@apipass/design-system 3.1.0 → 3.3.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 (92) hide show
  1. package/dist/lib/embedded-styles.js +1 -1
  2. package/dist/lib/lib.index.cjs +1 -1
  3. package/dist/lib/lib.index.js +755 -750
  4. package/dist/lib/lib.index.js.map +1 -1
  5. package/dist/lib/style.css +1 -1
  6. package/dist/lib/ui/hooks/useOverlayPortal.cjs +2 -0
  7. package/dist/lib/ui/hooks/useOverlayPortal.cjs.map +1 -0
  8. package/dist/lib/ui/hooks/useOverlayPortal.js +17 -0
  9. package/dist/lib/ui/hooks/useOverlayPortal.js.map +1 -0
  10. package/dist/lib/ui/primitives/ComboBox/ComboBox.cjs +1 -1
  11. package/dist/lib/ui/primitives/ComboBox/ComboBox.cjs.map +1 -1
  12. package/dist/lib/ui/primitives/ComboBox/ComboBox.js +31 -30
  13. package/dist/lib/ui/primitives/ComboBox/ComboBox.js.map +1 -1
  14. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.cjs +1 -1
  15. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.cjs.map +1 -1
  16. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.js +187 -178
  17. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.js.map +1 -1
  18. package/dist/lib/ui/primitives/Dialog/Dialog.cjs +1 -1
  19. package/dist/lib/ui/primitives/Dialog/Dialog.cjs.map +1 -1
  20. package/dist/lib/ui/primitives/Dialog/Dialog.js +52 -41
  21. package/dist/lib/ui/primitives/Dialog/Dialog.js.map +1 -1
  22. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs +2 -0
  23. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs.map +1 -0
  24. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js +121 -0
  25. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js.map +1 -0
  26. package/dist/lib/ui/primitives/Menu/Menu.cjs +1 -1
  27. package/dist/lib/ui/primitives/Menu/Menu.cjs.map +1 -1
  28. package/dist/lib/ui/primitives/Menu/Menu.js +68 -57
  29. package/dist/lib/ui/primitives/Menu/Menu.js.map +1 -1
  30. package/dist/lib/ui/primitives/Search/Search.cjs +1 -1
  31. package/dist/lib/ui/primitives/Search/Search.cjs.map +1 -1
  32. package/dist/lib/ui/primitives/Search/Search.js +21 -20
  33. package/dist/lib/ui/primitives/Search/Search.js.map +1 -1
  34. package/dist/lib/ui/primitives/Select/Select.cjs +1 -1
  35. package/dist/lib/ui/primitives/Select/Select.cjs.map +1 -1
  36. package/dist/lib/ui/primitives/Select/Select.js +31 -30
  37. package/dist/lib/ui/primitives/Select/Select.js.map +1 -1
  38. package/dist/lib/ui/primitives/Tooltip/Tooltip.cjs +1 -1
  39. package/dist/lib/ui/primitives/Tooltip/Tooltip.cjs.map +1 -1
  40. package/dist/lib/ui/primitives/Tooltip/Tooltip.js +56 -53
  41. package/dist/lib/ui/primitives/Tooltip/Tooltip.js.map +1 -1
  42. package/dist/lib/vendor/@codemirror/lang-json/dist/index.cjs +2 -0
  43. package/dist/lib/vendor/@codemirror/lang-json/dist/index.cjs.map +1 -0
  44. package/dist/lib/vendor/@codemirror/lang-json/dist/index.js +28 -0
  45. package/dist/lib/vendor/@codemirror/lang-json/dist/index.js.map +1 -0
  46. package/dist/lib/vendor/@codemirror/language/dist/index.cjs +2 -0
  47. package/dist/lib/vendor/@codemirror/language/dist/index.cjs.map +1 -0
  48. package/dist/lib/vendor/@codemirror/language/dist/index.js +791 -0
  49. package/dist/lib/vendor/@codemirror/language/dist/index.js.map +1 -0
  50. package/dist/lib/vendor/@codemirror/state/dist/index.cjs +6 -0
  51. package/dist/lib/vendor/@codemirror/state/dist/index.cjs.map +1 -0
  52. package/dist/lib/vendor/@codemirror/state/dist/index.js +2633 -0
  53. package/dist/lib/vendor/@codemirror/state/dist/index.js.map +1 -0
  54. package/dist/lib/vendor/@codemirror/view/dist/index.cjs +5 -0
  55. package/dist/lib/vendor/@codemirror/view/dist/index.cjs.map +1 -0
  56. package/dist/lib/vendor/@codemirror/view/dist/index.js +6068 -0
  57. package/dist/lib/vendor/@codemirror/view/dist/index.js.map +1 -0
  58. package/dist/lib/vendor/@lezer/common/dist/index.cjs +2 -0
  59. package/dist/lib/vendor/@lezer/common/dist/index.cjs.map +1 -0
  60. package/dist/lib/vendor/@lezer/common/dist/index.js +1392 -0
  61. package/dist/lib/vendor/@lezer/common/dist/index.js.map +1 -0
  62. package/dist/lib/vendor/@lezer/highlight/dist/index.cjs +2 -0
  63. package/dist/lib/vendor/@lezer/highlight/dist/index.cjs.map +1 -0
  64. package/dist/lib/vendor/@lezer/highlight/dist/index.js +638 -0
  65. package/dist/lib/vendor/@lezer/highlight/dist/index.js.map +1 -0
  66. package/dist/lib/vendor/@lezer/json/dist/index.cjs +2 -0
  67. package/dist/lib/vendor/@lezer/json/dist/index.cjs.map +1 -0
  68. package/dist/lib/vendor/@lezer/json/dist/index.js +35 -0
  69. package/dist/lib/vendor/@lezer/json/dist/index.js.map +1 -0
  70. package/dist/lib/vendor/@lezer/lr/dist/index.cjs +2 -0
  71. package/dist/lib/vendor/@lezer/lr/dist/index.cjs.map +1 -0
  72. package/dist/lib/vendor/@lezer/lr/dist/index.js +1269 -0
  73. package/dist/lib/vendor/@lezer/lr/dist/index.js.map +1 -0
  74. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.cjs +2 -0
  75. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.cjs.map +1 -0
  76. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.js +70 -0
  77. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.js.map +1 -0
  78. package/dist/lib/vendor/style-mod/src/style-mod.cjs +4 -0
  79. package/dist/lib/vendor/style-mod/src/style-mod.cjs.map +1 -0
  80. package/dist/lib/vendor/style-mod/src/style-mod.js +110 -0
  81. package/dist/lib/vendor/style-mod/src/style-mod.js.map +1 -0
  82. package/dist/lib/vendor/w3c-keyname/index.cjs +2 -0
  83. package/dist/lib/vendor/w3c-keyname/index.cjs.map +1 -0
  84. package/dist/lib/vendor/w3c-keyname/index.js +89 -0
  85. package/dist/lib/vendor/w3c-keyname/index.js.map +1 -0
  86. package/dist/types/ui/hooks/index.d.ts +1 -0
  87. package/dist/types/ui/hooks/useOverlayPortal.d.ts +15 -0
  88. package/dist/types/ui/primitives/Dialog/Dialog.d.ts +1 -1
  89. package/dist/types/ui/primitives/JsonViewer/JsonViewer.d.ts +16 -0
  90. package/dist/types/ui/primitives/Menu/Menu.d.ts +1 -1
  91. package/dist/types/ui/primitives/index.d.ts +1 -0
  92. package/package.json +7 -1
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("react"),r=e.createContext(null);function l({container:t,children:o}){return n.jsx(r.Provider,{value:t??null,children:o})}function a(){return e.useContext(r)??void 0}exports.OverlayPortalProvider=l;exports.useOverlayPortalContainer=a;
2
+ //# sourceMappingURL=useOverlayPortal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOverlayPortal.cjs","sources":["../../../../src/ui/hooks/useOverlayPortal.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\n/**\n * Destino do portal dos overlays do DS (Modal, Popover, Tooltip).\n *\n * POR QUE ISSO EXISTE — não troque por `UNSAFE_PortalProvider` do react-aria.\n *\n * Os overlays do react-aria-components (RAC) não são renderizados no lugar onde\n * foram escritos: eles fazem portal para outro ponto do DOM. Por padrão, o\n * destino é `document.body`. Quando o DS roda dentro de um MFE isolado em Shadow\n * DOM, `document.body` está FORA da shadow root — e o CSS do DS, que vive dentro\n * dela, não alcança nada de fora. O overlay abre completamente sem estilo.\n *\n * O react-aria tem uma solução própria para isso (`UNSAFE_PortalProvider`), mas\n * ela é frágil num setup de Module Federation: o Context dela mora no pacote\n * `react-aria`, e o `Modal`/`Popover` do RAC o alcança por subpath profundo\n * (`react-aria/Overlay`). O MF compartilha módulos por chave exata de request —\n * subpaths nunca entram no share scope e sempre resolvem para a cópia local do\n * bundle. Ou seja: quem escreve o Context e quem lê podem ser duas cópias\n * diferentes do react-aria, e aí o provider simplesmente não tem efeito. Já\n * causou bug real e intermitente (modal do Tunnel abrindo sem CSS), dependente\n * de qual MFE ganhou a corrida pelo slot compartilhado.\n *\n * Este Context é imune a isso porque vive no `@apipass/design-system`, que NÃO é\n * compartilhado via Module Federation: cada MFE bundla a própria cópia, então\n * quem provê e quem consome são sempre a mesma instância — em qualquer ordem de\n * carregamento.\n *\n * USO — envolva a raiz do MFE uma única vez:\n *\n * <OverlayPortalProvider container={shadowRootPortalElement}>\n * <App />\n * </OverlayPortalProvider>\n *\n * Todos os overlays do DS abaixo dele passam a fazer portal no container. Sem o\n * provider, o comportamento padrão do RAC é preservado (`document.body`), então\n * apps que não rodam em Shadow DOM não precisam de nada.\n */\nconst OverlayPortalContext = createContext<Element | null>(null);\n\nexport interface OverlayPortalProviderProps {\n /** Elemento onde os overlays devem ser inseridos. `null`/`undefined` mantém o padrão do RAC. */\n container: Element | null | undefined;\n children: ReactNode;\n}\n\nexport function OverlayPortalProvider({\n container,\n children,\n}: OverlayPortalProviderProps) {\n return (\n <OverlayPortalContext.Provider value={container ?? null}>\n {children}\n </OverlayPortalContext.Provider>\n );\n}\n\n/**\n * Container de portal do overlay, ou `undefined` se não houver provider acima.\n *\n * Retorna `undefined` (e não `null`) de propósito: passar\n * `UNSTABLE_portalContainer={undefined}` para um componente do RAC é um no-op e\n * preserva o comportamento padrão, enquanto `null` não é aceito pelo tipo.\n */\n// eslint-disable-next-line react-refresh/only-export-components -- hook consumido pelos overlays do DS, não é um componente\nexport function useOverlayPortalContainer(): Element | undefined {\n return useContext(OverlayPortalContext) ?? undefined;\n}\n"],"names":["OverlayPortalContext","createContext","OverlayPortalProvider","container","children","useOverlayPortalContainer","useContext"],"mappings":"wIAsCMA,EAAuBC,EAAAA,cAA8B,IAAI,EAQxD,SAASC,EAAsB,CACpC,UAAAC,EACA,SAAAC,CACF,EAA+B,CAC7B,aACGJ,EAAqB,SAArB,CAA8B,MAAOG,GAAa,KAChD,SAAAC,EACH,CAEJ,CAUO,SAASC,GAAiD,CAC/D,OAAOC,EAAAA,WAAWN,CAAoB,GAAK,MAC7C"}
@@ -0,0 +1,17 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { createContext as n, useContext as l } from "react";
3
+ const r = n(null);
4
+ function i({
5
+ container: t,
6
+ children: o
7
+ }) {
8
+ return /* @__PURE__ */ e(r.Provider, { value: t ?? null, children: o });
9
+ }
10
+ function v() {
11
+ return l(r) ?? void 0;
12
+ }
13
+ export {
14
+ i as OverlayPortalProvider,
15
+ v as useOverlayPortalContainer
16
+ };
17
+ //# sourceMappingURL=useOverlayPortal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOverlayPortal.js","sources":["../../../../src/ui/hooks/useOverlayPortal.tsx"],"sourcesContent":["import { createContext, useContext, type ReactNode } from \"react\";\n\n/**\n * Destino do portal dos overlays do DS (Modal, Popover, Tooltip).\n *\n * POR QUE ISSO EXISTE — não troque por `UNSAFE_PortalProvider` do react-aria.\n *\n * Os overlays do react-aria-components (RAC) não são renderizados no lugar onde\n * foram escritos: eles fazem portal para outro ponto do DOM. Por padrão, o\n * destino é `document.body`. Quando o DS roda dentro de um MFE isolado em Shadow\n * DOM, `document.body` está FORA da shadow root — e o CSS do DS, que vive dentro\n * dela, não alcança nada de fora. O overlay abre completamente sem estilo.\n *\n * O react-aria tem uma solução própria para isso (`UNSAFE_PortalProvider`), mas\n * ela é frágil num setup de Module Federation: o Context dela mora no pacote\n * `react-aria`, e o `Modal`/`Popover` do RAC o alcança por subpath profundo\n * (`react-aria/Overlay`). O MF compartilha módulos por chave exata de request —\n * subpaths nunca entram no share scope e sempre resolvem para a cópia local do\n * bundle. Ou seja: quem escreve o Context e quem lê podem ser duas cópias\n * diferentes do react-aria, e aí o provider simplesmente não tem efeito. Já\n * causou bug real e intermitente (modal do Tunnel abrindo sem CSS), dependente\n * de qual MFE ganhou a corrida pelo slot compartilhado.\n *\n * Este Context é imune a isso porque vive no `@apipass/design-system`, que NÃO é\n * compartilhado via Module Federation: cada MFE bundla a própria cópia, então\n * quem provê e quem consome são sempre a mesma instância — em qualquer ordem de\n * carregamento.\n *\n * USO — envolva a raiz do MFE uma única vez:\n *\n * <OverlayPortalProvider container={shadowRootPortalElement}>\n * <App />\n * </OverlayPortalProvider>\n *\n * Todos os overlays do DS abaixo dele passam a fazer portal no container. Sem o\n * provider, o comportamento padrão do RAC é preservado (`document.body`), então\n * apps que não rodam em Shadow DOM não precisam de nada.\n */\nconst OverlayPortalContext = createContext<Element | null>(null);\n\nexport interface OverlayPortalProviderProps {\n /** Elemento onde os overlays devem ser inseridos. `null`/`undefined` mantém o padrão do RAC. */\n container: Element | null | undefined;\n children: ReactNode;\n}\n\nexport function OverlayPortalProvider({\n container,\n children,\n}: OverlayPortalProviderProps) {\n return (\n <OverlayPortalContext.Provider value={container ?? null}>\n {children}\n </OverlayPortalContext.Provider>\n );\n}\n\n/**\n * Container de portal do overlay, ou `undefined` se não houver provider acima.\n *\n * Retorna `undefined` (e não `null`) de propósito: passar\n * `UNSTABLE_portalContainer={undefined}` para um componente do RAC é um no-op e\n * preserva o comportamento padrão, enquanto `null` não é aceito pelo tipo.\n */\n// eslint-disable-next-line react-refresh/only-export-components -- hook consumido pelos overlays do DS, não é um componente\nexport function useOverlayPortalContainer(): Element | undefined {\n return useContext(OverlayPortalContext) ?? undefined;\n}\n"],"names":["OverlayPortalContext","createContext","OverlayPortalProvider","container","children","useOverlayPortalContainer","useContext"],"mappings":";;AAsCA,MAAMA,IAAuBC,EAA8B,IAAI;AAQxD,SAASC,EAAsB;AAAA,EACpC,WAAAC;AAAA,EACA,UAAAC;AACF,GAA+B;AAC7B,2BACGJ,EAAqB,UAArB,EAA8B,OAAOG,KAAa,MAChD,UAAAC,GACH;AAEJ;AAUO,SAASC,IAAiD;AAC/D,SAAOC,EAAWN,CAAoB,KAAK;AAC7C;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("../../../vendor/clsx/dist/clsx.cjs"),B=require("react"),n=require("react-aria-components");;/* empty css */const c=require("../Fieldset/Fieldset.cjs"),C=require("../Input/Input.cjs"),f=require("../../icons/IconChevronDown.cjs"),l=require("../ListBox/ListBox.cjs"),q=require("../../icons/IconCheck.cjs");function I({className:o,label:r,description:s,errorMessage:t,placeholder:i,children:b,items:d,...j}){const h=m.clsx(o,"combobox-container"),x=B.useRef(null);return e.jsx(a,{className:h,...j,children:e.jsxs(c.Field,{children:[r&&e.jsx(c.Label,{children:r}),e.jsxs(n.Group,{className:"combobox",children:[e.jsx(C.Input,{className:"combobox-input",placeholder:i,onPointerDown:g=>{var u;document.activeElement===g.currentTarget&&((u=x.current)==null||u.click())}}),e.jsx(n.Button,{ref:x,className:"combobox-trigger",children:e.jsx(f.IconChevronDown,{"aria-hidden":"true"})})]}),e.jsx(n.Popover,{children:e.jsx(l.ListBox,{items:d,children:b})}),s&&e.jsx(c.Description,{children:s}),e.jsx(c.FieldError,{children:t})]})})}function a({...o}){return e.jsx(n.ComboBox,{menuTrigger:"focus",...o})}function p({children:o,className:r,...s}){const t=m.clsx(r,"combobox-item"),i=typeof o=="string"?o:"";return e.jsx(l.ListBoxItem,{textValue:i,className:t,...s,children:e.jsxs(e.Fragment,{children:[e.jsx(q.IconCheck,{className:"combobox-item-check"}),o]})})}exports.ComboBox=a;exports.ComboBoxField=I;exports.ComboBoxItem=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("../../../vendor/clsx/dist/clsx.cjs"),g=require("react"),s=require("react-aria-components");;/* empty css */const q=require("../../hooks/useOverlayPortal.cjs"),t=require("../Fieldset/Fieldset.cjs"),f=require("../Input/Input.cjs"),p=require("../../icons/IconChevronDown.cjs"),x=require("../ListBox/ListBox.cjs"),I=require("../../icons/IconCheck.cjs");function N({className:o,label:r,description:n,errorMessage:c,placeholder:i,children:b,items:d,...j}){const C=u.clsx(o,"combobox-container"),a=g.useRef(null),h=q.useOverlayPortalContainer();return e.jsx(m,{className:C,...j,children:e.jsxs(t.Field,{children:[r&&e.jsx(t.Label,{children:r}),e.jsxs(s.Group,{className:"combobox",children:[e.jsx(f.Input,{className:"combobox-input",placeholder:i,onPointerDown:B=>{var l;document.activeElement===B.currentTarget&&((l=a.current)==null||l.click())}}),e.jsx(s.Button,{ref:a,className:"combobox-trigger",children:e.jsx(p.IconChevronDown,{"aria-hidden":"true"})})]}),e.jsx(s.Popover,{UNSTABLE_portalContainer:h,children:e.jsx(x.ListBox,{items:d,children:b})}),n&&e.jsx(t.Description,{children:n}),e.jsx(t.FieldError,{children:c})]})})}function m({...o}){return e.jsx(s.ComboBox,{menuTrigger:"focus",...o})}function v({children:o,className:r,...n}){const c=u.clsx(r,"combobox-item"),i=typeof o=="string"?o:"";return e.jsx(x.ListBoxItem,{textValue:i,className:c,...n,children:e.jsxs(e.Fragment,{children:[e.jsx(I.IconCheck,{className:"combobox-item-check"}),o]})})}exports.ComboBox=m;exports.ComboBoxField=N;exports.ComboBoxItem=v;
2
2
  //# sourceMappingURL=ComboBox.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.cjs","sources":["../../../../../src/ui/primitives/ComboBox/ComboBox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n ListBox,\n ListBoxItem,\n Label,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport { useRef } from \"react\";\nimport {\n Button as RACButton,\n ComboBox as RACComboBox,\n Group as RACGroup,\n Popover as RACPopover,\n type ComboBoxProps as RACComboBoxProps,\n} from \"react-aria-components\";\nimport \"./combobox.css\";\n\nexport interface ComboBoxFieldProps<T extends object>\n extends Omit<ComboBoxProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function ComboBoxField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n items,\n ...props\n}: ComboBoxFieldProps<T>) {\n const classNames = clsx(className, \"combobox-container\");\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n return (\n <ComboBox className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACGroup className=\"combobox\">\n <Input\n className=\"combobox-input\"\n placeholder={placeholder}\n onPointerDown={(event) => {\n if (document.activeElement === event.currentTarget) {\n triggerRef.current?.click();\n }\n }}\n />\n <RACButton ref={triggerRef} className=\"combobox-trigger\">\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n </RACGroup>\n <RACPopover>\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </ComboBox>\n );\n}\n\nexport type ComboBoxProps<T extends object> = RACComboBoxProps<T>;\nexport function ComboBox<T extends object>({ ...props }: ComboBoxProps<T>) {\n return <RACComboBox<T> menuTrigger=\"focus\" {...props} />;\n}\n\nexport type ComboBoxItemProps = ListBoxItemProps;\nexport function ComboBoxItem({ children, className, ...props }: ComboBoxItemProps) {\n const classNames = clsx(className, \"combobox-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"combobox-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["ComboBoxField","className","label","description","errorMessage","placeholder","children","items","props","classNames","clsx","triggerRef","useRef","ComboBox","Field","jsx","Label","jsxs","RACGroup","Input","event","_a","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACComboBox","ComboBoxItem","textValue","ListBoxItem","Fragment","IconCheck"],"mappings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B,EAAY,OAAOxB,GAAa,SAAWA,EAAW,GAC5D,aACGyB,EAAAA,YAAA,CAAY,UAAAD,EAAsB,UAAWrB,EAAa,GAAGD,EAC5D,SAAAS,EAAAA,KAAAe,EAAAA,SAAA,CACE,SAAA,CAAAjB,EAAAA,IAACkB,EAAAA,UAAA,CAAU,UAAU,qBAAA,CAAsB,EAC1C3B,CAAA,CAAA,CACH,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"ComboBox.cjs","sources":["../../../../../src/ui/primitives/ComboBox/ComboBox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n ListBox,\n ListBoxItem,\n Label,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport { useRef } from \"react\";\nimport {\n Button as RACButton,\n ComboBox as RACComboBox,\n Group as RACGroup,\n Popover as RACPopover,\n type ComboBoxProps as RACComboBoxProps,\n} from \"react-aria-components\";\nimport \"./combobox.css\";\n\nexport interface ComboBoxFieldProps<T extends object>\n extends Omit<ComboBoxProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function ComboBoxField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n items,\n ...props\n}: ComboBoxFieldProps<T>) {\n const classNames = clsx(className, \"combobox-container\");\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <ComboBox className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACGroup className=\"combobox\">\n <Input\n className=\"combobox-input\"\n placeholder={placeholder}\n onPointerDown={(event) => {\n if (document.activeElement === event.currentTarget) {\n triggerRef.current?.click();\n }\n }}\n />\n <RACButton ref={triggerRef} className=\"combobox-trigger\">\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n </RACGroup>\n <RACPopover UNSTABLE_portalContainer={portalContainer}>\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </ComboBox>\n );\n}\n\nexport type ComboBoxProps<T extends object> = RACComboBoxProps<T>;\nexport function ComboBox<T extends object>({ ...props }: ComboBoxProps<T>) {\n return <RACComboBox<T> menuTrigger=\"focus\" {...props} />;\n}\n\nexport type ComboBoxItemProps = ListBoxItemProps;\nexport function ComboBoxItem({ children, className, ...props }: ComboBoxItemProps) {\n const classNames = clsx(className, \"combobox-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"combobox-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["ComboBoxField","className","label","description","errorMessage","placeholder","children","items","props","classNames","clsx","triggerRef","useRef","portalContainer","useOverlayPortalContainer","ComboBox","Field","jsx","Label","jsxs","RACGroup","Input","event","_a","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACComboBox","ComboBoxItem","textValue","ListBoxItem","Fragment","IconCheck"],"mappings":"2eA8BO,SAASA,EAAgC,CAC9C,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,YAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EAA0B,CACxB,MAAMC,EAAaC,EAAAA,KAAKT,EAAW,oBAAoB,EACjDU,EAAaC,EAAAA,OAAiC,IAAI,EAGlDC,EAAkBC,EAAAA,0BAAA,EACxB,aACGC,EAAA,CAAS,UAAWN,EAAa,GAAGD,EACnC,gBAACQ,EAAAA,MAAA,CACE,SAAA,CAAAd,GAASe,EAAAA,IAACC,EAAAA,OAAO,SAAAhB,CAAA,CAAM,EACxBiB,EAAAA,KAACC,E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from "react/jsx-runtime";
2
2
  import { clsx as a } from "../../../vendor/clsx/dist/clsx.js";
3
- import { useRef as d } from "react";
4
- import { Group as h, Button as g, Popover as B, ComboBox as N } from "react-aria-components";
3
+ import { useRef as h } from "react";
4
+ import { Group as C, Button as g, Popover as B, ComboBox as N } from "react-aria-components";
5
5
  /* empty css */
6
- import { Field as C, Label as I, Description as F, FieldError as k } from "../Fieldset/Fieldset.js";
7
- import { Input as v } from "../Input/Input.js";
8
- import { IconChevronDown as D } from "../../icons/IconChevronDown.js";
9
- import { ListBox as L, ListBoxItem as j } from "../ListBox/ListBox.js";
10
- import { IconCheck as w } from "../../icons/IconCheck.js";
11
- function H({
6
+ import { useOverlayPortalContainer as I } from "../../hooks/useOverlayPortal.js";
7
+ import { Field as v, Label as F, Description as L, FieldError as k } from "../Fieldset/Fieldset.js";
8
+ import { Input as D } from "../Input/Input.js";
9
+ import { IconChevronDown as E } from "../../icons/IconChevronDown.js";
10
+ import { ListBox as P, ListBoxItem as T } from "../ListBox/ListBox.js";
11
+ import { IconCheck as j } from "../../icons/IconCheck.js";
12
+ function z({
12
13
  className: r,
13
14
  label: e,
14
15
  description: t,
15
- errorMessage: m,
16
- placeholder: n,
16
+ errorMessage: n,
17
+ placeholder: c,
17
18
  children: l,
18
19
  items: u,
19
- ...x
20
+ ...f
20
21
  }) {
21
- const f = a(r, "combobox-container"), i = d(null);
22
- return /* @__PURE__ */ o(E, { className: f, ...x, children: /* @__PURE__ */ c(C, { children: [
23
- e && /* @__PURE__ */ o(I, { children: e }),
24
- /* @__PURE__ */ c(h, { className: "combobox", children: [
22
+ const p = a(r, "combobox-container"), i = h(null), x = I();
23
+ return /* @__PURE__ */ o(w, { className: p, ...f, children: /* @__PURE__ */ m(v, { children: [
24
+ e && /* @__PURE__ */ o(F, { children: e }),
25
+ /* @__PURE__ */ m(C, { className: "combobox", children: [
25
26
  /* @__PURE__ */ o(
26
- v,
27
+ D,
27
28
  {
28
29
  className: "combobox-input",
29
- placeholder: n,
30
+ placeholder: c,
30
31
  onPointerDown: (b) => {
31
32
  var s;
32
33
  document.activeElement === b.currentTarget && ((s = i.current) == null || s.click());
33
34
  }
34
35
  }
35
36
  ),
36
- /* @__PURE__ */ o(g, { ref: i, className: "combobox-trigger", children: /* @__PURE__ */ o(D, { "aria-hidden": "true" }) })
37
+ /* @__PURE__ */ o(g, { ref: i, className: "combobox-trigger", children: /* @__PURE__ */ o(E, { "aria-hidden": "true" }) })
37
38
  ] }),
38
- /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(L, { items: u, children: l }) }),
39
- t && /* @__PURE__ */ o(F, { children: t }),
40
- /* @__PURE__ */ o(k, { children: m })
39
+ /* @__PURE__ */ o(B, { UNSTABLE_portalContainer: x, children: /* @__PURE__ */ o(P, { items: u, children: l }) }),
40
+ t && /* @__PURE__ */ o(L, { children: t }),
41
+ /* @__PURE__ */ o(k, { children: n })
41
42
  ] }) });
42
43
  }
43
- function E({ ...r }) {
44
+ function w({ ...r }) {
44
45
  return /* @__PURE__ */ o(N, { menuTrigger: "focus", ...r });
45
46
  }
46
- function J({ children: r, className: e, ...t }) {
47
- const m = a(e, "combobox-item");
48
- return /* @__PURE__ */ o(j, { textValue: typeof r == "string" ? r : "", className: m, ...t, children: /* @__PURE__ */ c(p, { children: [
49
- /* @__PURE__ */ o(w, { className: "combobox-item-check" }),
47
+ function H({ children: r, className: e, ...t }) {
48
+ const n = a(e, "combobox-item");
49
+ return /* @__PURE__ */ o(T, { textValue: typeof r == "string" ? r : "", className: n, ...t, children: /* @__PURE__ */ m(d, { children: [
50
+ /* @__PURE__ */ o(j, { className: "combobox-item-check" }),
50
51
  r
51
52
  ] }) });
52
53
  }
53
54
  export {
54
- E as ComboBox,
55
- H as ComboBoxField,
56
- J as ComboBoxItem
55
+ w as ComboBox,
56
+ z as ComboBoxField,
57
+ H as ComboBoxItem
57
58
  };
58
59
  //# sourceMappingURL=ComboBox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboBox.js","sources":["../../../../../src/ui/primitives/ComboBox/ComboBox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n ListBox,\n ListBoxItem,\n Label,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport { useRef } from \"react\";\nimport {\n Button as RACButton,\n ComboBox as RACComboBox,\n Group as RACGroup,\n Popover as RACPopover,\n type ComboBoxProps as RACComboBoxProps,\n} from \"react-aria-components\";\nimport \"./combobox.css\";\n\nexport interface ComboBoxFieldProps<T extends object>\n extends Omit<ComboBoxProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function ComboBoxField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n items,\n ...props\n}: ComboBoxFieldProps<T>) {\n const classNames = clsx(className, \"combobox-container\");\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n return (\n <ComboBox className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACGroup className=\"combobox\">\n <Input\n className=\"combobox-input\"\n placeholder={placeholder}\n onPointerDown={(event) => {\n if (document.activeElement === event.currentTarget) {\n triggerRef.current?.click();\n }\n }}\n />\n <RACButton ref={triggerRef} className=\"combobox-trigger\">\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n </RACGroup>\n <RACPopover>\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </ComboBox>\n );\n}\n\nexport type ComboBoxProps<T extends object> = RACComboBoxProps<T>;\nexport function ComboBox<T extends object>({ ...props }: ComboBoxProps<T>) {\n return <RACComboBox<T> menuTrigger=\"focus\" {...props} />;\n}\n\nexport type ComboBoxItemProps = ListBoxItemProps;\nexport function ComboBoxItem({ children, className, ...props }: ComboBoxItemProps) {\n const classNames = clsx(className, \"combobox-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"combobox-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["ComboBoxField","className","label","description","errorMessage","placeholder","children","items","props","classNames","clsx","triggerRef","useRef","ComboBox","Field","jsx","Label","jsxs","RACGroup","Input","event","_a","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACComboBox","ComboBoxItem","ListBoxItem","Fragment","IconCheck"],"mappings":";;;;;;;;;;AA6BO,SAASA,EAAgC;AAAA,EAC9C,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GAA0B;AACxB,QAAMC,IAAaC,EAAKT,GAAW,oBAAoB,GACjDU,IAAaC,EAAiC,IAAI;AACxD,2BACGC,GAAA,EAAS,WAAWJ,GAAa,GAAGD,GACnC,4BAACM,GAAA,EACE,UAAA;AAAA,IAAAZ,KAAS,gBAAAa,EAACC,KAAO,UAAAd,EAAA,CAAM;AAAA,IACxB,gBAAAe,EAACC,GAAA,EAAS,WAAU,YAClB,UAAA;AAAA,MAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,aAAAd;AAAA,UACA,eAAe,CAACe,MAAU;;AACxB,YAAI,SAAS,kBAAkBA,EAAM,mBACnCC,IAAAV,EAAW,YAAX,QAAAU,EAAoB;AAAA,UAExB;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAN,EAACO,GAAA,EAAU,KAAKX,GAAY,WAAU,oBACpC,UAAA,gBAAAI,EAACQ,GAAA,EAAgB,eAAY,OAAA,CAAO,EAAA,CACtC;AAAA,IAAA,GACF;AAAA,sBACCC,GAAA,EACC,UAAA,gBAAAT,EAACU,GAAA,EAAQ,OAAAlB,GAAe,UAAAD,GAAS,GACnC;AAAA,IACCH,KAAe,gBAAAY,EAACW,GAAA,EAAa,UAAAvB,EAAA,CAAY;AAAA,IAC1C,gBAAAY,EAACY,KAAY,UAAAvB,EAAA,CAAa;AAAA,EAAA,EAAA,CAC5B,EAAA,CACF;AAEJ;AAGO,SAASS,EAA2B,EAAE,GAAGL,KAA2B;AACzE,SAAO,gBAAAO,EAACa,GAAA,EAAe,aAAY,SAAS,GAAGpB,GAAO;AACxD;AAGO,SAASqB,EAAa,EAAE,UAAAvB,GAAU,WAAAL,GAAW,GAAGO,KAA4B;AACjF,QAAMC,IAAaC,EAAKT,GAAW,eAAe;AAElD,2BACG6B,GAAA,EAAY,WAFG,OAAOxB,KAAa,WAAWA,IAAW,IAEvB,WAAWG,GAAa,GAAGD,GAC5D,UAAA,gBAAAS,EAAAc,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAhB,EAACiB,GAAA,EAAU,WAAU,sBAAA,CAAsB;AAAA,IAC1C1B;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"ComboBox.js","sources":["../../../../../src/ui/primitives/ComboBox/ComboBox.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Input,\n ListBox,\n ListBoxItem,\n Label,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport { useRef } from \"react\";\nimport {\n Button as RACButton,\n ComboBox as RACComboBox,\n Group as RACGroup,\n Popover as RACPopover,\n type ComboBoxProps as RACComboBoxProps,\n} from \"react-aria-components\";\nimport \"./combobox.css\";\n\nexport interface ComboBoxFieldProps<T extends object>\n extends Omit<ComboBoxProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function ComboBoxField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n items,\n ...props\n}: ComboBoxFieldProps<T>) {\n const classNames = clsx(className, \"combobox-container\");\n const triggerRef = useRef<HTMLButtonElement | null>(null);\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <ComboBox className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACGroup className=\"combobox\">\n <Input\n className=\"combobox-input\"\n placeholder={placeholder}\n onPointerDown={(event) => {\n if (document.activeElement === event.currentTarget) {\n triggerRef.current?.click();\n }\n }}\n />\n <RACButton ref={triggerRef} className=\"combobox-trigger\">\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n </RACGroup>\n <RACPopover UNSTABLE_portalContainer={portalContainer}>\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </ComboBox>\n );\n}\n\nexport type ComboBoxProps<T extends object> = RACComboBoxProps<T>;\nexport function ComboBox<T extends object>({ ...props }: ComboBoxProps<T>) {\n return <RACComboBox<T> menuTrigger=\"focus\" {...props} />;\n}\n\nexport type ComboBoxItemProps = ListBoxItemProps;\nexport function ComboBoxItem({ children, className, ...props }: ComboBoxItemProps) {\n const classNames = clsx(className, \"combobox-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"combobox-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["ComboBoxField","className","label","description","errorMessage","placeholder","children","items","props","classNames","clsx","triggerRef","useRef","portalContainer","useOverlayPortalContainer","ComboBox","Field","jsx","Label","jsxs","RACGroup","Input","event","_a","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACComboBox","ComboBoxItem","ListBoxItem","Fragment","IconCheck"],"mappings":";;;;;;;;;;;AA8BO,SAASA,EAAgC;A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AAU,WAAAL,GAAW,GAAGO,KAA4B;AACjF,QAAMC,IAAaC,EAAKT,GAAW,eAAe;AAElD,2BACG+B,GAAA,EAAY,WAFG,OAAO1B,KAAa,WAAWA,IAAW,IAEvB,WAAWG,GAAa,GAAGD,GAC5D,UAAA,gBAAAW,EAAAc,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAhB,EAACiB,GAAA,EAAU,WAAU,sBAAA,CAAsB;AAAA,IAC1C5B;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("@internationalized/date"),qe=require("../../../vendor/clsx/dist/clsx.cjs"),h=require("react"),n=require("react-aria-components"),ye=require("./dateRangePresets.cjs");;/* empty css */const z=require("../../icons/IconCalendar.cjs"),Ie=require("../../icons/IconChevronDown.cjs"),G=require("../Text/Text.cjs"),Le=require("../../icons/IconCheck.cjs"),Be=require("../../icons/IconChevronLeft.cjs"),we=require("../../icons/IconChevronRight.cjs"),V=require("../Fieldset/Fieldset.cjs"),ae=require("../ListBox/ListBox.cjs"),ne=require("../Button/Button.cjs"),H=()=>new o.Time(0,0,0),re=()=>new o.Time(23,59,59);function Re({onAnchorChange:a}){const c=h.useContext(n.RangeCalendarStateContext),l=(c==null?void 0:c.anchorDate)??null,u=l==null?void 0:l.toString();return h.useEffect(()=>{a(l)},[u]),null}const k=a=>a&&"hour"in a?new o.Time(a.hour,a.minute,a.second):null,se=a=>!a||!a.start&&!a.end?{range:null,startTime:null,endTime:null,preset:a==null?void 0:a.preset}:{range:a.start&&a.end?{start:o.toCalendarDate(a.start),end:o.toCalendarDate(a.end)}:null,startTime:k(a.start),endTime:k(a.end),preset:a.preset},m=(a,c,l)=>{if(!a)return null;const u=o.toCalendarDate(a);return l||!c?u:o.toCalendarDateTime(u,c)},Fe=(a,c)=>{var l,u;return{preset:a.preset,start:m((l=a.range)==null?void 0:l.start,a.startTime,c),end:m((u=a.range)==null?void 0:u.end,a.endTime,c)}};function Pe({className:a,locale:c,label:l,"aria-label":u,description:K,errorMessage:q,labels:ie,intervals:y,presetKeys:I,presetLabels:L,hideTime:i=!1,minValue:B,maxValue:w,timezone:ce,isDisabled:le=!1,isRequired:de=!1,value:S,defaultValue:oe,onChange:R}){var _,ee;const{locale:ge}=n.useLocale(),F=c??ge??"pt-BR",P=ce??o.getLocalTimeZone(),{placeholder:M,relativeLabel:Z,absoluteLabel:$,startDateLabel:me,endDateLabel:ue,cancelLabel:E,applyLabel:A}=ie,x=h.useMemo(()=>{if(y)return y;if(I){if(!L)throw new Error("DateRangePicker: `presetLabels` is required when `presetKeys` is provided.");return ye.createDateRangePresets({locale:F,timezone:P,include:I,labels:L})}},[y,I,L,F,P]),[g,J]=h.useState(()=>se(S??oe)),[p,j]=h.useState(g),[pe,C]=h.useState(null),[he,O]=h.useState(!1);h.useEffect(()=>{S!==void 0&&J(se(S))},[S]);const v=t=>({...t,preset:void 0}),xe=t=>i?t:{...t,startTime:t.startTime??H(),endTime:t.endTime??re()},je=t=>{t&&(j(g),C(null)),O(t)},fe=t=>{C(null);const{start:r,end:d}=t.getValue();j({range:{start:o.toCalendarDate(r),end:o.toCalendarDate(d)},startTime:k(r),endTime:k(d),preset:t})},ke=t=>{C(t),t&&!i&&j(r=>v({...r,startTime:r.startTime??H()}))},Ce=t=>{C(null),j(r=>xe(v({...r,range:t})))},De=t=>{if(!t)return;C(null);const r=o.toCalendarDate(t),d=k(t);j(s=>{var b,te;const f=i?s.startTime:d??s.startTime??H(),D=m(r,f,i),T=m((b=s.range)==null?void 0:b.end,s.endTime,i),N=!!(D&&T&&T.compare(D)<0);return v({...s,range:{start:r,end:N||!((te=s.range)!=null&&te.end)?r:s.range.end},startTime:f,endTime:N?f:s.endTime})})},Te=t=>{if(!t)return;const r=o.toCalendarDate(t),d=k(t);j(s=>{var N,b;const f=i?s.endTime:d??s.endTime??re(),D=m(r,f,i),T=m((N=s.range)==null?void 0:N.start,s.startTime,i);return T&&D&&D.compare(T)<0?s:v({...s,range:{start:((b=s.range)==null?void 0:b.start)??r,end:r},endTime:f})})},Ne=()=>{J(p),R==null||R(Fe(p,i)),O(!1)},be=()=>O(!1),Se=!!(E||A),Q=(()=>{if(g.preset)return g.preset.label;if(g.range){const t=s=>s.toDate(P).toLocaleString(F,{day:"2-digit",month:"2-digit",year:"numeric",...i?{}:{hour:"2-digit",minute:"2-digit",second:"2-digit"}}),r=m(g.range.start,g.startTime,i),d=m(g.range.end,g.endTime,i);if(r&&d)return`${t(r)} — ${t(d)}`}return null})(),ve=!!(x&&x.length>0),U=i?"day":"second",W=m(((_=p.range)==null?void 0:_.start)??pe??void 0,p.startTime,i),X=m(((ee=p.range)==null?void 0:ee.end)??void 0,p.endTime,i),Y=e.jsxs(V.Field,{className:qe.clsx(a,"date-range-picker"),children:[l&&e.jsx(V.Label,{children:l}),e.jsxs(n.DialogTrigger,{isOpen:he,onOpenChange:je,children:[e.jsxs(n.Button,{className:"date-range-picker-trigger",isDisabled:le,"aria-label":l?void 0:u??M,"aria-required":de||void 0,"data-invalid":q?!0:void 0,children:[g.preset?e.jsxs("span",{className:"date-range-picker-preset-badge",children:[e.jsx(z.IconCalendar,{"aria-hidden":"true"}),g.preset.label]}):e.jsx("span",{className:"date-range-picker-value","data-placeholder":Q?void 0:!0,children:Q??M}),e.jsx(Ie.IconChevronDown,{"aria-hidden":"true"})]}),e.jsx(n.Popover,{className:"date-range-picker-popover",placement:"bottom start",children:e.jsxs(n.Dialog,{className:"date-range-picker-dialog",children:[e.jsxs("div",{className:"date-range-picker-body",children:[ve&&e.jsxs("div",{className:"date-range-picker-presets",children:[e.jsx(G.TextSmallStrong,{className:"date-range-picker-section-title",children:Z}),e.jsx(ae.ListBox,{"aria-label":Z,className:"date-range-picker-presets-list",selectionMode:"single",selectedKeys:p.preset?[p.preset.id]:[],items:x,onSelectionChange:t=>{const[r]=[...t],d=x==null?void 0:x.find(s=>s.id===r);d&&fe(d)},children:t=>e.jsxs(ae.ListBoxItem,{id:t.id,textValue:t.label,className:"date-range-picker-preset-item",children:[e.jsx("span",{children:t.label}),e.jsx(Le.IconCheck,{"aria-hidden":"true",className:"date-range-picker-preset-check"})]})})]}),e.jsxs("div",{className:"date-range-picker-absolute",children:[e.jsx(G.TextSmallStrong,{className:"date-range-picker-section-title",children:$}),e.jsxs("div",{className:"date-range-picker-fields",children:[e.jsxs(n.DateField,{className:"date-range-picker-datefield",granularity:U,value:W,minValue:B,maxValue:X??w,onChange:De,children:[e.jsx(n.Label,{className:"date-range-picker-field-label",children:me}),e.jsxs(n.Group,{className:"date-range-picker-input",children:[e.jsx(n.DateInput,{children:t=>e.jsx(n.DateSegment,{segment:t})}),e.jsx(z.IconCalendar,{"aria-hidden":"true"})]})]}),e.jsxs(n.DateField,{className:"date-range-picker-datefield",granularity:U,value:X,minValue:W??B,maxValue:w,onChange:Te,children:[e.jsx(n.Label,{className:"date-range-picker-field-label",children:ue}),e.jsxs(n.Group,{className:"date-range-picker-input",children:[e.jsx(n.DateInput,{children:t=>e.jsx(n.DateSegment,{segment:t})}),e.jsx(z.IconCalendar,{"aria-hidden":"true"})]})]})]}),e.jsxs(n.RangeCalendar,{className:"date-range-picker-calendar","aria-label":$,value:p.range,minValue:B,maxValue:w,onChange:Ce,children:[e.jsx(Re,{onAnchorChange:ke}),e.jsxs("header",{className:"date-range-picker-calendar-header",children:[e.jsx(n.Button,{slot:"previous",className:"date-range-picker-calendar-nav",children:e.jsx(Be.IconChevronLeft,{"aria-hidden":"true"})}),e.jsx(n.Heading,{className:"date-range-picker-calendar-heading"}),e.jsx(n.Button,{slot:"next",className:"date-range-picker-calendar-nav",children:e.jsx(we.IconChevronRight,{"aria-hidden":"true"})})]}),e.jsx(n.CalendarGrid,{className:"date-range-picker-calendar-grid",children:t=>e.jsx(n.CalendarCell,{date:t,className:"date-range-picker-calendar-cell"})})]})]})]}),Se&&e.jsxs("div",{className:"date-range-picker-actions",children:[E&&e.jsx(ne.Button,{variant:"neutral",size:"small",onPress:be,children:E}),A&&e.jsx(ne.Button,{variant:"primary",size:"small",onPress:Ne,children:A})]})]})})]}),K&&e.jsx(V.Description,{children:K}),q&&e.jsx(G.Text,{className:"date-range-picker-error",elementType:"span",children:q})]});return c?e.jsx(n.I18nProvider,{locale:c,children:Y}):Y}exports.DateRangePicker=Pe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@internationalized/date"),ye=require("../../../vendor/clsx/dist/clsx.cjs"),h=require("react"),n=require("react-aria-components"),Le=require("./dateRangePresets.cjs");;/* empty css */const z=require("../../icons/IconCalendar.cjs"),Ie=require("../../icons/IconChevronDown.cjs"),G=require("../Text/Text.cjs"),Be=require("../../icons/IconCheck.cjs"),we=require("../../icons/IconChevronLeft.cjs"),Pe=require("../../icons/IconChevronRight.cjs"),Re=require("../../hooks/useOverlayPortal.cjs"),V=require("../Fieldset/Fieldset.cjs"),ae=require("../ListBox/ListBox.cjs"),ne=require("../Button/Button.cjs"),H=()=>new d.Time(0,0,0),re=()=>new d.Time(23,59,59);function Fe({onAnchorChange:a}){const c=h.useContext(n.RangeCalendarStateContext),l=(c==null?void 0:c.anchorDate)??null,m=l==null?void 0:l.toString();return h.useEffect(()=>{a(l)},[m]),null}const C=a=>a&&"hour"in a?new d.Time(a.hour,a.minute,a.second):null,se=a=>!a||!a.start&&!a.end?{range:null,startTime:null,endTime:null,preset:a==null?void 0:a.preset}:{range:a.start&&a.end?{start:d.toCalendarDate(a.start),end:d.toCalendarDate(a.end)}:null,startTime:C(a.start),endTime:C(a.end),preset:a.preset},u=(a,c,l)=>{if(!a)return null;const m=d.toCalendarDate(a);return l||!c?m:d.toCalendarDateTime(m,c)},Ee=(a,c)=>{var l,m;return{preset:a.preset,start:u((l=a.range)==null?void 0:l.start,a.startTime,c),end:u((m=a.range)==null?void 0:m.end,a.endTime,c)}};function Oe({className:a,locale:c,label:l,"aria-label":m,description:K,errorMessage:q,labels:ie,intervals:y,presetKeys:L,presetLabels:I,hideTime:i=!1,minValue:B,maxValue:w,timezone:ce,isDisabled:le=!1,isRequired:oe=!1,value:S,defaultValue:de,onChange:P}){var Y,ee;const ge=Re.useOverlayPortalContainer(),{locale:ue}=n.useLocale(),R=c??ue??"pt-BR",F=ce??d.getLocalTimeZone(),{placeholder:M,relativeLabel:U,absoluteLabel:Z,startDateLabel:me,endDateLabel:pe,cancelLabel:E,applyLabel:O}=ie,x=h.useMemo(()=>{if(y)return y;if(L){if(!I)throw new Error("DateRangePicker: `presetLabels` is required when `presetKeys` is provided.");return Le.createDateRangePresets({locale:R,timezone:F,include:L,labels:I})}},[y,L,I,R,F]),[g,_]=h.useState(()=>se(S??de)),[p,j]=h.useState(g),[he,k]=h.useState(null),[xe,A]=h.useState(!1);h.useEffect(()=>{S!==void 0&&_(se(S))},[S]);const v=t=>({...t,preset:void 0}),je=t=>i?t:{...t,startTime:t.startTime??H(),endTime:t.endTime??re()},fe=t=>{t&&(j(g),k(null)),A(t)},Ce=t=>{k(null);const{start:r,end:o}=t.getValue();j({range:{start:d.toCalendarDate(r),end:d.toCalendarDate(o)},startTime:C(r),endTime:C(o),preset:t})},ke=t=>{k(t),t&&!i&&j(r=>v({...r,startTime:r.startTime??H()}))},De=t=>{k(null),j(r=>je(v({...r,range:t})))},Te=t=>{if(!t)return;k(null);const r=d.toCalendarDate(t),o=C(t);j(s=>{var b,te;const f=i?s.startTime:o??s.startTime??H(),D=u(r,f,i),T=u((b=s.range)==null?void 0:b.end,s.endTime,i),N=!!(D&&T&&T.compare(D)<0);return v({...s,range:{start:r,end:N||!((te=s.range)!=null&&te.end)?r:s.range.end},startTime:f,endTime:N?f:s.endTime})})},Ne=t=>{if(!t)return;const r=d.toCalendarDate(t),o=C(t);j(s=>{var N,b;const f=i?s.endTime:o??s.endTime??re(),D=u(r,f,i),T=u((N=s.range)==null?void 0:N.start,s.startTime,i);return T&&D&&D.compare(T)<0?s:v({...s,range:{start:((b=s.range)==null?void 0:b.start)??r,end:r},endTime:f})})},be=()=>{_(p),P==null||P(Ee(p,i)),A(!1)},Se=()=>A(!1),ve=!!(E||O),$=(()=>{if(g.preset)return g.preset.label;if(g.range){const t=s=>s.toDate(F).toLocaleString(R,{day:"2-digit",month:"2-digit",year:"numeric",...i?{}:{hour:"2-digit",minute:"2-digit",second:"2-digit"}}),r=u(g.range.start,g.startTime,i),o=u(g.range.end,g.endTime,i);if(r&&o)return`${t(r)} — ${t(o)}`}return null})(),qe=!!(x&&x.length>0),J=i?"day":"second",Q=u(((Y=p.range)==null?void 0:Y.start)??he??void 0,p.startTime,i),W=u(((ee=p.range)==null?void 0:ee.end)??void 0,p.endTime,i),X=e.jsxs(V.Field,{className:ye.clsx(a,"date-range-picker"),children:[l&&e.jsx(V.Label,{children:l}),e.jsxs(n.DialogTrigger,{isOpen:xe,onOpenChange:fe,children:[e.jsxs(n.Button,{className:"date-range-picker-trigger",isDisabled:le,"aria-label":l?void 0:m??M,"aria-required":oe||void 0,"data-invalid":q?!0:void 0,children:[g.preset?e.jsxs("span",{className:"date-range-picker-preset-badge",children:[e.jsx(z.IconCalendar,{"aria-hidden":"true"}),g.preset.label]}):e.jsx("span",{className:"date-range-picker-value","data-placeholder":$?void 0:!0,children:$??M}),e.jsx(Ie.IconChevronDown,{"aria-hidden":"true"})]}),e.jsx(n.Popover,{className:"date-range-picker-popover",placement:"bottom start",UNSTABLE_portalContainer:ge,children:e.jsxs(n.Dialog,{className:"date-range-picker-dialog",children:[e.jsxs("div",{className:"date-range-picker-body",children:[qe&&e.jsxs("div",{className:"date-range-picker-presets",children:[e.jsx(G.TextSmallStrong,{className:"date-range-picker-section-title",children:U}),e.jsx(ae.ListBox,{"aria-label":U,className:"date-range-picker-presets-list",selectionMode:"single",selectedKeys:p.preset?[p.preset.id]:[],items:x,onSelectionChange:t=>{const[r]=[...t],o=x==null?void 0:x.find(s=>s.id===r);o&&Ce(o)},children:t=>e.jsxs(ae.ListBoxItem,{id:t.id,textValue:t.label,className:"date-range-picker-preset-item",children:[e.jsx("span",{children:t.label}),e.jsx(Be.IconCheck,{"aria-hidden":"true",className:"date-range-picker-preset-check"})]})})]}),e.jsxs("div",{className:"date-range-picker-absolute",children:[e.jsx(G.TextSmallStrong,{className:"date-range-picker-section-title",children:Z}),e.jsxs("div",{className:"date-range-picker-fields",children:[e.jsxs(n.DateField,{className:"date-range-picker-datefield",granularity:J,value:Q,minValue:B,maxValue:W??w,onChange:Te,children:[e.jsx(n.Label,{className:"date-range-picker-field-label",children:me}),e.jsxs(n.Group,{className:"date-range-picker-input",children:[e.jsx(n.DateInput,{children:t=>e.jsx(n.DateSegment,{segment:t})}),e.jsx(z.IconCalendar,{"aria-hidden":"true"})]})]}),e.jsxs(n.DateField,{className:"date-range-picker-datefield",granularity:J,value:W,minValue:Q??B,maxValue:w,onChange:Ne,children:[e.jsx(n.Label,{className:"date-range-picker-field-label",children:pe}),e.jsxs(n.Group,{className:"date-range-picker-input",children:[e.jsx(n.DateInput,{children:t=>e.jsx(n.DateSegment,{segment:t})}),e.jsx(z.IconCalendar,{"aria-hidden":"true"})]})]})]}),e.jsxs(n.RangeCalendar,{className:"date-range-picker-calendar","aria-label":Z,value:p.range,minValue:B,maxValue:w,onChange:De,children:[e.jsx(Fe,{onAnchorChange:ke}),e.jsxs("header",{className:"date-range-picker-calendar-header",children:[e.jsx(n.Button,{slot:"previous",className:"date-range-picker-calendar-nav",children:e.jsx(we.IconChevronLeft,{"aria-hidden":"true"})}),e.jsx(n.Heading,{className:"date-range-picker-calendar-heading"}),e.jsx(n.Button,{slot:"next",className:"date-range-picker-calendar-nav",children:e.jsx(Pe.IconChevronRight,{"aria-hidden":"true"})})]}),e.jsx(n.CalendarGrid,{className:"date-range-picker-calendar-grid",children:t=>e.jsx(n.CalendarCell,{date:t,className:"date-range-picker-calendar-cell"})})]})]})]}),ve&&e.jsxs("div",{className:"date-range-picker-actions",children:[E&&e.jsx(ne.Button,{variant:"neutral",size:"small",onPress:Se,children:E}),O&&e.jsx(ne.Button,{variant:"primary",size:"small",onPress:be,children:O})]})]})})]}),K&&e.jsx(V.Description,{children:K}),q&&e.jsx(G.Text,{className:"date-range-picker-error",elementType:"span",children:q})]});return c?e.jsx(n.I18nProvider,{locale:c,children:X}):X}exports.DateRangePicker=Oe;
2
2
  //# sourceMappingURL=DateRangePicker.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.cjs","sources":["../../../../../src/ui/primitives/DateRangePicker/DateRangePicker.tsx"],"sourcesContent":["import {\n Time,\n getLocalTimeZone,\n toCalendarDate,\n toCalendarDateTime,\n type DateValue,\n} from \"@internationalized/date\";\nimport { clsx } from \"clsx\";\nimport {\n IconCalendar,\n IconCheck,\n IconChevronDown,\n IconChevronLeft,\n IconChevronRight,\n} from \"icons\";\nimport {\n Button,\n Description,\n Field,\n Label,\n ListBox,\n ListBoxItem,\n Text,\n TextSmallStrong,\n} from \"primitives\";\nimport { useContext, useEffect, useMemo, useState } from \"react\";\nimport {\n Button as RACButton,\n CalendarCell as RACCalendarCell,\n CalendarGrid as RACCalendarGrid,\n DateField as RACDateField,\n DateInput as RACDateInput,\n DateSegment as RACDateSegment,\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Group as RACGroup,\n Heading as RACHeading,\n I18nProvider as RACI18nProvider,\n Label as RACLabel,\n Popover as RACPopover,\n RangeCalendar as RACRangeCalendar,\n RangeCalendarStateContext,\n useLocale,\n type TimeValue,\n} from \"react-aria-components\";\nimport {\n createDateRangePresets,\n type DateRangePresetKey,\n} from \"./dateRangePresets\";\nimport \"./daterangepicker.css\";\n\nconst dayStartTime = () => new Time(0, 0, 0);\nconst dayEndTime = () => new Time(23, 59, 59);\n\nfunction CalendarAnchorSync({\n onAnchorChange,\n}: {\n onAnchorChange: (anchor: DateValue | null) => void;\n}) {\n const state = useContext(RangeCalendarStateContext);\n const anchor = state?.anchorDate ?? null;\n const anchorKey = anchor?.toString();\n useEffect(() => {\n onAnchorChange(anchor);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [anchorKey]);\n return null;\n}\n\nexport interface DateRangePreset {\n id: string;\n label: string;\n getValue: () => { start: DateValue; end: DateValue };\n}\n\nexport interface DateRangePickerValue {\n preset?: DateRangePreset;\n start: DateValue | null;\n end: DateValue | null;\n}\n\nexport interface DateRangePickerLabels {\n placeholder: string;\n relativeLabel: string;\n absoluteLabel: string;\n startDateLabel: string;\n endDateLabel: string;\n cancelLabel?: string | null;\n applyLabel?: string | null;\n}\n\nexport interface DateRangePickerProps {\n className?: string;\n locale?: string;\n label?: string;\n \"aria-label\"?: string;\n description?: string;\n errorMessage?: string;\n labels: DateRangePickerLabels;\n intervals?: DateRangePreset[];\n presetKeys?: DateRangePresetKey[];\n presetLabels?: Record<DateRangePresetKey, string>;\n hideTime?: boolean;\n minValue?: DateValue;\n maxValue?: DateValue;\n timezone?: string;\n isDisabled?: boolean;\n isRequired?: boolean;\n value?: DateRangePickerValue;\n defaultValue?: DateRangePickerValue;\n onChange?: (value: DateRangePickerValue) => void;\n}\n\ntype DateRange = { start: DateValue; end: DateValue };\n\ntype DraftState = {\n range: DateRange | null;\n startTime: TimeValue | null;\n endTime: TimeValue | null;\n preset?: DateRangePreset;\n};\n\nconst timeFromDateValue = (date: DateValue | null): TimeValue | null =>\n date && \"hour\" in date ? new Time(date.hour, date.minute, date.second) : null;\n\nconst toDraftState = (value?: DateRangePickerValue): DraftState => {\n if (!value || (!value.start && !value.end)) {\n return { range: null, startTime: null, endTime: null, preset: value?.preset };\n }\n const range =\n value.start && value.end\n ? { start: toCalendarDate(value.start), end: toCalendarDate(value.end) }\n : null;\n return {\n range,\n startTime: timeFromDateValue(value.start),\n endTime: timeFromDateValue(value.end),\n preset: value.preset,\n };\n};\n\nconst combineDateAndTime = (\n date: DateValue | undefined,\n time: TimeValue | null,\n hideTime: boolean,\n): DateValue | null => {\n if (!date) return null;\n const calendarDate = toCalendarDate(date);\n if (hideTime || !time) return calendarDate;\n return toCalendarDateTime(calendarDate, time);\n};\n\nconst draftToValue = (\n draft: DraftState,\n hideTime: boolean,\n): DateRangePickerValue => ({\n preset: draft.preset,\n start: combineDateAndTime(draft.range?.start, draft.startTime, hideTime),\n end: combineDateAndTime(draft.range?.end, draft.endTime, hideTime),\n});\n\nexport function DateRangePicker({\n className,\n locale: localeProp,\n label,\n \"aria-label\": ariaLabel,\n description,\n errorMessage,\n labels,\n intervals: intervalsProp,\n presetKeys,\n presetLabels,\n hideTime = false,\n minValue,\n maxValue,\n timezone: timezoneProp,\n isDisabled = false,\n isRequired = false,\n value,\n defaultValue,\n onChange,\n}: DateRangePickerProps) {\n const { locale: ambientLocale } = useLocale();\n const locale = localeProp ?? ambientLocale ?? \"pt-BR\";\n const timezone = timezoneProp ?? getLocalTimeZone();\n const {\n placeholder,\n relativeLabel,\n absoluteLabel,\n startDateLabel,\n endDateLabel,\n cancelLabel,\n applyLabel,\n } = labels;\n\n const intervals = useMemo(() => {\n if (intervalsProp) return intervalsProp;\n if (!presetKeys) return undefined;\n if (!presetLabels) {\n throw new Error(\n \"DateRangePicker: `presetLabels` is required when `presetKeys` is provided.\",\n );\n }\n return createDateRangePresets({\n locale,\n timezone,\n include: presetKeys,\n labels: presetLabels,\n });\n }, [intervalsProp, presetKeys, presetLabels, locale, timezone]);\n\n const [committed, setCommitted] = useState<DraftState>(() =>\n toDraftState(value ?? defaultValue),\n );\n const [draft, setDraft] = useState<DraftState>(committed);\n const [previewStart, setPreviewStart] = useState<DateValue | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n\n useEffect(() => {\n if (value !== undefined) setCommitted(toDraftState(value));\n }, [value]);\n\n const clearPreset = (next: DraftState): DraftState => ({\n ...next,\n preset: undefined,\n });\n\n const withDefaultTimes = (next: DraftState): DraftState =>\n hideTime\n ? next\n : {\n ...next,\n startTime: next.startTime ?? dayStartTime(),\n endTime: next.endTime ?? dayEndTime(),\n };\n\n const handleOpenChange = (open: boolean) => {\n if (open) {\n setDraft(committed);\n setPreviewStart(null);\n }\n setIsOpen(open);\n };\n\n const selectPreset = (preset: DateRangePreset) => {\n setPreviewStart(null);\n const { start, end } = preset.getValue();\n setDraft({\n range: { start: toCalendarDate(start), end: toCalendarDate(end) },\n startTime: timeFromDateValue(start),\n endTime: timeFromDateValue(end),\n preset,\n });\n };\n\n const handleAnchorChange = (anchor: DateValue | null) => {\n setPreviewStart(anchor);\n if (anchor && !hideTime) {\n setDraft((current) =>\n clearPreset({\n ...current,\n startTime: current.startTime ?? dayStartTime(),\n }),\n );\n }\n };\n\n const setRange = (range: DateRange | null) => {\n setPreviewStart(null);\n setDraft((current) => withDefaultTimes(clearPreset({ ...current, range })));\n };\n\n const setStartField = (dateTime: DateValue | null) => {\n if (!dateTime) return;\n setPreviewStart(null);\n const date = toCalendarDate(dateTime);\n const time = timeFromDateValue(dateTime);\n setDraft((current) => {\n const nextStartTime = hideTime\n ? current.startTime\n : (time ?? current.startTime ?? dayStartTime());\n const start = combineDateAndTime(date, nextStartTime, hideTime);\n const currentEnd = combineDateAndTime(\n current.range?.end,\n current.endTime,\n hideTime,\n );\n const pushEnd = Boolean(start && currentEnd && currentEnd.compare(start) < 0);\n return clearPreset({\n ...current,\n range: {\n start: date,\n end: pushEnd || !current.range?.end ? date : current.range.end,\n },\n startTime: nextStartTime,\n endTime: pushEnd ? nextStartTime : current.endTime,\n });\n });\n };\n\n const setEndField = (dateTime: DateValue | null) => {\n if (!dateTime) return;\n const date = toCalendarDate(dateTime);\n const time = timeFromDateValue(dateTime);\n setDraft((current) => {\n const nextEndTime = hideTime\n ? current.endTime\n : (time ?? current.endTime ?? dayEndTime());\n const end = combineDateAndTime(date, nextEndTime, hideTime);\n const start = combineDateAndTime(\n current.range?.start,\n current.startTime,\n hideTime,\n );\n if (start && end && end.compare(start) < 0) return current;\n return clearPreset({\n ...current,\n range: { start: current.range?.start ?? date, end: date },\n endTime: nextEndTime,\n });\n });\n };\n\n const apply = () => {\n setCommitted(draft);\n onChange?.(draftToValue(draft, hideTime));\n setIsOpen(false);\n };\n\n const cancel = () => setIsOpen(false);\n\n const showFooter = Boolean(cancelLabel || applyLabel);\n\n const triggerText = () => {\n if (committed.preset) return committed.preset.label;\n if (committed.range) {\n const format = (date: DateValue) =>\n date\n .toDate(timezone)\n .toLocaleString(locale, {\n day: \"2-digit\",\n month: \"2-digit\",\n year: \"numeric\",\n ...(hideTime\n ? {}\n : { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" }),\n });\n const start = combineDateAndTime(\n committed.range.start,\n committed.startTime,\n hideTime,\n );\n const end = combineDateAndTime(\n committed.range.end,\n committed.endTime,\n hideTime,\n );\n if (start && end) return `${format(start)} — ${format(end)}`;\n }\n return null;\n };\n\n const selectedText = triggerText();\n const hasPresets = Boolean(intervals && intervals.length > 0);\n const fieldGranularity = hideTime ? \"day\" : \"second\";\n const startFieldValue = combineDateAndTime(\n draft.range?.start ?? previewStart ?? undefined,\n draft.startTime,\n hideTime,\n );\n const endFieldValue = combineDateAndTime(\n draft.range?.end ?? undefined,\n draft.endTime,\n hideTime,\n );\n\n const content = (\n <Field className={clsx(className, \"date-range-picker\")}>\n {label && <Label>{label}</Label>}\n <RACDialogTrigger isOpen={isOpen} onOpenChange={handleOpenChange}>\n <RACButton\n className=\"date-range-picker-trigger\"\n isDisabled={isDisabled}\n aria-label={label ? undefined : (ariaLabel ?? placeholder)}\n aria-required={isRequired || undefined}\n data-invalid={errorMessage ? true : undefined}\n >\n {committed.preset ? (\n <span className=\"date-range-picker-preset-badge\">\n <IconCalendar aria-hidden=\"true\" />\n {committed.preset.label}\n </span>\n ) : (\n <span\n className=\"date-range-picker-value\"\n data-placeholder={selectedText ? undefined : true}\n >\n {selectedText ?? placeholder}\n </span>\n )}\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover className=\"date-range-picker-popover\" placement=\"bottom start\">\n <RACDialog className=\"date-range-picker-dialog\">\n <div className=\"date-range-picker-body\">\n {hasPresets && (\n <div className=\"date-range-picker-presets\">\n <TextSmallStrong className=\"date-range-picker-section-title\">\n {relativeLabel}\n </TextSmallStrong>\n <ListBox\n aria-label={relativeLabel}\n className=\"date-range-picker-presets-list\"\n selectionMode=\"single\"\n selectedKeys={draft.preset ? [draft.preset.id] : []}\n items={intervals}\n onSelectionChange={(keys) => {\n const [id] = [...keys];\n const preset = intervals?.find((item) => item.id === id);\n if (preset) selectPreset(preset);\n }}\n >\n {(item) => (\n <ListBoxItem\n id={item.id}\n textValue={item.label}\n className=\"date-range-picker-preset-item\"\n >\n <span>{item.label}</span>\n <IconCheck\n aria-hidden=\"true\"\n className=\"date-range-picker-preset-check\"\n />\n </ListBoxItem>\n )}\n </ListBox>\n </div>\n )}\n\n <div className=\"date-range-picker-absolute\">\n <TextSmallStrong className=\"date-range-picker-section-title\">\n {absoluteLabel}\n </TextSmallStrong>\n\n <div className=\"date-range-picker-fields\">\n <RACDateField\n className=\"date-range-picker-datefield\"\n granularity={fieldGranularity}\n value={startFieldValue}\n minValue={minValue}\n maxValue={endFieldValue ?? maxValue}\n onChange={setStartField}\n >\n <RACLabel className=\"date-range-picker-field-label\">\n {startDateLabel}\n </RACLabel>\n <RACGroup className=\"date-range-picker-input\">\n <RACDateInput>\n {(segment) => <RACDateSegment segment={segment} />}\n </RACDateInput>\n <IconCalendar aria-hidden=\"true\" />\n </RACGroup>\n </RACDateField>\n\n <RACDateField\n className=\"date-range-picker-datefield\"\n granularity={fieldGranularity}\n value={endFieldValue}\n minValue={startFieldValue ?? minValue}\n maxValue={maxValue}\n onChange={setEndField}\n >\n <RACLabel className=\"date-range-picker-field-label\">\n {endDateLabel}\n </RACLabel>\n <RACGroup className=\"date-range-picker-input\">\n <RACDateInput>\n {(segment) => <RACDateSegment segment={segment} />}\n </RACDateInput>\n <IconCalendar aria-hidden=\"true\" />\n </RACGroup>\n </RACDateField>\n </div>\n\n <RACRangeCalendar\n className=\"date-range-picker-calendar\"\n aria-label={absoluteLabel}\n value={draft.range}\n minValue={minValue}\n maxValue={maxValue}\n onChange={setRange}\n >\n <CalendarAnchorSync onAnchorChange={handleAnchorChange} />\n <header className=\"date-range-picker-calendar-header\">\n <RACButton\n slot=\"previous\"\n className=\"date-range-picker-calendar-nav\"\n >\n <IconChevronLeft aria-hidden=\"true\" />\n </RACButton>\n <RACHeading className=\"date-range-picker-calendar-heading\" />\n <RACButton\n slot=\"next\"\n className=\"date-range-picker-calendar-nav\"\n >\n <IconChevronRight aria-hidden=\"true\" />\n </RACButton>\n </header>\n <RACCalendarGrid className=\"date-range-picker-calendar-grid\">\n {(date) => (\n <RACCalendarCell\n date={date}\n className=\"date-range-picker-calendar-cell\"\n />\n )}\n </RACCalendarGrid>\n </RACRangeCalendar>\n </div>\n </div>\n\n {showFooter && (\n <div className=\"date-range-picker-actions\">\n {cancelLabel && (\n <Button variant=\"neutral\" size=\"small\" onPress={cancel}>\n {cancelLabel}\n </Button>\n )}\n {applyLabel && (\n <Button variant=\"primary\" size=\"small\" onPress={apply}>\n {applyLabel}\n </Button>\n )}\n </div>\n )}\n </RACDialog>\n </RACPopover>\n </RACDialogTrigger>\n {description && <Description>{description}</Description>}\n {errorMessage && (\n <Text className=\"date-range-picker-error\" elementType=\"span\">\n {errorMessage}\n </Text>\n )}\n </Field>\n );\n\n return localeProp ? (\n <RACI18nProvider locale={localeProp}>{content}</RACI18nProvider>\n ) : (\n content\n );\n}\n"],"names":["dayStartTime","Time","dayEndTime","CalendarAnchorSync","onAnchorChange","state","useContext","RangeCalendarStateContext","anchor","anchorKey","useEffect","timeFromDateValue","date","toDraftState","value","toCalendarDate","combineDateAndTime","time","hideTime","calendarDate","toCalendarDateTime","draftToValue","draft","_a","_b","DateRangePicker","className","localeProp","label","ariaLabel","description","errorMessage","labels","intervalsProp","presetKeys","presetLabels","minValue","maxValue","timezoneProp","isDisabled","isRequired","defaultValue","onChange","ambientLocale","useLocale","locale","timezone","getLocalTimeZone","placeholder","relativeLabel","absoluteLabel","startDateLabel","endDateLabel","cancelLabel","applyLabel","intervals","useMemo","createDateRangePresets","committed","setCommitted","useState","setDraft","previewStart","setPreviewStart","isOpen","setIsOpen","clearPreset","next","withDefaultTimes","handleOpenChange","open","selectPreset","preset","start","end","handleAnchorChange","current","setRange","range","setStartField","dateTime","nextStartTime","currentEnd","pushEnd","setEndField","nextEndTime","apply","cancel","showFooter","selectedText","format","hasPresets","fieldGranularity","startFieldValue","endFieldValue","content","jsxs","Field","clsx","jsx","Label","RACDialogTrigger","RACButton","IconCalendar","IconChevronDown","RACPopover","RACDialog","TextSmallStrong","ListBox","keys","id","item","ListBoxItem","IconCheck","RACDateField","RACLabel","RACGroup","RACDateInput","segment","RACDateSegment","RACRangeCalendar","IconChevronLeft","RACHeading","IconChevronRight","RACCalendarGrid","RACCalendarCell","Button","Description","Text","RACI18nProvider"],"mappings":"0rBAmDMA,EAAe,IAAM,IAAIC,EAAAA,KAAK,EAAG,EAAG,CAAC,EACrCC,GAAa,IAAM,IAAID,EAAAA,KAAK,GAAI,GAAI,EAAE,EAE5C,SAASE,GAAmB,CAC1B,eAAAC,CACF,EAEG,CACD,MAAMC,EAAQC,EAAAA,WAAWC,2BAAyB,EAC5CC,GAASH,GAAA,YAAAA,EAAO,aAAc,KAC9BI,EAAYD,GAAA,YAAAA,EAAQ,WAC1BE,OAAAA,EAAAA,UAAU,IAAM,CACdN,EAAeI,CAAM,CAEvB,EAAG,CAACC,CAAS,CAAC,EACP,IACT,CAuDA,MAAME,EAAqBC,GACzBA,GAAQ,SAAUA,EAAO,IAAIX,EAAAA,KAAKW,EAAK,KAAMA,EAAK,OAAQA,EAAK,MAAM,EAAI,KAErEC,GAAgBC,GAChB,CAACA,GAAU,CAACA,EAAM,OAAS,CAACA,EAAM,IAC7B,CAAE,MAAO,KAAM,UAAW,KAAM,QAAS,KAAM,OAAQA,GAAA,YAAAA,EAAO,MAAA,EAMhE,CACL,MAJAA,EAAM,OAASA,EAAM,IACjB,CAAE,MAAOC,EAAAA,eAAeD,EA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EACzCC,GACCoE,EAAAA,IAAC6B,EAAAA,KAAA,CAAK,UAAU,0BAA0B,YAAY,OACnD,SAAAjG,CAAA,CACH,CAAA,EAEJ,EAGF,OAAOJ,EACLwE,MAAC8B,EAAAA,aAAA,CAAgB,OAAQtG,EAAa,WAAQ,EAE9CoE,CAEJ"}
1
+ {"version":3,"file":"DateRangePicker.cjs","sources":["../../../../../src/ui/primitives/DateRangePicker/DateRangePicker.tsx"],"sourcesContent":["import {\n Time,\n getLocalTimeZone,\n toCalendarDate,\n toCalendarDateTime,\n type DateValue,\n} from \"@internationalized/date\";\nimport { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport {\n IconCalendar,\n IconCheck,\n IconChevronDown,\n IconChevronLeft,\n IconChevronRight,\n} from \"icons\";\nimport {\n Button,\n Description,\n Field,\n Label,\n ListBox,\n ListBoxItem,\n Text,\n TextSmallStrong,\n} from \"primitives\";\nimport { useContext, useEffect, useMemo, useState } from \"react\";\nimport {\n Button as RACButton,\n CalendarCell as RACCalendarCell,\n CalendarGrid as RACCalendarGrid,\n DateField as RACDateField,\n DateInput as RACDateInput,\n DateSegment as RACDateSegment,\n Dialog as RACDialog,\n DialogTrigger as RACDialogTrigger,\n Group as RACGroup,\n Heading as RACHeading,\n I18nProvider as RACI18nProvider,\n Label as RACLabel,\n Popover as RACPopover,\n RangeCalendar as RACRangeCalendar,\n RangeCalendarStateContext,\n useLocale,\n type TimeValue,\n} from \"react-aria-components\";\nimport {\n createDateRangePresets,\n type DateRangePresetKey,\n} from \"./dateRangePresets\";\nimport \"./daterangepicker.css\";\n\nconst dayStartTime = () => new Time(0, 0, 0);\nconst dayEndTime = () => new Time(23, 59, 59);\n\nfunction CalendarAnchorSync({\n onAnchorChange,\n}: {\n onAnchorChange: (anchor: DateValue | null) => void;\n}) {\n const state = useContext(RangeCalendarStateContext);\n const anchor = state?.anchorDate ?? null;\n const anchorKey = anchor?.toString();\n useEffect(() => {\n onAnchorChange(anchor);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [anchorKey]);\n return null;\n}\n\nexport interface DateRangePreset {\n id: string;\n label: string;\n getValue: () => { start: DateValue; end: DateValue };\n}\n\nexport interface DateRangePickerValue {\n preset?: DateRangePreset;\n start: DateValue | null;\n end: DateValue | null;\n}\n\nexport interface DateRangePickerLabels {\n placeholder: string;\n relativeLabel: string;\n absoluteLabel: string;\n startDateLabel: string;\n endDateLabel: string;\n cancelLabel?: string | null;\n applyLabel?: string | null;\n}\n\nexport interface DateRangePickerProps {\n className?: string;\n locale?: string;\n label?: string;\n \"aria-label\"?: string;\n description?: string;\n errorMessage?: string;\n labels: DateRangePickerLabels;\n intervals?: DateRangePreset[];\n presetKeys?: DateRangePresetKey[];\n presetLabels?: Record<DateRangePresetKey, string>;\n hideTime?: boolean;\n minValue?: DateValue;\n maxValue?: DateValue;\n timezone?: string;\n isDisabled?: boolean;\n isRequired?: boolean;\n value?: DateRangePickerValue;\n defaultValue?: DateRangePickerValue;\n onChange?: (value: DateRangePickerValue) => void;\n}\n\ntype DateRange = { start: DateValue; end: DateValue };\n\ntype DraftState = {\n range: DateRange | null;\n startTime: TimeValue | null;\n endTime: TimeValue | null;\n preset?: DateRangePreset;\n};\n\nconst timeFromDateValue = (date: DateValue | null): TimeValue | null =>\n date && \"hour\" in date ? new Time(date.hour, date.minute, date.second) : null;\n\nconst toDraftState = (value?: DateRangePickerValue): DraftState => {\n if (!value || (!value.start && !value.end)) {\n return { range: null, startTime: null, endTime: null, preset: value?.preset };\n }\n const range =\n value.start && value.end\n ? { start: toCalendarDate(value.start), end: toCalendarDate(value.end) }\n : null;\n return {\n range,\n startTime: timeFromDateValue(value.start),\n endTime: timeFromDateValue(value.end),\n preset: value.preset,\n };\n};\n\nconst combineDateAndTime = (\n date: DateValue | undefined,\n time: TimeValue | null,\n hideTime: boolean,\n): DateValue | null => {\n if (!date) return null;\n const calendarDate = toCalendarDate(date);\n if (hideTime || !time) return calendarDate;\n return toCalendarDateTime(calendarDate, time);\n};\n\nconst draftToValue = (\n draft: DraftState,\n hideTime: boolean,\n): DateRangePickerValue => ({\n preset: draft.preset,\n start: combineDateAndTime(draft.range?.start, draft.startTime, hideTime),\n end: combineDateAndTime(draft.range?.end, draft.endTime, hideTime),\n});\n\nexport function DateRangePicker({\n className,\n locale: localeProp,\n label,\n \"aria-label\": ariaLabel,\n description,\n errorMessage,\n labels,\n intervals: intervalsProp,\n presetKeys,\n presetLabels,\n hideTime = false,\n minValue,\n maxValue,\n timezone: timezoneProp,\n isDisabled = false,\n isRequired = false,\n value,\n defaultValue,\n onChange,\n}: DateRangePickerProps) {\n // Sem container explícito o popover faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n const { locale: ambientLocale } = useLocale();\n const locale = localeProp ?? ambientLocale ?? \"pt-BR\";\n const timezone = timezoneProp ?? getLocalTimeZone();\n const {\n placeholder,\n relativeLabel,\n absoluteLabel,\n startDateLabel,\n endDateLabel,\n cancelLabel,\n applyLabel,\n } = labels;\n\n const intervals = useMemo(() => {\n if (intervalsProp) return intervalsProp;\n if (!presetKeys) return undefined;\n if (!presetLabels) {\n throw new Error(\n \"DateRangePicker: `presetLabels` is required when `presetKeys` is provided.\",\n );\n }\n return createDateRangePresets({\n locale,\n timezone,\n include: presetKeys,\n labels: presetLabels,\n });\n }, [intervalsProp, presetKeys, presetLabels, locale, timezone]);\n\n const [committed, setCommitted] = useState<DraftState>(() =>\n toDraftState(value ?? defaultValue),\n );\n const [draft, setDraft] = useState<DraftState>(committed);\n const [previewStart, setPreviewStart] = useState<DateValue | null>(null);\n const [isOpen, setIsOpen] = useState(false);\n\n useEffect(() => {\n if (value !== undefined) setCommitted(toDraftState(value));\n }, [value]);\n\n const clearPreset = (next: DraftState): DraftState => ({\n ...next,\n preset: undefined,\n });\n\n const withDefaultTimes = (next: DraftState): DraftState =>\n hideTime\n ? next\n : {\n ...next,\n startTime: next.startTime ?? dayStartTime(),\n endTime: next.endTime ?? dayEndTime(),\n };\n\n const handleOpenChange = (open: boolean) => {\n if (open) {\n setDraft(committed);\n setPreviewStart(null);\n }\n setIsOpen(open);\n };\n\n const selectPreset = (preset: DateRangePreset) => {\n setPreviewStart(null);\n const { start, end } = preset.getValue();\n setDraft({\n range: { start: toCalendarDate(start), end: toCalendarDate(end) },\n startTime: timeFromDateValue(start),\n endTime: timeFromDateValue(end),\n preset,\n });\n };\n\n const handleAnchorChange = (anchor: DateValue | null) => {\n setPreviewStart(anchor);\n if (anchor && !hideTime) {\n setDraft((current) =>\n clearPreset({\n ...current,\n startTime: current.startTime ?? dayStartTime(),\n }),\n );\n }\n };\n\n const setRange = (range: DateRange | null) => {\n setPreviewStart(null);\n setDraft((current) => withDefaultTimes(clearPreset({ ...current, range })));\n };\n\n const setStartField = (dateTime: DateValue | null) => {\n if (!dateTime) return;\n setPreviewStart(null);\n const date = toCalendarDate(dateTime);\n const time = timeFromDateValue(dateTime);\n setDraft((current) => {\n const nextStartTime = hideTime\n ? current.startTime\n : (time ?? current.startTime ?? dayStartTime());\n const start = combineDateAndTime(date, nextStartTime, hideTime);\n const currentEnd = combineDateAndTime(\n current.range?.end,\n current.endTime,\n hideTime,\n );\n const pushEnd = Boolean(start && currentEnd && currentEnd.compare(start) < 0);\n return clearPreset({\n ...current,\n range: {\n start: date,\n end: pushEnd || !current.range?.end ? date : current.range.end,\n },\n startTime: nextStartTime,\n endTime: pushEnd ? nextStartTime : current.endTime,\n });\n });\n };\n\n const setEndField = (dateTime: DateValue | null) => {\n if (!dateTime) return;\n const date = toCalendarDate(dateTime);\n const time = timeFromDateValue(dateTime);\n setDraft((current) => {\n const nextEndTime = hideTime\n ? current.endTime\n : (time ?? current.endTime ?? dayEndTime());\n const end = combineDateAndTime(date, nextEndTime, hideTime);\n const start = combineDateAndTime(\n current.range?.start,\n current.startTime,\n hideTime,\n );\n if (start && end && end.compare(start) < 0) return current;\n return clearPreset({\n ...current,\n range: { start: current.range?.start ?? date, end: date },\n endTime: nextEndTime,\n });\n });\n };\n\n const apply = () => {\n setCommitted(draft);\n onChange?.(draftToValue(draft, hideTime));\n setIsOpen(false);\n };\n\n const cancel = () => setIsOpen(false);\n\n const showFooter = Boolean(cancelLabel || applyLabel);\n\n const triggerText = () => {\n if (committed.preset) return committed.preset.label;\n if (committed.range) {\n const format = (date: DateValue) =>\n date\n .toDate(timezone)\n .toLocaleString(locale, {\n day: \"2-digit\",\n month: \"2-digit\",\n year: \"numeric\",\n ...(hideTime\n ? {}\n : { hour: \"2-digit\", minute: \"2-digit\", second: \"2-digit\" }),\n });\n const start = combineDateAndTime(\n committed.range.start,\n committed.startTime,\n hideTime,\n );\n const end = combineDateAndTime(\n committed.range.end,\n committed.endTime,\n hideTime,\n );\n if (start && end) return `${format(start)} — ${format(end)}`;\n }\n return null;\n };\n\n const selectedText = triggerText();\n const hasPresets = Boolean(intervals && intervals.length > 0);\n const fieldGranularity = hideTime ? \"day\" : \"second\";\n const startFieldValue = combineDateAndTime(\n draft.range?.start ?? previewStart ?? undefined,\n draft.startTime,\n hideTime,\n );\n const endFieldValue = combineDateAndTime(\n draft.range?.end ?? undefined,\n draft.endTime,\n hideTime,\n );\n\n const content = (\n <Field className={clsx(className, \"date-range-picker\")}>\n {label && <Label>{label}</Label>}\n <RACDialogTrigger isOpen={isOpen} onOpenChange={handleOpenChange}>\n <RACButton\n className=\"date-range-picker-trigger\"\n isDisabled={isDisabled}\n aria-label={label ? undefined : (ariaLabel ?? placeholder)}\n aria-required={isRequired || undefined}\n data-invalid={errorMessage ? true : undefined}\n >\n {committed.preset ? (\n <span className=\"date-range-picker-preset-badge\">\n <IconCalendar aria-hidden=\"true\" />\n {committed.preset.label}\n </span>\n ) : (\n <span\n className=\"date-range-picker-value\"\n data-placeholder={selectedText ? undefined : true}\n >\n {selectedText ?? placeholder}\n </span>\n )}\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"date-range-picker-popover\"\n placement=\"bottom start\"\n UNSTABLE_portalContainer={portalContainer}\n >\n <RACDialog className=\"date-range-picker-dialog\">\n <div className=\"date-range-picker-body\">\n {hasPresets && (\n <div className=\"date-range-picker-presets\">\n <TextSmallStrong className=\"date-range-picker-section-title\">\n {relativeLabel}\n </TextSmallStrong>\n <ListBox\n aria-label={relativeLabel}\n className=\"date-range-picker-presets-list\"\n selectionMode=\"single\"\n selectedKeys={draft.preset ? [draft.preset.id] : []}\n items={intervals}\n onSelectionChange={(keys) => {\n const [id] = [...keys];\n const preset = intervals?.find((item) => item.id === id);\n if (preset) selectPreset(preset);\n }}\n >\n {(item) => (\n <ListBoxItem\n id={item.id}\n textValue={item.label}\n className=\"date-range-picker-preset-item\"\n >\n <span>{item.label}</span>\n <IconCheck\n aria-hidden=\"true\"\n className=\"date-range-picker-preset-check\"\n />\n </ListBoxItem>\n )}\n </ListBox>\n </div>\n )}\n\n <div className=\"date-range-picker-absolute\">\n <TextSmallStrong className=\"date-range-picker-section-title\">\n {absoluteLabel}\n </TextSmallStrong>\n\n <div className=\"date-range-picker-fields\">\n <RACDateField\n className=\"date-range-picker-datefield\"\n granularity={fieldGranularity}\n value={startFieldValue}\n minValue={minValue}\n maxValue={endFieldValue ?? maxValue}\n onChange={setStartField}\n >\n <RACLabel className=\"date-range-picker-field-label\">\n {startDateLabel}\n </RACLabel>\n <RACGroup className=\"date-range-picker-input\">\n <RACDateInput>\n {(segment) => <RACDateSegment segment={segment} />}\n </RACDateInput>\n <IconCalendar aria-hidden=\"true\" />\n </RACGroup>\n </RACDateField>\n\n <RACDateField\n className=\"date-range-picker-datefield\"\n granularity={fieldGranularity}\n value={endFieldValue}\n minValue={startFieldValue ?? minValue}\n maxValue={maxValue}\n onChange={setEndField}\n >\n <RACLabel className=\"date-range-picker-field-label\">\n {endDateLabel}\n </RACLabel>\n <RACGroup className=\"date-range-picker-input\">\n <RACDateInput>\n {(segment) => <RACDateSegment segment={segment} />}\n </RACDateInput>\n <IconCalendar aria-hidden=\"true\" />\n </RACGroup>\n </RACDateField>\n </div>\n\n <RACRangeCalendar\n className=\"date-range-picker-calendar\"\n aria-label={absoluteLabel}\n value={draft.range}\n minValue={minValue}\n maxValue={maxValue}\n onChange={setRange}\n >\n <CalendarAnchorSync onAnchorChange={handleAnchorChange} />\n <header className=\"date-range-picker-calendar-header\">\n <RACButton\n slot=\"previous\"\n className=\"date-range-picker-calendar-nav\"\n >\n <IconChevronLeft aria-hidden=\"true\" />\n </RACButton>\n <RACHeading className=\"date-range-picker-calendar-heading\" />\n <RACButton\n slot=\"next\"\n className=\"date-range-picker-calendar-nav\"\n >\n <IconChevronRight aria-hidden=\"true\" />\n </RACButton>\n </header>\n <RACCalendarGrid className=\"date-range-picker-calendar-grid\">\n {(date) => (\n <RACCalendarCell\n date={date}\n className=\"date-range-picker-calendar-cell\"\n />\n )}\n </RACCalendarGrid>\n </RACRangeCalendar>\n </div>\n </div>\n\n {showFooter && (\n <div className=\"date-range-picker-actions\">\n {cancelLabel && (\n <Button variant=\"neutral\" size=\"small\" onPress={cancel}>\n {cancelLabel}\n </Button>\n )}\n {applyLabel && (\n <Button variant=\"primary\" size=\"small\" onPress={apply}>\n {applyLabel}\n </Button>\n )}\n </div>\n )}\n </RACDialog>\n </RACPopover>\n </RACDialogTrigger>\n {description && <Description>{description}</Description>}\n {errorMessage && (\n <Text className=\"date-range-picker-error\" elementType=\"span\">\n {errorMessage}\n </Text>\n )}\n </Field>\n );\n\n return localeProp ? (\n <RACI18nProvider locale={localeProp}>{content}</RACI18nProvider>\n ) : (\n content\n );\n}\n"],"names":["dayStartTime","Time","dayEndTime","CalendarAnchorSync","onAnchorChange","state","useContext","RangeCalendarStateContext","anchor","anchorKey","useEffect","timeFromDateValue","date","toDraftState","value","toCalendarDate","combineDateAndTime","time","hideTime","calendarDate","toCalendarDateTime","draftToValue","draft","_a","_b","DateRangePicker","className","localeProp","label","ariaLabel","description","errorMessage","labels","intervalsProp","presetKeys","presetLabels","minValue","maxValue","timezoneProp","isDisabled","isRequired","defaultValue","onChange","portalContainer","useOverlayPortalContainer","ambientLocale","useLocale","locale","timezone","getLocalTimeZone","placeholder","relativeLabel","absoluteLabel","startDateLabel","endDateLabel","cancelLabel","applyLabel","intervals","useMemo","createDateRangePresets","committed","setCommitted","useState","setDraft","previewStart","setPreviewStart","isOpen","setIsOpen","clearPreset","next","withDefaultTimes","handleOpenChange","open","selectPreset","preset","start","end","handleAnchorChange","current","setRange","range","setStartField","dateTime","nextStartTime","currentEnd","pushEnd","setEndField","nextEndTime","apply","cancel","showFooter","selectedText","format","hasPresets","fieldGranularity","startFieldValue","endFieldValue","content","jsxs","Field","clsx","jsx","Label","RACDialogTrigger","RACButton","IconCalendar","IconChevronDown","RACPopover","RACDialog","TextSmallStrong","ListBox","keys","id","item","ListBoxItem","IconCheck","RACDateField","RACLabel","RACGroup","RACDateInput","segment","RACDateSegment","RACRangeCalendar","IconChevronLeft","RACHeading","IconChevronRight","RACCalendarGrid","RACCalendarCell","Button","Description","Text","RACI18nProvider"],"mappings":"yuBAoDMA,EAAe,IAAM,IAAIC,EAAAA,KAAK,EAAG,EAAG,CAAC,EACrCC,GAAa,IAAM,IAAID,EAAAA,KAAK,GAAI,GAAI,EAAE,EAE5C,SAASE,GAAmB,CAC1B,eAAAC,CACF,EAEG,CACD,MAAMC,EAAQC,EAAAA,WAAWC,2BAAyB,EAC5CC,GAASH,GAAA,YAAAA,EAAO,aAAc,KAC9BI,EAAYD,GAAA,YAAAA,EAAQ,WAC1BE,OAAAA,EAAAA,UAAU,IAAM,CACdN,EAAeI,CAAM,CAEvB,EAAG,CAACC,CAAS,CAAC,EACP,IACT,CAuDA,MAAME,EAAqBC,GACzBA,GAAQ,SAAUA,EAAO,IAAIX,EAAAA,KAAKW,EAAK,KAAMA,EAAK,OAAQA,EAAK,MAAM,EAAI,KAErEC,GAAgBC,GAChB,CAACA,GAAU,CAACA,EAAM,OAAS,CAACA,EAAM,IAC7B,CAAE,MAAO,KAAM,UAAW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