@wordpress/components 28.7.0 → 28.8.1-next.5368f64a9.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 (157) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/build/composite/context.js +1 -1
  3. package/build/composite/context.js.map +1 -1
  4. package/build/composite/group-label.js +1 -1
  5. package/build/composite/group-label.js.map +1 -1
  6. package/build/composite/group.js +1 -1
  7. package/build/composite/group.js.map +1 -1
  8. package/build/composite/hover.js +1 -1
  9. package/build/composite/hover.js.map +1 -1
  10. package/build/composite/index.js +17 -26
  11. package/build/composite/index.js.map +1 -1
  12. package/build/composite/item.js +1 -1
  13. package/build/composite/item.js.map +1 -1
  14. package/build/composite/legacy/index.js +59 -8
  15. package/build/composite/legacy/index.js.map +1 -1
  16. package/build/composite/row.js +1 -1
  17. package/build/composite/row.js.map +1 -1
  18. package/build/composite/typeahead.js +1 -1
  19. package/build/composite/typeahead.js.map +1 -1
  20. package/build/composite/types.js.map +1 -1
  21. package/build/date-time/date/index.js +1 -1
  22. package/build/date-time/date/index.js.map +1 -1
  23. package/build/date-time/date/styles.js +35 -24
  24. package/build/date-time/date/styles.js.map +1 -1
  25. package/build/date-time/date/use-lilius/index.js +163 -0
  26. package/build/date-time/date/use-lilius/index.js.map +1 -0
  27. package/build/index.js +7 -0
  28. package/build/index.js.map +1 -1
  29. package/build/modal/index.js +11 -4
  30. package/build/modal/index.js.map +1 -1
  31. package/build/navigator/navigator-screen/component.js +5 -0
  32. package/build/navigator/navigator-screen/component.js.map +1 -1
  33. package/build/private-apis.js +0 -9
  34. package/build/private-apis.js.map +1 -1
  35. package/build/slot-fill/index.js +1 -0
  36. package/build/slot-fill/index.js.map +1 -1
  37. package/build/tabs/styles.js +3 -3
  38. package/build/tabs/styles.js.map +1 -1
  39. package/build/tabs/tablist.js +5 -4
  40. package/build/tabs/tablist.js.map +1 -1
  41. package/build/utils/element-rect.js +73 -105
  42. package/build/utils/element-rect.js.map +1 -1
  43. package/build-module/composite/context.js +1 -1
  44. package/build-module/composite/context.js.map +1 -1
  45. package/build-module/composite/group-label.js +1 -1
  46. package/build-module/composite/group-label.js.map +1 -1
  47. package/build-module/composite/group.js +1 -1
  48. package/build-module/composite/group.js.map +1 -1
  49. package/build-module/composite/hover.js +1 -1
  50. package/build-module/composite/hover.js.map +1 -1
  51. package/build-module/composite/index.js +17 -26
  52. package/build-module/composite/index.js.map +1 -1
  53. package/build-module/composite/item.js +1 -1
  54. package/build-module/composite/item.js.map +1 -1
  55. package/build-module/composite/legacy/index.js +56 -8
  56. package/build-module/composite/legacy/index.js.map +1 -1
  57. package/build-module/composite/row.js +1 -1
  58. package/build-module/composite/row.js.map +1 -1
  59. package/build-module/composite/typeahead.js +1 -1
  60. package/build-module/composite/typeahead.js.map +1 -1
  61. package/build-module/composite/types.js.map +1 -1
  62. package/build-module/date-time/date/index.js +1 -2
  63. package/build-module/date-time/date/index.js.map +1 -1
  64. package/build-module/date-time/date/styles.js +31 -24
  65. package/build-module/date-time/date/styles.js.map +1 -1
  66. package/build-module/date-time/date/use-lilius/index.js +158 -0
  67. package/build-module/date-time/date/use-lilius/index.js.map +1 -0
  68. package/build-module/index.js +1 -0
  69. package/build-module/index.js.map +1 -1
  70. package/build-module/modal/index.js +12 -4
  71. package/build-module/modal/index.js.map +1 -1
  72. package/build-module/navigator/navigator-screen/component.js +4 -0
  73. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  74. package/build-module/private-apis.js +0 -9
  75. package/build-module/private-apis.js.map +1 -1
  76. package/build-module/slot-fill/index.js +1 -0
  77. package/build-module/slot-fill/index.js.map +1 -1
  78. package/build-module/tabs/styles.js +3 -3
  79. package/build-module/tabs/styles.js.map +1 -1
  80. package/build-module/tabs/tablist.js +5 -4
  81. package/build-module/tabs/tablist.js.map +1 -1
  82. package/build-module/utils/element-rect.js +74 -105
  83. package/build-module/utils/element-rect.js.map +1 -1
  84. package/build-style/style-rtl.css +0 -4
  85. package/build-style/style.css +0 -4
  86. package/build-types/composite/context.d.ts.map +1 -1
  87. package/build-types/composite/index.d.ts +36 -24
  88. package/build-types/composite/index.d.ts.map +1 -1
  89. package/build-types/composite/legacy/index.d.ts +25 -2
  90. package/build-types/composite/legacy/index.d.ts.map +1 -1
  91. package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
  92. package/build-types/composite/stories/index.story.d.ts +9 -9
  93. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  94. package/build-types/composite/types.d.ts +11 -10
  95. package/build-types/composite/types.d.ts.map +1 -1
  96. package/build-types/date-time/date/index.d.ts +0 -3
  97. package/build-types/date-time/date/index.d.ts.map +1 -1
  98. package/build-types/date-time/date/styles.d.ts.map +1 -1
  99. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  100. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  101. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  102. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  103. package/build-types/index.d.ts +1 -0
  104. package/build-types/index.d.ts.map +1 -1
  105. package/build-types/modal/index.d.ts.map +1 -1
  106. package/build-types/modal/stories/index.story.d.ts +3 -0
  107. package/build-types/modal/stories/index.story.d.ts.map +1 -1
  108. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  109. package/build-types/private-apis.d.ts.map +1 -1
  110. package/build-types/slot-fill/index.d.ts +3 -0
  111. package/build-types/slot-fill/index.d.ts.map +1 -1
  112. package/build-types/tabs/styles.d.ts.map +1 -1
  113. package/build-types/tabs/tablist.d.ts.map +1 -1
  114. package/build-types/utils/element-rect.d.ts +32 -74
  115. package/build-types/utils/element-rect.d.ts.map +1 -1
  116. package/package.json +19 -20
  117. package/src/composite/README.md +5 -24
  118. package/src/composite/{context.ts → context.tsx} +1 -2
  119. package/src/composite/group-label.tsx +1 -1
  120. package/src/composite/group.tsx +1 -1
  121. package/src/composite/hover.tsx +1 -1
  122. package/src/composite/index.tsx +17 -28
  123. package/src/composite/item.tsx +1 -1
  124. package/src/composite/legacy/index.tsx +72 -11
  125. package/src/composite/legacy/stories/index.story.tsx +2 -1
  126. package/src/composite/legacy/test/index.tsx +57 -1
  127. package/src/composite/row.tsx +1 -1
  128. package/src/composite/stories/index.story.tsx +185 -169
  129. package/src/composite/typeahead.tsx +1 -1
  130. package/src/composite/types.ts +13 -15
  131. package/src/date-time/date/index.tsx +1 -1
  132. package/src/date-time/date/styles.ts +31 -11
  133. package/src/date-time/date/test/use-lilius.ts +417 -0
  134. package/src/date-time/date/use-lilius/index.ts +394 -0
  135. package/src/index.ts +1 -0
  136. package/src/modal/index.tsx +16 -7
  137. package/src/modal/stories/index.story.tsx +8 -14
  138. package/src/modal/style.scss +0 -5
  139. package/src/navigator/navigator-screen/component.tsx +7 -0
  140. package/src/navigator/test/index.tsx +8 -0
  141. package/src/private-apis.ts +0 -9
  142. package/src/select-control/README.md +2 -2
  143. package/src/slot-fill/index.tsx +1 -0
  144. package/src/tabs/styles.ts +40 -11
  145. package/src/tabs/tablist.tsx +5 -4
  146. package/src/utils/element-rect.ts +93 -130
  147. package/tsconfig.tsbuildinfo +1 -1
  148. package/build/composite/store.js +0 -54
  149. package/build/composite/store.js.map +0 -1
  150. package/build-module/composite/store.js +0 -46
  151. package/build-module/composite/store.js.map +0 -1
  152. package/build-types/composite/store.d.ts +0 -25
  153. package/build-types/composite/store.d.ts.map +0 -1
  154. package/build-types/composite/stories/utils.d.ts +0 -29
  155. package/build-types/composite/stories/utils.d.ts.map +0 -1
  156. package/src/composite/store.ts +0 -46
  157. package/src/composite/stories/utils.tsx +0 -76
@@ -2,98 +2,13 @@
2
2
  /**
3
3
  * WordPress dependencies
4
4
  */
5
- import { useRef, useEffect, useState } from '@wordpress/element';
5
+ import { useLayoutEffect, useRef, useState } from '@wordpress/element';
6
+ import { useResizeObserver } from '@wordpress/compose';
6
7
  /**
7
8
  * Internal dependencies
8
9
  */
9
10
  import { useEvent } from './hooks/use-event';
10
11
 
11
- /**
12
- * `useTrackElementRectUpdates` options.
13
- */
14
-
15
- /**
16
- * Tracks an element's "rect" (size and position) and fires `onRect` for all
17
- * of its discrete values. The element can be changed dynamically and **it
18
- * must not be stored in a ref**. Instead, it should be stored in a React
19
- * state or equivalent.
20
- *
21
- * By default, `onRect` is called initially for the target element (including
22
- * when the target element changes), not only on size or position updates.
23
- * This allows consumers of the hook to always be in sync with all rect values
24
- * of the target element throughout its lifetime. This behavior can be
25
- * disabled by setting the `fireOnElementInit` option to `false`.
26
- *
27
- * Under the hood, it sets up a `ResizeObserver` that tracks the element. The
28
- * target element can be changed dynamically, and the observer will be
29
- * updated accordingly.
30
- *
31
- * @example
32
- *
33
- * ```tsx
34
- * const [ targetElement, setTargetElement ] = useState< HTMLElement | null >();
35
- *
36
- * useTrackElementRectUpdates( targetElement, ( element ) => {
37
- * console.log( 'Element resized:', element );
38
- * } );
39
- *
40
- * <div ref={ setTargetElement } />;
41
- * ```
42
- */
43
- export function useTrackElementRectUpdates(
44
- /**
45
- * The target element to observe. It can be changed dynamically.
46
- */
47
- targetElement,
48
- /**
49
- * Callback to fire when the element is resized. It will also be
50
- * called when the observer is set up, unless `fireOnElementInit` is
51
- * set to `false`.
52
- */
53
- onRect, {
54
- fireOnElementInit = true
55
- } = {}) {
56
- const onRectEvent = useEvent(onRect);
57
- const observedElementRef = useRef();
58
- const resizeObserverRef = useRef();
59
-
60
- // TODO: could this be a layout effect?
61
- useEffect(() => {
62
- if (targetElement === observedElementRef.current) {
63
- return;
64
- }
65
- observedElementRef.current = targetElement;
66
-
67
- // Set up a ResizeObserver.
68
- if (!resizeObserverRef.current) {
69
- resizeObserverRef.current = new ResizeObserver(entries => {
70
- if (observedElementRef.current) {
71
- onRectEvent(observedElementRef.current, entries);
72
- }
73
- });
74
- }
75
- const {
76
- current: resizeObserver
77
- } = resizeObserverRef;
78
-
79
- // Observe new element.
80
- if (targetElement) {
81
- if (fireOnElementInit) {
82
- // TODO: investigate if this can be removed,
83
- // see: https://stackoverflow.com/a/60026394
84
- onRectEvent(targetElement);
85
- }
86
- resizeObserver.observe(targetElement);
87
- }
88
- return () => {
89
- // Unobserve previous element.
90
- if (observedElementRef.current) {
91
- resizeObserver.unobserve(observedElementRef.current);
92
- }
93
- };
94
- }, [fireOnElementInit, onRectEvent, targetElement]);
95
- }
96
-
97
12
  /**
98
13
  * The position and dimensions of an element, relative to its offset parent.
99
14
  */
@@ -102,44 +17,98 @@ onRect, {
102
17
  * An `ElementOffsetRect` object with all values set to zero.
103
18
  */
104
19
  export const NULL_ELEMENT_OFFSET_RECT = {
105
- left: 0,
106
20
  top: 0,
21
+ right: 0,
22
+ bottom: 0,
23
+ left: 0,
107
24
  width: 0,
108
25
  height: 0
109
26
  };
110
27
 
111
28
  /**
112
29
  * Returns the position and dimensions of an element, relative to its offset
113
- * parent. This is useful in contexts where `getBoundingClientRect` is not
114
- * suitable, such as when the element is transformed.
30
+ * parent, with subpixel precision. Values reflect the real measures before any
31
+ * potential scaling distortions along the X and Y axes.
115
32
  *
116
- * **Note:** the `left` and `right` values are adjusted due to a limitation
117
- * in the way the browser calculates the offset position of the element,
118
- * which can cause unwanted scrollbars to appear. This adjustment makes the
119
- * values potentially inaccurate within a range of 1 pixel.
33
+ * Useful in contexts where plain `getBoundingClientRect` calls or `ResizeObserver`
34
+ * entries are not suitable, such as when the element is transformed, and when
35
+ * `element.offset<Top|Left|Width|Height>` methods are not precise enough.
36
+ *
37
+ * **Note:** in some contexts, like when the scale is 0, this method will fail
38
+ * because it's impossible to calculate a scaling ratio. When that happens, it
39
+ * will return `undefined`.
120
40
  */
121
41
  export function getElementOffsetRect(element) {
42
+ var _element$offsetParent;
43
+ // Position and dimension values computed with `getBoundingClientRect` have
44
+ // subpixel precision, but are affected by distortions since they represent
45
+ // the "real" measures, or in other words, the actual final values as rendered
46
+ // by the browser.
47
+ const rect = element.getBoundingClientRect();
48
+ if (rect.width === 0 || rect.height === 0) {
49
+ return;
50
+ }
51
+ const offsetParentRect = (_element$offsetParent = element.offsetParent?.getBoundingClientRect()) !== null && _element$offsetParent !== void 0 ? _element$offsetParent : NULL_ELEMENT_OFFSET_RECT;
52
+
53
+ // Computed widths and heights have subpixel precision, and are not affected
54
+ // by distortions.
55
+ const computedWidth = parseFloat(getComputedStyle(element).width);
56
+ const computedHeight = parseFloat(getComputedStyle(element).height);
57
+
58
+ // We can obtain the current scale factor for the element by comparing "computed"
59
+ // dimensions with the "real" ones.
60
+ const scaleX = computedWidth / rect.width;
61
+ const scaleY = computedHeight / rect.height;
122
62
  return {
123
- // The adjustments mentioned in the documentation above are necessary
124
- // because `offsetLeft` and `offsetTop` are rounded to the nearest pixel,
125
- // which can result in a position mismatch that causes unwanted overflow.
126
- // For context, see: https://github.com/WordPress/gutenberg/pull/61979
127
- left: Math.max(element.offsetLeft - 1, 0),
128
- top: Math.max(element.offsetTop - 1, 0),
129
- // This is a workaround to obtain these values with a sub-pixel precision,
130
- // since `offsetWidth` and `offsetHeight` are rounded to the nearest pixel.
131
- width: parseFloat(getComputedStyle(element).width),
132
- height: parseFloat(getComputedStyle(element).height)
63
+ // To obtain the adjusted values for the position:
64
+ // 1. Compute the element's position relative to the offset parent.
65
+ // 2. Correct for the scale factor.
66
+ top: (rect.top - offsetParentRect?.top) * scaleY,
67
+ right: (offsetParentRect?.right - rect.right) * scaleX,
68
+ bottom: (offsetParentRect?.bottom - rect.bottom) * scaleY,
69
+ left: (rect.left - offsetParentRect?.left) * scaleX,
70
+ // Computed dimensions don't need any adjustments.
71
+ width: computedWidth,
72
+ height: computedHeight
133
73
  };
134
74
  }
75
+ const POLL_RATE = 100;
135
76
 
136
77
  /**
137
78
  * Tracks the position and dimensions of an element, relative to its offset
138
79
  * parent. The element can be changed dynamically.
80
+ *
81
+ * **Note:** sometimes, the measurement will fail (see `getElementOffsetRect`'s
82
+ * documentation for more details). When that happens, this hook will attempt
83
+ * to measure again after a frame, and if that fails, it will poll every 100
84
+ * milliseconds until it succeeds.
139
85
  */
140
86
  export function useTrackElementOffsetRect(targetElement) {
141
87
  const [indicatorPosition, setIndicatorPosition] = useState(NULL_ELEMENT_OFFSET_RECT);
142
- useTrackElementRectUpdates(targetElement, element => setIndicatorPosition(getElementOffsetRect(element)));
88
+ const intervalRef = useRef();
89
+ const measure = useEvent(() => {
90
+ if (targetElement) {
91
+ const elementOffsetRect = getElementOffsetRect(targetElement);
92
+ if (elementOffsetRect) {
93
+ setIndicatorPosition(elementOffsetRect);
94
+ clearInterval(intervalRef.current);
95
+ return true;
96
+ }
97
+ } else {
98
+ clearInterval(intervalRef.current);
99
+ }
100
+ return false;
101
+ });
102
+ const setElement = useResizeObserver(() => {
103
+ if (!measure()) {
104
+ requestAnimationFrame(() => {
105
+ if (!measure()) {
106
+ intervalRef.current = setInterval(measure, POLL_RATE);
107
+ }
108
+ });
109
+ }
110
+ });
111
+ useLayoutEffect(() => setElement(targetElement), [setElement, targetElement]);
143
112
  return indicatorPosition;
144
113
  }
145
114
 
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","useEffect","useState","useEvent","useTrackElementRectUpdates","targetElement","onRect","fireOnElementInit","onRectEvent","observedElementRef","resizeObserverRef","current","ResizeObserver","entries","resizeObserver","observe","unobserve","NULL_ELEMENT_OFFSET_RECT","left","top","width","height","getElementOffsetRect","element","Math","max","offsetLeft","offsetTop","parseFloat","getComputedStyle","useTrackElementOffsetRect","indicatorPosition","setIndicatorPosition"],"sources":["@wordpress/components/src/utils/element-rect.ts"],"sourcesContent":["/* eslint-disable jsdoc/require-param */\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect, useState } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { useEvent } from './hooks/use-event';\n\n/**\n * `useTrackElementRectUpdates` options.\n */\nexport type UseTrackElementRectUpdatesOptions = {\n\t/**\n\t * Whether to trigger the callback when an element's ResizeObserver is\n\t * first set up, including when the target element changes.\n\t *\n\t * @default true\n\t */\n\tfireOnElementInit?: boolean;\n};\n\n/**\n * Tracks an element's \"rect\" (size and position) and fires `onRect` for all\n * of its discrete values. The element can be changed dynamically and **it\n * must not be stored in a ref**. Instead, it should be stored in a React\n * state or equivalent.\n *\n * By default, `onRect` is called initially for the target element (including\n * when the target element changes), not only on size or position updates.\n * This allows consumers of the hook to always be in sync with all rect values\n * of the target element throughout its lifetime. This behavior can be\n * disabled by setting the `fireOnElementInit` option to `false`.\n *\n * Under the hood, it sets up a `ResizeObserver` that tracks the element. The\n * target element can be changed dynamically, and the observer will be\n * updated accordingly.\n *\n * @example\n *\n * ```tsx\n * const [ targetElement, setTargetElement ] = useState< HTMLElement | null >();\n *\n * useTrackElementRectUpdates( targetElement, ( element ) => {\n * console.log( 'Element resized:', element );\n * } );\n *\n * <div ref={ setTargetElement } />;\n * ```\n */\nexport function useTrackElementRectUpdates(\n\t/**\n\t * The target element to observe. It can be changed dynamically.\n\t */\n\ttargetElement: HTMLElement | undefined | null,\n\t/**\n\t * Callback to fire when the element is resized. It will also be\n\t * called when the observer is set up, unless `fireOnElementInit` is\n\t * set to `false`.\n\t */\n\tonRect: (\n\t\t/**\n\t\t * The element being tracked at the time of this update.\n\t\t */\n\t\telement: HTMLElement,\n\t\t/**\n\t\t * The list of\n\t\t * [`ResizeObserverEntry`](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry)\n\t\t * objects passed to the `ResizeObserver.observe` callback. This list\n\t\t * won't be available when the observer is set up, and only on updates.\n\t\t */\n\t\tresizeObserverEntries?: ResizeObserverEntry[]\n\t) => void,\n\t{ fireOnElementInit = true }: UseTrackElementRectUpdatesOptions = {}\n) {\n\tconst onRectEvent = useEvent( onRect );\n\n\tconst observedElementRef = useRef< HTMLElement | null >();\n\tconst resizeObserverRef = useRef< ResizeObserver >();\n\n\t// TODO: could this be a layout effect?\n\tuseEffect( () => {\n\t\tif ( targetElement === observedElementRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tobservedElementRef.current = targetElement;\n\n\t\t// Set up a ResizeObserver.\n\t\tif ( ! resizeObserverRef.current ) {\n\t\t\tresizeObserverRef.current = new ResizeObserver( ( entries ) => {\n\t\t\t\tif ( observedElementRef.current ) {\n\t\t\t\t\tonRectEvent( observedElementRef.current, entries );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t\tconst { current: resizeObserver } = resizeObserverRef;\n\n\t\t// Observe new element.\n\t\tif ( targetElement ) {\n\t\t\tif ( fireOnElementInit ) {\n\t\t\t\t// TODO: investigate if this can be removed,\n\t\t\t\t// see: https://stackoverflow.com/a/60026394\n\t\t\t\tonRectEvent( targetElement );\n\t\t\t}\n\t\t\tresizeObserver.observe( targetElement );\n\t\t}\n\n\t\treturn () => {\n\t\t\t// Unobserve previous element.\n\t\t\tif ( observedElementRef.current ) {\n\t\t\t\tresizeObserver.unobserve( observedElementRef.current );\n\t\t\t}\n\t\t};\n\t}, [ fireOnElementInit, onRectEvent, targetElement ] );\n}\n\n/**\n * The position and dimensions of an element, relative to its offset parent.\n */\nexport type ElementOffsetRect = {\n\t/**\n\t * The distance from the left edge of the offset parent to the left edge of\n\t * the element.\n\t */\n\tleft: number;\n\t/**\n\t * The distance from the top edge of the offset parent to the top edge of\n\t * the element.\n\t */\n\ttop: number;\n\t/**\n\t * The width of the element.\n\t */\n\twidth: number;\n\t/**\n\t * The height of the element.\n\t */\n\theight: number;\n};\n\n/**\n * An `ElementOffsetRect` object with all values set to zero.\n */\nexport const NULL_ELEMENT_OFFSET_RECT = {\n\tleft: 0,\n\ttop: 0,\n\twidth: 0,\n\theight: 0,\n} satisfies ElementOffsetRect;\n\n/**\n * Returns the position and dimensions of an element, relative to its offset\n * parent. This is useful in contexts where `getBoundingClientRect` is not\n * suitable, such as when the element is transformed.\n *\n * **Note:** the `left` and `right` values are adjusted due to a limitation\n * in the way the browser calculates the offset position of the element,\n * which can cause unwanted scrollbars to appear. This adjustment makes the\n * values potentially inaccurate within a range of 1 pixel.\n */\nexport function getElementOffsetRect(\n\telement: HTMLElement\n): ElementOffsetRect {\n\treturn {\n\t\t// The adjustments mentioned in the documentation above are necessary\n\t\t// because `offsetLeft` and `offsetTop` are rounded to the nearest pixel,\n\t\t// which can result in a position mismatch that causes unwanted overflow.\n\t\t// For context, see: https://github.com/WordPress/gutenberg/pull/61979\n\t\tleft: Math.max( element.offsetLeft - 1, 0 ),\n\t\ttop: Math.max( element.offsetTop - 1, 0 ),\n\t\t// This is a workaround to obtain these values with a sub-pixel precision,\n\t\t// since `offsetWidth` and `offsetHeight` are rounded to the nearest pixel.\n\t\twidth: parseFloat( getComputedStyle( element ).width ),\n\t\theight: parseFloat( getComputedStyle( element ).height ),\n\t};\n}\n\n/**\n * Tracks the position and dimensions of an element, relative to its offset\n * parent. The element can be changed dynamically.\n */\nexport function useTrackElementOffsetRect(\n\ttargetElement: HTMLElement | undefined | null\n) {\n\tconst [ indicatorPosition, setIndicatorPosition ] =\n\t\tuseState< ElementOffsetRect >( NULL_ELEMENT_OFFSET_RECT );\n\n\tuseTrackElementRectUpdates( targetElement, ( element ) =>\n\t\tsetIndicatorPosition( getElementOffsetRect( element ) )\n\t);\n\n\treturn indicatorPosition;\n}\n\n/* eslint-enable jsdoc/require-param */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,mBAAmB;;AAE5C;AACA;AACA;;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,0BAA0BA;AACzC;AACD;AACA;AACCC,aAA6C;AAC7C;AACD;AACA;AACA;AACA;AACCC,MAYS,EACT;EAAEC,iBAAiB,GAAG;AAAwC,CAAC,GAAG,CAAC,CAAC,EACnE;EACD,MAAMC,WAAW,GAAGL,QAAQ,CAAEG,MAAO,CAAC;EAEtC,MAAMG,kBAAkB,G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G,CAAEF,OAAO,CAACG,UAAU,GAAG,CAAC,EAAE,CAAE,CAAC;IAC3CP,GAAG,EAAEK,IAAI,CAACC,GAAG,CAAEF,OAAO,CAACI,SAAS,GAAG,CAAC,EAAE,CAAE,CAAC;IACzC;IACA;IACAP,KAAK,EAAEQ,UAAU,CAAEC,gBAAgB,CAAEN,OAAQ,CAAC,CAACH,KAAM,CAAC;IACtDC,MAAM,EAAEO,UAAU,CAAEC,gBAAgB,CAAEN,OAAQ,CAAC,CAACF,MAAO;EACxD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASS,yBAAyBA,CACxCzB,aAA6C,EAC5C;EACD,MAAM,CAAE0B,iBAAiB,EAAEC,oBAAoB,CAAE,GAChD9B,QAAQ,CAAuBe,wBAAyB,CAAC;EAE1Db,0BAA0B,CAAEC,aAAa,EAAIkB,OAAO,IACnDS,oBAAoB,CAAEV,oBAAoB,CAAEC,OAAQ,CAAE,CACvD,CAAC;EAED,OAAOQ,iBAAiB;AACzB;;AAEA","ignoreList":[]}
1
+ {"version":3,"names":["useLayoutEffect","useRef","useState","useResizeObserver","useEvent","NULL_ELEMENT_OFFSET_RECT","top","right","bottom","left","width","height","getElementOffsetRect","element","_element$offsetParent","rect","getBoundingClientRect","offsetParentRect","offsetParent","computedWidth","parseFloat","getComputedStyle","computedHeight","scaleX","scaleY","POLL_RATE","useTrackElementOffsetRect","targetElement","indicatorPosition","setIndicatorPosition","intervalRef","measure","elementOffsetRect","clearInterval","current","setElement","requestAnimationFrame","setInterval"],"sources":["@wordpress/components/src/utils/element-rect.ts"],"sourcesContent":["/* eslint-disable jsdoc/require-param */\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useRef, useState } from '@wordpress/element';\nimport { useResizeObserver } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport { useEvent } from './hooks/use-event';\n\n/**\n * The position and dimensions of an element, relative to its offset parent.\n */\nexport type ElementOffsetRect = {\n\t/**\n\t * The distance from the top edge of the offset parent to the top edge of\n\t * the element.\n\t */\n\ttop: number;\n\t/**\n\t * The distance from the right edge of the offset parent to the right edge\n\t * of the element.\n\t */\n\tright: number;\n\t/**\n\t * The distance from the bottom edge of the offset parent to the bottom edge\n\t * of the element.\n\t */\n\tbottom: number;\n\t/**\n\t * The distance from the left edge of the offset parent to the left edge of\n\t * the element.\n\t */\n\tleft: number;\n\t/**\n\t * The width of the element.\n\t */\n\twidth: number;\n\t/**\n\t * The height of the element.\n\t */\n\theight: number;\n};\n\n/**\n * An `ElementOffsetRect` object with all values set to zero.\n */\nexport const NULL_ELEMENT_OFFSET_RECT = {\n\ttop: 0,\n\tright: 0,\n\tbottom: 0,\n\tleft: 0,\n\twidth: 0,\n\theight: 0,\n} satisfies ElementOffsetRect;\n\n/**\n * Returns the position and dimensions of an element, relative to its offset\n * parent, with subpixel precision. Values reflect the real measures before any\n * potential scaling distortions along the X and Y axes.\n *\n * Useful in contexts where plain `getBoundingClientRect` calls or `ResizeObserver`\n * entries are not suitable, such as when the element is transformed, and when\n * `element.offset<Top|Left|Width|Height>` methods are not precise enough.\n *\n * **Note:** in some contexts, like when the scale is 0, this method will fail\n * because it's impossible to calculate a scaling ratio. When that happens, it\n * will return `undefined`.\n */\nexport function getElementOffsetRect(\n\telement: HTMLElement\n): ElementOffsetRect | undefined {\n\t// Position and dimension values computed with `getBoundingClientRect` have\n\t// subpixel precision, but are affected by distortions since they represent\n\t// the \"real\" measures, or in other words, the actual final values as rendered\n\t// by the browser.\n\tconst rect = element.getBoundingClientRect();\n\tif ( rect.width === 0 || rect.height === 0 ) {\n\t\treturn;\n\t}\n\tconst offsetParentRect =\n\t\telement.offsetParent?.getBoundingClientRect() ??\n\t\tNULL_ELEMENT_OFFSET_RECT;\n\n\t// Computed widths and heights have subpixel precision, and are not affected\n\t// by distortions.\n\tconst computedWidth = parseFloat( getComputedStyle( element ).width );\n\tconst computedHeight = parseFloat( getComputedStyle( element ).height );\n\n\t// We can obtain the current scale factor for the element by comparing \"computed\"\n\t// dimensions with the \"real\" ones.\n\tconst scaleX = computedWidth / rect.width;\n\tconst scaleY = computedHeight / rect.height;\n\n\treturn {\n\t\t// To obtain the adjusted values for the position:\n\t\t// 1. Compute the element's position relative to the offset parent.\n\t\t// 2. Correct for the scale factor.\n\t\ttop: ( rect.top - offsetParentRect?.top ) * scaleY,\n\t\tright: ( offsetParentRect?.right - rect.right ) * scaleX,\n\t\tbottom: ( offsetParentRect?.bottom - rect.bottom ) * scaleY,\n\t\tleft: ( rect.left - offsetParentRect?.left ) * scaleX,\n\t\t// Computed dimensions don't need any adjustments.\n\t\twidth: computedWidth,\n\t\theight: computedHeight,\n\t};\n}\n\nconst POLL_RATE = 100;\n\n/**\n * Tracks the position and dimensions of an element, relative to its offset\n * parent. The element can be changed dynamically.\n *\n * **Note:** sometimes, the measurement will fail (see `getElementOffsetRect`'s\n * documentation for more details). When that happens, this hook will attempt\n * to measure again after a frame, and if that fails, it will poll every 100\n * milliseconds until it succeeds.\n */\nexport function useTrackElementOffsetRect(\n\ttargetElement: HTMLElement | undefined | null\n) {\n\tconst [ indicatorPosition, setIndicatorPosition ] =\n\t\tuseState< ElementOffsetRect >( NULL_ELEMENT_OFFSET_RECT );\n\tconst intervalRef = useRef< ReturnType< typeof setInterval > >();\n\n\tconst measure = useEvent( () => {\n\t\tif ( targetElement ) {\n\t\t\tconst elementOffsetRect = getElementOffsetRect( targetElement );\n\t\t\tif ( elementOffsetRect ) {\n\t\t\t\tsetIndicatorPosition( elementOffsetRect );\n\t\t\t\tclearInterval( intervalRef.current );\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} else {\n\t\t\tclearInterval( intervalRef.current );\n\t\t}\n\t\treturn false;\n\t} );\n\n\tconst setElement = useResizeObserver( () => {\n\t\tif ( ! measure() ) {\n\t\t\trequestAnimationFrame( () => {\n\t\t\t\tif ( ! measure() ) {\n\t\t\t\t\tintervalRef.current = setInterval( measure, POLL_RATE );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\n\tuseLayoutEffect(\n\t\t() => setElement( targetElement ),\n\t\t[ setElement, targetElement ]\n\t);\n\n\treturn indicatorPosition;\n}\n\n/* eslint-enable jsdoc/require-param */\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,oBAAoB;AACtE,SAASC,iBAAiB,QAAQ,oBAAoB;AACtD;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,mBAAmB;;AAE5C;AACA;AACA;;AAgCA;AACA;AACA;AACA,OAAO,MAAMC,wBAAwB,GAAG;EACvCC,GAAG,EAAE,CAAC;EACNC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACT,CAA6B;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CACnCC,OAAoB,EACY;EAAA,IAAAC,qBAAA;EAChC;EACA;EACA;EACA;EACA,MAAMC,IAAI,GAAGF,OAAO,CAACG,qBAAqB,CAAC,CAAC;EAC5C,IAAKD,IAAI,CAACL,KAAK,KAAK,CAAC,IAAIK,IAAI,CAACJ,MAAM,KAAK,CAAC,EAAG;IAC5C;EACD;EACA,MAAMM,gBAAgB,IAAAH,qBAAA,GACrBD,OAAO,CAACK,YAAY,EAAEF,qBAAqB,CAAC,CAAC,cAAAF,qBAAA,cAAAA,qBAAA,GAC7CT,wBAAwB;;EAEzB;EACA;EACA,MAAMc,aAAa,GAAGC,UAAU,CAAEC,gBAAgB,CAAER,OAAQ,CAAC,CAACH,KAAM,CAAC;EACrE,MAAMY,cAAc,GAAGF,UAAU,CAAEC,gBAAgB,CAAER,OAAQ,CAAC,CAACF,MAAO,CAAC;;EAEvE;EACA;EACA,MAAMY,MAAM,GAAGJ,aAAa,GAAGJ,IAAI,CAACL,KAAK;EACzC,M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qB,CAAE,MAAM;QAC5B,IAAK,CAAEL,OAAO,CAAC,CAAC,EAAG;UAClBD,WAAW,CAACI,OAAO,GAAGG,WAAW,CAAEN,OAAO,EAAEN,SAAU,CAAC;QACxD;MACD,CAAE,CAAC;IACJ;EACD,CAAE,CAAC;EAEHzB,eAAe,CACd,MAAMmC,UAAU,CAAER,aAAc,CAAC,EACjC,CAAEQ,UAAU,EAAER,aAAa,CAC5B,CAAC;EAED,OAAOC,iBAAiB;AACzB;;AAEA","ignoreList":[]}
@@ -1988,10 +1988,6 @@ body.is-dragging-components-draggable {
1988
1988
  line-height: 1;
1989
1989
  margin: 0;
1990
1990
  }
1991
- .components-modal__header .components-button {
1992
- position: relative;
1993
- right: 8px;
1994
- }
1995
1991
  .components-modal__content.has-scrolled-content:not(.hide-header) .components-modal__header {
1996
1992
  border-bottom-color: #ddd;
1997
1993
  }
@@ -1993,10 +1993,6 @@ body.is-dragging-components-draggable {
1993
1993
  line-height: 1;
1994
1994
  margin: 0;
1995
1995
  }
1996
- .components-modal__header .components-button {
1997
- position: relative;
1998
- left: 8px;
1999
- }
2000
1996
  .components-modal__content.has-scrolled-content:not(.hide-header) .components-modal__header {
2001
1997
  border-bottom-color: #ddd;
2002
1998
  }
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/composite/context.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,gBAAgB,gDACuB,CAAC;AAErD,eAAO,MAAM,mBAAmB,6BAAuC,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/composite/context.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,gBAAgB,gDAA+C,CAAC;AAE7E,eAAO,MAAM,mBAAmB,6BAAuC,CAAC"}
@@ -18,33 +18,50 @@ import * as Ariakit from '@ariakit/react';
18
18
  *
19
19
  * @example
20
20
  * ```jsx
21
- * import { Composite, useCompositeStore } from '@wordpress/components';
21
+ * import { Composite } from '@wordpress/components';
22
22
  *
23
- * const store = useCompositeStore();
24
- * <Composite store={store}>
23
+ * <Composite>
25
24
  * <Composite.Item>Item 1</Composite.Item>
26
25
  * <Composite.Item>Item 2</Composite.Item>
27
26
  * </Composite>
28
27
  * ```
29
28
  */
30
- export declare const Composite: import("react").ForwardRefExoticComponent<import("./types").CompositeStoreProps & {
31
- store?: Ariakit.CompositeStore;
29
+ export declare const Composite: import("react").ForwardRefExoticComponent<{
30
+ activeId?: Ariakit.CompositeStoreProps["activeId"];
31
+ defaultActiveId?: Ariakit.CompositeStoreProps["defaultActiveId"];
32
+ setActiveId?: Ariakit.CompositeStoreProps["setActiveId"];
33
+ focusLoop?: Ariakit.CompositeStoreProps["focusLoop"];
34
+ focusWrap?: Ariakit.CompositeStoreProps["focusWrap"];
35
+ focusShift?: Ariakit.CompositeStoreProps["focusShift"];
36
+ virtualFocus?: Ariakit.CompositeStoreProps["virtualFocus"];
37
+ orientation?: Ariakit.CompositeStoreProps["orientation"];
38
+ rtl?: Ariakit.CompositeStoreProps["rtl"];
39
+ } & {
32
40
  render?: Ariakit.CompositeProps["render"];
33
41
  focusable?: Ariakit.CompositeProps["focusable"];
34
42
  disabled?: Ariakit.CompositeProps["disabled"];
35
43
  accessibleWhenDisabled?: Ariakit.CompositeProps["accessibleWhenDisabled"];
36
44
  onFocusVisible?: Ariakit.CompositeProps["onFocusVisible"];
37
45
  children?: Ariakit.CompositeProps["children"];
38
- } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "disabled" | "focusable" | "children" | "as" | "render" | "accessibleWhenDisabled" | "onFocusVisible" | "store" | keyof import("./types").CompositeStoreProps> & import("react").RefAttributes<HTMLDivElement>> & {
46
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "disabled" | "focusable" | "children" | "as" | "render" | "accessibleWhenDisabled" | "onFocusVisible" | keyof {
47
+ activeId?: Ariakit.CompositeStoreProps["activeId"];
48
+ defaultActiveId?: Ariakit.CompositeStoreProps["defaultActiveId"];
49
+ setActiveId?: Ariakit.CompositeStoreProps["setActiveId"];
50
+ focusLoop?: Ariakit.CompositeStoreProps["focusLoop"];
51
+ focusWrap?: Ariakit.CompositeStoreProps["focusWrap"];
52
+ focusShift?: Ariakit.CompositeStoreProps["focusShift"];
53
+ virtualFocus?: Ariakit.CompositeStoreProps["virtualFocus"];
54
+ orientation?: Ariakit.CompositeStoreProps["orientation"];
55
+ rtl?: Ariakit.CompositeStoreProps["rtl"];
56
+ }> & import("react").RefAttributes<HTMLDivElement>> & {
39
57
  /**
40
58
  * Renders a group element for composite items.
41
59
  *
42
60
  * @example
43
61
  * ```jsx
44
- * import { Composite, useCompositeStore } from '@wordpress/components';
62
+ * import { Composite } from '@wordpress/components';
45
63
  *
46
- * const store = useCompositeStore();
47
- * <Composite store={store}>
64
+ * <Composite>
48
65
  * <Composite.Group>
49
66
  * <Composite.GroupLabel>Label</Composite.GroupLabel>
50
67
  * <Composite.Item>Item 1</Composite.Item>
@@ -63,10 +80,9 @@ export declare const Composite: import("react").ForwardRefExoticComponent<import
63
80
  *
64
81
  * @example
65
82
  * ```jsx
66
- * import { Composite, useCompositeStore } from '@wordpress/components';
83
+ * import { Composite } from '@wordpress/components';
67
84
  *
68
- * const store = useCompositeStore();
69
- * <Composite store={store}>
85
+ * <Composite>
70
86
  * <Composite.Group>
71
87
  * <Composite.GroupLabel>Label</Composite.GroupLabel>
72
88
  * <Composite.Item>Item 1</Composite.Item>
@@ -83,10 +99,9 @@ export declare const Composite: import("react").ForwardRefExoticComponent<import
83
99
  *
84
100
  * @example
85
101
  * ```jsx
86
- * import { Composite, useCompositeStore } from '@wordpress/components';
102
+ * import { Composite } from '@wordpress/components';
87
103
  *
88
- * const store = useCompositeStore();
89
- * <Composite store={store}>
104
+ * <Composite>
90
105
  * <Composite.Item>Item 1</Composite.Item>
91
106
  * <Composite.Item>Item 2</Composite.Item>
92
107
  * <Composite.Item>Item 3</Composite.Item>
@@ -103,10 +118,9 @@ export declare const Composite: import("react").ForwardRefExoticComponent<import
103
118
  *
104
119
  * @example
105
120
  * ```jsx
106
- * import { Composite, useCompositeStore } from '@wordpress/components';
121
+ * import { Composite } from '@wordpress/components';
107
122
  *
108
- * const store = useCompositeStore();
109
- * <Composite store={store}>
123
+ * <Composite>
110
124
  * <Composite.Row>
111
125
  * <Composite.Item>Item 1.1</Composite.Item>
112
126
  * <Composite.Item>Item 1.2</Composite.Item>
@@ -130,10 +144,9 @@ export declare const Composite: import("react").ForwardRefExoticComponent<import
130
144
  *
131
145
  * @example
132
146
  * ```jsx
133
- * import { Composite, useCompositeStore } from '@wordpress/components';
147
+ * import { Composite } from '@wordpress/components';
134
148
  *
135
- * const store = useCompositeStore();
136
- * <Composite store={store}>
149
+ * <Composite>
137
150
  * <Composite.Hover render={ <Composite.Item /> }>
138
151
  * Item 1
139
152
  * </Composite.Hover>
@@ -153,10 +166,9 @@ export declare const Composite: import("react").ForwardRefExoticComponent<import
153
166
  *
154
167
  * @example
155
168
  * ```jsx
156
- * import { Composite, useCompositeStore } from '@wordpress/components';
169
+ * import { Composite } from '@wordpress/components';
157
170
  *
158
- * const store = useCompositeStore();
159
- * <Composite store={store} render={ <CompositeTypeahead /> }>
171
+ * <Composite render={ <CompositeTypeahead /> }>
160
172
  * <Composite.Item>Item 1</Composite.Item>
161
173
  * <Composite.Item>Item 2</Composite.Item>
162
174
  * </Composite>
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composite/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAoB1C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS;;;;;;;;;IAgEpB;;;;;;;;;;;;;;;;OAgBG;;;;IAIH;;;;;;;;;;;;;;;;;;OAkBG;;;;IAIH;;;;;;;;;;;;;;OAcG;;;;IAEH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;;;;IAEH;;;;;;;;;;;;;;;;;;;OAmBG;;;;IAIH;;;;;;;;;;;;;;;OAeG;;;;IAIH;;;;;;;;;;;;;OAaG;;;;CAKJ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composite/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAqB1C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2DpB;;;;;;;;;;;;;;;OAeG;;;;IAIH;;;;;;;;;;;;;;;;;OAiBG;;;;IAIH;;;;;;;;;;;;;OAaG;;;;IAEH;;;;;;;;;;;;;;;;;;;;;;OAsBG;;;;IAEH;;;;;;;;;;;;;;;;;;OAkBG;;;;IAIH;;;;;;;;;;;;;;OAcG;;;;IAIH;;;;;;;;;;;;;OAaG;;;;CAKJ,CAAC"}
@@ -12,7 +12,10 @@
12
12
  *
13
13
  * @see https://ariakit.org/components/composite
14
14
  */
15
- import { useCompositeStore } from '../store';
15
+ /**
16
+ * External dependencies
17
+ */
18
+ import * as Ariakit from '@ariakit/react';
16
19
  type Orientation = 'horizontal' | 'vertical';
17
20
  export interface LegacyStateOptions {
18
21
  /**
@@ -64,7 +67,7 @@ export interface LegacyStateOptions {
64
67
  unstable_virtual?: boolean;
65
68
  }
66
69
  type Component = React.FunctionComponent<any>;
67
- type CompositeStore = ReturnType<typeof useCompositeStore>;
70
+ type CompositeStore = ReturnType<typeof Ariakit.useCompositeStore>;
68
71
  type CompositeStoreState = {
69
72
  store: CompositeStore;
70
73
  };
@@ -77,9 +80,29 @@ export type CompositeStateProps = {
77
80
  type ComponentProps<C extends Component> = React.ComponentPropsWithRef<C>;
78
81
  export type CompositeProps<C extends Component> = ComponentProps<C> & CompositeStateProps;
79
82
  type CompositeComponent<C extends Component> = (props: CompositeProps<C>) => React.ReactElement;
83
+ /**
84
+ * _Note: please use the `Composite` component instead._
85
+ *
86
+ * @deprecated
87
+ */
80
88
  export declare const Composite: CompositeComponent<Component>;
89
+ /**
90
+ * _Note: please use the `Composite.Row` or `Composite.Group` components instead._
91
+ *
92
+ * @deprecated
93
+ */
81
94
  export declare const CompositeGroup: CompositeComponent<Component>;
95
+ /**
96
+ * _Note: please use the `Composite.Item` component instead._
97
+ *
98
+ * @deprecated
99
+ */
82
100
  export declare const CompositeItem: CompositeComponent<Component>;
101
+ /**
102
+ * _Note: please use the `Composite` component instead._
103
+ *
104
+ * @deprecated
105
+ */
83
106
  export declare function useCompositeState(legacyStateOptions?: LegacyStateOptions): CompositeState;
84
107
  export {};
85
108
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composite/legacy/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAWH,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG7C,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IACd;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B;;;;;;;O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CAAE,CAAC,CAAE,KACtB,KAAK,CAAC,YAAY,CAAC;AAgFxB;;;;GAIG;AACH,eAAO,MAAM,SAAS,+BAGrB,CAAC;AACF;;;;GAIG;AACH,eAAO,MAAM,cAAc,+BAI1B,CAAC;AACF;;;;GAIG;AACH,eAAO,MAAM,aAAa,+BAOzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAChC,kBAAkB,GAAE,kBAAuB,GACzC,cAAc,CA8BhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/composite/legacy/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAWtD,OAAO,EAAE,4BAA4B,EAAa,MAAM,SAAS,CAAC;AAElE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,4BAA4B,CA2BpD,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAC/C,OAAO,4BAA4B,CA6CnC,CAAC;AAGF,eAAO,MAAM,4BAA4B,EAAE,OAAO,CACjD,OAAO,4BAA4B,CA6CnC,CAAC;AAGF,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAC9C,OAAO,4BAA4B,CA2BnC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAChD,OAAO,4BAA4B,CA2BnC,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../../src/composite/legacy/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAWtD,OAAO,EAAE,4BAA4B,EAAa,MAAM,SAAS,CAAC;AAElE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,4BAA4B,CA4BpD,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAC/C,OAAO,4BAA4B,CA6CnC,CAAC;AAGF,eAAO,MAAM,4BAA4B,EAAE,OAAO,CACjD,OAAO,4BAA4B,CA6CnC,CAAC;AAGF,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAC9C,OAAO,4BAA4B,CA2BnC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAChD,OAAO,4BAA4B,CA2BnC,CAAC"}
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import type { Meta, StoryFn } from '@storybook/react';
5
- import { UseCompositeStorePlaceholder } from './utils';
6
- declare const meta: Meta<typeof UseCompositeStorePlaceholder>;
4
+ import type { Meta, StoryObj } from '@storybook/react';
5
+ import { Composite } from '..';
6
+ declare const meta: Meta<typeof Composite>;
7
7
  export default meta;
8
- export declare const Default: StoryFn<typeof UseCompositeStorePlaceholder>;
9
- export declare const Groups: StoryFn<typeof UseCompositeStorePlaceholder>;
10
- export declare const Grid: StoryFn<typeof UseCompositeStorePlaceholder>;
11
- export declare const Hover: StoryFn<typeof UseCompositeStorePlaceholder>;
12
- export declare const Typeahead: StoryFn<typeof UseCompositeStorePlaceholder>;
13
- export declare const WithSlotFill: StoryFn<typeof UseCompositeStorePlaceholder>;
8
+ export declare const Default: StoryObj<typeof Composite>;
9
+ export declare const Groups: StoryObj<typeof Composite>;
10
+ export declare const Grid: StoryObj<typeof Composite>;
11
+ export declare const Hover: StoryObj<typeof Composite>;
12
+ export declare const Typeahead: StoryObj<typeof Composite>;
13
+ export declare const WithSlotFill: StoryObj<typeof Composite>;
14
14
  //# sourceMappingURL=index.story.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/composite/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAgB,MAAM,kBAAkB,CAAC;AA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O,MAAM,YAAY,EAAE,QAAQ,CAAE,OAAO,SAAS,CAuGpD,CAAC"}
@@ -4,11 +4,15 @@
4
4
  import type * as Ariakit from '@ariakit/react';
5
5
  export type CompositeContextProps = {
6
6
  /**
7
- * Object returned by the `useCompositeStore` hook.
7
+ * The component store, used for advanced usage of the component.
8
+ *
9
+ * _Note: Using the store directly is not recommended. Instead, use the props
10
+ * exposed by the `Composite` component._
11
+ *
8
12
  */
9
- store: Ariakit.CompositeStore;
10
- } | undefined;
11
- export type CompositeStoreProps = {
13
+ store?: unknown;
14
+ };
15
+ type CompositeStoreProps = {
12
16
  /**
13
17
  * The current active item `id`. The active item is the element within the
14
18
  * composite widget that has either DOM or virtual focus (in case
@@ -113,21 +117,17 @@ export type CompositeStoreProps = {
113
117
  */
114
118
  orientation?: Ariakit.CompositeStoreProps['orientation'];
115
119
  /**
116
- * Determines how the `store`'s `next` and `previous` functions will behave.
120
+ * Controls how the previous and next items are determined.
117
121
  * If `rtl` is set to `true`, they will be inverted.
118
122
  *
119
123
  * This only affects the composite widget behavior. You still need to set
120
124
  * `dir="rtl"` on HTML/CSS.
121
125
  *
122
- * @default false
126
+ * @default `isRtl()`
123
127
  */
124
128
  rtl?: Ariakit.CompositeStoreProps['rtl'];
125
129
  };
126
130
  export type CompositeProps = CompositeStoreProps & {
127
- /**
128
- * Object returned by the `useCompositeStore` hook.
129
- */
130
- store?: Ariakit.CompositeStore;
131
131
  /**
132
132
  * Allows the component to be rendered as a different HTML element or React
133
133
  * component. The value can be a React element or a function that takes in the
@@ -285,4 +285,5 @@ export type CompositeTypeaheadProps = {
285
285
  */
286
286
  children?: Ariakit.CompositeTypeaheadProps['children'];
287
287
  };
288
+ export {};
288
289
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/composite/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;A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ePicker is a React component that renders a calendar for date selection.