@astryxdesign/core 0.4.4 → 0.4.5-canary.1fdecb1

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 (275) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/BottomSheet/BottomSheet.d.ts +11 -2
  3. package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
  4. package/dist/BottomSheet/BottomSheet.js +4 -0
  5. package/dist/BottomSheet/BottomSheetPanel.d.ts +5 -2
  6. package/dist/BottomSheet/BottomSheetPanel.d.ts.map +1 -1
  7. package/dist/BottomSheet/BottomSheetPanel.js +65 -15
  8. package/dist/BottomSheet/index.d.ts +1 -1
  9. package/dist/BottomSheet/index.d.ts.map +1 -1
  10. package/dist/BottomSheet/snapOffsets.d.ts +57 -20
  11. package/dist/BottomSheet/snapOffsets.d.ts.map +1 -1
  12. package/dist/BottomSheet/snapOffsets.js +106 -30
  13. package/dist/BottomSheet/useSheetGestures.d.ts +13 -8
  14. package/dist/BottomSheet/useSheetGestures.d.ts.map +1 -1
  15. package/dist/BottomSheet/useSheetGestures.js +160 -64
  16. package/dist/Calendar/Calendar.d.ts +17 -0
  17. package/dist/Calendar/Calendar.d.ts.map +1 -1
  18. package/dist/Calendar/Calendar.js +34 -3
  19. package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +14 -0
  20. package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +1 -0
  21. package/dist/Calendar/getStandaloneShortWeekdayNames.js +26 -0
  22. package/dist/Calendar/hooks/useCalendarConstraints.d.ts +22 -1
  23. package/dist/Calendar/hooks/useCalendarConstraints.d.ts.map +1 -1
  24. package/dist/Calendar/hooks/useCalendarConstraints.js +26 -4
  25. package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
  26. package/dist/Calendar/hooks/useCalendarDays.js +14 -10
  27. package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts +47 -0
  28. package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +1 -0
  29. package/dist/Calendar/standaloneShortWeekdayNames.generated.js +40 -0
  30. package/dist/Center/Center.d.ts +23 -1
  31. package/dist/Center/Center.d.ts.map +1 -1
  32. package/dist/Center/Center.js +12 -6
  33. package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
  34. package/dist/CheckboxInput/CheckboxInput.js +9 -0
  35. package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
  36. package/dist/ComplexSelector/ComplexSelector.js +6 -1
  37. package/dist/DateInput/DateInput.d.ts.map +1 -1
  38. package/dist/DateInput/DateInput.js +6 -1
  39. package/dist/DateRangeInput/DateRangeInput.d.ts +23 -1
  40. package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
  41. package/dist/DateRangeInput/DateRangeInput.js +38 -3
  42. package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
  43. package/dist/DateTimeInput/DateTimeInput.js +7 -2
  44. package/dist/Dialog/Dialog.d.ts.map +1 -1
  45. package/dist/Dialog/Dialog.js +3 -3
  46. package/dist/Field/FieldLabel.d.ts +2 -1
  47. package/dist/Field/FieldLabel.d.ts.map +1 -1
  48. package/dist/Field/FieldLabel.js +21 -3
  49. package/dist/Field/InputClearButton.d.ts +2 -1
  50. package/dist/Field/InputClearButton.d.ts.map +1 -1
  51. package/dist/Field/InputClearButton.js +6 -1
  52. package/dist/FormLayout/FormLayout.d.ts +24 -2
  53. package/dist/FormLayout/FormLayout.d.ts.map +1 -1
  54. package/dist/FormLayout/FormLayout.js +7 -2
  55. package/dist/FormLayout/FormLayoutContext.d.ts +15 -2
  56. package/dist/FormLayout/FormLayoutContext.d.ts.map +1 -1
  57. package/dist/FormLayout/FormLayoutContext.js +19 -4
  58. package/dist/FormLayout/index.d.ts +1 -1
  59. package/dist/FormLayout/index.d.ts.map +1 -1
  60. package/dist/Item/Item.d.ts +9 -1
  61. package/dist/Item/Item.d.ts.map +1 -1
  62. package/dist/Item/Item.js +45 -7
  63. package/dist/Layer/useLayer.d.ts.map +1 -1
  64. package/dist/Layer/useLayer.js +3 -2
  65. package/dist/Layout/container.stylex.d.ts +4 -2
  66. package/dist/Layout/container.stylex.d.ts.map +1 -1
  67. package/dist/Layout/container.stylex.js +19 -11
  68. package/dist/Layout/index.d.ts +1 -0
  69. package/dist/Layout/index.d.ts.map +1 -1
  70. package/dist/Layout/index.js +4 -0
  71. package/dist/Layout/padding.stylex.d.ts +315 -12
  72. package/dist/Layout/padding.stylex.d.ts.map +1 -1
  73. package/dist/Layout/padding.stylex.js +389 -12
  74. package/dist/Lightbox/Lightbox.d.ts.map +1 -1
  75. package/dist/Lightbox/Lightbox.js +2 -1
  76. package/dist/Markdown/Markdown.d.ts +8 -0
  77. package/dist/Markdown/Markdown.d.ts.map +1 -1
  78. package/dist/Markdown/Markdown.js +31 -3
  79. package/dist/Markdown/parser.d.ts +14 -2
  80. package/dist/Markdown/parser.d.ts.map +1 -1
  81. package/dist/Markdown/parser.js +50 -2
  82. package/dist/MobileNav/MobileNav.d.ts +1 -0
  83. package/dist/MobileNav/MobileNav.d.ts.map +1 -1
  84. package/dist/MobileNav/MobileNav.js +24 -6
  85. package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
  86. package/dist/MultiSelector/MultiSelector.js +6 -1
  87. package/dist/NumberInput/NumberInput.d.ts.map +1 -1
  88. package/dist/NumberInput/NumberInput.js +36 -3
  89. package/dist/Outline/parseOutlineFromMarkdown.d.ts +2 -0
  90. package/dist/Outline/parseOutlineFromMarkdown.d.ts.map +1 -1
  91. package/dist/Outline/parseOutlineFromMarkdown.js +5 -31
  92. package/dist/RadioList/RadioList.d.ts.map +1 -1
  93. package/dist/RadioList/RadioList.js +12 -1
  94. package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
  95. package/dist/Resizable/ResizeHandle.js +3 -3
  96. package/dist/Section/Section.d.ts +36 -1
  97. package/dist/Section/Section.d.ts.map +1 -1
  98. package/dist/Section/Section.js +12 -2
  99. package/dist/Selector/Selector.d.ts +26 -1
  100. package/dist/Selector/Selector.d.ts.map +1 -1
  101. package/dist/Selector/Selector.js +93 -15
  102. package/dist/Selector/SelectorOption.d.ts +14 -1
  103. package/dist/Selector/SelectorOption.d.ts.map +1 -1
  104. package/dist/Selector/SelectorOption.js +6 -0
  105. package/dist/Selector/SelectorRowLayoutContext.d.ts +8 -0
  106. package/dist/Selector/SelectorRowLayoutContext.d.ts.map +1 -0
  107. package/dist/Selector/SelectorRowLayoutContext.js +27 -0
  108. package/dist/Selector/types.d.ts +1 -0
  109. package/dist/Selector/types.d.ts.map +1 -1
  110. package/dist/Slider/Slider.d.ts.map +1 -1
  111. package/dist/Slider/Slider.js +2 -2
  112. package/dist/Stack/Stack.d.ts +23 -1
  113. package/dist/Stack/Stack.d.ts.map +1 -1
  114. package/dist/Stack/Stack.js +12 -6
  115. package/dist/StatusDot/StatusDot.d.ts +43 -3
  116. package/dist/StatusDot/StatusDot.d.ts.map +1 -1
  117. package/dist/StatusDot/StatusDot.js +42 -5
  118. package/dist/Switch/Switch.d.ts.map +1 -1
  119. package/dist/Switch/Switch.js +9 -0
  120. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
  121. package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +7 -2
  122. package/dist/TextArea/TextArea.d.ts.map +1 -1
  123. package/dist/TextArea/TextArea.js +6 -1
  124. package/dist/TextInput/TextInput.d.ts.map +1 -1
  125. package/dist/TextInput/TextInput.js +6 -1
  126. package/dist/TimeInput/TimeInput.d.ts.map +1 -1
  127. package/dist/TimeInput/TimeInput.js +6 -1
  128. package/dist/astryx.css +40 -21
  129. package/dist/hooks/scrollbarGutter.d.ts +28 -0
  130. package/dist/hooks/scrollbarGutter.d.ts.map +1 -0
  131. package/dist/hooks/scrollbarGutter.js +103 -0
  132. package/dist/hooks/useResolvedRequired.d.ts +19 -0
  133. package/dist/hooks/useResolvedRequired.d.ts.map +1 -0
  134. package/dist/hooks/useResolvedRequired.js +40 -0
  135. package/dist/hooks/useScrollLock.d.ts +4 -0
  136. package/dist/hooks/useScrollLock.d.ts.map +1 -1
  137. package/dist/hooks/useScrollLock.js +13 -1
  138. package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
  139. package/dist/theme/derivedVarRegistry.js +7 -0
  140. package/dist/theme/generateThemeRules.d.ts.map +1 -1
  141. package/dist/theme/generateThemeRules.js +37 -4
  142. package/dist/utils/plainDate.d.ts +6 -0
  143. package/dist/utils/plainDate.d.ts.map +1 -1
  144. package/dist/utils/plainDate.js +12 -0
  145. package/locales/af-ZA.json +958 -0
  146. package/locales/ar-SA.json +998 -0
  147. package/locales/ca-ES.json +974 -0
  148. package/locales/cs-CZ.json +990 -0
  149. package/locales/da-DK.json +966 -0
  150. package/locales/de-DE.json +966 -0
  151. package/locales/el-GR.json +990 -0
  152. package/locales/en.json +8 -0
  153. package/locales/es-ES.json +978 -0
  154. package/locales/fi-FI.json +990 -0
  155. package/locales/fr-FR.json +928 -0
  156. package/locales/he-IL.json +990 -0
  157. package/locales/hu-HU.json +990 -0
  158. package/locales/it-IT.json +978 -0
  159. package/locales/ja-JP.json +998 -0
  160. package/locales/ko-KR.json +990 -0
  161. package/locales/nl-NL.json +954 -0
  162. package/locales/no-NO.json +978 -0
  163. package/locales/pl-PL.json +982 -0
  164. package/locales/pseudo.json +6 -0
  165. package/locales/pt-BR.json +982 -0
  166. package/locales/pt-PT.json +982 -0
  167. package/locales/ro-RO.json +982 -0
  168. package/locales/ru-RU.json +990 -0
  169. package/locales/sr-SP.json +990 -0
  170. package/locales/sv-SE.json +986 -0
  171. package/locales/tr-TR.json +990 -0
  172. package/locales/uk-UA.json +990 -0
  173. package/locales/vi-VN.json +986 -0
  174. package/locales/zh-CN.json +998 -0
  175. package/locales/zh-TW.json +998 -0
  176. package/package.json +3 -3
  177. package/src/BottomSheet/BottomSheet.doc.mjs +36 -3
  178. package/src/BottomSheet/BottomSheet.test.tsx +177 -2
  179. package/src/BottomSheet/BottomSheet.tsx +16 -2
  180. package/src/BottomSheet/BottomSheetPanel.test.tsx +41 -0
  181. package/src/BottomSheet/BottomSheetPanel.tsx +95 -15
  182. package/src/BottomSheet/index.ts +5 -1
  183. package/src/BottomSheet/snapOffsets.test.ts +114 -47
  184. package/src/BottomSheet/snapOffsets.ts +119 -33
  185. package/src/BottomSheet/useSheetGestures.test.ts +113 -15
  186. package/src/BottomSheet/useSheetGestures.ts +196 -100
  187. package/src/Calendar/Calendar.doc.mjs +16 -0
  188. package/src/Calendar/Calendar.test.tsx +137 -0
  189. package/src/Calendar/Calendar.tsx +65 -2
  190. package/src/Calendar/getStandaloneShortWeekdayNames.test.ts +54 -0
  191. package/src/Calendar/getStandaloneShortWeekdayNames.ts +38 -0
  192. package/src/Calendar/hooks/useCalendarConstraints.ts +54 -3
  193. package/src/Calendar/hooks/useCalendarDays.ts +13 -10
  194. package/src/Calendar/standaloneShortWeekdayNames.generated.ts +50 -0
  195. package/src/Center/Center.doc.mjs +48 -0
  196. package/src/Center/Center.test.tsx +158 -0
  197. package/src/Center/Center.tsx +50 -9
  198. package/src/CheckboxInput/CheckboxInput.tsx +6 -0
  199. package/src/ComplexSelector/ComplexSelector.tsx +3 -1
  200. package/src/DateInput/DateInput.tsx +3 -1
  201. package/src/DateRangeInput/DateRangeInput.doc.mjs +16 -0
  202. package/src/DateRangeInput/DateRangeInput.test.tsx +81 -1
  203. package/src/DateRangeInput/DateRangeInput.tsx +72 -1
  204. package/src/DateTimeInput/DateTimeInput.tsx +4 -2
  205. package/src/Dialog/Dialog.test.tsx +24 -0
  206. package/src/Dialog/Dialog.tsx +3 -0
  207. package/src/Field/Field.doc.mjs +1 -0
  208. package/src/Field/FieldLabel.tsx +20 -4
  209. package/src/Field/InputClearButton.test.tsx +25 -0
  210. package/src/Field/InputClearButton.tsx +4 -1
  211. package/src/FormLayout/FormLayout.doc.mjs +13 -0
  212. package/src/FormLayout/FormLayout.test.tsx +181 -4
  213. package/src/FormLayout/FormLayout.tsx +33 -2
  214. package/src/FormLayout/FormLayoutContext.ts +22 -7
  215. package/src/FormLayout/index.ts +1 -1
  216. package/src/Item/Item.doc.mjs +1 -0
  217. package/src/Item/Item.test.tsx +50 -0
  218. package/src/Item/Item.tsx +40 -1
  219. package/src/Layer/useLayer.tsx +13 -2
  220. package/src/Layout/Layout.doc.mjs +18 -0
  221. package/src/Layout/container.stylex.ts +11 -3
  222. package/src/Layout/index.ts +4 -0
  223. package/src/Layout/overlayPaddingReset.test.tsx +222 -0
  224. package/src/Layout/padding.stylex.ts +192 -12
  225. package/src/Lightbox/Lightbox.tsx +2 -1
  226. package/src/Markdown/Markdown.doc.mjs +3 -0
  227. package/src/Markdown/Markdown.test.tsx +78 -0
  228. package/src/Markdown/Markdown.tsx +41 -1
  229. package/src/Markdown/parser.ts +60 -2
  230. package/src/MobileNav/MobileNav.tsx +61 -5
  231. package/src/MobileNav/MobileNavEntryAnimation.test.tsx +212 -0
  232. package/src/MobileNav/MobileNavScrollbarGutter.test.tsx +109 -0
  233. package/src/MultiSelector/MultiSelector.tsx +3 -1
  234. package/src/NumberInput/NumberInput.doc.mjs +24 -0
  235. package/src/NumberInput/NumberInput.test.tsx +138 -0
  236. package/src/NumberInput/NumberInput.tsx +43 -5
  237. package/src/Outline/Outline.doc.mjs +2 -0
  238. package/src/Outline/parseOutlineFromMarkdown.ts +10 -40
  239. package/src/RadioList/RadioList.tsx +9 -1
  240. package/src/Resizable/ResizeHandle.test.tsx +22 -0
  241. package/src/Resizable/ResizeHandle.tsx +9 -3
  242. package/src/Section/Section.doc.mjs +55 -0
  243. package/src/Section/Section.test.tsx +201 -4
  244. package/src/Section/Section.tsx +69 -0
  245. package/src/Selector/Selector.doc.mjs +16 -2
  246. package/src/Selector/Selector.test.tsx +524 -0
  247. package/src/Selector/Selector.tsx +161 -17
  248. package/src/Selector/SelectorOption.doc.mjs +7 -0
  249. package/src/Selector/SelectorOption.tsx +21 -0
  250. package/src/Selector/SelectorRowLayoutContext.ts +32 -0
  251. package/src/Selector/types.ts +4 -4
  252. package/src/Slider/Slider.tsx +10 -0
  253. package/src/Stack/Stack.doc.mjs +72 -0
  254. package/src/Stack/Stack.test.tsx +156 -0
  255. package/src/Stack/Stack.tsx +50 -8
  256. package/src/StatusDot/StatusDot.doc.mjs +13 -0
  257. package/src/StatusDot/StatusDot.test.tsx +115 -8
  258. package/src/StatusDot/StatusDot.tsx +74 -9
  259. package/src/Switch/Switch.tsx +6 -0
  260. package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +20 -2
  261. package/src/TextArea/TextArea.tsx +3 -1
  262. package/src/TextInput/TextInput.tsx +3 -1
  263. package/src/TimeInput/TimeInput.tsx +3 -1
  264. package/src/hooks/scrollbarGutter.test.ts +167 -0
  265. package/src/hooks/scrollbarGutter.ts +121 -0
  266. package/src/hooks/useResolvedRequired.ts +42 -0
  267. package/src/hooks/useScrollLock.doc.mjs +4 -4
  268. package/src/hooks/useScrollLock.test.ts +73 -0
  269. package/src/hooks/useScrollLock.ts +14 -0
  270. package/src/theme/derivedVarRegistry.test.ts +14 -3
  271. package/src/theme/derivedVarRegistry.ts +4 -0
  272. package/src/theme/generateThemeRules.test.ts +79 -0
  273. package/src/theme/generateThemeRules.ts +49 -4
  274. package/src/utils/plainDate.test.ts +50 -0
  275. package/src/utils/plainDate.ts +12 -0
@@ -0,0 +1,103 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file scrollbarGutter.ts
5
+ * @input The element a scroll lock pins, plus live layout measurements
6
+ * @output Exports holdScrollbarGutter and the ScrollbarGutterHold it returns
7
+ * @position Internal hook utility; used by useScrollLock and MobileNav so that
8
+ * locking background scroll does not resize the layout viewport.
9
+ *
10
+ * Locking scroll hides the document's scrollbar. Where that scrollbar is a
11
+ * classic (space-taking) one — Windows/Linux desktop, and macOS set to
12
+ * "Always" show scroll bars — hiding it widens the layout viewport by the
13
+ * scrollbar's width and the whole page jumps sideways behind the overlay.
14
+ *
15
+ * The fix is `scrollbar-gutter: stable`, which holds the gutter open once the
16
+ * scrollbar goes away. Being a real layout change it holds `position: fixed`
17
+ * chrome (sticky headers, toast viewports) as well as in-flow content, which
18
+ * padding fundamentally cannot: fixed elements resolve against the viewport,
19
+ * not against the padded element.
20
+ *
21
+ * Padding is kept only as a fallback for engines without `scrollbar-gutter`
22
+ * (Safari shipped it in 18.2), and it is applied by measuring whether the
23
+ * element actually moved rather than by assuming it did.
24
+ */
25
+
26
+ const NOOP = {
27
+ settle() {},
28
+ release() {}
29
+ };
30
+ /**
31
+ * Keeps `element`'s content box the width it is right now, across a scroll
32
+ * lock that is about to hide the document's scrollbar.
33
+ *
34
+ * Call it *before* applying the lock's styles, then {@link
35
+ * ScrollbarGutterHold.settle} immediately after, and {@link
36
+ * ScrollbarGutterHold.release} on unlock:
37
+ *
38
+ * ```
39
+ * const hold = holdScrollbarGutter(document.body);
40
+ * body.style.position = 'fixed';
41
+ * hold.settle();
42
+ * ```
43
+ *
44
+ * Overlay scrollbars (mobile, default macOS) take no layout space, so there is
45
+ * nothing to hold and nothing is touched.
46
+ */
47
+ export function holdScrollbarGutter(element) {
48
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
49
+ return NOOP;
50
+ }
51
+ const root = document.documentElement;
52
+ const viewportWidth = root.clientWidth;
53
+
54
+ // 0 means "no layout to measure" (jsdom, and any non-visual environment),
55
+ // not "the scrollbar is as wide as the window".
56
+ if (viewportWidth === 0) {
57
+ return NOOP;
58
+ }
59
+ const previousGutter = root.style.scrollbarGutter;
60
+ const previousPadding = element.style.paddingRight;
61
+ const widthBefore = element.getBoundingClientRect().width;
62
+ let heldGutter = false;
63
+ let padded = false;
64
+ let settled = false;
65
+
66
+ // Only when a space-taking scrollbar is actually there. Holding the gutter
67
+ // open on a page that never had one would carve out 15px that was never
68
+ // reserved — the same shift, in the other direction.
69
+ if (window.innerWidth > viewportWidth) {
70
+ root.style.scrollbarGutter = 'stable';
71
+ heldGutter = true;
72
+ }
73
+ return {
74
+ settle() {
75
+ if (settled) {
76
+ return;
77
+ }
78
+ settled = true;
79
+
80
+ // What the lock actually did to this element, rather than what we
81
+ // assumed it would do. 0 on any engine where the gutter held — and on a
82
+ // page that already sets `scrollbar-gutter: stable` itself, where the
83
+ // scrollbar was never taking the space back.
84
+ const grew = element.getBoundingClientRect().width - widthBefore;
85
+ if (grew <= 0) {
86
+ return;
87
+ }
88
+ const existing = Number.parseFloat(window.getComputedStyle(element).paddingRight) || 0;
89
+ element.style.paddingRight = `${existing + grew}px`;
90
+ padded = true;
91
+ },
92
+ release() {
93
+ if (padded) {
94
+ element.style.paddingRight = previousPadding;
95
+ padded = false;
96
+ }
97
+ if (heldGutter) {
98
+ root.style.scrollbarGutter = previousGutter;
99
+ heldGutter = false;
100
+ }
101
+ }
102
+ };
103
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Resolve a field's effective *required* state for `aria-required`, honoring a
3
+ * surrounding `FormLayout`'s `defaultOptionality`.
4
+ *
5
+ * Under `defaultOptionality="required"` a field is required unless it opts out
6
+ * with `isOptional`. The visible indicator is suppressed for the unmarked
7
+ * majority, so those fields must still expose `aria-required` — otherwise a
8
+ * sighted user reads them as required (form-wide default, no indicator) while a
9
+ * screen reader hears "not required". This closes that mismatch.
10
+ *
11
+ * Semantics only: this drives `aria-required`, never the native `required`
12
+ * attribute, so a layout-level default can't silently switch on browser
13
+ * validation bubbles. `isOptional` takes precedence, matching `FieldLabel`.
14
+ */
15
+ export declare function useResolvedRequired({ isRequired, isOptional, }: {
16
+ isRequired?: boolean;
17
+ isOptional?: boolean;
18
+ }): boolean;
19
+ //# sourceMappingURL=useResolvedRequired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResolvedRequired.d.ts","sourceRoot":"","sources":["../../src/hooks/useResolvedRequired.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,UAAkB,EAClB,UAAkB,GACnB,EAAE;IACD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,OAAO,CAGV"}
@@ -0,0 +1,40 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ 'use client';
4
+
5
+ /**
6
+ * @file useResolvedRequired.ts
7
+ * @input Uses React, FormLayoutContext
8
+ * @output Exports useResolvedRequired
9
+ * @position Resolves a field's effective aria-required against the form default
10
+ *
11
+ * SYNC: When modified, update these files to stay in sync:
12
+ * - /packages/core/src/FormLayout/FormLayoutContext.ts (defaultOptionality source)
13
+ * - /packages/core/src/FormLayout/FormLayout.tsx (prop doc: aria-required behavior)
14
+ */
15
+ import { use } from 'react';
16
+ import { FormLayoutContext } from "../FormLayout/FormLayoutContext.js";
17
+
18
+ /**
19
+ * Resolve a field's effective *required* state for `aria-required`, honoring a
20
+ * surrounding `FormLayout`'s `defaultOptionality`.
21
+ *
22
+ * Under `defaultOptionality="required"` a field is required unless it opts out
23
+ * with `isOptional`. The visible indicator is suppressed for the unmarked
24
+ * majority, so those fields must still expose `aria-required` — otherwise a
25
+ * sighted user reads them as required (form-wide default, no indicator) while a
26
+ * screen reader hears "not required". This closes that mismatch.
27
+ *
28
+ * Semantics only: this drives `aria-required`, never the native `required`
29
+ * attribute, so a layout-level default can't silently switch on browser
30
+ * validation bubbles. `isOptional` takes precedence, matching `FieldLabel`.
31
+ */
32
+ export function useResolvedRequired({
33
+ isRequired = false,
34
+ isOptional = false
35
+ }) {
36
+ const {
37
+ defaultOptionality
38
+ } = use(FormLayoutContext);
39
+ return !isOptional && (isRequired || defaultOptionality === 'required');
40
+ }
@@ -6,6 +6,10 @@
6
6
  * does not prevent body scroll behind modals. Restores scroll position
7
7
  * on unlock.
8
8
  *
9
+ * Pinning also hides the document's scrollbar, so the gutter that scrollbar
10
+ * occupied is held open for the duration of the lock — without it the page
11
+ * reflows sideways by ~15px the moment an overlay opens.
12
+ *
9
13
  * @example
10
14
  * ```
11
15
  * useScrollLock(isOpen);
@@ -1 +1 @@
1
- {"version":3,"file":"useScrollLock.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollLock.ts"],"names":[],"mappings":"AAgCA;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAiDrD"}
1
+ {"version":3,"file":"useScrollLock.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollLock.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAwDrD"}
@@ -13,8 +13,10 @@
13
13
  *
14
14
  * SYNC: When modified, update:
15
15
  * - /packages/core/src/hooks/index.ts
16
+ * - /packages/core/src/hooks/scrollbarGutter.ts
16
17
  */
17
18
  import { useEffect } from 'react';
19
+ import { holdScrollbarGutter } from "./scrollbarGutter.js";
18
20
  let lockCount = 0;
19
21
  let originalBodyState = null;
20
22
 
@@ -26,6 +28,10 @@ let originalBodyState = null;
26
28
  * does not prevent body scroll behind modals. Restores scroll position
27
29
  * on unlock.
28
30
  *
31
+ * Pinning also hides the document's scrollbar, so the gutter that scrollbar
32
+ * occupied is held open for the duration of the lock — without it the page
33
+ * reflows sideways by ~15px the moment an overlay opens.
34
+ *
29
35
  * @example
30
36
  * ```
31
37
  * useScrollLock(isOpen);
@@ -42,6 +48,9 @@ export function useScrollLock(isLocked) {
42
48
  if (lockCount === 0) {
43
49
  const scrollX = window.scrollX;
44
50
  const scrollY = window.scrollY;
51
+
52
+ // Taken before the pinning styles below hide the scrollbar.
53
+ const gutter = holdScrollbarGutter(body);
45
54
  originalBodyState = {
46
55
  scrollX,
47
56
  scrollY,
@@ -49,13 +58,15 @@ export function useScrollLock(isLocked) {
49
58
  position: body.style.position,
50
59
  top: body.style.top,
51
60
  left: body.style.left,
52
- right: body.style.right
61
+ right: body.style.right,
62
+ gutter
53
63
  };
54
64
  body.style.overflow = 'hidden';
55
65
  body.style.position = 'fixed';
56
66
  body.style.top = `-${scrollY}px`;
57
67
  body.style.left = '0';
58
68
  body.style.right = '0';
69
+ gutter.settle();
59
70
  }
60
71
  lockCount += 1;
61
72
  return () => {
@@ -70,6 +81,7 @@ export function useScrollLock(isLocked) {
70
81
  body.style.top = state.top;
71
82
  body.style.left = state.left;
72
83
  body.style.right = state.right;
84
+ state.gutter.release();
73
85
  window.scrollTo(state.scrollX, state.scrollY);
74
86
  };
75
87
  }, [isLocked]);
@@ -1 +1 @@
1
- {"version":3,"file":"derivedVarRegistry.d.ts","sourceRoot":"","sources":["../../src/theme/derivedVarRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CA0ChE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,eAAe,EAAE,CAMnB"}
1
+ {"version":3,"file":"derivedVarRegistry.d.ts","sourceRoot":"","sources":["../../src/theme/derivedVarRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CA8ChE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,eAAe,EAAE,CAMnB"}
@@ -77,6 +77,13 @@ export const derivedVarRegistry = {
77
77
  property: 'borderRadius',
78
78
  vars: ['--_hovercard-radius']
79
79
  }],
80
+ 'number-input': [{
81
+ property: 'padding',
82
+ expand: 'container'
83
+ }, {
84
+ property: 'borderRadius',
85
+ vars: ['--_field-radius']
86
+ }],
80
87
  popover: [{
81
88
  property: 'borderRadius',
82
89
  vars: ['--_popover-radius']
@@ -1 +1 @@
1
- {"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AA+DhD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAgKD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAoChE;AAmQD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAe5E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CA4E9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CA2BpE"}
1
+ {"version":3,"file":"generateThemeRules.d.ts","sourceRoot":"","sources":["../../src/theme/generateThemeRules.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AA+DhD;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AA8LD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,EAAE,CAoChE;AAkRD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,eAAe,CAe5E;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CA4E9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,GAAG,cAAc,CA2BpE"}
@@ -96,13 +96,40 @@ function toKebabCase(str) {
96
96
 
97
97
  /** Padding properties that trigger container token mapping */
98
98
  const PADDING_PROPS = new Set(['padding', 'paddingBlock', 'paddingInline', 'paddingBlockStart', 'paddingBlockEnd', 'paddingInlineStart', 'paddingInlineEnd']);
99
+
100
+ /**
101
+ * Physical block-axis longhands, and the logical longhand each one *is* in
102
+ * every horizontal writing mode. Normalizing them costs no direction
103
+ * assumption, which is why they can join the container expansion.
104
+ *
105
+ * `paddingLeft`/`paddingRight` are deliberately absent. They are
106
+ * direction-relative — left is inline-start in LTR and inline-end in RTL — and
107
+ * the expansion's tokens are consumed by logical properties, so mapping them
108
+ * would put the padding on the opposite edge in RTL. They keep their physical
109
+ * meaning and land on the element as `padding-left`/`padding-right`; the cost
110
+ * is that a component's internals cannot see them.
111
+ */
112
+ const PHYSICAL_BLOCK_PADDING_PROPS = {
113
+ paddingTop: 'paddingBlockStart',
114
+ paddingBottom: 'paddingBlockEnd'
115
+ };
116
+
117
+ /**
118
+ * Every padding spelling the container expansion consumes. Kept separate from
119
+ * PADDING_PROPS, which also routes longhands to `vars`-style derived entries —
120
+ * those carry one value for the whole box, so a single physical edge must not
121
+ * reach them.
122
+ */
123
+ const CONTAINER_PADDING_PROPS = new Set([...PADDING_PROPS, ...Object.keys(PHYSICAL_BLOCK_PADDING_PROPS)]);
99
124
  /**
100
125
  * Parse CSS padding shorthand/longhand into block/inline values.
101
- * Supports 1-3 value shorthands and logical properties.
126
+ * Supports 1-3 value shorthands, logical properties, and the physical block
127
+ * longhands normalized by PHYSICAL_BLOCK_PADDING_PROPS.
102
128
  */
103
129
  function parsePadding(props) {
104
130
  const result = {};
105
- for (const [prop, value] of props) {
131
+ for (const [rawProp, value] of props) {
132
+ const prop = PHYSICAL_BLOCK_PADDING_PROPS[rawProp] ?? rawProp;
106
133
  switch (prop) {
107
134
  case 'padding':
108
135
  {
@@ -311,13 +338,19 @@ function generateComponentRules(components, parts) {
311
338
  }
312
339
  }
313
340
  }
341
+ // A physical block longhand reaches the container expansion only. It
342
+ // names one edge, so it must not feed a `vars` entry above, which
343
+ // carries the padding for the whole box.
344
+ if (prop in PHYSICAL_BLOCK_PADDING_PROPS && getDerivedVars(component, 'padding').some(e => e.expand === 'container')) {
345
+ containerExpanded = true;
346
+ }
314
347
  }
315
348
 
316
349
  // Container padding expansion: replace padding props with
317
350
  // component-scoped container tokens for layout integration.
318
351
  if (containerExpanded) {
319
- const paddingProps = props.filter(([p]) => PADDING_PROPS.has(p));
320
- const nonPaddingProps = props.filter(([p]) => !PADDING_PROPS.has(p));
352
+ const paddingProps = props.filter(([p]) => CONTAINER_PADDING_PROPS.has(p));
353
+ const nonPaddingProps = props.filter(([p]) => !CONTAINER_PADDING_PROPS.has(p));
321
354
  const parsed = parsePadding(paddingProps);
322
355
  const containerTokens = expandContainerPadding(component, parsed);
323
356
  finalProps = [...nonPaddingProps, ...containerTokens];
@@ -16,6 +16,12 @@ export declare function getDaysInMonth(year: number, month: number): number;
16
16
  export declare function plainDateDayOfWeek(pd: PlainDate): number;
17
17
  export declare function plainDateAddMonths(pd: PlainDate, n: number): PlainDate;
18
18
  export declare function plainDateAddDays(pd: PlainDate, n: number): PlainDate;
19
+ /**
20
+ * Whole calendar days from `a` to `b`, ignoring time of day. Positive when
21
+ * `b` is after `a`, negative when before. Uses UTC midnight so DST shifts
22
+ * never add or drop a day.
23
+ */
24
+ export declare function plainDateDiffDays(a: PlainDate, b: PlainDate): number;
19
25
  /**
20
26
  * The wall-clock fields an instant reads as in a given zone.
21
27
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plainDate.d.ts","sourceRoot":"","sources":["../../src/utils/plainDate.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAE1D,YAAY,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAE3C,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,SAAS,CAcX;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,SAAS,CAG9D;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,SAAS,GAAG,aAAa,CAK3D;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,IAAI,CAEnD;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,CAMpD;AAED,wBAAgB,cAAc,IAAI,SAAS,CAE1C;AAED,wBAAgB,cAAc,CAAC,IAAI,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AE,IAAI,CAAC,qBAKjD,CAAC;AAGF,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,qBAInC,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,IAAI,CAAC,qBAGzC,CAAC;AAGF,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,qBAGpC,CAAC;AAGF,eAAO,MAAM,2BAA2B,EAAE,IAAI,CAAC,qBAI9C,CAAC;AAEF,wBAAgB,eAAe,CAC7B,EAAE,EAAE,SAAS,EACb,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAClC,MAAM,CAIR;AAMD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,gBAAgB,GAC1B,MAAM,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAC;AAExD;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAC7C,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,EACxC,IAAI,CAAC,qBAAqB,CAK3B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,gBAAgB,GACvB,MAAM,CAKR"}
@@ -77,6 +77,18 @@ export function plainDateAddDays(pd, n) {
77
77
  return plainDateFromDate(d);
78
78
  }
79
79
 
80
+ /**
81
+ * Whole calendar days from `a` to `b`, ignoring time of day. Positive when
82
+ * `b` is after `a`, negative when before. Uses UTC midnight so DST shifts
83
+ * never add or drop a day.
84
+ */
85
+ export function plainDateDiffDays(a, b) {
86
+ const msPerDay = 24 * 60 * 60 * 1000;
87
+ const aUTC = Date.UTC(a.year, a.month - 1, a.day);
88
+ const bUTC = Date.UTC(b.year, b.month - 1, b.day);
89
+ return Math.round((bUTC - aUTC) / msPerDay);
90
+ }
91
+
80
92
  /**
81
93
  * The wall-clock fields an instant reads as in a given zone.
82
94
  *