reshaped 3.3.12 → 3.4.0-rc.0

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.d.ts +4 -1
  4. package/dist/bundle.js +11 -11
  5. package/dist/components/Autocomplete/Autocomplete.js +34 -24
  6. package/dist/components/Autocomplete/Autocomplete.types.d.ts +1 -1
  7. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +8 -1
  8. package/dist/components/Carousel/Carousel.js +53 -4
  9. package/dist/components/Carousel/Carousel.types.d.ts +5 -0
  10. package/dist/components/Carousel/tests/Carousel.stories.d.ts +20 -4
  11. package/dist/components/Carousel/tests/Carousel.stories.js +195 -102
  12. package/dist/components/Container/Container.module.css +1 -1
  13. package/dist/components/ContextMenu/ContextMenu.js +2 -2
  14. package/dist/components/ContextMenu/tests/ContextMenu.test.stories.js +1 -1
  15. package/dist/components/DropdownMenu/DropdownMenu.js +6 -1
  16. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.js +2 -2
  17. package/dist/components/Popover/Popover.js +1 -1
  18. package/dist/components/Popover/tests/Popover.test.stories.js +4 -4
  19. package/dist/components/ProgressIndicator/ProgressIndicator.d.ts +3 -0
  20. package/dist/components/ProgressIndicator/ProgressIndicator.js +101 -0
  21. package/dist/components/ProgressIndicator/ProgressIndicator.module.css +1 -0
  22. package/dist/components/ProgressIndicator/ProgressIndicator.types.d.ts +9 -0
  23. package/dist/components/ProgressIndicator/ProgressIndicator.types.js +1 -0
  24. package/dist/components/ProgressIndicator/index.d.ts +2 -0
  25. package/dist/components/ProgressIndicator/index.js +1 -0
  26. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.d.ts +19 -0
  27. package/dist/components/ProgressIndicator/tests/ProgressIndicator.stories.js +85 -0
  28. package/dist/components/Reshaped/Reshaped.js +4 -5
  29. package/dist/components/Table/index.d.ts +1 -1
  30. package/dist/components/Table/tests/Table.stories.d.ts +5 -5
  31. package/dist/components/Table/tests/Table.test.stories.d.ts +5 -5
  32. package/dist/components/TextField/TextField.module.css +1 -1
  33. package/dist/components/Toast/tests/Toast.stories.js +22 -7
  34. package/dist/components/Tooltip/tests/Tooltip.test.stories.js +1 -1
  35. package/dist/components/_private/Flyout/Flyout.module.css +1 -1
  36. package/dist/components/_private/Flyout/Flyout.types.d.ts +14 -3
  37. package/dist/components/_private/Flyout/FlyoutContent.js +37 -7
  38. package/dist/components/_private/Flyout/FlyoutControlled.js +12 -11
  39. package/dist/components/_private/Flyout/FlyoutUncontrolled.js +3 -5
  40. package/dist/components/_private/Flyout/index.d.ts +1 -1
  41. package/dist/components/_private/Flyout/tests/Flyout.stories.d.ts +79 -13
  42. package/dist/components/_private/Flyout/tests/Flyout.stories.js +526 -280
  43. package/dist/components/_private/Flyout/useFlyout.js +9 -3
  44. package/dist/components/_private/Flyout/utilities/isFullyVisible.d.ts +3 -1
  45. package/dist/components/_private/Flyout/utilities/isFullyVisible.js +2 -2
  46. package/dist/hooks/_private/usePrevious.d.ts +2 -0
  47. package/dist/hooks/_private/usePrevious.js +17 -0
  48. package/dist/hooks/_private/useSingletonEnvironment.d.ts +1 -1
  49. package/dist/hooks/_private/useSingletonEnvironment.js +1 -1
  50. package/dist/hooks/_private/useSingletonKeyboardMode.d.ts +13 -2
  51. package/dist/hooks/_private/useSingletonKeyboardMode.js +48 -15
  52. package/dist/hooks/tests/useKeyboardMode.stories.d.ts +6 -0
  53. package/dist/hooks/tests/useKeyboardMode.stories.js +37 -0
  54. package/dist/hooks/useKeyboardMode.d.ts +7 -0
  55. package/dist/hooks/useKeyboardMode.js +13 -0
  56. package/dist/index.d.ts +4 -1
  57. package/dist/index.js +2 -0
  58. package/dist/utilities/a11y/index.d.ts +1 -1
  59. package/dist/utilities/a11y/index.js +1 -1
  60. package/dist/utilities/a11y/keyboardMode.d.ts +2 -2
  61. package/dist/utilities/a11y/keyboardMode.js +2 -2
  62. package/dist/utilities/dom/find.d.ts +4 -1
  63. package/dist/utilities/dom/find.js +4 -4
  64. package/dist/utilities/scroll/lockStandard.js +1 -1
  65. package/package.json +34 -35
  66. package/dist/components/Carousel/tests/Carousel.test.stories.d.ts +0 -17
  67. package/dist/components/Carousel/tests/Carousel.test.stories.js +0 -52
  68. package/dist/components/_private/Flyout/tests/Flyout.test.stories.d.ts +0 -28
  69. package/dist/components/_private/Flyout/tests/Flyout.test.stories.js +0 -205
@@ -33,7 +33,8 @@ const flyout = (args) => {
33
33
  const targetClone = flyoutEl.cloneNode(true);
34
34
  const baseUnit = getComputedStyle(flyoutEl).getPropertyValue("--rs-unit-x1");
35
35
  const unitModifier = baseUnit ? parseInt(baseUnit) : 0;
36
- const triggerBounds = passedTriggerBounds || triggerEl?.getBoundingClientRect();
36
+ const internalTriggerBounds = triggerEl?.getBoundingClientRect();
37
+ const triggerBounds = passedTriggerBounds || internalTriggerBounds;
37
38
  if (!triggerBounds)
38
39
  return;
39
40
  const resolvedTriggerBounds = getRectFromCoordinates(triggerBounds);
@@ -56,7 +57,12 @@ const flyout = (args) => {
56
57
  // Insert inside shadow root if possible to make sure styles are applied correctly
57
58
  (shadowRoot || document.body).appendChild(targetClone);
58
59
  const flyoutBounds = targetClone.getBoundingClientRect();
59
- const containerParent = container || (triggerEl ? findClosestRenderContainer({ el: triggerEl }) : document.body);
60
+ const closestRenderContainer = !container && triggerEl ? findClosestRenderContainer({ el: triggerEl }) : undefined;
61
+ const containerParent = container ||
62
+ // Only render inside non-scrollable container to make sure it doesn't get clipped by overflow auto
63
+ // We render those cases in the document root and then sync the position on scroll instead
64
+ (!closestRenderContainer?.scrollable ? closestRenderContainer?.el : undefined) ||
65
+ document.body;
60
66
  const containerBounds = containerParent.getBoundingClientRect();
61
67
  const scopeOffset = {
62
68
  top: containerBounds.top + document.documentElement.scrollTop - containerParent.scrollTop,
@@ -74,7 +80,7 @@ const flyout = (args) => {
74
80
  contentGap: contentGap * unitModifier,
75
81
  contentShift: contentShift * unitModifier,
76
82
  });
77
- const visible = isFullyVisible(tested);
83
+ const visible = isFullyVisible({ ...tested, container });
78
84
  const validPosition = visible || fallbackPositions?.length === 0;
79
85
  // Saving first try in case non of the options work
80
86
  if (validPosition || lastUsedFallback === currentPosition) {
@@ -2,5 +2,7 @@ import calculatePosition from "./calculatePosition";
2
2
  /**
3
3
  * Check if element visually fits on the screen
4
4
  */
5
- declare const isFullyVisible: (args: ReturnType<typeof calculatePosition>) => boolean;
5
+ declare const isFullyVisible: (args: ReturnType<typeof calculatePosition> & {
6
+ container?: HTMLElement | null;
7
+ }) => boolean;
6
8
  export default isFullyVisible;
@@ -2,8 +2,8 @@
2
2
  * Check if element visually fits on the screen
3
3
  */
4
4
  const isFullyVisible = (args) => {
5
- const { styles, scopeOffset } = args;
6
- const htmlEl = document.documentElement;
5
+ const { styles, scopeOffset, container } = args;
6
+ const htmlEl = container || document.documentElement;
7
7
  const pageLeft = htmlEl.scrollLeft;
8
8
  const pageRight = pageLeft + htmlEl.clientWidth;
9
9
  const pageTop = htmlEl.scrollTop;
@@ -0,0 +1,2 @@
1
+ declare const usePrevious: <T>(value?: T, clean?: boolean) => T;
2
+ export default usePrevious;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import React from "react";
3
+ const copy = (value) => {
4
+ const valueIsDate = value instanceof Date;
5
+ if (valueIsDate)
6
+ return String(valueIsDate);
7
+ const string = JSON.stringify(value);
8
+ return JSON.parse(string);
9
+ };
10
+ const usePrevious = (value, clean = false) => {
11
+ const ref = React.useRef(clean ? copy(value) : value);
12
+ React.useEffect(() => {
13
+ ref.current = clean ? copy(value) : value;
14
+ }, [value, clean]);
15
+ return ref.current;
16
+ };
17
+ export default usePrevious;
@@ -5,5 +5,5 @@ type Context = {
5
5
  defaultViewport: G.Viewport;
6
6
  };
7
7
  export declare const SingletonEnvironmentContext: React.Context<Context>;
8
- export declare const useSingletonRTL: (defaultRTL?: boolean) => [boolean, React.Dispatch<React.SetStateAction<boolean>>];
8
+ export declare const useSingletonEnvironment: (defaultRTL?: boolean) => [boolean, React.Dispatch<React.SetStateAction<boolean>>];
9
9
  export {};
@@ -4,7 +4,7 @@ export const SingletonEnvironmentContext = React.createContext({
4
4
  rtl: [false, () => { }],
5
5
  defaultViewport: "s",
6
6
  });
7
- export const useSingletonRTL = (defaultRTL) => {
7
+ export const useSingletonEnvironment = (defaultRTL) => {
8
8
  const state = React.useState(defaultRTL || false);
9
9
  const [isRTL, setRTL] = state;
10
10
  /**
@@ -1,2 +1,13 @@
1
- declare const useSingletonKeyboardMode: () => void;
2
- export default useSingletonKeyboardMode;
1
+ import React from "react";
2
+ type ContextProps = {
3
+ disabledRef: React.RefObject<boolean> | null;
4
+ disable: () => void;
5
+ enable: () => void;
6
+ activate: () => void;
7
+ deactivate: () => void;
8
+ };
9
+ export declare const SingletonKeyboardModeContext: React.Context<ContextProps>;
10
+ export declare const SingletonKeyboardModeProvider: (props: {
11
+ children: React.ReactNode;
12
+ }) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -1,25 +1,58 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
1
3
  import React from "react";
2
4
  import * as keys from "../../constants/keys.js";
3
- import { enableKeyboardMode, disableKeyboardMode } from "../../utilities/a11y/index.js";
4
- const useSingletonKeyboardMode = () => {
5
+ import { activateKeyboardMode, deactivateKeyboardMode } from "../../utilities/a11y/index.js";
6
+ export const SingletonKeyboardModeContext = React.createContext({
7
+ disabledRef: null,
8
+ disable: () => { },
9
+ enable: () => { },
10
+ activate: () => { },
11
+ deactivate: () => { },
12
+ });
13
+ export const SingletonKeyboardModeProvider = (props) => {
14
+ const disabledRef = React.useRef(false);
15
+ const disable = React.useCallback(() => {
16
+ disabledRef.current = true;
17
+ }, []);
18
+ const enable = React.useCallback(() => {
19
+ disabledRef.current = false;
20
+ }, []);
21
+ const activate = React.useCallback(() => {
22
+ if (disabledRef.current)
23
+ return;
24
+ activateKeyboardMode();
25
+ }, []);
26
+ const deactivate = React.useCallback(() => {
27
+ if (disabledRef.current)
28
+ return;
29
+ deactivateKeyboardMode();
30
+ }, []);
31
+ const handleKeyDown = React.useCallback((e) => {
32
+ if (e.metaKey || e.altKey || e.ctrlKey)
33
+ return;
34
+ // Prevent focus ring from appearing when using mouse but closing with esc
35
+ if (e.key === keys.ESC)
36
+ return;
37
+ activate();
38
+ }, [activate]);
39
+ const handleClick = React.useCallback(() => {
40
+ deactivate();
41
+ }, [deactivate]);
5
42
  React.useEffect(() => {
6
- const handleKeyDown = (e) => {
7
- if (e.metaKey || e.altKey || e.ctrlKey)
8
- return;
9
- // Prevent focus ring from appearing when using mouse but closing with esc
10
- if (e.key === keys.ESC)
11
- return;
12
- enableKeyboardMode();
13
- };
14
- const handleClick = () => {
15
- disableKeyboardMode();
16
- };
17
43
  window.addEventListener("keydown", handleKeyDown);
18
44
  window.addEventListener("mousedown", handleClick);
19
45
  return () => {
20
46
  window.removeEventListener("keydown", handleKeyDown);
21
47
  window.removeEventListener("mousedown", handleClick);
22
48
  };
23
- }, []);
49
+ }, [handleClick, handleKeyDown]);
50
+ const value = React.useMemo(() => ({
51
+ disabledRef,
52
+ disable,
53
+ enable,
54
+ activate,
55
+ deactivate,
56
+ }), [disable, enable, activate, deactivate]);
57
+ return (_jsx(SingletonKeyboardModeContext.Provider, { value: value, children: props.children }));
24
58
  };
25
- export default useSingletonKeyboardMode;
@@ -0,0 +1,6 @@
1
+ import { StoryObj } from "@storybook/react";
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const base: StoryObj;
@@ -0,0 +1,37 @@
1
+ import { expect, userEvent } from "@storybook/test";
2
+ import Button from "../../components/Button/index.js";
3
+ import View from "../../components/View/index.js";
4
+ import useKeyboardMode from "../useKeyboardMode.js";
5
+ export default { title: "Hooks/useKeyboardMode" };
6
+ const Component = () => {
7
+ const { activate, deactivate, disable, enable } = useKeyboardMode();
8
+ return (<View direction="row" gap={2}>
9
+ <Button onClick={activate}>Activate</Button>
10
+ <Button onClick={deactivate}>Deactivate</Button>
11
+ <Button onClick={disable}>Disable</Button>
12
+ <Button onClick={enable}>Enable</Button>
13
+ </View>);
14
+ };
15
+ export const base = {
16
+ name: "base",
17
+ render: () => <Component />,
18
+ play: async ({ canvas }) => {
19
+ const attribute = "data-rs-keyboard";
20
+ const root = document.documentElement;
21
+ const activateTrigger = canvas.getAllByRole("button")[0];
22
+ const deactivateTrigger = canvas.getAllByRole("button")[1];
23
+ const disableTrigger = canvas.getAllByRole("button")[2];
24
+ const enableTrigger = canvas.getAllByRole("button")[3];
25
+ expect(root).not.toHaveAttribute(attribute);
26
+ await userEvent.click(activateTrigger);
27
+ expect(root).toHaveAttribute(attribute);
28
+ await userEvent.click(deactivateTrigger);
29
+ expect(root).not.toHaveAttribute(attribute);
30
+ await userEvent.click(disableTrigger);
31
+ await userEvent.click(activateTrigger);
32
+ expect(root).not.toHaveAttribute(attribute);
33
+ await userEvent.click(enableTrigger);
34
+ await userEvent.click(activateTrigger);
35
+ expect(root).toHaveAttribute(attribute);
36
+ },
37
+ };
@@ -0,0 +1,7 @@
1
+ declare const useKeyboardMode: () => {
2
+ enable: () => void;
3
+ disable: () => void;
4
+ activate: () => void;
5
+ deactivate: () => void;
6
+ };
7
+ export default useKeyboardMode;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import React from "react";
3
+ import { SingletonKeyboardModeContext } from "./_private/useSingletonKeyboardMode.js";
4
+ const useKeyboardMode = () => {
5
+ const singletonKeyboardMode = React.useContext(SingletonKeyboardModeContext);
6
+ return React.useMemo(() => ({
7
+ enable: singletonKeyboardMode.enable,
8
+ disable: singletonKeyboardMode.disable,
9
+ activate: singletonKeyboardMode.activate,
10
+ deactivate: singletonKeyboardMode.deactivate,
11
+ }), [singletonKeyboardMode]);
12
+ };
13
+ export default useKeyboardMode;
package/dist/index.d.ts CHANGED
@@ -73,6 +73,8 @@ export { default as Popover } from "./components/Popover";
73
73
  export type { PopoverProps, PopoverInstance } from "./components/Popover";
74
74
  export { default as Progress } from "./components/Progress";
75
75
  export type { ProgressProps } from "./components/Progress";
76
+ export { default as ProgressIndicator } from "./components/ProgressIndicator";
77
+ export type { ProgressIndicatorProps } from "./components/ProgressIndicator";
76
78
  export { default as Radio } from "./components/Radio";
77
79
  export type { RadioProps } from "./components/Radio";
78
80
  export { default as RadioGroup } from "./components/RadioGroup";
@@ -96,7 +98,7 @@ export type { StepperProps } from "./components/Stepper";
96
98
  export { default as Switch } from "./components/Switch";
97
99
  export type { SwitchProps } from "./components/Switch";
98
100
  export { default as Table } from "./components/Table";
99
- export type { TableProps } from "./components/Table";
101
+ export type { TableProps, TableBodyProps, TableHeadProps, TableHeadingProps, TableCellProps, TableRowProps, } from "./components/Table";
100
102
  export { default as Tabs } from "./components/Tabs";
101
103
  export type { TabsProps } from "./components/Tabs";
102
104
  export { default as Text } from "./components/Text";
@@ -124,6 +126,7 @@ export { default as useToggle } from "./hooks/useToggle";
124
126
  export { default as useRTL } from "./hooks/useRTL";
125
127
  export { default as useIsomorphicLayoutEffect } from "./hooks/useIsomorphicLayoutEffect";
126
128
  export { default as useHotkeys } from "./hooks/useHotkeys";
129
+ export { default as useKeyboardMode } from "./hooks/useKeyboardMode";
127
130
  export { default as useResponsiveClientValue } from "./hooks/useResponsiveClientValue";
128
131
  /**
129
132
  * Utilities
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ export { default as Pagination } from "./components/Pagination/index.js";
37
37
  export { default as PinField } from "./components/PinField/index.js";
38
38
  export { default as Popover } from "./components/Popover/index.js";
39
39
  export { default as Progress } from "./components/Progress/index.js";
40
+ export { default as ProgressIndicator } from "./components/ProgressIndicator/index.js";
40
41
  export { default as Radio } from "./components/Radio/index.js";
41
42
  export { default as RadioGroup } from "./components/RadioGroup/index.js";
42
43
  export { default as Reshaped } from "./components/Reshaped/index.js";
@@ -67,6 +68,7 @@ export { default as useToggle } from "./hooks/useToggle.js";
67
68
  export { default as useRTL } from "./hooks/useRTL.js";
68
69
  export { default as useIsomorphicLayoutEffect } from "./hooks/useIsomorphicLayoutEffect.js";
69
70
  export { default as useHotkeys } from "./hooks/useHotkeys.js";
71
+ export { default as useKeyboardMode } from "./hooks/useKeyboardMode.js";
70
72
  export { default as useResponsiveClientValue } from "./hooks/useResponsiveClientValue.js";
71
73
  /**
72
74
  * Utilities
@@ -1,4 +1,4 @@
1
1
  export { focusableSelector, getActiveElement, focusNextElement, focusPreviousElement, focusFirstElement, focusLastElement, } from "./focus";
2
- export { enableKeyboardMode, disableKeyboardMode, checkKeyboardMode } from "./keyboardMode";
2
+ export { activateKeyboardMode, deactivateKeyboardMode, checkKeyboardMode } from "./keyboardMode";
3
3
  export { default as TrapFocus } from "./TrapFocus";
4
4
  export type { TrapMode, FocusableElement } from "./types";
@@ -1,3 +1,3 @@
1
1
  export { focusableSelector, getActiveElement, focusNextElement, focusPreviousElement, focusFirstElement, focusLastElement, } from "./focus.js";
2
- export { enableKeyboardMode, disableKeyboardMode, checkKeyboardMode } from "./keyboardMode.js";
2
+ export { activateKeyboardMode, deactivateKeyboardMode, checkKeyboardMode } from "./keyboardMode.js";
3
3
  export { default as TrapFocus } from "./TrapFocus.js";
@@ -1,3 +1,3 @@
1
- export declare const enableKeyboardMode: () => void;
2
- export declare const disableKeyboardMode: () => void;
1
+ export declare const activateKeyboardMode: () => void;
2
+ export declare const deactivateKeyboardMode: () => void;
3
3
  export declare const checkKeyboardMode: () => boolean;
@@ -1,8 +1,8 @@
1
1
  const keyboardModeAttribute = "data-rs-keyboard";
2
- export const enableKeyboardMode = () => {
2
+ export const activateKeyboardMode = () => {
3
3
  document.documentElement.setAttribute(keyboardModeAttribute, "true");
4
4
  };
5
- export const disableKeyboardMode = () => {
5
+ export const deactivateKeyboardMode = () => {
6
6
  document.documentElement.removeAttribute(keyboardModeAttribute);
7
7
  };
8
8
  export const checkKeyboardMode = () => {
@@ -7,4 +7,7 @@ export declare const findClosestRenderContainer: (args: {
7
7
  el: HTMLElement | null;
8
8
  iteration?: number;
9
9
  overflowOnly?: boolean;
10
- }) => HTMLElement;
10
+ }) => {
11
+ el: HTMLElement;
12
+ scrollable?: boolean;
13
+ };
@@ -23,13 +23,13 @@ export const findClosestRenderContainer = (args) => {
23
23
  if (iteration === 0) {
24
24
  const shadowRoot = getShadowRoot(el);
25
25
  if (shadowRoot?.firstElementChild)
26
- return shadowRoot.firstElementChild;
26
+ return { el: shadowRoot.firstElementChild };
27
27
  }
28
28
  if (el === document.body || !el)
29
- return document.body;
29
+ return { el: document.body };
30
30
  if (isScrollable && el.scrollHeight > el.clientHeight)
31
- return el;
31
+ return { el, scrollable: true };
32
32
  if (isFixed && !overflowOnly)
33
- return el;
33
+ return { el };
34
34
  return findClosestRenderContainer({ el: el.parentElement, iteration: iteration + 1 });
35
35
  };
@@ -5,7 +5,7 @@ const styleCache = new StyleCache();
5
5
  const lockStandardScroll = (args) => {
6
6
  let container = document.body;
7
7
  if (args.originEl)
8
- container = findClosestRenderContainer({ el: args.originEl });
8
+ container = findClosestRenderContainer({ el: args.originEl }).el;
9
9
  if (args.containerEl)
10
10
  container = args.containerEl;
11
11
  const rect = container.getBoundingClientRect();
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.3.12",
4
+ "version": "3.4.0-rc.0",
5
5
  "license": "MIT",
6
6
  "email": "hello@reshaped.so",
7
7
  "homepage": "https://reshaped.so",
@@ -71,9 +71,8 @@
71
71
  "build:cjs": "tsc -p tsconfig.cjs.json && resolve-tspaths -p tsconfig.cjs.json && node ./bin/format-cjs-build.js",
72
72
  "build:css": "postcss \"src/**/*.css\" --dir dist --base src --config tools/build",
73
73
  "build:stories": "tsc -p tsconfig.stories.json && resolve-tspaths -p tsconfig.stories.json",
74
- "build:bundle:vite": "vite build",
75
- "build:bundle": "yarn build:bundle:vite && cp dist/index.d.ts dist/bundle.d.ts",
76
- "build:size": "yarn clean && yarn build:esm && yarn build:bundle:vite",
74
+ "build:bundle": "vite build && cp dist/index.d.ts dist/bundle.d.ts",
75
+ "build:size": "yarn clean && yarn build:esm && yarn build:bundle",
77
76
  "build:storybook": "storybook build -o dist/app --disable-telemetry",
78
77
  "build:chromatic": "STORYBOOK_ENV=chromatic storybook build",
79
78
  "release": "read -p 'Have you updated chromatic tests?' && yarn release:lib && yarn release:source && yarn build:storybook && yarn release:copy",
@@ -96,31 +95,31 @@
96
95
  "defaults and not IE 11"
97
96
  ],
98
97
  "devDependencies": {
99
- "@commitlint/cli": "19.6.0",
100
- "@commitlint/config-conventional": "19.6.0",
98
+ "@commitlint/cli": "19.7.1",
99
+ "@commitlint/config-conventional": "19.7.1",
101
100
  "@commitlint/types": "19.5.0",
102
101
  "@eslint/js": "9.16.0",
103
- "@size-limit/preset-big-lib": "11.1.6",
104
- "@storybook/addon-a11y": "8.5.2",
105
- "@storybook/addon-actions": "8.5.2",
106
- "@storybook/addon-controls": "8.5.2",
107
- "@storybook/addon-docs": "8.5.2",
108
- "@storybook/addon-storysource": "8.5.2",
109
- "@storybook/experimental-addon-test": "8.5.2",
110
- "@storybook/react": "8.5.2",
111
- "@storybook/react-vite": "8.5.2",
102
+ "@size-limit/preset-big-lib": "11.2.0",
103
+ "@storybook/addon-a11y": "8.6.2",
104
+ "@storybook/addon-actions": "8.6.2",
105
+ "@storybook/addon-controls": "8.6.2",
106
+ "@storybook/addon-docs": "8.6.2",
107
+ "@storybook/addon-storysource": "8.6.2",
108
+ "@storybook/experimental-addon-test": "8.6.2",
109
+ "@storybook/react": "8.6.2",
110
+ "@storybook/react-vite": "8.6.2",
112
111
  "@types/culori": "2.1.1",
113
112
  "@types/events": "3.0.3",
114
- "@types/node": "22.10.1",
115
- "@types/react": "19.0.8",
116
- "@types/react-dom": "19.0.3",
113
+ "@types/node": "22.13.5",
114
+ "@types/react": "19.0.10",
115
+ "@types/react-dom": "19.0.4",
117
116
  "@typescript-eslint/eslint-plugin": "7.18.0",
118
117
  "@typescript-eslint/parser": "7.18.0",
119
118
  "@vitejs/plugin-react": "4.3.4",
120
- "@vitest/browser": "2.1.8",
121
- "@vitest/coverage-istanbul": "2.1.8",
122
- "@vitest/coverage-v8": "2.1.8",
123
- "chromatic": "11.19.0",
119
+ "@vitest/browser": "3.0.7",
120
+ "@vitest/coverage-istanbul": "3.0.7",
121
+ "@vitest/coverage-v8": "3.0.7",
122
+ "chromatic": "11.26.1",
124
123
  "cz-conventional-changelog": "3.3.0",
125
124
  "eslint": "8.57.1",
126
125
  "eslint-config-prettier": "9.1.0",
@@ -130,29 +129,29 @@
130
129
  "eslint-plugin-react": "7.37.2",
131
130
  "eslint-plugin-react-hooks": "5.0.0",
132
131
  "globals": "15.12.0",
133
- "lefthook": "1.8.4",
134
- "playwright": "1.49.1",
135
- "postcss": "8.4.49",
132
+ "lefthook": "1.11.2",
133
+ "playwright": "1.50.1",
134
+ "postcss": "8.5.3",
136
135
  "postcss-cli": "11.0.0",
137
136
  "postcss-each": "1.1.0",
138
137
  "postcss-nested": "7.0.2",
139
- "prettier": "3.4.1",
138
+ "prettier": "3.5.2",
140
139
  "react": "18",
141
140
  "react-dom": "18",
142
141
  "react-shadow": "20.5.0",
143
142
  "resolve-tspaths": "0.8.23",
144
- "size-limit": "11.1.6",
145
- "storybook": "8.5.2",
146
- "stylelint": "16.11.0",
143
+ "size-limit": "11.2.0",
144
+ "storybook": "8.6.2",
145
+ "stylelint": "16.14.1",
147
146
  "stylelint-config-prettier": "9.0.5",
148
- "stylelint-config-standard": "36.0.1",
147
+ "stylelint-config-standard": "37.0.0",
149
148
  "ts-node": "10.9.2",
150
- "typescript": "5.7.2",
149
+ "typescript": "5.7.3",
151
150
  "typescript-eslint": "8.16.0",
152
- "vite": "6.0.1",
153
- "vite-tsconfig-paths": "5.1.3",
154
- "vitest": "2.1.8",
155
- "vitest-browser-react": "0.0.4"
151
+ "vite": "6.2.0",
152
+ "vite-tsconfig-paths": "5.1.4",
153
+ "vitest": "3.0.7",
154
+ "vitest-browser-react": "0.1.1"
156
155
  },
157
156
  "peerDependencies": {
158
157
  "postcss": "^8",
@@ -1,17 +0,0 @@
1
- import { StoryObj } from "@storybook/react";
2
- declare const _default: {
3
- title: string;
4
- component: (props: import("./..").CarouselProps) => import("react").JSX.Element;
5
- parameters: {
6
- iframe: {
7
- url: string;
8
- };
9
- chromatic: {
10
- disableSnapshot: boolean;
11
- };
12
- };
13
- };
14
- export default _default;
15
- export declare const render: StoryObj;
16
- export declare const navigationDisplay: StoryObj;
17
- export declare const className: StoryObj;
@@ -1,52 +0,0 @@
1
- import { expect } from "@storybook/test";
2
- import Carousel from "../index.js";
3
- export default {
4
- title: "Components/Carousel/tests",
5
- component: Carousel,
6
- parameters: {
7
- iframe: {
8
- url: "https://reshaped.so/docs/components/carousel",
9
- },
10
- chromatic: { disableSnapshot: true },
11
- },
12
- };
13
- export const render = {
14
- name: "rendering",
15
- render: () => (<Carousel attributes={{ "data-testid": "test-id" }}>
16
- <div>Content</div>
17
- <div>Content</div>
18
- </Carousel>),
19
- play: async ({ canvas }) => {
20
- const elRoot = canvas.getByTestId("test-id");
21
- const elItems = canvas.getAllByText("Content");
22
- const elButtons = elRoot.querySelectorAll("button");
23
- expect(elRoot).toBeInTheDocument();
24
- expect(elRoot.tagName).toBe("SECTION");
25
- expect(elItems).toHaveLength(2);
26
- expect(elButtons).toHaveLength(2);
27
- },
28
- };
29
- export const navigationDisplay = {
30
- name: "navigationDisplay",
31
- render: () => (<Carousel navigationDisplay="hidden" attributes={{ "data-testid": "test-id" }}>
32
- <div>Content</div>
33
- </Carousel>),
34
- play: async ({ canvas }) => {
35
- const elRoot = canvas.getByTestId("test-id");
36
- const elButtons = elRoot.querySelectorAll("button");
37
- expect(elButtons).toHaveLength(0);
38
- },
39
- };
40
- export const className = {
41
- name: "className, attributes",
42
- render: () => (<div data-testid="root">
43
- <Carousel className="test-classname" attributes={{ id: "test-id" }}>
44
- <div>Content</div>
45
- </Carousel>
46
- </div>),
47
- play: async ({ canvas }) => {
48
- const root = canvas.getByTestId("root").firstChild;
49
- expect(root).toHaveClass("test-classname");
50
- expect(root).toHaveAttribute("id", "test-id");
51
- },
52
- };
@@ -1,28 +0,0 @@
1
- import { StoryObj } from "@storybook/react";
2
- import { fn } from "@storybook/test";
3
- declare const _default: {
4
- title: string;
5
- };
6
- export default _default;
7
- export declare const defaultActive: StoryObj<{
8
- handleOpen: ReturnType<typeof fn>;
9
- handleClose: ReturnType<typeof fn>;
10
- }>;
11
- export declare const active: StoryObj<{
12
- handleOpen: ReturnType<typeof fn>;
13
- handleClose: ReturnType<typeof fn>;
14
- }>;
15
- export declare const activeFalse: StoryObj<{
16
- handleOpen: ReturnType<typeof fn>;
17
- handleClose: ReturnType<typeof fn>;
18
- }>;
19
- export declare const triggerType: StoryObj<{
20
- handleOpen: ReturnType<typeof fn>;
21
- handleClose: ReturnType<typeof fn>;
22
- }>;
23
- export declare const disabled: StoryObj<{
24
- handleOpen: ReturnType<typeof fn>;
25
- }>;
26
- export declare const containerRef: StoryObj;
27
- export declare const shadowDom: StoryObj;
28
- export declare const className: StoryObj;