@fuf-stack/uniform 1.22.4 → 1.22.5
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.
- package/dist/Checkboxes/index.cjs +2 -1
- package/dist/Checkboxes/index.d.cts +2 -2
- package/dist/Checkboxes/index.d.ts +2 -2
- package/dist/Checkboxes/index.js +2 -2
- package/dist/{Checkboxes-DHk09GmH.cjs → Checkboxes-DrJqx6O2.cjs} +7 -1
- package/dist/{Checkboxes-DHk09GmH.cjs.map → Checkboxes-DrJqx6O2.cjs.map} +1 -1
- package/dist/{Checkboxes-D1hppxDE.js → Checkboxes-X6FRwI50.js} +2 -2
- package/dist/{Checkboxes-D1hppxDE.js.map → Checkboxes-X6FRwI50.js.map} +1 -1
- package/dist/DatePicker/index.cjs +2 -1
- package/dist/DatePicker/index.d.cts +2 -2
- package/dist/DatePicker/index.d.ts +2 -2
- package/dist/DatePicker/index.js +2 -2
- package/dist/{DatePicker-BUSi8SWQ.js → DatePicker-CGIWizz9.js} +2 -2
- package/dist/{DatePicker-BUSi8SWQ.js.map → DatePicker-CGIWizz9.js.map} +1 -1
- package/dist/{DatePicker-DuBjvS5g.cjs → DatePicker-CYUuwwsm.cjs} +7 -1
- package/dist/{DatePicker-DuBjvS5g.cjs.map → DatePicker-CYUuwwsm.cjs.map} +1 -1
- package/dist/FieldArray/index.cjs +2 -1
- package/dist/FieldArray/index.d.cts +2 -2
- package/dist/FieldArray/index.d.ts +2 -2
- package/dist/FieldArray/index.js +2 -2
- package/dist/{FieldArray-BxmK1NRd.js → FieldArray-Dkw6JBnT.js} +2 -2
- package/dist/{FieldArray-BxmK1NRd.js.map → FieldArray-Dkw6JBnT.js.map} +1 -1
- package/dist/{FieldArray-DgiQpIdr.cjs → FieldArray-V66fsvtd.cjs} +7 -1
- package/dist/{FieldArray-DgiQpIdr.cjs.map → FieldArray-V66fsvtd.cjs.map} +1 -1
- package/dist/FieldCard/index.cjs +6 -2
- package/dist/FieldCard/index.d.cts +2 -2
- package/dist/FieldCard/index.d.ts +2 -2
- package/dist/FieldCard/index.js +2 -2
- package/dist/{FieldCard-C-DZ5ARr.cjs → FieldCard-CAHnM8C0.cjs} +10 -1
- package/dist/FieldCard-CAHnM8C0.cjs.map +1 -0
- package/dist/{FieldCard-BK6SNqFY.js → FieldCard-Cg31ce9J.js} +5 -2
- package/dist/FieldCard-Cg31ce9J.js.map +1 -0
- package/dist/Input/index.d.cts +1 -1
- package/dist/Input/index.d.ts +1 -1
- package/dist/RadioBoxes/index.cjs +1 -1
- package/dist/RadioBoxes/index.d.cts +2 -2
- package/dist/RadioBoxes/index.d.ts +2 -2
- package/dist/RadioBoxes/index.js +1 -1
- package/dist/{RadioBoxes-CR--FBhQ.cjs → RadioBoxes-BmLrbYXt.cjs} +3 -3
- package/dist/RadioBoxes-BmLrbYXt.cjs.map +1 -0
- package/dist/{RadioBoxes-BJz-aJp3.js → RadioBoxes-DWxJBTKR.js} +3 -3
- package/dist/RadioBoxes-DWxJBTKR.js.map +1 -0
- package/dist/RadioTabs/index.cjs +2 -1
- package/dist/RadioTabs/index.d.cts +2 -2
- package/dist/RadioTabs/index.d.ts +2 -2
- package/dist/RadioTabs/index.js +2 -2
- package/dist/{RadioTabs-Btt582Nl.cjs → RadioTabs-14XTbTJU.cjs} +20 -14
- package/dist/RadioTabs-14XTbTJU.cjs.map +1 -0
- package/dist/{RadioTabs-CYmzrPBG.js → RadioTabs-DAY6MYJI.js} +15 -15
- package/dist/RadioTabs-DAY6MYJI.js.map +1 -0
- package/dist/Radios/index.cjs +2 -1
- package/dist/Radios/index.d.cts +2 -2
- package/dist/Radios/index.d.ts +2 -2
- package/dist/Radios/index.js +2 -2
- package/dist/{Radios-DZxhrX96.js → Radios-C938-msm.js} +2 -2
- package/dist/{Radios-DZxhrX96.js.map → Radios-C938-msm.js.map} +1 -1
- package/dist/{Radios-Jg9mwE0B.cjs → Radios-D_B9Y8s2.cjs} +7 -1
- package/dist/{Radios-Jg9mwE0B.cjs.map → Radios-D_B9Y8s2.cjs.map} +1 -1
- package/dist/Select/index.cjs +2 -1
- package/dist/Select/index.d.cts +2 -2
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select/index.js +2 -2
- package/dist/{Select-CgeqhZIC.js → Select-BL6k_e-D.js} +2 -2
- package/dist/Select-BL6k_e-D.js.map +1 -0
- package/dist/{Select-CZwuEAB5.cjs → Select-D66A-hYm.cjs} +7 -1
- package/dist/Select-D66A-hYm.cjs.map +1 -0
- package/dist/Slider/index.cjs +2 -1
- package/dist/Slider/index.d.cts +2 -2
- package/dist/Slider/index.d.ts +2 -2
- package/dist/Slider/index.js +2 -2
- package/dist/{Slider-Bpxt-Qgj.cjs → Slider-ChC2PZNb.cjs} +7 -1
- package/dist/{Slider-Bpxt-Qgj.cjs.map → Slider-ChC2PZNb.cjs.map} +1 -1
- package/dist/{Slider-DRfSw0uE.js → Slider-DmEwhC1T.js} +2 -2
- package/dist/{Slider-DRfSw0uE.js.map → Slider-DmEwhC1T.js.map} +1 -1
- package/dist/Switch/index.cjs +2 -1
- package/dist/Switch/index.d.cts +2 -2
- package/dist/Switch/index.d.ts +2 -2
- package/dist/Switch/index.js +2 -2
- package/dist/{Switch-hjjy34QB.cjs → Switch-Ch6_VInV.cjs} +7 -1
- package/dist/{Switch-hjjy34QB.cjs.map → Switch-Ch6_VInV.cjs.map} +1 -1
- package/dist/{Switch-D9DNrqmj.js → Switch-DvKRPFcC.js} +2 -2
- package/dist/{Switch-D9DNrqmj.js.map → Switch-DvKRPFcC.js.map} +1 -1
- package/dist/SwitchBox/index.d.cts +1 -1
- package/dist/SwitchBox/index.d.ts +1 -1
- package/dist/SwitchBox-BU1XieaZ.js.map +1 -1
- package/dist/SwitchBox-Dl-F5y2m.cjs.map +1 -1
- package/dist/TextArea/index.d.cts +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/Time/index.cjs +7 -2
- package/dist/Time/index.d.cts +2 -2
- package/dist/Time/index.d.ts +2 -2
- package/dist/Time/index.js +2 -2
- package/dist/{Time-CDptQ3CK.js → Time-B_SXrKWK.js} +5 -2
- package/dist/Time-B_SXrKWK.js.map +1 -0
- package/dist/{Time-WKgbji5k.cjs → Time-CYoWaQsz.cjs} +16 -1
- package/dist/Time-CYoWaQsz.cjs.map +1 -0
- package/dist/hooks/useFormContext/index.d.cts +1 -1
- package/dist/hooks/useFormContext/index.d.ts +1 -1
- package/dist/hooks/useUniformField/index.d.cts +1 -1
- package/dist/hooks/useUniformField/index.d.ts +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.cts +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.ts +1 -1
- package/dist/index-19JGtN7H.d.cts +1257 -0
- package/dist/index-19JGtN7H.d.cts.map +1 -0
- package/dist/index-B4XExHDi.d.cts +539 -0
- package/dist/index-B4XExHDi.d.cts.map +1 -0
- package/dist/index-BUZEnZDm.d.ts +1760 -0
- package/dist/index-BUZEnZDm.d.ts.map +1 -0
- package/dist/index-Bbaubtxp.d.cts +677 -0
- package/dist/index-Bbaubtxp.d.cts.map +1 -0
- package/dist/index-BdgFJ-dj.d.ts +1028 -0
- package/dist/index-BdgFJ-dj.d.ts.map +1 -0
- package/dist/index-BiZNkLK3.d.cts +1477 -0
- package/dist/index-BiZNkLK3.d.cts.map +1 -0
- package/dist/index-Bie3CWyW.d.cts +1760 -0
- package/dist/index-Bie3CWyW.d.cts.map +1 -0
- package/dist/index-BsTqcI1C.d.cts +659 -0
- package/dist/index-BsTqcI1C.d.cts.map +1 -0
- package/dist/index-C6Y8KybK.d.ts +677 -0
- package/dist/index-C6Y8KybK.d.ts.map +1 -0
- package/dist/index-CD0Wpla3.d.cts +1413 -0
- package/dist/index-CD0Wpla3.d.cts.map +1 -0
- package/dist/index-CUByIf_d.d.ts +314 -0
- package/dist/index-CUByIf_d.d.ts.map +1 -0
- package/dist/index-Cf2B9woY.d.cts +473 -0
- package/dist/index-Cf2B9woY.d.cts.map +1 -0
- package/dist/index-CqXEYILn.d.cts +1263 -0
- package/dist/index-CqXEYILn.d.cts.map +1 -0
- package/dist/index-D1cB3mbB.d.ts +3917 -0
- package/dist/index-D1cB3mbB.d.ts.map +1 -0
- package/dist/index-D7AUghFx.d.ts +1413 -0
- package/dist/index-D7AUghFx.d.ts.map +1 -0
- package/dist/index-DCwffq1f.d.ts +1263 -0
- package/dist/index-DCwffq1f.d.ts.map +1 -0
- package/dist/index-DFbuWomg.d.ts +534 -0
- package/dist/index-DFbuWomg.d.ts.map +1 -0
- package/dist/index-DXOBPBft.d.ts +659 -0
- package/dist/index-DXOBPBft.d.ts.map +1 -0
- package/dist/index-DY-d4cFe.d.cts +1028 -0
- package/dist/index-DY-d4cFe.d.cts.map +1 -0
- package/dist/index-DqMpHpu7.d.ts +1257 -0
- package/dist/index-DqMpHpu7.d.ts.map +1 -0
- package/dist/index-DwnqyNnX.d.cts +534 -0
- package/dist/index-DwnqyNnX.d.cts.map +1 -0
- package/dist/index-OdNTqjhQ.d.ts +585 -0
- package/dist/index-OdNTqjhQ.d.ts.map +1 -0
- package/dist/index-QPDvw5Z5.d.cts +585 -0
- package/dist/index-QPDvw5Z5.d.cts.map +1 -0
- package/dist/index-amMd-sQN.d.ts +473 -0
- package/dist/index-amMd-sQN.d.ts.map +1 -0
- package/dist/index-clztdahp.d.ts +1477 -0
- package/dist/index-clztdahp.d.ts.map +1 -0
- package/dist/index-jK092-MJ.d.cts +314 -0
- package/dist/index-jK092-MJ.d.cts.map +1 -0
- package/dist/index-veBM95Gw.d.cts +3917 -0
- package/dist/index-veBM95Gw.d.cts.map +1 -0
- package/dist/index-yYjVSHlN.d.ts +539 -0
- package/dist/index-yYjVSHlN.d.ts.map +1 -0
- package/dist/index.cjs +20 -11
- package/dist/index.d.cts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +12 -12
- package/dist/{useFormContext-CpLVpNAf.d.ts → useFormContext-Bj1gXLt_.d.ts} +3 -3
- package/dist/{useFormContext-CpLVpNAf.d.ts.map → useFormContext-Bj1gXLt_.d.ts.map} +1 -1
- package/dist/{useFormContext-Ddc1HWKv.d.cts → useFormContext-M94eQfHm.d.cts} +3 -3
- package/dist/{useFormContext-Ddc1HWKv.d.cts.map → useFormContext-M94eQfHm.d.cts.map} +1 -1
- package/dist/{useUniformField-CmAYcGER.d.cts → useUniformField-BE-e3C4Y.d.cts} +2 -2
- package/dist/{useUniformField-CmAYcGER.d.cts.map → useUniformField-BE-e3C4Y.d.cts.map} +1 -1
- package/dist/{useUniformField-DJDpQzRo.d.ts → useUniformField-DUW-svZD.d.ts} +2 -2
- package/dist/{useUniformField-DJDpQzRo.d.ts.map → useUniformField-DUW-svZD.d.ts.map} +1 -1
- package/dist/{useUniformFieldArray-zGcIhwhF.d.ts → useUniformFieldArray-CdWv1SEk.d.ts} +2 -2
- package/dist/{useUniformFieldArray-zGcIhwhF.d.ts.map → useUniformFieldArray-CdWv1SEk.d.ts.map} +1 -1
- package/dist/{useUniformFieldArray-D3fdzwzD.d.cts → useUniformFieldArray-kkOHxNFF.d.cts} +2 -2
- package/dist/{useUniformFieldArray-D3fdzwzD.d.cts.map → useUniformFieldArray-kkOHxNFF.d.cts.map} +1 -1
- package/package.json +6 -6
- package/dist/FieldCard-BK6SNqFY.js.map +0 -1
- package/dist/FieldCard-C-DZ5ARr.cjs.map +0 -1
- package/dist/RadioBoxes-BJz-aJp3.js.map +0 -1
- package/dist/RadioBoxes-CR--FBhQ.cjs.map +0 -1
- package/dist/RadioTabs-Btt582Nl.cjs.map +0 -1
- package/dist/RadioTabs-CYmzrPBG.js.map +0 -1
- package/dist/Select-CZwuEAB5.cjs.map +0 -1
- package/dist/Select-CgeqhZIC.js.map +0 -1
- package/dist/Time-CDptQ3CK.js.map +0 -1
- package/dist/Time-WKgbji5k.cjs.map +0 -1
- package/dist/index-7UT2Ki5e.d.cts +0 -113
- package/dist/index-7UT2Ki5e.d.cts.map +0 -1
- package/dist/index-9_3XTDJC.d.cts +0 -174
- package/dist/index-9_3XTDJC.d.cts.map +0 -1
- package/dist/index-B5SfdA5O.d.cts +0 -99
- package/dist/index-B5SfdA5O.d.cts.map +0 -1
- package/dist/index-B61zRzeS.d.cts +0 -101
- package/dist/index-B61zRzeS.d.cts.map +0 -1
- package/dist/index-B7gQppgQ.d.ts +0 -116
- package/dist/index-B7gQppgQ.d.ts.map +0 -1
- package/dist/index-BDFJDKmz.d.ts +0 -166
- package/dist/index-BDFJDKmz.d.ts.map +0 -1
- package/dist/index-BPaSE_7b.d.ts +0 -179
- package/dist/index-BPaSE_7b.d.ts.map +0 -1
- package/dist/index-BSjcTo7A.d.ts +0 -147
- package/dist/index-BSjcTo7A.d.ts.map +0 -1
- package/dist/index-BmMspnsJ.d.cts +0 -137
- package/dist/index-BmMspnsJ.d.cts.map +0 -1
- package/dist/index-Bzs7_gnk.d.cts +0 -116
- package/dist/index-Bzs7_gnk.d.cts.map +0 -1
- package/dist/index-C4GJH8Xv.d.ts +0 -290
- package/dist/index-C4GJH8Xv.d.ts.map +0 -1
- package/dist/index-CE8fnXuQ.d.ts +0 -167
- package/dist/index-CE8fnXuQ.d.ts.map +0 -1
- package/dist/index-CIiOXrrY.d.ts +0 -99
- package/dist/index-CIiOXrrY.d.ts.map +0 -1
- package/dist/index-C_zjtsGM.d.ts +0 -113
- package/dist/index-C_zjtsGM.d.ts.map +0 -1
- package/dist/index-CbPJiRK2.d.ts +0 -83
- package/dist/index-CbPJiRK2.d.ts.map +0 -1
- package/dist/index-CvP3tbVV.d.ts +0 -137
- package/dist/index-CvP3tbVV.d.ts.map +0 -1
- package/dist/index-Cwb7sTO0.d.ts +0 -154
- package/dist/index-Cwb7sTO0.d.ts.map +0 -1
- package/dist/index-CxY9VWv5.d.cts +0 -154
- package/dist/index-CxY9VWv5.d.cts.map +0 -1
- package/dist/index-D8udSkgA.d.cts +0 -167
- package/dist/index-D8udSkgA.d.cts.map +0 -1
- package/dist/index-DBsF7xsq.d.cts +0 -147
- package/dist/index-DBsF7xsq.d.cts.map +0 -1
- package/dist/index-DNADTCoc.d.cts +0 -290
- package/dist/index-DNADTCoc.d.cts.map +0 -1
- package/dist/index-DRg0anjB.d.cts +0 -179
- package/dist/index-DRg0anjB.d.cts.map +0 -1
- package/dist/index-DUmNI6cE.d.cts +0 -83
- package/dist/index-DUmNI6cE.d.cts.map +0 -1
- package/dist/index-Db0WD4d1.d.cts +0 -166
- package/dist/index-Db0WD4d1.d.cts.map +0 -1
- package/dist/index-GxTY7aAc.d.ts +0 -174
- package/dist/index-GxTY7aAc.d.ts.map +0 -1
- package/dist/index-PMCqBX0t.d.ts +0 -101
- package/dist/index-PMCqBX0t.d.ts.map +0 -1
- package/dist/index-QgVr4iWX.d.cts +0 -122
- package/dist/index-QgVr4iWX.d.cts.map +0 -1
- package/dist/index-dgho7gpc.d.ts +0 -122
- package/dist/index-dgho7gpc.d.ts.map +0 -1
|
@@ -2,6 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_Checkboxes = require("../Checkboxes-
|
|
5
|
+
const require_Checkboxes = require("../Checkboxes-DrJqx6O2.cjs");
|
|
6
6
|
exports.Checkboxes = require_Checkboxes.Checkboxes;
|
|
7
|
+
exports.checkboxesVariants = require_Checkboxes.checkboxesVariants;
|
|
7
8
|
exports.default = require_Checkboxes.Checkboxes_default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Checkboxes, r as CheckboxesProps, t as CheckboxOption } from "../index-
|
|
2
|
-
export { type CheckboxOption, Checkboxes, Checkboxes as default, type CheckboxesProps };
|
|
1
|
+
import { i as checkboxesVariants, n as Checkboxes, r as CheckboxesProps, t as CheckboxOption } from "../index-DwnqyNnX.cjs";
|
|
2
|
+
export { type CheckboxOption, Checkboxes, Checkboxes as default, type CheckboxesProps, checkboxesVariants };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Checkboxes, r as CheckboxesProps, t as CheckboxOption } from "../index-
|
|
2
|
-
export { type CheckboxOption, Checkboxes, Checkboxes as default, type CheckboxesProps };
|
|
1
|
+
import { i as checkboxesVariants, n as Checkboxes, r as CheckboxesProps, t as CheckboxOption } from "../index-DFbuWomg.js";
|
|
2
|
+
export { type CheckboxOption, Checkboxes, Checkboxes as default, type CheckboxesProps, checkboxesVariants };
|
package/dist/Checkboxes/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Checkboxes, t as Checkboxes_default } from "../Checkboxes-
|
|
2
|
-
export { Checkboxes, Checkboxes_default as default };
|
|
1
|
+
import { n as Checkboxes, r as checkboxesVariants, t as Checkboxes_default } from "../Checkboxes-X6FRwI50.js";
|
|
2
|
+
export { Checkboxes, checkboxesVariants, Checkboxes_default as default };
|
|
@@ -120,5 +120,11 @@ Object.defineProperty(exports, "Checkboxes_default", {
|
|
|
120
120
|
return Checkboxes_default;
|
|
121
121
|
}
|
|
122
122
|
});
|
|
123
|
+
Object.defineProperty(exports, "checkboxesVariants", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function() {
|
|
126
|
+
return checkboxesVariants;
|
|
127
|
+
}
|
|
128
|
+
});
|
|
123
129
|
|
|
124
|
-
//# sourceMappingURL=Checkboxes-
|
|
130
|
+
//# sourceMappingURL=Checkboxes-DrJqx6O2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkboxes-
|
|
1
|
+
{"version":3,"file":"Checkboxes-DrJqx6O2.cjs","names":["heroCheckboxVariants","useUniformField","FieldValidationError","HeroCheckboxGroup","HeroCheckbox"],"sources":["../src/Checkboxes/Checkboxes.tsx","../src/Checkboxes/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type {\n CheckboxGroupProps as HeroCheckboxGroupProps,\n CheckboxProps as HeroCheckboxProps,\n} from '@heroui/checkbox';\nimport type { ReactNode } from 'react';\nimport type { FieldError } from 'react-hook-form';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport {\n Checkbox as HeroCheckbox,\n CheckboxGroup as HeroCheckboxGroup,\n} from '@heroui/checkbox';\nimport { checkbox as heroCheckboxVariants } from '@heroui/theme';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const checkboxesVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n errorMessage: 'text-tiny',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger',\n optionBase: '',\n optionIcon: '',\n optionLabel: '',\n optionLabelSubline: 'text-foreground-400 !text-small',\n optionWrapper: '',\n wrapper: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/checkbox.ts\n color: {\n info: {\n wrapper:\n 'text-info-foreground after:bg-info after:text-info-foreground',\n },\n ...heroCheckboxVariants.variants.color,\n } as const,\n lineThrough: {\n true: {\n optionLabel: [\n ...heroCheckboxVariants.variants.lineThrough.true.label,\n // fix stroke position when used with subline and enable animation\n 'relative before:transition-all before:duration-200',\n ],\n optionLabelSubline: 'group-data-[selected=true]:opacity-60',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof checkboxesVariants>;\ntype ClassName = TVClassName<typeof checkboxesVariants>;\n\nexport interface CheckboxOption {\n /** option label */\n label?: ReactNode;\n /** subline displayed below the label */\n labelSubline?: ReactNode;\n /** option value */\n value: string;\n /** disables the option */\n disabled?: boolean;\n /** HTML data-testid attribute of the option */\n testId?: string;\n}\n\nexport interface CheckboxesProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Color scheme of the checkboxes */\n color?: VariantProps['color'];\n /** Sets all checkboxes disabled */\n disabled?: boolean;\n /** Orientation of the checkboxes */\n inline?: boolean;\n /** Label displayed above the checkboxes */\n label?: ReactNode;\n /** Whether the checkboxes label should be crossed out */\n lineThrough?: boolean;\n /** Name the Field is registered on the form */\n name: string;\n /** Checkboxes that should be displayed. */\n options: CheckboxOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string[]>;\n}\n\n/**\n * Checkboxes component based on [HeroUI CheckboxGroup](https://www.heroui.com//docs/components/checkbox-group)\n */\nconst Checkboxes = ({\n className = undefined,\n color = 'primary',\n inline = false,\n lineThrough = false,\n options,\n name,\n ...uniformFieldProps\n}: CheckboxesProps) => {\n const {\n ariaLabel,\n disabled,\n error: _error,\n field: { onChange, value: fieldValue, ref, onBlur },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Ensure value is always an array (checkboxes need arrays)\n const value = Array.isArray(fieldValue) ? fieldValue : [];\n\n // Convert React Hook Form's nested error object structure to a flat array\n // RHF errors can be nested like: checkboxField.0 (individual checkbox errors)\n // and checkboxField._error (global field errors) - this flattens all\n // error values into a single array for rendering with FieldValidationError\n const errorFlat: FieldError[] =\n (_error &&\n Object.values(\n _error as unknown as Record<string, FieldError[]>,\n ).flat()) ??\n [];\n const errorMessage = (\n <FieldValidationError error={errorFlat} testId={testId} />\n );\n\n // classNames from slots\n const variants = checkboxesVariants({ lineThrough });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // map slots to HeroUI class names\n const heroCheckboxGroupClassNames: HeroCheckboxGroupProps['classNames'] = {\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n };\n const heroCheckboxClassNames: HeroCheckboxProps['classNames'] = {\n base: classNames.optionBase,\n icon: classNames.optionIcon,\n label: classNames.optionLabel,\n wrapper: classNames.optionWrapper,\n };\n\n return (\n <HeroCheckboxGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={heroCheckboxGroupClassNames}\n color={color === 'info' ? 'primary' : color}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n orientation={inline ? 'horizontal' : 'vertical'}\n value={value}\n >\n {options?.map((option) => {\n const optionTestId = slugify(\n `${testId}_option_${option?.testId ?? option?.value}`,\n { replaceDots: true },\n );\n\n // set content and classes depending option has subline\n const hasSubline = !!option.labelSubline;\n let labelContent: ReactNode;\n let optionClassNames = heroCheckboxClassNames;\n if (hasSubline) {\n labelContent = (\n <div className=\"flex grow flex-col items-start\">\n <span className={classNames.optionLabel}>{option.label}</span>\n <span className={classNames.optionLabelSubline}>\n {option.labelSubline}\n </span>\n </div>\n );\n // remove label classes from outer label when subline is used\n optionClassNames = { ...optionClassNames, label: '' };\n } else {\n labelContent = option.label;\n }\n\n return (\n <HeroCheckbox\n key={`index_${option.value}`}\n classNames={optionClassNames}\n data-invalid={invalid}\n data-testid={optionTestId}\n isDisabled={!!disabled || option.disabled}\n value={option?.value}\n aria-label={\n typeof option.label === 'string' ? option.label : option.value\n }\n >\n {labelContent}\n </HeroCheckbox>\n );\n })}\n </HeroCheckboxGroup>\n );\n};\n\nexport default Checkboxes;\n","import Checkboxes from './Checkboxes';\n\nexport type { CheckboxesProps, CheckboxOption } from './Checkboxes';\n\nexport { checkboxesVariants } from './Checkboxes';\n\nexport { Checkboxes };\n\nexport default Checkboxes;\n"],"mappings":";;;;;;;;AAoBA,MAAa,sBAAA,GAAA,uBAAA,IAAwB;CACnC,OAAO;EACL,MAAM;EACN,cAAc;EAGd,OACE;EACF,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,oBAAoB;EACpB,eAAe;E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;EAC9B;YAEN,SAAS,KAAK,WAAW;GACxB,MAAM,gBAAA,GAAA,uBAAA,SACJ,GAAG,OAAO,UAAU,QAAQ,UAAU,QAAQ,SAC9C,EAAE,aAAa,KAAK,CACtB;GAGA,MAAM,aAAa,CAAC,CAAC,OAAO;GAC5B,IAAI;GACJ,IAAI,mBAAmB;GACvB,IAAI,YAAY;IACd,eACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;KAAK,WAAU;eAAf,CACE,iBAAA,GAAA,kBAAA,KAAC,QAAD;MAAM,WAAW,WAAW;gBAAc,OAAO;KAAY,CAAA,GAC7D,iBAAA,GAAA,kBAAA,KAAC,QAAD;MAAM,WAAW,WAAW;gBACzB,OAAO;KACJ,CAAA,CACH;;IAGP,mBAAmB;KAAE,GAAG;KAAkB,OAAO;IAAG;GACtD,OACE,eAAe,OAAO;GAGxB,OACE,iBAAA,GAAA,kBAAA,KAACC,iBAAAA,UAAD;IAEE,YAAY;IACZ,gBAAc;IACd,eAAa;IACb,YAAY,CAAC,CAAC,YAAY,OAAO;IACjC,OAAO,QAAQ;IACf,cACE,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,OAAO;cAG1D;GACW,GAXP,SAAS,OAAO,OAWT;EAElB,CAAC;CACgB,CAAA;AAEvB;;;ACtNA,IAAA,qBAAe"}
|
|
@@ -107,6 +107,6 @@ const Checkboxes = ({ className = void 0, color = "primary", inline = false, lin
|
|
|
107
107
|
//#region src/Checkboxes/index.ts
|
|
108
108
|
var Checkboxes_default = Checkboxes;
|
|
109
109
|
//#endregion
|
|
110
|
-
export { Checkboxes as n, Checkboxes_default as t };
|
|
110
|
+
export { Checkboxes as n, checkboxesVariants as r, Checkboxes_default as t };
|
|
111
111
|
|
|
112
|
-
//# sourceMappingURL=Checkboxes-
|
|
112
|
+
//# sourceMappingURL=Checkboxes-X6FRwI50.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkboxes-
|
|
1
|
+
{"version":3,"file":"Checkboxes-X6FRwI50.js","names":["heroCheckboxVariants","HeroCheckboxGroup","HeroCheckbox"],"sources":["../src/Checkboxes/Checkboxes.tsx","../src/Checkboxes/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type {\n CheckboxGroupProps as HeroCheckboxGroupProps,\n CheckboxProps as HeroCheckboxProps,\n} from '@heroui/checkbox';\nimport type { ReactNode } from 'react';\nimport type { FieldError } from 'react-hook-form';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport {\n Checkbox as HeroCheckbox,\n CheckboxGroup as HeroCheckboxGroup,\n} from '@heroui/checkbox';\nimport { checkbox as heroCheckboxVariants } from '@heroui/theme';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const checkboxesVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n errorMessage: 'text-tiny',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger',\n optionBase: '',\n optionIcon: '',\n optionLabel: '',\n optionLabelSubline: 'text-foreground-400 !text-small',\n optionWrapper: '',\n wrapper: '',\n },\n variants: {\n // see: https://github.com/heroui-inc/heroui/blob/canary/packages/core/theme/src/components/checkbox.ts\n color: {\n info: {\n wrapper:\n 'text-info-foreground after:bg-info after:text-info-foreground',\n },\n ...heroCheckboxVariants.variants.color,\n } as const,\n lineThrough: {\n true: {\n optionLabel: [\n ...heroCheckboxVariants.variants.lineThrough.true.label,\n // fix stroke position when used with subline and enable animation\n 'relative before:transition-all before:duration-200',\n ],\n optionLabelSubline: 'group-data-[selected=true]:opacity-60',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof checkboxesVariants>;\ntype ClassName = TVClassName<typeof checkboxesVariants>;\n\nexport interface CheckboxOption {\n /** option label */\n label?: ReactNode;\n /** subline displayed below the label */\n labelSubline?: ReactNode;\n /** option value */\n value: string;\n /** disables the option */\n disabled?: boolean;\n /** HTML data-testid attribute of the option */\n testId?: string;\n}\n\nexport interface CheckboxesProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Color scheme of the checkboxes */\n color?: VariantProps['color'];\n /** Sets all checkboxes disabled */\n disabled?: boolean;\n /** Orientation of the checkboxes */\n inline?: boolean;\n /** Label displayed above the checkboxes */\n label?: ReactNode;\n /** Whether the checkboxes label should be crossed out */\n lineThrough?: boolean;\n /** Name the Field is registered on the form */\n name: string;\n /** Checkboxes that should be displayed. */\n options: CheckboxOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string[]>;\n}\n\n/**\n * Checkboxes component based on [HeroUI CheckboxGroup](https://www.heroui.com//docs/components/checkbox-group)\n */\nconst Checkboxes = ({\n className = undefined,\n color = 'primary',\n inline = false,\n lineThrough = false,\n options,\n name,\n ...uniformFieldProps\n}: CheckboxesProps) => {\n const {\n ariaLabel,\n disabled,\n error: _error,\n field: { onChange, value: fieldValue, ref, onBlur },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Ensure value is always an array (checkboxes need arrays)\n const value = Array.isArray(fieldValue) ? fieldValue : [];\n\n // Convert React Hook Form's nested error object structure to a flat array\n // RHF errors can be nested like: checkboxField.0 (individual checkbox errors)\n // and checkboxField._error (global field errors) - this flattens all\n // error values into a single array for rendering with FieldValidationError\n const errorFlat: FieldError[] =\n (_error &&\n Object.values(\n _error as unknown as Record<string, FieldError[]>,\n ).flat()) ??\n [];\n const errorMessage = (\n <FieldValidationError error={errorFlat} testId={testId} />\n );\n\n // classNames from slots\n const variants = checkboxesVariants({ lineThrough });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // map slots to HeroUI class names\n const heroCheckboxGroupClassNames: HeroCheckboxGroupProps['classNames'] = {\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n };\n const heroCheckboxClassNames: HeroCheckboxProps['classNames'] = {\n base: classNames.optionBase,\n icon: classNames.optionIcon,\n label: classNames.optionLabel,\n wrapper: classNames.optionWrapper,\n };\n\n return (\n <HeroCheckboxGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={heroCheckboxGroupClassNames}\n color={color === 'info' ? 'primary' : color}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n onChange={onChange}\n orientation={inline ? 'horizontal' : 'vertical'}\n value={value}\n >\n {options?.map((option) => {\n const optionTestId = slugify(\n `${testId}_option_${option?.testId ?? option?.value}`,\n { replaceDots: true },\n );\n\n // set content and classes depending option has subline\n const hasSubline = !!option.labelSubline;\n let labelContent: ReactNode;\n let optionClassNames = heroCheckboxClassNames;\n if (hasSubline) {\n labelContent = (\n <div className=\"flex grow flex-col items-start\">\n <span className={classNames.optionLabel}>{option.label}</span>\n <span className={classNames.optionLabelSubline}>\n {option.labelSubline}\n </span>\n </div>\n );\n // remove label classes from outer label when subline is used\n optionClassNames = { ...optionClassNames, label: '' };\n } else {\n labelContent = option.label;\n }\n\n return (\n <HeroCheckbox\n key={`index_${option.value}`}\n classNames={optionClassNames}\n data-invalid={invalid}\n data-testid={optionTestId}\n isDisabled={!!disabled || option.disabled}\n value={option?.value}\n aria-label={\n typeof option.label === 'string' ? option.label : option.value\n }\n >\n {labelContent}\n </HeroCheckbox>\n );\n })}\n </HeroCheckboxGroup>\n );\n};\n\nexport default Checkboxes;\n","import Checkboxes from './Checkboxes';\n\nexport type { CheckboxesProps, CheckboxOption } from './Checkboxes';\n\nexport { checkboxesVariants } from './Checkboxes';\n\nexport { Checkboxes };\n\nexport default Checkboxes;\n"],"mappings":";;;;;;;AAoBA,MAAa,qBAAqB,GAAG;CACnC,OAAO;EACL,MAAM;EACN,cAAc;EAGd,OACE;EACF,YAAY;EACZ,YAAY;EACZ,aAAa;EACb,oBAAoB;EACpB,eAAe;EACf,SAAS;CACX;CACA,UAAU;EAER,OAAO;GACL,MAAM,EACJ,SACE,gEACJ;GACA,GAAGA,SAAqB,SAAS;EACnC;EACA,aAAa,EACX,MAAM;GACJ,aAAa,CACX,GAAGA,SAAqB,SAAS,YAAY,KAAK,OAElD,oDACF;GACA,oBAAoB;EACtB,EACF;CACF;AACF,CAAC;;;;AA8CD,MAAM,cAAc,EAClB,YAAY,KAAA,GACZ,QAAQ,WACR,SAAS,OACT,cAAc,OACd,SACA,MACA,GAAG,wBACkB;CACrB,MAAM,EACJ,WACA,UACA,OAAO,QACP,OAAO,EAAE,UAAU,OAAO,YAAY,KAAK,UAC3C,SACA,OACA,UACA,WACE,gBAAgB;EAClB;EACA,GAAG;CACL,CAAC;CAGD,MAAM,QAAQ,MAAM,QAAQ,UAAU,IAAI,aAAa,CAAC;CAYxD,MAAM,eACJ,oBAAC,sBAAD;EAAsB,QANrB,UACC,OAAO,OACL,MACF,EAAE,KAAK,MACT,CAAC;EAE+C;CAAS,CAAA;CAK3D,MAAM,aAAa,qBADF,mBAAmB,EAAE,YAAY,CACH,GAAG,WAAW,MAAM;CAGnE,MAAM,8BAAoE;EACxE,MAAM,WAAW;EACjB,OAAO,WAAW;EAClB,SAAS,WAAW;CACtB;CACA,MAAM,yBAA0D;EAC9D,MAAM,WAAW;EACjB,MAAM,WAAW;EACjB,OAAO,WAAW;EAClB,SAAS,WAAW;CACtB;CAEA,OACE,oBAACC,eAAD;EACO;EACL,cAAY;EACZ,YAAY;EACZ,OAAO,UAAU,SAAS,YAAY;EAGtC,gBAAc;EACd,eAAa;EACC;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,oBAAC,UAAD,EAAA,UAAS,MAAc,CAAA,IAAI;EACpC;EACE;EACE;EACV,aAAa,SAAS,eAAe;EAC9B;YAEN,SAAS,KAAK,WAAW;GACxB,MAAM,eAAe,QACnB,GAAG,OAAO,UAAU,QAAQ,UAAU,QAAQ,SAC9C,EAAE,aAAa,KAAK,CACtB;GAGA,MAAM,aAAa,CAAC,CAAC,OAAO;GAC5B,IAAI;GACJ,IAAI,mBAAmB;GACvB,IAAI,YAAY;IACd,eACE,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,QAAD;MAAM,WAAW,WAAW;gBAAc,OAAO;KAAY,CAAA,GAC7D,oBAAC,QAAD;MAAM,WAAW,WAAW;gBACzB,OAAO;KACJ,CAAA,CACH;;IAGP,mBAAmB;KAAE,GAAG;KAAkB,OAAO;IAAG;GACtD,OACE,eAAe,OAAO;GAGxB,OACE,oBAACC,UAAD;IAEE,YAAY;IACZ,gBAAc;IACd,eAAa;IACb,YAAY,CAAC,CAAC,YAAY,OAAO;IACjC,OAAO,QAAQ;IACf,cACE,OAAO,OAAO,UAAU,WAAW,OAAO,QAAQ,OAAO;cAG1D;GACW,GAXP,SAAS,OAAO,OAWT;EAElB,CAAC;CACgB,CAAA;AAEvB;;;ACtNA,IAAA,qBAAe"}
|
|
@@ -2,6 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_DatePicker = require("../DatePicker-
|
|
5
|
+
const require_DatePicker = require("../DatePicker-CYUuwwsm.cjs");
|
|
6
6
|
exports.DatePicker = require_DatePicker.DatePicker;
|
|
7
|
+
exports.datePickerVariants = require_DatePicker.datePickerVariants;
|
|
7
8
|
exports.default = require_DatePicker.DatePicker_default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DatePickerProps, t as DatePicker } from "../index-
|
|
2
|
-
export { DatePicker, DatePicker as default, type DatePickerProps };
|
|
1
|
+
import { n as DatePickerProps, r as datePickerVariants, t as DatePicker } from "../index-CD0Wpla3.cjs";
|
|
2
|
+
export { DatePicker, DatePicker as default, type DatePickerProps, datePickerVariants };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DatePickerProps, t as DatePicker } from "../index-
|
|
2
|
-
export { DatePicker, DatePicker as default, type DatePickerProps };
|
|
1
|
+
import { n as DatePickerProps, r as datePickerVariants, t as DatePicker } from "../index-D7AUghFx.js";
|
|
2
|
+
export { DatePicker, DatePicker as default, type DatePickerProps, datePickerVariants };
|
package/dist/DatePicker/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DatePicker, t as DatePicker_default } from "../DatePicker-
|
|
2
|
-
export { DatePicker, DatePicker_default as default };
|
|
1
|
+
import { n as DatePicker, r as datePickerVariants, t as DatePicker_default } from "../DatePicker-CGIWizz9.js";
|
|
2
|
+
export { DatePicker, datePickerVariants, DatePicker_default as default };
|
|
@@ -188,6 +188,6 @@ const DatePicker$1 = ({ className: _className = void 0, hourCycle = 24, hideTime
|
|
|
188
188
|
//#region src/DatePicker/index.ts
|
|
189
189
|
var DatePicker_default = DatePicker$1;
|
|
190
190
|
//#endregion
|
|
191
|
-
export { DatePicker$1 as n, DatePicker_default as t };
|
|
191
|
+
export { DatePicker$1 as n, datePickerVariants as r, DatePicker_default as t };
|
|
192
192
|
|
|
193
|
-
//# sourceMappingURL=DatePicker-
|
|
193
|
+
//# sourceMappingURL=DatePicker-CGIWizz9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker-BUSi8SWQ.js","names":["DatePicker","HeroDatePicker","DatePicker"],"sources":["../src/DatePicker/dateHelpers.ts","../src/DatePicker/DatePicker.tsx","../src/DatePicker/index.ts"],"sourcesContent":["import type { DatePicker as HeroDatePicker } from '@heroui/date-picker';\nimport type { ComponentProps } from 'react';\n\nimport {\n getLocalTimeZone,\n now,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseDate,\n parseDateTime,\n parseZonedDateTime,\n} from '@internationalized/date';\n\n/** Value type accepted by the HeroUI DatePicker */\nexport type DatePickerValue = ComponentProps<typeof HeroDatePicker>['value'];\n\n/** Cast unknown input to the DatePicker value union type. */\nconst asDatePickerValue = (value: unknown): DatePickerValue => {\n return value as DatePickerValue;\n};\n\n/** Check whether a value already looks like an @internationalized/date object. */\nconst isDateValueLike = (value: unknown): value is object => {\n return !!value && typeof value === 'object' && 'calendar' in value;\n};\n\n/** True for ISO datetime strings that do not yet include timezone information. */\nconst isNaiveDateTimeString = (value: string): boolean => {\n return /^\\d{4}-\\d{2}-\\d{2}T/.test(value) && !hasExplicitTimeZone(value);\n};\n\n/** True when an input already carries timezone/offset information. */\nconst hasExplicitTimeZone = (value: string): boolean => {\n if (value.includes('[') && value.includes(']')) {\n return true;\n }\n\n return /(?:[zZ]|[+-]\\d{2}:\\d{2})$/.test(value);\n};\n\n/** Safely run a parser and return `null` on parsing errors. */\nconst tryParse = (parser: () => unknown): DatePickerValue => {\n try {\n return asDatePickerValue(parser());\n } catch {\n return null;\n }\n};\n\n/**\n * Parse a form value into a HeroUI DatePicker compatible `DateValue`.\n *\n * Accepts existing `DateValue` objects, native `Date` instances, and ISO-like\n * strings (date, date-time, zoned, and absolute). Returns `null` when the value\n * is empty or cannot be parsed.\n */\nexport const parseDateValue = (\n value: unknown,\n timeZone?: string,\n): DatePickerValue => {\n if (value == null || value === '') {\n return null;\n }\n\n if (isDateValueLike(value)) {\n return asDatePickerValue(value);\n }\n\n if (value instanceof Date) {\n return asDatePickerValue(\n timeZone\n ? parseAbsolute(value.toISOString(), timeZone)\n : parseAbsoluteToLocal(value.toISOString()),\n );\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n const normalizedValue = value.trim();\n if (normalizedValue === '') {\n return null;\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(normalizedValue)) {\n return tryParse(() => {\n return parseDate(normalizedValue);\n });\n }\n\n const parsers: (() => unknown)[] = [\n ...(timeZone && isNaiveDateTimeString(normalizedValue)\n ? [\n () => {\n return parseZonedDateTime(`${normalizedValue}[${timeZone}]`);\n },\n ]\n : []),\n () => {\n return timeZone\n ? parseAbsolute(normalizedValue, timeZone)\n : parseAbsoluteToLocal(normalizedValue);\n },\n () => {\n return parseZonedDateTime(normalizedValue);\n },\n () => {\n return parseDateTime(normalizedValue);\n },\n () => {\n return parseDate(normalizedValue);\n },\n ];\n\n return (\n parsers\n .map((parser) => {\n return tryParse(parser);\n })\n .find((parsedValue) => {\n return parsedValue != null;\n }) ?? null\n );\n};\n\n/** Resolve the timezone used by the DatePicker when time fields are enabled. */\nexport const resolveDatePickerTimeZone = (\n withTime: boolean,\n timeZone?: string,\n): string | undefined => {\n if (!withTime) {\n return timeZone;\n }\n\n return timeZone ?? getLocalTimeZone();\n};\n\n/** Build the default placeholder value for time-enabled pickers. */\nexport const getDatePickerPlaceholderValue = (\n withTime: boolean,\n timeZone?: string,\n): DatePickerValue => {\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n if (!resolvedTimeZone || !withTime) {\n return undefined;\n }\n\n return asDatePickerValue(now(resolvedTimeZone));\n};\n\n/**\n * Convert a date value into a UTC ISO string.\n *\n * `CalendarDate` and `CalendarDateTime` values are interpreted in the provided\n * timezone. `ZonedDateTime` values use their own timezone and offset.\n */\nexport const dateValueToUtcIsoString = (\n value: DatePickerValue,\n timeZone: string,\n): string | null => {\n if (value == null) {\n return null;\n }\n\n const maybeWithAbsoluteString = value as { toAbsoluteString?: () => string };\n if (typeof maybeWithAbsoluteString.toAbsoluteString === 'function') {\n return maybeWithAbsoluteString.toAbsoluteString();\n }\n\n const maybeWithToDate = value as { toDate?: (zone: string) => Date };\n if (typeof maybeWithToDate.toDate === 'function') {\n return maybeWithToDate.toDate(timeZone).toISOString();\n }\n\n return null;\n};\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { DatePickerProps as HeroDatePickerProps } from '@heroui/date-picker';\nimport type { ReactNode } from 'react';\nimport type { DatePickerValue } from './dateHelpers';\n\nimport { DatePicker as HeroDatePicker } from '@heroui/date-picker';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport {\n dateValueToUtcIsoString,\n getDatePickerPlaceholderValue,\n parseDateValue,\n resolveDatePickerTimeZone,\n} from './dateHelpers';\n\nexport const datePickerVariants = tv({\n slots: {\n /** wrapper around the whole date picker */\n base: '',\n /** helper wrapper for error/description */\n helperWrapper: [\n // set padding to 0 for error message exit animation\n 'p-0',\n ],\n /** the calendar element */\n calendar: '',\n /** the calendar's content element */\n calendarContent: '',\n /**\n * inner wrapper (HeroUI inputWrapper slot)\n *\n * NOTE: Unlike HeroUI Input, the DatePicker does not expose a\n * `data-focus` indicator on the group, so the focus border has to be\n * driven by the native `focus-within` state of the segment inputs.\n */\n inputWrapper: 'bg-content1 focus-within:border-focus',\n /** the calendar popover element */\n popoverContent: '',\n /** selector button element */\n selectorButton: '',\n /** selector icon element */\n selectorIcon: '',\n /** the time-input component element */\n timeInput: '',\n /** the time-input component's label element */\n timeInputLabel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof datePickerVariants>;\ntype ClassName = TVClassName<typeof datePickerVariants>;\n\nexport interface DatePickerProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** date picker is disabled */\n disabled?: boolean;\n /**\n * Optional hour cycle override.\n *\n * When omitted, the picker uses the user's locale default (12-hour or 24-hour).\n */\n hourCycle?: 12 | 24;\n /** hide timezone abbreviation for zoned values */\n hideTimeZone?: boolean;\n /** form field label */\n label?: ReactNode;\n /** latest selectable value as ISO string */\n maxValue?: string;\n /** earliest selectable value as ISO string */\n minValue?: string;\n /** form field name */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /**\n * Optional advanced override for the display/interpretation timezone.\n *\n * When omitted, the picker uses the current user's local timezone while\n * `withTime` is enabled.\n */\n timeZone?: string;\n /**\n * Enables date-time mode.\n *\n * - `false` (default): date-only input (`day` granularity)\n * - `true`: includes time segments (`minute` granularity)\n */\n withTime?: boolean;\n /** value format stored in form state (`string` stores UTC ISO values) */\n valueType?: 'dateValue' | 'string';\n}\n\n/**\n * DatePicker component based on [HeroUI DatePicker](https://v2.heroui.com/docs/components/date-picker)\n */\nconst DatePicker = ({\n className: _className = undefined,\n hourCycle = 24,\n hideTimeZone = false,\n maxValue = undefined,\n minValue = undefined,\n name,\n timeZone = undefined,\n valueType = 'string',\n withTime = false,\n ...uniformFieldProps\n}: DatePickerProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // classNames from slots\n const variants = datePickerVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n\n // Normalize incoming form value into HeroUI's DateValue shape so the field can\n // render consistently from UTC strings, local strings, Date instances, or DateValue objects.\n const parsedValue = parseDateValue(\n value,\n withTime ? resolvedTimeZone : timeZone,\n );\n\n // Build the default placeholder value for time-enabled pickers.\n const placeholderValue = getDatePickerPlaceholderValue(withTime, timeZone);\n\n // Parse ISO boundary strings into HeroUI DateValue objects.\n const parsedMinValue = parseDateValue(\n minValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['minValue'];\n const parsedMaxValue = parseDateValue(\n maxValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['maxValue'];\n\n // Normalize DatePicker output into the configured storage format before writing to form state.\n const handleChange = (nextValue: DatePickerValue) => {\n if (nextValue == null) {\n onChange(null);\n return;\n }\n\n if (valueType === 'dateValue') {\n onChange(nextValue);\n return;\n }\n\n // String mode always stores UTC ISO values so form state is timezone-neutral\n // and comparable across users/locales.\n onChange(\n dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? 'UTC') ??\n String(nextValue),\n );\n };\n\n return (\n <HeroDatePicker\n aria-label={label ? undefined : ariaLabel}\n classNames={{\n base: classNames.base,\n calendar: classNames.calendar,\n calendarContent: classNames.calendarContent,\n helperWrapper: classNames.helperWrapper,\n inputWrapper: classNames.inputWrapper,\n popoverContent: classNames.popoverContent,\n selectorButton: classNames.selectorButton,\n selectorIcon: classNames.selectorIcon,\n timeInput: classNames.timeInput,\n timeInputLabel: classNames.timeInputLabel,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n granularity={withTime ? 'minute' : 'day'}\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n maxValue={parsedMaxValue}\n minValue={parsedMinValue}\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholderValue={placeholderValue}\n radius=\"sm\"\n value={parsedValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default DatePicker;\n","import DatePicker from './DatePicker';\n\nexport type { DatePickerProps } from './DatePicker';\n\nexport { DatePicker };\n\nexport default DatePicker;\n"],"mappings":";;;;;;;AAiBA,MAAM,qBAAqB,UAAoC;CAC7D,OAAO;AACT;;AAGA,MAAM,mBAAmB,UAAoC;CAC3D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,cAAc;AAC/D;;AAGA,MAAM,yBAAyB,UAA2B;CACxD,OAAO,sBAAsB,KAAK,KAAK,KAAK,CAAC,oBAAoB,KAAK;AACxE;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,IAAI,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,GAAG,GAC3C,OAAO;CAGT,OAAO,4BAA4B,KAAK,KAAK;AAC/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AoB,KAAK,KAC1D,OAAO,SAAS,CACpB;CACF;CAEA,OACE,oBAACC,YAAD;EACE,cAAY,QAAQ,KAAA,IAAY;EAChC,YAAY;GACV,MAAM,WAAW;GACjB,UAAU,WAAW;GACrB,iBAAiB,WAAW;GAC5B,eAAe,WAAW;GAC1B,cAAc,WAAW;GACzB,gBAAgB,WAAW;GAC3B,gBAAgB,WAAW;GAC3B,cAAc,WAAW;GACzB,WAAW,WAAW;GACtB,gBAAgB,WAAW;EAC7B;EACA,eAAa;EACC;EACd,aAAa,WAAW,WAAW;EACrB;EACH;EACX,IAAI;EACJ,YAAY;EACZ,WAAW;EACX,YAAY;EACL;EACP,gBAAe;EACf,UAAU;EACV,UAAU;EACJ;EACE;EACR,UAAU;EACQ;EAClB,QAAO;EACP,OAAO;EACP,SAAQ;CACT,CAAA;AAEL;;;ACvMA,IAAA,qBAAeC"}
|
|
1
|
+
{"version":3,"file":"DatePicker-CGIWizz9.js","names":["DatePicker","HeroDatePicker","DatePicker"],"sources":["../src/DatePicker/dateHelpers.ts","../src/DatePicker/DatePicker.tsx","../src/DatePicker/index.ts"],"sourcesContent":["import type { DatePicker as HeroDatePicker } from '@heroui/date-picker';\nimport type { ComponentProps } from 'react';\n\nimport {\n getLocalTimeZone,\n now,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseDate,\n parseDateTime,\n parseZonedDateTime,\n} from '@internationalized/date';\n\n/** Value type accepted by the HeroUI DatePicker */\nexport type DatePickerValue = ComponentProps<typeof HeroDatePicker>['value'];\n\n/** Cast unknown input to the DatePicker value union type. */\nconst asDatePickerValue = (value: unknown): DatePickerValue => {\n return value as DatePickerValue;\n};\n\n/** Check whether a value already looks like an @internationalized/date object. */\nconst isDateValueLike = (value: unknown): value is object => {\n return !!value && typeof value === 'object' && 'calendar' in value;\n};\n\n/** True for ISO datetime strings that do not yet include timezone information. */\nconst isNaiveDateTimeString = (value: string): boolean => {\n return /^\\d{4}-\\d{2}-\\d{2}T/.test(value) && !hasExplicitTimeZone(value);\n};\n\n/** True when an input already carries timezone/offset information. */\nconst hasExplicitTimeZone = (value: string): boolean => {\n if (value.includes('[') && value.includes(']')) {\n return true;\n }\n\n return /(?:[zZ]|[+-]\\d{2}:\\d{2})$/.test(value);\n};\n\n/** Safely run a parser and return `null` on parsing errors. */\nconst tryParse = (parser: () => unknown): DatePickerValue => {\n try {\n return asDatePickerValue(parser());\n } catch {\n return null;\n }\n};\n\n/**\n * Parse a form value into a HeroUI DatePicker compatible `DateValue`.\n *\n * Accepts existing `DateValue` objects, native `Date` instances, and ISO-like\n * strings (date, date-time, zoned, and absolute). Returns `null` when the value\n * is empty or cannot be parsed.\n */\nexport const parseDateValue = (\n value: unknown,\n timeZone?: string,\n): DatePickerValue => {\n if (value == null || value === '') {\n return null;\n }\n\n if (isDateValueLike(value)) {\n return asDatePickerValue(value);\n }\n\n if (value instanceof Date) {\n return asDatePickerValue(\n timeZone\n ? parseAbsolute(value.toISOString(), timeZone)\n : parseAbsoluteToLocal(value.toISOString()),\n );\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n const normalizedValue = value.trim();\n if (normalizedValue === '') {\n return null;\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(normalizedValue)) {\n return tryParse(() => {\n return parseDate(normalizedValue);\n });\n }\n\n const parsers: (() => unknown)[] = [\n ...(timeZone && isNaiveDateTimeString(normalizedValue)\n ? [\n () => {\n return parseZonedDateTime(`${normalizedValue}[${timeZone}]`);\n },\n ]\n : []),\n () => {\n return timeZone\n ? parseAbsolute(normalizedValue, timeZone)\n : parseAbsoluteToLocal(normalizedValue);\n },\n () => {\n return parseZonedDateTime(normalizedValue);\n },\n () => {\n return parseDateTime(normalizedValue);\n },\n () => {\n return parseDate(normalizedValue);\n },\n ];\n\n return (\n parsers\n .map((parser) => {\n return tryParse(parser);\n })\n .find((parsedValue) => {\n return parsedValue != null;\n }) ?? null\n );\n};\n\n/** Resolve the timezone used by the DatePicker when time fields are enabled. */\nexport const resolveDatePickerTimeZone = (\n withTime: boolean,\n timeZone?: string,\n): string | undefined => {\n if (!withTime) {\n return timeZone;\n }\n\n return timeZone ?? getLocalTimeZone();\n};\n\n/** Build the default placeholder value for time-enabled pickers. */\nexport const getDatePickerPlaceholderValue = (\n withTime: boolean,\n timeZone?: string,\n): DatePickerValue => {\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n if (!resolvedTimeZone || !withTime) {\n return undefined;\n }\n\n return asDatePickerValue(now(resolvedTimeZone));\n};\n\n/**\n * Convert a date value into a UTC ISO string.\n *\n * `CalendarDate` and `CalendarDateTime` values are interpreted in the provided\n * timezone. `ZonedDateTime` values use their own timezone and offset.\n */\nexport const dateValueToUtcIsoString = (\n value: DatePickerValue,\n timeZone: string,\n): string | null => {\n if (value == null) {\n return null;\n }\n\n const maybeWithAbsoluteString = value as { toAbsoluteString?: () => string };\n if (typeof maybeWithAbsoluteString.toAbsoluteString === 'function') {\n return maybeWithAbsoluteString.toAbsoluteString();\n }\n\n const maybeWithToDate = value as { toDate?: (zone: string) => Date };\n if (typeof maybeWithToDate.toDate === 'function') {\n return maybeWithToDate.toDate(timeZone).toISOString();\n }\n\n return null;\n};\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { DatePickerProps as HeroDatePickerProps } from '@heroui/date-picker';\nimport type { ReactNode } from 'react';\nimport type { DatePickerValue } from './dateHelpers';\n\nimport { DatePicker as HeroDatePicker } from '@heroui/date-picker';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport {\n dateValueToUtcIsoString,\n getDatePickerPlaceholderValue,\n parseDateValue,\n resolveDatePickerTimeZone,\n} from './dateHelpers';\n\nexport const datePickerVariants = tv({\n slots: {\n /** wrapper around the whole date picker */\n base: '',\n /** helper wrapper for error/description */\n helperWrapper: [\n // set padding to 0 for error message exit animation\n 'p-0',\n ],\n /** the calendar element */\n calendar: '',\n /** the calendar's content element */\n calendarContent: '',\n /**\n * inner wrapper (HeroUI inputWrapper slot)\n *\n * NOTE: Unlike HeroUI Input, the DatePicker does not expose a\n * `data-focus` indicator on the group, so the focus border has to be\n * driven by the native `focus-within` state of the segment inputs.\n */\n inputWrapper: 'bg-content1 focus-within:border-focus',\n /** the calendar popover element */\n popoverContent: '',\n /** selector button element */\n selectorButton: '',\n /** selector icon element */\n selectorIcon: '',\n /** the time-input component element */\n timeInput: '',\n /** the time-input component's label element */\n timeInputLabel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof datePickerVariants>;\ntype ClassName = TVClassName<typeof datePickerVariants>;\n\nexport interface DatePickerProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** date picker is disabled */\n disabled?: boolean;\n /**\n * Optional hour cycle override.\n *\n * When omitted, the picker uses the user's locale default (12-hour or 24-hour).\n */\n hourCycle?: 12 | 24;\n /** hide timezone abbreviation for zoned values */\n hideTimeZone?: boolean;\n /** form field label */\n label?: ReactNode;\n /** latest selectable value as ISO string */\n maxValue?: string;\n /** earliest selectable value as ISO string */\n minValue?: string;\n /** form field name */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /**\n * Optional advanced override for the display/interpretation timezone.\n *\n * When omitted, the picker uses the current user's local timezone while\n * `withTime` is enabled.\n */\n timeZone?: string;\n /**\n * Enables date-time mode.\n *\n * - `false` (default): date-only input (`day` granularity)\n * - `true`: includes time segments (`minute` granularity)\n */\n withTime?: boolean;\n /** value format stored in form state (`string` stores UTC ISO values) */\n valueType?: 'dateValue' | 'string';\n}\n\n/**\n * DatePicker component based on [HeroUI DatePicker](https://v2.heroui.com/docs/components/date-picker)\n */\nconst DatePicker = ({\n className: _className = undefined,\n hourCycle = 24,\n hideTimeZone = false,\n maxValue = undefined,\n minValue = undefined,\n name,\n timeZone = undefined,\n valueType = 'string',\n withTime = false,\n ...uniformFieldProps\n}: DatePickerProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // classNames from slots\n const variants = datePickerVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n\n // Normalize incoming form value into HeroUI's DateValue shape so the field can\n // render consistently from UTC strings, local strings, Date instances, or DateValue objects.\n const parsedValue = parseDateValue(\n value,\n withTime ? resolvedTimeZone : timeZone,\n );\n\n // Build the default placeholder value for time-enabled pickers.\n const placeholderValue = getDatePickerPlaceholderValue(withTime, timeZone);\n\n // Parse ISO boundary strings into HeroUI DateValue objects.\n const parsedMinValue = parseDateValue(\n minValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['minValue'];\n const parsedMaxValue = parseDateValue(\n maxValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['maxValue'];\n\n // Normalize DatePicker output into the configured storage format before writing to form state.\n const handleChange = (nextValue: DatePickerValue) => {\n if (nextValue == null) {\n onChange(null);\n return;\n }\n\n if (valueType === 'dateValue') {\n onChange(nextValue);\n return;\n }\n\n // String mode always stores UTC ISO values so form state is timezone-neutral\n // and comparable across users/locales.\n onChange(\n dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? 'UTC') ??\n String(nextValue),\n );\n };\n\n return (\n <HeroDatePicker\n aria-label={label ? undefined : ariaLabel}\n classNames={{\n base: classNames.base,\n calendar: classNames.calendar,\n calendarContent: classNames.calendarContent,\n helperWrapper: classNames.helperWrapper,\n inputWrapper: classNames.inputWrapper,\n popoverContent: classNames.popoverContent,\n selectorButton: classNames.selectorButton,\n selectorIcon: classNames.selectorIcon,\n timeInput: classNames.timeInput,\n timeInputLabel: classNames.timeInputLabel,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n granularity={withTime ? 'minute' : 'day'}\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n maxValue={parsedMaxValue}\n minValue={parsedMinValue}\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholderValue={placeholderValue}\n radius=\"sm\"\n value={parsedValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default DatePicker;\n","import DatePicker from './DatePicker';\n\nexport type { DatePickerProps } from './DatePicker';\n\nexport { datePickerVariants } from './DatePicker';\n\nexport { DatePicker };\n\nexport default DatePicker;\n"],"mappings":";;;;;;;AAiBA,MAAM,qBAAqB,UAAoC;CAC7D,OAAO;AACT;;AAGA,MAAM,mBAAmB,UAAoC;CAC3D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,cAAc;AAC/D;;AAGA,MAAM,yBAAyB,UAA2B;CACxD,OAAO,sBAAsB,KAAK,KAAK,KAAK,CAAC,oBAAoB,KAAK;AACxE;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,IAAI,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,GAAG,GAC3C,OAAO;CAGT,OAAO,4BAA4B,KAAK,KAAK;AAC/C;;AAGA,MAAM,YAAY,WAA2C;CAC3D,IAAI;EACF,OAAO,kBAAkB,OAAO,CAAC;CACnC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;AASA,MAAa,kBACX,OACA,aACoB;CACpB,IAAI,SAAS,QAAQ,UAAU,IAC7B,OAAO;CAGT,IAAI,gBAAgB,KAAK,GACvB,OAAO,kBAAkB,KAAK;CAGhC,IAAI,iBAAiB,MACnB,OAAO,kBACL,WACI,cAAc,MAAM,YAAY,GAAG,QAAQ,IAC3C,qBAAqB,MAAM,YAAY,CAAC,CAC9C;CAGF,IAAI,OAAO,UAAU,UACnB,OAAO;CAGT,MAAM,kBAAkB,MAAM,KAAK;CACnC,IAAI,oBAAoB,IACtB,OAAO;CAGT,IAAI,sBAAsB,KAAK,eA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AAO;EACP,SAAQ;CACT,CAAA;AAEL;;;ACrMA,IAAA,qBAAeC"}
|
|
@@ -201,5 +201,11 @@ Object.defineProperty(exports, "DatePicker_default", {
|
|
|
201
201
|
return DatePicker_default;
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
+
Object.defineProperty(exports, "datePickerVariants", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function() {
|
|
207
|
+
return datePickerVariants;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
204
210
|
|
|
205
|
-
//# sourceMappingURL=DatePicker-
|
|
211
|
+
//# sourceMappingURL=DatePicker-CYUuwwsm.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker-DuBjvS5g.cjs","names":["useUniformField","HeroDatePicker"],"sources":["../src/DatePicker/dateHelpers.ts","../src/DatePicker/DatePicker.tsx","../src/DatePicker/index.ts"],"sourcesContent":["import type { DatePicker as HeroDatePicker } from '@heroui/date-picker';\nimport type { ComponentProps } from 'react';\n\nimport {\n getLocalTimeZone,\n now,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseDate,\n parseDateTime,\n parseZonedDateTime,\n} from '@internationalized/date';\n\n/** Value type accepted by the HeroUI DatePicker */\nexport type DatePickerValue = ComponentProps<typeof HeroDatePicker>['value'];\n\n/** Cast unknown input to the DatePicker value union type. */\nconst asDatePickerValue = (value: unknown): DatePickerValue => {\n return value as DatePickerValue;\n};\n\n/** Check whether a value already looks like an @internationalized/date object. */\nconst isDateValueLike = (value: unknown): value is object => {\n return !!value && typeof value === 'object' && 'calendar' in value;\n};\n\n/** True for ISO datetime strings that do not yet include timezone information. */\nconst isNaiveDateTimeString = (value: string): boolean => {\n return /^\\d{4}-\\d{2}-\\d{2}T/.test(value) && !hasExplicitTimeZone(value);\n};\n\n/** True when an input already carries timezone/offset information. */\nconst hasExplicitTimeZone = (value: string): boolean => {\n if (value.includes('[') && value.includes(']')) {\n return true;\n }\n\n return /(?:[zZ]|[+-]\\d{2}:\\d{2})$/.test(value);\n};\n\n/** Safely run a parser and return `null` on parsing errors. */\nconst tryParse = (parser: () => unknown): DatePickerValue => {\n try {\n return asDatePickerValue(parser());\n } catch {\n return null;\n }\n};\n\n/**\n * Parse a form value into a HeroUI DatePicker compatible `DateValue`.\n *\n * Accepts existing `DateValue` objects, native `Date` instances, and ISO-like\n * strings (date, date-time, zoned, and absolute). Returns `null` when the value\n * is empty or cannot be parsed.\n */\nexport const parseDateValue = (\n value: unknown,\n timeZone?: string,\n): DatePickerValue => {\n if (value == null || value === '') {\n return null;\n }\n\n if (isDateValueLike(value)) {\n return asDatePickerValue(value);\n }\n\n if (value instanceof Date) {\n return asDatePickerValue(\n timeZone\n ? parseAbsolute(value.toISOString(), timeZone)\n : parseAbsoluteToLocal(value.toISOString()),\n );\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n const normalizedValue = value.trim();\n if (normalizedValue === '') {\n return null;\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(normalizedValue)) {\n return tryParse(() => {\n return parseDate(normalizedValue);\n });\n }\n\n const parsers: (() => unknown)[] = [\n ...(timeZone && isNaiveDateTimeString(normalizedValue)\n ? [\n () => {\n return parseZonedDateTime(`${normalizedValue}[${timeZone}]`);\n },\n ]\n : []),\n () => {\n return timeZone\n ? parseAbsolute(normalizedValue, timeZone)\n : parseAbsoluteToLocal(normalizedValue);\n },\n () => {\n return parseZonedDateTime(normalizedValue);\n },\n () => {\n return parseDateTime(normalizedValue);\n },\n () => {\n return parseDate(normalizedValue);\n },\n ];\n\n return (\n parsers\n .map((parser) => {\n return tryParse(parser);\n })\n .find((parsedValue) => {\n return parsedValue != null;\n }) ?? null\n );\n};\n\n/** Resolve the timezone used by the DatePicker when time fields are enabled. */\nexport const resolveDatePickerTimeZone = (\n withTime: boolean,\n timeZone?: string,\n): string | undefined => {\n if (!withTime) {\n return timeZone;\n }\n\n return timeZone ?? getLocalTimeZone();\n};\n\n/** Build the default placeholder value for time-enabled pickers. */\nexport const getDatePickerPlaceholderValue = (\n withTime: boolean,\n timeZone?: string,\n): DatePickerValue => {\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n if (!resolvedTimeZone || !withTime) {\n return undefined;\n }\n\n return asDatePickerValue(now(resolvedTimeZone));\n};\n\n/**\n * Convert a date value into a UTC ISO string.\n *\n * `CalendarDate` and `CalendarDateTime` values are interpreted in the provided\n * timezone. `ZonedDateTime` values use their own timezone and offset.\n */\nexport const dateValueToUtcIsoString = (\n value: DatePickerValue,\n timeZone: string,\n): string | null => {\n if (value == null) {\n return null;\n }\n\n const maybeWithAbsoluteString = value as { toAbsoluteString?: () => string };\n if (typeof maybeWithAbsoluteString.toAbsoluteString === 'function') {\n return maybeWithAbsoluteString.toAbsoluteString();\n }\n\n const maybeWithToDate = value as { toDate?: (zone: string) => Date };\n if (typeof maybeWithToDate.toDate === 'function') {\n return maybeWithToDate.toDate(timeZone).toISOString();\n }\n\n return null;\n};\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { DatePickerProps as HeroDatePickerProps } from '@heroui/date-picker';\nimport type { ReactNode } from 'react';\nimport type { DatePickerValue } from './dateHelpers';\n\nimport { DatePicker as HeroDatePicker } from '@heroui/date-picker';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport {\n dateValueToUtcIsoString,\n getDatePickerPlaceholderValue,\n parseDateValue,\n resolveDatePickerTimeZone,\n} from './dateHelpers';\n\nexport const datePickerVariants = tv({\n slots: {\n /** wrapper around the whole date picker */\n base: '',\n /** helper wrapper for error/description */\n helperWrapper: [\n // set padding to 0 for error message exit animation\n 'p-0',\n ],\n /** the calendar element */\n calendar: '',\n /** the calendar's content element */\n calendarContent: '',\n /**\n * inner wrapper (HeroUI inputWrapper slot)\n *\n * NOTE: Unlike HeroUI Input, the DatePicker does not expose a\n * `data-focus` indicator on the group, so the focus border has to be\n * driven by the native `focus-within` state of the segment inputs.\n */\n inputWrapper: 'bg-content1 focus-within:border-focus',\n /** the calendar popover element */\n popoverContent: '',\n /** selector button element */\n selectorButton: '',\n /** selector icon element */\n selectorIcon: '',\n /** the time-input component element */\n timeInput: '',\n /** the time-input component's label element */\n timeInputLabel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof datePickerVariants>;\ntype ClassName = TVClassName<typeof datePickerVariants>;\n\nexport interface DatePickerProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** date picker is disabled */\n disabled?: boolean;\n /**\n * Optional hour cycle override.\n *\n * When omitted, the picker uses the user's locale default (12-hour or 24-hour).\n */\n hourCycle?: 12 | 24;\n /** hide timezone abbreviation for zoned values */\n hideTimeZone?: boolean;\n /** form field label */\n label?: ReactNode;\n /** latest selectable value as ISO string */\n maxValue?: string;\n /** earliest selectable value as ISO string */\n minValue?: string;\n /** form field name */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /**\n * Optional advanced override for the display/interpretation timezone.\n *\n * When omitted, the picker uses the current user's local timezone while\n * `withTime` is enabled.\n */\n timeZone?: string;\n /**\n * Enables date-time mode.\n *\n * - `false` (default): date-only input (`day` granularity)\n * - `true`: includes time segments (`minute` granularity)\n */\n withTime?: boolean;\n /** value format stored in form state (`string` stores UTC ISO values) */\n valueType?: 'dateValue' | 'string';\n}\n\n/**\n * DatePicker component based on [HeroUI DatePicker](https://v2.heroui.com/docs/components/date-picker)\n */\nconst DatePicker = ({\n className: _className = undefined,\n hourCycle = 24,\n hideTimeZone = false,\n maxValue = undefined,\n minValue = undefined,\n name,\n timeZone = undefined,\n valueType = 'string',\n withTime = false,\n ...uniformFieldProps\n}: DatePickerProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // classNames from slots\n const variants = datePickerVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n\n // Normalize incoming form value into HeroUI's DateValue shape so the field can\n // render consistently from UTC strings, local strings, Date instances, or DateValue objects.\n const parsedValue = parseDateValue(\n value,\n withTime ? resolvedTimeZone : timeZone,\n );\n\n // Build the default placeholder value for time-enabled pickers.\n const placeholderValue = getDatePickerPlaceholderValue(withTime, timeZone);\n\n // Parse ISO boundary strings into HeroUI DateValue objects.\n const parsedMinValue = parseDateValue(\n minValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['minValue'];\n const parsedMaxValue = parseDateValue(\n maxValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['maxValue'];\n\n // Normalize DatePicker output into the configured storage format before writing to form state.\n const handleChange = (nextValue: DatePickerValue) => {\n if (nextValue == null) {\n onChange(null);\n return;\n }\n\n if (valueType === 'dateValue') {\n onChange(nextValue);\n return;\n }\n\n // String mode always stores UTC ISO values so form state is timezone-neutral\n // and comparable across users/locales.\n onChange(\n dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? 'UTC') ??\n String(nextValue),\n );\n };\n\n return (\n <HeroDatePicker\n aria-label={label ? undefined : ariaLabel}\n classNames={{\n base: classNames.base,\n calendar: classNames.calendar,\n calendarContent: classNames.calendarContent,\n helperWrapper: classNames.helperWrapper,\n inputWrapper: classNames.inputWrapper,\n popoverContent: classNames.popoverContent,\n selectorButton: classNames.selectorButton,\n selectorIcon: classNames.selectorIcon,\n timeInput: classNames.timeInput,\n timeInputLabel: classNames.timeInputLabel,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n granularity={withTime ? 'minute' : 'day'}\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n maxValue={parsedMaxValue}\n minValue={parsedMinValue}\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholderValue={placeholderValue}\n radius=\"sm\"\n value={parsedValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default DatePicker;\n","import DatePicker from './DatePicker';\n\nexport type { DatePickerProps } from './DatePicker';\n\nexport { DatePicker };\n\nexport default DatePicker;\n"],"mappings":";;;;;;;;AAiBA,MAAM,qBAAqB,UAAoC;CAC7D,OAAO;AACT;;AAGA,MAAM,mBAAmB,UAAoC;CAC3D,OAAO,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,cAAc;AAC/D;;AAGA,MAAM,yBAAyB,UAA2B;CACxD,OAAO,sBAAsB,KAAK,KAAK,KAAK,CAAC,oBAAoB,KAAK;AACxE;;AAGA,MAAM,uBAAuB,UAA2B;CACtD,IAAI,MAAM,SAAS,GAAG,KAAK,MAAM,SAAS,GAAG,GAC3C,OAAO;CAGT,OAAO,4BAA4B,KAAK,KAAK;AAC/C;;AAGA,MAAM,YAAY,WAA2C;CAC3D,IAAI;EACF,OAAO,kBAAkB,OAAO,CAAC;CACnC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;AASA,MAAa,kBACX,OACA,aACoB;CACpB,IAAI,SAAS,QAAQ,UAAU,IAC7B,OAAO;CAGT,IAAI,gBAAgB,KAAK,GACvB,OAAO,kBAAkB,KAAK;CAGhC,IAAI,iBAAiB,MACnB,OAAO,kBACL,YAAA,GAAA,wBAAA,eACkB,MAAM,YAAY,GAAG,QAAQ,KAAA,GAAA,wBAAA,sBACtB,MAAM,YAAY,CAAC,CAC9C;CAGF,IAAI,OAAO,UAAU,UACnB,OAAO;CAGT,MAAM,kBAAkB,MAAM,KAAK;CACnC,IAAI,oBAAoB,IACtB,OAAO;CAGT,IAAI,sBAAsB,KAAK,eAAe,GAC5C,OAAO,eAAe;EACpB,QAAA,GAAA,wBAAA,WAAiB,eAAe;CAClC,CAAC;CA2BH,OACE;EAxBA,GAAI,YAAY,sBAAsB,eAAe,IACjD,OACQ;GAC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AU;EACJ;EACE;EACR,UAAU;EACQ;EAClB,QAAO;EACP,OAAO;EACP,SAAQ;CACT,CAAA;AAEL;;;ACvMA,IAAA,qBAAe"}
|
|
1
|
+
{"version":3,"file":"DatePicker-CYUuwwsm.cjs","names":["useUniformField","HeroDatePicker"],"sources":["../src/DatePicker/dateHelpers.ts","../src/DatePicker/DatePicker.tsx","../src/DatePicker/index.ts"],"sourcesContent":["import type { DatePicker as HeroDatePicker } from '@heroui/date-picker';\nimport type { ComponentProps } from 'react';\n\nimport {\n getLocalTimeZone,\n now,\n parseAbsolute,\n parseAbsoluteToLocal,\n parseDate,\n parseDateTime,\n parseZonedDateTime,\n} from '@internationalized/date';\n\n/** Value type accepted by the HeroUI DatePicker */\nexport type DatePickerValue = ComponentProps<typeof HeroDatePicker>['value'];\n\n/** Cast unknown input to the DatePicker value union type. */\nconst asDatePickerValue = (value: unknown): DatePickerValue => {\n return value as DatePickerValue;\n};\n\n/** Check whether a value already looks like an @internationalized/date object. */\nconst isDateValueLike = (value: unknown): value is object => {\n return !!value && typeof value === 'object' && 'calendar' in value;\n};\n\n/** True for ISO datetime strings that do not yet include timezone information. */\nconst isNaiveDateTimeString = (value: string): boolean => {\n return /^\\d{4}-\\d{2}-\\d{2}T/.test(value) && !hasExplicitTimeZone(value);\n};\n\n/** True when an input already carries timezone/offset information. */\nconst hasExplicitTimeZone = (value: string): boolean => {\n if (value.includes('[') && value.includes(']')) {\n return true;\n }\n\n return /(?:[zZ]|[+-]\\d{2}:\\d{2})$/.test(value);\n};\n\n/** Safely run a parser and return `null` on parsing errors. */\nconst tryParse = (parser: () => unknown): DatePickerValue => {\n try {\n return asDatePickerValue(parser());\n } catch {\n return null;\n }\n};\n\n/**\n * Parse a form value into a HeroUI DatePicker compatible `DateValue`.\n *\n * Accepts existing `DateValue` objects, native `Date` instances, and ISO-like\n * strings (date, date-time, zoned, and absolute). Returns `null` when the value\n * is empty or cannot be parsed.\n */\nexport const parseDateValue = (\n value: unknown,\n timeZone?: string,\n): DatePickerValue => {\n if (value == null || value === '') {\n return null;\n }\n\n if (isDateValueLike(value)) {\n return asDatePickerValue(value);\n }\n\n if (value instanceof Date) {\n return asDatePickerValue(\n timeZone\n ? parseAbsolute(value.toISOString(), timeZone)\n : parseAbsoluteToLocal(value.toISOString()),\n );\n }\n\n if (typeof value !== 'string') {\n return null;\n }\n\n const normalizedValue = value.trim();\n if (normalizedValue === '') {\n return null;\n }\n\n if (/^\\d{4}-\\d{2}-\\d{2}$/.test(normalizedValue)) {\n return tryParse(() => {\n return parseDate(normalizedValue);\n });\n }\n\n const parsers: (() => unknown)[] = [\n ...(timeZone && isNaiveDateTimeString(normalizedValue)\n ? [\n () => {\n return parseZonedDateTime(`${normalizedValue}[${timeZone}]`);\n },\n ]\n : []),\n () => {\n return timeZone\n ? parseAbsolute(normalizedValue, timeZone)\n : parseAbsoluteToLocal(normalizedValue);\n },\n () => {\n return parseZonedDateTime(normalizedValue);\n },\n () => {\n return parseDateTime(normalizedValue);\n },\n () => {\n return parseDate(normalizedValue);\n },\n ];\n\n return (\n parsers\n .map((parser) => {\n return tryParse(parser);\n })\n .find((parsedValue) => {\n return parsedValue != null;\n }) ?? null\n );\n};\n\n/** Resolve the timezone used by the DatePicker when time fields are enabled. */\nexport const resolveDatePickerTimeZone = (\n withTime: boolean,\n timeZone?: string,\n): string | undefined => {\n if (!withTime) {\n return timeZone;\n }\n\n return timeZone ?? getLocalTimeZone();\n};\n\n/** Build the default placeholder value for time-enabled pickers. */\nexport const getDatePickerPlaceholderValue = (\n withTime: boolean,\n timeZone?: string,\n): DatePickerValue => {\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n if (!resolvedTimeZone || !withTime) {\n return undefined;\n }\n\n return asDatePickerValue(now(resolvedTimeZone));\n};\n\n/**\n * Convert a date value into a UTC ISO string.\n *\n * `CalendarDate` and `CalendarDateTime` values are interpreted in the provided\n * timezone. `ZonedDateTime` values use their own timezone and offset.\n */\nexport const dateValueToUtcIsoString = (\n value: DatePickerValue,\n timeZone: string,\n): string | null => {\n if (value == null) {\n return null;\n }\n\n const maybeWithAbsoluteString = value as { toAbsoluteString?: () => string };\n if (typeof maybeWithAbsoluteString.toAbsoluteString === 'function') {\n return maybeWithAbsoluteString.toAbsoluteString();\n }\n\n const maybeWithToDate = value as { toDate?: (zone: string) => Date };\n if (typeof maybeWithToDate.toDate === 'function') {\n return maybeWithToDate.toDate(timeZone).toISOString();\n }\n\n return null;\n};\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { DatePickerProps as HeroDatePickerProps } from '@heroui/date-picker';\nimport type { ReactNode } from 'react';\nimport type { DatePickerValue } from './dateHelpers';\n\nimport { DatePicker as HeroDatePicker } from '@heroui/date-picker';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\nimport {\n dateValueToUtcIsoString,\n getDatePickerPlaceholderValue,\n parseDateValue,\n resolveDatePickerTimeZone,\n} from './dateHelpers';\n\nexport const datePickerVariants = tv({\n slots: {\n /** wrapper around the whole date picker */\n base: '',\n /** helper wrapper for error/description */\n helperWrapper: [\n // set padding to 0 for error message exit animation\n 'p-0',\n ],\n /** the calendar element */\n calendar: '',\n /** the calendar's content element */\n calendarContent: '',\n /**\n * inner wrapper (HeroUI inputWrapper slot)\n *\n * NOTE: Unlike HeroUI Input, the DatePicker does not expose a\n * `data-focus` indicator on the group, so the focus border has to be\n * driven by the native `focus-within` state of the segment inputs.\n */\n inputWrapper: 'bg-content1 focus-within:border-focus',\n /** the calendar popover element */\n popoverContent: '',\n /** selector button element */\n selectorButton: '',\n /** selector icon element */\n selectorIcon: '',\n /** the time-input component element */\n timeInput: '',\n /** the time-input component's label element */\n timeInputLabel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof datePickerVariants>;\ntype ClassName = TVClassName<typeof datePickerVariants>;\n\nexport interface DatePickerProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** date picker is disabled */\n disabled?: boolean;\n /**\n * Optional hour cycle override.\n *\n * When omitted, the picker uses the user's locale default (12-hour or 24-hour).\n */\n hourCycle?: 12 | 24;\n /** hide timezone abbreviation for zoned values */\n hideTimeZone?: boolean;\n /** form field label */\n label?: ReactNode;\n /** latest selectable value as ISO string */\n maxValue?: string;\n /** earliest selectable value as ISO string */\n minValue?: string;\n /** form field name */\n name: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /**\n * Optional advanced override for the display/interpretation timezone.\n *\n * When omitted, the picker uses the current user's local timezone while\n * `withTime` is enabled.\n */\n timeZone?: string;\n /**\n * Enables date-time mode.\n *\n * - `false` (default): date-only input (`day` granularity)\n * - `true`: includes time segments (`minute` granularity)\n */\n withTime?: boolean;\n /** value format stored in form state (`string` stores UTC ISO values) */\n valueType?: 'dateValue' | 'string';\n}\n\n/**\n * DatePicker component based on [HeroUI DatePicker](https://v2.heroui.com/docs/components/date-picker)\n */\nconst DatePicker = ({\n className: _className = undefined,\n hourCycle = 24,\n hideTimeZone = false,\n maxValue = undefined,\n minValue = undefined,\n name,\n timeZone = undefined,\n valueType = 'string',\n withTime = false,\n ...uniformFieldProps\n}: DatePickerProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({ name, ...uniformFieldProps });\n\n // classNames from slots\n const variants = datePickerVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n const resolvedTimeZone = resolveDatePickerTimeZone(withTime, timeZone);\n\n // Normalize incoming form value into HeroUI's DateValue shape so the field can\n // render consistently from UTC strings, local strings, Date instances, or DateValue objects.\n const parsedValue = parseDateValue(\n value,\n withTime ? resolvedTimeZone : timeZone,\n );\n\n // Build the default placeholder value for time-enabled pickers.\n const placeholderValue = getDatePickerPlaceholderValue(withTime, timeZone);\n\n // Parse ISO boundary strings into HeroUI DateValue objects.\n const parsedMinValue = parseDateValue(\n minValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['minValue'];\n const parsedMaxValue = parseDateValue(\n maxValue,\n withTime ? resolvedTimeZone : timeZone,\n ) as unknown as HeroDatePickerProps['maxValue'];\n\n // Normalize DatePicker output into the configured storage format before writing to form state.\n const handleChange = (nextValue: DatePickerValue) => {\n if (nextValue == null) {\n onChange(null);\n return;\n }\n\n if (valueType === 'dateValue') {\n onChange(nextValue);\n return;\n }\n\n // String mode always stores UTC ISO values so form state is timezone-neutral\n // and comparable across users/locales.\n onChange(\n dateValueToUtcIsoString(nextValue, resolvedTimeZone ?? 'UTC') ??\n String(nextValue),\n );\n };\n\n return (\n <HeroDatePicker\n aria-label={label ? undefined : ariaLabel}\n classNames={{\n base: classNames.base,\n calendar: classNames.calendar,\n calendarContent: classNames.calendarContent,\n helperWrapper: classNames.helperWrapper,\n inputWrapper: classNames.inputWrapper,\n popoverContent: classNames.popoverContent,\n selectorButton: classNames.selectorButton,\n selectorIcon: classNames.selectorIcon,\n timeInput: classNames.timeInput,\n timeInputLabel: classNames.timeInputLabel,\n }}\n data-testid={testId}\n errorMessage={errorMessage}\n granularity={withTime ? 'minute' : 'day'}\n hideTimeZone={hideTimeZone}\n hourCycle={hourCycle}\n id={testId}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label}\n labelPlacement=\"outside\"\n maxValue={parsedMaxValue}\n minValue={parsedMinValue}\n name={name}\n onBlur={onBlur}\n onChange={handleChange}\n placeholderValue={placeholderValue}\n radius=\"sm\"\n value={parsedValue}\n variant=\"bordered\"\n />\n );\n};\n\nexport default DatePicker;\n","import DatePicker from './DatePicker';\n\nexport type { DatePickerProps } from './DatePicker';\n\nexport { datePickerVariants } from './DatePicker';\n\nexport { DatePicker };\n\nexport default DatePicker;\n"],"mappings":";;;;;;;;AAiBA,MAAM,qBAAqB,UAAoC;CAC7D,OAAO;AACT;;AAGA,MAAM,mB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AAG;CAAkB,CAAC;CAIlD,MAAM,cAAA,GAAA,uBAAA,sBADW,mBAC8B,GAAG,YAAY,MAAM;CACpE,MAAM,mBAAmB,0BAA0B,UAAU,QAAQ;CAIrE,MAAM,cAAc,eAClB,OACA,WAAW,mBAAmB,QAChC;CAGA,MAAM,mBAAmB,8BAA8B,UAAU,QAAQ;CAGzE,MAAM,iBAAiB,eACrB,UACA,WAAW,mBAAmB,QAChC;CACA,MAAM,iBAAiB,eACrB,UACA,WAAW,mBAAmB,QAChC;CAGA,MAAM,gBAAgB,cAA+B;EACnD,IAAI,aAAa,MAAM;GACrB,SAAS,IAAI;GACb;EACF;EAEA,IAAI,cAAc,aAAa;GAC7B,SAAS,SAAS;GAClB;EACF;EAIA,SACE,wBAAwB,WAAW,oBAAoB,KAAK,KAC1D,OAAO,SAAS,CACpB;CACF;CAEA,OACE,iBAAA,GAAA,kBAAA,KAACC,oBAAAA,YAAD;EACE,cAAY,QAAQ,KAAA,IAAY;EAChC,YAAY;GACV,MAAM,WAAW;GACjB,UAAU,WAAW;GACrB,iBAAiB,WAAW;GAC5B,eAAe,WAAW;GAC1B,cAAc,WAAW;GACzB,gBAAgB,WAAW;GAC3B,gBAAgB,WAAW;GAC3B,cAAc,WAAW;GACzB,WAAW,WAAW;GACtB,gBAAgB,WAAW;EAC7B;EACA,eAAa;EACC;EACd,aAAa,WAAW,WAAW;EACrB;EACH;EACX,IAAI;EACJ,YAAY;EACZ,WAAW;EACX,YAAY;EACL;EACP,gBAAe;EACf,UAAU;EACV,UAAU;EACJ;EACE;EACR,UAAU;EACQ;EAClB,QAAO;EACP,OAAO;EACP,SAAQ;CACT,CAAA;AAEL;;;ACrMA,IAAA,qBAAe"}
|
|
@@ -2,6 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_FieldArray = require("../FieldArray-
|
|
5
|
+
const require_FieldArray = require("../FieldArray-V66fsvtd.cjs");
|
|
6
6
|
exports.FieldArray = require_FieldArray.FieldArray;
|
|
7
7
|
exports.default = require_FieldArray.FieldArray_default;
|
|
8
|
+
exports.fieldArrayVariants = require_FieldArray.fieldArrayVariants;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { FieldArray, FieldArray as default, type FieldArrayChildrenRenderFn, type FieldArrayFeatures, type FieldArrayProps };
|
|
1
|
+
import { a as FieldArrayProps, i as FieldArrayFeatures, n as fieldArrayVariants, r as FieldArrayChildrenRenderFn, t as FieldArray } from "../index-B4XExHDi.cjs";
|
|
2
|
+
export { FieldArray, FieldArray as default, type FieldArrayChildrenRenderFn, type FieldArrayFeatures, type FieldArrayProps, fieldArrayVariants };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { FieldArray, FieldArray as default, type FieldArrayChildrenRenderFn, type FieldArrayFeatures, type FieldArrayProps };
|
|
1
|
+
import { a as FieldArrayProps, i as FieldArrayFeatures, n as fieldArrayVariants, r as FieldArrayChildrenRenderFn, t as FieldArray } from "../index-yYjVSHlN.js";
|
|
2
|
+
export { FieldArray, FieldArray as default, type FieldArrayChildrenRenderFn, type FieldArrayFeatures, type FieldArrayProps, fieldArrayVariants };
|
package/dist/FieldArray/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as FieldArray, t as FieldArray_default } from "../FieldArray-
|
|
2
|
-
export { FieldArray, FieldArray_default as default };
|
|
1
|
+
import { n as FieldArray, r as fieldArrayVariants, t as FieldArray_default } from "../FieldArray-Dkw6JBnT.js";
|
|
2
|
+
export { FieldArray, FieldArray_default as default, fieldArrayVariants };
|
|
@@ -489,6 +489,6 @@ const FieldArray = ({ appendButtonText = "Add Element", children, className: _cl
|
|
|
489
489
|
//#region src/FieldArray/index.ts
|
|
490
490
|
var FieldArray_default = FieldArray;
|
|
491
491
|
//#endregion
|
|
492
|
-
export { FieldArray as n, FieldArray_default as t };
|
|
492
|
+
export { FieldArray as n, fieldArrayVariants as r, FieldArray_default as t };
|
|
493
493
|
|
|
494
|
-
//# sourceMappingURL=FieldArray-
|
|
494
|
+
//# sourceMappingURL=FieldArray-Dkw6JBnT.js.map
|