@wonderflow/react-components 7.0.0 → 8.2.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 (63) hide show
  1. package/dist/components/autocomplete/autocomplete-option.d.ts +0 -10
  2. package/dist/components/autocomplete/autocomplete-option.d.ts.map +1 -1
  3. package/dist/components/autocomplete/autocomplete-option.js +1 -1
  4. package/dist/components/autocomplete/autocomplete.d.ts +5 -3
  5. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  6. package/dist/components/autocomplete/autocomplete.js +10 -11
  7. package/dist/components/container/container.d.ts +1 -1
  8. package/dist/components/container/container.d.ts.map +1 -1
  9. package/dist/components/container/container.module.css +1 -1
  10. package/dist/components/disclosure/disclosure.d.ts.map +1 -1
  11. package/dist/components/disclosure/disclosure.js +2 -2
  12. package/dist/components/drawer/drawer.d.ts.map +1 -1
  13. package/dist/components/drawer/drawer.js +2 -2
  14. package/dist/components/icon/icon.d.ts +1 -1
  15. package/dist/components/menu/menu-item/menu-item.d.ts +5 -1
  16. package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
  17. package/dist/components/menu/menu-item/menu-item.js +3 -3
  18. package/dist/components/menu/menu.d.ts +4 -0
  19. package/dist/components/menu/menu.d.ts.map +1 -1
  20. package/dist/components/menu/menu.js +5 -2
  21. package/dist/components/menu/menu.module.css +1 -1
  22. package/dist/components/modal/modal.d.ts.map +1 -1
  23. package/dist/components/modal/modal.js +2 -2
  24. package/dist/components/overlay-container/overlay-container.d.ts.map +1 -1
  25. package/dist/components/overlay-container/overlay-container.js +2 -2
  26. package/dist/components/popover/popover.d.ts.map +1 -1
  27. package/dist/components/popover/popover.js +6 -6
  28. package/dist/components/slider/slider.module.css +1 -1
  29. package/dist/components/spinner/spinner.d.ts.map +1 -1
  30. package/dist/components/spinner/spinner.js +6 -6
  31. package/dist/components/tab/tab.d.ts +27 -26
  32. package/dist/components/tab/tab.d.ts.map +1 -1
  33. package/dist/components/tab/tab.js +15 -32
  34. package/dist/components/tab/tab.module.css +1 -1
  35. package/dist/components/tab/tabs-panel.d.ts +10 -0
  36. package/dist/components/tab/tabs-panel.d.ts.map +1 -0
  37. package/dist/components/tab/tabs-panel.js +5 -0
  38. package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -1
  39. package/dist/components/table/table-controls/toggle-columns.js +2 -2
  40. package/dist/components/table/table.d.ts +41 -51
  41. package/dist/components/table/table.d.ts.map +1 -1
  42. package/dist/components/table/table.js +64 -64
  43. package/dist/components/table/types.d.ts +2 -2
  44. package/dist/components/table/types.d.ts.map +1 -1
  45. package/dist/components/textfield/base-field/base-field.module.css +1 -1
  46. package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
  47. package/dist/components/toggle-button/toggle-button.js +4 -4
  48. package/package.json +15 -14
  49. package/dist/components/tab/primitive-tab.d.ts +0 -12
  50. package/dist/components/tab/primitive-tab.d.ts.map +0 -1
  51. package/dist/components/tab/primitive-tab.js +0 -51
  52. package/dist/components/tab/tab-item.d.ts +0 -23
  53. package/dist/components/tab/tab-item.d.ts.map +0 -1
  54. package/dist/components/tab/tab-item.js +0 -24
  55. package/dist/components/tab/tab-list.d.ts +0 -8
  56. package/dist/components/tab/tab-list.d.ts.map +0 -1
  57. package/dist/components/tab/tab-list.js +0 -11
  58. package/dist/components/tab/tab-panel.d.ts +0 -35
  59. package/dist/components/tab/tab-panel.d.ts.map +0 -1
  60. package/dist/components/tab/tab-panel.js +0 -16
  61. package/dist/components/tab/use-constant.d.ts +0 -2
  62. package/dist/components/tab/use-constant.d.ts.map +0 -1
  63. package/dist/components/tab/use-constant.js +0 -8
@@ -2,11 +2,6 @@ import { MenuItemProps } from '../..';
2
2
  import { PropsWithChildren } from 'react';
3
3
  import { Except } from 'type-fest';
4
4
  export declare type AutocompleteOptionProps = PropsWithChildren<PropsWithClass> & Except<MenuItemProps, 'padding' | 'autoFocus' | 'description' | 'onClick'> & {
5
- /**
6
- * Value of the option.
7
- * This is the value that will be passed to the `onChange` callback.
8
- */
9
- value: string;
10
5
  /**
11
6
  * Callback called when the option is clicked.
12
7
  * It passes the value and the inner text of the option as arguments.
@@ -21,11 +16,6 @@ export declare type AutocompleteOptionProps = PropsWithChildren<PropsWithClass>
21
16
  export declare const AutocompleteOption: import("react").ForwardRefExoticComponent<PropsWithClass & {
22
17
  children?: import("react").ReactNode;
23
18
  } & Except<MenuItemProps, "padding" | "autoFocus" | "description" | "onClick"> & {
24
- /**
25
- * Value of the option.
26
- * This is the value that will be passed to the `onChange` callback.
27
- */
28
- value: string;
29
19
  /**
30
20
  * Callback called when the option is clicked.
31
21
  * It passes the value and the inner text of the option as arguments.
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAmC,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAC9E,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CACpD,GAAG;IACF;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;IAjB7B;;;OAGG;WACI,MAAM;IACb;;;OAGG;wEACyC,IAAI;IAChD;;;OAGG;cACO,MAAM,GAAG,MAAM,EAAE;qDA4B3B,CAAA"}
1
+ {"version":3,"file":"autocomplete-option.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete-option.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,aAAa,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAmC,MAAM,OAAO,CAAA;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,oBAAY,uBAAuB,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG,MAAM,CAC9E,aAAa,EACb,SAAS,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CACpD,GAAG;IACF;;;OAGG;IACH,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,kBAAkB;;;IAZ7B;;;OAGG;wEACyC,IAAI;IAChD;;;OAGG;cACO,MAAM,GAAG,MAAM,EAAE;qDA6B3B,CAAA"}
@@ -6,6 +6,6 @@ export const AutocompleteOption = forwardRef(({ children, value, onClick, ...oth
6
6
  const handleClick = useCallback(() => {
7
7
  onClick && onClick(value, contentRef?.current?.innerText);
8
8
  }, [onClick, value]);
9
- return (_jsx(Menu.Item, { ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
9
+ return (_jsx(Menu.Item, { value: value, ref: forwardedRef, role: "option", padding: false, onClick: handleClick, ...otherProps, children: _jsx("span", { ref: contentRef, children: children }) }));
10
10
  });
11
11
  AutocompleteOption.displayName = 'Autocomplete.Option';
@@ -1,6 +1,7 @@
1
1
  import { AutocompleteOptionProps } from './autocomplete-option';
2
2
  import { ForwardRefExoticComponent, ReactNode } from 'react';
3
3
  import { TextfieldProps } from '../..';
4
+ import { MenuProps } from '../menu';
4
5
  export declare type AutocompleteProps = TextfieldProps & {
5
6
  /**
6
7
  * The callback called when an option is picked from the list
@@ -10,12 +11,13 @@ export declare type AutocompleteProps = TextfieldProps & {
10
11
  * Set the maximum height of the options list after which
11
12
  * it will scroll.
12
13
  */
13
- maxHeight?: string;
14
+ maxHeight?: MenuProps['maxHeight'];
14
15
  /**
15
- * Custom empty message to display when there are no options or
16
+ * Custom empty content to display when there are no options or
16
17
  * when the value does not match any of the options.
17
18
  */
18
- emptyMessage?: ReactNode;
19
+ emptyContent?: ReactNode;
20
+ busy?: boolean;
19
21
  };
20
22
  declare type AutocompleteComponent = ForwardRefExoticComponent<AutocompleteProps> & {
21
23
  Option: ForwardRefExoticComponent<AutocompleteOptionProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACnF,OAAO,EACK,yBAAyB,EAEC,SAAS,EAC9C,MAAM,OAAO,CAAA;AAEd,OAAO,EAAyB,cAAc,EAAE,MAAM,cAAc,CAAA;AAKpE,oBAAY,iBAAiB,GAAG,cAAc,GAAG;IAC/C;;OAEG;IACH,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBA6IE,CAAA"}
1
+ {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../src/components/autocomplete/autocomplete.tsx"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACnF,OAAO,EACK,yBAAyB,EAEd,SAAS,EAC/B,MAAM,OAAO,CAAA;AAEd,OAAO,EAAyB,cAAc,EAAmB,MAAM,cAAc,CAAA;AAIrF,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,oBAAY,iBAAiB,GAAG,cAAc,GAAG;IAC/C;;OAEG;IACH,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,aAAK,qBAAqB,GAAG,yBAAyB,CAAC,iBAAiB,CAAC,GAAG;IAC1E,MAAM,EAAE,yBAAyB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAA;AAqBD,eAAO,MAAM,YAAY,uBA8IE,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AnimatePresence, motion } from 'framer-motion';
2
+ import { domMax, LazyMotion, m, AnimatePresence } from 'framer-motion';
3
3
  import { AutocompleteOption } from './autocomplete-option';
4
4
  import { Children, cloneElement, forwardRef, useCallback, useMemo, useRef, useState, useEffect, isValidElement } from 'react';
5
5
  import { useDebounce, useFocusWithin, useKeyPress, useSize } from 'ahooks';
6
- import { Text, Menu, Textfield } from '../..';
6
+ import { Text, Menu, Textfield, Skeleton, Stack } from '../..';
7
7
  import styles from './autocomplete.module.css';
8
8
  import { usePopperTooltip } from 'react-popper-tooltip';
9
9
  import { useUIDSeed } from 'react-uid';
@@ -25,7 +25,7 @@ const AutocompleteAnimation = {
25
25
  }
26
26
  }
27
27
  };
28
- export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value, maxHeight = '200px', emptyMessage = 'No results found', ...otherProps }, forwardedRef) => {
28
+ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly, value, busy, maxHeight = '200px', emptyContent = 'No items to show', ...otherProps }, forwardedRef) => {
29
29
  const seedID = useUIDSeed();
30
30
  const autocompleteRef = useRef(forwardedRef);
31
31
  const [isOpen, setIsOpen] = useState(false);
@@ -65,17 +65,16 @@ export const Autocomplete = forwardRef(({ children, onChange, disabled, readOnly
65
65
  const handleFilter = useCallback(({ currentTarget }) => {
66
66
  setContent(currentTarget.value);
67
67
  }, []);
68
- const dynamicStyle = {
69
- '--max-h': maxHeight
70
- };
71
68
  useEffect(() => {
72
69
  value && setContent(String(value));
73
70
  }, [value]);
74
- return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { ref: setTriggerRef, id: seedID('autocomplete-trigger'), "aria-haspopup": "true", "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, onChange: handleFilter, value: content, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, ...getTooltipProps({ className: styles.PopUp, style: { minInlineSize: triggerSize ? (triggerSize.width + 2) : 'auto' } }), children: _jsx(motion.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, style: dynamicStyle, "aria-labelledby": seedID('autocomplete-trigger'), children: filteredOptions.length === 0
75
- ? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyMessage })
76
- : Children.map(filteredOptions, (child) => isValidElement(child) && cloneElement(child, {
77
- onClick: handleOptionClick
78
- })) }) }) })) })] }));
71
+ return (_jsxs("div", { ref: autocompleteRef, className: styles.Autocomplete, "data-focus-within": isFocusWithin, children: [_jsx(Textfield, { ref: setTriggerRef, id: seedID('autocomplete-trigger'), "aria-haspopup": "true", "aria-controls": seedID('autocomplete-menu'), "aria-expanded": isOpen, onChange: handleFilter, value: content, autoComplete: "off", disabled: disabled, readOnly: readOnly, ...otherProps }, seedID('autocomplete-trigger')), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, ...getTooltipProps({ className: styles.PopUp, style: { minInlineSize: triggerSize ? (triggerSize.width + 2) : 'auto' } }), children: _jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(m.div, { variants: AutocompleteAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: _jsx(Menu, { role: "listbox", id: seedID('autocomplete-menu'), className: styles.OptionsList, maxHeight: maxHeight, "aria-labelledby": seedID('autocomplete-trigger'), children: (filteredOptions.length === 0 && !busy)
72
+ ? _jsx(Text, { as: "div", textAlign: "center", dimmed: 5, children: emptyContent })
73
+ : busy
74
+ ? _jsx(Stack, { hPadding: 8, as: "li", children: _jsx(Skeleton, { count: 3 }) })
75
+ : Children.map(filteredOptions, (child) => isValidElement(child) && cloneElement(child, {
76
+ onClick: handleOptionClick
77
+ })) }) }) }) })) })] }));
79
78
  });
80
79
  Autocomplete.Option = AutocompleteOption;
81
80
  Autocomplete.displayName = 'Autocomplete';
@@ -3,7 +3,7 @@ export declare type ContainerProps = {
3
3
  /**
4
4
  * Set the horizontal max-width of the container.
5
5
  */
6
- dimension?: 'full' | 'medium' | 'large';
6
+ dimension?: 'full' | 'small' | 'medium' | 'large';
7
7
  /**
8
8
  * Set or remove the container's predefined horizontal padding.
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/components/container/container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACxC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,SAAS,sBAmBI,CAAA"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/components/container/container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1C,oBAAY,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAClD;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,aAAK,oBAAoB,GAAG,WAAW,CAAC,mBAAmB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;AAEnF,eAAO,MAAM,SAAS,sBAmBI,CAAA"}
@@ -1 +1 @@
1
- .Container{inline-size:100%;margin:0 auto;padding:0 .89rem}.Container[data-container-dimension=medium]{max-inline-size:35.56rem}@media (min-width:48em){.Container[data-container-dimension=medium]{padding:0 1.78rem}}.Container[data-container-dimension=large]{max-inline-size:80rem}@media (min-width:48em){.Container[data-container-dimension=large]{padding:0 1.78rem}}.Container[data-container-dimension=full]{max-inline-size:100%}@media (min-width:48em){.Container[data-container-dimension=full]{padding:0 1.78rem}}.Container[data-container-padding=false]{padding:0}
1
+ .Container{inline-size:100%;margin:0 auto;padding:0 .89rem}.Container[data-container-dimension=small]{max-inline-size:35.56rem}@media (min-width:48em){.Container[data-container-dimension=small]{padding:0 1.78rem}}.Container[data-container-dimension=medium]{max-inline-size:55.56rem}@media (min-width:48em){.Container[data-container-dimension=medium]{padding:0 1.78rem}}.Container[data-container-dimension=large]{max-inline-size:80rem}@media (min-width:48em){.Container[data-container-dimension=large]{padding:0 1.78rem}}.Container[data-container-dimension=full]{max-inline-size:100%}@media (min-width:48em){.Container[data-container-dimension=full]{padding:0 1.78rem}}.Container[data-container-padding=false]{padding:0}
@@ -1 +1 @@
1
- {"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAA;AAMd,oBAAY,eAAe,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;IACxE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,UAAU;IAnCrB;;OAEG;;IAEH;;;OAGG;aACM,SAAS;IAClB;;;;OAIG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;sDAqGH,CAAA"}
1
+ {"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EACrB,SAAS,EACV,MAAM,OAAO,CAAA;AAMd,oBAAY,eAAe,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,GAAG;IACxE;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAA;AAED,eAAO,MAAM,UAAU;IAnCrB;;OAEG;;IAEH;;;OAGG;aACM,SAAS;IAClB;;;;OAIG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;sDAuGH,CAAA"}
@@ -3,7 +3,7 @@ import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import styles from './disclosure.module.css';
5
5
  import { Text, Icon } from '../..';
6
- import { motion } from 'framer-motion';
6
+ import { domMax, LazyMotion, m } from 'framer-motion';
7
7
  export const Disclosure = forwardRef(({ children, open = false, padding = true, className, summary, contentMaxHeight, dimension = 'regular', iconPosition = 'left', expandable = true, style, ...otherProps }, forwardedRef) => {
8
8
  const ref = useRef(forwardedRef);
9
9
  const [isOpen, setIsOpen] = useState(open);
@@ -32,7 +32,7 @@ export const Disclosure = forwardRef(({ children, open = false, padding = true,
32
32
  icon: 24
33
33
  }
34
34
  };
35
- const renderContent = useCallback(() => (_jsx(motion.div, { className: styles.Content, "data-disclosure-padding": padding, "data-disclosure-height": Boolean(contentMaxHeight), animate: isOpen ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 }, initial: false, children: children })), [children, contentMaxHeight, padding, isOpen]);
35
+ const renderContent = useCallback(() => (_jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { className: styles.Content, "data-disclosure-padding": padding, "data-disclosure-height": Boolean(contentMaxHeight), animate: isOpen ? { y: 5, opacity: 1 } : { y: 0, opacity: 0 }, transition: { ease: 'easeOut', duration: 0.1 }, initial: false, children: children }) })), [children, contentMaxHeight, padding, isOpen]);
36
36
  return (_jsxs("details", { style: { ...dynamicStyle, ...style }, className: clsx(styles.Disclosure, className), "data-disclosure-icon-position": iconPosition, "data-disclosure-dimension": dimension, "data-disclosure-expandable": expandable, onToggle: handleOpen(), "aria-expanded": isOpen ? 'true' : 'false', ref: ref, ...otherProps, children: [_jsxs(Text, { as: "summary", responsive: false, className: styles.Summary, "aria-expanded": isOpen, tabIndex: !expandable ? -1 : 0, size: dimension ? sizes[dimension].summary : undefined, weight: "bold", children: [summary, expandable && (_jsx(Icon, { className: styles.ExpandIcon, source: "chevron-right", dimension: sizes[dimension].icon }))] }), renderContent()] }));
37
37
  });
38
38
  Disclosure.displayName = 'Disclosure';
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQ/E,oBAAY,WAAW,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC5D;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,MAAM;;;IAzCjB;;;;;;OAMG;;IAEH;;;OAGG;YACK,SAAS;IACjB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;;OAIG;;kDA4FH,CAAA"}
1
+ {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQ/E,oBAAY,WAAW,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC5D;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AAED,eAAO,MAAM,MAAM;;;IAzCjB;;;;;;OAMG;;IAEH;;;OAGG;YACK,SAAS;IACjB;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;;OAIG;;kDA8FH,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import { motion } from 'framer-motion';
3
+ import { domMax, LazyMotion, m } from 'framer-motion';
4
4
  import clsx from 'clsx';
5
5
  import { FocusOn, AutoFocusInside } from 'react-focus-on';
6
6
  import { useKeyPress } from 'ahooks';
@@ -28,6 +28,6 @@ export const Drawer = forwardRef(({ children, className, closeOnClickOutside = t
28
28
  }
29
29
  }
30
30
  };
31
- return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(styles.Drawer, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: styles.Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "6", id: titleId, children: title }), onClose && _jsx(IconButton, { onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" })] })), _jsx(AutoFocusInside, { children: children })] }) }) }) }) }));
31
+ return (_jsx("div", { role: "dialog", "aria-modal": isModal, "data-theme": theme, "aria-labelledby": titleId, className: clsx(styles.Drawer, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { enabled: isModal, onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: DrawerAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, "data-drawer-side": side, children: _jsx(Elevator, { resting: 4, children: _jsxs("div", { className: styles.Content, style: dynamicStyle, ref: forwardedRef, ...otherProps, children: [(showHeader && title) && (_jsxs(Stack, { vAlign: "center", fill: false, hAlign: "space-between", direction: "row", className: styles.Header, children: [_jsx(Title, { responsive: false, level: "6", id: titleId, children: title }), onClose && _jsx(IconButton, { onClick: onClose, className: styles.CloseButton, icon: "xmark", kind: "flat" })] })), _jsx(AutoFocusInside, { children: children })] }) }) }) }) }) }));
32
32
  });
33
33
  Drawer.displayName = 'Drawer';
@@ -34,7 +34,7 @@ export declare const Icon: import("react").ForwardRefExoticComponent<SVGAttribut
34
34
  * Set the size of the icon. To improve readability at any size, the style of the icon
35
35
  * is automatically defined based on the dimension.
36
36
  */
37
- dimension?: 16 | 12 | 24 | 32 | 40 | 48 | 56 | undefined;
37
+ dimension?: 16 | 24 | 32 | 40 | 48 | 56 | 12 | undefined;
38
38
  /**
39
39
  * Set the weight of the icon.
40
40
  * The default weight is `outline` if `dimension` is greather than `12` or `undefined`.
@@ -21,7 +21,7 @@ export declare type MenuItemProps = {
21
21
  /**
22
22
  * Callback function to be called when the menu item is pressed.
23
23
  */
24
- onClick?(event?: Event): void;
24
+ onClick?(event: Event, value: string): void;
25
25
  /**
26
26
  * Add an extra description to the menu item.
27
27
  * This uses the `<Tooltip>` component internally.
@@ -53,6 +53,10 @@ export declare type MenuItemProps = {
53
53
  * if `Menu.Item` is rendered as ´<button>´ (default).
54
54
  */
55
55
  decoration?: ReactNode;
56
+ /**
57
+ * Assign a string value to the menu option. This is returned when the menu item is clicked.
58
+ */
59
+ value: string;
56
60
  };
57
61
  declare type PolymorphicMenuItem = Polymorphic.ForwardRefComponent<'button', MenuItemProps>;
58
62
  export declare const MenuItem: PolymorphicMenuItem;
@@ -1 +1 @@
1
- {"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBA2FI,CAAA"}
1
+ {"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AAE3E,OAAO,EAAE,SAAS,EAA4C,MAAM,OAAO,CAAA;AAI3E,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B;;OAEG;IACH,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAA;AAED,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBA4FI,CAAA"}
@@ -4,7 +4,7 @@ import styles from './menu-item.module.css';
4
4
  import { forwardRef, useCallback, useMemo, useRef } from 'react';
5
5
  import { useFocusEffect, useRovingTabIndex } from 'react-roving-tabindex';
6
6
  import clsx from 'clsx';
7
- export const MenuItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, autoFocus, decoration, ...otherProps }, forwardedRef) => {
7
+ export const MenuItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, autoFocus, decoration, value, ...otherProps }, forwardedRef) => {
8
8
  const itemRef = useRef(forwardedRef);
9
9
  const [tabIndex, focused, handleKeyDown, handleClick] = useRovingTabIndex(itemRef, disabled);
10
10
  const isIconRight = iconPosition === 'right';
@@ -12,9 +12,9 @@ export const MenuItem = forwardRef(({ className, children, onClick, icon, dimens
12
12
  const triggerClick = useCallback((e) => {
13
13
  if (onClick) {
14
14
  handleClick();
15
- onClick(e);
15
+ onClick(e, value);
16
16
  }
17
- }, [handleClick, onClick]);
17
+ }, [handleClick, onClick, value]);
18
18
  const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Icon, { className: styles.IconClass, source: icon, dimension: dimension === 'small' ? 12 : 16 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [children, decoration] })] })), [children, dimension, icon, isIconRight, decoration, padding]);
19
19
  return (_jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, ...otherProps, children: description
20
20
  ? (_jsx(Tooltip, { fill: true, open: focused, placement: "right-start", interactive: true, trigger: InnerContent, children: description }))
@@ -7,6 +7,10 @@ export declare type MenuProps = HTMLAttributes<HTMLUListElement> & {
7
7
  * The items of the menu.
8
8
  */
9
9
  children: ReactNode;
10
+ /**
11
+ * Set a maximum height of the menu after which it will scroll.
12
+ */
13
+ maxHeight?: string;
10
14
  };
11
15
  declare type MenuComponent = ForwardRefExoticComponent<MenuProps> & {
12
16
  Item: Polymorphic.ForwardRefComponent<Polymorphic.IntrinsicElement<typeof MenuItem>, Polymorphic.OwnProps<typeof MenuItem> & MenuItemProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAA;AAElG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACxF,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAA;AAI3D,oBAAY,SAAS,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG;IACzD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAA;AAED,aAAK,aAAa,GAAG,yBAAyB,CAAC,SAAS,CAAC,GAAG;IAC1D,IAAI,EAAE,WAAW,CAAC,mBAAmB,CACnC,WAAW,CAAC,gBAAgB,CAAC,OAAO,QAAQ,CAAC,EAC7C,WAAW,CAAC,QAAQ,CAAC,OAAO,QAAQ,CAAC,GAAG,aAAa,CACtD,CAAC;IACF,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAC3C,WAAW,CAAC,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,EACrD,WAAW,CAAC,QAAQ,CAAC,OAAO,gBAAgB,CAAC,GAAG,qBAAqB,CACtE,CAAC;CACH,CAAA;AAED,eAAO,MAAM,IAAI,eA2BE,CAAA"}
1
+ {"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AACA,OAAO,EAAwB,SAAS,EAAE,cAAc,EAAE,yBAAyB,EAAiB,MAAM,OAAO,CAAA;AAEjH,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAA;AACxF,OAAO,EAAmB,WAAW,EAAE,MAAM,cAAc,CAAA;AAI3D,oBAAY,SAAS,GAAG,cAAc,CAAC,gBAAgB,CAAC,GAAG;IACzD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAA;AAED,aAAK,aAAa,GAAG,yBAAyB,CAAC,SAAS,CAAC,GAAG;IAC1D,IAAI,EAAE,WAAW,CAAC,mBAAmB,CACnC,WAAW,CAAC,gBAAgB,CAAC,OAAO,QAAQ,CAAC,EAC7C,WAAW,CAAC,QAAQ,CAAC,OAAO,QAAQ,CAAC,GAAG,aAAa,CACtD,CAAC;IACF,YAAY,EAAE,WAAW,CAAC,mBAAmB,CAC3C,WAAW,CAAC,gBAAgB,CAAC,OAAO,gBAAgB,CAAC,EACrD,WAAW,CAAC,QAAQ,CAAC,OAAO,gBAAgB,CAAC,GAAG,qBAAqB,CACtE,CAAC;CACH,CAAA;AAED,eAAO,MAAM,IAAI,eAmCE,CAAA"}
@@ -6,9 +6,12 @@ import { MenuItemCheckbox } from './menu-item/menu-item-checkbox';
6
6
  import { Stack, Elevator } from '../..';
7
7
  import styles from './menu.module.css';
8
8
  import clsx from 'clsx';
9
- export const Menu = forwardRef(({ className, children, ...otherProps }, forwardedRef) => {
9
+ export const Menu = forwardRef(({ className, children, maxHeight, style, ...otherProps }, forwardedRef) => {
10
10
  const renderedChildren = Children.toArray(children).filter(Boolean);
11
- return (_jsx(Elevator, { resting: 2, children: _jsx(Stack, { as: "ul", ref: forwardedRef, className: clsx(styles.Menu, className), vPadding: 8, role: "menu", ...otherProps, children: _jsx(RovingTabIndexProvider, { options: { direction: 'vertical', loopAround: true }, children: Children.map(renderedChildren, (child) => (_jsx(Stack, { as: "li", role: "none", vPadding: child.type?.displayName === 'Separator' ? 8 : undefined, children: child }))) }) }) }));
11
+ const computedStyle = {
12
+ '--max-height': maxHeight
13
+ };
14
+ return (_jsx(Elevator, { resting: 2, children: _jsx(Stack, { as: "ul", ref: forwardedRef, className: clsx(styles.Menu, className), style: { ...computedStyle, ...style }, "data-menu-should-scroll": Boolean(maxHeight), vPadding: 8, role: "menu", ...otherProps, children: _jsx(RovingTabIndexProvider, { options: { direction: 'vertical', loopAround: true }, children: Children.map(renderedChildren, (child) => (_jsx(Stack, { as: "li", role: "none", vPadding: child.type?.displayName === 'Separator' ? 8 : undefined, children: child }))) }) }) }));
12
15
  });
13
16
  Menu.displayName = 'Menu';
14
17
  Menu.Item = MenuItem;
@@ -1 +1 @@
1
- .Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.44rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .44rem}
1
+ .Menu{background-color:var(--global-background);border:1px solid var(--dimmed-1);border-radius:.44rem;list-style-type:none;overflow:hidden;position:relative}.Menu hr{margin:0 .44rem}.Menu[data-menu-should-scroll=true]{-webkit-overflow-scrolling:touch;max-height:var(--max-height);overflow:auto;overscroll-behavior:contain}
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAIzE,oBAAY,UAAU,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC3D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAED,aAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAA;AAqBD,eAAO,MAAM,KAAK,gBAiCE,CAAA"}
1
+ {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIrD,OAAO,EAAgB,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAIzE,oBAAY,UAAU,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IAC3D;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAA;AAED,aAAK,cAAc,GAAG,KAAK,CAAC,yBAAyB,CAAC,UAAU,CAAC,GAAG;IAClE,OAAO,EAAE,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;CAC7D,CAAA;AAqBD,eAAO,MAAM,KAAK,gBAmCE,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
- import { motion } from 'framer-motion';
3
+ import { domMax, LazyMotion, m } from 'framer-motion';
4
4
  import clsx from 'clsx';
5
5
  import { FocusOn } from 'react-focus-on';
6
6
  import { ModalContent } from './content/modal-content';
@@ -26,7 +26,7 @@ const ModalAnimation = {
26
26
  };
27
27
  export const Modal = forwardRef(({ children, className, closeOnClickOutside = true, ...otherProps }, forwardedRef) => {
28
28
  const { titleId, onClose } = useOverlayContext();
29
- return (_jsx("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(motion.div, { variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, children: children }) }) }));
29
+ return (_jsx("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, className: clsx(styles.Modal, className), ref: forwardedRef, ...otherProps, children: _jsx(FocusOn, { onClickOutside: closeOnClickOutside ? onClose : undefined, onEscapeKey: onClose, children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: ModalAnimation, initial: "hidden", animate: "visible", exit: "hidden", className: styles.Container, children: children }) }) }) }));
30
30
  });
31
31
  Modal.displayName = 'Modal';
32
32
  Modal.Content = ModalContent;
@@ -1 +1 @@
1
- {"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAM5C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA4C5D,CAAA"}
1
+ {"version":3,"file":"overlay-container.d.ts","sourceRoot":"","sources":["../../../src/components/overlay-container/overlay-container.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAM5C,oBAAY,qBAAqB,GAAG;IAClC;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC;;OAEG;IACH,OAAO,CAAC,IAAI,IAAI,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8C5D,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AnimatePresence, motion } from 'framer-motion';
2
+ import { domMax, LazyMotion, m, AnimatePresence } from 'framer-motion';
3
3
  import { useEffect } from 'react';
4
4
  import { createPortal } from 'react-dom';
5
5
  import { useUIDSeed } from 'react-uid';
@@ -12,6 +12,6 @@ export const OverlayContainer = ({ children, root = document.body, overlayColor
12
12
  throw new Error('An OverlayContainer must not be inside another container. Please change the root prop.');
13
13
  }
14
14
  }, [root]);
15
- const content = (_jsx(OverlayProvider, { onClose: onClose, children: _jsx(AnimatePresence, { exitBeforeEnter: true, children: children && (_jsxs("div", { "data-overlay-container": true, "data-overlay-container-obfuscate": obfuscate, className: styles.OverlayContainer, style: { zIndex: index }, children: [obfuscate && (_jsx(motion.span, { className: styles.Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, transition: { duration: 0.2 }, exit: { opacity: 0 } }, seedID('modal-backdrop'))), children] })) }) }));
15
+ const content = (_jsx(OverlayProvider, { onClose: onClose, children: _jsx(AnimatePresence, { exitBeforeEnter: true, children: children && (_jsx("div", { "data-overlay-container": true, "data-overlay-container-obfuscate": obfuscate, className: styles.OverlayContainer, style: { zIndex: index }, children: _jsxs(LazyMotion, { features: domMax, children: [obfuscate && (_jsx(m.span, { className: styles.Backdrop, "data-overlay-color": overlayColor, initial: { opacity: 0 }, animate: { opacity: 0.95 }, transition: { duration: 0.2 }, exit: { opacity: 0 } }, seedID('modal-backdrop'))), children] }) })) }) }));
16
16
  return createPortal(content, root);
17
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EASV,MAAM,OAAO,CAAA;AAId,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAY,MAAM,gBAAgB,CAAA;AAK3F,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAA;AAqBD,eAAO,MAAM,OAAO;IAjElB;;OAEG;cACO,SAAS;IACnB;;OAEG;aACM,SAAS;IAClB;;OAEG;;IAEH;;;;;;;;OAQG;;IAEH;;OAEG;;IAEH;;;OAGG;2BACmB,OAAO,KAAK,IAAI;IACtC;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;kDAgJH,CAAA"}
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../src/components/popover/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EASV,MAAM,OAAO,CAAA;AAId,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAY,MAAM,gBAAgB,CAAA;AAK3F,oBAAY,YAAY,GAAG,cAAc,GAAG;IAC1C;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAA;AAqBD,eAAO,MAAM,OAAO;IAjElB;;OAEG;cACO,SAAS;IACnB;;OAEG;aACM,SAAS;IAClB;;OAEG;;IAEH;;;;;;;;OAQG;;IAEH;;OAEG;;IAEH;;;OAGG;2BACmB,OAAO,KAAK,IAAI;IACtC;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;kDAkJH,CAAA"}
@@ -4,7 +4,7 @@ import { useKeyPress, useFocusWithin } from 'ahooks';
4
4
  import styles from './popover.module.css';
5
5
  import { useUIDSeed } from 'react-uid';
6
6
  import { usePopperTooltip } from 'react-popper-tooltip';
7
- import { AnimatePresence, motion } from 'framer-motion';
7
+ import { domMax, LazyMotion, m, AnimatePresence } from 'framer-motion';
8
8
  import clsx from 'clsx';
9
9
  const PopoverAnimation = {
10
10
  visible: {
@@ -82,12 +82,12 @@ export const Popover = forwardRef(({ children, trigger, offset = 8, placement =
82
82
  id: seedID('popover-trigger'),
83
83
  key: seedID('popover-trigger'),
84
84
  'aria-haspopup': 'true',
85
- 'aria-controls': seedID('popover-menu'),
85
+ 'aria-controls': seedID('popover-dialog'),
86
86
  'aria-expanded': isOpen,
87
87
  ...otherProps
88
- })), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(motion.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
89
- id: seedID('popover-menu'),
90
- 'aria-labelledby': seedID('popover-trigger')
91
- })) }) }, seedID('tooltip-content'))) })] }));
88
+ })), _jsx(AnimatePresence, { children: visible && (_jsx("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), ...getTooltipProps({ className: styles.PopUp }), children: _jsx(LazyMotion, { features: domMax, children: _jsx(m.div, { variants: PopoverAnimation, initial: "hidden", animate: "visible", exit: "hidden", children: Children.map(children, (child) => isValidElement(child) && cloneElement(child, {
89
+ id: seedID('popover-dialog'),
90
+ 'aria-labelledby': seedID('popover-trigger')
91
+ })) }) }) }, seedID('tooltip-content'))) })] }));
92
92
  });
93
93
  Popover.displayName = 'Popover';
@@ -1 +1 @@
1
- .Slider svg{flex-shrink:0}.Input{--track-color:var(--global-vibrancy-background);--progress-color:var(--dimmed-3);--thumb-size:24px;--progress-direction:calc(-9999px - var(--thumb-size)/2);-webkit-appearance:none;appearance:none;background:transparent;border-radius:100px;height:var(--thumb-size);overflow:hidden;width:100%}[dir=rtl] .Input{--progress-direction:calc(9999px + var(--thumb-size)/2)}.Slider[data-slider-dimension=small] .Input{--thumb-size:16px}.Input::-webkit-slider-runnable-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-webkit-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-range-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-moz-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-focus-outer{border:0}.Input::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-webkit-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input::-webkit-slider-thumb:active,.Input::-webkit-slider-thumb:focus{background-color:var(--dimmed-6)}.Input::-moz-range-thumb{appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-moz-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input::-moz-range-thumb:active,.Input::-moz-range-thumb:focus{background-color:var(--dimmed-6)}.Input:active::-webkit-slider-thumb{background-color:var(--dimmed-7);box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);cursor:grabbing}.Input:active::-moz-range-thumb{background-color:var(--dimmed-7);box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);cursor:grabbing}.Input:disabled::-webkit-slider-runnable-track{background:var(--global-disabled-background);cursor:not-allowed}.Input:disabled::-moz-range-track{background:var(--global-disabled-background);cursor:not-allowed}.Input:disabled::-webkit-slider-thumb{background:none var(--global-disabled-foreground);box-shadow:var(--progress-direction) 0 0 9999px transparent;cursor:not-allowed}.Input:disabled::-moz-range-thumb{background:none var(--global-disabled-foreground);box-shadow:var(--progress-direction) 0 0 9999px transparent;cursor:not-allowed}.CurrentValue,.Value{flex-shrink:0}
1
+ .Slider svg{flex-shrink:0}.Input{--track-color:var(--global-vibrancy-background);--progress-color:var(--dimmed-3);--thumb-size:24px;--progress-direction:calc(-9999px - var(--thumb-size)/2);-webkit-appearance:none;appearance:none;background:transparent;border-radius:100px;height:var(--thumb-size);overflow:hidden;width:100%}[dir=rtl] .Input{--progress-direction:calc(9999px + var(--thumb-size)/2)}.Slider[data-slider-dimension=small] .Input{--thumb-size:16px}.Input::-webkit-slider-runnable-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-webkit-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-range-track{background:var(--track-color);cursor:pointer;height:var(--thumb-size);-moz-transition:background-color .2s ease-out;transition:background-color .2s ease-out;width:100%}.Input::-moz-focus-outer{border:0}.Input::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-webkit-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input:active::-webkit-slider-thumb,.Input:focus::-webkit-slider-thumb{background-color:var(--dimmed-6)}.Input::-moz-range-thumb{appearance:none;background-color:var(--dimmed-7);border:0;border-radius:100%;box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);height:var(--thumb-size);outline-offset:-2px;-moz-transition:box-shadow .1s ease-out,background-color .1s ease-out;transition:box-shadow .1s ease-out,background-color .1s ease-out;width:var(--thumb-size)}.Input:active::-moz-range-thumb,.Input:focus::-moz-range-thumb{background-color:var(--dimmed-6)}.Input:active::-webkit-slider-thumb{background-color:var(--dimmed-7);box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);cursor:grabbing}.Input:active::-moz-range-thumb{background-color:var(--dimmed-7);box-shadow:var(--progress-direction) 0 0 9999px var(--progress-color);cursor:grabbing}.Input:disabled::-webkit-slider-runnable-track{background:var(--global-disabled-background);cursor:not-allowed}.Input:disabled::-moz-range-track{background:var(--global-disabled-background);cursor:not-allowed}.Input:disabled::-webkit-slider-thumb{background:none var(--global-disabled-foreground);box-shadow:var(--progress-direction) 0 0 9999px transparent;cursor:not-allowed}.Input:disabled::-moz-range-thumb{background:none var(--global-disabled-foreground);box-shadow:var(--progress-direction) 0 0 9999px transparent;cursor:not-allowed}.CurrentValue,.Value{flex-shrink:0}
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,OAAO,CAAA;AAIjD,oBAAY,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO;IAVlB;;OAEG;;IAEH;;OAEG;;iDA4DH,CAAA"}
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../../src/components/spinner/spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAE,MAAM,OAAO,CAAA;AAIjD,oBAAY,YAAY,GAAG,aAAa,CAAC,UAAU,CAAC,GAAG;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO;IAVlB;;OAEG;;IAEH;;OAEG;;iDA8DH,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import clsx from 'clsx';
4
- import { motion } from 'framer-motion';
4
+ import { domMax, LazyMotion, m } from 'framer-motion';
5
5
  export const Spinner = forwardRef(({ className, style, color, dimension = 'big' }, forwardedRef) => {
6
6
  const attributes = {
7
7
  small: {
@@ -14,10 +14,10 @@ export const Spinner = forwardRef(({ className, style, color, dimension = 'big'
14
14
  size: 30
15
15
  }
16
16
  };
17
- return (_jsx(motion.svg, { ref: forwardedRef, className: clsx(className), animate: { rotate: '2turn' }, transition: {
18
- duration: 2,
19
- repeat: Infinity,
20
- repeatDelay: 2
21
- }, style: { ...style, originX: '50%', originY: '50%' }, width: attributes[dimension].size, height: attributes[dimension].size, viewBox: "0 0 38 38", stroke: color || 'currentColor', xmlns: "http://www.w3.org/2000/svg", strokeLinecap: "round", children: _jsxs("g", { transform: "translate(1 1)", strokeWidth: 2, fill: "none", fillRule: "evenodd", children: [_jsx("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }), _jsx("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "1s", repeatCount: "indefinite" }) })] }) }));
17
+ return (_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(m.svg, { ref: forwardedRef, className: clsx(className), animate: { rotate: '2turn' }, transition: {
18
+ duration: 2,
19
+ repeat: Infinity,
20
+ repeatDelay: 2
21
+ }, style: { ...style, originX: '50%', originY: '50%' }, width: attributes[dimension].size, height: attributes[dimension].size, viewBox: "0 0 38 38", stroke: color || 'currentColor', xmlns: "http://www.w3.org/2000/svg", strokeLinecap: "round", children: _jsxs("g", { transform: "translate(1 1)", strokeWidth: 2, fill: "none", fillRule: "evenodd", children: [_jsx("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }), _jsx("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: _jsx("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "1s", repeatCount: "indefinite" }) })] }) }) }));
22
22
  });
23
23
  Spinner.displayName = 'Spinner';
@@ -1,35 +1,36 @@
1
- import { ReactNode } from 'react';
2
- import { TabItem } from './tab-item';
3
- import { TabListProps } from './tab-list';
4
- import { TabPanelProps } from './tab-panel';
5
- import { Polymorphic } from '../..';
6
- /**
7
- * Tab.Root
8
- * Public api
9
- */
10
- export declare type TabProps = PropsWithClass & {
1
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
2
+ import { PropsWithChildren } from 'react';
3
+ export declare type TabProps = PropsWithChildren<PropsWithClass> & {
11
4
  /**
12
- * Pass the children Tab.Panel components.
5
+ * The value for the selected tab, if controlled
13
6
  */
14
- children: ReactNode;
7
+ value?: TabsPrimitive.TabsProps['value'];
15
8
  /**
16
- * Set the index of the tab to be selected.
9
+ * The value of the tab to select by default, if uncontrolled
17
10
  */
18
- state?: [number, React.Dispatch<React.SetStateAction<number>>];
11
+ defaultValue?: TabsPrimitive.TabsProps['defaultValue'];
19
12
  /**
20
- * Callback function called when the selected tab changes.
13
+ * A function called when a new tab is selected
21
14
  */
22
- onChange?(index: number): void;
15
+ onValueChange?: TabsPrimitive.TabsProps['onValueChange'];
16
+ /**
17
+ * The direction of navigation between toolbar items.
18
+ * @defaultValue ltr
19
+ */
20
+ dir?: TabsPrimitive.TabsProps['dir'];
21
+ /**
22
+ * When `automatic`, tabs are activated when receiving focus.
23
+ * When `manual`, tabs are activated when clicked.
24
+ */
25
+ activationMode?: TabsPrimitive.TabsProps['activationMode'];
26
+ /**
27
+ * When true, keyboard navigation will loop from last tab to first, and vice versa.
28
+ * @defaultValue true
29
+ */
30
+ loop?: TabsPrimitive.TabsListProps['loop'];
23
31
  };
24
- declare type TabComponent = React.ForwardRefExoticComponent<TabProps> & {
25
- Panel: React.ForwardRefExoticComponent<TabPanelProps>;
26
- Item: React.ForwardRefExoticComponent<Polymorphic.OwnProps<typeof TabItem>>;
27
- List: React.ForwardRefExoticComponent<TabListProps>;
32
+ export declare const Tab: {
33
+ ({ className, children, onValueChange, defaultValue, loop, ...otherProps }: TabProps): JSX.Element;
34
+ Panel: ({ className, children, label, ...otherProps }: import("./tabs-panel").TabPanelProps) => JSX.Element;
28
35
  };
29
- /**
30
- * Tab.Root
31
- * Component
32
- */
33
- export declare const Tab: TabComponent;
34
- export {};
35
36
  //# sourceMappingURL=tab.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,SAAS,EAIV,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAW,YAAY,EAAE,MAAM,YAAY,CAAA;AAClD,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAQ1C;;;GAGG;AACH,oBAAY,QAAQ,GAAG,cAAc,GAAG;IACtC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC/D;;OAEG;IACH,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAA;AAED,aAAK,YAAY,GAAG,KAAK,CAAC,yBAAyB,CAAC,QAAQ,CAAC,GAAG;IAC9D,KAAK,EAAE,KAAK,CAAC,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACtD,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC;IAC5E,IAAI,EAAE,KAAK,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC;CACrD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,GAAG,cAwDE,CAAA"}
1
+ {"version":3,"file":"tab.d.ts","sourceRoot":"","sources":["../../../src/components/tab/tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAA;AAErD,OAAO,EACqB,iBAAiB,EAC5C,MAAM,OAAO,CAAA;AAQd,oBAAY,QAAQ,GAAG,iBAAiB,CAAC,cAAc,CAAC,GAAG;IACzD;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACvD;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IACzD;;;OAGG;IACH,GAAG,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACrC;;;OAGG;IACH,cAAc,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC3D;;;OAGG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,GAAG;gFAOb,QAAQ;;CAwCV,CAAA"}
@@ -1,35 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState, forwardRef, Children, cloneElement, isValidElement } from 'react';
3
- import clsx from 'clsx';
4
- import { useUIDSeed } from 'react-uid';
5
- import { TabItem } from './tab-item';
6
- import { TabList } from './tab-list';
7
- import { TabPanel } from './tab-panel';
8
- import { Tabs as TabsWrapper } from './primitive-tab';
2
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
3
+ import { domMax, LazyMotion, m } from 'framer-motion';
4
+ import { Children, isValidElement, useCallback, useState } from 'react';
5
+ import { Button } from '../..';
9
6
  import styles from './tab.module.css';
10
- /**
11
- * Tab.Root
12
- * Component
13
- */
14
- export const Tab = forwardRef(({ children, className, state, onChange, ...otherProps }, forwardedRef) => {
15
- const innerState = useState(0);
16
- const tabState = state || innerState;
17
- const [currentTab] = tabState;
18
- const seedID = useUIDSeed();
19
- useEffect(() => {
20
- if (typeof onChange === 'function') {
21
- onChange(currentTab);
22
- }
23
- }, [currentTab, onChange]);
24
- return (_jsx("div", { ref: forwardedRef, className: clsx(styles.Tab, className), ...otherProps, children: _jsxs(TabsWrapper, { state: tabState, children: [_jsx(TabList, { children: Children.map(children, (child, index) => isValidElement(child) && (_jsx(TabItem, { id: seedID('tab-item'), "aria-controls": seedID('tab-panel'), icon: child.props.icon, children: child.props.label }))) }), Children.map(children, (child, index) => isValidElement(child) && cloneElement(child, {
25
- id: seedID('tab-panel'),
26
- 'aria-labelledby': seedID('tab-item')
27
- }))] }) }));
28
- });
29
- Tab.displayName = 'Tab';
30
- /* -------------------------------------------------------------------------- */
31
- /* Export */
32
- /* -------------------------------------------------------------------------- */
7
+ import { TabPanel } from './tabs-panel';
8
+ import { useUIDSeed } from 'react-uid';
9
+ export const Tab = ({ className, children, onValueChange, defaultValue, loop, ...otherProps }) => {
10
+ const [activeItem, setActiveItem] = useState(defaultValue ?? '');
11
+ const uid = useUIDSeed();
12
+ const handleOnVlaueChange = useCallback((value) => {
13
+ onValueChange?.(value);
14
+ setActiveItem(value);
15
+ }, [onValueChange]);
16
+ return (_jsxs(TabsPrimitive.Root, { defaultValue: defaultValue, onValueChange: handleOnVlaueChange, className: className, ...otherProps, children: [_jsx(LazyMotion, { features: domMax, strict: true, children: _jsx(TabsPrimitive.List, { className: styles.List, loop: loop, children: Children.map(children, child => isValidElement(child) && (_jsx(TabsPrimitive.Trigger, { value: child.props.value, disabled: child.props.disabled, className: styles.Trigger, asChild: true, children: _jsxs(Button, { kind: "flat", icon: child.props.icon, children: [child.props.label, (child.props.value === activeItem) && 'active' && (_jsx(m.span, { className: styles.Highlight, layoutId: uid('tab-highlight') }))] }) }))) }) }), children] }));
17
+ };
33
18
  Tab.Panel = TabPanel;
34
- Tab.Item = TabItem;
35
- Tab.List = TabList;
@@ -1 +1 @@
1
- .Tab{display:block}.TabList{--separator-size:1px;-webkit-overflow-scrolling:touch;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-2);display:flex;flex-wrap:nowrap;outline:none;overflow-x:auto;overscroll-behavior-x:contain;padding:0 .44rem;scroll-snap-type:x mandatory}@media (max-width:47.999em){.TabList{-ms-overflow-style:none;scrollbar-color:transparent transparent;scrollbar-width:none}.TabList::-webkit-scrollbar{display:none}.TabList::-webkit-scrollbar-track{background:transparent}.TabList::-webkit-scrollbar-thumb{background-color:transparent;border:3px solid transparent;border-radius:6px}}.TabItem{-webkit-appearance:none;appearance:none;background-color:transparent;block-size:2.67rem;border:0;color:var(--dimmed-6);flex-shrink:0;font-family:inherit;font-size:inherit;outline-offset:-4px;overflow:unset;padding:.44rem .89rem;position:relative;white-space:nowrap}.TabItem[aria-selected=true]{-webkit-text-stroke:.7px currentcolor;color:var(--global-foreground)}.TabItem:not([aria-selected=true]) svg{fill:var(--dimmed-6)}.TabItem:not([aria-selected=true]):hover{cursor:pointer}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;left:0;pointer-events:none;position:absolute;width:100%}.TabPanel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1))}@keyframes fade-in{0%{opacity:0;transform:translate(var(--fade-from-x,0),var(--fade-from-y,0))}to{opacity:unset;transform:none}}
1
+ .List{--separator-size:2px;box-shadow:inset 0 calc(var(--separator-size)*-1) 0 var(--dimmed-1);overflow:auto;white-space:nowrap}.Trigger{-webkit-appearance:none;appearance:none;background:none;background-color:transparent;block-size:2.67rem;border:0;border-radius:0;color:var(--dimmed-6);flex-shrink:0;font-family:inherit;font-size:inherit;font-weight:token(--font-weight-semi-bold);outline-offset:calc(var(--separator-size)*-1);overflow:unset;padding:.44rem .89rem;position:relative;white-space:nowrap}.Trigger,.Trigger:not([aria-disabled=true]){-webkit-backdrop-filter:none;backdrop-filter:none}.Trigger:not([aria-disabled=true]){color:var(--dimmed-5)}.Trigger.Trigger:not([aria-disabled=true]):is(:hover,:focus,:active){-webkit-backdrop-filter:none;backdrop-filter:none;background:none;color:var(--global-foreground)}.Trigger.Trigger[aria-disabled=true]{-webkit-backdrop-filter:none;backdrop-filter:none;background:none}.Trigger[data-state=active]{-webkit-text-stroke:.4px var(--global-foreground);color:var(--global-foreground)}.Highlight{background:var(--cta-default);border-radius:2px 2px 0 0;bottom:0;height:4px;pointer-events:none;position:absolute;width:100%}.Panel{animation:fade-in .2s;animation-timing-function:cubic-bezier(0,0,.34,1))}@keyframes fade-in{0%{opacity:0;transform:translate(var(--fade-from-x,0),var(--fade-from-y,0))}to{opacity:unset;transform:none}}
@@ -0,0 +1,10 @@
1
+ import * as TabsPrimitive from '@radix-ui/react-tabs';
2
+ import { IconProps } from '../..';
3
+ import { PropsWithChildren } from 'react';
4
+ export declare type TabPanelProps = PropsWithChildren<PropsWithClass> & {
5
+ label: string;
6
+ icon?: IconProps['source'];
7
+ value: TabsPrimitive.TabsContentProps['value'];
8
+ };
9
+ export declare const TabPanel: ({ className, children, label, ...otherProps }: TabPanelProps) => JSX.Element;
10
+ //# sourceMappingURL=tabs-panel.d.ts.map