@kanso-labs/kanso-ui 0.45.22 → 0.45.24

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 (247) hide show
  1. package/dist/badge/index.js.map +1 -1
  2. package/dist/button/context.js.map +1 -1
  3. package/dist/button/group.js.map +1 -1
  4. package/dist/button/hooks.js.map +1 -1
  5. package/dist/button/index.d.ts +3 -4
  6. package/dist/button/index.js.map +1 -1
  7. package/dist/button/styles.js.map +1 -1
  8. package/dist/button/toggle.js.map +1 -1
  9. package/dist/calendar/index.js.map +1 -1
  10. package/dist/calendar/styles.js.map +1 -1
  11. package/dist/carousel/arrangement.d.ts +1 -2
  12. package/dist/carousel/arrangement.js.map +1 -1
  13. package/dist/chip/index.js.map +1 -1
  14. package/dist/chip/label.js.map +1 -1
  15. package/dist/chip/styles.js.map +1 -1
  16. package/dist/collection/empty.js.map +1 -1
  17. package/dist/collection/index.js.map +1 -1
  18. package/dist/collection/styles.js.map +1 -1
  19. package/dist/collection/text.js.map +1 -1
  20. package/dist/color-scheme.d.ts +1 -2
  21. package/dist/color-scheme.js.map +1 -1
  22. package/dist/components/app-bar/index.d.ts +1 -2
  23. package/dist/components/app-bar/index.js.map +1 -1
  24. package/dist/components/autocomplete/index.d.ts +1 -2
  25. package/dist/components/autocomplete/index.js.map +1 -1
  26. package/dist/components/avatar/index.d.ts +1 -2
  27. package/dist/components/avatar/index.js.map +1 -1
  28. package/dist/components/badge/index.d.ts +1 -2
  29. package/dist/components/badge/index.js.map +1 -1
  30. package/dist/components/breadcrumbs/index.d.ts +1 -2
  31. package/dist/components/breadcrumbs/index.js.map +1 -1
  32. package/dist/components/button/index.d.ts +1 -2
  33. package/dist/components/button/index.js.map +1 -1
  34. package/dist/components/button-group/index.d.ts +1 -2
  35. package/dist/components/button-group/index.js.map +1 -1
  36. package/dist/components/calendar/index.d.ts +1 -2
  37. package/dist/components/calendar/index.js.map +1 -1
  38. package/dist/components/card/index.d.ts +1 -2
  39. package/dist/components/card/index.js.map +1 -1
  40. package/dist/components/carousel/index.d.ts +1 -2
  41. package/dist/components/carousel/index.js.map +1 -1
  42. package/dist/components/checkbox/index.d.ts +1 -2
  43. package/dist/components/checkbox/index.js.map +1 -1
  44. package/dist/components/checkbox-group/index.d.ts +1 -2
  45. package/dist/components/checkbox-group/index.js.map +1 -1
  46. package/dist/components/chip/index.d.ts +1 -2
  47. package/dist/components/chip/index.js.map +1 -1
  48. package/dist/components/chip-group/index.d.ts +1 -2
  49. package/dist/components/chip-group/index.js.map +1 -1
  50. package/dist/components/code/index.d.ts +1 -2
  51. package/dist/components/code/index.js.map +1 -1
  52. package/dist/components/color-area/index.d.ts +1 -2
  53. package/dist/components/color-area/index.js.map +1 -1
  54. package/dist/components/color-field/index.d.ts +1 -2
  55. package/dist/components/color-field/index.js.map +1 -1
  56. package/dist/components/color-picker/index.d.ts +1 -2
  57. package/dist/components/color-picker/index.js.map +1 -1
  58. package/dist/components/color-slider/index.d.ts +1 -2
  59. package/dist/components/color-slider/index.js.map +1 -1
  60. package/dist/components/color-swatch/index.d.ts +1 -2
  61. package/dist/components/color-swatch/index.js.map +1 -1
  62. package/dist/components/color-swatch-picker/index.d.ts +1 -2
  63. package/dist/components/color-swatch-picker/index.js.map +1 -1
  64. package/dist/components/color-wheel/index.d.ts +1 -2
  65. package/dist/components/color-wheel/index.js.map +1 -1
  66. package/dist/components/combo-box/index.d.ts +1 -2
  67. package/dist/components/combo-box/index.js.map +1 -1
  68. package/dist/components/container/index.d.ts +1 -2
  69. package/dist/components/container/index.js.map +1 -1
  70. package/dist/components/copy-field/index.d.ts +1 -2
  71. package/dist/components/copy-field/index.js.map +1 -1
  72. package/dist/components/currency/index.d.ts +1 -2
  73. package/dist/components/currency/index.js.map +1 -1
  74. package/dist/components/date-field/index.d.ts +1 -2
  75. package/dist/components/date-field/index.js.map +1 -1
  76. package/dist/components/date-picker/index.d.ts +1 -2
  77. package/dist/components/date-picker/index.js.map +1 -1
  78. package/dist/components/date-range-picker/index.d.ts +1 -2
  79. package/dist/components/date-range-picker/index.js.map +1 -1
  80. package/dist/components/dialog/index.d.ts +1 -2
  81. package/dist/components/dialog/index.js.map +1 -1
  82. package/dist/components/disclosure/index.d.ts +1 -2
  83. package/dist/components/disclosure/index.js.map +1 -1
  84. package/dist/components/disclosure-group/index.d.ts +1 -2
  85. package/dist/components/disclosure-group/index.js.map +1 -1
  86. package/dist/components/drop-zone/index.d.ts +1 -2
  87. package/dist/components/drop-zone/index.js.map +1 -1
  88. package/dist/components/drop-zone/styles.js.map +1 -1
  89. package/dist/components/fab/index.d.ts +1 -2
  90. package/dist/components/fab/index.js.map +1 -1
  91. package/dist/components/fab-menu/index.d.ts +1 -2
  92. package/dist/components/fab-menu/index.js.map +1 -1
  93. package/dist/components/feed/index.d.ts +1 -2
  94. package/dist/components/feed/index.js.map +1 -1
  95. package/dist/components/form/index.d.ts +1 -2
  96. package/dist/components/form/index.js.map +1 -1
  97. package/dist/components/icon-button/index.d.ts +1 -2
  98. package/dist/components/icon-button/index.js.map +1 -1
  99. package/dist/components/keycap/index.d.ts +1 -2
  100. package/dist/components/keycap/index.js.map +1 -1
  101. package/dist/components/link/index.d.ts +1 -2
  102. package/dist/components/link/index.js.map +1 -1
  103. package/dist/components/list/index.d.ts +1 -2
  104. package/dist/components/list/index.js.map +1 -1
  105. package/dist/components/list-box/index.d.ts +1 -2
  106. package/dist/components/list-box/index.js.map +1 -1
  107. package/dist/components/list-detail/index.d.ts +1 -2
  108. package/dist/components/list-detail/index.js.map +1 -1
  109. package/dist/components/list-item/index.d.ts +1 -2
  110. package/dist/components/list-item/index.js.map +1 -1
  111. package/dist/components/loading-indicator/index.d.ts +1 -2
  112. package/dist/components/loading-indicator/index.js.map +1 -1
  113. package/dist/components/menu/index.d.ts +1 -2
  114. package/dist/components/menu/index.js.map +1 -1
  115. package/dist/components/meter/index.d.ts +1 -2
  116. package/dist/components/meter/index.js.map +1 -1
  117. package/dist/components/navigation-bar/index.d.ts +1 -2
  118. package/dist/components/navigation-bar/index.js.map +1 -1
  119. package/dist/components/navigation-rail/index.d.ts +1 -2
  120. package/dist/components/navigation-rail/index.js.map +1 -1
  121. package/dist/components/navigation-tree/index.d.ts +1 -2
  122. package/dist/components/navigation-tree/index.js.map +1 -1
  123. package/dist/components/number-field/index.d.ts +1 -2
  124. package/dist/components/number-field/index.js.map +1 -1
  125. package/dist/components/popover/index.d.ts +1 -2
  126. package/dist/components/popover/index.js.map +1 -1
  127. package/dist/components/product-icon/index.d.ts +1 -2
  128. package/dist/components/product-icon/index.js.map +1 -1
  129. package/dist/components/progress-indicator/index.d.ts +1 -2
  130. package/dist/components/progress-indicator/index.js.map +1 -1
  131. package/dist/components/radio-group/index.d.ts +1 -2
  132. package/dist/components/radio-group/index.js.map +1 -1
  133. package/dist/components/range-calendar/index.d.ts +1 -2
  134. package/dist/components/range-calendar/index.js.map +1 -1
  135. package/dist/components/search-field/index.d.ts +1 -2
  136. package/dist/components/search-field/index.js.map +1 -1
  137. package/dist/components/search-view/index.d.ts +1 -2
  138. package/dist/components/search-view/index.js.map +1 -1
  139. package/dist/components/segmented-button/index.d.ts +1 -2
  140. package/dist/components/segmented-button/index.js.map +1 -1
  141. package/dist/components/select/index.d.ts +1 -2
  142. package/dist/components/select/index.js.map +1 -1
  143. package/dist/components/separator/index.d.ts +1 -2
  144. package/dist/components/separator/index.js.map +1 -1
  145. package/dist/components/sheet/index.d.ts +1 -2
  146. package/dist/components/sheet/index.js.map +1 -1
  147. package/dist/components/slider/index.d.ts +1 -2
  148. package/dist/components/slider/index.js.map +1 -1
  149. package/dist/components/snackbar/index.d.ts +1 -2
  150. package/dist/components/snackbar/index.js.map +1 -1
  151. package/dist/components/split-button/index.d.ts +1 -2
  152. package/dist/components/split-button/index.js.map +1 -1
  153. package/dist/components/stack/index.d.ts +1 -2
  154. package/dist/components/stack/index.js.map +1 -1
  155. package/dist/components/supporting-pane/index.d.ts +1 -2
  156. package/dist/components/supporting-pane/index.js.map +1 -1
  157. package/dist/components/switch/index.d.ts +1 -2
  158. package/dist/components/switch/index.js.map +1 -1
  159. package/dist/components/table/index.d.ts +1 -2
  160. package/dist/components/table/index.js.map +1 -1
  161. package/dist/components/tabs/index.d.ts +1 -2
  162. package/dist/components/tabs/index.js.map +1 -1
  163. package/dist/components/tag/index.d.ts +1 -2
  164. package/dist/components/tag/index.js.map +1 -1
  165. package/dist/components/text/index.d.ts +1 -2
  166. package/dist/components/text/index.js.map +1 -1
  167. package/dist/components/text-area/index.d.ts +1 -2
  168. package/dist/components/text-area/index.js.map +1 -1
  169. package/dist/components/text-field/index.d.ts +1 -2
  170. package/dist/components/text-field/index.js.map +1 -1
  171. package/dist/components/time-field/index.d.ts +1 -2
  172. package/dist/components/time-field/index.js.map +1 -1
  173. package/dist/components/time-picker/index.d.ts +1 -2
  174. package/dist/components/time-picker/index.js.map +1 -1
  175. package/dist/components/token-field/index.d.ts +1 -2
  176. package/dist/components/token-field/index.js.map +1 -1
  177. package/dist/components/toolbar/index.d.ts +1 -2
  178. package/dist/components/toolbar/index.js.map +1 -1
  179. package/dist/components/tooltip/index.d.ts +1 -2
  180. package/dist/components/tooltip/index.js.map +1 -1
  181. package/dist/components/tree/index.d.ts +1 -2
  182. package/dist/components/tree/index.js.map +1 -1
  183. package/dist/control/index.js.map +1 -1
  184. package/dist/control/styles.js.map +1 -1
  185. package/dist/drag/hooks.d.ts +1 -2
  186. package/dist/drag/hooks.js.map +1 -1
  187. package/dist/drag/index.js.map +1 -1
  188. package/dist/drag/styles.js.map +1 -1
  189. package/dist/fab/styles.js.map +1 -1
  190. package/dist/field/index.d.ts +3 -4
  191. package/dist/field/index.js.map +1 -1
  192. package/dist/field/press.js.map +1 -1
  193. package/dist/field/root.js.map +1 -1
  194. package/dist/field/styles.js.map +1 -1
  195. package/dist/glyphs/index.js.map +1 -1
  196. package/dist/glyphs/styles.js.map +1 -1
  197. package/dist/hooks/useAppBarScroll.d.ts +1 -2
  198. package/dist/hooks/useAppBarScroll.js.map +1 -1
  199. package/dist/hooks/useBottomEdge.js.map +1 -1
  200. package/dist/hooks/useClippedTitle.js.map +1 -1
  201. package/dist/hooks/useImageLoadingStatus.js.map +1 -1
  202. package/dist/hooks/useRipple.js.map +1 -1
  203. package/dist/hooks/useScrollStop.js.map +1 -1
  204. package/dist/hooks/useToggleGroupDisabled.js.map +1 -1
  205. package/dist/i18n/index.js.map +1 -1
  206. package/dist/i18n/messages.js.map +1 -1
  207. package/dist/indicator/index.js.map +1 -1
  208. package/dist/indicator/styles.d.ts +1 -2
  209. package/dist/indicator/styles.js.map +1 -1
  210. package/dist/kanso-ui-core/defaults-DMH0HWCw.d.ts +1 -2
  211. package/dist/keycap/context.js.map +1 -1
  212. package/dist/layout.d.ts +1 -2
  213. package/dist/layout.js.map +1 -1
  214. package/dist/mark/index.js.map +1 -1
  215. package/dist/mark/initials.js.map +1 -1
  216. package/dist/mark/styles.js.map +1 -1
  217. package/dist/navigation/context.js.map +1 -1
  218. package/dist/navigation/index.d.ts +2 -3
  219. package/dist/navigation/index.js.map +1 -1
  220. package/dist/navigation/styles.js.map +1 -1
  221. package/dist/overlay/index.js.map +1 -1
  222. package/dist/render/aria.js.map +1 -1
  223. package/dist/render/content.js.map +1 -1
  224. package/dist/render/name.d.ts +1 -2
  225. package/dist/render/ref.js.map +1 -1
  226. package/dist/render/useRender.d.ts +1 -2
  227. package/dist/render/useRender.js.map +1 -1
  228. package/dist/row/index.js.map +1 -1
  229. package/dist/row/styles.js.map +1 -1
  230. package/dist/segments/index.js.map +1 -1
  231. package/dist/segments/styles.js.map +1 -1
  232. package/dist/styles/chequer.js.map +1 -1
  233. package/dist/styles/color.js.map +1 -1
  234. package/dist/styles/focus.js.map +1 -1
  235. package/dist/styles/icon-button.js.map +1 -1
  236. package/dist/styles/merge.js.map +1 -1
  237. package/dist/styles/overlay.d.ts +2 -3
  238. package/dist/styles/overlay.js.map +1 -1
  239. package/dist/styles/picker.js.map +1 -1
  240. package/dist/styles/ripple.js.map +1 -1
  241. package/dist/styles/scheme.js.map +1 -1
  242. package/dist/swatch/index.js.map +1 -1
  243. package/dist/theme-scope.d.ts +1 -2
  244. package/dist/theme-scope.js.map +1 -1
  245. package/dist/tokens/design.tokens.stylex.js.map +1 -1
  246. package/dist/tokens/values.js.map +1 -1
  247. package/package.json +15 -15
@@ -69,5 +69,4 @@ type CopyFieldProps = {
69
69
  * the value selects exactly the value too.
70
70
  */
71
71
  declare function CopyField({ copiedLabel: copiedLabelProp, copyLabel: copyLabelProp, label, onCopied, onCopyFailed, selectedLabel: selectedLabelProp, value, ...props }: CopyFieldProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
72
- export { type CopyFieldProps, CopyField as default };
73
- //# sourceMappingURL=index.d.ts.map
72
+ export { type CopyFieldProps, CopyField as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","RefAttributes","stylex","useCallback","useEffect","useId","useRef","useState","useMessages","mergeStyles","colors","radii","spacing","typography","Button","COPIED_RESET_MS","CopyFieldProps","copiedLabel","copyLabel","label","onCopied","value","onCopyFailed","error","selectedLabel","Omit","HTMLDivElement","CopyField","t0","$","copiedLabelProp","copyLabelProp","selectedLabelProp","props","messages","copied","copy","copySelected","setCopy","shown","text","kind","timer","undefined","code","generatedId","rootId","id","copyId","copiedId","named","role","buttonName","t1","t2","Symbol","for","clearTimeout","current","t3","settle","setTimeout","count","write","navigator","clipboard","writeText","t4","selectAndCopy","reportCopied","handleCopy","className","t5","t6","t7","0","1","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","thrown","queueMicrotask","element","HTMLElement","selection","window","getSelection","range","document","createRange","selectNodeContents","removeAllRanges","addRange","execCommand","_c"],"sources":["../../../src/components/copy-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { useMessages } from '../../i18n';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Button from '../button';\n\n// How long the confirmation stands before the control returns to offering the\n// copy again. Not a motion token: those are transition durations, measured in\n// hundreds of milliseconds, and this is a dwell — long enough to be read\n// without being long enough to leave the button lying about what it will do.\nconst COPIED_RESET_MS = 2000;\n\n// No Material Design page draws a read-only value with a copy control. It\n// follows the outlined text field: the 1dp rule in the outline role, the\n// surface behind it, and the control at its trailing end. The value is\n// body-small beside a 32dp text button with 8dp above and below it, so the\n// box is 50dp against the field's 56, which suits a value that is read\n// rather than edited, and its corner is the shape scale's small step for the\n// same reason.\n//\n// The 8dp is what holds the button's focus ring, which reaches 4dp out from\n// it, clear of the rule, and the trailing end gives the button the same 8dp\n// rather than the 12dp the value starts in by. The button brings 12dp of its\n// own around its label, so the label ends 20dp in where the two paddings\n// added up to 24.\n\ntype CopyFieldProps = {\n /**\n * What the button says once the value has been copied, and what is\n * announced. It reverts to `copyLabel` on its own after a couple of\n * seconds. Left out, it is the word for it in the I18nProvider's locale —\n * \"Copied\" in English.\n */\n copiedLabel?: string;\n /**\n * What the button says at rest. Left out, it is the word for it in the\n * I18nProvider's locale — \"Copy\" in English.\n */\n copyLabel?: string;\n /**\n * What the value is — \"Repository URL\", \"Access token\" — for a page with\n * more than one field. It names the field as a group and joins the button's\n * name, so a screen reader hears \"Copy Repository URL\" rather than one\n * \"Copy\" after another; it is not shown. The value itself stays out of the\n * button's name, since a token would be read aloud. Left out, the field is\n * unnamed and its button is \"Copy\" alone, as it always was.\n */\n label?: string;\n /**\n * Called with the value after it reaches the clipboard, never before.\n *\n * Named `onCopied` rather than `onCopy` because the root is a `<div>`, which\n * already has an `onCopy` of its own — React's handler for the native copy\n * event, fired when the reader presses the copy shortcut inside the element.\n * The two are different moments, and a prop that quietly shadowed the\n * built-in would be a trap rather than a convenience.\n */\n onCopied?: (value: string) => void;\n /**\n * Called when the write is refused, with whatever was thrown, and the\n * field's own fallback has not copied the value either. By then the value\n * is selected and the field says so — see `selectedLabel` — so this is for\n * an app that wants to say more, in a snackbar say.\n *\n * Takes the error where `onCopied` takes the value, because the value is\n * the one thing the call site already has and the reason is the one thing\n * it does not. The two refusals throw differently: outside a secure\n * context `navigator.clipboard` is not there at all, and where the\n * permission is denied it is a `DOMException`.\n */\n onCopyFailed?: (error: unknown) => void;\n /**\n * What is announced when the clipboard refused the write and the value has\n * been selected for the reader to copy themselves. The button keeps saying\n * `copyLabel`, since a label slot wide enough for this would double the\n * button's width at rest; the selection itself is what shows. Left out, it\n * is the phrase for it in the I18nProvider's locale — \"Selected to copy\"\n * in English.\n */\n selectedLabel?: string;\n /** The text shown, and the text copied. */\n value: string;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\n/**\n * A value to be read and taken away — a repository URL, a token, a command.\n * It shows the value in the mono face and copies it on request, confirming\n * on the button itself.\n *\n * A write refused — outside a secure context, or where the permission is\n * denied — does not leave the reader with nothing. The field selects the\n * value and tries the older copy command, which some of those places still\n * allow; failing that, the selection is left ready for the keyboard's own\n * copy, the field announces so, and `onCopyFailed` is called. One click on\n * the value selects exactly the value too.\n */\nfunction CopyField({\n copiedLabel: copiedLabelProp,\n copyLabel: copyLabelProp,\n label,\n onCopied,\n onCopyFailed,\n selectedLabel: selectedLabelProp,\n value,\n ...props\n}: CopyFieldProps & RefAttributes<HTMLDivElement>) {\n const messages = useMessages();\n const copiedLabel = copiedLabelProp ?? messages.copied;\n const copyLabel = copyLabelProp ?? messages.copy;\n const selectedLabel = selectedLabelProp ?? messages.copySelected;\n // What the last write put on the clipboard, and how many writes there have\n // been. The confirmation is that text still being the value shown, so a\n // value that changes inside the dwell — a token regenerated, a selection\n // swapped — takes the label back to Copy at once rather than confirming a\n // copy of something else. The count is what lets a second press be\n // announced, below. `kind` is whether the text reached the clipboard or\n // was only selected for the reader to copy, after a refusal.\n const [copy, setCopy] = useState<null | {\n count: number;\n kind: 'copied' | 'selected';\n text: string;\n }>(null);\n const shown: 'copied' | 'copy' | 'selected' = copy?.text === value ? copy.kind : 'copy';\n const copied = shown === 'copied';\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const code = useRef<HTMLElement>(null);\n const generatedId = useId();\n const rootId = props.id ?? generatedId;\n const copyId = useId();\n const copiedId = useId();\n\n // With a label, the field is a group it names, and the button is named by\n // the label slot on show and then by the group: \"Copy Repository URL\",\n // then \"Copied Repository URL\". The slot on show rather than both, since\n // the two swap `aria-hidden` and a name taking both would say both.\n const named = label === undefined ? undefined : {\n 'aria-label': label,\n id: rootId,\n role: 'group'\n };\n const buttonName = label === undefined ? undefined : `${copied ? copiedId : copyId} ${rootId}`;\n\n // Without this, a field unmounted inside the dwell leaves a timer holding a\n // setState for a tree that is gone.\n useEffect(() => () => {\n clearTimeout(timer.current);\n }, []);\n const handleCopy = useCallback(() => {\n // The component's own state first, the dwell included, and the call\n // site's handler after it: a handler that threw used to skip the timer,\n // leaving the button on Copied for good. Its error is still the call\n // site's to see, raised on its own rather than swallowed.\n const settle = (kind: 'copied' | 'selected') => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setCopy(null);\n }, COPIED_RESET_MS);\n setCopy(current => ({\n count: (current?.count ?? 0) + 1,\n kind,\n text: value\n }));\n };\n const write = async () => {\n try {\n await navigator.clipboard.writeText(value);\n } catch (error) {\n // A clipboard write is refused outside a secure context and wherever\n // the permission is denied, neither of which the call site can fix,\n // and a button that did nothing there left the reader with nothing.\n // So the value is selected, which is what the keyboard's own copy\n // acts on, and the older copy command is tried on that selection,\n // since some of those places still allow it. Only where that fails\n // too does the field announce that the value is selected — not that\n // it is copied, which it is not — and report the refusal.\n //\n // Nothing is logged — the library writes to the console nowhere, and\n // a warning an app cannot turn off is not its to emit.\n if (selectAndCopy(code.current)) {\n settle('copied');\n reportCopied(onCopied, value);\n return;\n }\n settle('selected');\n onCopyFailed?.(error);\n return;\n }\n settle('copied');\n reportCopied(onCopied, value);\n };\n void write();\n }, [onCopied, onCopyFailed, value]);\n return <div {...props} {...named} {...mergeStyles({\n className: \"x6s0dn4 x14s9m32 x1fwvt7v x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x78zum5 x126z3so x1cmllll xq7elwu xwde665\"\n }, props)}>\n <span className=\"x139gbkf x1iyjqo2 x1b35g6e xdb2kus x9d6959 xwth0xh xybisxh xeuugli x6mezaz xvrbanz x126k92a\">\n <code dir=\"ltr\" ref={code} className=\"x9f619 xbppi91 x1qlqyl8 xj0a0fe x4ej8vm\">\n {value}\n </code>\n </span>\n <Button aria-labelledby={buttonName} onClick={handleCopy} size=\"xs\" variant=\"text\" className=\"x2lah0s\">\n <span className=\"xrvj5dj x1o2pa38\">\n <span aria-hidden={copied || undefined} id={copyId} {...{\n 0: {\n className: \"x15r89dc\"\n },\n 1: {\n className: \"x15r89dc xlshs6z\"\n }\n }[!!copied << 0]}>\n {copyLabel}\n </span>\n <span aria-hidden={!copied || undefined} id={copiedId} {...{\n 0: {\n className: \"x15r89dc\"\n },\n 1: {\n className: \"x15r89dc xlshs6z\"\n }\n }[!!!copied << 0]}>\n {copiedLabel}\n </span>\n </span>\n </Button>\n {/* The button's own label changes, but a label changing under a screen\n reader is not reliably announced. This is. `<output>` carries an\n implicit role of status, so it needs no role attribute of its own.\n Each write puts a new node in it, keyed by the count, since a second\n press inside the dwell otherwise left the text as it was and the\n region had nothing to announce. */}\n <output className=\"xjm9jq1 x1hyvwdk x1i1rx1s xb3r6kr x10l6tqk xuxw1ft\">\n {copy !== null && shown !== 'copy' ? <span key={copy.count}>\n {shown === 'copied' ? copiedLabel : selectedLabel}\n </span> : null}\n </output>\n </div>;\n}\n\n/**\n * Hands the call site the value it copied. What its handler throws is raised\n * on its own, outside the copy: it still reaches the page's error reporting,\n * where a rejection of the copy's own promise reached nothing but an\n * unhandled-rejection warning. Outside the component, since the React\n * Compiler compiles neither optional chaining nor a captured catch binding\n * inside a `try`.\n */\nfunction reportCopied(onCopied: ((value: string) => void) | undefined, value: string) {\n if (onCopied === undefined) {\n return;\n }\n try {\n onCopied(value);\n } catch (thrown) {\n queueMicrotask(() => {\n throw thrown;\n });\n }\n}\n\n/**\n * Selects the value's text, which is what the keyboard's own copy acts on,\n * and tries the older copy command on that selection, saying whether it\n * copied. The command is deprecated, and still the one way to the clipboard\n * on an insecure origin, which is where the newer one is refused.\n */\nfunction selectAndCopy(element: HTMLElement | null) {\n const selection = window.getSelection();\n if (element === null || selection === null) {\n return false;\n }\n const range = document.createRange();\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n try {\n // oxlint-disable-next-line typescript/no-deprecated -- the one fallback an insecure origin still allows\n return document.execCommand('copy');\n } catch {\n return false;\n }\n}\nexport type { CopyFieldProps };\nexport default CopyField;"],"mappings":";;;;;;;;AAeA,MAAMiB,kBAAkB;;;;;;;;;;;;;AAsFxB,SAAAY,UAAAC,IAAA;CAAA,MAAAC,IAAA9B,EAAA,EAAA;CAAmB,MAAA,EAAAkB,aAAAa,iBAAAZ,WAAAa,eAAAZ,OAAAC,UAAAE,cAAAE,eAAAQ,mBAAAX,OAAA,GAAAY,UAAAL;CAUjB,MAAAM,WAAiB1B,YAAY;CAC7B,MAAAS,cAAoBa,mBAAmBI,SAAQC;CAC/C,MAAAjB,YAAkBa,iBAAiBG,SAAQE;CAC3C,MAAAZ,gBAAsBQ,qBAAqBE,SAAQG;CAQnD,MAAA,CAAAD,MAAAE,WAAwB/B,SAIrB,IAAI;CACP,MAAAgC,QAA8CH,MAAII,SAAWnB,QAAQe,KAAIK,OAA3B;CAC9C,MAAAN,SAAeI,UAAU;CACzB,MAAAG,QAAcpC,OAAkDqC,KAAAA,CAAS;CACzE,MAAAC,OAAatC,OAAoB,IAAI;CACrC,MAAAuC,cAAoBxC,MAAM;CAC1B,MAAAyC,SAAeb,MAAKc,MAALF;CACf,MAAAG,SAAe3C,MAAM;CACrB,MAAA4C,WAAiB5C,MAAM;CAMvB,MA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AAgB;CAC1BP,UAAUQ,SAASL,KAAK;CACxB,IAAI;EAEF,OAAOC,SAASK,YAAY,MAAM;CACpC,QAAQ;EACN,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"index.js","names":["_c","useEffect","useId","useRef","useState","useMessages","mergeStyles","COPIED_RESET_MS","copiedLabel","copyLabel","label","onCopied","value","onCopyFailed","error","selectedLabel","CopyField","t0","$","copiedLabelProp","copyLabelProp","selectedLabelProp","props","messages","copied","copy","copySelected","setCopy","shown","text","kind","timer","undefined","code","generatedId","rootId","id","copyId","copiedId","named","role","buttonName","t1","t2","Symbol","for","clearTimeout","current","t3","settle","setTimeout","count","write","navigator","clipboard","writeText","t4","selectAndCopy","reportCopied","handleCopy","className","t5","t6","t7","0","1","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","thrown","queueMicrotask","element","selection","window","getSelection","range","document","createRange","selectNodeContents","removeAllRanges","addRange","execCommand"],"sources":["../../../src/components/copy-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useCallback, useEffect, useId, useRef, useState } from 'react';\nimport { useMessages } from '../../i18n';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, typography } from '../../tokens/design.tokens.stylex';\nimport Button from '../button';\n\n// How long the confirmation stands before the control returns to offering the\n// copy again. Not a motion token: those are transition durations, measured in\n// hundreds of milliseconds, and this is a dwell — long enough to be read\n// without being long enough to leave the button lying about what it will do.\nconst COPIED_RESET_MS = 2000;\n\n// No Material Design page draws a read-only value with a copy control. It\n// follows the outlined text field: the 1dp rule in the outline role, the\n// surface behind it, and the control at its trailing end. The value is\n// body-small beside a 32dp text button with 8dp above and below it, so the\n// box is 50dp against the field's 56, which suits a value that is read\n// rather than edited, and its corner is the shape scale's small step for the\n// same reason.\n//\n// The 8dp is what holds the button's focus ring, which reaches 4dp out from\n// it, clear of the rule, and the trailing end gives the button the same 8dp\n// rather than the 12dp the value starts in by. The button brings 12dp of its\n// own around its label, so the label ends 20dp in where the two paddings\n// added up to 24.\n\ntype CopyFieldProps = {\n /**\n * What the button says once the value has been copied, and what is\n * announced. It reverts to `copyLabel` on its own after a couple of\n * seconds. Left out, it is the word for it in the I18nProvider's locale —\n * \"Copied\" in English.\n */\n copiedLabel?: string;\n /**\n * What the button says at rest. Left out, it is the word for it in the\n * I18nProvider's locale — \"Copy\" in English.\n */\n copyLabel?: string;\n /**\n * What the value is — \"Repository URL\", \"Access token\" — for a page with\n * more than one field. It names the field as a group and joins the button's\n * name, so a screen reader hears \"Copy Repository URL\" rather than one\n * \"Copy\" after another; it is not shown. The value itself stays out of the\n * button's name, since a token would be read aloud. Left out, the field is\n * unnamed and its button is \"Copy\" alone, as it always was.\n */\n label?: string;\n /**\n * Called with the value after it reaches the clipboard, never before.\n *\n * Named `onCopied` rather than `onCopy` because the root is a `<div>`, which\n * already has an `onCopy` of its own — React's handler for the native copy\n * event, fired when the reader presses the copy shortcut inside the element.\n * The two are different moments, and a prop that quietly shadowed the\n * built-in would be a trap rather than a convenience.\n */\n onCopied?: (value: string) => void;\n /**\n * Called when the write is refused, with whatever was thrown, and the\n * field's own fallback has not copied the value either. By then the value\n * is selected and the field says so — see `selectedLabel` — so this is for\n * an app that wants to say more, in a snackbar say.\n *\n * Takes the error where `onCopied` takes the value, because the value is\n * the one thing the call site already has and the reason is the one thing\n * it does not. The two refusals throw differently: outside a secure\n * context `navigator.clipboard` is not there at all, and where the\n * permission is denied it is a `DOMException`.\n */\n onCopyFailed?: (error: unknown) => void;\n /**\n * What is announced when the clipboard refused the write and the value has\n * been selected for the reader to copy themselves. The button keeps saying\n * `copyLabel`, since a label slot wide enough for this would double the\n * button's width at rest; the selection itself is what shows. Left out, it\n * is the phrase for it in the I18nProvider's locale — \"Selected to copy\"\n * in English.\n */\n selectedLabel?: string;\n /** The text shown, and the text copied. */\n value: string;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;\n\n/**\n * A value to be read and taken away — a repository URL, a token, a command.\n * It shows the value in the mono face and copies it on request, confirming\n * on the button itself.\n *\n * A write refused — outside a secure context, or where the permission is\n * denied — does not leave the reader with nothing. The field selects the\n * value and tries the older copy command, which some of those places still\n * allow; failing that, the selection is left ready for the keyboard's own\n * copy, the field announces so, and `onCopyFailed` is called. One click on\n * the value selects exactly the value too.\n */\nfunction CopyField({\n copiedLabel: copiedLabelProp,\n copyLabel: copyLabelProp,\n label,\n onCopied,\n onCopyFailed,\n selectedLabel: selectedLabelProp,\n value,\n ...props\n}: CopyFieldProps & RefAttributes<HTMLDivElement>) {\n const messages = useMessages();\n const copiedLabel = copiedLabelProp ?? messages.copied;\n const copyLabel = copyLabelProp ?? messages.copy;\n const selectedLabel = selectedLabelProp ?? messages.copySelected;\n // What the last write put on the clipboard, and how many writes there have\n // been. The confirmation is that text still being the value shown, so a\n // value that changes inside the dwell — a token regenerated, a selection\n // swapped — takes the label back to Copy at once rather than confirming a\n // copy of something else. The count is what lets a second press be\n // announced, below. `kind` is whether the text reached the clipboard or\n // was only selected for the reader to copy, after a refusal.\n const [copy, setCopy] = useState<null | {\n count: number;\n kind: 'copied' | 'selected';\n text: string;\n }>(null);\n const shown: 'copied' | 'copy' | 'selected' = copy?.text === value ? copy.kind : 'copy';\n const copied = shown === 'copied';\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const code = useRef<HTMLElement>(null);\n const generatedId = useId();\n const rootId = props.id ?? generatedId;\n const copyId = useId();\n const copiedId = useId();\n\n // With a label, the field is a group it names, and the button is named by\n // the label slot on show and then by the group: \"Copy Repository URL\",\n // then \"Copied Repository URL\". The slot on show rather than both, since\n // the two swap `aria-hidden` and a name taking both would say both.\n const named = label === undefined ? undefined : {\n 'aria-label': label,\n id: rootId,\n role: 'group'\n };\n const buttonName = label === undefined ? undefined : `${copied ? copiedId : copyId} ${rootId}`;\n\n // Without this, a field unmounted inside the dwell leaves a timer holding a\n // setState for a tree that is gone.\n useEffect(() => () => {\n clearTimeout(timer.current);\n }, []);\n const handleCopy = useCallback(() => {\n // The component's own state first, the dwell included, and the call\n // site's handler after it: a handler that threw used to skip the timer,\n // leaving the button on Copied for good. Its error is still the call\n // site's to see, raised on its own rather than swallowed.\n const settle = (kind: 'copied' | 'selected') => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n setCopy(null);\n }, COPIED_RESET_MS);\n setCopy(current => ({\n count: (current?.count ?? 0) + 1,\n kind,\n text: value\n }));\n };\n const write = async () => {\n try {\n await navigator.clipboard.writeText(value);\n } catch (error) {\n // A clipboard write is refused outside a secure context and wherever\n // the permission is denied, neither of which the call site can fix,\n // and a button that did nothing there left the reader with nothing.\n // So the value is selected, which is what the keyboard's own copy\n // acts on, and the older copy command is tried on that selection,\n // since some of those places still allow it. Only where that fails\n // too does the field announce that the value is selected — not that\n // it is copied, which it is not — and report the refusal.\n //\n // Nothing is logged — the library writes to the console nowhere, and\n // a warning an app cannot turn off is not its to emit.\n if (selectAndCopy(code.current)) {\n settle('copied');\n reportCopied(onCopied, value);\n return;\n }\n settle('selected');\n onCopyFailed?.(error);\n return;\n }\n settle('copied');\n reportCopied(onCopied, value);\n };\n void write();\n }, [onCopied, onCopyFailed, value]);\n return <div {...props} {...named} {...mergeStyles({\n className: \"x6s0dn4 x14s9m32 x1fwvt7v x1xdvaa9 x1y0btm7 xmkeg23 x9f619 x78zum5 x126z3so x1cmllll xq7elwu xwde665\"\n }, props)}>\n <span className=\"x139gbkf x1iyjqo2 x1b35g6e xdb2kus x9d6959 xwth0xh xybisxh xeuugli x6mezaz xvrbanz x126k92a\">\n <code dir=\"ltr\" ref={code} className=\"x9f619 xbppi91 x1qlqyl8 xj0a0fe x4ej8vm\">\n {value}\n </code>\n </span>\n <Button aria-labelledby={buttonName} onClick={handleCopy} size=\"xs\" variant=\"text\" className=\"x2lah0s\">\n <span className=\"xrvj5dj x1o2pa38\">\n <span aria-hidden={copied || undefined} id={copyId} {...{\n 0: {\n className: \"x15r89dc\"\n },\n 1: {\n className: \"x15r89dc xlshs6z\"\n }\n }[!!copied << 0]}>\n {copyLabel}\n </span>\n <span aria-hidden={!copied || undefined} id={copiedId} {...{\n 0: {\n className: \"x15r89dc\"\n },\n 1: {\n className: \"x15r89dc xlshs6z\"\n }\n }[!!!copied << 0]}>\n {copiedLabel}\n </span>\n </span>\n </Button>\n {/* The button's own label changes, but a label changing under a screen\n reader is not reliably announced. This is. `<output>` carries an\n implicit role of status, so it needs no role attribute of its own.\n Each write puts a new node in it, keyed by the count, since a second\n press inside the dwell otherwise left the text as it was and the\n region had nothing to announce. */}\n <output className=\"xjm9jq1 x1hyvwdk x1i1rx1s xb3r6kr x10l6tqk xuxw1ft\">\n {copy !== null && shown !== 'copy' ? <span key={copy.count}>\n {shown === 'copied' ? copiedLabel : selectedLabel}\n </span> : null}\n </output>\n </div>;\n}\n\n/**\n * Hands the call site the value it copied. What its handler throws is raised\n * on its own, outside the copy: it still reaches the page's error reporting,\n * where a rejection of the copy's own promise reached nothing but an\n * unhandled-rejection warning. Outside the component, since the React\n * Compiler compiles neither optional chaining nor a captured catch binding\n * inside a `try`.\n */\nfunction reportCopied(onCopied: ((value: string) => void) | undefined, value: string) {\n if (onCopied === undefined) {\n return;\n }\n try {\n onCopied(value);\n } catch (thrown) {\n queueMicrotask(() => {\n throw thrown;\n });\n }\n}\n\n/**\n * Selects the value's text, which is what the keyboard's own copy acts on,\n * and tries the older copy command on that selection, saying whether it\n * copied. The command is deprecated, and still the one way to the clipboard\n * on an insecure origin, which is where the newer one is refused.\n */\nfunction selectAndCopy(element: HTMLElement | null) {\n const selection = window.getSelection();\n if (element === null || selection === null) {\n return false;\n }\n const range = document.createRange();\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n try {\n // oxlint-disable-next-line typescript/no-deprecated -- the one fallback an insecure origin still allows\n return document.execCommand('copy');\n } catch {\n return false;\n }\n}\nexport type { CopyFieldProps };\nexport default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C,MAAAtC,EAAA,QAAA2C,IAAA;EA1CNe,MAAA,qBAAA,OAAA;GA2CC,GA3CQtD;GAAK,GAAMiB;GAAK,GAAMiB;GAA/B,UAAA;IAGHK;IAKAY;IA8BAE;GAKI;;EAAAzD,EAAA,MAAAqB;EAAArB,EAAA,MAAAI;EAAAJ,EAAA,MAAAuD;EAAAvD,EAAA,MAAAyD;EAAAzD,EAAA,MAAAsC;EAAAtC,EAAA,MAAA2C;EAAA3C,EAAA,MAAA0D;CAAA,OAAAA,MAAA1D,EAAA;CAAA,OA3CD0D;AA2CC;;;;;;;;;AAWV,SAASlB,aAAa/C,UAAiDC,OAAe;CACpF,IAAID,aAAaqB,KAAAA,GACf;CAEF,IAAI;EACFrB,SAASC,KAAK;CAChB,SAASiE,QAAQ;EACfC,qBAAqB;GACnB,MAAMD;EACR,CAAC;CACH;AACF;;;;;;;AAQA,SAASpB,cAAcsB,SAA6B;CAClD,MAAMC,YAAYC,OAAOC,aAAa;CACtC,IAAIH,YAAY,QAAQC,cAAc,MACpC,OAAO;CAET,MAAMG,QAAQC,SAASC,YAAY;CACnCF,MAAMG,mBAAmBP,OAAO;CAChCC,UAAUO,gBAAgB;CAC1BP,UAAUQ,SAASL,KAAK;CACxB,IAAI;EAEF,OAAOC,SAASK,YAAY,MAAM;CACpC,QAAQ;EACN,OAAO;CACT;AACF"}
@@ -115,5 +115,4 @@ type CurrencyTone = 'auto' | 'inherit' | 'negative' | 'neutral' | 'positive';
115
115
  * amount.
116
116
  */
117
117
  declare function Currency({ currency, currencyDisplay, locale, maximumFractionDigits, minimumFractionDigits, notation, render, sign, tone, value, ...props }: CurrencyProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
118
- export { type CurrencyDisplay, type CurrencyNotation, type CurrencyProps, type CurrencySignDisplay, type CurrencyTone, Currency as default };
119
- //# sourceMappingURL=index.d.ts.map
118
+ export { type CurrencyDisplay, type CurrencyNotation, type CurrencyProps, type CurrencySignDisplay, type CurrencyTone, Currency as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","stylex","isRTL","useLocale","RenderComponentProps","useRender","mergeStyles","colors","typography","styles","base","kB7OPa","kMv6JI","kcqcaj","k63SB2","k9WMMc","kQ0QjF","$$css","tones","inherit","kMwMTN","negative","neutral","positive","MINUS_SIGN","CurrencyDisplay","CurrencyNotation","CurrencyProps","Omit","currency","currencyDisplay","locale","maximumFractionDigits","minimumFractionDigits","notation","sign","CurrencySignDisplay","tone","CurrencyTone","value","Currency","t0","$","t1","render","t2","t3","props","undefined","provided","amount","formatCurrency","fallbackLocale","t4","t5","text","t6","dir","direction","t7","lang","t8","resolveTone","shownAsZero","t9","children","t10","defaultTagName","formatters","Map","ResolvedFormat","code","formatter","Intl","NumberFormat","options","FormatOptions","formatterFor","parts","formatToParts","map","part","type","join","every","test","SIGN_DISPLAY","always","auto","never","const","Record","NumberFormatOptions","TWO_PLACES","key","JSON","stringify","String","cached","get","usable","find","isLocale","written","signDisplay","digits","asCurrency","style","attempts","attempt","formatterOrNull","resolved","set","tag","supportedLocalesOf","length","_c","props","stylex.props"],"sources":["../../../src/components/currency/index.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { isRTL } from 'react-aria';\nimport { useLocale } from 'react-aria-components';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// Deliberately sets no font-size. The same value turns up at several sizes —\n// inside a list row, as a heading-scale figure, as a total — differing in\n// nothing else, so the size is the container's decision. What must never vary\n// is here: the mono face, tabular figures so a column of them lines up on the\n// decimal point, and the medium weight that separates a figure from the prose\n// around it.\n//\n// No Material Design page draws an amount. It is type alone: the mono face\n// and medium weight from the type tokens, tabular figures, and the on surface\n// role for the neutral tone. Positive and negative are the library's own\n// roles, the pair Tag draws from as well.\n//\n// The amount is isolated from the text around it, so its characters are\n// ordered by its own direction, the one the element's `dir` names, rather\n// than by the paragraph's. Without that a minus sign or a currency code at\n// the edge of an amount is ordered with its neighbours: an American amount on\n// a right-to-left page draws its minus on the far side of the digits, and an\n// Arabic amount on a left-to-right page puts its code at the wrong end. A\n// browser's own stylesheet isolates an element carrying `dir` too; the rule\n// here keeps the amount isolated where a page's styles override that one.\n//\n// `dir` also turns `start` around, which an amount laid out as a block — a\n// flex item stretched across a column — would otherwise align to: an Arabic\n// amount in a left-to-right column would sit at its right edge.\n// `match-parent` reads `start` against the direction around the amount, so it\n// lines up with its neighbours, and inherits any alignment the container set.\n// Chromium knows it only as `-webkit-match-parent`, which is the fallback.\nconst styles = {\n base: {\n kB7OPa: \"x9f619\",\n kMv6JI: \"xbppi91\",\n kcqcaj: \"xss6m8b\",\n k63SB2: \"x1bf3uqz\",\n k9WMMc: \"x16pb8o4\",\n kQ0QjF: \"x4ej8vm\",\n $$css: true\n }\n};\nconst tones = {\n inherit: {\n kMwMTN: \"x1heor9g\",\n $$css: true\n },\n negative: {\n kMwMTN: \"x12gp0t\",\n $$css: true\n },\n neutral: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n positive: {\n kMwMTN: \"x4no3js\",\n $$css: true\n }\n};\n\n// U+2212 MINUS SIGN, not the U+002D hyphen Intl actually emits. The hyphen is\n// a typographic stand-in: it is narrower than the plus it pairs with and does\n// not sit on the same optical centre as the digits, which shows up as a\n// wobbling column the moment amounts are stacked.\nconst MINUS_SIGN = '−';\ntype CurrencyDisplay = 'code' | 'name' | 'narrowSymbol' | 'symbol';\ntype CurrencyNotation = 'compact' | 'standard';\ntype CurrencyProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * ISO 4217 code for the currency to format in.\n * @default 'USD'\n */\n currency?: string;\n /**\n * How the currency is written. `symbol` is the locale's own symbol, which\n * tells one dollar from another where the locale has to — `CA$` in\n * American English. `narrowSymbol` is the bare sign, `$` for every dollar,\n * for a page that states its currency some other way. `code` writes the\n * ISO code and `name` the currency's name in the locale's words, `US\n * dollars`.\n *\n * A right-to-left locale draws a symbol made of letters and a sign with\n * its sign first, so Arabic's `US$` reads `$US`. `code` writes `USD`,\n * which has no sign to turn around.\n * @default 'symbol'\n */\n currencyDisplay?: CurrencyDisplay;\n /**\n * BCP 47 locale to format for. Defaults to React Aria's `I18nProvider`, as\n * the date and number fields do, so an amount reads in the locale the app\n * set — and to the browser's language where there is no provider.\n *\n * The element carries the locale it was formatted in as its `lang`, and\n * that locale's writing direction as its `dir`, so a screen reader can\n * read it by the locale's own number rules and its characters fall in the\n * locale's own order. A `lang` or `dir` the call site passes wins.\n */\n locale?: string;\n /**\n * The most digits shown after the decimal point; the amount is rounded to\n * them. Left out, the currency's own minor units decide — two for a\n * dollar, none for a yen — and under `compact` notation the figure keeps\n * two significant digits instead.\n *\n * A count the runtime rejects — negative, over a hundred, or below\n * `minimumFractionDigits` — is dropped rather than thrown, and both counts\n * fall back to the currency's own.\n */\n maximumFractionDigits?: number;\n /**\n * The fewest digits shown after the decimal point, padded with zeros.\n * Left out, the currency's own minor units decide.\n */\n minimumFractionDigits?: number;\n /**\n * `compact` shortens a large amount to a few digits and the locale's word\n * or letter for the scale — `$12B`, `12 Mrd. €` — for a figure that would\n * otherwise run past a narrow container. An amount has no break\n * opportunity, so a long one in hero type overflows rather than wrapping.\n * The amount is rounded, so it suits a figure read at a glance rather\n * than one read to the cent.\n * @default 'standard'\n */\n notation?: CurrencyNotation;\n /**\n * When to show the sign. `auto` shows one only on negatives, `always` also\n * prefixes positives with a plus, and `never` shows neither — which leaves\n * colour as the only thing separating a credit from a debt, so reach for it\n * only where the direction is already stated some other way.\n *\n * An amount that shows as zero carries no sign under any of them, since\n * there is nothing owed or owing: `-0.004` reads `$0.00`, not `−$0.00`.\n * @default 'auto'\n */\n sign?: CurrencySignDisplay;\n /**\n * Which colour role to render in. `auto` follows the sign of the amount as\n * it is shown, so one that rounds to zero — float residue, or a fraction\n * of a cent — reads as neutral rather than as a gain or a debt.\n *\n * The positive and negative roles are guaranteed legible on the surface\n * family, which is what the library's own tokens and every demo scheme are\n * held to. Over a container of its own — a selected row, a filled card —\n * the pair is one colour family on top of another and is not guaranteed.\n * `inherit` is the way out there, as it is on Text: it sets no colour, so\n * the amount takes the container's own on-colour, and its sign is what\n * says which way it goes.\n * @default 'auto'\n */\n tone?: CurrencyTone;\n /** The amount, in the currency's major units. */\n value: number;\n};\ntype CurrencySignDisplay = 'always' | 'auto' | 'never';\ntype CurrencyTone = 'auto' | 'inherit' | 'negative' | 'neutral' | 'positive';\n\n/**\n * An amount of money, formatted for the reader's locale in the mono face with\n * tabular figures, so a column of amounts lines up on the decimal point.\n * Negatives carry a true minus sign, and the tone follows the sign unless\n * `tone` names one.\n *\n * ```tsx\n * <Currency value={-42.5} currency=\"EUR\" />\n * ```\n *\n * It sets no size of its own, so it takes the type around it: wrap it in a\n * Text, or put it in a heading, for a larger figure. A figure that has to\n * fit a narrow space takes `notation=\"compact\"`, which shortens it to a few\n * digits and a scale.\n *\n * Over a container of its own, such as a selected row, give it\n * `tone=\"inherit\"` so it reads in the container's own on-colour.\n *\n * It carries the `lang` and `dir` of the locale it was formatted in, and is\n * isolated from the text around it, so an amount in a locale other than the\n * page's reads in its own order.\n *\n * The call site's `className` and `style` land on the element holding the\n * amount.\n */\nfunction Currency({\n currency = 'USD',\n currencyDisplay,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n notation,\n render,\n sign = 'auto',\n tone = 'auto',\n value,\n ...props\n}: CurrencyProps) {\n // React Aria holds the locale steady through hydration, where the runtime's\n // default differs between the server and the browser and the amount's text\n // would not match.\n const provided = useLocale().locale;\n const amount = formatCurrency(value, {\n currency,\n currencyDisplay,\n fallbackLocale: provided,\n // An empty string asks for the provider's locale as `undefined` does —\n // it is what clearing a locale control leaves — rather than reaching the\n // formatter as a tag it rejects.\n locale: locale === undefined || locale === '' ? provided : locale,\n maximumFractionDigits,\n minimumFractionDigits,\n notation,\n sign\n });\n return useRender({\n defaultTagName: 'span',\n props: {\n ...props,\n children: amount.text,\n // The call site's own win, for a page that states them some other way.\n dir: props.dir ?? amount.direction,\n lang: props.lang ?? amount.locale,\n ...mergeStyles(stylex.props(styles.base, tones[resolveTone(value, tone, amount.shownAsZero)]), props)\n },\n render\n });\n}\n\n// Constructing an Intl.NumberFormat resolves the locale, loads the currency's\n// data and builds the pattern; formatToParts on one already built skips all\n// three, which measures about ten times cheaper per value. An instance is\n// stateless once constructed, so one can be shared across every component\n// asking for the same options.\n//\n// What this saves is a mount and a changing amount, not an idle re-render:\n// the React Compiler already memoises the call below on the props it reads,\n// so a component re-rendered with the same props never reaches here.\n// That cache belongs to one component instance and counts `value` among its\n// keys, which leaves two cases it cannot cover — a column of rows, where every\n// instance has a cache of its own and each builds a formatter, and a single\n// amount that ticks, where each new value misses.\n//\n// Unbounded on purpose. The keys are the option sets an app actually uses —\n// its locales times its currencies times the handful of sign, display,\n// notation and digit settings it writes — so the map settles at that size\n// rather than growing with renders or with values.\n//\n// A request the runtime rejects is cached too, under its own key, as the\n// fallback it resolved to, so a bad pair costs one failed construction rather\n// than one a render.\nconst formatters = new Map<string, ResolvedFormat>();\n\n/**\n * A formatter, the locale it formats in and that locale's direction, and the\n * currency code written beside its number when it is the decimal fallback for\n * a code the runtime rejected.\n */\ntype ResolvedFormat = {\n code: null | string;\n direction: 'ltr' | 'rtl';\n formatter: Intl.NumberFormat;\n locale: string;\n};\n\n// formatToParts rather than a replace over the formatted string, so only the\n// sign is substituted. A blind replace would also hit a hyphen inside a\n// locale's currency name or grouping, and locales that wrap negatives in\n// parentheses have no minus to swap at all — both of which this leaves alone.\nfunction formatCurrency(value: number, options: FormatOptions) {\n const {\n code,\n direction,\n formatter,\n locale\n } = formatterFor(options);\n const parts = formatter.formatToParts(value);\n const amount = parts.map(part => part.type === 'minusSign' ? MINUS_SIGN : part.value).join('');\n return {\n direction,\n locale,\n // Whether every digit shown is a zero, which is what the tone reads\n // rather than the raw value: the two never saw the same number before.\n shownAsZero: parts.every(part => part.type !== 'integer' && part.type !== 'fraction' || /^0+$/.test(part.value)),\n text: code === null || code === '' ? amount : `${amount} ${code}`\n };\n}\n\n// The sign each setting asks Intl for. `negative` and `exceptZero` are the\n// forms that leave a zero bare, which `auto` and `always` do not: they put a\n// minus on any negative input, and a plus on any positive one, including\n// those that round to a displayed zero.\nconst SIGN_DISPLAY = {\n always: 'exceptZero',\n auto: 'negative',\n never: 'never'\n} as const satisfies Record<CurrencySignDisplay, Intl.NumberFormatOptions['signDisplay']>;\n\n// What the plain number shows when a currency code is rejected and the call\n// site gave no digit count: two places, as most currencies have.\nconst TWO_PLACES = {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2\n};\n\n/** Everything that decides how an amount is written, value aside. */\ntype FormatOptions = {\n currency: string;\n currencyDisplay: CurrencyDisplay | undefined;\n fallbackLocale: string;\n locale: string;\n maximumFractionDigits: number | undefined;\n minimumFractionDigits: number | undefined;\n notation: CurrencyNotation | undefined;\n sign: CurrencySignDisplay;\n};\n\n// A component that only shows an amount must not take the page down with it,\n// and `new Intl.NumberFormat` throws for a malformed locale (`xx_YY`, an\n// empty string), for a currency code that is not one (`xx`, `US`), and for a\n// digit count out of range or below the minimum it is paired with. Valid\n// input takes exactly the path it always did; the rest falls back. A locale\n// the runtime rejects gives way to the provider's. A currency code it rejects\n// gives way to the plain number in that locale with the code written after\n// it, so the amount still reads and what was wrong with it stays visible.\n// Digit counts it rejects are dropped for the currency's own.\n//\n// Nothing is logged: the library writes to the console nowhere, and a\n// warning an app cannot turn off is not its to emit.\nfunction formatterFor(options: FormatOptions) {\n const {\n currency,\n currencyDisplay,\n fallbackLocale,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n notation,\n sign\n } = options;\n // JSON over an array cannot make two option sets share a key, whatever a\n // rejected locale or code holds. The digit counts go in as strings, since\n // JSON writes a count left out and one that is not a number alike.\n const key = JSON.stringify([locale, currency, sign, fallbackLocale, currencyDisplay, notation, String(minimumFractionDigits), String(maximumFractionDigits)]);\n const cached = formatters.get(key);\n if (cached) {\n return cached;\n }\n\n // The locale the amount is written in, which is the one its `lang` and\n // `dir` name. React Aria's `isRTL` is what the provider's own direction\n // comes from, so an amount in the provider's locale and the page around it\n // agree.\n const usable = [locale, fallbackLocale].find(isLocale) ?? 'en-US';\n const written = {\n direction: isRTL(usable) ? 'rtl' : 'ltr',\n locale: usable\n } as const;\n const signDisplay = SIGN_DISPLAY[sign];\n const digits = {\n maximumFractionDigits,\n minimumFractionDigits\n };\n const asCurrency = {\n currency,\n currencyDisplay,\n notation,\n signDisplay,\n style: 'currency'\n } as const;\n // In order: everything asked for; the plain number with the code after it,\n // for a code the runtime rejects; and each again without the digit counts,\n // for counts it rejects. The plain number shows two places unless the\n // call site gave a count, as a currency with minor units does.\n const attempts: [null | string, Intl.NumberFormatOptions][] = [[null, {\n ...asCurrency,\n ...digits\n }], [currency, {\n notation,\n signDisplay,\n ...(maximumFractionDigits === undefined && minimumFractionDigits === undefined ? TWO_PLACES : digits)\n }], [null, asCurrency]];\n for (const [code, attempt] of attempts) {\n const formatter = formatterOrNull(usable, attempt);\n if (formatter !== null) {\n const resolved = {\n code,\n formatter,\n ...written\n };\n formatters.set(key, resolved);\n return resolved;\n }\n }\n const resolved = {\n code: currency,\n formatter: new Intl.NumberFormat(usable, {\n ...TWO_PLACES,\n signDisplay\n }),\n ...written\n };\n formatters.set(key, resolved);\n return resolved;\n}\n\n// A formatter for the options, or null where the runtime rejects them.\nfunction formatterOrNull(locale: string, options: Intl.NumberFormatOptions) {\n try {\n return new Intl.NumberFormat(locale, options);\n } catch {\n return null;\n }\n}\n\n// Whether the runtime takes `tag` as a locale at all — one it parses, whether\n// or not it has data for it, which it then fills in from the nearest it has.\nfunction isLocale(tag: string) {\n try {\n return Intl.NumberFormat.supportedLocalesOf(tag).length >= 0;\n } catch {\n return false;\n }\n}\n\n// An amount shown as zero is neither owed nor owing, so it takes the neutral\n// role whatever the raw value's sign: negative zero, a rounded-away debt and\n// float residue all read as settled. Otherwise the sign decides.\nfunction resolveTone(value: number, tone: CurrencyTone, shownAsZero: boolean) {\n if (tone !== 'auto') {\n return tone;\n }\n if (shownAsZero) {\n return 'neutral';\n }\n if (value > 0) {\n return 'positive';\n }\n if (value < 0) {\n return 'negative';\n }\n return 'neutral';\n}\nexport type { CurrencyDisplay, CurrencyNotation, CurrencyProps, CurrencySignDisplay, CurrencyTone };\nexport default Currency;"],"mappings":";;;;;;;;AAsCA,MAAMU,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AACA,MAAMC,QAAQ;CACZC,SAAS;EACPC,QAAQ;EACRH,OAAO;CACT;CACAI,UAAU;EACRD,QAAQ;EACRH,OAAO;CACT;CACAK,SAAS;EACPF,QAAQ;EACRH,OAAO;CACT;CACAM,UAAU;EACRH,QAAQ;EACRH,OAAO;CACT;AACF;AAMA,MAAMO,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;AAqHnB,SAAAgB,SAAAC,IAAA;CAAA,MAAAC,IAAA1C,EAAA,CAAA;CAAkB,MAAA,EAAA6B,UAAAc,IAAAb,iBAAAC,QAAAC,uBAAAC,uBAAAC,UAAAU,QAAAT,MAAAU,IAAAR,MAAAS,IAAAP,OAAA,GAAAQ,YAAAN;CAChB,MAAAZ,WAAAc,OAAAK,KAAAA,IAAA,QAAAL;CAOA,MAAAR,OAAAU,OAAAG,KAAAA,IAAA,SAAAH;CACA,MAAAR,OAAAS,OAAAE,KAAAA,IAAA,SAAAF;CAOA,MAAAG,WAAiB9C,UAAU,CAAC,CAAA4B;CAC5B,MAAAmB,SAAeC,eAAeZ,OAAO;EAAAV;EAAAC;EAAAsB,gBAGnBH;EAAQlB,QAIhBA,WAAWiB,KAAAA,KAAajB,WAAW,KAAnCkB,WAAAlB;EAAyDC;EAAAC;EAAAC;EAAAC;CAKnE,CA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jD,IAAIrC,cAAc,MAAM;GACtB,MAAMuC,WAAW;IACfxC;IACAC;IACA,GAAG+B;GACL;GACAnC,WAAW4C,IAAIlB,KAAKiB,QAAQ;GAC5B,OAAOA;EACT;CACF;CACA,MAAMA,WAAW;EACfxC,MAAM1C;EACN2C,WAAW,IAAIC,KAAKC,aAAa0B,QAAQ;GACvC,GAAGP;GACHW;EACF,CAAC;EACD,GAAGD;CACL;CACAnC,WAAW4C,IAAIlB,KAAKiB,QAAQ;CAC5B,OAAOA;AACT;AAGA,SAASD,gBAAgB/E,QAAgB4C,SAAmC;CAC1E,IAAI;EACF,OAAO,IAAIF,KAAKC,aAAa3C,QAAQ4C,OAAO;CAC9C,QAAQ;EACN,OAAO;CACT;AACF;AAIA,SAAS2B,SAASW,KAAa;CAC7B,IAAI;EACF,OAAOxC,KAAKC,aAAawC,mBAAmBD,GAAG,CAAC,CAACE,UAAU;CAC7D,QAAQ;EACN,OAAO;CACT;AACF;AAKA,SAASrD,YAAYvB,OAAeF,MAAoB0B,aAAsB;CAC5E,IAAI1B,SAAS,QACX,OAAOA;CAET,IAAI0B,aACF,OAAO;CAET,IAAIxB,QAAQ,GACV,OAAO;CAET,IAAIA,QAAQ,GACV,OAAO;CAET,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","isRTL","useLocale","useRender","mergeStyles","styles","base","kB7OPa","kMv6JI","kcqcaj","k63SB2","k9WMMc","kQ0QjF","$$css","tones","inherit","kMwMTN","negative","neutral","positive","MINUS_SIGN","currency","currencyDisplay","locale","maximumFractionDigits","minimumFractionDigits","notation","sign","tone","value","Currency","t0","$","t1","render","t2","t3","props","undefined","provided","amount","formatCurrency","fallbackLocale","t4","t5","text","t6","dir","direction","t7","lang","t8","resolveTone","shownAsZero","t9","children","t10","defaultTagName","formatters","Map","code","formatter","Intl","NumberFormat","options","formatterFor","parts","formatToParts","map","part","type","join","every","test","SIGN_DISPLAY","always","auto","never","TWO_PLACES","key","JSON","stringify","String","cached","get","usable","find","isLocale","written","signDisplay","digits","asCurrency","style","attempts","attempt","formatterOrNull","resolved","set","tag","supportedLocalesOf","length"],"sources":["../../../src/components/currency/index.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { isRTL } from 'react-aria';\nimport { useLocale } from 'react-aria-components';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\n\n// Deliberately sets no font-size. The same value turns up at several sizes —\n// inside a list row, as a heading-scale figure, as a total — differing in\n// nothing else, so the size is the container's decision. What must never vary\n// is here: the mono face, tabular figures so a column of them lines up on the\n// decimal point, and the medium weight that separates a figure from the prose\n// around it.\n//\n// No Material Design page draws an amount. It is type alone: the mono face\n// and medium weight from the type tokens, tabular figures, and the on surface\n// role for the neutral tone. Positive and negative are the library's own\n// roles, the pair Tag draws from as well.\n//\n// The amount is isolated from the text around it, so its characters are\n// ordered by its own direction, the one the element's `dir` names, rather\n// than by the paragraph's. Without that a minus sign or a currency code at\n// the edge of an amount is ordered with its neighbours: an American amount on\n// a right-to-left page draws its minus on the far side of the digits, and an\n// Arabic amount on a left-to-right page puts its code at the wrong end. A\n// browser's own stylesheet isolates an element carrying `dir` too; the rule\n// here keeps the amount isolated where a page's styles override that one.\n//\n// `dir` also turns `start` around, which an amount laid out as a block — a\n// flex item stretched across a column — would otherwise align to: an Arabic\n// amount in a left-to-right column would sit at its right edge.\n// `match-parent` reads `start` against the direction around the amount, so it\n// lines up with its neighbours, and inherits any alignment the container set.\n// Chromium knows it only as `-webkit-match-parent`, which is the fallback.\nconst styles = {\n base: {\n kB7OPa: \"x9f619\",\n kMv6JI: \"xbppi91\",\n kcqcaj: \"xss6m8b\",\n k63SB2: \"x1bf3uqz\",\n k9WMMc: \"x16pb8o4\",\n kQ0QjF: \"x4ej8vm\",\n $$css: true\n }\n};\nconst tones = {\n inherit: {\n kMwMTN: \"x1heor9g\",\n $$css: true\n },\n negative: {\n kMwMTN: \"x12gp0t\",\n $$css: true\n },\n neutral: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n positive: {\n kMwMTN: \"x4no3js\",\n $$css: true\n }\n};\n\n// U+2212 MINUS SIGN, not the U+002D hyphen Intl actually emits. The hyphen is\n// a typographic stand-in: it is narrower than the plus it pairs with and does\n// not sit on the same optical centre as the digits, which shows up as a\n// wobbling column the moment amounts are stacked.\nconst MINUS_SIGN = '−';\ntype CurrencyDisplay = 'code' | 'name' | 'narrowSymbol' | 'symbol';\ntype CurrencyNotation = 'compact' | 'standard';\ntype CurrencyProps = Omit<RenderComponentProps<'span'>, 'children'> & {\n /**\n * ISO 4217 code for the currency to format in.\n * @default 'USD'\n */\n currency?: string;\n /**\n * How the currency is written. `symbol` is the locale's own symbol, which\n * tells one dollar from another where the locale has to — `CA$` in\n * American English. `narrowSymbol` is the bare sign, `$` for every dollar,\n * for a page that states its currency some other way. `code` writes the\n * ISO code and `name` the currency's name in the locale's words, `US\n * dollars`.\n *\n * A right-to-left locale draws a symbol made of letters and a sign with\n * its sign first, so Arabic's `US$` reads `$US`. `code` writes `USD`,\n * which has no sign to turn around.\n * @default 'symbol'\n */\n currencyDisplay?: CurrencyDisplay;\n /**\n * BCP 47 locale to format for. Defaults to React Aria's `I18nProvider`, as\n * the date and number fields do, so an amount reads in the locale the app\n * set — and to the browser's language where there is no provider.\n *\n * The element carries the locale it was formatted in as its `lang`, and\n * that locale's writing direction as its `dir`, so a screen reader can\n * read it by the locale's own number rules and its characters fall in the\n * locale's own order. A `lang` or `dir` the call site passes wins.\n */\n locale?: string;\n /**\n * The most digits shown after the decimal point; the amount is rounded to\n * them. Left out, the currency's own minor units decide — two for a\n * dollar, none for a yen — and under `compact` notation the figure keeps\n * two significant digits instead.\n *\n * A count the runtime rejects — negative, over a hundred, or below\n * `minimumFractionDigits` — is dropped rather than thrown, and both counts\n * fall back to the currency's own.\n */\n maximumFractionDigits?: number;\n /**\n * The fewest digits shown after the decimal point, padded with zeros.\n * Left out, the currency's own minor units decide.\n */\n minimumFractionDigits?: number;\n /**\n * `compact` shortens a large amount to a few digits and the locale's word\n * or letter for the scale — `$12B`, `12 Mrd. €` — for a figure that would\n * otherwise run past a narrow container. An amount has no break\n * opportunity, so a long one in hero type overflows rather than wrapping.\n * The amount is rounded, so it suits a figure read at a glance rather\n * than one read to the cent.\n * @default 'standard'\n */\n notation?: CurrencyNotation;\n /**\n * When to show the sign. `auto` shows one only on negatives, `always` also\n * prefixes positives with a plus, and `never` shows neither — which leaves\n * colour as the only thing separating a credit from a debt, so reach for it\n * only where the direction is already stated some other way.\n *\n * An amount that shows as zero carries no sign under any of them, since\n * there is nothing owed or owing: `-0.004` reads `$0.00`, not `−$0.00`.\n * @default 'auto'\n */\n sign?: CurrencySignDisplay;\n /**\n * Which colour role to render in. `auto` follows the sign of the amount as\n * it is shown, so one that rounds to zero — float residue, or a fraction\n * of a cent — reads as neutral rather than as a gain or a debt.\n *\n * The positive and negative roles are guaranteed legible on the surface\n * family, which is what the library's own tokens and every demo scheme are\n * held to. Over a container of its own — a selected row, a filled card —\n * the pair is one colour family on top of another and is not guaranteed.\n * `inherit` is the way out there, as it is on Text: it sets no colour, so\n * the amount takes the container's own on-colour, and its sign is what\n * says which way it goes.\n * @default 'auto'\n */\n tone?: CurrencyTone;\n /** The amount, in the currency's major units. */\n value: number;\n};\ntype CurrencySignDisplay = 'always' | 'auto' | 'never';\ntype CurrencyTone = 'auto' | 'inherit' | 'negative' | 'neutral' | 'positive';\n\n/**\n * An amount of money, formatted for the reader's locale in the mono face with\n * tabular figures, so a column of amounts lines up on the decimal point.\n * Negatives carry a true minus sign, and the tone follows the sign unless\n * `tone` names one.\n *\n * ```tsx\n * <Currency value={-42.5} currency=\"EUR\" />\n * ```\n *\n * It sets no size of its own, so it takes the type around it: wrap it in a\n * Text, or put it in a heading, for a larger figure. A figure that has to\n * fit a narrow space takes `notation=\"compact\"`, which shortens it to a few\n * digits and a scale.\n *\n * Over a container of its own, such as a selected row, give it\n * `tone=\"inherit\"` so it reads in the container's own on-colour.\n *\n * It carries the `lang` and `dir` of the locale it was formatted in, and is\n * isolated from the text around it, so an amount in a locale other than the\n * page's reads in its own order.\n *\n * The call site's `className` and `style` land on the element holding the\n * amount.\n */\nfunction Currency({\n currency = 'USD',\n currencyDisplay,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n notation,\n render,\n sign = 'auto',\n tone = 'auto',\n value,\n ...props\n}: CurrencyProps) {\n // React Aria holds the locale steady through hydration, where the runtime's\n // default differs between the server and the browser and the amount's text\n // would not match.\n const provided = useLocale().locale;\n const amount = formatCurrency(value, {\n currency,\n currencyDisplay,\n fallbackLocale: provided,\n // An empty string asks for the provider's locale as `undefined` does —\n // it is what clearing a locale control leaves — rather than reaching the\n // formatter as a tag it rejects.\n locale: locale === undefined || locale === '' ? provided : locale,\n maximumFractionDigits,\n minimumFractionDigits,\n notation,\n sign\n });\n return useRender({\n defaultTagName: 'span',\n props: {\n ...props,\n children: amount.text,\n // The call site's own win, for a page that states them some other way.\n dir: props.dir ?? amount.direction,\n lang: props.lang ?? amount.locale,\n ...mergeStyles(stylex.props(styles.base, tones[resolveTone(value, tone, amount.shownAsZero)]), props)\n },\n render\n });\n}\n\n// Constructing an Intl.NumberFormat resolves the locale, loads the currency's\n// data and builds the pattern; formatToParts on one already built skips all\n// three, which measures about ten times cheaper per value. An instance is\n// stateless once constructed, so one can be shared across every component\n// asking for the same options.\n//\n// What this saves is a mount and a changing amount, not an idle re-render:\n// the React Compiler already memoises the call below on the props it reads,\n// so a component re-rendered with the same props never reaches here.\n// That cache belongs to one component instance and counts `value` among its\n// keys, which leaves two cases it cannot cover — a column of rows, where every\n// instance has a cache of its own and each builds a formatter, and a single\n// amount that ticks, where each new value misses.\n//\n// Unbounded on purpose. The keys are the option sets an app actually uses —\n// its locales times its currencies times the handful of sign, display,\n// notation and digit settings it writes — so the map settles at that size\n// rather than growing with renders or with values.\n//\n// A request the runtime rejects is cached too, under its own key, as the\n// fallback it resolved to, so a bad pair costs one failed construction rather\n// than one a render.\nconst formatters = new Map<string, ResolvedFormat>();\n\n/**\n * A formatter, the locale it formats in and that locale's direction, and the\n * currency code written beside its number when it is the decimal fallback for\n * a code the runtime rejected.\n */\ntype ResolvedFormat = {\n code: null | string;\n direction: 'ltr' | 'rtl';\n formatter: Intl.NumberFormat;\n locale: string;\n};\n\n// formatToParts rather than a replace over the formatted string, so only the\n// sign is substituted. A blind replace would also hit a hyphen inside a\n// locale's currency name or grouping, and locales that wrap negatives in\n// parentheses have no minus to swap at all — both of which this leaves alone.\nfunction formatCurrency(value: number, options: FormatOptions) {\n const {\n code,\n direction,\n formatter,\n locale\n } = formatterFor(options);\n const parts = formatter.formatToParts(value);\n const amount = parts.map(part => part.type === 'minusSign' ? MINUS_SIGN : part.value).join('');\n return {\n direction,\n locale,\n // Whether every digit shown is a zero, which is what the tone reads\n // rather than the raw value: the two never saw the same number before.\n shownAsZero: parts.every(part => part.type !== 'integer' && part.type !== 'fraction' || /^0+$/.test(part.value)),\n text: code === null || code === '' ? amount : `${amount} ${code}`\n };\n}\n\n// The sign each setting asks Intl for. `negative` and `exceptZero` are the\n// forms that leave a zero bare, which `auto` and `always` do not: they put a\n// minus on any negative input, and a plus on any positive one, including\n// those that round to a displayed zero.\nconst SIGN_DISPLAY = {\n always: 'exceptZero',\n auto: 'negative',\n never: 'never'\n} as const satisfies Record<CurrencySignDisplay, Intl.NumberFormatOptions['signDisplay']>;\n\n// What the plain number shows when a currency code is rejected and the call\n// site gave no digit count: two places, as most currencies have.\nconst TWO_PLACES = {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2\n};\n\n/** Everything that decides how an amount is written, value aside. */\ntype FormatOptions = {\n currency: string;\n currencyDisplay: CurrencyDisplay | undefined;\n fallbackLocale: string;\n locale: string;\n maximumFractionDigits: number | undefined;\n minimumFractionDigits: number | undefined;\n notation: CurrencyNotation | undefined;\n sign: CurrencySignDisplay;\n};\n\n// A component that only shows an amount must not take the page down with it,\n// and `new Intl.NumberFormat` throws for a malformed locale (`xx_YY`, an\n// empty string), for a currency code that is not one (`xx`, `US`), and for a\n// digit count out of range or below the minimum it is paired with. Valid\n// input takes exactly the path it always did; the rest falls back. A locale\n// the runtime rejects gives way to the provider's. A currency code it rejects\n// gives way to the plain number in that locale with the code written after\n// it, so the amount still reads and what was wrong with it stays visible.\n// Digit counts it rejects are dropped for the currency's own.\n//\n// Nothing is logged: the library writes to the console nowhere, and a\n// warning an app cannot turn off is not its to emit.\nfunction formatterFor(options: FormatOptions) {\n const {\n currency,\n currencyDisplay,\n fallbackLocale,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n notation,\n sign\n } = options;\n // JSON over an array cannot make two option sets share a key, whatever a\n // rejected locale or code holds. The digit counts go in as strings, since\n // JSON writes a count left out and one that is not a number alike.\n const key = JSON.stringify([locale, currency, sign, fallbackLocale, currencyDisplay, notation, String(minimumFractionDigits), String(maximumFractionDigits)]);\n const cached = formatters.get(key);\n if (cached) {\n return cached;\n }\n\n // The locale the amount is written in, which is the one its `lang` and\n // `dir` name. React Aria's `isRTL` is what the provider's own direction\n // comes from, so an amount in the provider's locale and the page around it\n // agree.\n const usable = [locale, fallbackLocale].find(isLocale) ?? 'en-US';\n const written = {\n direction: isRTL(usable) ? 'rtl' : 'ltr',\n locale: usable\n } as const;\n const signDisplay = SIGN_DISPLAY[sign];\n const digits = {\n maximumFractionDigits,\n minimumFractionDigits\n };\n const asCurrency = {\n currency,\n currencyDisplay,\n notation,\n signDisplay,\n style: 'currency'\n } as const;\n // In order: everything asked for; the plain number with the code after it,\n // for a code the runtime rejects; and each again without the digit counts,\n // for counts it rejects. The plain number shows two places unless the\n // call site gave a count, as a currency with minor units does.\n const attempts: [null | string, Intl.NumberFormatOptions][] = [[null, {\n ...asCurrency,\n ...digits\n }], [currency, {\n notation,\n signDisplay,\n ...(maximumFractionDigits === undefined && minimumFractionDigits === undefined ? TWO_PLACES : digits)\n }], [null, asCurrency]];\n for (const [code, attempt] of attempts) {\n const formatter = formatterOrNull(usable, attempt);\n if (formatter !== null) {\n const resolved = {\n code,\n formatter,\n ...written\n };\n formatters.set(key, resolved);\n return resolved;\n }\n }\n const resolved = {\n code: currency,\n formatter: new Intl.NumberFormat(usable, {\n ...TWO_PLACES,\n signDisplay\n }),\n ...written\n };\n formatters.set(key, resolved);\n return resolved;\n}\n\n// A formatter for the options, or null where the runtime rejects them.\nfunction formatterOrNull(locale: string, options: Intl.NumberFormatOptions) {\n try {\n return new Intl.NumberFormat(locale, options);\n } catch {\n return null;\n }\n}\n\n// Whether the runtime takes `tag` as a locale at all — one it parses, whether\n// or not it has data for it, which it then fills in from the nearest it has.\nfunction isLocale(tag: string) {\n try {\n return Intl.NumberFormat.supportedLocalesOf(tag).length >= 0;\n } catch {\n return false;\n }\n}\n\n// An amount shown as zero is neither owed nor owing, so it takes the neutral\n// role whatever the raw value's sign: negative zero, a rounded-away debt and\n// float residue all read as settled. Otherwise the sign decides.\nfunction resolveTone(value: number, tone: CurrencyTone, shownAsZero: boolean) {\n if (tone !== 'auto') {\n return tone;\n }\n if (shownAsZero) {\n return 'neutral';\n }\n if (value > 0) {\n return 'positive';\n }\n if (value < 0) {\n return 'negative';\n }\n return 'neutral';\n}\nexport type { CurrencyDisplay, CurrencyNotation, CurrencyProps, CurrencySignDisplay, CurrencyTone };\nexport default Currency;"],"mappings":";;;;;;;;AAsCA,MAAMM,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AACA,MAAMC,QAAQ;CACZC,SAAS;EACPC,QAAQ;EACRH,OAAO;CACT;CACAI,UAAU;EACRD,QAAQ;EACRH,OAAO;CACT;CACAK,SAAS;EACPF,QAAQ;EACRH,OAAO;CACT;CACAM,UAAU;EACRH,QAAQ;EACR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AAYvB,OAAeD,MAAoByB,aAAsB;CAC5E,IAAIzB,SAAS,QACX,OAAOA;CAET,IAAIyB,aACF,OAAO;CAET,IAAIxB,QAAQ,GACV,OAAO;CAET,IAAIA,QAAQ,GACV,OAAO;CAET,OAAO;AACT"}
@@ -62,5 +62,4 @@ type DateFieldProps$1<T extends DateValue = DateValue> = Omit<DateFieldProps<T>,
62
62
  * the field as a whole, which is the element a layout positions.
63
63
  */
64
64
  declare function DateField$1<T extends DateValue>({ description, error, floatingLabel, isDisabled, label, leadingIcon, trailingIcon, variant, ...props }: DateFieldProps$1<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
65
- export { type DateFieldProps$1 as DateFieldProps, DateField$1 as default };
66
- //# sourceMappingURL=index.d.ts.map
65
+ export { type DateFieldProps$1 as DateFieldProps, DateField$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","DateValue","DateFieldProps","RACDateFieldProps","stylex","DateField","RACDateField","DateInput","RACDateInput","FieldVariant","FieldBox","FieldMessage","FieldSegments","fieldStyles","invalidFrom","useFieldValidationBehavior","renderSegment","segmentStyles","mergeStatefulStyles","Omit","T","className","description","error","floatingLabel","label","leadingIcon","style","trailingIcon","variant","t0","$","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","Symbol","for","input","t7","isRequired","t8","t9","DateField","_c","props","RACDateField","stylex.props","RACDateInput"],"sources":["../../../src/components/date-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DateValue, DateFieldProps as RACDateFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { DateField as RACDateField, DateInput as RACDateInput } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldSegments } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A date typed a segment at a time, rather than picked from a calendar. The\n// box, label and message are the field chrome in `src/field`, shared with\n// every other field, so a date field on a form is the same box as the text\n// field beside it — which is what the date pickers page means by a date in a\n// text field.\n//\n// Three things are this component's own.\n//\n// **Each segment is its own focus stop, and React Aria decides how many.**\n// The order and the count come from the locale rather than from here: a\n// reader under `I18nProvider` with a British locale gets day before month,\n// and `granularity` of `minute` adds two more. So the segments are rendered\n// from what React Aria hands the input, never written out.\n//\n// **A segment not yet filled is muted, and the label floats from the\n// start.** The placeholder text is the segment's own — `mm`, `dd`, `yyyy` —\n// and it takes the muted role so a half-typed date reads as half-typed. The\n// segments show it whether or not a date is in them, so the floating label\n// sits above them even while the field is empty, rather than resting on top\n// of the placeholders.\n//\n// **A focused segment is a filled shape rather than a ring.** A caret cannot\n// show which of three spinbuttons has focus, since React Aria hides it — the\n// segment is what has to say so, and it does it the way a selected row does.\n\ntype DateFieldProps<T extends DateValue = DateValue> = Omit<RACDateFieldProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the field's render state. */\n className?: RACDateFieldProps<T>['className'];\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACDateFieldProps<T>['style'];\n /**\n * An icon at the box's trailing end, in the page's 24dp size. An icon\n * drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n};\n\n/**\n * A date typed rather than picked: one segment per part, each its own focus\n * stop. The value is React Aria's — pass `value` with `onChange` to control\n * it, or `defaultValue` — as an `@internationalized/date` value from this\n * package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DateField defaultValue={new CalendarDate(2026, 9, 15)} label=\"Label\" />\n * ```\n *\n * How many segments there are and what order they come in is the reader's\n * locale, through React Aria's `I18nProvider` — `granularity` adds time\n * segments, and `minValue` and `maxValue` bound what may be typed.\n *\n * The box, label and message are the field chrome in `src/field`, shared\n * with every other field. The call site's `className` and `style` land on\n * the field as a whole, which is the element a layout positions.\n */\nfunction DateField<T extends DateValue>({\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n trailingIcon,\n variant = 'filled',\n ...props\n}: DateFieldProps<T> & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACDateField<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys the outlined notch. The box decides\n // populated twice over — in CSS for the label's type, and in React\n // for the notch, since CSS cannot cut an outline to a width it has\n // no way to measure. React Aria renders a hidden\n // `<input type=\"date\">` carrying no placeholder, so the CSS half\n // reads as populated on its own; the React half reads React Aria's\n // input context, which a date field does not provide. Without this\n // the notch stays shut across segments already showing `mm/dd/yyyy`.\n isPopulated isRequired={props.isRequired} label={label} leading={leadingIcon} trailing={trailingIcon} variant={variant}>\n <FieldSegments>\n <RACDateInput {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </FieldSegments>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACDateField>;\n}\nexport type { DateFieldProps };\nexport default DateField;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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K,QAAAY;EAAAjB,EAAA,KAAAH;EAAAG,EAAA,KAAAF;EAAAE,EAAA,KAAAgB;CAAA,OAAAA,KAAAhB,EAAA;CAAA,IAAAkB;CAAA,IAAAlB,EAAA,QAAAT,eAAAS,EAAA,QAAAR,OAAA;EACX0B,KAAA,oBAAC,cAAD;GAA2B3B;GAAoBC;EAAK,CAAA;EAAIQ,EAAA,MAAAT;EAAAS,EAAA,MAAAR;EAAAQ,EAAA,MAAAkB;CAAA,OAAAA,KAAAlB,EAAA;CAAA,IAAAmB;CAAA,IAAAnB,EAAA,QAAAQ,MAAAR,EAAA,QAAAE,cAAAF,EAAA,QAAAK,WAAAL,EAAA,QAAAS,MAAAT,EAAA,QAAAU,MAAAV,EAAA,QAAAgB,MAAAhB,EAAA,QAAAkB,MAAAlB,EAAA,QAAAO,oBAAA;EAjBrDY,KAAA,qBAAC,IAAD;GAA6BjB;GAAuB,WAAAO;GAAwCF;GAAkB,GAAMF;GAAK,GAAMK;GAA/H,UAAA,CACHM,IAgBAE,EAjBgB;;EAkBHlB,EAAA,MAAAQ;EAAAR,EAAA,MAAAE;EAAAF,EAAA,MAAAK;EAAAL,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAgB;EAAAhB,EAAA,MAAAkB;EAAAlB,EAAA,MAAAO;EAAAP,EAAA,MAAAmB;CAAA,OAAAA,KAAAnB,EAAA;CAAA,OAlBVmB;AAkBU"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","DateField","RACDateField","fieldStyles","invalidFrom","useFieldValidationBehavior","renderSegment","segmentStyles","mergeStatefulStyles","description","error","floatingLabel","label","leadingIcon","trailingIcon","variant","t0","$","t1","isDisabled","t2","t3","props","undefined","validationBehavior","T0","t4","t5","root","t6","Symbol","for","input","t7","isRequired","t8","t9","RACDateInput"],"sources":["../../../src/components/date-field/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DateValue, DateFieldProps as RACDateFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { DateField as RACDateField, DateInput as RACDateInput } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldSegments } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A date typed a segment at a time, rather than picked from a calendar. The\n// box, label and message are the field chrome in `src/field`, shared with\n// every other field, so a date field on a form is the same box as the text\n// field beside it — which is what the date pickers page means by a date in a\n// text field.\n//\n// Three things are this component's own.\n//\n// **Each segment is its own focus stop, and React Aria decides how many.**\n// The order and the count come from the locale rather than from here: a\n// reader under `I18nProvider` with a British locale gets day before month,\n// and `granularity` of `minute` adds two more. So the segments are rendered\n// from what React Aria hands the input, never written out.\n//\n// **A segment not yet filled is muted, and the label floats from the\n// start.** The placeholder text is the segment's own — `mm`, `dd`, `yyyy` —\n// and it takes the muted role so a half-typed date reads as half-typed. The\n// segments show it whether or not a date is in them, so the floating label\n// sits above them even while the field is empty, rather than resting on top\n// of the placeholders.\n//\n// **A focused segment is a filled shape rather than a ring.** A caret cannot\n// show which of three spinbuttons has focus, since React Aria hides it — the\n// segment is what has to say so, and it does it the way a selected row does.\n\ntype DateFieldProps<T extends DateValue = DateValue> = Omit<RACDateFieldProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the field's render state. */\n className?: RACDateFieldProps<T>['className'];\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /** A function may compute the style from the field's render state. */\n style?: RACDateFieldProps<T>['style'];\n /**\n * An icon at the box's trailing end, in the page's 24dp size. An icon\n * drawn in `em` takes that size from the slot.\n */\n trailingIcon?: ReactNode;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n};\n\n/**\n * A date typed rather than picked: one segment per part, each its own focus\n * stop. The value is React Aria's — pass `value` with `onChange` to control\n * it, or `defaultValue` — as an `@internationalized/date` value from this\n * package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DateField defaultValue={new CalendarDate(2026, 9, 15)} label=\"Label\" />\n * ```\n *\n * How many segments there are and what order they come in is the reader's\n * locale, through React Aria's `I18nProvider` — `granularity` adds time\n * segments, and `minValue` and `maxValue` bound what may be typed.\n *\n * The box, label and message are the field chrome in `src/field`, shared\n * with every other field. The call site's `className` and `style` land on\n * the field as a whole, which is the element a layout positions.\n */\nfunction DateField<T extends DateValue>({\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n trailingIcon,\n variant = 'filled',\n ...props\n}: DateFieldProps<T> & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACDateField<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys the outlined notch. The box decides\n // populated twice over — in CSS for the label's type, and in React\n // for the notch, since CSS cannot cut an outline to a width it has\n // no way to measure. React Aria renders a hidden\n // `<input type=\"date\">` carrying no placeholder, so the CSS half\n // reads as populated on its own; the React half reads React Aria's\n // input context, which a date field does not provide. Without this\n // the notch stays shut across segments already showing `mm/dd/yyyy`.\n isPopulated isRequired={props.isRequired} label={label} leading={leadingIcon} trailing={trailingIcon} variant={variant}>\n <FieldSegments>\n <RACDateInput {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </FieldSegments>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n </RACDateField>;\n}\nexport type { DateFieldProps };\nexport default DateField;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGA,SAAAE,YAAAe,IAAA;CAAA,MAAAC,IAAAlB,EAAA,EAAA;CAAwC,MAAA,EAAAU,aAAAC,OAAAC,eAAAO,IAAAC,YAAAC,IAAAR,OAAAC,aAAAC,cAAAC,SAAAM,IAAA,GAAAC,YAAAN;CAGtC,MAAAL,gBAAAO,OAAAK,KAAAA,IAAA,OAAAL;CACA,MAAAC,aAAAC,OAAAG,KAAAA,IAAA,QAAAH;CAIA,MAAAL,UAAAM,OAAAE,KAAAA,IAAA,WAAAF;CAGA,MAAAG,qBAA2BnB,2BAA2B;CAC9C,MAAAoB,KAAAvB;CAAY,IAAAwB;CAAA,IAAAT,EAAA,OAAAP,OAAA;EAAuCgB,KAAAtB,YAAYM,KAAK;EAACO,EAAA,KAAAP;EAAAO,EAAA,KAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAyD,MAAAU,KAAAnB,oBAAoBR,MAAaG,YAAWyB,IAAK,GAAGN,OAAK;CAAC,IAAAO;CAAA,IAAAZ,EAAA,OAAAa,OAAAC,IAAA,2BAAA,GAAA;EAW1LF,KAAA,oBAAC,eAAD,EAAA,UACE,oBAACQ,WAAD;GAAa,GAAKrC,MAAaO,cAAayB,KAAM;GAC/C1B,UAAAA;EADU,CAAA,EADD,CAAA;EAIEW,EAAA,KAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAgB;CAAA,IAAAhB,EAAA,OAAAN,iBAAAM,EAAA,OAAAL,SAAAK,EAAA,OAAAJ,eAAAI,EAAA,OAAAK,QAAAY,cAAAjB,EAAA,OAAAH,gBAAAG,EAAA,OAAAF,SAAA;EAdlBk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extends DateValue>({ container, description, error, floatingLabel, isDisabled, label, leadingIcon, showMonthYearMenus, triggerLabel, variant, visibleDuration, ...props }: DatePickerProps$1<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
89
- export { type DatePickerProps$1 as DatePickerProps, DatePicker$1 as default };
90
- //# sourceMappingURL=index.d.ts.map
89
+ export { type DatePickerProps$1 as DatePickerProps, DatePicker$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","DateDuration","ReactNode","RefAttributes","DateValue","DatePickerProps","RACDatePickerProps","stylex","Button","RACButton","DateInput","RACDateInput","DatePicker","RACDatePicker","Dialog","RACDialog","Group","RACGroup","Popover","RACPopover","FieldVariant","FieldBox","FieldMessage","FieldSegments","fieldStyles","invalidFrom","useFieldValidationBehavior","CalendarGlyph","renderSegment","segmentStyles","focus","mergeStatefulStyles","overlay","datePopoverClassName","picker","triggerClassName","Calendar","Omit","T","className","container","Element","description","error","floatingLabel","label","leadingIcon","showMonthYearMenus","style","triggerLabel","variant","visibleDuration","calendarTrigger","props","triggerGlyph","t0","$","t1","isDisabled","t2","t3","t4","undefined","validationBehavior","T0","t5","t6","root","t7","isRequired","t8","t9","Symbol","for","group","t10","input","t11","t12","t13","popupDialog","ring","t14","t15","t16","RACButton","stylex.props","DatePicker","_c","props","RACDatePicker","RACGroup","RACDateInput","RACDialog","Calendar","RACPopover"],"sources":["../../../src/components/date-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { DateDuration } from '@internationalized/date';\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DateValue, DatePickerProps as RACDatePickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, DateInput as RACDateInput, DatePicker as RACDatePicker, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldSegments } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CalendarGlyph } from '../../glyphs';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { datePopoverClassName, picker, triggerClassName } from '../../styles/picker';\nimport Calendar from '../calendar';\n\n// The date pickers page's picker: the date field a date is typed into, with\n// a calendar behind a button for picking it instead. Both halves already\n// exist — the segments are `DateField`'s, from `src/segments`, and the\n// calendar is `Calendar` — so what this adds is the button between them and\n// the surface the calendar opens on.\n//\n// Two things are this component's own.\n//\n// **The picker is one field, not a field beside a button.** React Aria's\n// `Group` is what holds the segments and the trigger together, so the box\n// draws once around both and a reader tabs through the segments and reaches\n// the button at the end of them rather than as a separate control.\n//\n// **It is docked above the medium breakpoint and modal below it**, which is\n// the pairing the page draws: below the breakpoint the picker is a dialog,\n// centred over a scrim, and `Sheet` changes presentation at the same width.\n// It is done in CSS rather than by rendering a different tree: a 360dp\n// calendar anchored to a field is unreachable at 375px, and a modal that\n// stayed centred on a desktop would cover a form for no reason. `Sheet`\n// settles its own swap the same way, and doing it twice in two different\n// ways is how the two would drift. The styles are in `src/styles/picker.ts`.\n\ntype DatePickerProps<T extends DateValue = DateValue> = Omit<RACDatePickerProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the picker's render state. */\n className?: RACDatePickerProps<T>['className'];\n /**\n * Where to portal the calendar. Defaults to the container of the `ThemeScope`\n * around it, which keeps the calendar on that scope's tokens, or to the end\n * of `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the calendar\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * Whether the calendar's header draws the month and the year as menu\n * buttons, each opening a list of them in the grid's place — see\n * `Calendar`.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the picker's render state. */\n style?: RACDatePickerProps<T>['style'];\n /**\n * What the button that opens the calendar is called, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Calendar\" in\n * English, followed by the field's own label.\n */\n triggerLabel?: string;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n /**\n * How much of the calendar shows at once: `{ months: 2 }` draws two\n * months side by side. Below the expanded breakpoint, where two do not\n * fit, they stack instead — see `Calendar`.\n * @default { months: 1 }\n */\n visibleDuration?: DateDuration;\n};\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-jsx-as-prop is after — the same reason Select builds its\n// chevron this way.\nfunction calendarTrigger(triggerLabel: string | undefined) {\n return <RACButton aria-label={triggerLabel} className={triggerClassName}>\n <CalendarGlyph {...stylex.props(picker.triggerGlyph)} />\n </RACButton>;\n}\n\n/**\n * A date typed into a field, or picked from a calendar behind a button. The\n * value is React Aria's — pass `value` with `onChange` to control it, or\n * `defaultValue` — as an `@internationalized/date` value from this package's\n * `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DatePicker defaultValue={new CalendarDate(2026, 9, 15)} label=\"Label\" />\n * ```\n *\n * The segments are `DateField`'s and the calendar is `Calendar`, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` all behave\n * as they do there. Above the medium breakpoint the calendar is docked to\n * the field; below it, it opens centred, which is the page's modal picker.\n *\n * The call site's `className` and `style` land on the picker as a whole,\n * which is the element a layout positions.\n */\nfunction DatePicker<T extends DateValue>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n showMonthYearMenus = false,\n triggerLabel,\n variant = 'filled',\n visibleDuration,\n ...props\n}: DatePickerProps<T> & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACDatePicker<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys exactly one thing: the outlined\n // notch. The box decides populated twice over — in CSS for the\n // label's type, and in React for the notch, since CSS cannot cut an\n // outline to a width it has no way to measure. React Aria renders a\n // hidden `<input type=\"date\">` carrying no placeholder, so the CSS\n // half reads as populated on its own; the React half reads React\n // Aria's input context, which a picker does not provide. Without\n // this the notch stays shut across segments already showing\n // `mm/dd/yyyy`.\n isPopulated isRequired={props.isRequired} label={label} leading={leadingIcon}\n // In the chrome's trailing slot rather than on the segments' line,\n // which is where Select and ComboBox put their chevron. The slot\n // cancels the box's top padding and stretches to its full height, so\n // it centres the 40dp trigger in the box; on the line the trigger\n // was taller than the row that held it and hung past the underline,\n // and the segments centred on it rather than on their own line.\n //\n // React Aria's `DatePicker` is what gives the trigger its press\n // behaviour, through context, so the slot reaches it as well as the\n // group did.\n trailing={calendarTrigger(triggerLabel)} variant={variant}>\n <FieldSegments>\n <RACGroup {...stylex.props(picker.group)}>\n <RACDateInput {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </RACGroup>\n </FieldSegments>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={datePopoverClassName}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n <Calendar aria-label={label} showMonthYearMenus={showMonthYearMenus} visibleDuration={visible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{"version":3,"file":"index.js","names":["_c","stylex","DatePicker","RACDatePicker","fieldStyles","invalidFrom","useFieldValidationBehavior","renderSegment","segmentStyles","focus","mergeStatefulStyles","overlay","datePopoverClassName","picker","triggerClassName","container","description","error","floatingLabel","label","leadingIcon","showMonthYearMenus","triggerLabel","variant","visibleDuration","calendarTrigger","props","triggerGlyph","t0","$","t1","isDisabled","t2","t3","t4","undefined","validationBehavior","T0","t5","t6","root","t7","isRequired","t8","t9","Symbol","for","group","t10","input","t11","t12","t13","popupDialog","ring","t14","t15","t16","RACButton","RACGroup","RACDateInput","RACDialog","Calendar","RACPopover"],"sources":["../../../src/components/date-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { DateDuration } from '@internationalized/date';\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DateValue, DatePickerProps as RACDatePickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Button as RACButton, DateInput as RACDateInput, DatePicker as RACDatePicker, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldSegments } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CalendarGlyph } from '../../glyphs';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { datePopoverClassName, picker, triggerClassName } from '../../styles/picker';\nimport Calendar from '../calendar';\n\n// The date pickers page's picker: the date field a date is typed into, with\n// a calendar behind a button for picking it instead. Both halves already\n// exist — the segments are `DateField`'s, from `src/segments`, and the\n// calendar is `Calendar` — so what this adds is the button between them and\n// the surface the calendar opens on.\n//\n// Two things are this component's own.\n//\n// **The picker is one field, not a field beside a button.** React Aria's\n// `Group` is what holds the segments and the trigger together, so the box\n// draws once around both and a reader tabs through the segments and reaches\n// the button at the end of them rather than as a separate control.\n//\n// **It is docked above the medium breakpoint and modal below it**, which is\n// the pairing the page draws: below the breakpoint the picker is a dialog,\n// centred over a scrim, and `Sheet` changes presentation at the same width.\n// It is done in CSS rather than by rendering a different tree: a 360dp\n// calendar anchored to a field is unreachable at 375px, and a modal that\n// stayed centred on a desktop would cover a form for no reason. `Sheet`\n// settles its own swap the same way, and doing it twice in two different\n// ways is how the two would drift. The styles are in `src/styles/picker.ts`.\n\ntype DatePickerProps<T extends DateValue = DateValue> = Omit<RACDatePickerProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the picker's render state. */\n className?: RACDatePickerProps<T>['className'];\n /**\n * Where to portal the calendar. Defaults to the container of the `ThemeScope`\n * around it, which keeps the calendar on that scope's tokens, or to the end\n * of `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the calendar\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * Whether the calendar's header draws the month and the year as menu\n * buttons, each opening a list of them in the grid's place — see\n * `Calendar`.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the picker's render state. */\n style?: RACDatePickerProps<T>['style'];\n /**\n * What the button that opens the calendar is called, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Calendar\" in\n * English, followed by the field's own label.\n */\n triggerLabel?: string;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n /**\n * How much of the calendar shows at once: `{ months: 2 }` draws two\n * months side by side. Below the expanded breakpoint, where two do not\n * fit, they stack instead — see `Calendar`.\n * @default { months: 1 }\n */\n visibleDuration?: DateDuration;\n};\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-jsx-as-prop is after — the same reason Select builds its\n// chevron this way.\nfunction calendarTrigger(triggerLabel: string | undefined) {\n return <RACButton aria-label={triggerLabel} className={triggerClassName}>\n <CalendarGlyph {...stylex.props(picker.triggerGlyph)} />\n </RACButton>;\n}\n\n/**\n * A date typed into a field, or picked from a calendar behind a button. The\n * value is React Aria's — pass `value` with `onChange` to control it, or\n * `defaultValue` — as an `@internationalized/date` value from this package's\n * `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DatePicker defaultValue={new CalendarDate(2026, 9, 15)} label=\"Label\" />\n * ```\n *\n * The segments are `DateField`'s and the calendar is `Calendar`, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` all behave\n * as they do there. Above the medium breakpoint the calendar is docked to\n * the field; below it, it opens centred, which is the page's modal picker.\n *\n * The call site's `className` and `style` land on the picker as a whole,\n * which is the element a layout positions.\n */\nfunction DatePicker<T extends DateValue>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n showMonthYearMenus = false,\n triggerLabel,\n variant = 'filled',\n visibleDuration,\n ...props\n}: DatePickerProps<T> & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACDatePicker<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys exactly one thing: the outlined\n // notch. The box decides populated twice over — in CSS for the\n // label's type, and in React for the notch, since CSS cannot cut an\n // outline to a width it has no way to measure. React Aria renders a\n // hidden `<input type=\"date\">` carrying no placeholder, so the CSS\n // half reads as populated on its own; the React half reads React\n // Aria's input context, which a picker does not provide. Without\n // this the notch stays shut across segments already showing\n // `mm/dd/yyyy`.\n isPopulated isRequired={props.isRequired} label={label} leading={leadingIcon}\n // In the chrome's trailing slot rather than on the segments' line,\n // which is where Select and ComboBox put their chevron. The slot\n // cancels the box's top padding and stretches to its full height, so\n // it centres the 40dp trigger in the box; on the line the trigger\n // was taller than the row that held it and hung past the underline,\n // and the segments centred on it rather than on their own line.\n //\n // React Aria's `DatePicker` is what gives the trigger its press\n // behaviour, through context, so the slot reaches it as well as the\n // group did.\n trailing={calendarTrigger(triggerLabel)} variant={variant}>\n <FieldSegments>\n <RACGroup {...stylex.props(picker.group)}>\n <RACDateInput {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </RACGroup>\n </FieldSegments>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={datePopoverClassName}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n <Calendar aria-label={label} showMonthYearMenus={showMonthYearMenus} visibleDuration={visibleDuration} />\n </RACDialog>\n </RACPopover>\n </RACDatePicker>;\n}\nexport type { DatePickerProps };\nexport default DatePicker;"],"mappings":";;;;;;;;;;;;;;;;AA4GA,SAASyB,gBAAgBH,cAAkC;CACzD,OAAO,oBAACoC,QAAD;EAAW,cAAYpC;EAAc,WAAWR;EACnD,UAAA,oBAAC,eAAD,EAAe,GAAIb,MAAaY,OAAOc,YAAY,EAAE,CAAA;CAC5C,CAAA;AACf;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAAzB,aAAA0B,IAAA;CAAA,MAAAC,IAAA7B,EAAA,EAAA;CAAyC,MAAA,EAAAe,WAAAC,aAAAC,OAAAC,eAAAY,IAAAC,YAAAC,IAAAb,OAAAC,aAAAC,oBAAAY,IAAAX,cAAAC,SAA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BwC,UAAAA;EAHS,CAAA;EAME1B,EAAA,MAAAd;EAAAc,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;CAAA,OAAAA,MAAA3B,EAAA;CAAA,IAAA4B;CAAA,IAAA5B,EAAA,QAAAQ,MAAAR,EAAA,QAAAE,cAAAF,EAAA,QAAAH,WAAAG,EAAA,QAAAqB,OAAArB,EAAA,QAAAsB,OAAAtB,EAAA,QAAA2B,OAAA3B,EAAA,QAAAS,MAAAT,EAAA,QAAAU,MAAAV,EAAA,QAAAO,oBAAA;EAtCVqB,MAAA,qBAAC,IAAD;GAA8B1B;GAAuB,WAAAO;GAAwCF;GAAkB,GAAMV;GAAK,GAAMa;GAAhI,UAAA;IACHW;IA8BAC;IACAK;GAhCiB;;EAuCH3B,EAAA,MAAAQ;EAAAR,EAAA,MAAAE;EAAAF,EAAA,MAAAH;EAAAG,EAAA,MAAAqB;EAAArB,EAAA,MAAAsB;EAAAtB,EAAA,MAAA2B;EAAA3B,EAAA,MAAAS;EAAAT,EAAA,MAAAU;EAAAV,EAAA,MAAAO;EAAAP,EAAA,MAAA4B;CAAA,OAAAA,MAAA5B,EAAA;CAAA,OAvCX4B;AAuCW"}
@@ -99,5 +99,4 @@ type DateRangePickerProps$1<T extends DateValue = DateValue> = Omit<DateRangePic
99
99
  * which is the element a layout positions.
100
100
  */
101
101
  declare function DateRangePicker$1<T extends DateValue>({ container, description, error, floatingLabel, isDisabled, label, leadingIcon, separator, showMonthYearMenus, triggerLabel, variant, visibleDuration, ...props }: DateRangePickerProps$1<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
102
- export { type DateRangePickerProps$1 as DateRangePickerProps, DateRangePicker$1 as default };
103
- //# sourceMappingURL=index.d.ts.map
102
+ export { type DateRangePickerProps$1 as DateRangePickerProps, DateRangePicker$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","DateDuration","ReactNode","RefAttributes","DateValue","DateRangePickerProps","RACDateRangePickerProps","stylex","useLayoutEffect","useState","Button","RACButton","DateInput","RACDateInput","DateRangePicker","RACDateRangePicker","Dialog","RACDialog","Group","RACGroup","Popover","RACPopover","FieldVariant","FieldBox","FieldMessage","FieldSegments","fieldStyles","invalidFrom","useFieldValidationBehavior","CalendarGlyph","renderSegment","segmentStyles","focus","mergeStatefulStyles","overlay","datePopoverClassName","picker","triggerClassName","colors","typography","RangeCalendar","styles","groupWrapped","kwnvtZ","khm7nJ","$$css","Omit","T","className","container","Element","description","error","floatingLabel","label","leadingIcon","separator","showMonthYearMenus","style","triggerLabel","variant","visibleDuration","calendarTrigger","props","triggerGlyph","t0","$","t1","isDisabled","t2","t3","t4","t5","undefined","validationBehavior","group","setGroup","wrapped","useEndDateWrap","T0","t6","t7","root","t8","isRequired","t9","t10","t11","Symbol","for","input","t12","t13","t14","t15","t16","t17","t18","popupDialog","ring","t19","t20","t21","setWrapped","decidedAt","measure","room","getBoundingClientRect","width","parts","children","filter","_temp","gap","Number","parseFloat","getComputedStyle","columnGap","needs","reduce","_temp2","length","fits","redecide","resize","ResizeObserver","observe","part_1","part","document","fonts","addEventListener","disconnect","removeEventListener","sum","part_0","height","RACButton","stylex.props","DateRangePicker","_c","props","RACDateRangePicker","RACDateInput","RACGroup","RACDialog","RangeCalendar","RACPopover"],"sources":["../../../src/components/date-range-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { DateDuration } from '@internationalized/date';\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DateValue, DateRangePickerProps as RACDateRangePickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useLayoutEffect, useState } from 'react';\nimport { Button as RACButton, DateInput as RACDateInput, DateRangePicker as RACDateRangePicker, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldSegments } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CalendarGlyph } from '../../glyphs';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { datePopoverClassName, picker, triggerClassName } from '../../styles/picker';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\nimport RangeCalendar from '../range-calendar';\n\n// `DatePicker` picking two dates rather than one. Every part it draws is\n// already here — the segments from `src/segments`, the trigger and the\n// overlay from `src/styles/picker`, the calendar from `RangeCalendar` — so\n// the two pickers cannot come apart. What a range adds is a second segment\n// group and the dash between them.\n//\n// The date pickers page draws a range as a configuration of the *modal*\n// picker: a full-screen selector with a header and two text fields, plus a\n// modal date input variant. It carries no docked range picker and no range\n// token of its own — its token set is `docked.*` and `modal.*`, and neither\n// names a range. So the docked shape here follows the docked single picker,\n// the same choice `RangeCalendar` records for the band it draws.\n//\n// Two things are this component's own.\n//\n// **The dash is decoration, not content.** It reads as a range to someone\n// looking, and React Aria has already told a screen reader which group is\n// which — every segment is named \"Start Date\" or \"End Date\" — so repeating\n// it aloud would be a third telling. It is `aria-hidden` and takes the muted\n// role, which is what keeps it quieter than the dates either side.\n//\n// **Both segment groups and the trigger sit in one React Aria `Group`.** The\n// box draws once around all three, so a reader tabs start, end, trigger\n// rather than meeting three controls in a row.\n//\n// **The end date takes a line of its own where the two do not fit on one.**\n// The line the segments sit on clips them, as an input clips its text, and\n// two dates and the dash are wider than a phone's field: at 328px the empty\n// field showed 212px of the 281px its placeholders take, so most of the end\n// date was out of sight until it was typed in. Every segment is a place to\n// type, so none can be hidden, and shortening the placeholders would not hold\n// for a locale whose dates are longer. So the two groups wrap, the dash stays\n// after the start date, and the box grows by a line, as a text area's does,\n// from the page's 56dp. Where both fit, nothing moves: the box is 56dp and\n// the dates share their line.\n//\n// The wrap is decided by the line's width, and typing never undoes it. A date\n// is narrower filled than empty — `9` where `mm` was — so a field between the\n// two widths, which is where a 375 to 400px phone puts it, would otherwise\n// lift the end date back up beside the start and shrink the box while the\n// start date was being typed. So the end date goes onto its own line whenever\n// the three stop fitting, and comes back only when the line's width changes\n// or a font arrives — see `useEndDateWrap`.\n\nconst styles = {\n groupWrapped: {\n kwnvtZ: \"x1a02dak\",\n khm7nJ: \"xxs79tx\",\n $$css: true\n }\n};\ntype DateRangePickerProps<T extends DateValue = DateValue> = Omit<RACDateRangePickerProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the picker's render state. */\n className?: RACDateRangePickerProps<T>['className'];\n /**\n * Where to portal the calendar. Defaults to the container of the `ThemeScope`\n * around it, which keeps the calendar on that scope's tokens, or to the end\n * of `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the calendar\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * What is drawn between the two segment groups. Decoration — a screen\n * reader is told which group is which by React Aria.\n * @default '–'\n */\n separator?: string;\n /**\n * Whether the calendar's header draws the month and the year as menu\n * buttons, each opening a list of them in the grid's place — see\n * `RangeCalendar`.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the picker's render state. */\n style?: RACDateRangePickerProps<T>['style'];\n /**\n * What the button that opens the calendar is called, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Calendar\" in\n * English, followed by the field's own label.\n */\n triggerLabel?: string;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n /**\n * How much of the calendar shows at once: `{ months: 2 }` draws two\n * months side by side, which is what a range is usually picked from.\n * Below the expanded breakpoint, where two do not fit, they stack instead\n * — see `RangeCalendar`.\n * @default { months: 1 }\n */\n visibleDuration?: DateDuration;\n};\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-jsx-as-prop is after — the same reason Select builds its\n// chevron this way.\nfunction calendarTrigger(triggerLabel: string | undefined) {\n return <RACButton aria-label={triggerLabel} className={triggerClassName}>\n <CalendarGlyph {...stylex.props(picker.triggerGlyph)} />\n </RACButton>;\n}\n\n/**\n * A date range typed into a field, or picked from a calendar behind a\n * button. The value is React Aria's — pass `value` with `onChange` to\n * control it, or `defaultValue` — as a `{ start, end }` pair of\n * `@internationalized/date` values from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DateRangePicker\n * defaultValue={{\n * end: new CalendarDate(2026, 9, 20),\n * start: new CalendarDate(2026, 9, 15),\n * }}\n * label=\"Label\"\n * />\n * ```\n *\n * The segments are `DateField`'s and the calendar is `RangeCalendar`, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` all behave\n * as they do there. Above the medium breakpoint the calendar is docked to\n * the field; below it, it opens centred, the same swap `DatePicker` makes.\n *\n * The call site's `className` and `style` land on the picker as a whole,\n * which is the element a layout positions.\n */\nfunction DateRangePicker<T extends DateValue>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n separator = '–',\n showMonthYearMenus = false,\n triggerLabel,\n variant = 'filled',\n visibleDuration,\n ...props\n}: DateRangePickerProps<T> & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n const [group, setGroup] = useState<HTMLDivElement | null>(null);\n const wrapped = useEndDateWrap(group);\n return <RACDateRangePicker<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys exactly one thing: the outlined\n // notch. The box decides populated twice over — in CSS for the\n // label's type, and in React for the notch, since CSS cannot cut an\n // outline to a width it has no way to measure. React Aria renders a\n // hidden input per segment group, neither carrying a placeholder, so\n // the CSS half reads as populated on its own; the React half reads\n // React Aria's input context, which a picker does not provide.\n // Without this the notch stays shut across segments already showing\n // `mm/dd/yyyy`.\n isPopulated isRequired={props.isRequired} label={label} leading={leadingIcon}\n // Grows by a line while the end date is on one of its own, and is\n // the page's 56dp otherwise — see the header.\n multiline\n // In the chrome's trailing slot rather than on the segments' line —\n // see the same prop on DatePicker for what that slot does and why\n // the trigger still opens from there.\n trailing={calendarTrigger(triggerLabel)} variant={variant}>\n <FieldSegments>\n <RACGroup ref={setGroup} {...stylex.props(picker.group, wrapped && styles.groupWrapped)}>\n <RACDateInput slot=\"start\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n <span aria-hidden=\"true\" className=\"x1w5n3ug x2lah0s x16svsjw x1848etk xh7dzej\">\n {separator}\n </span>\n {wrapped && <span aria-hidden=\"true\" className=\"xqtp20y x9f619 x1l7klhg\" />}\n <RACDateInput slot=\"end\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </RACGroup>\n </FieldSegments>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={datePopoverClassName}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n <RangeCalendar aria-label={label} showMonthYearMenus={showMonthYearMenus} visibleDuration={visibleDuration} />\n </RACDialog>\n </RACPopover>\n </RACDateRangePicker>;\n}\n\n/**\n * Whether the end date takes a line of its own: whenever the start date, the\n * dash and the end date are wider together than the line they sit on.\n *\n * Decided afresh when the line's width changes or a font finishes loading,\n * and otherwise only ever turned on, so a date narrowing as it is typed\n * never moves the end date back up mid-entry — see the header. Read off the\n * three parts' own widths rather than the line's overflow, since a wrapped\n * line overflows nothing.\n */\nfunction useEndDateWrap(group: HTMLElement | null) {\n const [wrapped, setWrapped] = useState(false);\n useLayoutEffect(() => {\n if (group === null) {\n return undefined;\n }\n let decidedAt: null | number = null;\n const measure = () => {\n const room = group.getBoundingClientRect().width;\n // React Aria's hidden inputs sit in the group too, and so does the\n // break while the end date is held down. Neither takes a line's height,\n // and neither is a part the line has to hold.\n const parts = [...group.children].filter(part => part.getBoundingClientRect().height > 0);\n const gap = Number.parseFloat(getComputedStyle(group).columnGap) || 0;\n const needs = parts.reduce((sum, part) => sum + part.getBoundingClientRect().width, gap * (parts.length - 1));\n const fits = needs <= room + 0.5;\n if (room !== decidedAt) {\n decidedAt = room;\n setWrapped(!fits);\n } else if (!fits) {\n setWrapped(true);\n }\n };\n const redecide = () => {\n decidedAt = null;\n measure();\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(group);\n for (const part of group.children) {\n resize.observe(part);\n }\n document.fonts.addEventListener('loadingdone', redecide);\n return () => {\n resize.disconnect();\n document.fonts.removeEventListener('loadingdone', redecide);\n };\n }, [group]);\n return wrapped;\n}\nexport type { DateRangePickerProps };\nexport default DateRangePicker;"],"mappings":";;;;;;;;;;;;;;;;;AAkEA,MAAM0C,SAAS,EACbC,cAAc;CACZC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA2EA,SAASiB,gBAAgBH,cAAkC;CACzD,OAAO,oBAAC8E,QAAD;EAAW,cAAY9E;EAAc,WAAWtB;EACnD,UAAA,oBAAC,eAAD,EAAe,GAAI9B,MAAa6B,OAAO4B,YAAY,EAAE,CAAA;CAC5C,CAAA;AACf;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAAlD,kBAAAmD,IAAA;CAAA,MAAAC,IAAAlE,EAAA,EAAA;CAA8C,MAAA,EAAAiD,WAAAE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C,KAAK,CAAC,CAAA0C,SAAe,KAAxD;IAEZ,MAAAK,OADcb,MAAKU,OAAQC,QAAyDP,OAAOJ,MAAKY,SAAU,EAC7FH,KAASZ,OAAO;IAC7B,IAAIA,SAASF,WAAS;KACpBA,YAAYE;KACZH,WAAW,CAACmB,IAAI;IAAC,OACZ,IAAI,CAACA,MACVnB,WAAW,IAAI;GAChB;GAEH,MAAAoB,iBAAiB;IACfnB,YAAYA;IACZC,QAAQ;GAAC;GAEXA,QAAQ;GACR,MAAAmB,SAAe,IAAIC,eAAepB,OAAO;GACzCmB,OAAME,QAASnD,KAAK;GACpB,KAAK,MAAAoD,UAAcpD,MAAKmC,UACtBc,OAAME,QAASE,MAAI;GAErBC,SAAQC,MAAMC,iBAAkB,eAAeR,QAAQ;GAAC,aACjD;IACLC,OAAMQ,WAAY;IAClBH,SAAQC,MAAMG,oBAAqB,eAAeV,QAAQ;GAAC;EAC5D;EACAxD,KAAA,CAACQ,KAAK;EAACT,EAAA,KAAAS;EAAAT,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAA;EAAAF,KAAAC,EAAA;EAAAC,KAAAD,EAAA;CAAA;CApCV1D,gBAAgByD,IAoCbE,EAAO;CAAC,OACJU;AAAO;AAvChB,SAAA2C,OAAAc,KAAAC,QAAA;CAAA,OAcgDD,MAAMN,OAAIrB,sBAAuB,CAAC,CAAAC;AAAM;AAdxF,SAAAI,MAAAgB,MAAA;CAAA,OAYuDA,KAAIrB,sBAAuB,CAAC,CAAA6B,SAAU;AAAC"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","useLayoutEffect","useState","DateRangePicker","RACDateRangePicker","fieldStyles","invalidFrom","useFieldValidationBehavior","renderSegment","segmentStyles","focus","mergeStatefulStyles","overlay","datePopoverClassName","picker","triggerClassName","styles","groupWrapped","kwnvtZ","khm7nJ","$$css","container","description","error","floatingLabel","label","leadingIcon","separator","showMonthYearMenus","triggerLabel","variant","visibleDuration","calendarTrigger","props","triggerGlyph","t0","$","t1","isDisabled","t2","t3","t4","t5","undefined","validationBehavior","group","setGroup","wrapped","useEndDateWrap","T0","t6","t7","root","t8","isRequired","t9","t10","t11","Symbol","for","input","t12","t13","t14","t15","t16","t17","t18","popupDialog","ring","t19","t20","t21","setWrapped","decidedAt","measure","room","getBoundingClientRect","width","parts","children","filter","_temp","gap","Number","parseFloat","getComputedStyle","columnGap","needs","reduce","_temp2","length","fits","redecide","resize","ResizeObserver","observe","part_1","part","document","fonts","addEventListener","disconnect","removeEventListener","sum","part_0","height","RACButton","RACDateInput","RACGroup","RACDialog","RangeCalendar","RACPopover"],"sources":["../../../src/components/date-range-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { DateDuration } from '@internationalized/date';\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { DateValue, DateRangePickerProps as RACDateRangePickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useLayoutEffect, useState } from 'react';\nimport { Button as RACButton, DateInput as RACDateInput, DateRangePicker as RACDateRangePicker, Dialog as RACDialog, Group as RACGroup, Popover as RACPopover } from 'react-aria-components';\nimport type { FieldVariant } from '../../field';\nimport { FieldBox, FieldMessage, FieldSegments } from '../../field';\nimport { fieldStyles, invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CalendarGlyph } from '../../glyphs';\nimport { renderSegment } from '../../segments';\nimport { segmentStyles } from '../../segments/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport { overlay } from '../../styles/overlay';\nimport { datePopoverClassName, picker, triggerClassName } from '../../styles/picker';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, typography } from '../../tokens/design.tokens.stylex';\nimport RangeCalendar from '../range-calendar';\n\n// `DatePicker` picking two dates rather than one. Every part it draws is\n// already here — the segments from `src/segments`, the trigger and the\n// overlay from `src/styles/picker`, the calendar from `RangeCalendar` — so\n// the two pickers cannot come apart. What a range adds is a second segment\n// group and the dash between them.\n//\n// The date pickers page draws a range as a configuration of the *modal*\n// picker: a full-screen selector with a header and two text fields, plus a\n// modal date input variant. It carries no docked range picker and no range\n// token of its own — its token set is `docked.*` and `modal.*`, and neither\n// names a range. So the docked shape here follows the docked single picker,\n// the same choice `RangeCalendar` records for the band it draws.\n//\n// Two things are this component's own.\n//\n// **The dash is decoration, not content.** It reads as a range to someone\n// looking, and React Aria has already told a screen reader which group is\n// which — every segment is named \"Start Date\" or \"End Date\" — so repeating\n// it aloud would be a third telling. It is `aria-hidden` and takes the muted\n// role, which is what keeps it quieter than the dates either side.\n//\n// **Both segment groups and the trigger sit in one React Aria `Group`.** The\n// box draws once around all three, so a reader tabs start, end, trigger\n// rather than meeting three controls in a row.\n//\n// **The end date takes a line of its own where the two do not fit on one.**\n// The line the segments sit on clips them, as an input clips its text, and\n// two dates and the dash are wider than a phone's field: at 328px the empty\n// field showed 212px of the 281px its placeholders take, so most of the end\n// date was out of sight until it was typed in. Every segment is a place to\n// type, so none can be hidden, and shortening the placeholders would not hold\n// for a locale whose dates are longer. So the two groups wrap, the dash stays\n// after the start date, and the box grows by a line, as a text area's does,\n// from the page's 56dp. Where both fit, nothing moves: the box is 56dp and\n// the dates share their line.\n//\n// The wrap is decided by the line's width, and typing never undoes it. A date\n// is narrower filled than empty — `9` where `mm` was — so a field between the\n// two widths, which is where a 375 to 400px phone puts it, would otherwise\n// lift the end date back up beside the start and shrink the box while the\n// start date was being typed. So the end date goes onto its own line whenever\n// the three stop fitting, and comes back only when the line's width changes\n// or a font arrives — see `useEndDateWrap`.\n\nconst styles = {\n groupWrapped: {\n kwnvtZ: \"x1a02dak\",\n khm7nJ: \"xxs79tx\",\n $$css: true\n }\n};\ntype DateRangePickerProps<T extends DateValue = DateValue> = Omit<RACDateRangePickerProps<T>, 'children' | 'className' | 'style'> & {\n /** A function may compute the class from the picker's render state. */\n className?: RACDateRangePickerProps<T>['className'];\n /**\n * Where to portal the calendar. Defaults to the container of the `ThemeScope`\n * around it, which keeps the calendar on that scope's tokens, or to the end\n * of `<body>` where there is none. A subtree themed through the `themeScope`\n * class has no container of its own, so point this inside it, or the calendar\n * renders outside and keeps the page's tokens.\n */\n container?: Element;\n /** Supporting text under the field. */\n description?: string;\n /**\n * The message shown instead of the description, which also marks the\n * field invalid.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * Whether the label floats into the box's top once the field holds a\n * value, rather than sitting above it.\n * @default true\n */\n floatingLabel?: boolean;\n /** What the field is for. Always rendered; never a placeholder. */\n label: string;\n /**\n * An icon at the box's leading end, in the page's 24dp size. An icon drawn\n * in `em` takes that size from the slot.\n */\n leadingIcon?: ReactNode;\n /**\n * What is drawn between the two segment groups. Decoration — a screen\n * reader is told which group is which by React Aria.\n * @default '–'\n */\n separator?: string;\n /**\n * Whether the calendar's header draws the month and the year as menu\n * buttons, each opening a list of them in the grid's place — see\n * `RangeCalendar`.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the picker's render state. */\n style?: RACDateRangePickerProps<T>['style'];\n /**\n * What the button that opens the calendar is called, for a screen reader.\n * Left out, React Aria names it in the reader's locale — \"Calendar\" in\n * English, followed by the field's own label.\n */\n triggerLabel?: string;\n /**\n * Which of the text fields page's two boxes to draw.\n * @default 'filled'\n */\n variant?: FieldVariant;\n /**\n * How much of the calendar shows at once: `{ months: 2 }` draws two\n * months side by side, which is what a range is usually picked from.\n * Below the expanded breakpoint, where two do not fit, they stack instead\n * — see `RangeCalendar`.\n * @default { months: 1 }\n */\n visibleDuration?: DateDuration;\n};\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-jsx-as-prop is after — the same reason Select builds its\n// chevron this way.\nfunction calendarTrigger(triggerLabel: string | undefined) {\n return <RACButton aria-label={triggerLabel} className={triggerClassName}>\n <CalendarGlyph {...stylex.props(picker.triggerGlyph)} />\n </RACButton>;\n}\n\n/**\n * A date range typed into a field, or picked from a calendar behind a\n * button. The value is React Aria's — pass `value` with `onChange` to\n * control it, or `defaultValue` — as a `{ start, end }` pair of\n * `@internationalized/date` values from this package's `./date` subpath.\n *\n * ```tsx\n * import { CalendarDate } from '@kanso-labs/kanso-ui/date'\n *\n * <DateRangePicker\n * defaultValue={{\n * end: new CalendarDate(2026, 9, 20),\n * start: new CalendarDate(2026, 9, 15),\n * }}\n * label=\"Label\"\n * />\n * ```\n *\n * The segments are `DateField`'s and the calendar is `RangeCalendar`, so\n * `granularity`, `minValue`, `maxValue` and `isDateUnavailable` all behave\n * as they do there. Above the medium breakpoint the calendar is docked to\n * the field; below it, it opens centred, the same swap `DatePicker` makes.\n *\n * The call site's `className` and `style` land on the picker as a whole,\n * which is the element a layout positions.\n */\nfunction DateRangePicker<T extends DateValue>({\n container,\n description,\n error,\n floatingLabel = true,\n isDisabled = false,\n label,\n leadingIcon,\n separator = '–',\n showMonthYearMenus = false,\n triggerLabel,\n variant = 'filled',\n visibleDuration,\n ...props\n}: DateRangePickerProps<T> & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n const [group, setGroup] = useState<HTMLDivElement | null>(null);\n const wrapped = useEndDateWrap(group);\n return <RACDateRangePicker<T> isDisabled={isDisabled} isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(fieldStyles.root), props)}>\n <FieldBox floatingLabel={floatingLabel}\n // Always populated, which buys exactly one thing: the outlined\n // notch. The box decides populated twice over — in CSS for the\n // label's type, and in React for the notch, since CSS cannot cut an\n // outline to a width it has no way to measure. React Aria renders a\n // hidden input per segment group, neither carrying a placeholder, so\n // the CSS half reads as populated on its own; the React half reads\n // React Aria's input context, which a picker does not provide.\n // Without this the notch stays shut across segments already showing\n // `mm/dd/yyyy`.\n isPopulated isRequired={props.isRequired} label={label} leading={leadingIcon}\n // Grows by a line while the end date is on one of its own, and is\n // the page's 56dp otherwise — see the header.\n multiline\n // In the chrome's trailing slot rather than on the segments' line —\n // see the same prop on DatePicker for what that slot does and why\n // the trigger still opens from there.\n trailing={calendarTrigger(triggerLabel)} variant={variant}>\n <FieldSegments>\n <RACGroup ref={setGroup} {...stylex.props(picker.group, wrapped && styles.groupWrapped)}>\n <RACDateInput slot=\"start\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n <span aria-hidden=\"true\" className=\"x1w5n3ug x2lah0s x16svsjw x1848etk xh7dzej\">\n {separator}\n </span>\n {wrapped && <span aria-hidden=\"true\" className=\"xqtp20y x9f619 x1l7klhg\" />}\n <RACDateInput slot=\"end\" {...stylex.props(segmentStyles.input)}>\n {renderSegment}\n </RACDateInput>\n </RACGroup>\n </FieldSegments>\n </FieldBox>\n <FieldMessage description={description} error={error} />\n <RACPopover className={datePopoverClassName}\n // oxlint-disable-next-line typescript/no-deprecated -- its replacement, UNSAFE_PortalProvider, is not exported by react-aria-components\n UNSTABLE_portalContainer={container}>\n <RACDialog {...stylex.props(overlay.popupDialog, focus.ring)}>\n <RangeCalendar aria-label={label} showMonthYearMenus={showMonthYearMenus} visibleDuration={visibleDuration} />\n </RACDialog>\n </RACPopover>\n </RACDateRangePicker>;\n}\n\n/**\n * Whether the end date takes a line of its own: whenever the start date, the\n * dash and the end date are wider together than the line they sit on.\n *\n * Decided afresh when the line's width changes or a font finishes loading,\n * and otherwise only ever turned on, so a date narrowing as it is typed\n * never moves the end date back up mid-entry — see the header. Read off the\n * three parts' own widths rather than the line's overflow, since a wrapped\n * line overflows nothing.\n */\nfunction useEndDateWrap(group: HTMLElement | null) {\n const [wrapped, setWrapped] = useState(false);\n useLayoutEffect(() => {\n if (group === null) {\n return undefined;\n }\n let decidedAt: null | number = null;\n const measure = () => {\n const room = group.getBoundingClientRect().width;\n // React Aria's hidden inputs sit in the group too, and so does the\n // break while the end date is held down. Neither takes a line's height,\n // and neither is a part the line has to hold.\n const parts = [...group.children].filter(part => part.getBoundingClientRect().height > 0);\n const gap = Number.parseFloat(getComputedStyle(group).columnGap) || 0;\n const needs = parts.reduce((sum, part) => sum + part.getBoundingClientRect().width, gap * (parts.length - 1));\n const fits = needs <= room + 0.5;\n if (room !== decidedAt) {\n decidedAt = room;\n setWrapped(!fits);\n } else if (!fits) {\n setWrapped(true);\n }\n };\n const redecide = () => {\n decidedAt = null;\n measure();\n };\n measure();\n const resize = new ResizeObserver(measure);\n resize.observe(group);\n for (const part of group.children) {\n resize.observe(part);\n }\n document.fonts.addEventListener('loadingdone', redecide);\n return () => {\n resize.disconnect();\n document.fonts.removeEventListener('loadingdone', redecide);\n };\n }, [group]);\n return wrapped;\n}\nexport type { DateRangePickerProps };\nexport default DateRangePicker;"],"mappings":";;;;;;;;;;;;;;;;;AAkEA,MAAMiB,SAAS,EACbC,cAAc;CACZC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA2EA,SAASY,gBAAgBH,cAAkC;CACzD,OAAO,oBAAC8E,QAAD;EAAW,cAAY9E;EAAc,WAAWd;EACnD,UAAA,oBAAC,eAAD,EAAe,GAAIf,MAAac,OAAOoB,YAAY,EAAE,CAAA;CAC5C,CAAA;AACf;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAA/B,kBAAAgC,IAAA;CAAA,MAAAC,IAAArC,EAAA,EAAA;CAA8C,MAAA,EAAAsB,WAAAC,aAAAC,OAAAC,eAAAa,IAAAC,YAAAC,IAAAd,OAAAC,aAAAC,WAAAa,IAAAZ,oBAAAa,IAAAZ,cAAAC,SAAAY,IAAAX,iBAAA,GAAAE,YAAAE;CAI5C,MAAAX,gBAAAa,OAAAM,KAAAA,IAAA,OAAAN;CACA,MAAAC,aAAAC,OAAAI,KAAAA,IAAA,QAAAJ;CAGA,MAAAZ,YAAAa,OAAAG,KAAAA,IAAA,MAAAH;CACA,MAAAZ,qBAAAa,OAAAE,KAAAA,IAAA,QAAAF;CAEA,MAAAX,UAAAY,OAAAC,KAAAA,IAAA,WAAAD;CAIA,MAAAE,qBAA2BrC,2BAA2B;CACtD,MAA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AASE,MAAI;GAErBC,SAAQC,MAAMC,iBAAkB,eAAeR,QAAQ;GAAC,aACjD;IACLC,OAAMQ,WAAY;IAClBH,SAAQC,MAAMG,oBAAqB,eAAeV,QAAQ;GAAC;EAC5D;EACAxD,KAAA,CAACQ,KAAK;EAACT,EAAA,KAAAS;EAAAT,EAAA,KAAAD;EAAAC,EAAA,KAAAC;CAAA,OAAA;EAAAF,KAAAC,EAAA;EAAAC,KAAAD,EAAA;CAAA;CApCVnC,gBAAgBkC,IAoCbE,EAAO;CAAC,OACJU;AAAO;AAvChB,SAAA2C,OAAAc,KAAAC,QAAA;CAAA,OAcgDD,MAAMN,OAAIrB,sBAAuB,CAAC,CAAAC;AAAM;AAdxF,SAAAI,MAAAgB,MAAA;CAAA,OAYuDA,KAAIrB,sBAAuB,CAAC,CAAA6B,SAAU;AAAC"}
@@ -128,5 +128,4 @@ type DialogContentProps = {
128
128
  style?: StyleOrFunction<ModalRenderProps>;
129
129
  } & Omit<DialogProps, 'className' | 'style'> & Pick<ModalOverlayProps, 'defaultOpen' | 'isKeyboardDismissDisabled' | 'isOpen' | 'onOpenChange'>;
130
130
  type DialogTitleProps = HeadingProps;
131
- export { DialogBody, DialogContent, type DialogContentProps, DialogFooter, DialogHeader, type DialogProps$1 as DialogProps, DialogTitle, type DialogTitleProps, Dialog$1 as default };
132
- //# sourceMappingURL=index.d.ts.map
131
+ export { DialogBody, DialogContent, type DialogContentProps, DialogFooter, DialogHeader, type DialogProps$1 as DialogProps, DialogTitle, type DialogTitleProps, Dialog$1 as default };