@namroodinc/liquid-editorial 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/README.md +1 -1
  2. package/UPGRADING.md +47 -0
  3. package/dist/chunks/{Avatar-Dw7EWd_-.cjs → Avatar-BZGFSE6C.cjs} +2 -2
  4. package/dist/chunks/{Avatar-Dw7EWd_-.cjs.map → Avatar-BZGFSE6C.cjs.map} +1 -1
  5. package/dist/chunks/{Avatar-BToMaTdL.js → Avatar-C4W-g8nU.js} +2 -2
  6. package/dist/chunks/{Avatar-BToMaTdL.js.map → Avatar-C4W-g8nU.js.map} +1 -1
  7. package/dist/chunks/{Board-XeDG9nWP.js → Board-Cbi5FMW-.js} +2 -2
  8. package/dist/chunks/{Board-XeDG9nWP.js.map → Board-Cbi5FMW-.js.map} +1 -1
  9. package/dist/chunks/{Board-DeXtaWNO.cjs → Board-_agEjTy8.cjs} +2 -2
  10. package/dist/chunks/{Board-DeXtaWNO.cjs.map → Board-_agEjTy8.cjs.map} +1 -1
  11. package/dist/chunks/{CollectionView-Dbg4d_tA.cjs → CollectionView-BfX2Lxre.cjs} +2 -2
  12. package/dist/chunks/{CollectionView-Dbg4d_tA.cjs.map → CollectionView-BfX2Lxre.cjs.map} +1 -1
  13. package/dist/chunks/{CollectionView-C0_bTO2v.js → CollectionView-DPJGtSP5.js} +2 -2
  14. package/dist/chunks/{CollectionView-C0_bTO2v.js.map → CollectionView-DPJGtSP5.js.map} +1 -1
  15. package/dist/chunks/{ColourField-DAFzOIOq.cjs → ColourField-BVGnW8Wh.cjs} +2 -2
  16. package/dist/chunks/{ColourField-DAFzOIOq.cjs.map → ColourField-BVGnW8Wh.cjs.map} +1 -1
  17. package/dist/chunks/{ColourField-Bb8H87fg.js → ColourField-BcuARZY4.js} +6 -6
  18. package/dist/chunks/{ColourField-Bb8H87fg.js.map → ColourField-BcuARZY4.js.map} +1 -1
  19. package/dist/chunks/{DatePicker-COm1giw8.js → DatePicker-VQUsbYdo.js} +3 -3
  20. package/dist/chunks/{DatePicker-COm1giw8.js.map → DatePicker-VQUsbYdo.js.map} +1 -1
  21. package/dist/chunks/{DatePicker-DOg3iQYy.cjs → DatePicker-zA0bWVBp.cjs} +2 -2
  22. package/dist/chunks/{DatePicker-DOg3iQYy.cjs.map → DatePicker-zA0bWVBp.cjs.map} +1 -1
  23. package/dist/chunks/{Drawer-nUTJtwX_.js → Drawer-2cf0SaG4.js} +3 -3
  24. package/dist/chunks/{Drawer-nUTJtwX_.js.map → Drawer-2cf0SaG4.js.map} +1 -1
  25. package/dist/chunks/{Drawer-B2dcTh5l.cjs → Drawer-BzvSfkCL.cjs} +2 -2
  26. package/dist/chunks/{Drawer-B2dcTh5l.cjs.map → Drawer-BzvSfkCL.cjs.map} +1 -1
  27. package/dist/chunks/{EntryPicker-Ie9T47hA.js → EntryPicker-BGWxiLJ_.js} +7 -7
  28. package/dist/chunks/{EntryPicker-Ie9T47hA.js.map → EntryPicker-BGWxiLJ_.js.map} +1 -1
  29. package/dist/chunks/{EntryPicker-BwEYRtQl.cjs → EntryPicker-wVjzdlAO.cjs} +2 -2
  30. package/dist/chunks/{EntryPicker-BwEYRtQl.cjs.map → EntryPicker-wVjzdlAO.cjs.map} +1 -1
  31. package/dist/chunks/{FormEditor-DgDV5aeR.js → FormEditor-BHVJG23r.js} +2 -2
  32. package/dist/chunks/{FormEditor-DgDV5aeR.js.map → FormEditor-BHVJG23r.js.map} +1 -1
  33. package/dist/chunks/{FormEditor-D1HUnjMI.cjs → FormEditor-DjUz7qQo.cjs} +2 -2
  34. package/dist/chunks/{FormEditor-D1HUnjMI.cjs.map → FormEditor-DjUz7qQo.cjs.map} +1 -1
  35. package/dist/chunks/Icon-QLZH31JA.cjs +2 -0
  36. package/dist/chunks/Icon-QLZH31JA.cjs.map +1 -0
  37. package/dist/chunks/Icon-kLLQC54Z.js +107 -0
  38. package/dist/chunks/Icon-kLLQC54Z.js.map +1 -0
  39. package/dist/chunks/{Message-VJTPhId7.js → Message-DM6pTq7N.js} +2 -2
  40. package/dist/chunks/{Message-VJTPhId7.js.map → Message-DM6pTq7N.js.map} +1 -1
  41. package/dist/chunks/{Message-B0A5bz8V.cjs → Message-yZJDVzb8.cjs} +2 -2
  42. package/dist/chunks/{Message-B0A5bz8V.cjs.map → Message-yZJDVzb8.cjs.map} +1 -1
  43. package/dist/chunks/RichTextEditor-BgfeOrEe.cjs +2 -0
  44. package/dist/chunks/RichTextEditor-BgfeOrEe.cjs.map +1 -0
  45. package/dist/chunks/RichTextEditor-CS2ED0HP.js +2702 -0
  46. package/dist/chunks/RichTextEditor-CS2ED0HP.js.map +1 -0
  47. package/dist/chunks/dialogLabel-Dx-WEEzI.cjs +2 -0
  48. package/dist/chunks/dialogLabel-Dx-WEEzI.cjs.map +1 -0
  49. package/dist/chunks/dialogLabel-nB1gwKz0.js +157 -0
  50. package/dist/chunks/dialogLabel-nB1gwKz0.js.map +1 -0
  51. package/dist/chunks/overlayLayer-CPd3zj_u.cjs +2 -0
  52. package/dist/chunks/overlayLayer-CPd3zj_u.cjs.map +1 -0
  53. package/dist/chunks/overlayLayer-Dv1vmfaI.js +199 -0
  54. package/dist/chunks/overlayLayer-Dv1vmfaI.js.map +1 -0
  55. package/dist/chunks/{useTooltip-Du8PutGX.js → useTooltip-COyAcujL.js} +2 -2
  56. package/dist/chunks/{useTooltip-Du8PutGX.js.map → useTooltip-COyAcujL.js.map} +1 -1
  57. package/dist/chunks/{useTooltip-ekdwMJFz.cjs → useTooltip-nEDN0ObI.cjs} +2 -2
  58. package/dist/chunks/{useTooltip-ekdwMJFz.cjs.map → useTooltip-nEDN0ObI.cjs.map} +1 -1
  59. package/dist/components/AppShell/index.cjs +1 -1
  60. package/dist/components/AppShell/index.js +1 -1
  61. package/dist/components/AssetCard/index.cjs +1 -1
  62. package/dist/components/AssetCard/index.js +1 -1
  63. package/dist/components/AssetGrid/index.cjs +1 -1
  64. package/dist/components/AssetGrid/index.js +1 -1
  65. package/dist/components/Avatar/index.cjs +1 -1
  66. package/dist/components/Avatar/index.js +1 -1
  67. package/dist/components/Banner/index.cjs +1 -1
  68. package/dist/components/Banner/index.js +1 -1
  69. package/dist/components/Board/index.cjs +1 -1
  70. package/dist/components/Board/index.js +1 -1
  71. package/dist/components/Button/index.cjs +1 -1
  72. package/dist/components/Button/index.js +1 -1
  73. package/dist/components/CollectionView/index.cjs +1 -1
  74. package/dist/components/CollectionView/index.js +1 -1
  75. package/dist/components/ColourField/index.cjs +1 -1
  76. package/dist/components/ColourField/index.js +1 -1
  77. package/dist/components/DatePicker/index.cjs +1 -1
  78. package/dist/components/DatePicker/index.js +1 -1
  79. package/dist/components/Drawer/index.cjs +1 -1
  80. package/dist/components/Drawer/index.js +1 -1
  81. package/dist/components/EditLayout/index.cjs +1 -1
  82. package/dist/components/EditLayout/index.cjs.map +1 -1
  83. package/dist/components/EditLayout/index.js +6 -7
  84. package/dist/components/EditLayout/index.js.map +1 -1
  85. package/dist/components/EntryPicker/index.cjs +1 -1
  86. package/dist/components/EntryPicker/index.js +1 -1
  87. package/dist/components/EntryPicker/style.css +1 -1
  88. package/dist/components/FormEditor/README.md +72 -34
  89. package/dist/components/FormEditor/index.cjs +1 -1
  90. package/dist/components/FormEditor/index.js +2 -2
  91. package/dist/components/Icon/icons.d.cts +5 -0
  92. package/dist/components/Icon/icons.d.cts.map +1 -1
  93. package/dist/components/Icon/icons.d.ts +5 -0
  94. package/dist/components/Icon/icons.d.ts.map +1 -1
  95. package/dist/components/Icon/index.cjs +1 -1
  96. package/dist/components/Icon/index.js +1 -1
  97. package/dist/components/Menu/index.cjs +1 -1
  98. package/dist/components/Menu/index.js +9 -9
  99. package/dist/components/Menu/index.js.map +1 -1
  100. package/dist/components/Modal/index.cjs +1 -1
  101. package/dist/components/Modal/index.js +2 -2
  102. package/dist/components/Popover/index.cjs +1 -1
  103. package/dist/components/Popover/index.cjs.map +1 -1
  104. package/dist/components/Popover/index.d.cts.map +1 -1
  105. package/dist/components/Popover/index.d.ts.map +1 -1
  106. package/dist/components/Popover/index.js +67 -64
  107. package/dist/components/Popover/index.js.map +1 -1
  108. package/dist/components/RichTextEditor/content-block-frame.d.cts +32 -0
  109. package/dist/components/RichTextEditor/content-block-frame.d.cts.map +1 -0
  110. package/dist/components/RichTextEditor/content-block-frame.d.ts +32 -0
  111. package/dist/components/RichTextEditor/content-block-frame.d.ts.map +1 -0
  112. package/dist/components/RichTextEditor/content-block-view.d.cts +3 -0
  113. package/dist/components/RichTextEditor/content-block-view.d.cts.map +1 -0
  114. package/dist/components/RichTextEditor/content-block-view.d.ts +3 -0
  115. package/dist/components/RichTextEditor/content-block-view.d.ts.map +1 -0
  116. package/dist/components/RichTextEditor/content-block.d.cts +24 -0
  117. package/dist/components/RichTextEditor/content-block.d.cts.map +1 -0
  118. package/dist/components/RichTextEditor/content-block.d.ts +24 -0
  119. package/dist/components/RichTextEditor/content-block.d.ts.map +1 -0
  120. package/dist/components/RichTextEditor/document.d.cts +10 -7
  121. package/dist/components/RichTextEditor/document.d.cts.map +1 -1
  122. package/dist/components/RichTextEditor/document.d.ts +10 -7
  123. package/dist/components/RichTextEditor/document.d.ts.map +1 -1
  124. package/dist/components/RichTextEditor/index.cjs +1 -1
  125. package/dist/components/RichTextEditor/index.d.cts +1 -1
  126. package/dist/components/RichTextEditor/index.d.cts.map +1 -1
  127. package/dist/components/RichTextEditor/index.d.ts +1 -1
  128. package/dist/components/RichTextEditor/index.d.ts.map +1 -1
  129. package/dist/components/RichTextEditor/index.js +1 -1
  130. package/dist/components/RichTextEditor/style.css +126 -49
  131. package/dist/components/RichTextEditor/table-actions.d.cts +11 -0
  132. package/dist/components/RichTextEditor/table-actions.d.cts.map +1 -0
  133. package/dist/components/RichTextEditor/table-actions.d.ts +11 -0
  134. package/dist/components/RichTextEditor/table-actions.d.ts.map +1 -0
  135. package/dist/components/RichTextEditor/table-bands.d.cts +19 -0
  136. package/dist/components/RichTextEditor/table-bands.d.cts.map +1 -0
  137. package/dist/components/RichTextEditor/table-bands.d.ts +19 -0
  138. package/dist/components/RichTextEditor/table-bands.d.ts.map +1 -0
  139. package/dist/components/RichTextEditor/table-view.d.cts +4 -0
  140. package/dist/components/RichTextEditor/table-view.d.cts.map +1 -0
  141. package/dist/components/RichTextEditor/table-view.d.ts +4 -0
  142. package/dist/components/RichTextEditor/table-view.d.ts.map +1 -0
  143. package/dist/components/RichTextEditor/tables.d.cts.map +1 -1
  144. package/dist/components/RichTextEditor/tables.d.ts.map +1 -1
  145. package/dist/components/RichTextEditor/use-embeds.d.cts.map +1 -1
  146. package/dist/components/RichTextEditor/use-embeds.d.ts.map +1 -1
  147. package/dist/components/SearchField/index.cjs +1 -1
  148. package/dist/components/SearchField/index.js +1 -1
  149. package/dist/components/Select/index.cjs +1 -1
  150. package/dist/components/Select/index.js +2 -2
  151. package/dist/components/SideNav/index.cjs +1 -1
  152. package/dist/components/SideNav/index.js +1 -1
  153. package/dist/components/SortableList/index.cjs +1 -1
  154. package/dist/components/SortableList/index.js +1 -1
  155. package/dist/components/Stepper/index.cjs +1 -1
  156. package/dist/components/Stepper/index.js +1 -1
  157. package/dist/components/SubNav/index.cjs +1 -1
  158. package/dist/components/SubNav/index.js +1 -1
  159. package/dist/components/Switch/style.css +2 -6
  160. package/dist/components/Table/index.cjs +1 -1
  161. package/dist/components/Table/index.js +1 -1
  162. package/dist/components/Time/index.cjs +1 -1
  163. package/dist/components/Time/index.js +1 -1
  164. package/dist/components/Toast/index.cjs +1 -1
  165. package/dist/components/Toast/index.js +1 -1
  166. package/dist/components/TopNav/index.cjs +1 -1
  167. package/dist/components/TopNav/index.js +1 -1
  168. package/dist/index.cjs +1 -1
  169. package/dist/index.d.cts +1 -1
  170. package/dist/index.d.cts.map +1 -1
  171. package/dist/index.d.ts +1 -1
  172. package/dist/index.d.ts.map +1 -1
  173. package/dist/index.js +17 -17
  174. package/package.json +1 -1
  175. package/dist/chunks/Icon-Bxvp1-td.js +0 -102
  176. package/dist/chunks/Icon-Bxvp1-td.js.map +0 -1
  177. package/dist/chunks/Icon-CnnTrtNb.cjs +0 -2
  178. package/dist/chunks/Icon-CnnTrtNb.cjs.map +0 -1
  179. package/dist/chunks/RichTextEditor-DPhEkDxi.js +0 -2108
  180. package/dist/chunks/RichTextEditor-DPhEkDxi.js.map +0 -1
  181. package/dist/chunks/RichTextEditor-DV7NZp_k.cjs +0 -2
  182. package/dist/chunks/RichTextEditor-DV7NZp_k.cjs.map +0 -1
  183. package/dist/chunks/dialogLabel-C153NosD.js +0 -176
  184. package/dist/chunks/dialogLabel-C153NosD.js.map +0 -1
  185. package/dist/chunks/dialogLabel-CNNQbtob.cjs +0 -2
  186. package/dist/chunks/dialogLabel-CNNQbtob.cjs.map +0 -1
  187. package/dist/chunks/overlayLayer-CtOTt1xB.cjs +0 -2
  188. package/dist/chunks/overlayLayer-CtOTt1xB.cjs.map +0 -1
  189. package/dist/chunks/overlayLayer-Og07sIyl.js +0 -180
  190. package/dist/chunks/overlayLayer-Og07sIyl.js.map +0 -1
  191. package/dist/components/RichTextEditor/storyblock-view.d.cts +0 -3
  192. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +0 -1
  193. package/dist/components/RichTextEditor/storyblock-view.d.ts +0 -3
  194. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +0 -1
  195. package/dist/components/RichTextEditor/storyblock.d.cts +0 -19
  196. package/dist/components/RichTextEditor/storyblock.d.cts.map +0 -1
  197. package/dist/components/RichTextEditor/storyblock.d.ts +0 -19
  198. package/dist/components/RichTextEditor/storyblock.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ColourField-Bb8H87fg.js","names":["_Fragment","Icon","mergeRefs","focusAfterField","tabbableControls","useOverlayOpen","parseColour","colourState","normaliseColour","colourHex","Slider","Fragment$1","clamp","value","ColourSquare","dragging","useRef","update","rect","event","onChange","colour","isDisabled","step","change","useColourValue","internal","setInternal","useState","defaultValue","current","selection","setSelection","hex","next","onValueChange","useColourDraft","draft","setDraft","isValid","eyeDropperConstructor","subscribe","noPresets","presetColumns","presetTarget","column","index","lastInColumn","count","key","ColourPanel","forwardRef","rest","ColourPanelContent","commit","inputRef","active","disabledRef","isPicking","setPicking","pickerError","setPickerError","hasEyeDropper","useSyncExternalStore","presetsId","useId","rgb","swatches","useMemo","unique","preset","presets","normalised","selectedIndex","swatch","useEffect","pickFromScreen","EyeDropper","result","onColourChange","error","className","style","picker","Button","delta","input","a","showPresets","radios","selected","ColourField","ariaInvalid","open","setOpen","isOpen","rootRef","openerRef","panelRef","panelId","fieldId","id","invalid","text","effectiveDisabled","disabled","readOnly","visible","onValidityChange","outside","target","toggle","opener","close","triggerProps","controls","FieldAffix","TextField","ref","isInvalid","valid","type","discard","onBlur","onKeyDown","Popover"],"sources":["../../src/components/ColourField/square.tsx","../../src/components/ColourField/value.ts","../../src/components/ColourField/panel.tsx","../../src/components/ColourField/index.tsx"],"sourcesContent":["import { useRef, type KeyboardEvent, type PointerEvent } from \"react\";\nimport type { Colour } from \"./colour\";\n\ninterface ColourSquareProps {\n colour: Colour;\n isDisabled: boolean;\n onChange: (colour: Colour) => void;\n}\n\nfunction clamp(value: number) {\n return Math.max(0, Math.min(100, value));\n}\n\nexport function ColourSquare({ colour, isDisabled, onChange }: ColourSquareProps) {\n const dragging = useRef<number | null>(null);\n const update = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n if (!rect.width || !rect.height) {\n return;\n }\n onChange({\n ...colour,\n s: clamp(((event.clientX - rect.left) / rect.width) * 100),\n v: clamp((1 - (event.clientY - rect.top) / rect.height) * 100),\n });\n };\n const handleKey = (event: KeyboardEvent) => {\n if (isDisabled) {\n return;\n }\n const step = event.shiftKey ? 10 : 1;\n const changes: Record<string, Partial<Colour>> = {\n ArrowLeft: { s: clamp(colour.s - step) },\n ArrowRight: { s: clamp(colour.s + step) },\n ArrowDown: { v: clamp(colour.v - step) },\n ArrowUp: { v: clamp(colour.v + step) },\n Home: { s: 0 },\n End: { s: 100 },\n };\n const change = changes[event.key];\n if (!change) {\n return;\n }\n event.preventDefault();\n onChange({ ...colour, ...change });\n };\n return (\n <div\n className=\"ds-colour-panel__square\"\n role=\"slider\"\n tabIndex={isDisabled ? -1 : 0}\n aria-label=\"Saturation and brightness\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(colour.s)}\n aria-valuetext={`Saturation ${Math.round(colour.s)}%, brightness ${Math.round(colour.v)}%`}\n aria-disabled={isDisabled || undefined}\n onKeyDown={handleKey}\n onPointerDown={(event) => {\n if (isDisabled || event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.currentTarget.focus();\n dragging.current = event.pointerId;\n event.currentTarget.setPointerCapture(event.pointerId);\n update(event);\n }}\n onPointerMove={(event) => {\n if (!isDisabled && dragging.current === event.pointerId) {\n update(event);\n }\n }}\n onPointerUp={(event) => {\n if (dragging.current !== event.pointerId) {\n return;\n }\n dragging.current = null;\n event.currentTarget.releasePointerCapture(event.pointerId);\n }}\n onPointerCancel={() => {\n dragging.current = null;\n }}\n onLostPointerCapture={() => {\n dragging.current = null;\n }}\n >\n <span\n className=\"ds-colour-panel__thumb\"\n style={{ left: `${colour.s}%`, top: `${100 - colour.v}%` }}\n />\n </div>\n );\n}\n","import { useState } from \"react\";\nimport { colourHex, colourState, normaliseColour, type Colour } from \"./colour\";\n\nexport interface ColourValueProps {\n value?: string;\n defaultValue?: string;\n /** Uppercase hex (including alpha when needed), or an empty string when cleared. */\n onValueChange?: (value: string) => void;\n}\n\nexport function useColourValue({ value, defaultValue = \"\", onValueChange }: ColourValueProps) {\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const [selection, setSelection] = useState(() => ({\n source: current,\n colour: colourState(current),\n }));\n let colour = selection.colour;\n if (selection.source !== current) {\n colour = colourState(current, colour);\n setSelection({ source: current, colour });\n }\n\n const commit = (next: string | Colour) => {\n const hex = typeof next === \"string\" ? normaliseColour(next) : colourHex(next);\n setSelection({\n source: hex,\n colour: typeof next === \"string\" ? colourState(next, colour) : next,\n });\n if (value === undefined) {\n setInternal(hex);\n }\n onValueChange?.(hex);\n };\n\n return { current, colour, commit };\n}\n\n/** Typed text the field shows until it is committed, blurred, or replaced. */\nexport function useColourDraft(current: string, hex: string) {\n const [draft, setDraft] = useState<{ source: string; text: string } | null>(null);\n // A draft belongs to the value it was typed over. A parent that stores the invalid\n // text (FormEditor does) takes it over, so restoring the earlier value then wins.\n if (draft && draft.source !== current && draft.text === current) {\n setDraft({ source: current, text: current });\n }\n const text = draft?.source === current ? draft.text : hex || current;\n /** Valid text becomes the committed hex; invalid text stays over the current value. */\n const type = (next: string, isValid: boolean) =>\n setDraft({ source: isValid ? normaliseColour(next) : current, text: next });\n return { text, type, discard: () => setDraft(null) };\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Slider } from \"../Slider\";\nimport { colourHex, colourState, normaliseColour, parseColour, type Colour } from \"./colour\";\nimport { ColourSquare } from \"./square\";\nimport { useColourValue, type ColourValueProps } from \"./value\";\nimport \"./style.css\";\n\nexport interface ColourPickerOptions {\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n isDisabled?: boolean;\n}\n\nexport interface ColourPanelProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\">,\n ColourValueProps,\n ColourPickerOptions {}\n\ninterface EyeDropperInstance {\n open: () => Promise<{ sRGBHex: string }>;\n}\nfunction eyeDropperConstructor() {\n return (window as Window & { EyeDropper?: new () => EyeDropperInstance }).EyeDropper;\n}\nconst subscribe = () => () => {};\nconst noPresets: string[] = [];\nconst presetColumns = 8;\n\n/** Where a key moves within the preset grid; rows wrap within their column. */\nfunction presetTarget(key: string, index: number, count: number) {\n const column = index % presetColumns;\n const lastInColumn = column + Math.floor((count - 1 - column) / presetColumns) * presetColumns;\n switch (key) {\n case \"Home\":\n return 0;\n case \"End\":\n return count - 1;\n case \"ArrowRight\":\n return (index + 1) % count;\n case \"ArrowLeft\":\n return (index - 1 + count) % count;\n case \"ArrowDown\":\n return index + presetColumns < count ? index + presetColumns : column;\n case \"ArrowUp\":\n return index >= presetColumns ? index - presetColumns : lastInColumn;\n default:\n return undefined;\n }\n}\n\n/** A standalone colour selection surface, also composed by ColourField. */\nexport const ColourPanel = forwardRef<HTMLDivElement, ColourPanelProps>(function ColourPanel(\n { value, defaultValue, onValueChange, ...rest },\n ref,\n) {\n const { current, colour, commit } = useColourValue({ value, defaultValue, onValueChange });\n return (\n <ColourPanelContent\n {...rest}\n ref={ref}\n colour={colour}\n current={current}\n onColourChange={commit}\n />\n );\n});\n\ninterface ColourPanelContentProps extends Omit<\n ColourPanelProps,\n \"value\" | \"defaultValue\" | \"onValueChange\"\n> {\n colour: Colour;\n current: string;\n onColourChange: (colour: Colour | string) => void;\n}\n\nexport const ColourPanelContent = forwardRef<HTMLDivElement, ColourPanelContentProps>(\n function ColourPanelContent(\n {\n colour,\n current,\n onColourChange,\n presets = noPresets,\n showPresets = true,\n picker = \"custom\",\n isDisabled = false,\n className,\n style,\n ...rest\n },\n ref,\n ) {\n const inputRef = useRef<HTMLInputElement>(null);\n const active = useRef(true);\n const disabledRef = useRef(isDisabled);\n const [isPicking, setPicking] = useState(false);\n const [pickerError, setPickerError] = useState(\"\");\n const hasEyeDropper = useSyncExternalStore(\n subscribe,\n () => Boolean(eyeDropperConstructor()),\n () => false,\n );\n const presetsId = useId();\n const hex = normaliseColour(current);\n const rgb = colourHex({ ...colour, a: 1 });\n // Equivalent spellings collapse onto the first; each preset is parsed once.\n const swatches = useMemo(() => {\n const unique = new Map<string, string>();\n for (const preset of presets) {\n const normalised = normaliseColour(preset);\n if (normalised && !unique.has(normalised)) {\n unique.set(normalised, preset);\n }\n }\n return [...unique].map(([normalised, preset]) => ({ normalised, preset }));\n }, [presets]);\n const selectedIndex = swatches.findIndex((swatch) => swatch.normalised === hex);\n useEffect(() => {\n disabledRef.current = isDisabled;\n }, [isDisabled]);\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n };\n }, []);\n\n const pickFromScreen = async () => {\n const EyeDropper = eyeDropperConstructor();\n if (!EyeDropper || isDisabled || isPicking) {\n return;\n }\n setPicking(true);\n setPickerError(\"\");\n try {\n const result = await new EyeDropper().open();\n if (active.current && !disabledRef.current) {\n if (parseColour(result.sRGBHex)) {\n onColourChange({ ...colourState(result.sRGBHex, colour), a: colour.a });\n }\n }\n } catch (error) {\n if (active.current && !(error instanceof DOMException && error.name === \"AbortError\")) {\n setPickerError(\"Unable to pick a colour from the screen. Try again.\");\n }\n } finally {\n if (active.current) {\n setPicking(false);\n }\n }\n };\n\n return (\n <div\n {...rest}\n ref={ref}\n className={[\"ds-colour-panel\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n data-disabled={isDisabled || undefined}\n style={\n {\n ...style,\n \"--colour-hue\": `hsl(${colour.h} 100% 50%)`,\n \"--colour-rgb\": rgb,\n \"--colour-rgba\": colourHex(colour),\n } as CSSProperties\n }\n >\n <div className=\"ds-colour-panel__head ds-field-surface\">\n <span>Colour</span>\n <span className=\"ds-colour-panel__value\">{hex || \"No colour\"}</span>\n </div>\n {picker === \"custom\" ? (\n <>\n <ColourSquare\n colour={colour}\n isDisabled={isDisabled}\n onChange={onColourChange}\n />\n <div className=\"ds-colour-panel__hue-row\">\n {hasEyeDropper && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"pipette\"\n aria-label=\"Pick from screen\"\n isDisabled={isDisabled}\n // Busy, not pending: a pending Button disables itself and drops focus.\n aria-busy={isPicking || undefined}\n onClick={() => void pickFromScreen()}\n />\n )}\n <Slider\n className=\"ds-colour-panel__hue\"\n value={colour.h}\n min={0}\n max={360}\n step={1}\n hasValueLabel={false}\n aria-label=\"Hue\"\n aria-valuetext={`${Math.round(colour.h)} degrees`}\n isDisabled={isDisabled}\n onValueChange={(h) => onColourChange({ ...colour, h })}\n onKeyDown={(event) => {\n if (\n !event.shiftKey ||\n ![\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(event.key)\n ) {\n return;\n }\n event.preventDefault();\n const delta = event.key === \"ArrowRight\" || event.key === \"ArrowUp\" ? 15 : -15;\n onColourChange({ ...colour, h: Math.max(0, Math.min(360, colour.h + delta)) });\n }}\n />\n </div>\n </>\n ) : (\n <div className=\"ds-colour-panel__native\">\n <input\n ref={inputRef}\n type=\"color\"\n value={rgb}\n tabIndex={-1}\n aria-hidden=\"true\"\n disabled={isDisabled}\n onChange={(event) => {\n if (parseColour(event.target.value)) {\n onColourChange({ ...colourState(event.target.value, colour), a: colour.a });\n }\n }}\n />\n <Button\n variant=\"neutral\"\n size=\"sm\"\n iconStart=\"pipette\"\n isDisabled={isDisabled}\n onClick={() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n try {\n if (input.showPicker) {\n input.showPicker();\n } else {\n input.click();\n }\n } catch {\n input.click();\n }\n }}\n >\n Custom colour…\n </Button>\n </div>\n )}\n <div className=\"ds-colour-panel__opacity\">\n <label htmlFor={`${presetsId}-opacity`}>Opacity</label>\n <Slider\n id={`${presetsId}-opacity`}\n className=\"ds-colour-panel__alpha\"\n value={Math.round(colour.a * 100)}\n min={0}\n max={100}\n step={1}\n suffix=\"%\"\n isDisabled={isDisabled}\n onValueChange={(a) => onColourChange({ ...colour, a: a / 100 })}\n />\n </div>\n {showPresets && swatches.length > 0 && (\n <div className=\"ds-colour-panel__presets\">\n <span\n id={presetsId}\n className=\"ds-colour-panel__presets-label\"\n >\n Presets\n </span>\n <div\n className=\"ds-colour-panel__grid\"\n role=\"radiogroup\"\n aria-labelledby={presetsId}\n style={{ \"--colour-preset-columns\": presetColumns } as CSSProperties}\n onKeyDown={(event) => {\n const radios = Array.from(\n event.currentTarget.querySelectorAll<HTMLButtonElement>(\"[role='radio']\"),\n );\n const index = radios.indexOf(event.target as HTMLButtonElement);\n const next = index < 0 ? undefined : presetTarget(event.key, index, radios.length);\n if (next === undefined) {\n return;\n }\n event.preventDefault();\n radios[next]?.focus();\n radios[next]?.click();\n }}\n >\n {swatches.map(({ normalised, preset }, index) => {\n const selected = index === selectedIndex;\n return (\n <Button\n key={normalised}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n role=\"radio\"\n aria-checked={selected}\n aria-label={preset}\n title={preset}\n tabIndex={index === Math.max(0, selectedIndex) ? 0 : -1}\n isDisabled={isDisabled}\n className=\"ds-colour-panel__preset\"\n onClick={() => onColourChange(preset)}\n >\n <span\n className=\"ds-colour-swatch\"\n style={{ \"--colour-swatch\": normalised } as CSSProperties}\n >\n {selected && (\n <Icon\n name=\"check\"\n size={16}\n strokeWidth={3}\n />\n )}\n </span>\n </Button>\n );\n })}\n </div>\n </div>\n )}\n {pickerError && (\n <span\n className=\"ds-colour-panel__error\"\n role=\"status\"\n >\n {pickerError}\n </span>\n )}\n </div>\n );\n },\n);\n","import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport { forwardRef, useEffect, useId, useRef, useState, type CSSProperties } from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { TextField, type TextFieldProps } from \"../TextField\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { normaliseColour, parseColour } from \"./colour\";\nimport { focusAfterField, tabbableControls } from \"../../internal/dialogFocus\";\nimport { ColourPanelContent, type ColourPickerOptions } from \"./panel\";\nimport { useColourDraft, useColourValue, type ColourValueProps } from \"./value\";\nimport \"./style.css\";\n\nexport { ColourPanel } from \"./panel\";\nexport type { ColourPanelProps } from \"./panel\";\n\nexport interface ColourFieldProps\n extends\n Omit<TextFieldProps, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"children\">,\n ColourValueProps,\n ColourPickerOptions {\n isInvalid?: boolean;\n placement?: PopoverPlacement;\n /** Parsing validity; an empty value is valid and native required validation remains separate. */\n onValidityChange?: (isValid: boolean) => void;\n}\n\n/** A typed colour value and a visual picker, bound to the shared Field frame. */\nexport const ColourField = forwardRef<HTMLInputElement, ColourFieldProps>(function ColourField(\n {\n value,\n defaultValue,\n onValueChange,\n onValidityChange,\n presets,\n showPresets,\n picker,\n placement,\n isDisabled = false,\n disabled,\n readOnly,\n isInvalid,\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n onBlur,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const { current, colour, commit } = useColourValue({ value, defaultValue, onValueChange });\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const openerRef = useRef<HTMLElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const fieldId = id ?? `${panelId}-input`;\n const hex = normaliseColour(current);\n const { text, type, discard } = useColourDraft(current, hex);\n const invalid = Boolean(text.trim() && !parseColour(text));\n const effectiveDisabled = isDisabled || disabled;\n if (isOpen && (effectiveDisabled || readOnly)) {\n setOpen(false);\n }\n const visible = isOpen && !effectiveDisabled && !readOnly;\n\n useEffect(() => {\n onValidityChange?.(!invalid);\n inputRef.current?.setCustomValidity(\n invalid ? \"Enter a colour, such as #0052CC or rebeccapurple.\" : \"\",\n );\n }, [invalid, onValidityChange]);\n\n useEffect(() => {\n if (!visible) {\n return;\n }\n if (panelRef.current) {\n tabbableControls(panelRef.current)[0]?.focus({ preventScroll: true });\n }\n const outside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (target && !rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", outside);\n return () => document.removeEventListener(\"mousedown\", outside);\n }, [visible]);\n\n const toggle = (opener: HTMLElement) => {\n openerRef.current = opener;\n setOpen(!visible);\n };\n const close = () => {\n setOpen(false);\n openerRef.current?.focus({ preventScroll: true });\n };\n const triggerProps = {\n \"aria-label\": visible ? \"Close colour picker\" : \"Open colour picker\",\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": visible,\n \"aria-controls\": visible ? panelId : undefined,\n isDisabled: effectiveDisabled || readOnly,\n };\n\n return (\n <div\n className=\"ds-colour-field\"\n ref={rootRef}\n onBlur={(event) => {\n const target = event.relatedTarget as Node | null;\n if (target && !rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n }}\n onKeyDown={(event) => {\n if (visible && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n close();\n }\n if (!visible || event.key !== \"Tab\" || !panelRef.current?.contains(event.target as Node)) {\n return;\n }\n const controls = tabbableControls(panelRef.current);\n const atBoundary = event.shiftKey\n ? event.target === controls[0]\n : event.target === controls.at(-1);\n if (!atBoundary) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n if (event.shiftKey) {\n openerRef.current?.focus({ preventScroll: true });\n } else if (rootRef.current) {\n focusAfterField(rootRef.current);\n }\n }}\n >\n <FieldAffix\n isLeadInteractive\n isTrailInteractive\n lead={\n // A pointer shortcut only: the chevron is the one keyboard and screen\n // reader trigger. The swatch never takes focus; the input gets it back.\n <Button\n aria-hidden=\"true\"\n tabIndex={-1}\n isDisabled={triggerProps.isDisabled}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n openerRef.current = inputRef.current;\n if (visible) {\n close();\n } else {\n setOpen(true);\n }\n }}\n >\n <span\n className=\"ds-colour-swatch ds-colour-field__swatch\"\n style={{ \"--colour-swatch\": hex || \"transparent\" } as CSSProperties}\n />\n </Button>\n }\n trail={\n <Button\n {...triggerProps}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"chevron-down\"\n onClick={(event) => toggle(event.currentTarget)}\n />\n }\n >\n <TextField\n {...rest}\n ref={mergeRefs(inputRef, ref)}\n id={fieldId}\n disabled={effectiveDisabled}\n readOnly={readOnly}\n spellCheck={false}\n autoComplete=\"off\"\n value={text}\n aria-invalid={invalid || isInvalid || ariaInvalid || undefined}\n aria-haspopup=\"dialog\"\n aria-controls={visible ? panelId : undefined}\n className={[\"ds-colour-field__input\", className].filter(Boolean).join(\" \")}\n onChange={(event) => {\n const next = event.target.value;\n const valid = !next.trim() || Boolean(parseColour(next));\n type(next, valid);\n if (valid) {\n commit(next);\n }\n }}\n onBlur={(event) => {\n if (!invalid) {\n discard();\n }\n onBlur?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Enter\" && !invalid) {\n event.preventDefault();\n discard();\n }\n if (event.key === \"ArrowDown\" && !effectiveDisabled && !readOnly) {\n event.preventDefault();\n openerRef.current = event.currentTarget;\n setOpen(true);\n }\n }}\n />\n </FieldAffix>\n <Popover\n anchorRef={inputRef}\n anchorId={fieldId}\n isOpen={visible}\n align=\"start\"\n placement={placement}\n panelRef={panelRef}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a colour\"\n // A click on the padding or a label focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n className=\"ds-colour-field__popover\"\n >\n <ColourPanelContent\n colour={colour}\n current={hex}\n presets={presets}\n showPresets={showPresets}\n picker={picker}\n onColourChange={(next) => {\n discard();\n commit(next);\n }}\n />\n </Popover>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;;;AASA,SAASY,EAAM,GAAe;CAC5B,OAAO,KAAK,IAAI,GAAG,KAAK,IAAI,KAAKC,CAAK,CAAC;AACzC;AAEA,SAAgBC,EAAa,EAAE,WAAQ,eAAY,eAA+B;CAChF,IAAMC,IAAWC,EAAsB,IAAI,GACrCC,KAAU,MAAwC;EACtD,IAAMC,IAAOC,EAAM,cAAc,sBAAsB;EACvD,AAAKD,EAA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IACb;GACD,CAAA;EACM,CAAA,CACN;;AAET,CAAC"}
1
+ {"version":3,"file":"ColourField-BcuARZY4.js","names":["_Fragment","Icon","mergeRefs","tabbableControls","focusAfterField","useOverlayOpen","parseColour","colourState","normaliseColour","colourHex","Slider","Fragment$1","clamp","value","ColourSquare","dragging","useRef","update","rect","event","onChange","colour","isDisabled","step","change","useColourValue","internal","setInternal","useState","defaultValue","current","selection","setSelection","hex","next","onValueChange","useColourDraft","draft","setDraft","isValid","eyeDropperConstructor","subscribe","noPresets","presetColumns","presetTarget","column","index","lastInColumn","count","key","ColourPanel","forwardRef","rest","ColourPanelContent","commit","inputRef","active","disabledRef","isPicking","setPicking","pickerError","setPickerError","hasEyeDropper","useSyncExternalStore","presetsId","useId","rgb","swatches","useMemo","unique","preset","presets","normalised","selectedIndex","swatch","useEffect","pickFromScreen","EyeDropper","result","onColourChange","error","className","style","picker","Button","delta","input","a","showPresets","radios","selected","ColourField","ariaInvalid","open","setOpen","isOpen","rootRef","openerRef","panelRef","panelId","fieldId","id","invalid","text","effectiveDisabled","disabled","readOnly","visible","onValidityChange","outside","target","toggle","opener","close","triggerProps","controls","FieldAffix","TextField","ref","isInvalid","valid","type","discard","onBlur","onKeyDown","Popover"],"sources":["../../src/components/ColourField/square.tsx","../../src/components/ColourField/value.ts","../../src/components/ColourField/panel.tsx","../../src/components/ColourField/index.tsx"],"sourcesContent":["import { useRef, type KeyboardEvent, type PointerEvent } from \"react\";\nimport type { Colour } from \"./colour\";\n\ninterface ColourSquareProps {\n colour: Colour;\n isDisabled: boolean;\n onChange: (colour: Colour) => void;\n}\n\nfunction clamp(value: number) {\n return Math.max(0, Math.min(100, value));\n}\n\nexport function ColourSquare({ colour, isDisabled, onChange }: ColourSquareProps) {\n const dragging = useRef<number | null>(null);\n const update = (event: PointerEvent<HTMLDivElement>) => {\n const rect = event.currentTarget.getBoundingClientRect();\n if (!rect.width || !rect.height) {\n return;\n }\n onChange({\n ...colour,\n s: clamp(((event.clientX - rect.left) / rect.width) * 100),\n v: clamp((1 - (event.clientY - rect.top) / rect.height) * 100),\n });\n };\n const handleKey = (event: KeyboardEvent) => {\n if (isDisabled) {\n return;\n }\n const step = event.shiftKey ? 10 : 1;\n const changes: Record<string, Partial<Colour>> = {\n ArrowLeft: { s: clamp(colour.s - step) },\n ArrowRight: { s: clamp(colour.s + step) },\n ArrowDown: { v: clamp(colour.v - step) },\n ArrowUp: { v: clamp(colour.v + step) },\n Home: { s: 0 },\n End: { s: 100 },\n };\n const change = changes[event.key];\n if (!change) {\n return;\n }\n event.preventDefault();\n onChange({ ...colour, ...change });\n };\n return (\n <div\n className=\"ds-colour-panel__square\"\n role=\"slider\"\n tabIndex={isDisabled ? -1 : 0}\n aria-label=\"Saturation and brightness\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round(colour.s)}\n aria-valuetext={`Saturation ${Math.round(colour.s)}%, brightness ${Math.round(colour.v)}%`}\n aria-disabled={isDisabled || undefined}\n onKeyDown={handleKey}\n onPointerDown={(event) => {\n if (isDisabled || event.button !== 0) {\n return;\n }\n event.preventDefault();\n event.currentTarget.focus();\n dragging.current = event.pointerId;\n event.currentTarget.setPointerCapture(event.pointerId);\n update(event);\n }}\n onPointerMove={(event) => {\n if (!isDisabled && dragging.current === event.pointerId) {\n update(event);\n }\n }}\n onPointerUp={(event) => {\n if (dragging.current !== event.pointerId) {\n return;\n }\n dragging.current = null;\n event.currentTarget.releasePointerCapture(event.pointerId);\n }}\n onPointerCancel={() => {\n dragging.current = null;\n }}\n onLostPointerCapture={() => {\n dragging.current = null;\n }}\n >\n <span\n className=\"ds-colour-panel__thumb\"\n style={{ left: `${colour.s}%`, top: `${100 - colour.v}%` }}\n />\n </div>\n );\n}\n","import { useState } from \"react\";\nimport { colourHex, colourState, normaliseColour, type Colour } from \"./colour\";\n\nexport interface ColourValueProps {\n value?: string;\n defaultValue?: string;\n /** Uppercase hex (including alpha when needed), or an empty string when cleared. */\n onValueChange?: (value: string) => void;\n}\n\nexport function useColourValue({ value, defaultValue = \"\", onValueChange }: ColourValueProps) {\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const [selection, setSelection] = useState(() => ({\n source: current,\n colour: colourState(current),\n }));\n let colour = selection.colour;\n if (selection.source !== current) {\n colour = colourState(current, colour);\n setSelection({ source: current, colour });\n }\n\n const commit = (next: string | Colour) => {\n const hex = typeof next === \"string\" ? normaliseColour(next) : colourHex(next);\n setSelection({\n source: hex,\n colour: typeof next === \"string\" ? colourState(next, colour) : next,\n });\n if (value === undefined) {\n setInternal(hex);\n }\n onValueChange?.(hex);\n };\n\n return { current, colour, commit };\n}\n\n/** Typed text the field shows until it is committed, blurred, or replaced. */\nexport function useColourDraft(current: string, hex: string) {\n const [draft, setDraft] = useState<{ source: string; text: string } | null>(null);\n // A draft belongs to the value it was typed over. A parent that stores the invalid\n // text (FormEditor does) takes it over, so restoring the earlier value then wins.\n if (draft && draft.source !== current && draft.text === current) {\n setDraft({ source: current, text: current });\n }\n const text = draft?.source === current ? draft.text : hex || current;\n /** Valid text becomes the committed hex; invalid text stays over the current value. */\n const type = (next: string, isValid: boolean) =>\n setDraft({ source: isValid ? normaliseColour(next) : current, text: next });\n return { text, type, discard: () => setDraft(null) };\n}\n","import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Slider } from \"../Slider\";\nimport { colourHex, colourState, normaliseColour, parseColour, type Colour } from \"./colour\";\nimport { ColourSquare } from \"./square\";\nimport { useColourValue, type ColourValueProps } from \"./value\";\nimport \"./style.css\";\n\nexport interface ColourPickerOptions {\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n isDisabled?: boolean;\n}\n\nexport interface ColourPanelProps\n extends\n Omit<HTMLAttributes<HTMLDivElement>, \"defaultValue\" | \"onChange\">,\n ColourValueProps,\n ColourPickerOptions {}\n\ninterface EyeDropperInstance {\n open: () => Promise<{ sRGBHex: string }>;\n}\nfunction eyeDropperConstructor() {\n return (window as Window & { EyeDropper?: new () => EyeDropperInstance }).EyeDropper;\n}\nconst subscribe = () => () => {};\nconst noPresets: string[] = [];\nconst presetColumns = 8;\n\n/** Where a key moves within the preset grid; rows wrap within their column. */\nfunction presetTarget(key: string, index: number, count: number) {\n const column = index % presetColumns;\n const lastInColumn = column + Math.floor((count - 1 - column) / presetColumns) * presetColumns;\n switch (key) {\n case \"Home\":\n return 0;\n case \"End\":\n return count - 1;\n case \"ArrowRight\":\n return (index + 1) % count;\n case \"ArrowLeft\":\n return (index - 1 + count) % count;\n case \"ArrowDown\":\n return index + presetColumns < count ? index + presetColumns : column;\n case \"ArrowUp\":\n return index >= presetColumns ? index - presetColumns : lastInColumn;\n default:\n return undefined;\n }\n}\n\n/** A standalone colour selection surface, also composed by ColourField. */\nexport const ColourPanel = forwardRef<HTMLDivElement, ColourPanelProps>(function ColourPanel(\n { value, defaultValue, onValueChange, ...rest },\n ref,\n) {\n const { current, colour, commit } = useColourValue({ value, defaultValue, onValueChange });\n return (\n <ColourPanelContent\n {...rest}\n ref={ref}\n colour={colour}\n current={current}\n onColourChange={commit}\n />\n );\n});\n\ninterface ColourPanelContentProps extends Omit<\n ColourPanelProps,\n \"value\" | \"defaultValue\" | \"onValueChange\"\n> {\n colour: Colour;\n current: string;\n onColourChange: (colour: Colour | string) => void;\n}\n\nexport const ColourPanelContent = forwardRef<HTMLDivElement, ColourPanelContentProps>(\n function ColourPanelContent(\n {\n colour,\n current,\n onColourChange,\n presets = noPresets,\n showPresets = true,\n picker = \"custom\",\n isDisabled = false,\n className,\n style,\n ...rest\n },\n ref,\n ) {\n const inputRef = useRef<HTMLInputElement>(null);\n const active = useRef(true);\n const disabledRef = useRef(isDisabled);\n const [isPicking, setPicking] = useState(false);\n const [pickerError, setPickerError] = useState(\"\");\n const hasEyeDropper = useSyncExternalStore(\n subscribe,\n () => Boolean(eyeDropperConstructor()),\n () => false,\n );\n const presetsId = useId();\n const hex = normaliseColour(current);\n const rgb = colourHex({ ...colour, a: 1 });\n // Equivalent spellings collapse onto the first; each preset is parsed once.\n const swatches = useMemo(() => {\n const unique = new Map<string, string>();\n for (const preset of presets) {\n const normalised = normaliseColour(preset);\n if (normalised && !unique.has(normalised)) {\n unique.set(normalised, preset);\n }\n }\n return [...unique].map(([normalised, preset]) => ({ normalised, preset }));\n }, [presets]);\n const selectedIndex = swatches.findIndex((swatch) => swatch.normalised === hex);\n useEffect(() => {\n disabledRef.current = isDisabled;\n }, [isDisabled]);\n useEffect(() => {\n active.current = true;\n return () => {\n active.current = false;\n };\n }, []);\n\n const pickFromScreen = async () => {\n const EyeDropper = eyeDropperConstructor();\n if (!EyeDropper || isDisabled || isPicking) {\n return;\n }\n setPicking(true);\n setPickerError(\"\");\n try {\n const result = await new EyeDropper().open();\n if (active.current && !disabledRef.current) {\n if (parseColour(result.sRGBHex)) {\n onColourChange({ ...colourState(result.sRGBHex, colour), a: colour.a });\n }\n }\n } catch (error) {\n if (active.current && !(error instanceof DOMException && error.name === \"AbortError\")) {\n setPickerError(\"Unable to pick a colour from the screen. Try again.\");\n }\n } finally {\n if (active.current) {\n setPicking(false);\n }\n }\n };\n\n return (\n <div\n {...rest}\n ref={ref}\n className={[\"ds-colour-panel\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n data-disabled={isDisabled || undefined}\n style={\n {\n ...style,\n \"--colour-hue\": `hsl(${colour.h} 100% 50%)`,\n \"--colour-rgb\": rgb,\n \"--colour-rgba\": colourHex(colour),\n } as CSSProperties\n }\n >\n <div className=\"ds-colour-panel__head ds-field-surface\">\n <span>Colour</span>\n <span className=\"ds-colour-panel__value\">{hex || \"No colour\"}</span>\n </div>\n {picker === \"custom\" ? (\n <>\n <ColourSquare\n colour={colour}\n isDisabled={isDisabled}\n onChange={onColourChange}\n />\n <div className=\"ds-colour-panel__hue-row\">\n {hasEyeDropper && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"pipette\"\n aria-label=\"Pick from screen\"\n isDisabled={isDisabled}\n // Busy, not pending: a pending Button disables itself and drops focus.\n aria-busy={isPicking || undefined}\n onClick={() => void pickFromScreen()}\n />\n )}\n <Slider\n className=\"ds-colour-panel__hue\"\n value={colour.h}\n min={0}\n max={360}\n step={1}\n hasValueLabel={false}\n aria-label=\"Hue\"\n aria-valuetext={`${Math.round(colour.h)} degrees`}\n isDisabled={isDisabled}\n onValueChange={(h) => onColourChange({ ...colour, h })}\n onKeyDown={(event) => {\n if (\n !event.shiftKey ||\n ![\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(event.key)\n ) {\n return;\n }\n event.preventDefault();\n const delta = event.key === \"ArrowRight\" || event.key === \"ArrowUp\" ? 15 : -15;\n onColourChange({ ...colour, h: Math.max(0, Math.min(360, colour.h + delta)) });\n }}\n />\n </div>\n </>\n ) : (\n <div className=\"ds-colour-panel__native\">\n <input\n ref={inputRef}\n type=\"color\"\n value={rgb}\n tabIndex={-1}\n aria-hidden=\"true\"\n disabled={isDisabled}\n onChange={(event) => {\n if (parseColour(event.target.value)) {\n onColourChange({ ...colourState(event.target.value, colour), a: colour.a });\n }\n }}\n />\n <Button\n variant=\"neutral\"\n size=\"sm\"\n iconStart=\"pipette\"\n isDisabled={isDisabled}\n onClick={() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n try {\n if (input.showPicker) {\n input.showPicker();\n } else {\n input.click();\n }\n } catch {\n input.click();\n }\n }}\n >\n Custom colour…\n </Button>\n </div>\n )}\n <div className=\"ds-colour-panel__opacity\">\n <label htmlFor={`${presetsId}-opacity`}>Opacity</label>\n <Slider\n id={`${presetsId}-opacity`}\n className=\"ds-colour-panel__alpha\"\n value={Math.round(colour.a * 100)}\n min={0}\n max={100}\n step={1}\n suffix=\"%\"\n isDisabled={isDisabled}\n onValueChange={(a) => onColourChange({ ...colour, a: a / 100 })}\n />\n </div>\n {showPresets && swatches.length > 0 && (\n <div className=\"ds-colour-panel__presets\">\n <span\n id={presetsId}\n className=\"ds-colour-panel__presets-label\"\n >\n Presets\n </span>\n <div\n className=\"ds-colour-panel__grid\"\n role=\"radiogroup\"\n aria-labelledby={presetsId}\n style={{ \"--colour-preset-columns\": presetColumns } as CSSProperties}\n onKeyDown={(event) => {\n const radios = Array.from(\n event.currentTarget.querySelectorAll<HTMLButtonElement>(\"[role='radio']\"),\n );\n const index = radios.indexOf(event.target as HTMLButtonElement);\n const next = index < 0 ? undefined : presetTarget(event.key, index, radios.length);\n if (next === undefined) {\n return;\n }\n event.preventDefault();\n radios[next]?.focus();\n radios[next]?.click();\n }}\n >\n {swatches.map(({ normalised, preset }, index) => {\n const selected = index === selectedIndex;\n return (\n <Button\n key={normalised}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n role=\"radio\"\n aria-checked={selected}\n aria-label={preset}\n title={preset}\n tabIndex={index === Math.max(0, selectedIndex) ? 0 : -1}\n isDisabled={isDisabled}\n className=\"ds-colour-panel__preset\"\n onClick={() => onColourChange(preset)}\n >\n <span\n className=\"ds-colour-swatch\"\n style={{ \"--colour-swatch\": normalised } as CSSProperties}\n >\n {selected && (\n <Icon\n name=\"check\"\n size={16}\n strokeWidth={3}\n />\n )}\n </span>\n </Button>\n );\n })}\n </div>\n </div>\n )}\n {pickerError && (\n <span\n className=\"ds-colour-panel__error\"\n role=\"status\"\n >\n {pickerError}\n </span>\n )}\n </div>\n );\n },\n);\n","import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport { forwardRef, useEffect, useId, useRef, useState, type CSSProperties } from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { TextField, type TextFieldProps } from \"../TextField\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { normaliseColour, parseColour } from \"./colour\";\nimport { focusAfterField, tabbableControls } from \"../../internal/dialogFocus\";\nimport { ColourPanelContent, type ColourPickerOptions } from \"./panel\";\nimport { useColourDraft, useColourValue, type ColourValueProps } from \"./value\";\nimport \"./style.css\";\n\nexport { ColourPanel } from \"./panel\";\nexport type { ColourPanelProps } from \"./panel\";\n\nexport interface ColourFieldProps\n extends\n Omit<TextFieldProps, \"value\" | \"defaultValue\" | \"onChange\" | \"type\" | \"children\">,\n ColourValueProps,\n ColourPickerOptions {\n isInvalid?: boolean;\n placement?: PopoverPlacement;\n /** Parsing validity; an empty value is valid and native required validation remains separate. */\n onValidityChange?: (isValid: boolean) => void;\n}\n\n/** A typed colour value and a visual picker, bound to the shared Field frame. */\nexport const ColourField = forwardRef<HTMLInputElement, ColourFieldProps>(function ColourField(\n {\n value,\n defaultValue,\n onValueChange,\n onValidityChange,\n presets,\n showPresets,\n picker,\n placement,\n isDisabled = false,\n disabled,\n readOnly,\n isInvalid,\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n onBlur,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const { current, colour, commit } = useColourValue({ value, defaultValue, onValueChange });\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const openerRef = useRef<HTMLElement | null>(null);\n const panelRef = useRef<HTMLDivElement>(null);\n const panelId = useId();\n const fieldId = id ?? `${panelId}-input`;\n const hex = normaliseColour(current);\n const { text, type, discard } = useColourDraft(current, hex);\n const invalid = Boolean(text.trim() && !parseColour(text));\n const effectiveDisabled = isDisabled || disabled;\n if (isOpen && (effectiveDisabled || readOnly)) {\n setOpen(false);\n }\n const visible = isOpen && !effectiveDisabled && !readOnly;\n\n useEffect(() => {\n onValidityChange?.(!invalid);\n inputRef.current?.setCustomValidity(\n invalid ? \"Enter a colour, such as #0052CC or rebeccapurple.\" : \"\",\n );\n }, [invalid, onValidityChange]);\n\n useEffect(() => {\n if (!visible) {\n return;\n }\n if (panelRef.current) {\n tabbableControls(panelRef.current)[0]?.focus({ preventScroll: true });\n }\n const outside = (event: MouseEvent) => {\n const target = event.target as Node;\n if (target && !rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", outside);\n return () => document.removeEventListener(\"mousedown\", outside);\n }, [visible]);\n\n const toggle = (opener: HTMLElement) => {\n openerRef.current = opener;\n setOpen(!visible);\n };\n const close = () => {\n setOpen(false);\n openerRef.current?.focus({ preventScroll: true });\n };\n const triggerProps = {\n \"aria-label\": visible ? \"Close colour picker\" : \"Open colour picker\",\n \"aria-haspopup\": \"dialog\" as const,\n \"aria-expanded\": visible,\n \"aria-controls\": visible ? panelId : undefined,\n isDisabled: effectiveDisabled || readOnly,\n };\n\n return (\n <div\n className=\"ds-colour-field\"\n ref={rootRef}\n onBlur={(event) => {\n const target = event.relatedTarget as Node | null;\n if (target && !rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n }}\n onKeyDown={(event) => {\n if (visible && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n close();\n }\n if (!visible || event.key !== \"Tab\" || !panelRef.current?.contains(event.target as Node)) {\n return;\n }\n const controls = tabbableControls(panelRef.current);\n const atBoundary = event.shiftKey\n ? event.target === controls[0]\n : event.target === controls.at(-1);\n if (!atBoundary) {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n if (event.shiftKey) {\n openerRef.current?.focus({ preventScroll: true });\n } else if (rootRef.current) {\n focusAfterField(rootRef.current);\n }\n }}\n >\n <FieldAffix\n isLeadInteractive\n isTrailInteractive\n lead={\n // A pointer shortcut only: the chevron is the one keyboard and screen\n // reader trigger. The swatch never takes focus; the input gets it back.\n <Button\n aria-hidden=\"true\"\n tabIndex={-1}\n isDisabled={triggerProps.isDisabled}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => {\n openerRef.current = inputRef.current;\n if (visible) {\n close();\n } else {\n setOpen(true);\n }\n }}\n >\n <span\n className=\"ds-colour-swatch ds-colour-field__swatch\"\n style={{ \"--colour-swatch\": hex || \"transparent\" } as CSSProperties}\n />\n </Button>\n }\n trail={\n <Button\n {...triggerProps}\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"chevron-down\"\n onClick={(event) => toggle(event.currentTarget)}\n />\n }\n >\n <TextField\n {...rest}\n ref={mergeRefs(inputRef, ref)}\n id={fieldId}\n disabled={effectiveDisabled}\n readOnly={readOnly}\n spellCheck={false}\n autoComplete=\"off\"\n value={text}\n aria-invalid={invalid || isInvalid || ariaInvalid || undefined}\n aria-haspopup=\"dialog\"\n aria-controls={visible ? panelId : undefined}\n className={[\"ds-colour-field__input\", className].filter(Boolean).join(\" \")}\n onChange={(event) => {\n const next = event.target.value;\n const valid = !next.trim() || Boolean(parseColour(next));\n type(next, valid);\n if (valid) {\n commit(next);\n }\n }}\n onBlur={(event) => {\n if (!invalid) {\n discard();\n }\n onBlur?.(event);\n }}\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) {\n return;\n }\n if (event.key === \"Enter\" && !invalid) {\n event.preventDefault();\n discard();\n }\n if (event.key === \"ArrowDown\" && !effectiveDisabled && !readOnly) {\n event.preventDefault();\n openerRef.current = event.currentTarget;\n setOpen(true);\n }\n }}\n />\n </FieldAffix>\n <Popover\n anchorRef={inputRef}\n anchorId={fieldId}\n isOpen={visible}\n align=\"start\"\n placement={placement}\n panelRef={panelRef}\n id={panelId}\n role=\"dialog\"\n aria-label=\"Choose a colour\"\n // A click on the padding or a label focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n className=\"ds-colour-field__popover\"\n >\n <ColourPanelContent\n colour={colour}\n current={hex}\n presets={presets}\n showPresets={showPresets}\n picker={picker}\n onColourChange={(next) => {\n discard();\n commit(next);\n }}\n />\n </Popover>\n </div>\n );\n});\n"],"mappings":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CAAA,GACZ,kBAAC+B,GAAD;GACE,WAAWtE;GACX,UAAU6C;GACV,QAAQO;GACR,OAAM;GACK;GACD;GACV,IAAIR;GACJ,MAAK;GACL,cAAW;GAGX,UAAU;GACV,WAAU;GAEV,UAAA,kBAAC9C,GAAD;IACU;IACR,SAASpB;IACA;IACI;IACL;IACR,iBAAiB,MAAS;KAExB,AADAyF,EAAQ,GACRpE,EAAOpB,CAAI;IACb;GACD,CAAA;EACM,CAAA,CACN;;AAET,CAAC"}
@@ -1,6 +1,6 @@
1
- import { t as e } from "./Icon-Bxvp1-td.js";
1
+ import { t as e } from "./Icon-kLLQC54Z.js";
2
2
  import { Button as t } from "../components/Button/index.js";
3
- import { o as n } from "./overlayLayer-Og07sIyl.js";
3
+ import { o as n } from "./overlayLayer-Dv1vmfaI.js";
4
4
  /* empty css */
5
5
  import { Popover as r } from "../components/Popover/index.js";
6
6
  import { n as i, r as a } from "./binding-Bshy43sG.js";
@@ -295,4 +295,4 @@ function E({ value: e, defaultValue: t = {
295
295
  //#endregion
296
296
  export { h as a, g as i, w as n, E as r, C as t };
297
297
 
298
- //# sourceMappingURL=DatePicker-COm1giw8.js.map
298
+ //# sourceMappingURL=DatePicker-VQUsbYdo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker-COm1giw8.js","names":["Icon","useOverlayOpen","omitRequired","useGroupBinding","toIso","month","date","day","fromIso","value","year","isIsoDate","formatIsoDate","cx","parts","WEEKDAYS","focusableDay","min","max","monthLabel","startOfGrid","first","weekday","dayVariant","isEdge","inRange","isToday","Calendar","forwardRef","rest","focused","setFocused","useState","setMonth","gridRef","useRef","shouldFocus","useEffect","next","days","start","index","today","changeMonth","delta","move","base","deltaDays","onKeyDown","event","className","Button","rowIndex","iso","isOutside","isDisabled","endValue","onSelect","DateField","ariaInvalid","internal","setInternal","defaultValue","current","open","setOpen","isOpen","rootRef","triggerRef","panelRef","generatedId","useId","triggerId","id","panel","onPointerDown","target","isInvalid","placeholder","isClearable","clearLabel","onValueChange","Popover","rangeBound","endpoint","bound","kind","DateRangeField","binding","commit","attributes","startLabel","endLabel"],"sources":["../../src/components/DatePicker/date.ts","../../src/components/DatePicker/index.tsx"],"sourcesContent":["/** ISO calendar date, \"YYYY-MM-DD\" — the only date shape the system passes around. */\nexport type IsoDate = string;\n\nexport function toIso(date: Date): IsoDate {\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function fromIso(value: string | undefined): Date | null {\n if (!value || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return null;\n }\n const [year, month, day] = value.split(\"-\").map(Number);\n if (!year || !month || !day) {\n return null;\n }\n const date = new Date(year, month - 1, day);\n return Number.isNaN(date.getTime()) || toIso(date) !== value ? null : date;\n}\n\n/** A real calendar day in \"YYYY-MM-DD\" form, checked without locale formatting. */\nexport function isIsoDate(value: string) {\n return fromIso(value) !== null;\n}\n\n/** \"12 March 2026\" — the system's one long date format. */\nexport function formatIsoDate(value: string | undefined): string {\n const date = fromIso(value);\n if (!date) {\n return \"\";\n }\n return date.toLocaleDateString(\"en-GB\", { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n","import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { omitRequired, useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport { formatIsoDate, fromIso, toIso, type IsoDate } from \"./date\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport { formatIsoDate } from \"./date\";\nexport type { IsoDate } from \"./date\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n/** The selected day, or today when none is valid, moved inside the bounds so it can take focus. */\nfunction focusableDay(value: string | undefined, min?: IsoDate, max?: IsoDate): IsoDate {\n const day = fromIso(value) ? (value as IsoDate) : toIso(new Date());\n if (min && day < min) {\n return min;\n }\n return max && day > max ? max : day;\n}\n\nfunction monthLabel(date: Date) {\n return date.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" });\n}\n\nfunction startOfGrid(month: Date) {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const weekday = (first.getDay() + 6) % 7; // Monday-first\n return new Date(first.getFullYear(), first.getMonth(), 1 - weekday);\n}\n\nfunction dayVariant(isEdge: boolean, inRange: boolean, isToday: boolean) {\n if (isEdge) {\n return \"primary\";\n }\n if (inRange) {\n return \"active\";\n }\n return isToday ? \"neutral\" : \"simple\";\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Selected day, or the start of a selected span. */\n value?: IsoDate;\n /** End of a selected span. Set it to put the calendar in range mode. */\n endValue?: IsoDate;\n onSelect?: (value: IsoDate) => void;\n min?: IsoDate;\n max?: IsoDate;\n}\n\n/**\n * A month of days, Monday first. Arrow keys walk the grid; the month follows\n * the focused day, so a whole year is reachable from the keyboard.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n { value, endValue, onSelect, min, max, className, ...rest },\n ref,\n) {\n const [focused, setFocused] = useState<IsoDate>(() => focusableDay(value, min, max));\n const [month, setMonth] = useState(() => fromIso(focused) ?? new Date());\n const gridRef = useRef<HTMLDivElement | null>(null);\n const shouldFocus = useRef(false);\n\n useEffect(() => {\n if (!fromIso(value)) {\n return;\n }\n const day = focusableDay(value, min, max);\n const next = fromIso(day) ?? new Date();\n // Controlled changes intentionally reposition the visible and roving-focus month.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocused(day);\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n }, [value, min, max]);\n\n useEffect(() => {\n if (!shouldFocus.current) {\n return;\n }\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(\"[data-focused]\")?.focus();\n }, [focused]);\n\n const days = Array.from({ length: 42 }, (_, index) => {\n const start = startOfGrid(month);\n return new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);\n });\n\n const today = toIso(new Date());\n\n const changeMonth = (delta: number) => {\n const next = new Date(month.getFullYear(), month.getMonth() + delta, 1);\n setMonth(next);\n setFocused(toIso(next));\n };\n\n const move = (deltaDays: number) => {\n const base = fromIso(focused) ?? new Date();\n const next = new Date(base.getFullYear(), base.getMonth(), base.getDate() + deltaDays);\n shouldFocus.current = true;\n setFocused(toIso(next));\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const steps: Record<string, number> = {\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -7,\n ArrowDown: 7,\n PageUp: -28,\n PageDown: 28,\n };\n const delta = steps[event.key];\n if (delta === undefined) {\n return;\n }\n event.preventDefault();\n move(delta);\n };\n\n return (\n <div\n ref={ref}\n className={cx(\"ds-calendar\", \"ds-field-surface\", className)}\n {...omitRequired(rest)}\n >\n <div className=\"ds-calendar__head ds-field-surface\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-left\"\n aria-label=\"Previous month\"\n onClick={() => changeMonth(-1)}\n />\n <span className=\"ds-calendar__month\">{monthLabel(month)}</span>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-right\"\n aria-label=\"Next month\"\n onClick={() => changeMonth(1)}\n />\n </div>\n <div\n className=\"ds-calendar__weekdays\"\n aria-hidden=\"true\"\n >\n {WEEKDAYS.map((day) => (\n <span key={day}>{day.slice(0, 2)}</span>\n ))}\n </div>\n <div\n ref={gridRef}\n className=\"ds-calendar__grid\"\n role=\"grid\"\n onKeyDown={onKeyDown}\n >\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n role=\"row\"\n className=\"ds-calendar__row\"\n key={rowIndex}\n >\n {days.slice(rowIndex * 7, rowIndex * 7 + 7).map((day) => {\n const iso = toIso(day);\n const isOutside = day.getMonth() !== month.getMonth();\n const isDisabled = (min && iso < min) || (max && iso > max);\n const inRange = Boolean(value && endValue && iso > value && iso < endValue);\n const isEdge = iso === value || iso === endValue;\n return (\n <Button\n key={iso}\n variant={dayVariant(isEdge, inRange, iso === today)}\n size=\"sm\"\n isIconOnly\n role=\"gridcell\"\n aria-label={formatIsoDate(iso)}\n tabIndex={iso === focused ? 0 : -1}\n isDisabled={Boolean(isDisabled)}\n aria-selected={isEdge || undefined}\n data-outside={isOutside || undefined}\n data-today={iso === today || undefined}\n data-in-range={inRange || undefined}\n data-focused={iso === focused || undefined}\n className=\"ds-calendar__day\"\n onClick={() => {\n setFocused(iso);\n onSelect?.(iso);\n }}\n >\n {day.getDate()}\n </Button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nexport interface DateFieldProps extends FieldBinding {\n /** Preferred side; the shared Popover flips when space requires it. */\n placement?: PopoverPlacement;\n value?: IsoDate;\n defaultValue?: IsoDate;\n onValueChange?: (value: IsoDate) => void;\n size?: FieldSize;\n placeholder?: string;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Show a separate clear action when populated. Defaults to false. */\n isClearable?: boolean;\n clearLabel?: string;\n className?: string;\n}\n\n/** One day, picked from a calendar. The field prints the long date, never a mask. */\nexport function DateField({\n value,\n defaultValue = \"\",\n onValueChange,\n size = \"md\",\n placeholder = \"Pick a date\",\n placement,\n min,\n max,\n isDisabled = false,\n isInvalid = false,\n isClearable = false,\n clearLabel = \"Clear date\",\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n ...rest\n}: DateFieldProps) {\n const [internal, setInternal] = useState<IsoDate>(defaultValue);\n const current = value ?? internal;\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n if (isOpen && isDisabled) {\n setOpen(false);\n }\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n // The roving day is always in bounds; the panel takes focus only if bounds exclude every day.\n const panel = panelRef.current;\n (panel?.querySelector<HTMLButtonElement>(\"[data-focused]:not(:disabled)\") ?? panel)?.focus();\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n }, [isOpen]);\n\n return (\n <div\n className={cx(\"ds-datefield\", className)}\n ref={rootRef}\n onKeyDown={(event) => {\n if (isOpen && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus();\n }\n }}\n >\n <Button\n {...omitRequired(rest)}\n ref={triggerRef}\n id={triggerId}\n size={size}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-invalid={isInvalid || ariaInvalid || undefined}\n isDisabled={isDisabled}\n data-placeholder={current ? undefined : \"\"}\n className=\"ds-field-skin ds-datefield__control\"\n onClick={() => setOpen((open) => !open)}\n >\n <span className=\"ds-datefield__value\">\n {current ? formatIsoDate(current) : placeholder}\n </span>\n <Icon\n name=\"calendar\"\n size={16}\n className=\"ds-datefield__glyph\"\n />\n </Button>\n {isClearable && current && (\n <Button\n variant=\"simple\"\n size={size}\n isIconOnly\n iconStart=\"x\"\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onClick={() => {\n if (value === undefined) {\n setInternal(\"\");\n }\n onValueChange?.(\"\");\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n )}\n <Popover\n anchorRef={triggerRef}\n placement={placement}\n anchorId={triggerId}\n isOpen={isOpen}\n align=\"start\"\n panelRef={panelRef}\n className=\"ds-datefield__popover\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n // A click on the heading or padding focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n >\n <Calendar\n value={current}\n min={min}\n max={max}\n onSelect={(next) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n </Popover>\n </div>\n );\n}\n\nexport interface DateRangeValue {\n start: IsoDate;\n end: IsoDate;\n}\n\nexport interface DateRangeFieldProps extends FieldBinding {\n placement?: PopoverPlacement;\n value?: DateRangeValue;\n defaultValue?: DateRangeValue;\n onValueChange?: (value: DateRangeValue) => void;\n size?: FieldSize;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isClearable?: boolean;\n startLabel?: string;\n endLabel?: string;\n className?: string;\n}\n\nfunction rangeBound(endpoint: string, bound: string | undefined, kind: \"min\" | \"max\") {\n if (!fromIso(endpoint)) {\n return bound;\n }\n if (!bound) {\n return endpoint;\n }\n return kind === \"min\"\n ? endpoint > bound\n ? endpoint\n : bound\n : endpoint < bound\n ? endpoint\n : bound;\n}\n\n/** A span of days. The end field never offers a day before the start. */\nexport function DateRangeField({\n value,\n defaultValue = { start: \"\", end: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n isDisabled = false,\n isClearable = false,\n startLabel = \"Start date\",\n endLabel = \"End date\",\n placement,\n className,\n ...binding\n}: DateRangeFieldProps) {\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: DateRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-daterange\", className)}\n >\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={startLabel}\n placement={placement}\n size={size}\n value={current.start}\n min={min}\n max={rangeBound(current.end, max, \"max\")}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${startLabel}`}\n placeholder={startLabel}\n onValueChange={(next) => commit({ ...current, start: next })}\n />\n <span\n className=\"ds-daterange__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={endLabel}\n placement={placement}\n size={size}\n value={current.end}\n min={rangeBound(current.start, min, \"min\")}\n max={max}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${endLabel}`}\n placeholder={endLabel}\n onValueChange={(next) => commit({ ...current, end: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAGA,SAAgBI,EAAM,GAAqB;CACzC,IAAMC,IAAQ,GAAGC,EAAK,SAAS,IAAI,IAAI,SAAS,GAAG,GAAG,GAChDC,IAAM,GAAGD,EAAK,QAAQ,IAAI,SAAS,GAAG,GAAG;CAC/C,OAAO,GAAGA,EAAK,YAAY,EAAE,GAAGD,EAAM,GAAGE;AAC3C;AAEA,SAAgBC,EAAQ,GAAwC;CAC9D,IAAI,CAACC,KAAS,CAAC,sBAAsB,KAAKA,CAAK,GAC7C,OAAO;CAET,IAAM,CAACC,GAAML,GAAOE,KAAOE,EAAM,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;CACtD,IAAI,CAACC,KAAQ,CAACL,KAAS,CAACE,GACtB,OAAO;CAET,IAAMD,IAAO,IAAI,KAAKI,GAAML,IAAQ,GAAGE,CAAG;CAC1C,OAAO,OAAO,MAAMD,EAAK,QAAQ,CAAC,KAAKF,EAAME,CAAI,MAAMG,IAAQ,OAAOH;AACxE;AAGA,SAAgBK,EAAU,GAAe;CACvC,OAAOH,EAAQC,CAAK,MAAM;AAC5B;AAGA,SAAgBG,EAAc,GAAmC;CAC/D,IAAMN,IAAOE,EAAQC,CAAK;CAI1B,OAHKH,IAGE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C;IACb,YAAY,SAAS2E;IACrB,aAAaA;IACb,gBAAgB,MAASH,EAAO;KAAE,GAAG1B;KAAS,KAAKzB;IAAK,CAAC;GAC1D,CAAA;EACE;;AAET"}
1
+ {"version":3,"file":"DatePicker-VQUsbYdo.js","names":["Icon","useOverlayOpen","omitRequired","useGroupBinding","toIso","month","date","day","fromIso","value","year","isIsoDate","formatIsoDate","cx","parts","WEEKDAYS","focusableDay","min","max","monthLabel","startOfGrid","first","weekday","dayVariant","isEdge","inRange","isToday","Calendar","forwardRef","rest","focused","setFocused","useState","setMonth","gridRef","useRef","shouldFocus","useEffect","next","days","start","index","today","changeMonth","delta","move","base","deltaDays","onKeyDown","event","className","Button","rowIndex","iso","isOutside","isDisabled","endValue","onSelect","DateField","ariaInvalid","internal","setInternal","defaultValue","current","open","setOpen","isOpen","rootRef","triggerRef","panelRef","generatedId","useId","triggerId","id","panel","onPointerDown","target","isInvalid","placeholder","isClearable","clearLabel","onValueChange","Popover","rangeBound","endpoint","bound","kind","DateRangeField","binding","commit","attributes","startLabel","endLabel"],"sources":["../../src/components/DatePicker/date.ts","../../src/components/DatePicker/index.tsx"],"sourcesContent":["/** ISO calendar date, \"YYYY-MM-DD\" — the only date shape the system passes around. */\nexport type IsoDate = string;\n\nexport function toIso(date: Date): IsoDate {\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function fromIso(value: string | undefined): Date | null {\n if (!value || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return null;\n }\n const [year, month, day] = value.split(\"-\").map(Number);\n if (!year || !month || !day) {\n return null;\n }\n const date = new Date(year, month - 1, day);\n return Number.isNaN(date.getTime()) || toIso(date) !== value ? null : date;\n}\n\n/** A real calendar day in \"YYYY-MM-DD\" form, checked without locale formatting. */\nexport function isIsoDate(value: string) {\n return fromIso(value) !== null;\n}\n\n/** \"12 March 2026\" — the system's one long date format. */\nexport function formatIsoDate(value: string | undefined): string {\n const date = fromIso(value);\n if (!date) {\n return \"\";\n }\n return date.toLocaleDateString(\"en-GB\", { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n","import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { omitRequired, useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport { formatIsoDate, fromIso, toIso, type IsoDate } from \"./date\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport { formatIsoDate } from \"./date\";\nexport type { IsoDate } from \"./date\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n/** The selected day, or today when none is valid, moved inside the bounds so it can take focus. */\nfunction focusableDay(value: string | undefined, min?: IsoDate, max?: IsoDate): IsoDate {\n const day = fromIso(value) ? (value as IsoDate) : toIso(new Date());\n if (min && day < min) {\n return min;\n }\n return max && day > max ? max : day;\n}\n\nfunction monthLabel(date: Date) {\n return date.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" });\n}\n\nfunction startOfGrid(month: Date) {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const weekday = (first.getDay() + 6) % 7; // Monday-first\n return new Date(first.getFullYear(), first.getMonth(), 1 - weekday);\n}\n\nfunction dayVariant(isEdge: boolean, inRange: boolean, isToday: boolean) {\n if (isEdge) {\n return \"primary\";\n }\n if (inRange) {\n return \"active\";\n }\n return isToday ? \"neutral\" : \"simple\";\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Selected day, or the start of a selected span. */\n value?: IsoDate;\n /** End of a selected span. Set it to put the calendar in range mode. */\n endValue?: IsoDate;\n onSelect?: (value: IsoDate) => void;\n min?: IsoDate;\n max?: IsoDate;\n}\n\n/**\n * A month of days, Monday first. Arrow keys walk the grid; the month follows\n * the focused day, so a whole year is reachable from the keyboard.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n { value, endValue, onSelect, min, max, className, ...rest },\n ref,\n) {\n const [focused, setFocused] = useState<IsoDate>(() => focusableDay(value, min, max));\n const [month, setMonth] = useState(() => fromIso(focused) ?? new Date());\n const gridRef = useRef<HTMLDivElement | null>(null);\n const shouldFocus = useRef(false);\n\n useEffect(() => {\n if (!fromIso(value)) {\n return;\n }\n const day = focusableDay(value, min, max);\n const next = fromIso(day) ?? new Date();\n // Controlled changes intentionally reposition the visible and roving-focus month.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocused(day);\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n }, [value, min, max]);\n\n useEffect(() => {\n if (!shouldFocus.current) {\n return;\n }\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(\"[data-focused]\")?.focus();\n }, [focused]);\n\n const days = Array.from({ length: 42 }, (_, index) => {\n const start = startOfGrid(month);\n return new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);\n });\n\n const today = toIso(new Date());\n\n const changeMonth = (delta: number) => {\n const next = new Date(month.getFullYear(), month.getMonth() + delta, 1);\n setMonth(next);\n setFocused(toIso(next));\n };\n\n const move = (deltaDays: number) => {\n const base = fromIso(focused) ?? new Date();\n const next = new Date(base.getFullYear(), base.getMonth(), base.getDate() + deltaDays);\n shouldFocus.current = true;\n setFocused(toIso(next));\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const steps: Record<string, number> = {\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -7,\n ArrowDown: 7,\n PageUp: -28,\n PageDown: 28,\n };\n const delta = steps[event.key];\n if (delta === undefined) {\n return;\n }\n event.preventDefault();\n move(delta);\n };\n\n return (\n <div\n ref={ref}\n className={cx(\"ds-calendar\", \"ds-field-surface\", className)}\n {...omitRequired(rest)}\n >\n <div className=\"ds-calendar__head ds-field-surface\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-left\"\n aria-label=\"Previous month\"\n onClick={() => changeMonth(-1)}\n />\n <span className=\"ds-calendar__month\">{monthLabel(month)}</span>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-right\"\n aria-label=\"Next month\"\n onClick={() => changeMonth(1)}\n />\n </div>\n <div\n className=\"ds-calendar__weekdays\"\n aria-hidden=\"true\"\n >\n {WEEKDAYS.map((day) => (\n <span key={day}>{day.slice(0, 2)}</span>\n ))}\n </div>\n <div\n ref={gridRef}\n className=\"ds-calendar__grid\"\n role=\"grid\"\n onKeyDown={onKeyDown}\n >\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n role=\"row\"\n className=\"ds-calendar__row\"\n key={rowIndex}\n >\n {days.slice(rowIndex * 7, rowIndex * 7 + 7).map((day) => {\n const iso = toIso(day);\n const isOutside = day.getMonth() !== month.getMonth();\n const isDisabled = (min && iso < min) || (max && iso > max);\n const inRange = Boolean(value && endValue && iso > value && iso < endValue);\n const isEdge = iso === value || iso === endValue;\n return (\n <Button\n key={iso}\n variant={dayVariant(isEdge, inRange, iso === today)}\n size=\"sm\"\n isIconOnly\n role=\"gridcell\"\n aria-label={formatIsoDate(iso)}\n tabIndex={iso === focused ? 0 : -1}\n isDisabled={Boolean(isDisabled)}\n aria-selected={isEdge || undefined}\n data-outside={isOutside || undefined}\n data-today={iso === today || undefined}\n data-in-range={inRange || undefined}\n data-focused={iso === focused || undefined}\n className=\"ds-calendar__day\"\n onClick={() => {\n setFocused(iso);\n onSelect?.(iso);\n }}\n >\n {day.getDate()}\n </Button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nexport interface DateFieldProps extends FieldBinding {\n /** Preferred side; the shared Popover flips when space requires it. */\n placement?: PopoverPlacement;\n value?: IsoDate;\n defaultValue?: IsoDate;\n onValueChange?: (value: IsoDate) => void;\n size?: FieldSize;\n placeholder?: string;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Show a separate clear action when populated. Defaults to false. */\n isClearable?: boolean;\n clearLabel?: string;\n className?: string;\n}\n\n/** One day, picked from a calendar. The field prints the long date, never a mask. */\nexport function DateField({\n value,\n defaultValue = \"\",\n onValueChange,\n size = \"md\",\n placeholder = \"Pick a date\",\n placement,\n min,\n max,\n isDisabled = false,\n isInvalid = false,\n isClearable = false,\n clearLabel = \"Clear date\",\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n ...rest\n}: DateFieldProps) {\n const [internal, setInternal] = useState<IsoDate>(defaultValue);\n const current = value ?? internal;\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n if (isOpen && isDisabled) {\n setOpen(false);\n }\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n // The roving day is always in bounds; the panel takes focus only if bounds exclude every day.\n const panel = panelRef.current;\n (panel?.querySelector<HTMLButtonElement>(\"[data-focused]:not(:disabled)\") ?? panel)?.focus();\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n }, [isOpen]);\n\n return (\n <div\n className={cx(\"ds-datefield\", className)}\n ref={rootRef}\n onKeyDown={(event) => {\n if (isOpen && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus();\n }\n }}\n >\n <Button\n {...omitRequired(rest)}\n ref={triggerRef}\n id={triggerId}\n size={size}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-invalid={isInvalid || ariaInvalid || undefined}\n isDisabled={isDisabled}\n data-placeholder={current ? undefined : \"\"}\n className=\"ds-field-skin ds-datefield__control\"\n onClick={() => setOpen((open) => !open)}\n >\n <span className=\"ds-datefield__value\">\n {current ? formatIsoDate(current) : placeholder}\n </span>\n <Icon\n name=\"calendar\"\n size={16}\n className=\"ds-datefield__glyph\"\n />\n </Button>\n {isClearable && current && (\n <Button\n variant=\"simple\"\n size={size}\n isIconOnly\n iconStart=\"x\"\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onClick={() => {\n if (value === undefined) {\n setInternal(\"\");\n }\n onValueChange?.(\"\");\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n )}\n <Popover\n anchorRef={triggerRef}\n placement={placement}\n anchorId={triggerId}\n isOpen={isOpen}\n align=\"start\"\n panelRef={panelRef}\n className=\"ds-datefield__popover\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n // A click on the heading or padding focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n >\n <Calendar\n value={current}\n min={min}\n max={max}\n onSelect={(next) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n </Popover>\n </div>\n );\n}\n\nexport interface DateRangeValue {\n start: IsoDate;\n end: IsoDate;\n}\n\nexport interface DateRangeFieldProps extends FieldBinding {\n placement?: PopoverPlacement;\n value?: DateRangeValue;\n defaultValue?: DateRangeValue;\n onValueChange?: (value: DateRangeValue) => void;\n size?: FieldSize;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isClearable?: boolean;\n startLabel?: string;\n endLabel?: string;\n className?: string;\n}\n\nfunction rangeBound(endpoint: string, bound: string | undefined, kind: \"min\" | \"max\") {\n if (!fromIso(endpoint)) {\n return bound;\n }\n if (!bound) {\n return endpoint;\n }\n return kind === \"min\"\n ? endpoint > bound\n ? endpoint\n : bound\n : endpoint < bound\n ? endpoint\n : bound;\n}\n\n/** A span of days. The end field never offers a day before the start. */\nexport function DateRangeField({\n value,\n defaultValue = { start: \"\", end: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n isDisabled = false,\n isClearable = false,\n startLabel = \"Start date\",\n endLabel = \"End date\",\n placement,\n className,\n ...binding\n}: DateRangeFieldProps) {\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: DateRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-daterange\", className)}\n >\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={startLabel}\n placement={placement}\n size={size}\n value={current.start}\n min={min}\n max={rangeBound(current.end, max, \"max\")}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${startLabel}`}\n placeholder={startLabel}\n onValueChange={(next) => commit({ ...current, start: next })}\n />\n <span\n className=\"ds-daterange__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={endLabel}\n placement={placement}\n size={size}\n value={current.end}\n min={rangeBound(current.start, min, \"min\")}\n max={max}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${endLabel}`}\n placeholder={endLabel}\n onValueChange={(next) => commit({ ...current, end: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAGA,SAAgBI,EAAM,GAAqB;CACzC,IAAMC,IAAQ,GAAGC,EAAK,SAAS,IAAI,IAAI,SAAS,GAAG,GAAG,GAChDC,IAAM,GAAGD,EAAK,QAAQ,IAAI,SAAS,GAAG,GAAG;CAC/C,O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E,kBAAenC,EAAgBqF,CAAO;CAE9C,OACE,kBAAC,OAAD;EACE,GAAIE;EACJ,WAAW7E,EAAG,gBAAgBqC,CAAS;EAFzC,UAAA;GAIE,kBAACQ,GAAD;IACE,gBAAc8B,EAAQ;IACtB,cAAYG;IACD;IACL;IACN,OAAO5B,EAAQ;IACV;IACL,KAAKoB,EAAWpB,EAAQ,KAAK7C,GAAK,KAAK;IAC3B;IACC;IACb,YAAY,SAASyE;IACrB,aAAaA;IACb,gBAAgB,MAASF,EAAO;KAAE,GAAG1B;KAAS,OAAOzB;IAAK,CAAC;GAC5D,CAAA;GACD,kBAAC,QAAD;IACE,WAAU;IACV,eAAY;IACb,UAAA;GAEK,CAAA;GACN,kBAACoB,GAAD;IACE,gBAAc8B,EAAQ;IACtB,cAAYI;IACD;IACL;IACN,OAAO7B,EAAQ;IACf,KAAKoB,EAAWpB,EAAQ,OAAO9C,GAAK,KAAK;IACpC;IACO;IACC;IACb,YAAY,SAAS2E;IACrB,aAAaA;IACb,gBAAgB,MAASH,EAAO;KAAE,GAAG1B;KAAS,KAAKzB;IAAK,CAAC;GAC1D,CAAA;EACE;;AAET"}
@@ -1,2 +1,2 @@
1
- const e=require("./Icon-CnnTrtNb.cjs"),t=require("../components/Button/index.cjs"),n=require("./overlayLayer-CtOTt1xB.cjs");;/* empty css */const r=require("../components/Popover/index.cjs"),i=require("./binding-tMjrUzkU.cjs");let a=require("react"),o=require("react/jsx-runtime");function s(e){let t=`${e.getMonth()+1}`.padStart(2,`0`),n=`${e.getDate()}`.padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function c(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let[t,n,r]=e.split(`-`).map(Number);if(!t||!n||!r)return null;let i=new Date(t,n-1,r);return Number.isNaN(i.getTime())||s(i)!==e?null:i}function l(e){return c(e)!==null}function u(e){let t=c(e);return t?t.toLocaleDateString(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`}):``}function d(...e){return e.filter(Boolean).join(` `)}var f=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`];function p(e,t,n){let r=c(e)?e:s(new Date);return t&&r<t?t:n&&r>n?n:r}function m(e){return e.toLocaleDateString(`en-GB`,{month:`long`,year:`numeric`})}function h(e){let t=new Date(e.getFullYear(),e.getMonth(),1),n=(t.getDay()+6)%7;return new Date(t.getFullYear(),t.getMonth(),1-n)}function g(e,t,n){return e?`primary`:t?`active`:n?`neutral`:`simple`}var _=(0,a.forwardRef)(function({value:e,endValue:n,onSelect:r,min:l,max:_,className:v,...y},b){let[x,S]=(0,a.useState)(()=>p(e,l,_)),[C,w]=(0,a.useState)(()=>c(x)??new Date),T=(0,a.useRef)(null),E=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!c(e))return;let t=p(e,l,_),n=c(t)??new Date;S(t),w(new Date(n.getFullYear(),n.getMonth(),1))},[e,l,_]),(0,a.useEffect)(()=>{E.current&&(E.current=!1,T.current?.querySelector(`[data-focused]`)?.focus())},[x]);let D=Array.from({length:42},(e,t)=>{let n=h(C);return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t)}),O=s(new Date),k=e=>{let t=new Date(C.getFullYear(),C.getMonth()+e,1);w(t),S(s(t))},A=e=>{let t=c(x)??new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+e);E.current=!0,S(s(n)),w(new Date(n.getFullYear(),n.getMonth(),1))},j=e=>{let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,PageUp:-28,PageDown:28}[e.key];t!==void 0&&(e.preventDefault(),A(t))};return(0,o.jsxs)(`div`,{ref:b,className:d(`ds-calendar`,`ds-field-surface`,v),...i.n(y),children:[(0,o.jsxs)(`div`,{className:`ds-calendar__head ds-field-surface`,children:[(0,o.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`chevron-left`,"aria-label":`Previous month`,onClick:()=>k(-1)}),(0,o.jsx)(`span`,{className:`ds-calendar__month`,children:m(C)}),(0,o.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`chevron-right`,"aria-label":`Next month`,onClick:()=>k(1)})]}),(0,o.jsx)(`div`,{className:`ds-calendar__weekdays`,"aria-hidden":`true`,children:f.map(e=>(0,o.jsx)(`span`,{children:e.slice(0,2)},e))}),(0,o.jsx)(`div`,{ref:T,className:`ds-calendar__grid`,role:`grid`,onKeyDown:j,children:Array.from({length:6},(i,a)=>(0,o.jsx)(`div`,{role:`row`,className:`ds-calendar__row`,children:D.slice(a*7,a*7+7).map(i=>{let a=s(i),c=i.getMonth()!==C.getMonth(),d=l&&a<l||_&&a>_,f=!!(e&&n&&a>e&&a<n),p=a===e||a===n;return(0,o.jsx)(t.Button,{variant:g(p,f,a===O),size:`sm`,isIconOnly:!0,role:`gridcell`,"aria-label":u(a),tabIndex:a===x?0:-1,isDisabled:!!d,"aria-selected":p||void 0,"data-outside":c||void 0,"data-today":a===O||void 0,"data-in-range":f||void 0,"data-focused":a===x||void 0,className:`ds-calendar__day`,onClick:()=>{S(a),r?.(a)},children:i.getDate()},a)})},a))})]})});function v({value:s,defaultValue:c=``,onValueChange:l,size:f=`md`,placeholder:p=`Pick a date`,placement:m,min:h,max:g,isDisabled:v=!1,isInvalid:y=!1,isClearable:b=!1,clearLabel:x=`Clear date`,"aria-invalid":S,id:C,className:w,...T}){let[E,D]=(0,a.useState)(c),O=s??E,[k,A]=(0,a.useState)(!1),j=n.o(k),M=(0,a.useRef)(null),N=(0,a.useRef)(null),P=(0,a.useRef)(null),F=(0,a.useId)(),I=C??F;return j&&v&&A(!1),(0,a.useEffect)(()=>{if(!j)return;let e=P.current;(e?.querySelector(`[data-focused]:not(:disabled)`)??e)?.focus();let t=e=>{let t=e.target;!M.current?.contains(t)&&!P.current?.contains(t)&&A(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[j]),(0,o.jsxs)(`div`,{className:d(`ds-datefield`,w),ref:M,onKeyDown:e=>{j&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),A(!1),N.current?.focus())},children:[(0,o.jsxs)(t.Button,{...i.n(T),ref:N,id:I,size:f,"aria-haspopup":`dialog`,"aria-expanded":j,"aria-invalid":y||S||void 0,isDisabled:v,"data-placeholder":O?void 0:``,className:`ds-field-skin ds-datefield__control`,onClick:()=>A(e=>!e),children:[(0,o.jsx)(`span`,{className:`ds-datefield__value`,children:O?u(O):p}),(0,o.jsx)(e.t,{name:`calendar`,size:16,className:`ds-datefield__glyph`})]}),b&&O&&(0,o.jsx)(t.Button,{variant:`simple`,size:f,isIconOnly:!0,iconStart:`x`,"aria-label":x,isDisabled:v,onClick:()=>{s===void 0&&D(``),l?.(``),A(!1),N.current?.focus()}}),(0,o.jsx)(r.Popover,{anchorRef:N,placement:m,anchorId:I,isOpen:j,align:`start`,panelRef:P,className:`ds-datefield__popover`,role:`dialog`,"aria-label":`Choose a date`,tabIndex:-1,children:(0,o.jsx)(_,{value:O,min:h,max:g,onSelect:e=>{s===void 0&&D(e),l?.(e),A(!1),N.current?.focus()}})})]})}function y(e,t,n){return c(e)?t?n===`min`?e>t?e:t:e<t?e:t:e:t}function b({value:e,defaultValue:t={start:``,end:``},onValueChange:n,size:r=`md`,min:s,max:c,isDisabled:l=!1,isClearable:u=!1,startLabel:f=`Start date`,endLabel:p=`End date`,placement:m,className:h,...g}){let[_,b]=(0,a.useState)(t),x=e??_,S=t=>{e===void 0&&b(t),n?.(t)},{attributes:C}=i.r(g);return(0,o.jsxs)(`div`,{...C,className:d(`ds-daterange`,h),children:[(0,o.jsx)(v,{"aria-invalid":g[`aria-invalid`],"aria-label":f,placement:m,size:r,value:x.start,min:s,max:y(x.end,c,`max`),isDisabled:l,isClearable:u,clearLabel:`Clear ${f}`,placeholder:f,onValueChange:e=>S({...x,start:e})}),(0,o.jsx)(`span`,{className:`ds-daterange__dash`,"aria-hidden":`true`,children:`–`}),(0,o.jsx)(v,{"aria-invalid":g[`aria-invalid`],"aria-label":p,placement:m,size:r,value:x.end,min:y(x.start,s,`min`),max:c,isDisabled:l,isClearable:u,clearLabel:`Clear ${p}`,placeholder:p,onValueChange:e=>S({...x,end:e})})]})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
2
- //# sourceMappingURL=DatePicker-DOg3iQYy.cjs.map
1
+ const e=require("./Icon-QLZH31JA.cjs"),t=require("../components/Button/index.cjs"),n=require("./overlayLayer-CPd3zj_u.cjs");;/* empty css */const r=require("../components/Popover/index.cjs"),i=require("./binding-tMjrUzkU.cjs");let a=require("react"),o=require("react/jsx-runtime");function s(e){let t=`${e.getMonth()+1}`.padStart(2,`0`),n=`${e.getDate()}`.padStart(2,`0`);return`${e.getFullYear()}-${t}-${n}`}function c(e){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;let[t,n,r]=e.split(`-`).map(Number);if(!t||!n||!r)return null;let i=new Date(t,n-1,r);return Number.isNaN(i.getTime())||s(i)!==e?null:i}function l(e){return c(e)!==null}function u(e){let t=c(e);return t?t.toLocaleDateString(`en-GB`,{day:`numeric`,month:`long`,year:`numeric`}):``}function d(...e){return e.filter(Boolean).join(` `)}var f=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`];function p(e,t,n){let r=c(e)?e:s(new Date);return t&&r<t?t:n&&r>n?n:r}function m(e){return e.toLocaleDateString(`en-GB`,{month:`long`,year:`numeric`})}function h(e){let t=new Date(e.getFullYear(),e.getMonth(),1),n=(t.getDay()+6)%7;return new Date(t.getFullYear(),t.getMonth(),1-n)}function g(e,t,n){return e?`primary`:t?`active`:n?`neutral`:`simple`}var _=(0,a.forwardRef)(function({value:e,endValue:n,onSelect:r,min:l,max:_,className:v,...y},b){let[x,S]=(0,a.useState)(()=>p(e,l,_)),[C,w]=(0,a.useState)(()=>c(x)??new Date),T=(0,a.useRef)(null),E=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(!c(e))return;let t=p(e,l,_),n=c(t)??new Date;S(t),w(new Date(n.getFullYear(),n.getMonth(),1))},[e,l,_]),(0,a.useEffect)(()=>{E.current&&(E.current=!1,T.current?.querySelector(`[data-focused]`)?.focus())},[x]);let D=Array.from({length:42},(e,t)=>{let n=h(C);return new Date(n.getFullYear(),n.getMonth(),n.getDate()+t)}),O=s(new Date),k=e=>{let t=new Date(C.getFullYear(),C.getMonth()+e,1);w(t),S(s(t))},A=e=>{let t=c(x)??new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+e);E.current=!0,S(s(n)),w(new Date(n.getFullYear(),n.getMonth(),1))},j=e=>{let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-7,ArrowDown:7,PageUp:-28,PageDown:28}[e.key];t!==void 0&&(e.preventDefault(),A(t))};return(0,o.jsxs)(`div`,{ref:b,className:d(`ds-calendar`,`ds-field-surface`,v),...i.n(y),children:[(0,o.jsxs)(`div`,{className:`ds-calendar__head ds-field-surface`,children:[(0,o.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`chevron-left`,"aria-label":`Previous month`,onClick:()=>k(-1)}),(0,o.jsx)(`span`,{className:`ds-calendar__month`,children:m(C)}),(0,o.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`chevron-right`,"aria-label":`Next month`,onClick:()=>k(1)})]}),(0,o.jsx)(`div`,{className:`ds-calendar__weekdays`,"aria-hidden":`true`,children:f.map(e=>(0,o.jsx)(`span`,{children:e.slice(0,2)},e))}),(0,o.jsx)(`div`,{ref:T,className:`ds-calendar__grid`,role:`grid`,onKeyDown:j,children:Array.from({length:6},(i,a)=>(0,o.jsx)(`div`,{role:`row`,className:`ds-calendar__row`,children:D.slice(a*7,a*7+7).map(i=>{let a=s(i),c=i.getMonth()!==C.getMonth(),d=l&&a<l||_&&a>_,f=!!(e&&n&&a>e&&a<n),p=a===e||a===n;return(0,o.jsx)(t.Button,{variant:g(p,f,a===O),size:`sm`,isIconOnly:!0,role:`gridcell`,"aria-label":u(a),tabIndex:a===x?0:-1,isDisabled:!!d,"aria-selected":p||void 0,"data-outside":c||void 0,"data-today":a===O||void 0,"data-in-range":f||void 0,"data-focused":a===x||void 0,className:`ds-calendar__day`,onClick:()=>{S(a),r?.(a)},children:i.getDate()},a)})},a))})]})});function v({value:s,defaultValue:c=``,onValueChange:l,size:f=`md`,placeholder:p=`Pick a date`,placement:m,min:h,max:g,isDisabled:v=!1,isInvalid:y=!1,isClearable:b=!1,clearLabel:x=`Clear date`,"aria-invalid":S,id:C,className:w,...T}){let[E,D]=(0,a.useState)(c),O=s??E,[k,A]=(0,a.useState)(!1),j=n.o(k),M=(0,a.useRef)(null),N=(0,a.useRef)(null),P=(0,a.useRef)(null),F=(0,a.useId)(),I=C??F;return j&&v&&A(!1),(0,a.useEffect)(()=>{if(!j)return;let e=P.current;(e?.querySelector(`[data-focused]:not(:disabled)`)??e)?.focus();let t=e=>{let t=e.target;!M.current?.contains(t)&&!P.current?.contains(t)&&A(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[j]),(0,o.jsxs)(`div`,{className:d(`ds-datefield`,w),ref:M,onKeyDown:e=>{j&&e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),A(!1),N.current?.focus())},children:[(0,o.jsxs)(t.Button,{...i.n(T),ref:N,id:I,size:f,"aria-haspopup":`dialog`,"aria-expanded":j,"aria-invalid":y||S||void 0,isDisabled:v,"data-placeholder":O?void 0:``,className:`ds-field-skin ds-datefield__control`,onClick:()=>A(e=>!e),children:[(0,o.jsx)(`span`,{className:`ds-datefield__value`,children:O?u(O):p}),(0,o.jsx)(e.t,{name:`calendar`,size:16,className:`ds-datefield__glyph`})]}),b&&O&&(0,o.jsx)(t.Button,{variant:`simple`,size:f,isIconOnly:!0,iconStart:`x`,"aria-label":x,isDisabled:v,onClick:()=>{s===void 0&&D(``),l?.(``),A(!1),N.current?.focus()}}),(0,o.jsx)(r.Popover,{anchorRef:N,placement:m,anchorId:I,isOpen:j,align:`start`,panelRef:P,className:`ds-datefield__popover`,role:`dialog`,"aria-label":`Choose a date`,tabIndex:-1,children:(0,o.jsx)(_,{value:O,min:h,max:g,onSelect:e=>{s===void 0&&D(e),l?.(e),A(!1),N.current?.focus()}})})]})}function y(e,t,n){return c(e)?t?n===`min`?e>t?e:t:e<t?e:t:e:t}function b({value:e,defaultValue:t={start:``,end:``},onValueChange:n,size:r=`md`,min:s,max:c,isDisabled:l=!1,isClearable:u=!1,startLabel:f=`Start date`,endLabel:p=`End date`,placement:m,className:h,...g}){let[_,b]=(0,a.useState)(t),x=e??_,S=t=>{e===void 0&&b(t),n?.(t)},{attributes:C}=i.r(g);return(0,o.jsxs)(`div`,{...C,className:d(`ds-daterange`,h),children:[(0,o.jsx)(v,{"aria-invalid":g[`aria-invalid`],"aria-label":f,placement:m,size:r,value:x.start,min:s,max:y(x.end,c,`max`),isDisabled:l,isClearable:u,clearLabel:`Clear ${f}`,placeholder:f,onValueChange:e=>S({...x,start:e})}),(0,o.jsx)(`span`,{className:`ds-daterange__dash`,"aria-hidden":`true`,children:`–`}),(0,o.jsx)(v,{"aria-invalid":g[`aria-invalid`],"aria-label":p,placement:m,size:r,value:x.end,min:y(x.start,s,`min`),max:c,isDisabled:l,isClearable:u,clearLabel:`Clear ${p}`,placeholder:p,onValueChange:e=>S({...x,end:e})})]})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return _}});
2
+ //# sourceMappingURL=DatePicker-zA0bWVBp.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker-DOg3iQYy.cjs","names":["forwardRef","useState","useRef","omitRequired","Button","useOverlayOpen","useId","Icon","Popover","useGroupBinding","require_Icon","require_components_Button_index","require_overlayLayer","require_components_Popover_index","require_binding","react","react_jsx_runtime","toIso","month","date","day","fromIso","value","year","isIsoDate","formatIsoDate","cx","parts","WEEKDAYS","focusableDay","min","max","monthLabel","startOfGrid","first","weekday","dayVariant","isEdge","inRange","isToday","Calendar","rest","focused","setFocused","setMonth","gridRef","shouldFocus","next","days","start","index","today","changeMonth","delta","move","base","deltaDays","onKeyDown","event","className","rowIndex","iso","isOutside","isDisabled","endValue","onSelect","DateField","ariaInvalid","internal","setInternal","defaultValue","current","open","setOpen","isOpen","rootRef","triggerRef","panelRef","generatedId","triggerId","id","panel","onPointerDown","target","isInvalid","placeholder","isClearable","clearLabel","onValueChange","rangeBound","endpoint","bound","kind","DateRangeField","binding","commit","attributes","startLabel","endLabel"],"sources":["../../src/components/DatePicker/date.ts","../../src/components/DatePicker/index.tsx"],"sourcesContent":["/** ISO calendar date, \"YYYY-MM-DD\" — the only date shape the system passes around. */\nexport type IsoDate = string;\n\nexport function toIso(date: Date): IsoDate {\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function fromIso(value: string | undefined): Date | null {\n if (!value || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return null;\n }\n const [year, month, day] = value.split(\"-\").map(Number);\n if (!year || !month || !day) {\n return null;\n }\n const date = new Date(year, month - 1, day);\n return Number.isNaN(date.getTime()) || toIso(date) !== value ? null : date;\n}\n\n/** A real calendar day in \"YYYY-MM-DD\" form, checked without locale formatting. */\nexport function isIsoDate(value: string) {\n return fromIso(value) !== null;\n}\n\n/** \"12 March 2026\" — the system's one long date format. */\nexport function formatIsoDate(value: string | undefined): string {\n const date = fromIso(value);\n if (!date) {\n return \"\";\n }\n return date.toLocaleDateString(\"en-GB\", { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n","import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { omitRequired, useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport { formatIsoDate, fromIso, toIso, type IsoDate } from \"./date\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport { formatIsoDate } from \"./date\";\nexport type { IsoDate } from \"./date\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n/** The selected day, or today when none is valid, moved inside the bounds so it can take focus. */\nfunction focusableDay(value: string | undefined, min?: IsoDate, max?: IsoDate): IsoDate {\n const day = fromIso(value) ? (value as IsoDate) : toIso(new Date());\n if (min && day < min) {\n return min;\n }\n return max && day > max ? max : day;\n}\n\nfunction monthLabel(date: Date) {\n return date.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" });\n}\n\nfunction startOfGrid(month: Date) {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const weekday = (first.getDay() + 6) % 7; // Monday-first\n return new Date(first.getFullYear(), first.getMonth(), 1 - weekday);\n}\n\nfunction dayVariant(isEdge: boolean, inRange: boolean, isToday: boolean) {\n if (isEdge) {\n return \"primary\";\n }\n if (inRange) {\n return \"active\";\n }\n return isToday ? \"neutral\" : \"simple\";\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Selected day, or the start of a selected span. */\n value?: IsoDate;\n /** End of a selected span. Set it to put the calendar in range mode. */\n endValue?: IsoDate;\n onSelect?: (value: IsoDate) => void;\n min?: IsoDate;\n max?: IsoDate;\n}\n\n/**\n * A month of days, Monday first. Arrow keys walk the grid; the month follows\n * the focused day, so a whole year is reachable from the keyboard.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n { value, endValue, onSelect, min, max, className, ...rest },\n ref,\n) {\n const [focused, setFocused] = useState<IsoDate>(() => focusableDay(value, min, max));\n const [month, setMonth] = useState(() => fromIso(focused) ?? new Date());\n const gridRef = useRef<HTMLDivElement | null>(null);\n const shouldFocus = useRef(false);\n\n useEffect(() => {\n if (!fromIso(value)) {\n return;\n }\n const day = focusableDay(value, min, max);\n const next = fromIso(day) ?? new Date();\n // Controlled changes intentionally reposition the visible and roving-focus month.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocused(day);\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n }, [value, min, max]);\n\n useEffect(() => {\n if (!shouldFocus.current) {\n return;\n }\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(\"[data-focused]\")?.focus();\n }, [focused]);\n\n const days = Array.from({ length: 42 }, (_, index) => {\n const start = startOfGrid(month);\n return new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);\n });\n\n const today = toIso(new Date());\n\n const changeMonth = (delta: number) => {\n const next = new Date(month.getFullYear(), month.getMonth() + delta, 1);\n setMonth(next);\n setFocused(toIso(next));\n };\n\n const move = (deltaDays: number) => {\n const base = fromIso(focused) ?? new Date();\n const next = new Date(base.getFullYear(), base.getMonth(), base.getDate() + deltaDays);\n shouldFocus.current = true;\n setFocused(toIso(next));\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const steps: Record<string, number> = {\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -7,\n ArrowDown: 7,\n PageUp: -28,\n PageDown: 28,\n };\n const delta = steps[event.key];\n if (delta === undefined) {\n return;\n }\n event.preventDefault();\n move(delta);\n };\n\n return (\n <div\n ref={ref}\n className={cx(\"ds-calendar\", \"ds-field-surface\", className)}\n {...omitRequired(rest)}\n >\n <div className=\"ds-calendar__head ds-field-surface\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-left\"\n aria-label=\"Previous month\"\n onClick={() => changeMonth(-1)}\n />\n <span className=\"ds-calendar__month\">{monthLabel(month)}</span>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-right\"\n aria-label=\"Next month\"\n onClick={() => changeMonth(1)}\n />\n </div>\n <div\n className=\"ds-calendar__weekdays\"\n aria-hidden=\"true\"\n >\n {WEEKDAYS.map((day) => (\n <span key={day}>{day.slice(0, 2)}</span>\n ))}\n </div>\n <div\n ref={gridRef}\n className=\"ds-calendar__grid\"\n role=\"grid\"\n onKeyDown={onKeyDown}\n >\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n role=\"row\"\n className=\"ds-calendar__row\"\n key={rowIndex}\n >\n {days.slice(rowIndex * 7, rowIndex * 7 + 7).map((day) => {\n const iso = toIso(day);\n const isOutside = day.getMonth() !== month.getMonth();\n const isDisabled = (min && iso < min) || (max && iso > max);\n const inRange = Boolean(value && endValue && iso > value && iso < endValue);\n const isEdge = iso === value || iso === endValue;\n return (\n <Button\n key={iso}\n variant={dayVariant(isEdge, inRange, iso === today)}\n size=\"sm\"\n isIconOnly\n role=\"gridcell\"\n aria-label={formatIsoDate(iso)}\n tabIndex={iso === focused ? 0 : -1}\n isDisabled={Boolean(isDisabled)}\n aria-selected={isEdge || undefined}\n data-outside={isOutside || undefined}\n data-today={iso === today || undefined}\n data-in-range={inRange || undefined}\n data-focused={iso === focused || undefined}\n className=\"ds-calendar__day\"\n onClick={() => {\n setFocused(iso);\n onSelect?.(iso);\n }}\n >\n {day.getDate()}\n </Button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nexport interface DateFieldProps extends FieldBinding {\n /** Preferred side; the shared Popover flips when space requires it. */\n placement?: PopoverPlacement;\n value?: IsoDate;\n defaultValue?: IsoDate;\n onValueChange?: (value: IsoDate) => void;\n size?: FieldSize;\n placeholder?: string;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Show a separate clear action when populated. Defaults to false. */\n isClearable?: boolean;\n clearLabel?: string;\n className?: string;\n}\n\n/** One day, picked from a calendar. The field prints the long date, never a mask. */\nexport function DateField({\n value,\n defaultValue = \"\",\n onValueChange,\n size = \"md\",\n placeholder = \"Pick a date\",\n placement,\n min,\n max,\n isDisabled = false,\n isInvalid = false,\n isClearable = false,\n clearLabel = \"Clear date\",\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n ...rest\n}: DateFieldProps) {\n const [internal, setInternal] = useState<IsoDate>(defaultValue);\n const current = value ?? internal;\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n if (isOpen && isDisabled) {\n setOpen(false);\n }\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n // The roving day is always in bounds; the panel takes focus only if bounds exclude every day.\n const panel = panelRef.current;\n (panel?.querySelector<HTMLButtonElement>(\"[data-focused]:not(:disabled)\") ?? panel)?.focus();\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n }, [isOpen]);\n\n return (\n <div\n className={cx(\"ds-datefield\", className)}\n ref={rootRef}\n onKeyDown={(event) => {\n if (isOpen && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus();\n }\n }}\n >\n <Button\n {...omitRequired(rest)}\n ref={triggerRef}\n id={triggerId}\n size={size}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-invalid={isInvalid || ariaInvalid || undefined}\n isDisabled={isDisabled}\n data-placeholder={current ? undefined : \"\"}\n className=\"ds-field-skin ds-datefield__control\"\n onClick={() => setOpen((open) => !open)}\n >\n <span className=\"ds-datefield__value\">\n {current ? formatIsoDate(current) : placeholder}\n </span>\n <Icon\n name=\"calendar\"\n size={16}\n className=\"ds-datefield__glyph\"\n />\n </Button>\n {isClearable && current && (\n <Button\n variant=\"simple\"\n size={size}\n isIconOnly\n iconStart=\"x\"\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onClick={() => {\n if (value === undefined) {\n setInternal(\"\");\n }\n onValueChange?.(\"\");\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n )}\n <Popover\n anchorRef={triggerRef}\n placement={placement}\n anchorId={triggerId}\n isOpen={isOpen}\n align=\"start\"\n panelRef={panelRef}\n className=\"ds-datefield__popover\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n // A click on the heading or padding focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n >\n <Calendar\n value={current}\n min={min}\n max={max}\n onSelect={(next) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n </Popover>\n </div>\n );\n}\n\nexport interface DateRangeValue {\n start: IsoDate;\n end: IsoDate;\n}\n\nexport interface DateRangeFieldProps extends FieldBinding {\n placement?: PopoverPlacement;\n value?: DateRangeValue;\n defaultValue?: DateRangeValue;\n onValueChange?: (value: DateRangeValue) => void;\n size?: FieldSize;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isClearable?: boolean;\n startLabel?: string;\n endLabel?: string;\n className?: string;\n}\n\nfunction rangeBound(endpoint: string, bound: string | undefined, kind: \"min\" | \"max\") {\n if (!fromIso(endpoint)) {\n return bound;\n }\n if (!bound) {\n return endpoint;\n }\n return kind === \"min\"\n ? endpoint > bound\n ? endpoint\n : bound\n : endpoint < bound\n ? endpoint\n : bound;\n}\n\n/** A span of days. The end field never offers a day before the start. */\nexport function DateRangeField({\n value,\n defaultValue = { start: \"\", end: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n isDisabled = false,\n isClearable = false,\n startLabel = \"Start date\",\n endLabel = \"End date\",\n placement,\n className,\n ...binding\n}: DateRangeFieldProps) {\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: DateRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-daterange\", className)}\n >\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={startLabel}\n placement={placement}\n size={size}\n value={current.start}\n min={min}\n max={rangeBound(current.end, max, \"max\")}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${startLabel}`}\n placeholder={startLabel}\n onValueChange={(next) => commit({ ...current, start: next })}\n />\n <span\n className=\"ds-daterange__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={endLabel}\n placement={placement}\n size={size}\n value={current.end}\n min={rangeBound(current.start, min, \"min\")}\n max={max}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${endLabel}`}\n placeholder={endLabel}\n onValueChange={(next) => commit({ ...current, end: next })}\n />\n </div>\n );\n}\n"],"mappings":"A,ySAGA,SAAgBiB,EAAM,EAAqB,CACzC,IAAMC,EAAQ,GAAGC,EAAK,SAAS,EAAI,IAAI,SAAS,EAAG,GAAG,EAChDC,EAAM,GAAGD,EAAK,QAAQ,IAAI,SAAS,EAAG,GAAG,EAC/C,MAAO,GAAGA,EAAK,YAAY,EAAE,GAAGD,EAAM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b,cAAgB,GAASH,EAAO,CAAE,GAAGxB,EAAS,IAAKxB,CAAK,CAAC,CAC1D,CAAA,CACE,C,EAET,C"}
1
+ {"version":3,"file":"DatePicker-zA0bWVBp.cjs","names":["forwardRef","useState","useRef","omitRequired","Button","useOverlayOpen","useId","Icon","Popover","useGroupBinding","require_Icon","require_components_Button_index","require_overlayLayer","require_components_Popover_index","require_binding","react","react_jsx_runtime","toIso","month","date","day","fromIso","value","year","isIsoDate","formatIsoDate","cx","parts","WEEKDAYS","focusableDay","min","max","monthLabel","startOfGrid","first","weekday","dayVariant","isEdge","inRange","isToday","Calendar","rest","focused","setFocused","setMonth","gridRef","shouldFocus","next","days","start","index","today","changeMonth","delta","move","base","deltaDays","onKeyDown","event","className","rowIndex","iso","isOutside","isDisabled","endValue","onSelect","DateField","ariaInvalid","internal","setInternal","defaultValue","current","open","setOpen","isOpen","rootRef","triggerRef","panelRef","generatedId","triggerId","id","panel","onPointerDown","target","isInvalid","placeholder","isClearable","clearLabel","onValueChange","rangeBound","endpoint","bound","kind","DateRangeField","binding","commit","attributes","startLabel","endLabel"],"sources":["../../src/components/DatePicker/date.ts","../../src/components/DatePicker/index.tsx"],"sourcesContent":["/** ISO calendar date, \"YYYY-MM-DD\" — the only date shape the system passes around. */\nexport type IsoDate = string;\n\nexport function toIso(date: Date): IsoDate {\n const month = `${date.getMonth() + 1}`.padStart(2, \"0\");\n const day = `${date.getDate()}`.padStart(2, \"0\");\n return `${date.getFullYear()}-${month}-${day}`;\n}\n\nexport function fromIso(value: string | undefined): Date | null {\n if (!value || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) {\n return null;\n }\n const [year, month, day] = value.split(\"-\").map(Number);\n if (!year || !month || !day) {\n return null;\n }\n const date = new Date(year, month - 1, day);\n return Number.isNaN(date.getTime()) || toIso(date) !== value ? null : date;\n}\n\n/** A real calendar day in \"YYYY-MM-DD\" form, checked without locale formatting. */\nexport function isIsoDate(value: string) {\n return fromIso(value) !== null;\n}\n\n/** \"12 March 2026\" — the system's one long date format. */\nexport function formatIsoDate(value: string | undefined): string {\n const date = fromIso(value);\n if (!date) {\n return \"\";\n }\n return date.toLocaleDateString(\"en-GB\", { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n","import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport { forwardRef, useEffect, useId, useRef, useState, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport { Popover, type PopoverPlacement } from \"../Popover\";\nimport { omitRequired, useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport { formatIsoDate, fromIso, toIso, type IsoDate } from \"./date\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport { formatIsoDate } from \"./date\";\nexport type { IsoDate } from \"./date\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst WEEKDAYS = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"];\n\n/** The selected day, or today when none is valid, moved inside the bounds so it can take focus. */\nfunction focusableDay(value: string | undefined, min?: IsoDate, max?: IsoDate): IsoDate {\n const day = fromIso(value) ? (value as IsoDate) : toIso(new Date());\n if (min && day < min) {\n return min;\n }\n return max && day > max ? max : day;\n}\n\nfunction monthLabel(date: Date) {\n return date.toLocaleDateString(\"en-GB\", { month: \"long\", year: \"numeric\" });\n}\n\nfunction startOfGrid(month: Date) {\n const first = new Date(month.getFullYear(), month.getMonth(), 1);\n const weekday = (first.getDay() + 6) % 7; // Monday-first\n return new Date(first.getFullYear(), first.getMonth(), 1 - weekday);\n}\n\nfunction dayVariant(isEdge: boolean, inRange: boolean, isToday: boolean) {\n if (isEdge) {\n return \"primary\";\n }\n if (inRange) {\n return \"active\";\n }\n return isToday ? \"neutral\" : \"simple\";\n}\n\nexport interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\"> {\n /** Selected day, or the start of a selected span. */\n value?: IsoDate;\n /** End of a selected span. Set it to put the calendar in range mode. */\n endValue?: IsoDate;\n onSelect?: (value: IsoDate) => void;\n min?: IsoDate;\n max?: IsoDate;\n}\n\n/**\n * A month of days, Monday first. Arrow keys walk the grid; the month follows\n * the focused day, so a whole year is reachable from the keyboard.\n */\nexport const Calendar = forwardRef<HTMLDivElement, CalendarProps>(function Calendar(\n { value, endValue, onSelect, min, max, className, ...rest },\n ref,\n) {\n const [focused, setFocused] = useState<IsoDate>(() => focusableDay(value, min, max));\n const [month, setMonth] = useState(() => fromIso(focused) ?? new Date());\n const gridRef = useRef<HTMLDivElement | null>(null);\n const shouldFocus = useRef(false);\n\n useEffect(() => {\n if (!fromIso(value)) {\n return;\n }\n const day = focusableDay(value, min, max);\n const next = fromIso(day) ?? new Date();\n // Controlled changes intentionally reposition the visible and roving-focus month.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setFocused(day);\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n }, [value, min, max]);\n\n useEffect(() => {\n if (!shouldFocus.current) {\n return;\n }\n shouldFocus.current = false;\n gridRef.current?.querySelector<HTMLButtonElement>(\"[data-focused]\")?.focus();\n }, [focused]);\n\n const days = Array.from({ length: 42 }, (_, index) => {\n const start = startOfGrid(month);\n return new Date(start.getFullYear(), start.getMonth(), start.getDate() + index);\n });\n\n const today = toIso(new Date());\n\n const changeMonth = (delta: number) => {\n const next = new Date(month.getFullYear(), month.getMonth() + delta, 1);\n setMonth(next);\n setFocused(toIso(next));\n };\n\n const move = (deltaDays: number) => {\n const base = fromIso(focused) ?? new Date();\n const next = new Date(base.getFullYear(), base.getMonth(), base.getDate() + deltaDays);\n shouldFocus.current = true;\n setFocused(toIso(next));\n setMonth(new Date(next.getFullYear(), next.getMonth(), 1));\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n const steps: Record<string, number> = {\n ArrowLeft: -1,\n ArrowRight: 1,\n ArrowUp: -7,\n ArrowDown: 7,\n PageUp: -28,\n PageDown: 28,\n };\n const delta = steps[event.key];\n if (delta === undefined) {\n return;\n }\n event.preventDefault();\n move(delta);\n };\n\n return (\n <div\n ref={ref}\n className={cx(\"ds-calendar\", \"ds-field-surface\", className)}\n {...omitRequired(rest)}\n >\n <div className=\"ds-calendar__head ds-field-surface\">\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-left\"\n aria-label=\"Previous month\"\n onClick={() => changeMonth(-1)}\n />\n <span className=\"ds-calendar__month\">{monthLabel(month)}</span>\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"chevron-right\"\n aria-label=\"Next month\"\n onClick={() => changeMonth(1)}\n />\n </div>\n <div\n className=\"ds-calendar__weekdays\"\n aria-hidden=\"true\"\n >\n {WEEKDAYS.map((day) => (\n <span key={day}>{day.slice(0, 2)}</span>\n ))}\n </div>\n <div\n ref={gridRef}\n className=\"ds-calendar__grid\"\n role=\"grid\"\n onKeyDown={onKeyDown}\n >\n {Array.from({ length: 6 }, (_, rowIndex) => (\n <div\n role=\"row\"\n className=\"ds-calendar__row\"\n key={rowIndex}\n >\n {days.slice(rowIndex * 7, rowIndex * 7 + 7).map((day) => {\n const iso = toIso(day);\n const isOutside = day.getMonth() !== month.getMonth();\n const isDisabled = (min && iso < min) || (max && iso > max);\n const inRange = Boolean(value && endValue && iso > value && iso < endValue);\n const isEdge = iso === value || iso === endValue;\n return (\n <Button\n key={iso}\n variant={dayVariant(isEdge, inRange, iso === today)}\n size=\"sm\"\n isIconOnly\n role=\"gridcell\"\n aria-label={formatIsoDate(iso)}\n tabIndex={iso === focused ? 0 : -1}\n isDisabled={Boolean(isDisabled)}\n aria-selected={isEdge || undefined}\n data-outside={isOutside || undefined}\n data-today={iso === today || undefined}\n data-in-range={inRange || undefined}\n data-focused={iso === focused || undefined}\n className=\"ds-calendar__day\"\n onClick={() => {\n setFocused(iso);\n onSelect?.(iso);\n }}\n >\n {day.getDate()}\n </Button>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n );\n});\n\nexport interface DateFieldProps extends FieldBinding {\n /** Preferred side; the shared Popover flips when space requires it. */\n placement?: PopoverPlacement;\n value?: IsoDate;\n defaultValue?: IsoDate;\n onValueChange?: (value: IsoDate) => void;\n size?: FieldSize;\n placeholder?: string;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Show a separate clear action when populated. Defaults to false. */\n isClearable?: boolean;\n clearLabel?: string;\n className?: string;\n}\n\n/** One day, picked from a calendar. The field prints the long date, never a mask. */\nexport function DateField({\n value,\n defaultValue = \"\",\n onValueChange,\n size = \"md\",\n placeholder = \"Pick a date\",\n placement,\n min,\n max,\n isDisabled = false,\n isInvalid = false,\n isClearable = false,\n clearLabel = \"Clear date\",\n \"aria-invalid\": ariaInvalid,\n id,\n className,\n ...rest\n}: DateFieldProps) {\n const [internal, setInternal] = useState<IsoDate>(defaultValue);\n const current = value ?? internal;\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n const panelRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const triggerId = id ?? generatedId;\n if (isOpen && isDisabled) {\n setOpen(false);\n }\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n // The roving day is always in bounds; the panel takes focus only if bounds exclude every day.\n const panel = panelRef.current;\n (panel?.querySelector<HTMLButtonElement>(\"[data-focused]:not(:disabled)\") ?? panel)?.focus();\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !panelRef.current?.contains(target)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", onPointerDown);\n return () => document.removeEventListener(\"mousedown\", onPointerDown);\n }, [isOpen]);\n\n return (\n <div\n className={cx(\"ds-datefield\", className)}\n ref={rootRef}\n onKeyDown={(event) => {\n if (isOpen && event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setOpen(false);\n triggerRef.current?.focus();\n }\n }}\n >\n <Button\n {...omitRequired(rest)}\n ref={triggerRef}\n id={triggerId}\n size={size}\n aria-haspopup=\"dialog\"\n aria-expanded={isOpen}\n aria-invalid={isInvalid || ariaInvalid || undefined}\n isDisabled={isDisabled}\n data-placeholder={current ? undefined : \"\"}\n className=\"ds-field-skin ds-datefield__control\"\n onClick={() => setOpen((open) => !open)}\n >\n <span className=\"ds-datefield__value\">\n {current ? formatIsoDate(current) : placeholder}\n </span>\n <Icon\n name=\"calendar\"\n size={16}\n className=\"ds-datefield__glyph\"\n />\n </Button>\n {isClearable && current && (\n <Button\n variant=\"simple\"\n size={size}\n isIconOnly\n iconStart=\"x\"\n aria-label={clearLabel}\n isDisabled={isDisabled}\n onClick={() => {\n if (value === undefined) {\n setInternal(\"\");\n }\n onValueChange?.(\"\");\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n )}\n <Popover\n anchorRef={triggerRef}\n placement={placement}\n anchorId={triggerId}\n isOpen={isOpen}\n align=\"start\"\n panelRef={panelRef}\n className=\"ds-datefield__popover\"\n role=\"dialog\"\n aria-label=\"Choose a date\"\n // A click on the heading or padding focuses the dialog rather than the page,\n // so the field's own Escape handler still runs before an enclosing Modal's.\n tabIndex={-1}\n >\n <Calendar\n value={current}\n min={min}\n max={max}\n onSelect={(next) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n setOpen(false);\n triggerRef.current?.focus();\n }}\n />\n </Popover>\n </div>\n );\n}\n\nexport interface DateRangeValue {\n start: IsoDate;\n end: IsoDate;\n}\n\nexport interface DateRangeFieldProps extends FieldBinding {\n placement?: PopoverPlacement;\n value?: DateRangeValue;\n defaultValue?: DateRangeValue;\n onValueChange?: (value: DateRangeValue) => void;\n size?: FieldSize;\n min?: IsoDate;\n max?: IsoDate;\n isDisabled?: boolean;\n isClearable?: boolean;\n startLabel?: string;\n endLabel?: string;\n className?: string;\n}\n\nfunction rangeBound(endpoint: string, bound: string | undefined, kind: \"min\" | \"max\") {\n if (!fromIso(endpoint)) {\n return bound;\n }\n if (!bound) {\n return endpoint;\n }\n return kind === \"min\"\n ? endpoint > bound\n ? endpoint\n : bound\n : endpoint < bound\n ? endpoint\n : bound;\n}\n\n/** A span of days. The end field never offers a day before the start. */\nexport function DateRangeField({\n value,\n defaultValue = { start: \"\", end: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n isDisabled = false,\n isClearable = false,\n startLabel = \"Start date\",\n endLabel = \"End date\",\n placement,\n className,\n ...binding\n}: DateRangeFieldProps) {\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: DateRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-daterange\", className)}\n >\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={startLabel}\n placement={placement}\n size={size}\n value={current.start}\n min={min}\n max={rangeBound(current.end, max, \"max\")}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${startLabel}`}\n placeholder={startLabel}\n onValueChange={(next) => commit({ ...current, start: next })}\n />\n <span\n className=\"ds-daterange__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <DateField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={endLabel}\n placement={placement}\n size={size}\n value={current.end}\n min={rangeBound(current.start, min, \"min\")}\n max={max}\n isDisabled={isDisabled}\n isClearable={isClearable}\n clearLabel={`Clear ${endLabel}`}\n placeholder={endLabel}\n onValueChange={(next) => commit({ ...current, end: next })}\n />\n </div>\n );\n}\n"],"mappings":"A,ySAGA,SAAgBiB,EAAM,EAAqB,CACzC,IAAMC,EAAQ,GAAGC,EAAK,SAAS,EAAI,IAAI,SAAS,EAAG,GAAG,EAChDC,EAAM,GAAGD,EAAK,QAAQ,IAAI,SAAS,EA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AAK,KAAK,EACpC,MACO,aACC,cACb,WAAY,SAASoE,IACrB,YAAaA,EACb,cAAgB,GAASH,EAAO,CAAE,GAAGxB,EAAS,IAAKxB,CAAK,CAAC,CAC1D,CAAA,CACE,C,EAET,C"}
@@ -1,8 +1,8 @@
1
1
  import { Button as e } from "../components/Button/index.js";
2
2
  import { t } from "./transitionDuration-BIBA3V7G.js";
3
3
  import { t as n } from "./mergeRefs-C6_5pADN.js";
4
- import { c as r, r as i, t as a } from "./overlayLayer-Og07sIyl.js";
5
- import { n as o, r as s, t as c } from "./dialogLabel-C153NosD.js";
4
+ import { c as r, r as i, t as a } from "./overlayLayer-Dv1vmfaI.js";
5
+ import { n as o, r as s, t as c } from "./dialogLabel-nB1gwKz0.js";
6
6
  import { forwardRef as l, useEffect as u, useId as d, useRef as f, useState as p } from "react";
7
7
  import { createPortal as m } from "react-dom";
8
8
  import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
@@ -169,4 +169,4 @@ var S = l(function({ isOpen: e, isHidden: t = !1, onClose: l, title: u, descript
169
169
  //#endregion
170
170
  export { S as t };
171
171
 
172
- //# sourceMappingURL=Drawer-nUTJtwX_.js.map
172
+ //# sourceMappingURL=Drawer-2cf0SaG4.js.map