reshaped

Community repository for storing examples, reporting issues and tracking roadmap

Downloads
8.5K
Stars
90
Committers
1
reshaped - v2.11.0 Latest Release

Published by blvdmitry 6 months ago

Full web changelog · Documentation

npm install reshaped

PinField component

<FormControl>
  <FormControl.Label>Pin code</FormControl.Label>
  <PinField name="pin" defaultValue="2543" />
</FormControl>

We've added a new PinField component for handling one-time passwords and other numeric or alphabetic codes.
It works based on a native input element, supports controlled/uncontrolled modes and has an extensive keyboard support for managing the input focus and selection.

Toast boundaries

Based on the community request, we have added Toast rendering boundaries.
Anywhere in your application, you can wrap an area with a separate ToastProvider to make notifications render based on that area boundaries.

function Boundary() {
  const ChildComponent = () => {
    const toast = useToast();

    return (
      <Button
        onClick={() => {
          toast.show({
            text: "Notification sent",
          });
        }}
      >
        Show notification
      </Button>
    );
  };

  return (
    <View backgroundColor="neutral-faded" padding={10} width="600px" maxWidth="100%" borderRadius="medium">
      <ToastProvider>
        <ChildComponent />
      </ToastProvider>
    </View>
  );
}

Other improvements

  • Updated Commitlint, Storybook and Chromatic to the latest major versions
  • Fixed a build error caused the FormControl files naming when working with Vite
  • Updated Vite integration guide #238
  • Actionable: improved the form submission logic for the submit type buttons with a custom onClick
  • Breadcrumbs: added a disabledExpand property to render static breadcrumbs inside other clickable elements #227
  • Calendar: fixed edge cases of assigning the correct tabIndex to the day cells
  • Card: improved the padding logic to include the border width into its calculations
  • DropdownMenu: simplified the handling of keyboard and mouse click events combination
  • Modal: added overlayClassName property #229
  • Modal: improved the scrollable content handling when using swipe-to-close functionality #242
  • Pagination: added tabular number styles to avoid the page button size changes during navigation
  • Slider: added tabular number styles to avoid the tooltip size changes
  • Slider: added float values rounding #228
  • Table: removed content wrapping for the cells using the auto width
  • Tabs: added smooth transition for the Tab list fades whenever it doesn't fit into the viewport
  • Tabs: improved the selection element transition
  • Tabs: updated the triggers font-weight to medium to match other clickable elements
  • TextField: removed focus-within styles from the root elements whenever a button is focused in one of its slots
  • View: fixed dividers rendering incorrectly when nested inside React.Fragment #226
  • View: improved the padding logic to include the border width into its calculations
  • useHotkeys: added a disabled option to control the hotkeys availability based on your local state
  • useHotkeys: added a preventDefault option to automatically prevent the default behavior of the binded hotkeys
  • useHotkeys: improved the cleanup of the triggered hotkeys when pressing the meta key
reshaped - v2.10.0

Published by blvdmitry 6 months ago

Full web changelog · Documentation

npm install reshaped

Pagination component

We've added a new component to help users navigate across multiple pages of content.
It automatically truncates the pages, handles accessility including focus management and provides controlled as well as uncontrolled behavior to make sure you can connect it to your custom application logic.

<Pagination total={10} previousAriaLabel="Back" nextAriaLabel="Forward" />

Theme sync with Figma

While we have aligned components and design tokens implementations in Figma and in React, syncing custom themes across both platforms was always a manual process.
With the introduction of theming generation, we've automated a part of the theming process and in this release we're adding the missing piece.

We've released a new version of our Figma plugin that now lets you upload the json output from your theme in code and generate a Figma style and variables library automatically.
We're planning to keep evolving this functionality with the upcoming improvements for the Figma variables support and general announcements that will happen during the Figma Config this summer.

Blog starter package

Ever wanted to start your own development blog but then you find yourself spending weeks to build a front-end application for that?
We've created a new blog example using Reshaped but this time we've also published it as an NPM package and open-sourced it.

Besides checking how Reshaped can be used in your own project, you can use it for your own MDX and Next.js powered blog.
It gives you an amazing layout inspired by Brian Lovin's personal website, which is built using Reshaped, supports light and dark mode, completely accessible and responsive.

Other improvements

  • With the last few components css changes, we were able to switch Reshaped NPM package to use sideEffects: false by default which improves tree-shaking for the bundlers relying on this flag.
    This means that you will get full tree-shaking support for even more frameworks, including the CSS tree-shaking for components you don't use in your application.
  • Updated all internal dependencies for the source code setup
  • Updated Create React App guidelines with more details on how to enable custom media queries support
  • Added json file output during theme generation
  • Actionable: Moved css reset to a css @layer with lower priority, making sure that css order gets resolved correctly during tree-shaking
  • Accordion: Fixed an error which caused product code calling Accordion to inlcude use client directive in RSC supporting frameworks
  • Accordion: Migrated height animation to CSS transitions without and JS calculations involved
  • BadgeContainer: Added pointer-events: none to the Badge used in BadgeContainer to avoid it blocking the trigger clicks
  • Button, Figma: Added min-width support for the text buttons
  • Button: Added as property support for nesting multiple clickable elements within each other
  • FormControl: Fixed an error which caused product code calling Accordion to inlcude use client directive in RSC supporting frameworks
  • MenuItem: Added as property support for nesting multiple clickable elements within each other
  • ScrollArea: Added overflow hidden to root element to prevent scrollbar thumb travelling outside the scrollable area in Safari
  • Slider: Added dynamic Tooltip positioning to always keep it inside the viewport and avoid causing page to scroll horizontally for tooltips with long labels
  • Table: Added cell verticalAlign support
  • Table: Removed border-radius in borderless tables for better composition with other components
  • Table: Fixed duplicated cell padding in borderless tables
  • Text: Added balance wrap support
reshaped - v2.9.0

Published by blvdmitry 9 months ago

Full web changelog · Documentation

npm install reshaped

ScrollArea utility

We're introducing a new ScrollArea utility which aligns the scrollbar styling across all platforms, while still relying on the native scrolling behavior.
It supports multiple display modes and supports both horizontal and vertical directions.

Besides the general style alignment, it can be useful for non-standard scrolling areas where displaying a native scrollbar can be too distractive on some platforms.
For example, it's perfect for navigation menus or smaller components with scrollable areas.

In this example, we're rendering it inside the Card with scrollbars shown on the area hover and scrolling in both directions:

<View width="300px">
  <Card height="200px" padding={0}>
    <ScrollArea scrollbarDisplay="hover">
      <View height="300px" width="150%" align="center" justify="center">
        Text content
      </View>
    </ScrollArea>
  </Card>
</View>

Improved Storybook setup

Based on the community request, we've improved out Storybook setup with the new addons:

  • Each story now display its source code with a storysource plugin
  • Most of the components now have an additional tab displaying auto-generated prop tables based on the current version of the source code you're using
  • In case you need more context about the component without leaving Storybook, we're also display each component latest documentation in an iframe

Together, these changes are aiming to improve the developer experience of teams working with our Storybook environment and provide additional contextual information about components in case they're staying on one of the previous versions of Reshaped.

Other improvements

  • Switched the TypeScript jsx build mode to react-jsx
  • Added support for radio inputs arrow navigation inside the areas with trapped focus
  • Added the page color background to <html> in addition to <body>
  • TextArea: Fixed placeholder color misalignment with TextFIeld
reshaped - v2.8.0

Published by blvdmitry 10 months ago

Full web changelog · Documentation

npm install reshaped

New color tokens

We are adding new color tokens: warning and brand.
Warning colors are used as a new role in between critical and positive colors, while brand colors can be used for brand assets as a standalone color different from primary colors.
With the new colors support we have introduced new colors for component like Badge and Progress.

If you're using your own themes, make sure to generate them again to include
new color tokens in the builders. If you're using a custom theme in Figma,
update its definition in the theming plugin you're using.

Application screen example

We have added a new example of the whole application screen built with Reshaped and its design is included in our Design license.
It features the whole page layout relying completely on the Reshaped components utilities, including its responsive behaviour and interactive components, like DropdownMenu or Toast.

Other improvements

  • PostCSS: Added getConfig() function to support viewport breakpoints theming
  • Badge, Figma: Exposed icon properties in Figma
  • Button: Added flex layout support for the button children
  • Button: Reduced the vertical padding to work with larger slots without stretching the button
  • Button, Figma: Extracted .button-content into a separate cmponent to improve the library performance and maintenance experience
  • Button, Figma: Added slot support
  • Icon: Fixed svg rendering error happening for icon components using prop-types
  • Icon: Added linear logo to the iconset in Figma
  • MenuItem: Fixed Tailwind CSS reset overriding button styles
  • Overlay: Fixed Tailwind CSS cursor override
  • Slot, Figma: Fixed slot overriding styles of the swapped components
  • Timeline, Figma: Fixed the content slot auto layout
  • View: added minWidth and minHeight support
  • View: added overflow auto support
reshaped - v2.7.0

Published by blvdmitry 11 months ago

Full web changelog · Documentation

npm install reshaped

Calendar component

<View width="320px">
  <Calendar />
</View>

We're adding a new Calendar component to work with single and range date selection.
It supports controlled / uncontrolled behavior, full keyboard navigation, localization, separate month selection and much more.

Like with every other component, we pay additional attention to how it can be composed with other components and we provide examples of how you can build a form input for the date selection.

Swipe events in Modal

We've introduced a new swipe behavior for Modal components on touch devices.
All Modals besides the center-positioned ones can now be closed with touch events and you can try it for yourself if you're on mobile device or simulate it in your dev tools:

function Example() {
  const { active, activate, deactivate } = useToggle(false);

  return (
    <>
      <Button onClick={activate}>Open modal</Button>
      <Modal active={active} onClose={deactivate} position="start">
        Modal content
      </Modal>
    </>
  );
}

Other improvements

  • Source code: Added GitHub actions setup
  • Themes: Updated on color generation algorithm to be more precise according to the wcag requirements
  • Themes: Added rgb variants for the border color tokens
  • Themes: Updated contrast edge cases to be handled based on the APCA formulas
  • Autocomplete: Fixed inputAttributes not applying correctly
  • Link: Fixed inherit color value for the iOS Safari edge cases
  • Modal: Improved the open/close transition effect
  • Overlay: Added number values support for the transparent property to manually control its progress
  • Slider: Removed the touch highlighting on mobile devices
  • Text: Updated maxLines to apply word-break when truncating a single line
  • Toast: Added className support
  • View: Updated documented to refer to the updated paddingInline and paddingBlock properties
reshaped - v2.6.0

Published by blvdmitry 11 months ago

Full web changelog · Documentation

npm install reshaped

FileUpload component

The new FileUpload component we're introducing is a flexible and easy-to-use tool for handling file attachments in forms. It's designed to be lightweight, leveraging our standard composition approach and give you complete control over the component's layout and appearance.

One of the key aspects of the FileUpload component is its compatibility with third-party libraries. For instance, integrating with react-dropzone is straightforward, enabling you to tap into its advanced file upload capabilities. This ensures that while the component itself remains simple and unopinionated, it doesn't limit your ability to implement more complex functionalities.

The component supports both click and drag events for file selection, making it user-friendly and adaptable to various user interactions. This approach aligns with our goal of providing components that are both powerful and easy to use, without imposing strict design or functional constraints.

Other improvements

  • Themes: added a way control individual "on" colors resolutions. Read more in the documentation.
  • Themes: improved baseThemeDefiniion typings
  • Breadcrumbs: fixed breadcrumbs rendering when used in React Server Components
  • Popover: fixed default render styles and updated transition effect for trigger width
  • Popover, DropdownMenu: added support for positioning inside the position: fixed parent
  • Select: fixed custom trigger start padding when used without slots
  • TextArea: added support for passing rows to inputAttributes
  • TextArea, TextField: updated onFocus and onBlur typings to use correct html element reference
reshaped - v2.5.0

Published by blvdmitry 12 months ago

Full web changelog · Documentation

npm install reshaped

Theme generation

Last time, we've introduced support for the runtime theming to let you create new themes right in your browser environment.
However, creating themes manually would mean that you still have to go through a long process of manually picking the values for all design tokens.

Finding right colors is definitely the hardest step in the process, so in v2.5 we're adding a new theme generation feature.
Now you can pass just your primary brand color and we'll generate a full set of color tokens required for theming, including dark mode values.
In case you want more granular control over certain colors, you still can pick different base colors for the critical, positive and neutral hues or even override individual token values.

To make sure your generated themes don't stay aligned with our default theme, we've updated some of the Reshaped theme values.
In case you're relying on the default Reshaped theme value, make sure to re-sync it in Figma.

Stepper component

<View width="500px" maxWidth="100%" gap={2}>
  <Stepper labelDisplay={{ s: "hidden", m: "inline" }} activeId={1}>
    <Stepper.Item completed title="Pick your plan" subtitle="Pro or hobby" />
    <Stepper.Item title="Contact info" />
    <Stepper.Item title="Payment" />
  </Stepper>
  <Hidden hide={{ s: false, m: true }}>
    <View direction="row" gap={4} justify="space-between">
      <Text weight="medium">Contact info</Text>
      <Text weight="medium">Step 2 of 3</Text>
    </View>
  </Hidden>
</View>

One of the requests we had was a component to control a multi-step process navigation, so we're introducing a new Stepper component in this release.
It includes support for row and column direction, as well as responsive visibility of the labels.
With all supported properties, you can easily compose and control the Stepper component according to the unique business logic of your product.

Other improvements

  • Figma: Fixed foreground-critical color style reference used in the colors preview
  • Theming: Added 0 value support for the shadow attributes
  • Theming: Fixed transitions staying disabled after setting the color mode to an already applied one

Accordion

  • Improved overflow handling on the accordion state change

Button

  • Renamed Button.Aligner position property to side. position is deprecated now but both properties will work until the next major release.

DropdownMenu

  • Added support for opening nested submenus with Enter and Space keys
  • Updated open and close transition effects

MenuItem

  • Added side support for the MenuItem.Aligner

Popover

  • Updated open and close transition effects

TextArea

  • Added TextField.Aligner utility for aligning the field value with other content on the page #180

TextField

  • Fixed width calculation bug in Safari that was causing field to grow on focus when it was centered #178
  • Fixed positioning of the native Chrome autocomplete #183
  • Added TextField.Aligner utility for aligning the field value with other content on the page #180

Tooltip

  • Updated open and close transition effects

View

  • Added static position support
  • Added automatic switching to the flexbox layout if any of the direct children are using grow property #185
reshaped - 2.4.0

Published by blvdmitry about 1 year ago

Full web changelog · Documentation

npm install reshaped

Table component

<View width="280px" maxWidth="100%">
  <Table border>
    <Table.Row highlighted>
      <Table.Heading>Product</Table.Heading>
      <Table.Heading align="end" width="auto">
        Price
      </Table.Heading>
    </Table.Row>
    <Table.Row>
      <Table.Cell>Coffee</Table.Cell>
      <Table.Cell align="end">$4</Table.Cell>
    </Table.Row>
    <Table.Row>
      <Table.Cell>Sandwich</Table.Cell>
      <Table.Cell align="end">$6.50</Table.Cell>
    </Table.Row>
  </Table>
</View>

We're adding a new Table component that provides common compound components for rendering individual table elements and gives you a lot of flexibility through composition.
This approach allows teams to build both, simple table with text content and rich tables with interactive content that are integrated with libraries like TanStack Table.

Theme previews

With the recent theming improvements, we're adding a new website page for previewing theme values on a real component examples.
This is a first step towards making it easier to create new themes.
In the upcoming releases, we're planning to expand its functionality with user interface for the runtime theme editing and theme values auto-generation.

Other improvements

  • Documentation: Updated website performance
  • Documentation: Added examples of working with theming settings based on user preferences and local storage before the React hydration

Button

  • Fixed margin value for the Button.Aligner used with ghost buttons

Card

  • Added selection transition

Checkbox

  • Added transition for the indeterminate state

Tabs

  • Added auto-scrolling when selecting items if Tabs.List is scrollable

View

  • Added space-between value for the justify property
reshaped - 2.3.1

Published by blvdmitry about 1 year ago

Full web changelog · Documentation

npm install reshaped

Focus trapping:
Fixed navigation edge cases for the hover trigger type causing the trap to be triggered without any focusable elements inside the flyout

reshaped - 2.3.0

Published by blvdmitry about 1 year ago

Full web changelog · Documentation

npm install reshaped

Runtime theming

We have added a new way to work with themes without building them using our CLI ahead of time.
With the new runtime theming feature, you can create new themes directly in the browser and insert them as a style tag, or create themes dynamically in Node.js and return css file contents.

Button group component

We're adding a new compound component for ButtonButton.Group, which lets you wrap any number of buttons to colocate multiple actions together.
It leverages the composition approach, which means you can combine items with other components like DropdownMenu.

Other improvements

  • Figma: Updated component style relations to improve the experience of switching color modes.
    Original issue is reported to the Figma team but let us know if you see any styles left that might be not respecting the mode without refreshing the page so we can patch those individual components.

Actionable

  • Fixed cases when onClick was triggered multiple times on Enter key press

Autocomplete

  • Added correct positioning support inside scrollable areas
  • Added trapFocus support for the dynamically rendered content

Checkbox

  • Removed default browser tap highlight on mobile devices

DropdownMenu

  • Added correct positioning support inside scrollable areas
  • Added trapFocus support for the dynamically rendered content

Popover

  • Added correct positioning support inside scrollable areas
  • Added trapFocus support for the dynamically rendered content

Radio

  • Removed default browser tap highlight on mobile devices

Select

  • Fixed the color of the chevron icon when using the disabled state

Switch

  • Removed default browser tap highlight on mobile devices

Tabs

  • Added support for wrapping Tabs.Item with framework router link components and other custom wrappers
  • Added href support for Tabs.Item
  • Added attributes support for Tabs.Item

Toast

  • Fixed an edge case when toast.hide is called immediately after toast was triggered