reshaped 3.5.4-canary.0 → 3.6.0-canary.1

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 (167) hide show
  1. package/CHANGELOG.md +29 -46
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.d.ts +37 -32
  4. package/dist/bundle.js +11 -11
  5. package/dist/components/Accordion/AccordionControlled.js +1 -1
  6. package/dist/components/Accordion/AccordionTrigger.js +1 -1
  7. package/dist/components/ActionBar/ActionBar.js +1 -1
  8. package/dist/components/Actionable/Actionable.js +1 -1
  9. package/dist/components/Avatar/Avatar.js +1 -1
  10. package/dist/components/Badge/Badge.js +1 -1
  11. package/dist/components/Badge/BadgeContainer.js +1 -1
  12. package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
  13. package/dist/components/Button/Button.js +1 -1
  14. package/dist/components/Button/Button.types.d.ts +1 -1
  15. package/dist/components/Button/ButtonGroup.js +1 -1
  16. package/dist/components/Calendar/CalendarDate.js +1 -1
  17. package/dist/components/Card/Card.d.ts +1 -1
  18. package/dist/components/Card/Card.js +1 -1
  19. package/dist/components/Card/tests/Card.stories.d.ts +1 -1
  20. package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
  21. package/dist/components/Carousel/Carousel.js +4 -3
  22. package/dist/components/Carousel/CarouselControl.js +1 -1
  23. package/dist/components/Checkbox/Checkbox.js +1 -1
  24. package/dist/components/Container/Container.js +1 -1
  25. package/dist/components/Dismissible/Dismissible.js +1 -1
  26. package/dist/components/Divider/Divider.js +1 -1
  27. package/dist/components/DropdownMenu/DropdownMenu.js +2 -2
  28. package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
  29. package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +1 -1
  30. package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +1 -1
  31. package/dist/components/FileUpload/FileUpload.js +1 -1
  32. package/dist/components/Flyout/Flyout.constants.d.ts +6 -0
  33. package/dist/components/Flyout/Flyout.constants.js +19 -0
  34. package/dist/components/{_private/Flyout → Flyout}/Flyout.types.d.ts +3 -3
  35. package/dist/components/{_private/Flyout → Flyout}/FlyoutContent.js +28 -22
  36. package/dist/components/{_private/Flyout → Flyout}/FlyoutControlled.js +9 -9
  37. package/dist/components/{_private/Flyout → Flyout}/tests/Flyout.stories.d.ts +6 -4
  38. package/dist/components/{_private/Flyout → Flyout}/tests/Flyout.stories.js +128 -118
  39. package/dist/components/{_private/Flyout → Flyout}/useFlyout.d.ts +1 -1
  40. package/dist/components/Flyout/useFlyout.js +116 -0
  41. package/dist/components/Flyout/utilities/calculatePosition.d.ts +30 -0
  42. package/dist/components/Flyout/utilities/calculatePosition.js +129 -0
  43. package/dist/components/Flyout/utilities/flyout.d.ts +11 -0
  44. package/dist/components/Flyout/utilities/flyout.js +79 -0
  45. package/dist/components/Flyout/utilities/isFullyVisible.d.ts +10 -0
  46. package/dist/components/Flyout/utilities/isFullyVisible.js +24 -0
  47. package/dist/components/FormControl/FormControl.context.d.ts +0 -2
  48. package/dist/components/Grid/Grid.js +1 -1
  49. package/dist/components/Hidden/Hidden.js +1 -1
  50. package/dist/components/Hotkey/Hotkey.js +1 -1
  51. package/dist/components/Icon/Icon.js +1 -1
  52. package/dist/components/Image/Image.js +1 -1
  53. package/dist/components/Link/Link.d.ts +1 -1
  54. package/dist/components/Link/Link.js +1 -1
  55. package/dist/components/Loader/Loader.js +1 -1
  56. package/dist/components/MenuItem/MenuItem.js +1 -1
  57. package/dist/components/Modal/Modal.js +1 -1
  58. package/dist/components/NumberField/NumberFieldControlled.js +1 -1
  59. package/dist/components/Overlay/Overlay.js +1 -1
  60. package/dist/components/PinField/PinFieldControlled.js +1 -1
  61. package/dist/components/Popover/Popover.d.ts +1 -1
  62. package/dist/components/Popover/Popover.js +4 -4
  63. package/dist/components/Popover/Popover.module.css +1 -1
  64. package/dist/components/Popover/Popover.types.d.ts +3 -1
  65. package/dist/components/Popover/tests/Popover.stories.d.ts +48 -9
  66. package/dist/components/Popover/tests/Popover.stories.js +209 -85
  67. package/dist/components/Progress/Progress.js +1 -1
  68. package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
  69. package/dist/components/Radio/Radio.js +1 -1
  70. package/dist/components/Reshaped/Reshaped.js +1 -1
  71. package/dist/components/Resizable/Resizable.js +1 -1
  72. package/dist/components/Scrim/Scrim.js +1 -1
  73. package/dist/components/ScrollArea/ScrollArea.js +6 -6
  74. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  75. package/dist/components/Select/Select.js +1 -1
  76. package/dist/components/Skeleton/Skeleton.js +1 -1
  77. package/dist/components/Slider/Slider.types.d.ts +34 -7
  78. package/dist/components/Slider/SliderControlled.js +32 -20
  79. package/dist/components/Slider/SliderThumb.js +4 -4
  80. package/dist/components/Slider/SliderUncontrolled.js +3 -2
  81. package/dist/components/Slider/tests/Slider.stories.d.ts +38 -8
  82. package/dist/components/Slider/tests/Slider.stories.js +268 -54
  83. package/dist/components/Stepper/Stepper.js +1 -1
  84. package/dist/components/Switch/Switch.js +1 -1
  85. package/dist/components/Table/Table.js +6 -3
  86. package/dist/components/Table/Table.module.css +1 -1
  87. package/dist/components/Tabs/TabsContext.d.ts +2 -2
  88. package/dist/components/Tabs/TabsItem.js +1 -1
  89. package/dist/components/Tabs/TabsList.js +3 -34
  90. package/dist/components/Tabs/TabsPanel.js +1 -1
  91. package/dist/components/Text/Text.js +1 -1
  92. package/dist/components/TextArea/TextArea.js +1 -1
  93. package/dist/components/TextField/TextField.js +1 -1
  94. package/dist/components/Theme/Theme.js +1 -1
  95. package/dist/components/Timeline/Timeline.js +1 -1
  96. package/dist/components/Toast/ToastContainer.js +1 -1
  97. package/dist/components/Toast/ToastRegion.js +1 -1
  98. package/dist/components/Tooltip/Tooltip.js +1 -1
  99. package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
  100. package/dist/components/View/View.js +1 -1
  101. package/dist/components/_private/Aligner/Aligner.js +1 -1
  102. package/dist/components/_private/Expandable/Expandable.js +1 -1
  103. package/dist/components/_private/HiddenInput/HiddenInput.js +1 -1
  104. package/dist/config/tailwind.d.ts +1 -1
  105. package/dist/hooks/_private/useFadeSide.d.ts +5 -0
  106. package/dist/hooks/_private/useFadeSide.js +47 -0
  107. package/dist/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
  108. package/dist/index.d.ts +37 -32
  109. package/dist/index.js +21 -17
  110. package/dist/styles/align/index.js +1 -1
  111. package/dist/styles/aspectRatio/index.js +1 -1
  112. package/dist/styles/bleed/index.js +1 -1
  113. package/dist/styles/border/index.js +1 -1
  114. package/dist/styles/height/index.js +1 -1
  115. package/dist/styles/inset/index.js +1 -1
  116. package/dist/styles/justify/index.js +1 -1
  117. package/dist/styles/maxHeight/index.js +1 -1
  118. package/dist/styles/maxWidth/index.js +1 -1
  119. package/dist/styles/minHeight/index.js +1 -1
  120. package/dist/styles/minWidth/index.js +1 -1
  121. package/dist/styles/padding/index.js +1 -1
  122. package/dist/styles/position/index.js +1 -1
  123. package/dist/styles/radius/index.js +1 -1
  124. package/dist/styles/textAlign/index.js +1 -1
  125. package/dist/styles/width/index.js +1 -1
  126. package/dist/utilities/dom/event.d.ts +7 -0
  127. package/dist/utilities/dom/event.js +11 -0
  128. package/dist/utilities/dom/find.d.ts +6 -9
  129. package/dist/utilities/dom/find.js +17 -15
  130. package/dist/utilities/dom/index.d.ts +2 -1
  131. package/dist/utilities/dom/index.js +2 -1
  132. package/dist/utilities/helpers.d.ts +1 -15
  133. package/dist/utilities/helpers.js +11 -133
  134. package/dist/utilities/props.d.ts +13 -0
  135. package/dist/utilities/props.js +83 -0
  136. package/dist/utilities/scroll/lock.js +4 -3
  137. package/package.json +24 -24
  138. package/CHANGELOG-old.md +0 -14
  139. package/dist/components/Popover/tests/Popover.test.stories.d.ts +0 -39
  140. package/dist/components/Popover/tests/Popover.test.stories.js +0 -167
  141. package/dist/components/Slider/tests/Slider.test.stories.d.ts +0 -38
  142. package/dist/components/Slider/tests/Slider.test.stories.js +0 -150
  143. package/dist/components/_private/Flyout/Flyout.constants.d.ts +0 -3
  144. package/dist/components/_private/Flyout/Flyout.constants.js +0 -3
  145. package/dist/components/_private/Flyout/useFlyout.js +0 -211
  146. package/dist/components/_private/Flyout/utilities/calculatePosition.d.ts +0 -19
  147. package/dist/components/_private/Flyout/utilities/calculatePosition.js +0 -102
  148. package/dist/components/_private/Flyout/utilities/isFullyVisible.d.ts +0 -8
  149. package/dist/components/_private/Flyout/utilities/isFullyVisible.js +0 -16
  150. /package/dist/components/{_private/Flyout → Flyout}/Flyout.context.d.ts +0 -0
  151. /package/dist/components/{_private/Flyout → Flyout}/Flyout.context.js +0 -0
  152. /package/dist/components/{_private/Flyout → Flyout}/Flyout.d.ts +0 -0
  153. /package/dist/components/{_private/Flyout → Flyout}/Flyout.js +0 -0
  154. /package/dist/components/{_private/Flyout → Flyout}/Flyout.module.css +0 -0
  155. /package/dist/components/{_private/Flyout → Flyout}/Flyout.types.js +0 -0
  156. /package/dist/components/{_private/Flyout → Flyout}/FlyoutContent.d.ts +0 -0
  157. /package/dist/components/{_private/Flyout → Flyout}/FlyoutControlled.d.ts +0 -0
  158. /package/dist/components/{_private/Flyout → Flyout}/FlyoutTrigger.d.ts +0 -0
  159. /package/dist/components/{_private/Flyout → Flyout}/FlyoutTrigger.js +0 -0
  160. /package/dist/components/{_private/Flyout → Flyout}/FlyoutUncontrolled.d.ts +0 -0
  161. /package/dist/components/{_private/Flyout → Flyout}/FlyoutUncontrolled.js +0 -0
  162. /package/dist/components/{_private/Flyout → Flyout}/index.d.ts +0 -0
  163. /package/dist/components/{_private/Flyout → Flyout}/index.js +0 -0
  164. /package/dist/components/{_private/Flyout → Flyout}/utilities/cooldown.d.ts +0 -0
  165. /package/dist/components/{_private/Flyout → Flyout}/utilities/cooldown.js +0 -0
  166. /package/dist/components/{_private/Flyout → Flyout}/utilities/getPositionFallbacks.d.ts +0 -0
  167. /package/dist/components/{_private/Flyout → Flyout}/utilities/getPositionFallbacks.js +0 -0
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames } from "../../utilities/helpers.js";
4
+ import { classNames } from "../../utilities/props.js";
5
5
  import { onNextFrame } from "../../utilities/animation.js";
6
6
  import { checkKeyboardMode, TrapFocus } from "../../utilities/a11y/index.js";
7
7
  import Toast from "./Toast.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames } from "../../utilities/helpers.js";
4
+ import { classNames } from "../../utilities/props.js";
5
5
  import { focusableSelector } from "../../utilities/a11y/index.js";
6
6
  import ToastContainer from "./ToastContainer.js";
7
7
  import ToastContext from "./Toast.context.js";
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import Theme from "../Theme/index.js";
4
4
  import Text from "../Text/index.js";
5
- import Flyout from "../_private/Flyout/index.js";
5
+ import Flyout from "../Flyout/index.js";
6
6
  import s from "./Tooltip.module.css";
7
7
  const Tooltip = (props) => {
8
8
  const { text, children, position = "bottom", ...flyoutProps } = props;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { FlyoutProps, FlyoutTriggerProps } from "../_private/Flyout";
2
+ import type { FlyoutProps, FlyoutTriggerProps } from "../Flyout";
3
3
  export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "contentGap" | "contentShift" | "originCoordinates"> & {
4
4
  children: (attributes: Parameters<FlyoutTriggerProps["children"]>[0] | {}) => React.ReactNode;
5
5
  text?: React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { createElement as _createElement } from "react";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames, responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
4
+ import { classNames, responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
5
5
  import Divider from "../Divider/index.js";
6
6
  import Hidden from "../Hidden/index.js";
7
7
  import s from "./View.module.css";
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
7
7
  * It relies on using a data-rs-aligner-target attribute in other components and works based
8
8
  * on the --rs-p, --rs-p-v and --rs-p-h css variables
9
9
  */
10
- import { classNames } from "../../../utilities/helpers.js";
10
+ import { classNames } from "../../../utilities/props.js";
11
11
  import s from "./Aligner.module.css";
12
12
  const Aligner = (props) => {
13
13
  const { side: passedSide = "all", children, className, attributes } = props;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { classNames } from "../../../utilities/helpers.js";
4
+ import { classNames } from "../../../utilities/props.js";
5
5
  import { onNextFrame } from "../../../utilities/animation.js";
6
6
  import useIsomorphicLayoutEffect from "../../../hooks/useIsomorphicLayoutEffect.js";
7
7
  import s from "./Expandable.module.css";
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { classNames } from "../../../utilities/helpers.js";
2
+ import { classNames } from "../../../utilities/props.js";
3
3
  import s from "./HiddenInput.module.css";
4
4
  const HiddenInput = (props) => {
5
5
  const { name, value, type, onChange, onFocus, onBlur, checked, defaultChecked, disabled, className, attributes, } = props;
@@ -1,2 +1,2 @@
1
1
  import type { ThemeDefinition } from "../themes/_generator/tokens/types";
2
- export declare const getTheme: (theme?: ThemeDefinition) => Record<"borderRadius" | "backgroundColor" | "borderColor" | "boxShadow" | "spacing" | "textColor" | "colors" | "screens", Record<string, string>>;
2
+ export declare const getTheme: (theme?: ThemeDefinition) => Record<"backgroundColor" | "borderColor" | "borderRadius" | "spacing" | "boxShadow" | "textColor" | "colors" | "screens", Record<string, string>>;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ declare const useFadeSide: (scrollableRef: React.RefObject<HTMLElement | null>, options?: {
3
+ disabled?: boolean;
4
+ }) => "start" | "end" | "both" | null;
5
+ export default useFadeSide;
@@ -0,0 +1,47 @@
1
+ "use client";
2
+ import React from "react";
3
+ import useRTL from "../useRTL.js";
4
+ import useIsomorphicLayoutEffect from "../useIsomorphicLayoutEffect.js";
5
+ import { rafThrottle } from "../../utilities/helpers.js";
6
+ const useFadeSide = (scrollableRef, options = {}) => {
7
+ const { disabled } = options;
8
+ const [rtl] = useRTL();
9
+ const [fadeSide, setFadeSide] = React.useState(null);
10
+ const updateFade = React.useCallback(() => {
11
+ const elScrollable = scrollableRef.current;
12
+ if (!elScrollable)
13
+ return;
14
+ const isScrollable = elScrollable.clientWidth < elScrollable.scrollWidth;
15
+ if (!isScrollable)
16
+ setFadeSide(null);
17
+ // scrollLeft in RTL starts from 1 instead of 0, so we compare values using this delta
18
+ const scrollLeft = elScrollable.scrollLeft * (rtl ? -1 : 1);
19
+ const cutOffStart = scrollLeft > 1;
20
+ const cutOffEnd = scrollLeft + elScrollable.clientWidth < elScrollable.scrollWidth - 1;
21
+ if (cutOffEnd && cutOffStart)
22
+ return setFadeSide("both");
23
+ if (cutOffStart)
24
+ return setFadeSide("start");
25
+ if (cutOffEnd)
26
+ return setFadeSide("end");
27
+ }, [rtl, scrollableRef]);
28
+ useIsomorphicLayoutEffect(() => {
29
+ const elScrollable = scrollableRef.current;
30
+ if (!elScrollable)
31
+ return;
32
+ if (disabled)
33
+ return;
34
+ const debouncedUpdate = rafThrottle(updateFade);
35
+ // Use RaF when scroll to have scrollWidth calculated correctly on the first effect
36
+ // For example: And edge case inside the complex flexbox layout
37
+ requestAnimationFrame(() => updateFade());
38
+ window.addEventListener("resize", debouncedUpdate);
39
+ elScrollable.addEventListener("scroll", debouncedUpdate);
40
+ return () => {
41
+ window.removeEventListener("resize", debouncedUpdate);
42
+ elScrollable.removeEventListener("scroll", debouncedUpdate);
43
+ };
44
+ }, [rtl, disabled]);
45
+ return fadeSide;
46
+ };
47
+ export default useFadeSide;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
2
+ declare const useIsomorphicLayoutEffect: typeof React.useEffect;
3
3
  export default useIsomorphicLayoutEffect;
package/dist/index.d.ts CHANGED
@@ -1,10 +1,6 @@
1
1
  /**
2
2
  * Components
3
3
  */
4
- export { default as Accordion } from "./components/Accordion";
5
- export type { AccordionProps } from "./components/Accordion";
6
- export { default as Actionable } from "./components/Actionable";
7
- export type { ActionableProps, ActionableRef } from "./components/Actionable";
8
4
  export { default as ActionBar } from "./components/ActionBar";
9
5
  export type { ActionBarProps } from "./components/ActionBar";
10
6
  export { default as Alert } from "./components/Alert";
@@ -29,32 +25,16 @@ export { default as Checkbox } from "./components/Checkbox";
29
25
  export type { CheckboxProps } from "./components/Checkbox";
30
26
  export { default as CheckboxGroup } from "./components/CheckboxGroup";
31
27
  export type { CheckboxGroupProps } from "./components/CheckboxGroup";
32
- export { default as Container } from "./components/Container";
33
- export type { ContainerProps } from "./components/Container";
34
28
  export { default as ContextMenu } from "./components/ContextMenu";
35
29
  export type { ContextMenuProps } from "./components/ContextMenu";
36
- export { default as Dismissible } from "./components/Dismissible";
37
- export type { DismissibleProps } from "./components/Dismissible";
38
30
  export { default as Divider } from "./components/Divider";
39
31
  export type { DividerProps } from "./components/Divider";
40
32
  export { default as DropdownMenu } from "./components/DropdownMenu";
41
33
  export type { DropdownMenuProps, DropdownMenuInstance } from "./components/DropdownMenu";
42
34
  export { default as FileUpload } from "./components/FileUpload";
43
35
  export type { FileUploadProps } from "./components/FileUpload";
44
- export { default as FormControl } from "./components/FormControl";
45
- export type { FormControlProps } from "./components/FormControl";
46
- export { default as Grid } from "./components/Grid";
47
- export type { GridProps, GridItemProps } from "./components/Grid";
48
- export { default as Hidden } from "./components/Hidden";
49
- export type { HiddenProps } from "./components/Hidden";
50
- export { default as HiddenVisually } from "./components/HiddenVisually";
51
- export type { HiddenVisuallyProps } from "./components/HiddenVisually";
52
36
  export { default as Hotkey } from "./components/Hotkey";
53
37
  export type { HotkeyProps } from "./components/Hotkey";
54
- export { default as Icon } from "./components/Icon";
55
- export type { IconProps } from "./components/Icon";
56
- export { default as Image } from "./components/Image";
57
- export type { ImageProps } from "./components/Image";
58
38
  export { default as Link } from "./components/Link";
59
39
  export type { LinkProps } from "./components/Link";
60
40
  export { default as Loader } from "./components/Loader";
@@ -65,8 +45,6 @@ export { default as Modal } from "./components/Modal";
65
45
  export type { ModalProps } from "./components/Modal";
66
46
  export { default as NumberField } from "./components/NumberField";
67
47
  export type { NumberFieldProps } from "./components/NumberField";
68
- export { default as Overlay } from "./components/Overlay";
69
- export type { OverlayProps } from "./components/Overlay";
70
48
  export { default as Pagination } from "./components/Pagination";
71
49
  export type { PaginationProps } from "./components/Pagination";
72
50
  export { default as PinField } from "./components/PinField";
@@ -81,14 +59,8 @@ export { default as Radio } from "./components/Radio";
81
59
  export type { RadioProps } from "./components/Radio";
82
60
  export { default as RadioGroup } from "./components/RadioGroup";
83
61
  export type { RadioGroupProps } from "./components/RadioGroup";
84
- export { default as Reshaped } from "./components/Reshaped";
85
- export type { ReshapedProps } from "./components/Reshaped";
86
- export { default as Resizable } from "./components/Resizable";
87
- export type { ResizableProps, ResizableItemProps, ResizableHandleProps, } from "./components/Resizable";
88
62
  export { default as Scrim } from "./components/Scrim";
89
63
  export type { ScrimProps } from "./components/Scrim";
90
- export { default as ScrollArea } from "./components/ScrollArea";
91
- export type { ScrollAreaProps } from "./components/ScrollArea";
92
64
  export { default as Select } from "./components/Select";
93
65
  export type { SelectProps } from "./components/Select";
94
66
  export { default as Skeleton } from "./components/Skeleton";
@@ -103,8 +75,6 @@ export { default as Table } from "./components/Table";
103
75
  export type { TableProps, TableBodyProps, TableHeadProps, TableHeadingProps, TableCellProps, TableRowProps, } from "./components/Table";
104
76
  export { default as Tabs } from "./components/Tabs";
105
77
  export type { TabsProps } from "./components/Tabs";
106
- export { default as Text } from "./components/Text";
107
- export type { TextProps } from "./components/Text";
108
78
  export { default as TextArea } from "./components/TextArea";
109
79
  export type { TextAreaProps } from "./components/TextArea";
110
80
  export { default as TextField } from "./components/TextField";
@@ -115,6 +85,41 @@ export { useToast, ToastProvider } from "./components/Toast";
115
85
  export type { ToastProps, ToastProviderProps, ToastShowProps } from "./components/Toast";
116
86
  export { default as Tooltip } from "./components/Tooltip";
117
87
  export type { TooltipProps } from "./components/Tooltip";
88
+ /**
89
+ * Utility components
90
+ */
91
+ export { default as Reshaped } from "./components/Reshaped";
92
+ export type { ReshapedProps } from "./components/Reshaped";
93
+ export { default as Accordion } from "./components/Accordion";
94
+ export type { AccordionProps } from "./components/Accordion";
95
+ export { default as Actionable } from "./components/Actionable";
96
+ export type { ActionableProps, ActionableRef } from "./components/Actionable";
97
+ export { default as Container } from "./components/Container";
98
+ export type { ContainerProps } from "./components/Container";
99
+ export { default as Dismissible } from "./components/Dismissible";
100
+ export type { DismissibleProps } from "./components/Dismissible";
101
+ export { default as Flyout } from "./components/Flyout";
102
+ export type { FlyoutProps, FlyoutInstance } from "./components/Flyout";
103
+ export { default as FormControl } from "./components/FormControl";
104
+ export type { FormControlProps } from "./components/FormControl";
105
+ export { default as Grid } from "./components/Grid";
106
+ export type { GridProps, GridItemProps } from "./components/Grid";
107
+ export { default as Hidden } from "./components/Hidden";
108
+ export type { HiddenProps } from "./components/Hidden";
109
+ export { default as HiddenVisually } from "./components/HiddenVisually";
110
+ export type { HiddenVisuallyProps } from "./components/HiddenVisually";
111
+ export { default as Icon } from "./components/Icon";
112
+ export type { IconProps } from "./components/Icon";
113
+ export { default as Image } from "./components/Image";
114
+ export type { ImageProps } from "./components/Image";
115
+ export { default as Overlay } from "./components/Overlay";
116
+ export type { OverlayProps } from "./components/Overlay";
117
+ export { default as Resizable } from "./components/Resizable";
118
+ export type { ResizableProps, ResizableItemProps, ResizableHandleProps, } from "./components/Resizable";
119
+ export { default as ScrollArea } from "./components/ScrollArea";
120
+ export type { ScrollAreaProps } from "./components/ScrollArea";
121
+ export { default as Text } from "./components/Text";
122
+ export type { TextProps } from "./components/Text";
118
123
  export { default as View } from "./components/View";
119
124
  export type { ViewProps, ViewItemProps } from "./components/View";
120
125
  /**
@@ -132,9 +137,9 @@ export { default as useRTL } from "./hooks/useRTL";
132
137
  export { default as useScrollLock } from "./hooks/useScrollLock";
133
138
  export { default as useToggle } from "./hooks/useToggle";
134
139
  /**
135
- * Utilities
140
+ * Utility functions
136
141
  */
137
- export { classNames, responsiveClassNames, responsivePropDependency } from "./utilities/helpers";
142
+ export { classNames, responsivePropDependency } from "./utilities/props";
138
143
  export { TrapFocus } from "./utilities/a11y";
139
144
  /**
140
145
  * Types
package/dist/index.js CHANGED
@@ -1,8 +1,6 @@
1
1
  /**
2
2
  * Components
3
3
  */
4
- export { default as Accordion } from "./components/Accordion/index.js";
5
- export { default as Actionable } from "./components/Actionable/index.js";
6
4
  export { default as ActionBar } from "./components/ActionBar/index.js";
7
5
  export { default as Alert } from "./components/Alert/index.js";
8
6
  export { default as Autocomplete } from "./components/Autocomplete/index.js";
@@ -15,25 +13,16 @@ export { default as Card } from "./components/Card/index.js";
15
13
  export { default as Carousel } from "./components/Carousel/index.js";
16
14
  export { default as Checkbox } from "./components/Checkbox/index.js";
17
15
  export { default as CheckboxGroup } from "./components/CheckboxGroup/index.js";
18
- export { default as Container } from "./components/Container/index.js";
19
16
  export { default as ContextMenu } from "./components/ContextMenu/index.js";
20
- export { default as Dismissible } from "./components/Dismissible/index.js";
21
17
  export { default as Divider } from "./components/Divider/index.js";
22
18
  export { default as DropdownMenu } from "./components/DropdownMenu/index.js";
23
19
  export { default as FileUpload } from "./components/FileUpload/index.js";
24
- export { default as FormControl } from "./components/FormControl/index.js";
25
- export { default as Grid } from "./components/Grid/index.js";
26
- export { default as Hidden } from "./components/Hidden/index.js";
27
- export { default as HiddenVisually } from "./components/HiddenVisually/index.js";
28
20
  export { default as Hotkey } from "./components/Hotkey/index.js";
29
- export { default as Icon } from "./components/Icon/index.js";
30
- export { default as Image } from "./components/Image/index.js";
31
21
  export { default as Link } from "./components/Link/index.js";
32
22
  export { default as Loader } from "./components/Loader/index.js";
33
23
  export { default as MenuItem } from "./components/MenuItem/index.js";
34
24
  export { default as Modal } from "./components/Modal/index.js";
35
25
  export { default as NumberField } from "./components/NumberField/index.js";
36
- export { default as Overlay } from "./components/Overlay/index.js";
37
26
  export { default as Pagination } from "./components/Pagination/index.js";
38
27
  export { default as PinField } from "./components/PinField/index.js";
39
28
  export { default as Popover } from "./components/Popover/index.js";
@@ -41,10 +30,7 @@ export { default as Progress } from "./components/Progress/index.js";
41
30
  export { default as ProgressIndicator } from "./components/ProgressIndicator/index.js";
42
31
  export { default as Radio } from "./components/Radio/index.js";
43
32
  export { default as RadioGroup } from "./components/RadioGroup/index.js";
44
- export { default as Reshaped } from "./components/Reshaped/index.js";
45
- export { default as Resizable } from "./components/Resizable/index.js";
46
33
  export { default as Scrim } from "./components/Scrim/index.js";
47
- export { default as ScrollArea } from "./components/ScrollArea/index.js";
48
34
  export { default as Select } from "./components/Select/index.js";
49
35
  export { default as Skeleton } from "./components/Skeleton/index.js";
50
36
  export { default as Slider } from "./components/Slider/index.js";
@@ -52,12 +38,30 @@ export { default as Stepper } from "./components/Stepper/index.js";
52
38
  export { default as Switch } from "./components/Switch/index.js";
53
39
  export { default as Table } from "./components/Table/index.js";
54
40
  export { default as Tabs } from "./components/Tabs/index.js";
55
- export { default as Text } from "./components/Text/index.js";
56
41
  export { default as TextArea } from "./components/TextArea/index.js";
57
42
  export { default as TextField } from "./components/TextField/index.js";
58
43
  export { default as Timeline } from "./components/Timeline/index.js";
59
44
  export { useToast, ToastProvider } from "./components/Toast/index.js";
60
45
  export { default as Tooltip } from "./components/Tooltip/index.js";
46
+ /**
47
+ * Utility components
48
+ */
49
+ export { default as Reshaped } from "./components/Reshaped/index.js";
50
+ export { default as Accordion } from "./components/Accordion/index.js";
51
+ export { default as Actionable } from "./components/Actionable/index.js";
52
+ export { default as Container } from "./components/Container/index.js";
53
+ export { default as Dismissible } from "./components/Dismissible/index.js";
54
+ export { default as Flyout } from "./components/Flyout/index.js";
55
+ export { default as FormControl } from "./components/FormControl/index.js";
56
+ export { default as Grid } from "./components/Grid/index.js";
57
+ export { default as Hidden } from "./components/Hidden/index.js";
58
+ export { default as HiddenVisually } from "./components/HiddenVisually/index.js";
59
+ export { default as Icon } from "./components/Icon/index.js";
60
+ export { default as Image } from "./components/Image/index.js";
61
+ export { default as Overlay } from "./components/Overlay/index.js";
62
+ export { default as Resizable } from "./components/Resizable/index.js";
63
+ export { default as ScrollArea } from "./components/ScrollArea/index.js";
64
+ export { default as Text } from "./components/Text/index.js";
61
65
  export { default as View } from "./components/View/index.js";
62
66
  /**
63
67
  * Hooks
@@ -74,9 +78,9 @@ export { default as useRTL } from "./hooks/useRTL.js";
74
78
  export { default as useScrollLock } from "./hooks/useScrollLock.js";
75
79
  export { default as useToggle } from "./hooks/useToggle.js";
76
80
  /**
77
- * Utilities
81
+ * Utility functions
78
82
  */
79
- export { classNames, responsiveClassNames, responsivePropDependency } from "./utilities/helpers.js";
83
+ export { classNames, responsivePropDependency } from "./utilities/props.js";
80
84
  export { TrapFocus } from "./utilities/a11y/index.js";
81
85
  /**
82
86
  * Dev utilities
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./align.css";
3
3
  const getAlignStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./aspectRatio.css";
3
3
  const getAspectRatioStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables, responsivePropDependency, } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables, responsivePropDependency, } from "../../utilities/props.js";
2
2
  import s from "./bleed.module.css";
3
3
  const getBleedStyles = (value) => {
4
4
  if (value === undefined)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames } from "../../utilities/props.js";
2
2
  import s from "./border.module.css";
3
3
  const getBorderStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
2
2
  import s from "./height.module.css";
3
3
  const getHeightStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./inset.css";
3
3
  const getInsetStyles = (value, side) => {
4
4
  if (value === undefined)
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./justify.css";
3
3
  const getJustifyStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
2
2
  import s from "./maxHeight.module.css";
3
3
  const getMaxHeightStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
2
2
  import s from "./maxWidth.module.css";
3
3
  const getMaxWidthStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
2
2
  import s from "./minHeight.module.css";
3
3
  const getMinHeightStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
2
2
  import s from "./minWidth.module.css";
3
3
  const getMinWidthStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./padding.css";
3
3
  const getPaddingStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./position.css";
3
3
  const getPositionStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames } from "../../utilities/props.js";
2
2
  import s from "./radius.module.css";
3
3
  const getRadiusStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveVariables } from "../../utilities/props.js";
2
2
  import "./textAlign.css";
3
3
  const getTextAlignStyles = (value) => {
4
4
  if (!value)
@@ -1,4 +1,4 @@
1
- import { responsiveClassNames, responsiveVariables } from "../../utilities/helpers.js";
1
+ import { responsiveClassNames, responsiveVariables } from "../../utilities/props.js";
2
2
  import s from "./width.module.css";
3
3
  const getWidthStyles = (value) => {
4
4
  if (!value)
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Workaround for changing a hidden input value with triggerring
3
+ * React input onChange and form onChange handlers
4
+ *
5
+ * Based on https://stackoverflow.com/a/60378508
6
+ */
7
+ export declare const triggerChangeEvent: (el: HTMLInputElement, value: string) => void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Workaround for changing a hidden input value with triggerring
3
+ * React input onChange and form onChange handlers
4
+ *
5
+ * Based on https://stackoverflow.com/a/60378508
6
+ */
7
+ export const triggerChangeEvent = (el, value) => {
8
+ const nativeInputValueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value").set;
9
+ nativeInputValueSetter.call(el, value);
10
+ el.dispatchEvent(new Event("change", { bubbles: true }));
11
+ };
@@ -1,13 +1,10 @@
1
1
  export declare const findParent: (element: HTMLElement, condition: (el: HTMLElement) => boolean) => HTMLElement | null;
2
- /**
3
- * Containers used for scoping the rendering,
4
- * mostly used in flyouts since the have to accommodate for positioning and overflow
5
- */
6
- export declare const findClosestRenderContainer: (args: {
2
+ export declare const findClosestPositionContainer: (args: {
3
+ el: HTMLElement | null;
4
+ iteration?: number;
5
+ }) => HTMLElement;
6
+ export declare const findClosestScrollableContainer: (args: {
7
7
  el: HTMLElement | null;
8
8
  iteration?: number;
9
9
  overflowOnly?: boolean;
10
- }) => {
11
- el: HTMLElement;
12
- scrollable?: boolean;
13
- };
10
+ }) => HTMLElement;
@@ -8,28 +8,30 @@ export const findParent = (element, condition) => {
8
8
  }
9
9
  return null;
10
10
  };
11
- /**
12
- * Containers used for scoping the rendering,
13
- * mostly used in flyouts since the have to accommodate for positioning and overflow
14
- */
15
- export const findClosestRenderContainer = (args) => {
16
- const { el, iteration = 0, overflowOnly } = args;
11
+ export const findClosestPositionContainer = (args) => {
12
+ const { el, iteration = 0 } = args;
17
13
  const style = el && window.getComputedStyle(el);
18
- const overflowY = style?.overflowY;
19
14
  const position = style?.position;
20
- const isScrollable = overflowY?.includes("scroll") || overflowY?.includes("auto");
21
15
  const isFixed = position === "fixed" || position === "sticky";
22
- // Only check shadow root on the first run
23
16
  if (iteration === 0) {
24
17
  const shadowRoot = getShadowRoot(el);
25
18
  if (shadowRoot?.firstElementChild)
26
- return { el: shadowRoot.firstElementChild };
19
+ return shadowRoot.firstElementChild;
27
20
  }
28
21
  if (el === document.body || !el)
29
- return { el: document.body };
22
+ return document.body;
23
+ if (isFixed)
24
+ return el;
25
+ return findClosestPositionContainer({ el: el.parentElement, iteration: iteration + 1 });
26
+ };
27
+ export const findClosestScrollableContainer = (args) => {
28
+ const { el, iteration = 0 } = args;
29
+ const style = el && window.getComputedStyle(el);
30
+ const overflowY = style?.overflowY;
31
+ const isScrollable = overflowY?.includes("scroll") || overflowY?.includes("auto");
32
+ if (el === document.body || !el)
33
+ return document.body;
30
34
  if (isScrollable && el.scrollHeight > el.clientHeight)
31
- return { el, scrollable: true };
32
- if (isFixed && !overflowOnly)
33
- return { el };
34
- return findClosestRenderContainer({ el: el.parentElement, iteration: iteration + 1 });
35
+ return el;
36
+ return findClosestScrollableContainer({ el: el.parentElement, iteration: iteration + 1 });
35
37
  };
@@ -1,4 +1,5 @@
1
1
  export { getRectFromCoordinates } from "./flyout";
2
2
  export { getShadowRoot } from "./shadowDom";
3
3
  export { enableUserSelect, disableUserSelect } from "./userSelect";
4
- export { findParent, findClosestRenderContainer } from "./find";
4
+ export { findParent, findClosestScrollableContainer, findClosestPositionContainer } from "./find";
5
+ export { triggerChangeEvent } from "./event";
@@ -1,4 +1,5 @@
1
1
  export { getRectFromCoordinates } from "./flyout.js";
2
2
  export { getShadowRoot } from "./shadowDom.js";
3
3
  export { enableUserSelect, disableUserSelect } from "./userSelect.js";
4
- export { findParent, findClosestRenderContainer } from "./find.js";
4
+ export { findParent, findClosestScrollableContainer, findClosestPositionContainer } from "./find.js";
5
+ export { triggerChangeEvent } from "./event.js";
@@ -1,17 +1,3 @@
1
- import type * as G from "../types/global";
2
1
  export declare const sleep: (milliseconds: number) => Promise<unknown>;
3
2
  export declare const range: (start: number, end: number) => number[];
4
- export declare const debounce: <T extends Function>(cb: T, wait?: number) => T;
5
- export declare function debounceHandler<T extends React.SyntheticEvent | Event>(handler: (event: T) => void, timeout: number): (event: T) => void;
6
- export declare const throttle: <T extends Function>(cb: T, wait: number) => (...args: unknown[]) => void;
7
- export declare function throttleHandler<T extends React.SyntheticEvent | Event>(handler: (event: T) => void, timeout: number): (event: T) => void;
8
- type Value = string | boolean | number | undefined;
9
- type ClassNameResolver = string | ((value: Value) => string);
10
- export declare const classNames: (...args: G.ClassName[]) => string;
11
- export declare const responsiveClassNames: <V extends G.Responsive<Value>>(s: Record<string, string>, className: ClassNameResolver, value: V, options?: {
12
- excludeValueFromClassName?: boolean;
13
- }) => string[];
14
- export declare const responsiveVariables: <V extends Value = Value>(variableName: G.CSSVariable, value?: G.Responsive<V>) => Record<G.CSSVariable, V>;
15
- export declare const responsivePropDependency: <Result, T>(prop: G.Responsive<T>, resolver: (value: T, key: G.Viewport) => Result) => Result;
16
- export declare const resolveViewportValue: <T>(viewport: G.Viewport, value: G.Responsive<T>) => T | undefined;
17
- export {};
3
+ export declare const rafThrottle: <T extends (...args: any[]) => void>(fn: T) => T;