reshaped 3.4.0 → 3.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -32
 - package/dist/bundle.css +1 -1
 - package/dist/bundle.js +11 -11
 - package/dist/cjs/cli/theming/index.js +0 -1
 - package/dist/cjs/themes/_generator/definitions/figma.d.ts +1 -1
 - package/dist/cjs/themes/_generator/definitions/figma.js +6 -5
 - package/dist/cjs/themes/_generator/utilities/color.js +11 -11
 - package/dist/cjs/themes/_generator/utilities/generateBackgroundColors.js +0 -2
 - package/dist/cjs/themes/_generator/utilities/generateColors.js +1 -1
 - package/dist/cjs/themes/_generator/utilities/generateUnits.js +0 -1
 - package/dist/cjs/themes/_generator/utilities/mergeDeep.js +1 -1
 - package/dist/cjs/themes/_generator/utilities/resolveTokenReference.js +2 -0
 - package/dist/cjs/themes/figma/tailwind.css +1 -1
 - package/dist/cjs/themes/figma/theme.css +1 -1
 - package/dist/cli/theming/index.js +0 -1
 - package/dist/components/Actionable/Actionable.js +2 -0
 - package/dist/components/Autocomplete/Autocomplete.js +1 -0
 - package/dist/components/Calendar/Calendar.module.css +1 -1
 - package/dist/components/Calendar/Calendar.types.d.ts +4 -4
 - package/dist/components/Calendar/CalendarControlled.js +2 -2
 - package/dist/components/Calendar/CalendarDate.js +29 -11
 - package/dist/components/Calendar/CalendarMonth.js +2 -6
 - package/dist/components/Calendar/tests/Calendar.stories.d.ts +19 -4
 - package/dist/components/Calendar/tests/Calendar.stories.js +237 -26
 - package/dist/components/Card/Card.d.ts +1 -1
 - package/dist/components/Card/Card.js +2 -4
 - package/dist/components/Card/tests/Card.stories.d.ts +1 -1
 - package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
 - package/dist/components/Carousel/Carousel.js +1 -2
 - package/dist/components/Carousel/Carousel.types.d.ts +1 -5
 - package/dist/components/Carousel/Carousel.types.js +1 -5
 - package/dist/components/Carousel/CarouselControl.js +2 -3
 - package/dist/components/FormControl/FormControl.context.d.ts +4 -0
 - package/dist/components/Grid/Grid.js +8 -2
 - package/dist/components/Icon/Icon.js +1 -3
 - package/dist/components/PinField/PinFieldControlled.js +0 -1
 - package/dist/components/Resizable/Resizable.js +1 -0
 - package/dist/components/Slider/SliderControlled.js +9 -3
 - package/dist/components/Stepper/Stepper.js +7 -2
 - package/dist/components/Tabs/TabsList.js +7 -3
 - package/dist/components/Text/Text.js +2 -4
 - package/dist/components/Timeline/Timeline.js +1 -1
 - package/dist/components/Toast/ToastProvider.js +8 -4
 - package/dist/components/View/View.js +10 -5
 - package/dist/components/_private/Flyout/FlyoutContent.js +1 -1
 - package/dist/components/_private/Flyout/FlyoutTrigger.js +1 -1
 - package/dist/components/_private/Flyout/useFlyout.js +3 -1
 - package/dist/components/_private/Portal/Portal.d.ts +1 -1
 - package/dist/config/tailwind.d.ts +1 -1
 - package/dist/hooks/_private/useOnClickOutside.d.ts +1 -1
 - package/dist/hooks/_private/useOnClickOutside.js +26 -10
 - package/dist/hooks/_private/useSingletonHotkeys.js +2 -0
 - package/dist/hooks/useResponsiveClientValue.d.ts +1 -1
 - package/dist/themes/_generator/definitions/figma.d.ts +1 -1
 - package/dist/themes/_generator/definitions/figma.js +6 -5
 - package/dist/themes/_generator/utilities/color.js +11 -11
 - package/dist/themes/_generator/utilities/generateBackgroundColors.js +0 -2
 - package/dist/themes/_generator/utilities/generateColors.js +1 -1
 - package/dist/themes/_generator/utilities/generateUnits.js +0 -1
 - package/dist/themes/_generator/utilities/mergeDeep.js +1 -1
 - package/dist/themes/_generator/utilities/resolveTokenReference.js +2 -0
 - package/dist/themes/figma/tailwind.css +1 -1
 - package/dist/themes/figma/theme.css +1 -1
 - package/dist/types/global.d.ts +2 -2
 - package/dist/utilities/helpers.js +4 -1
 - package/dist/utilities/platform.js +1 -0
 - package/package.json +36 -40
 - package/dist/components/Calendar/tests/Calendar.test.stories.d.ts +0 -26
 - package/dist/components/Calendar/tests/Calendar.test.stories.js +0 -161
 
    
        package/package.json
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            {
         
     | 
| 
       2 
2 
     | 
    
         
             
            	"name": "reshaped",
         
     | 
| 
       3 
3 
     | 
    
         
             
            	"description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
         
     | 
| 
       4 
     | 
    
         
            -
            	"version": "3.4. 
     | 
| 
      
 4 
     | 
    
         
            +
            	"version": "3.4.2",
         
     | 
| 
       5 
5 
     | 
    
         
             
            	"license": "MIT",
         
     | 
| 
       6 
6 
     | 
    
         
             
            	"email": "hello@reshaped.so",
         
     | 
| 
       7 
7 
     | 
    
         
             
            	"homepage": "https://reshaped.so",
         
     | 
| 
         @@ -95,62 +95,58 @@ 
     | 
|
| 
       95 
95 
     | 
    
         
             
            		"defaults and not IE 11"
         
     | 
| 
       96 
96 
     | 
    
         
             
            	],
         
     | 
| 
       97 
97 
     | 
    
         
             
            	"devDependencies": {
         
     | 
| 
       98 
     | 
    
         
            -
            		"@commitlint/cli": "19. 
     | 
| 
       99 
     | 
    
         
            -
            		"@commitlint/config-conventional": "19. 
     | 
| 
       100 
     | 
    
         
            -
            		"@commitlint/types": "19. 
     | 
| 
       101 
     | 
    
         
            -
            		"@eslint/js": "9. 
     | 
| 
      
 98 
     | 
    
         
            +
            		"@commitlint/cli": "19.8.0",
         
     | 
| 
      
 99 
     | 
    
         
            +
            		"@commitlint/config-conventional": "19.8.0",
         
     | 
| 
      
 100 
     | 
    
         
            +
            		"@commitlint/types": "19.8.0",
         
     | 
| 
      
 101 
     | 
    
         
            +
            		"@eslint/js": "9.23.0",
         
     | 
| 
       102 
102 
     | 
    
         
             
            		"@size-limit/preset-big-lib": "11.2.0",
         
     | 
| 
       103 
     | 
    
         
            -
            		"@storybook/addon-a11y": "8.6. 
     | 
| 
       104 
     | 
    
         
            -
            		"@storybook/addon-actions": "8.6. 
     | 
| 
       105 
     | 
    
         
            -
            		"@storybook/addon-controls": "8.6. 
     | 
| 
       106 
     | 
    
         
            -
            		"@storybook/addon-docs": "8.6. 
     | 
| 
       107 
     | 
    
         
            -
            		"@storybook/addon-storysource": "8.6. 
     | 
| 
       108 
     | 
    
         
            -
            		"@storybook/experimental-addon-test": "8.6. 
     | 
| 
       109 
     | 
    
         
            -
            		"@storybook/react": "8.6. 
     | 
| 
       110 
     | 
    
         
            -
            		"@storybook/react-vite": "8.6. 
     | 
| 
      
 103 
     | 
    
         
            +
            		"@storybook/addon-a11y": "8.6.8",
         
     | 
| 
      
 104 
     | 
    
         
            +
            		"@storybook/addon-actions": "8.6.8",
         
     | 
| 
      
 105 
     | 
    
         
            +
            		"@storybook/addon-controls": "8.6.8",
         
     | 
| 
      
 106 
     | 
    
         
            +
            		"@storybook/addon-docs": "8.6.8",
         
     | 
| 
      
 107 
     | 
    
         
            +
            		"@storybook/addon-storysource": "8.6.8",
         
     | 
| 
      
 108 
     | 
    
         
            +
            		"@storybook/experimental-addon-test": "8.6.8",
         
     | 
| 
      
 109 
     | 
    
         
            +
            		"@storybook/react": "8.6.8",
         
     | 
| 
      
 110 
     | 
    
         
            +
            		"@storybook/react-vite": "8.6.8",
         
     | 
| 
       111 
111 
     | 
    
         
             
            		"@types/culori": "2.1.1",
         
     | 
| 
       112 
112 
     | 
    
         
             
            		"@types/events": "3.0.3",
         
     | 
| 
       113 
     | 
    
         
            -
            		"@types/node": "22.13. 
     | 
| 
       114 
     | 
    
         
            -
            		"@types/react": "19.0. 
     | 
| 
      
 113 
     | 
    
         
            +
            		"@types/node": "22.13.11",
         
     | 
| 
      
 114 
     | 
    
         
            +
            		"@types/react": "19.0.12",
         
     | 
| 
       115 
115 
     | 
    
         
             
            		"@types/react-dom": "19.0.4",
         
     | 
| 
       116 
     | 
    
         
            -
            		"@typescript-eslint/eslint-plugin": "7.18.0",
         
     | 
| 
       117 
     | 
    
         
            -
            		"@typescript-eslint/parser": "7.18.0",
         
     | 
| 
       118 
116 
     | 
    
         
             
            		"@vitejs/plugin-react": "4.3.4",
         
     | 
| 
       119 
     | 
    
         
            -
            		"@vitest/browser": "3.0. 
     | 
| 
       120 
     | 
    
         
            -
            		"@vitest/coverage-istanbul": "3.0. 
     | 
| 
       121 
     | 
    
         
            -
            		"@vitest/coverage-v8": "3.0. 
     | 
| 
       122 
     | 
    
         
            -
            		"chromatic": "11. 
     | 
| 
      
 117 
     | 
    
         
            +
            		"@vitest/browser": "3.0.9",
         
     | 
| 
      
 118 
     | 
    
         
            +
            		"@vitest/coverage-istanbul": "3.0.9",
         
     | 
| 
      
 119 
     | 
    
         
            +
            		"@vitest/coverage-v8": "3.0.9",
         
     | 
| 
      
 120 
     | 
    
         
            +
            		"chromatic": "11.27.0",
         
     | 
| 
       123 
121 
     | 
    
         
             
            		"cz-conventional-changelog": "3.3.0",
         
     | 
| 
       124 
     | 
    
         
            -
            		"eslint": " 
     | 
| 
       125 
     | 
    
         
            -
            		"eslint-config-prettier": " 
     | 
| 
       126 
     | 
    
         
            -
            		"eslint-plugin-import": "2.31.0",
         
     | 
| 
      
 122 
     | 
    
         
            +
            		"eslint": "9.23.0",
         
     | 
| 
      
 123 
     | 
    
         
            +
            		"eslint-config-prettier": "10.1.1",
         
     | 
| 
       127 
124 
     | 
    
         
             
            		"eslint-plugin-jsx-a11y": "6.10.2",
         
     | 
| 
       128 
     | 
    
         
            -
            		"eslint-plugin-prettier": "5.2. 
     | 
| 
       129 
     | 
    
         
            -
            		"eslint-plugin-react": "7.37. 
     | 
| 
       130 
     | 
    
         
            -
            		"eslint-plugin-react-hooks": "5. 
     | 
| 
       131 
     | 
    
         
            -
            		" 
     | 
| 
       132 
     | 
    
         
            -
            		" 
     | 
| 
       133 
     | 
    
         
            -
            		"playwright": "1.50.1",
         
     | 
| 
      
 125 
     | 
    
         
            +
            		"eslint-plugin-prettier": "5.2.3",
         
     | 
| 
      
 126 
     | 
    
         
            +
            		"eslint-plugin-react": "7.37.4",
         
     | 
| 
      
 127 
     | 
    
         
            +
            		"eslint-plugin-react-hooks": "5.2.0",
         
     | 
| 
      
 128 
     | 
    
         
            +
            		"lefthook": "1.11.3",
         
     | 
| 
      
 129 
     | 
    
         
            +
            		"playwright": "1.51.1",
         
     | 
| 
       134 
130 
     | 
    
         
             
            		"postcss": "8.5.3",
         
     | 
| 
       135 
     | 
    
         
            -
            		"postcss-cli": "11.0. 
     | 
| 
      
 131 
     | 
    
         
            +
            		"postcss-cli": "11.0.1",
         
     | 
| 
       136 
132 
     | 
    
         
             
            		"postcss-each": "1.1.0",
         
     | 
| 
       137 
133 
     | 
    
         
             
            		"postcss-nested": "7.0.2",
         
     | 
| 
       138 
     | 
    
         
            -
            		"prettier": "3.5. 
     | 
| 
      
 134 
     | 
    
         
            +
            		"prettier": "3.5.3",
         
     | 
| 
       139 
135 
     | 
    
         
             
            		"react": "18",
         
     | 
| 
       140 
136 
     | 
    
         
             
            		"react-dom": "18",
         
     | 
| 
       141 
     | 
    
         
            -
            		"react-shadow": "20. 
     | 
| 
      
 137 
     | 
    
         
            +
            		"react-shadow": "20.6.0",
         
     | 
| 
       142 
138 
     | 
    
         
             
            		"resolve-tspaths": "0.8.23",
         
     | 
| 
       143 
139 
     | 
    
         
             
            		"size-limit": "11.2.0",
         
     | 
| 
       144 
     | 
    
         
            -
            		"storybook": "8.6. 
     | 
| 
       145 
     | 
    
         
            -
            		"stylelint": "16. 
     | 
| 
      
 140 
     | 
    
         
            +
            		"storybook": "8.6.8",
         
     | 
| 
      
 141 
     | 
    
         
            +
            		"stylelint": "16.16.0",
         
     | 
| 
       146 
142 
     | 
    
         
             
            		"stylelint-config-prettier": "9.0.5",
         
     | 
| 
       147 
143 
     | 
    
         
             
            		"stylelint-config-standard": "37.0.0",
         
     | 
| 
       148 
144 
     | 
    
         
             
            		"ts-node": "10.9.2",
         
     | 
| 
       149 
     | 
    
         
            -
            		"typescript": "5. 
     | 
| 
       150 
     | 
    
         
            -
            		"typescript-eslint": "8. 
     | 
| 
       151 
     | 
    
         
            -
            		"vite": "6.2. 
     | 
| 
      
 145 
     | 
    
         
            +
            		"typescript": "5.8.2",
         
     | 
| 
      
 146 
     | 
    
         
            +
            		"typescript-eslint": "8.27.0",
         
     | 
| 
      
 147 
     | 
    
         
            +
            		"vite": "6.2.2",
         
     | 
| 
       152 
148 
     | 
    
         
             
            		"vite-tsconfig-paths": "5.1.4",
         
     | 
| 
       153 
     | 
    
         
            -
            		"vitest": "3.0. 
     | 
| 
      
 149 
     | 
    
         
            +
            		"vitest": "3.0.9",
         
     | 
| 
       154 
150 
     | 
    
         
             
            		"vitest-browser-react": "0.1.1"
         
     | 
| 
       155 
151 
     | 
    
         
             
            	},
         
     | 
| 
       156 
152 
     | 
    
         
             
            	"peerDependencies": {
         
     | 
| 
         @@ -161,7 +157,7 @@ 
     | 
|
| 
       161 
157 
     | 
    
         
             
            	"dependencies": {
         
     | 
| 
       162 
158 
     | 
    
         
             
            		"@csstools/postcss-global-data": "3.0.0",
         
     | 
| 
       163 
159 
     | 
    
         
             
            		"chalk": "4.1.2",
         
     | 
| 
       164 
     | 
    
         
            -
            		"commander": " 
     | 
| 
      
 160 
     | 
    
         
            +
            		"commander": "13.1.0",
         
     | 
| 
       165 
161 
     | 
    
         
             
            		"cssnano": "7.0.6",
         
     | 
| 
       166 
162 
     | 
    
         
             
            		"csstype": "3.1.3",
         
     | 
| 
       167 
163 
     | 
    
         
             
            		"culori": "4.0.1",
         
     | 
| 
         @@ -1,26 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { StoryObj } from "@storybook/react";
         
     | 
| 
       2 
     | 
    
         
            -
            import { fn } from "@storybook/test";
         
     | 
| 
       3 
     | 
    
         
            -
            declare const _default: {
         
     | 
| 
       4 
     | 
    
         
            -
                title: string;
         
     | 
| 
       5 
     | 
    
         
            -
                component: (props: import("./..").CalendarProps) => import("react").JSX.Element;
         
     | 
| 
       6 
     | 
    
         
            -
                parameters: {
         
     | 
| 
       7 
     | 
    
         
            -
                    iframe: {
         
     | 
| 
       8 
     | 
    
         
            -
                        url: string;
         
     | 
| 
       9 
     | 
    
         
            -
                    };
         
     | 
| 
       10 
     | 
    
         
            -
                    chromatic: {
         
     | 
| 
       11 
     | 
    
         
            -
                        disableSnapshot: boolean;
         
     | 
| 
       12 
     | 
    
         
            -
                    };
         
     | 
| 
       13 
     | 
    
         
            -
                };
         
     | 
| 
       14 
     | 
    
         
            -
            };
         
     | 
| 
       15 
     | 
    
         
            -
            export default _default;
         
     | 
| 
       16 
     | 
    
         
            -
            export declare const base: StoryObj;
         
     | 
| 
       17 
     | 
    
         
            -
            export declare const onChange: StoryObj<{
         
     | 
| 
       18 
     | 
    
         
            -
                handleChange: ReturnType<typeof fn>;
         
     | 
| 
       19 
     | 
    
         
            -
            }>;
         
     | 
| 
       20 
     | 
    
         
            -
            export declare const defaultValue: StoryObj;
         
     | 
| 
       21 
     | 
    
         
            -
            export declare const value: StoryObj;
         
     | 
| 
       22 
     | 
    
         
            -
            export declare const range: StoryObj;
         
     | 
| 
       23 
     | 
    
         
            -
            export declare const minMax: StoryObj;
         
     | 
| 
       24 
     | 
    
         
            -
            export declare const monthSelection: StoryObj;
         
     | 
| 
       25 
     | 
    
         
            -
            export declare const ariaLabels: StoryObj;
         
     | 
| 
       26 
     | 
    
         
            -
            export declare const keyboardNavigation: StoryObj;
         
     | 
| 
         @@ -1,161 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { expect, userEvent, fn } from "@storybook/test";
         
     | 
| 
       2 
     | 
    
         
            -
            import Calendar from "../index.js";
         
     | 
| 
       3 
     | 
    
         
            -
            export default {
         
     | 
| 
       4 
     | 
    
         
            -
                title: "Components/Calendar/tests",
         
     | 
| 
       5 
     | 
    
         
            -
                component: Calendar,
         
     | 
| 
       6 
     | 
    
         
            -
                parameters: {
         
     | 
| 
       7 
     | 
    
         
            -
                    iframe: {
         
     | 
| 
       8 
     | 
    
         
            -
                        url: "https://reshaped.so/docs/components/calendar",
         
     | 
| 
       9 
     | 
    
         
            -
                    },
         
     | 
| 
       10 
     | 
    
         
            -
                    chromatic: { disableSnapshot: true },
         
     | 
| 
       11 
     | 
    
         
            -
                },
         
     | 
| 
       12 
     | 
    
         
            -
            };
         
     | 
| 
       13 
     | 
    
         
            -
            export const base = {
         
     | 
| 
       14 
     | 
    
         
            -
                name: "base",
         
     | 
| 
       15 
     | 
    
         
            -
                render: () => <Calendar defaultMonth={new Date(2020, 0, 1)}/>,
         
     | 
| 
       16 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       17 
     | 
    
         
            -
                    const monthTitleEl = canvas.getByText("January 2020");
         
     | 
| 
       18 
     | 
    
         
            -
                    const gridEl = canvas.getByRole("grid");
         
     | 
| 
       19 
     | 
    
         
            -
                    const gridCellEls = canvas.getAllByRole("gridcell");
         
     | 
| 
       20 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       21 
     | 
    
         
            -
                    const buttonEls = canvas.getAllByRole("button");
         
     | 
| 
       22 
     | 
    
         
            -
                    expect(monthTitleEl).toBeInTheDocument();
         
     | 
| 
       23 
     | 
    
         
            -
                    expect(gridEl).toBeInTheDocument();
         
     | 
| 
       24 
     | 
    
         
            -
                    expect(gridCellEls).toHaveLength(31);
         
     | 
| 
       25 
     | 
    
         
            -
                    expect(dateEls).toHaveLength(31);
         
     | 
| 
       26 
     | 
    
         
            -
                    expect(dateEls[0].getAttribute("aria-label")).toBe("Wednesday, January 1");
         
     | 
| 
       27 
     | 
    
         
            -
                    expect(dateEls[0]).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       28 
     | 
    
         
            -
                    expect(dateEls[1]).toHaveAttribute("tabIndex", "-1");
         
     | 
| 
       29 
     | 
    
         
            -
                    // Previous month button
         
     | 
| 
       30 
     | 
    
         
            -
                    expect(buttonEls[0].getAttribute("aria-label")).toBe("Previous month");
         
     | 
| 
       31 
     | 
    
         
            -
                    // Month select button
         
     | 
| 
       32 
     | 
    
         
            -
                    expect(buttonEls[1].innerHTML).toContain("Select a month");
         
     | 
| 
       33 
     | 
    
         
            -
                    // Next month button
         
     | 
| 
       34 
     | 
    
         
            -
                    expect(buttonEls[2].getAttribute("aria-label")).toBe("Next month");
         
     | 
| 
       35 
     | 
    
         
            -
                },
         
     | 
| 
       36 
     | 
    
         
            -
            };
         
     | 
| 
       37 
     | 
    
         
            -
            export const onChange = {
         
     | 
| 
       38 
     | 
    
         
            -
                name: "onChange",
         
     | 
| 
       39 
     | 
    
         
            -
                args: {
         
     | 
| 
       40 
     | 
    
         
            -
                    handleChange: fn(),
         
     | 
| 
       41 
     | 
    
         
            -
                },
         
     | 
| 
       42 
     | 
    
         
            -
                render: (args) => <Calendar defaultMonth={new Date(2020, 0)} onChange={args.handleChange}/>,
         
     | 
| 
       43 
     | 
    
         
            -
                play: async ({ canvas, args }) => {
         
     | 
| 
       44 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       45 
     | 
    
         
            -
                    await userEvent.click(dateEls[1]);
         
     | 
| 
       46 
     | 
    
         
            -
                    expect(args.handleChange).toHaveBeenCalledTimes(1);
         
     | 
| 
       47 
     | 
    
         
            -
                    // TODO: https://github.com/storybookjs/storybook/issues/30503
         
     | 
| 
       48 
     | 
    
         
            -
                    // expect(args.handleChange).toHaveBeenCalledWith({ value: new Date(2020, 0, 2) });
         
     | 
| 
       49 
     | 
    
         
            -
                },
         
     | 
| 
       50 
     | 
    
         
            -
            };
         
     | 
| 
       51 
     | 
    
         
            -
            export const defaultValue = {
         
     | 
| 
       52 
     | 
    
         
            -
                name: "defaultValue",
         
     | 
| 
       53 
     | 
    
         
            -
                render: () => <Calendar defaultMonth={new Date(2020, 0)} defaultValue={new Date(2020, 0, 5)}/>,
         
     | 
| 
       54 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       55 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       56 
     | 
    
         
            -
                    const selectedDateEl = dateEls[4];
         
     | 
| 
       57 
     | 
    
         
            -
                    expect(selectedDateEl).toBeInTheDocument();
         
     | 
| 
       58 
     | 
    
         
            -
                    expect(selectedDateEl).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       59 
     | 
    
         
            -
                    expect(selectedDateEl).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       60 
     | 
    
         
            -
                    await userEvent.click(dateEls[6], { delay: null });
         
     | 
| 
       61 
     | 
    
         
            -
                    expect(dateEls[6]).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       62 
     | 
    
         
            -
                },
         
     | 
| 
       63 
     | 
    
         
            -
            };
         
     | 
| 
       64 
     | 
    
         
            -
            export const value = {
         
     | 
| 
       65 
     | 
    
         
            -
                name: "value",
         
     | 
| 
       66 
     | 
    
         
            -
                render: () => <Calendar defaultMonth={new Date(2020, 0)} value={new Date(2020, 0, 5)}/>,
         
     | 
| 
       67 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       68 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       69 
     | 
    
         
            -
                    const selectedDateEl = dateEls[4];
         
     | 
| 
       70 
     | 
    
         
            -
                    expect(selectedDateEl).toBeInTheDocument();
         
     | 
| 
       71 
     | 
    
         
            -
                    expect(selectedDateEl).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       72 
     | 
    
         
            -
                    expect(selectedDateEl).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       73 
     | 
    
         
            -
                    await userEvent.click(dateEls[6], { delay: null });
         
     | 
| 
       74 
     | 
    
         
            -
                    expect(dateEls[6]).toHaveAttribute("aria-checked", "false");
         
     | 
| 
       75 
     | 
    
         
            -
                },
         
     | 
| 
       76 
     | 
    
         
            -
            };
         
     | 
| 
       77 
     | 
    
         
            -
            export const range = {
         
     | 
| 
       78 
     | 
    
         
            -
                name: "defaultValue, range",
         
     | 
| 
       79 
     | 
    
         
            -
                render: () => (<Calendar defaultMonth={new Date(2020, 0)} range defaultValue={{ start: new Date(2020, 0, 5), end: new Date(2020, 0, 7) }}/>),
         
     | 
| 
       80 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       81 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       82 
     | 
    
         
            -
                    const startDateEl = dateEls[4];
         
     | 
| 
       83 
     | 
    
         
            -
                    const endDateEl = dateEls[6];
         
     | 
| 
       84 
     | 
    
         
            -
                    expect(startDateEl).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       85 
     | 
    
         
            -
                    expect(startDateEl).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       86 
     | 
    
         
            -
                    expect(endDateEl).toHaveAttribute("tabIndex", "-1");
         
     | 
| 
       87 
     | 
    
         
            -
                    expect(endDateEl).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       88 
     | 
    
         
            -
                    await userEvent.click(dateEls[3], { delay: null });
         
     | 
| 
       89 
     | 
    
         
            -
                    expect(dateEls[3]).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       90 
     | 
    
         
            -
                    expect(dateEls[3]).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       91 
     | 
    
         
            -
                    expect(startDateEl).toHaveAttribute("aria-checked", "false");
         
     | 
| 
       92 
     | 
    
         
            -
                    expect(startDateEl).toHaveAttribute("tabIndex", "-1");
         
     | 
| 
       93 
     | 
    
         
            -
                    expect(endDateEl).toHaveAttribute("aria-checked", "false");
         
     | 
| 
       94 
     | 
    
         
            -
                    expect(endDateEl).toHaveAttribute("tabIndex", "-1");
         
     | 
| 
       95 
     | 
    
         
            -
                    // Click before the start date
         
     | 
| 
       96 
     | 
    
         
            -
                    await userEvent.click(dateEls[2], { delay: null });
         
     | 
| 
       97 
     | 
    
         
            -
                    expect(dateEls[2]).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       98 
     | 
    
         
            -
                    expect(dateEls[2]).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       99 
     | 
    
         
            -
                    expect(dateEls[3]).toHaveAttribute("aria-checked", "false");
         
     | 
| 
       100 
     | 
    
         
            -
                    expect(dateEls[3]).toHaveAttribute("tabIndex", "-1");
         
     | 
| 
       101 
     | 
    
         
            -
                    await userEvent.click(dateEls[4], { delay: null });
         
     | 
| 
       102 
     | 
    
         
            -
                    expect(dateEls[2]).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       103 
     | 
    
         
            -
                    expect(dateEls[2]).toHaveAttribute("tabIndex", "0");
         
     | 
| 
       104 
     | 
    
         
            -
                    expect(dateEls[4]).toHaveAttribute("aria-checked", "true");
         
     | 
| 
       105 
     | 
    
         
            -
                    expect(dateEls[4]).toHaveAttribute("tabIndex", "-1");
         
     | 
| 
       106 
     | 
    
         
            -
                },
         
     | 
| 
       107 
     | 
    
         
            -
            };
         
     | 
| 
       108 
     | 
    
         
            -
            export const minMax = {
         
     | 
| 
       109 
     | 
    
         
            -
                name: "min, max",
         
     | 
| 
       110 
     | 
    
         
            -
                render: () => (<Calendar min={new Date(2020, 0, 5)} max={new Date(2020, 0, 25)} defaultMonth={new Date(2020, 0)}/>),
         
     | 
| 
       111 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       112 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       113 
     | 
    
         
            -
                    expect(dateEls).toHaveLength(21);
         
     | 
| 
       114 
     | 
    
         
            -
                },
         
     | 
| 
       115 
     | 
    
         
            -
            };
         
     | 
| 
       116 
     | 
    
         
            -
            export const monthSelection = {
         
     | 
| 
       117 
     | 
    
         
            -
                name: "month selection",
         
     | 
| 
       118 
     | 
    
         
            -
                render: () => <Calendar defaultMonth={new Date(2020, 0)}/>,
         
     | 
| 
       119 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       120 
     | 
    
         
            -
                    const buttonEls = canvas.getAllByRole("button");
         
     | 
| 
       121 
     | 
    
         
            -
                    await userEvent.click(buttonEls[1], { delay: null });
         
     | 
| 
       122 
     | 
    
         
            -
                    const monthEls = canvas.getAllByRole("button").filter((el) => el.hasAttribute("data-rs-date"));
         
     | 
| 
       123 
     | 
    
         
            -
                    expect(monthEls).toHaveLength(12);
         
     | 
| 
       124 
     | 
    
         
            -
                },
         
     | 
| 
       125 
     | 
    
         
            -
            };
         
     | 
| 
       126 
     | 
    
         
            -
            export const ariaLabels = {
         
     | 
| 
       127 
     | 
    
         
            -
                name: "aria labels",
         
     | 
| 
       128 
     | 
    
         
            -
                render: () => (<Calendar defaultMonth={new Date(2020, 0)} nextYearAriaLabel="Test next year" nextMonthAriaLabel="Test next month" renderDateAriaLabel={() => "Test date"} renderMonthAriaLabel={() => "Test month"} previousYearAriaLabel="Test previous year" previousMonthAriaLabel="Test previous month" monthSelectionAriaLabel="Test month selection"/>),
         
     | 
| 
       129 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       130 
     | 
    
         
            -
                    const buttonEls = canvas.getAllByRole("button");
         
     | 
| 
       131 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       132 
     | 
    
         
            -
                    expect(buttonEls[0]).toHaveAttribute("aria-label", "Test previous month");
         
     | 
| 
       133 
     | 
    
         
            -
                    expect(buttonEls[1]).toHaveTextContent("Test month selection");
         
     | 
| 
       134 
     | 
    
         
            -
                    expect(buttonEls[2]).toHaveAttribute("aria-label", "Test next month");
         
     | 
| 
       135 
     | 
    
         
            -
                    expect(dateEls[0]).toHaveAttribute("aria-label", "Test date");
         
     | 
| 
       136 
     | 
    
         
            -
                    await userEvent.click(buttonEls[1], { delay: null });
         
     | 
| 
       137 
     | 
    
         
            -
                    const yearButtonEls = canvas.getAllByRole("button");
         
     | 
| 
       138 
     | 
    
         
            -
                    expect(yearButtonEls[0]).toHaveAttribute("aria-label", "Test previous year");
         
     | 
| 
       139 
     | 
    
         
            -
                    expect(yearButtonEls[1]).toHaveAttribute("aria-label", "Test next year");
         
     | 
| 
       140 
     | 
    
         
            -
                    expect(yearButtonEls[2]).toHaveAttribute("aria-label", "Test month");
         
     | 
| 
       141 
     | 
    
         
            -
                },
         
     | 
| 
       142 
     | 
    
         
            -
            };
         
     | 
| 
       143 
     | 
    
         
            -
            export const keyboardNavigation = {
         
     | 
| 
       144 
     | 
    
         
            -
                name: "keyboard navigation",
         
     | 
| 
       145 
     | 
    
         
            -
                render: () => <Calendar defaultMonth={new Date(2020, 0)}/>,
         
     | 
| 
       146 
     | 
    
         
            -
                play: async ({ canvas }) => {
         
     | 
| 
       147 
     | 
    
         
            -
                    const user = userEvent.setup();
         
     | 
| 
       148 
     | 
    
         
            -
                    const dateEls = canvas.getAllByRole("checkbox");
         
     | 
| 
       149 
     | 
    
         
            -
                    dateEls[0].focus();
         
     | 
| 
       150 
     | 
    
         
            -
                    await user.keyboard("{ArrowRight/}");
         
     | 
| 
       151 
     | 
    
         
            -
                    expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-02");
         
     | 
| 
       152 
     | 
    
         
            -
                    await user.keyboard("{ArrowLeft/}");
         
     | 
| 
       153 
     | 
    
         
            -
                    expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-01");
         
     | 
| 
       154 
     | 
    
         
            -
                    await user.keyboard("{ArrowDown/}");
         
     | 
| 
       155 
     | 
    
         
            -
                    expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-08");
         
     | 
| 
       156 
     | 
    
         
            -
                    await user.keyboard("{ArrowUp/}");
         
     | 
| 
       157 
     | 
    
         
            -
                    expect(document.activeElement).toHaveAttribute("data-rs-date", "2020-01-01");
         
     | 
| 
       158 
     | 
    
         
            -
                    await user.keyboard("{ArrowUp/}");
         
     | 
| 
       159 
     | 
    
         
            -
                    expect(document.activeElement).toHaveAttribute("data-rs-date", "2019-12-25");
         
     | 
| 
       160 
     | 
    
         
            -
                },
         
     | 
| 
       161 
     | 
    
         
            -
            };
         
     |