@fuf-stack/uniform 1.8.9 → 1.9.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.
- package/dist/Checkboxes/index.cjs +10 -10
- package/dist/Checkboxes/index.js +9 -9
- package/dist/FieldArray/index.cjs +10 -10
- package/dist/FieldArray/index.js +9 -9
- package/dist/Form/index.cjs +10 -10
- package/dist/Form/index.js +9 -9
- package/dist/Input/index.cjs +10 -10
- package/dist/Input/index.js +9 -9
- package/dist/{RadioBoxes-DpkI28l0.d.cts → RadioBox-B0s3q9g6.d.cts} +87 -37
- package/dist/{RadioBoxes-DpkI28l0.d.ts → RadioBox-B0s3q9g6.d.ts} +87 -37
- package/dist/RadioBoxes/index.cjs +12 -10
- package/dist/RadioBoxes/index.cjs.map +1 -1
- package/dist/RadioBoxes/index.d.cts +2 -2
- package/dist/RadioBoxes/index.d.ts +2 -2
- package/dist/RadioBoxes/index.js +13 -11
- package/dist/RadioTabs/index.cjs +10 -10
- package/dist/RadioTabs/index.d.cts +2 -2
- package/dist/RadioTabs/index.d.ts +2 -2
- package/dist/RadioTabs/index.js +9 -9
- package/dist/{RadioTabs-DTDcAZoH.d.cts → RadioTabs-D9Px3XEs.d.cts} +15 -0
- package/dist/{RadioTabs-DTDcAZoH.d.ts → RadioTabs-D9Px3XEs.d.ts} +15 -0
- package/dist/Radios/index.cjs +10 -10
- package/dist/Radios/index.js +9 -9
- package/dist/Select/index.cjs +10 -10
- package/dist/Select/index.js +9 -9
- package/dist/Slider/index.cjs +19 -0
- package/dist/Slider/index.cjs.map +1 -0
- package/dist/Slider/index.d.cts +10 -0
- package/dist/Slider/index.d.ts +10 -0
- package/dist/Slider/index.js +19 -0
- package/dist/Slider/index.js.map +1 -0
- package/dist/Slider-CIVhjJy1.d.cts +153 -0
- package/dist/Slider-CIVhjJy1.d.ts +153 -0
- package/dist/SubmitButton/index.cjs +10 -10
- package/dist/SubmitButton/index.js +9 -9
- package/dist/Switch/index.cjs +10 -10
- package/dist/Switch/index.d.cts +2 -2
- package/dist/Switch/index.d.ts +2 -2
- package/dist/Switch/index.js +9 -9
- package/dist/{Switch-Hr6PnK98.d.cts → Switch-CqBVdRJe.d.cts} +4 -4
- package/dist/{Switch-Hr6PnK98.d.ts → Switch-CqBVdRJe.d.ts} +4 -4
- package/dist/SwitchBox/index.cjs +26 -0
- package/dist/SwitchBox/index.cjs.map +1 -0
- package/dist/SwitchBox/index.d.cts +11 -0
- package/dist/SwitchBox/index.d.ts +11 -0
- package/dist/SwitchBox/index.js +26 -0
- package/dist/SwitchBox/index.js.map +1 -0
- package/dist/SwitchBox-q1I7a0NX.d.cts +146 -0
- package/dist/SwitchBox-q1I7a0NX.d.ts +146 -0
- package/dist/TextArea/index.cjs +10 -10
- package/dist/TextArea/index.js +9 -9
- package/dist/{chunk-T6G6NGLL.js → chunk-246OISWB.js} +2 -2
- package/dist/chunk-2OXNDD5W.cjs +162 -0
- package/dist/chunk-2OXNDD5W.cjs.map +1 -0
- package/dist/{chunk-2UQCRQEJ.cjs → chunk-6RZT2BKH.cjs} +5 -5
- package/dist/{chunk-2UQCRQEJ.cjs.map → chunk-6RZT2BKH.cjs.map} +1 -1
- package/dist/{chunk-OZQQSTVH.js → chunk-7FOSZV75.js} +8 -6
- package/dist/chunk-7FOSZV75.js.map +1 -0
- package/dist/{chunk-F5DISGJ4.cjs → chunk-7O6LAGV2.cjs} +9 -9
- package/dist/{chunk-F5DISGJ4.cjs.map → chunk-7O6LAGV2.cjs.map} +1 -1
- package/dist/{chunk-QLMUUXQO.cjs → chunk-7WKVH43M.cjs} +78 -46
- package/dist/chunk-7WKVH43M.cjs.map +1 -0
- package/dist/{chunk-RCLQ6NFK.js → chunk-A3PYIWG2.js} +2 -2
- package/dist/{chunk-O2XJNQQK.js → chunk-BOCYHTFE.js} +7 -1
- package/dist/chunk-BOCYHTFE.js.map +1 -0
- package/dist/{chunk-KE5DB3DZ.js → chunk-CEVS6WSG.js} +2 -2
- package/dist/{chunk-VIK6VTAZ.js → chunk-CG7GDQAP.js} +3 -3
- package/dist/{chunk-77OMBV7C.js → chunk-DQAZSXD6.js} +4 -4
- package/dist/chunk-FUMQULCR.cjs +215 -0
- package/dist/chunk-FUMQULCR.cjs.map +1 -0
- package/dist/{chunk-5MTIQ6WD.js → chunk-GE7HUIAK.js} +3 -3
- package/dist/{chunk-LO7UKHOS.js → chunk-IKOYYA75.js} +2 -2
- package/dist/{chunk-SG3JI5R3.cjs → chunk-IU4RL2D7.cjs} +3 -3
- package/dist/{chunk-SG3JI5R3.cjs.map → chunk-IU4RL2D7.cjs.map} +1 -1
- package/dist/{chunk-PHMEYG5F.js → chunk-IZZTVGEW.js} +78 -46
- package/dist/chunk-IZZTVGEW.js.map +1 -0
- package/dist/{chunk-F3WXUKZG.js → chunk-JICFOKDO.js} +2 -2
- package/dist/{chunk-ALI7JORZ.cjs → chunk-JQQ32JOD.cjs} +3 -3
- package/dist/{chunk-ALI7JORZ.cjs.map → chunk-JQQ32JOD.cjs.map} +1 -1
- package/dist/{chunk-YYLTLVIF.cjs → chunk-LTE7PW7F.cjs} +3 -3
- package/dist/{chunk-YYLTLVIF.cjs.map → chunk-LTE7PW7F.cjs.map} +1 -1
- package/dist/chunk-LUO4I3TW.js +162 -0
- package/dist/chunk-LUO4I3TW.js.map +1 -0
- package/dist/{chunk-JG7S3DEH.cjs → chunk-MEYGGRBQ.cjs} +7 -7
- package/dist/{chunk-JG7S3DEH.cjs.map → chunk-MEYGGRBQ.cjs.map} +1 -1
- package/dist/{chunk-YBLDWOOG.js → chunk-MHQ2V7UW.js} +2 -2
- package/dist/{chunk-HEPNEBRF.cjs → chunk-NKIZA3ZO.cjs} +3 -3
- package/dist/{chunk-HEPNEBRF.cjs.map → chunk-NKIZA3ZO.cjs.map} +1 -1
- package/dist/{chunk-6AWHOBNL.cjs → chunk-NV4YVZYX.cjs} +6 -6
- package/dist/{chunk-6AWHOBNL.cjs.map → chunk-NV4YVZYX.cjs.map} +1 -1
- package/dist/{chunk-D4AAQIY3.cjs → chunk-RRG5ZLVF.cjs} +5 -5
- package/dist/{chunk-D4AAQIY3.cjs.map → chunk-RRG5ZLVF.cjs.map} +1 -1
- package/dist/{chunk-NQ3KBYW6.cjs → chunk-SR76XJW4.cjs} +3 -3
- package/dist/{chunk-NQ3KBYW6.cjs.map → chunk-SR76XJW4.cjs.map} +1 -1
- package/dist/chunk-THCIT66I.cjs +217 -0
- package/dist/chunk-THCIT66I.cjs.map +1 -0
- package/dist/{chunk-OKJWLH7T.cjs → chunk-TKICOKNS.cjs} +9 -3
- package/dist/chunk-TKICOKNS.cjs.map +1 -0
- package/dist/{chunk-IV45K4WU.js → chunk-TUIK3MER.js} +2 -2
- package/dist/{chunk-AQJLKHAE.cjs → chunk-UBLASN6D.cjs} +5 -5
- package/dist/{chunk-AQJLKHAE.cjs.map → chunk-UBLASN6D.cjs.map} +1 -1
- package/dist/chunk-UUGSI3FD.js +215 -0
- package/dist/chunk-UUGSI3FD.js.map +1 -0
- package/dist/{chunk-FYN7ZWLW.cjs → chunk-UUGUQGMX.cjs} +10 -10
- package/dist/{chunk-FYN7ZWLW.cjs.map → chunk-UUGUQGMX.cjs.map} +1 -1
- package/dist/{chunk-H2PPUEUO.cjs → chunk-V65AMUKK.cjs} +5 -5
- package/dist/{chunk-H2PPUEUO.cjs.map → chunk-V65AMUKK.cjs.map} +1 -1
- package/dist/chunk-VIV3MSIX.cjs +129 -0
- package/dist/chunk-VIV3MSIX.cjs.map +1 -0
- package/dist/{chunk-26VE4IGU.js → chunk-WWRIMXSN.js} +3 -3
- package/dist/chunk-XBVXMQBW.js +217 -0
- package/dist/chunk-XBVXMQBW.js.map +1 -0
- package/dist/{chunk-LIW7KW2L.cjs → chunk-XC3C2W4M.cjs} +3 -3
- package/dist/{chunk-LIW7KW2L.cjs.map → chunk-XC3C2W4M.cjs.map} +1 -1
- package/dist/chunk-XMCL3F4W.js +129 -0
- package/dist/chunk-XMCL3F4W.js.map +1 -0
- package/dist/{chunk-REVHYI2O.js → chunk-XXLYUZY4.js} +4 -4
- package/dist/{chunk-4UR2T76K.js → chunk-Y7YEI6T2.js} +3 -3
- package/dist/{chunk-27MWGFXR.cjs → chunk-YCCBMAN2.cjs} +9 -7
- package/dist/chunk-YCCBMAN2.cjs.map +1 -0
- package/dist/{chunk-SJWL6EMI.js → chunk-ZZW7JZ2U.js} +3 -3
- package/dist/helpers/index.cjs +4 -2
- package/dist/helpers/index.cjs.map +1 -1
- package/dist/helpers/index.d.cts +25 -1
- package/dist/helpers/index.d.ts +25 -1
- package/dist/helpers/index.js +3 -1
- package/dist/hooks/index.cjs +14 -14
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +18 -18
- package/dist/hooks/useClientValidation/index.cjs +5 -5
- package/dist/hooks/useClientValidation/index.d.cts +2 -2
- package/dist/hooks/useClientValidation/index.d.ts +2 -2
- package/dist/hooks/useClientValidation/index.js +4 -4
- package/dist/hooks/useController/index.cjs +4 -4
- package/dist/hooks/useController/index.js +3 -3
- package/dist/hooks/useFormContext/index.cjs +4 -4
- package/dist/hooks/useFormContext/index.js +3 -3
- package/dist/hooks/useUniformField/index.cjs +6 -6
- package/dist/hooks/useUniformField/index.js +5 -5
- package/dist/hooks/useUniformFieldArray/index.cjs +7 -7
- package/dist/hooks/useUniformFieldArray/index.js +6 -6
- package/dist/hooks/useWatchUserChange/index.cjs +5 -5
- package/dist/hooks/useWatchUserChange/index.js +4 -4
- package/dist/index.cjs +38 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +45 -31
- package/package.json +13 -2
- package/dist/chunk-27MWGFXR.cjs.map +0 -1
- package/dist/chunk-DJKC3SR6.js +0 -105
- package/dist/chunk-DJKC3SR6.js.map +0 -1
- package/dist/chunk-HUDJU756.cjs +0 -170
- package/dist/chunk-HUDJU756.cjs.map +0 -1
- package/dist/chunk-NI3WUU7T.cjs +0 -105
- package/dist/chunk-NI3WUU7T.cjs.map +0 -1
- package/dist/chunk-O2XJNQQK.js.map +0 -1
- package/dist/chunk-OKJWLH7T.cjs.map +0 -1
- package/dist/chunk-OZQQSTVH.js.map +0 -1
- package/dist/chunk-PHMEYG5F.js.map +0 -1
- package/dist/chunk-QLMUUXQO.cjs.map +0 -1
- package/dist/chunk-U4D6YJ6Z.js +0 -170
- package/dist/chunk-U4D6YJ6Z.js.map +0 -1
- /package/dist/{chunk-T6G6NGLL.js.map → chunk-246OISWB.js.map} +0 -0
- /package/dist/{chunk-RCLQ6NFK.js.map → chunk-A3PYIWG2.js.map} +0 -0
- /package/dist/{chunk-KE5DB3DZ.js.map → chunk-CEVS6WSG.js.map} +0 -0
- /package/dist/{chunk-VIK6VTAZ.js.map → chunk-CG7GDQAP.js.map} +0 -0
- /package/dist/{chunk-77OMBV7C.js.map → chunk-DQAZSXD6.js.map} +0 -0
- /package/dist/{chunk-5MTIQ6WD.js.map → chunk-GE7HUIAK.js.map} +0 -0
- /package/dist/{chunk-LO7UKHOS.js.map → chunk-IKOYYA75.js.map} +0 -0
- /package/dist/{chunk-F3WXUKZG.js.map → chunk-JICFOKDO.js.map} +0 -0
- /package/dist/{chunk-YBLDWOOG.js.map → chunk-MHQ2V7UW.js.map} +0 -0
- /package/dist/{chunk-IV45K4WU.js.map → chunk-TUIK3MER.js.map} +0 -0
- /package/dist/{chunk-26VE4IGU.js.map → chunk-WWRIMXSN.js.map} +0 -0
- /package/dist/{chunk-REVHYI2O.js.map → chunk-XXLYUZY4.js.map} +0 -0
- /package/dist/{chunk-4UR2T76K.js.map → chunk-Y7YEI6T2.js.map} +0 -0
- /package/dist/{chunk-SJWL6EMI.js.map → chunk-ZZW7JZ2U.js.map} +0 -0
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,2pEAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/index.cjs"}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ export { b as CheckboxOption, C as Checkboxes, a as CheckboxesProps } from './Ch
|
|
|
2
2
|
export { F as FieldArray, a as FieldArrayChildrenRenderFn, b as FieldArrayFeatures, c as FieldArrayProps } from './FieldArray-Cql1zcch.cjs';
|
|
3
3
|
export { F as Form, a as FormProps } from './Form-BZZJPLsi.cjs';
|
|
4
4
|
export { G as Grid, a as GridProps } from './Grid-DF3L9NF3.cjs';
|
|
5
|
-
export { flatArrayKey, fromNullishString, nameToTestId, toFormFormat, toNullishString, toValidationFormat } from './helpers/index.cjs';
|
|
5
|
+
export { flatArrayKey, fromNullishString, isTestEnvironment, nameToTestId, toFormFormat, toNullishString, toValidationFormat } from './helpers/index.cjs';
|
|
6
6
|
export { clientValidationSchemaByName, useClientValidation } from './hooks/useClientValidation/index.cjs';
|
|
7
7
|
export { UseControllerProps, UseControllerReturn, useController } from './hooks/useController/index.cjs';
|
|
8
8
|
export { UseUniformFieldArrayProps, useUniformFieldArray } from './hooks/useUniformFieldArray/index.cjs';
|
|
@@ -15,12 +15,14 @@ export { UseWatchUserChangeOptions, useWatchUserChange } from './hooks/useWatchU
|
|
|
15
15
|
export { I as Input, a as InputProps } from './Input-DMVTcinm.cjs';
|
|
16
16
|
export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-_TDlmw0L.cjs';
|
|
17
17
|
export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-DwtLkGMo.cjs';
|
|
18
|
-
export { R as RadioBoxes, a as RadioBoxesProps } from './
|
|
18
|
+
export { R as RadioBoxes, a as RadioBoxesProps, r as radioBoxVariants } from './RadioBox-B0s3q9g6.cjs';
|
|
19
19
|
export { R as Radios, a as RadiosProps } from './Radios-DprlJhoq.cjs';
|
|
20
|
-
export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-
|
|
20
|
+
export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-D9Px3XEs.cjs';
|
|
21
21
|
export { S as Select, a as SelectProps } from './Select-CDkZmZp2.cjs';
|
|
22
|
+
export { S as Slider, a as SliderProps } from './Slider-CIVhjJy1.cjs';
|
|
22
23
|
export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-DqaxyVpp.cjs';
|
|
23
|
-
export { S as Switch, a as SwitchProps } from './Switch-
|
|
24
|
+
export { S as Switch, a as SwitchProps } from './Switch-CqBVdRJe.cjs';
|
|
25
|
+
export { S as SwitchBox, a as SwitchBoxProps, s as switchBoxVariants } from './SwitchBox-q1I7a0NX.cjs';
|
|
24
26
|
export { T as TextArea, a as TextAreaProps } from './TextArea-DhxNWYNg.cjs';
|
|
25
27
|
import 'react/jsx-runtime';
|
|
26
28
|
import 'tailwind-variants';
|
|
@@ -29,7 +31,7 @@ import 'react';
|
|
|
29
31
|
import '@fuf-stack/veto';
|
|
30
32
|
import 'react-hook-form';
|
|
31
33
|
import './FormContext-9Firwt4k.cjs';
|
|
32
|
-
import '@fuf-stack/veto/dist/types.d-
|
|
34
|
+
import '@fuf-stack/veto/dist/types.d-CNPgNK-V';
|
|
33
35
|
import '@fuf-stack/pixels';
|
|
34
36
|
import 'react-select';
|
|
35
37
|
import '@heroui/switch';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { b as CheckboxOption, C as Checkboxes, a as CheckboxesProps } from './Ch
|
|
|
2
2
|
export { F as FieldArray, a as FieldArrayChildrenRenderFn, b as FieldArrayFeatures, c as FieldArrayProps } from './FieldArray-Cql1zcch.js';
|
|
3
3
|
export { F as Form, a as FormProps } from './Form-zsUjI2yq.js';
|
|
4
4
|
export { G as Grid, a as GridProps } from './Grid-DF3L9NF3.js';
|
|
5
|
-
export { flatArrayKey, fromNullishString, nameToTestId, toFormFormat, toNullishString, toValidationFormat } from './helpers/index.js';
|
|
5
|
+
export { flatArrayKey, fromNullishString, isTestEnvironment, nameToTestId, toFormFormat, toNullishString, toValidationFormat } from './helpers/index.js';
|
|
6
6
|
export { clientValidationSchemaByName, useClientValidation } from './hooks/useClientValidation/index.js';
|
|
7
7
|
export { UseControllerProps, UseControllerReturn, useController } from './hooks/useController/index.js';
|
|
8
8
|
export { UseUniformFieldArrayProps, useUniformFieldArray } from './hooks/useUniformFieldArray/index.js';
|
|
@@ -15,12 +15,14 @@ export { UseWatchUserChangeOptions, useWatchUserChange } from './hooks/useWatchU
|
|
|
15
15
|
export { I as Input, a as InputProps } from './Input-BcdS2xBM.js';
|
|
16
16
|
export { F as FieldCopyTestIdButton, a as FieldCopyTestIdButtonProps } from './FieldCopyTestIdButton-_TDlmw0L.js';
|
|
17
17
|
export { F as FieldValidationError, a as FieldValidationErrorProps } from './FieldValidationError-DwtLkGMo.js';
|
|
18
|
-
export { R as RadioBoxes, a as RadioBoxesProps } from './
|
|
18
|
+
export { R as RadioBoxes, a as RadioBoxesProps, r as radioBoxVariants } from './RadioBox-B0s3q9g6.js';
|
|
19
19
|
export { R as Radios, a as RadiosProps } from './Radios-DprlJhoq.js';
|
|
20
|
-
export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-
|
|
20
|
+
export { R as RadioTabs, a as RadioTabsProps } from './RadioTabs-D9Px3XEs.js';
|
|
21
21
|
export { S as Select, a as SelectProps } from './Select-CDkZmZp2.js';
|
|
22
|
+
export { S as Slider, a as SliderProps } from './Slider-CIVhjJy1.js';
|
|
22
23
|
export { S as SubmitButton, a as SubmitButtonProps } from './SubmitButton-DqaxyVpp.js';
|
|
23
|
-
export { S as Switch, a as SwitchProps } from './Switch-
|
|
24
|
+
export { S as Switch, a as SwitchProps } from './Switch-CqBVdRJe.js';
|
|
25
|
+
export { S as SwitchBox, a as SwitchBoxProps, s as switchBoxVariants } from './SwitchBox-q1I7a0NX.js';
|
|
24
26
|
export { T as TextArea, a as TextAreaProps } from './TextArea-DhxNWYNg.js';
|
|
25
27
|
import 'react/jsx-runtime';
|
|
26
28
|
import 'tailwind-variants';
|
|
@@ -29,7 +31,7 @@ import 'react';
|
|
|
29
31
|
import '@fuf-stack/veto';
|
|
30
32
|
import 'react-hook-form';
|
|
31
33
|
import './FormContext-9Firwt4k.js';
|
|
32
|
-
import '@fuf-stack/veto/dist/types.d-
|
|
34
|
+
import '@fuf-stack/veto/dist/types.d-CNPgNK-V';
|
|
33
35
|
import '@fuf-stack/pixels';
|
|
34
36
|
import 'react-select';
|
|
35
37
|
import '@heroui/switch';
|
package/dist/index.js
CHANGED
|
@@ -1,49 +1,64 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Radios_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-246OISWB.js";
|
|
4
4
|
import {
|
|
5
5
|
Select_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CG7GDQAP.js";
|
|
7
|
+
import {
|
|
8
|
+
Slider_default
|
|
9
|
+
} from "./chunk-LUO4I3TW.js";
|
|
7
10
|
import {
|
|
8
11
|
SubmitButton_default
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-A3PYIWG2.js";
|
|
10
13
|
import {
|
|
11
14
|
Switch_default
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-XMCL3F4W.js";
|
|
16
|
+
import {
|
|
17
|
+
SwitchBox_default,
|
|
18
|
+
switchBoxVariants
|
|
19
|
+
} from "./chunk-UUGSI3FD.js";
|
|
13
20
|
import {
|
|
14
21
|
TextArea_default
|
|
15
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JICFOKDO.js";
|
|
16
23
|
import {
|
|
17
24
|
Checkboxes_default
|
|
18
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-MHQ2V7UW.js";
|
|
19
26
|
import {
|
|
20
27
|
FieldArray_default
|
|
21
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-XXLYUZY4.js";
|
|
22
29
|
import {
|
|
23
30
|
Form_default
|
|
24
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-Y7YEI6T2.js";
|
|
25
32
|
import {
|
|
26
33
|
Grid_default
|
|
27
34
|
} from "./chunk-B62HKKMS.js";
|
|
28
|
-
import {
|
|
29
|
-
RadioBoxes_default
|
|
30
|
-
} from "./chunk-U4D6YJ6Z.js";
|
|
31
35
|
import {
|
|
32
36
|
Input_default
|
|
33
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-CEVS6WSG.js";
|
|
38
|
+
import {
|
|
39
|
+
RadioBoxes_default,
|
|
40
|
+
radioBoxVariants
|
|
41
|
+
} from "./chunk-XBVXMQBW.js";
|
|
34
42
|
import {
|
|
35
43
|
RadioTabs_default
|
|
36
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-IZZTVGEW.js";
|
|
37
45
|
import "./chunk-V3GDAELU.js";
|
|
46
|
+
import {
|
|
47
|
+
useUniformFieldArray
|
|
48
|
+
} from "./chunk-DQAZSXD6.js";
|
|
49
|
+
import {
|
|
50
|
+
useWatchUserChange
|
|
51
|
+
} from "./chunk-IKOYYA75.js";
|
|
52
|
+
import {
|
|
53
|
+
clientValidationSchemaByName,
|
|
54
|
+
useClientValidation
|
|
55
|
+
} from "./chunk-WWRIMXSN.js";
|
|
38
56
|
import {
|
|
39
57
|
useInputValueDebounce
|
|
40
58
|
} from "./chunk-ZJDU5EPE.js";
|
|
41
|
-
import {
|
|
42
|
-
useUniformFieldArray
|
|
43
|
-
} from "./chunk-77OMBV7C.js";
|
|
44
59
|
import {
|
|
45
60
|
useUniformField
|
|
46
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-7FOSZV75.js";
|
|
47
62
|
import {
|
|
48
63
|
FieldCopyTestIdButton_default
|
|
49
64
|
} from "./chunk-NTDKZW4E.js";
|
|
@@ -52,33 +67,27 @@ import {
|
|
|
52
67
|
} from "./chunk-ELYGQTXB.js";
|
|
53
68
|
import {
|
|
54
69
|
useController
|
|
55
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-GE7HUIAK.js";
|
|
71
|
+
import {
|
|
72
|
+
checkFieldIsRequired,
|
|
73
|
+
useFormContext
|
|
74
|
+
} from "./chunk-ZZW7JZ2U.js";
|
|
75
|
+
import "./chunk-TUIK3MER.js";
|
|
56
76
|
import {
|
|
57
77
|
useInput
|
|
58
78
|
} from "./chunk-AHJJIANM.js";
|
|
59
79
|
import {
|
|
60
80
|
useInputValueTransform
|
|
61
81
|
} from "./chunk-CNTOODUQ.js";
|
|
62
|
-
import {
|
|
63
|
-
useWatchUserChange
|
|
64
|
-
} from "./chunk-LO7UKHOS.js";
|
|
65
|
-
import {
|
|
66
|
-
clientValidationSchemaByName,
|
|
67
|
-
useClientValidation
|
|
68
|
-
} from "./chunk-26VE4IGU.js";
|
|
69
|
-
import {
|
|
70
|
-
checkFieldIsRequired,
|
|
71
|
-
useFormContext
|
|
72
|
-
} from "./chunk-SJWL6EMI.js";
|
|
73
|
-
import "./chunk-IV45K4WU.js";
|
|
74
82
|
import {
|
|
75
83
|
flatArrayKey,
|
|
76
84
|
fromNullishString,
|
|
85
|
+
isTestEnvironment,
|
|
77
86
|
nameToTestId,
|
|
78
87
|
toFormFormat,
|
|
79
88
|
toNullishString,
|
|
80
89
|
toValidationFormat
|
|
81
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-BOCYHTFE.js";
|
|
82
91
|
import "./chunk-K2V4ULA2.js";
|
|
83
92
|
export {
|
|
84
93
|
Checkboxes_default as Checkboxes,
|
|
@@ -92,14 +101,19 @@ export {
|
|
|
92
101
|
RadioTabs_default as RadioTabs,
|
|
93
102
|
Radios_default as Radios,
|
|
94
103
|
Select_default as Select,
|
|
104
|
+
Slider_default as Slider,
|
|
95
105
|
SubmitButton_default as SubmitButton,
|
|
96
106
|
Switch_default as Switch,
|
|
107
|
+
SwitchBox_default as SwitchBox,
|
|
97
108
|
TextArea_default as TextArea,
|
|
98
109
|
checkFieldIsRequired,
|
|
99
110
|
clientValidationSchemaByName,
|
|
100
111
|
flatArrayKey,
|
|
101
112
|
fromNullishString,
|
|
113
|
+
isTestEnvironment,
|
|
102
114
|
nameToTestId,
|
|
115
|
+
radioBoxVariants,
|
|
116
|
+
switchBoxVariants,
|
|
103
117
|
toFormFormat,
|
|
104
118
|
toNullishString,
|
|
105
119
|
toValidationFormat,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuf-stack/uniform",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "fuf react form library",
|
|
5
5
|
"author": "Fröhlich ∧ Frei",
|
|
6
6
|
"homepage": "https://github.com/fuf-stack/pixels#readme",
|
|
@@ -126,6 +126,11 @@
|
|
|
126
126
|
"import": "./dist/Select/index.js",
|
|
127
127
|
"require": "./dist/Select/index.cjs"
|
|
128
128
|
},
|
|
129
|
+
"./Slider": {
|
|
130
|
+
"types": "./dist/Slider/index.d.ts",
|
|
131
|
+
"import": "./dist/Slider/index.js",
|
|
132
|
+
"require": "./dist/Slider/index.cjs"
|
|
133
|
+
},
|
|
129
134
|
"./SubmitButton": {
|
|
130
135
|
"types": "./dist/SubmitButton/index.d.ts",
|
|
131
136
|
"import": "./dist/SubmitButton/index.js",
|
|
@@ -136,6 +141,11 @@
|
|
|
136
141
|
"import": "./dist/Switch/index.js",
|
|
137
142
|
"require": "./dist/Switch/index.cjs"
|
|
138
143
|
},
|
|
144
|
+
"./SwitchBox": {
|
|
145
|
+
"types": "./dist/SwitchBox/index.d.ts",
|
|
146
|
+
"import": "./dist/SwitchBox/index.js",
|
|
147
|
+
"require": "./dist/SwitchBox/index.cjs"
|
|
148
|
+
},
|
|
139
149
|
"./TextArea": {
|
|
140
150
|
"types": "./dist/TextArea/index.d.ts",
|
|
141
151
|
"import": "./dist/TextArea/index.js",
|
|
@@ -180,6 +190,7 @@
|
|
|
180
190
|
"@heroui/number-input": "2.0.18",
|
|
181
191
|
"@heroui/radio": "2.3.24",
|
|
182
192
|
"@heroui/select": "2.4.25",
|
|
193
|
+
"@heroui/slider": "2.4.24",
|
|
183
194
|
"@heroui/switch": "2.2.22",
|
|
184
195
|
"@heroui/system": "2.4.20",
|
|
185
196
|
"@heroui/theme": "2.4.20",
|
|
@@ -197,5 +208,5 @@
|
|
|
197
208
|
"react": "19.1.1",
|
|
198
209
|
"react-dom": "19.1.1"
|
|
199
210
|
},
|
|
200
|
-
"gitHead": "
|
|
211
|
+
"gitHead": "4bfab45e67836b7919048409e4897c8b888efb33"
|
|
201
212
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-27MWGFXR.cjs","../src/hooks/useUniformField/useUniformField.tsx"],"names":["_a"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACjBA,2CAA4B;AA6NtB,+CAAA;AAtMN,IAAM,oBAAA,EAAsB,CAAC,OAAA,EAAkB,OAAA,EAAA,GAAoB;AACjE,EAAA,MAAM,iBAAA,EAAmB,iCAAA,OAAY,EAAS,OAAO,CAAA;AAGrD,EAAA,MAAM,OAAA,EACJ,OAAA,CAAQ,GAAA,CAAI,SAAA,IAAa,OAAA,GAAU,OAAA,CAAQ,GAAA,CAAI,OAAA,IAAW,MAAA;AAC5D,EAAA,GAAA,CAAI,MAAA,EAAQ;AACV,IAAA,OAAO,OAAA;AAAA,EACT;AAEA,EAAA,OAAO,gBAAA;AACT,CAAA;AA2FO,SAAS,eAAA,CAId,MAAA,EACqC;AAxIvC,EAAA,IAAA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KAAA;AAAA,IACA,cAAA,EAAgB;AAAA,EAClB,CAAC,CAAA;AAEH,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA,EAAU,UAAA;AAAA,IACV,KAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA,EAAO,6CAAA,8CAAA,CAAA,CAAA,EACF,KAAA,CAAA,EADE;AAAA,MAEL,KAAA,EAAO,gBAAA;AAAA,MACP,QAAA,EAAU;AAAA,IACZ,CAAA,CAAA;AAAA,IACA,oBAAA;AAAA,IACA,qBAAA;AAAA,IACA,aAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA,EAAO,SAAA;AAAA,IACP,MAAA;AAAA,IACA,QAAA,EAAU,mBAAA;AAAA,IACV,GAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF;ADxJA;AACA;AACE;AACF,0CAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-27MWGFXR.cjs","sourcesContent":[null,"import type { ReactNode } from 'react';\nimport type { FieldError, FieldValues, Path } from 'react-hook-form';\nimport type { InputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\nimport React from 'react';\n\nimport { useDebounce } from '@fuf-stack/pixels';\n\nimport { FieldCopyTestIdButton } from '../../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../../partials/FieldValidationError';\nimport { useController } from '../useController/useController';\nimport { useFormContext } from '../useFormContext/useFormContext';\nimport { useInput } from '../useInput/useInput';\nimport { useInputValueTransform } from '../useInputValueTransform/useInputValueTransform';\n\n/**\n * Debounce invalid state changes to prevent UI flicker on rapid changes.\n *\n * Primary purpose: Reduce UI flicker when validation state changes rapidly\n * (e.g., during fast typing). Without debouncing, error messages would flash\n * in/out rapidly, creating a poor UX.\n *\n * Secondary benefit: When animations are enabled (default), gives time for\n * enter/exit animations to complete smoothly.\n *\n * Behavior:\n * - Debounces both true → false and false → true transitions by `delayMs`\n * - Disabled in test environments for immediate snapshots\n */\nconst useDebouncedInvalid = (invalid: boolean, delayMs: number) => {\n const debouncedInvalid = useDebounce(invalid, delayMs);\n\n // Disable debouncing in test environments for immediate snapshots\n const isTest =\n process.env.NODE_ENV === 'test' || process.env.VITEST === 'true';\n if (isTest) {\n return invalid;\n }\n\n return debouncedInvalid;\n};\n\nexport interface UseUniformFieldParams<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n> {\n /** Form field name */\n name: Path<TFieldValues> & string;\n /** Disable the field */\n disabled?: boolean;\n /** Optional explicit test id used to build stable test ids */\n testId?: string;\n /** Optional label content; pass false to suppress label entirely */\n label?: ReactNode | false;\n /** Input type for special number handling */\n type?: 'text' | 'number' | 'password';\n /** Optional value transformation between form and display values */\n transform?: InputValueTransform<TDisplay>;\n}\n\nexport interface UseUniformFieldReturn<\n TFieldValues extends FieldValues = FieldValues,\n> {\n /** react-hook-form control instance for advanced integrations */\n control: ReturnType<typeof useFormContext<TFieldValues>>['control'];\n /** Debug mode from Uniform provider */\n debugMode: ReturnType<typeof useFormContext<TFieldValues>>['debugMode'];\n /** Current value used to initialize uncontrolled components */\n defaultValue: unknown;\n /** Whether the field is currently disabled (from RHF) */\n disabled: boolean | undefined;\n /** Validation error(s) for the field */\n error: FieldError[] | undefined;\n /** Pre-built errorMessage node to plug into components */\n errorMessage: ReactNode | null;\n /** RHF controller field with transformed value/onChange (use this for simple components) */\n field: ReturnType<typeof useController<TFieldValues>>['field'];\n /** Helper to spread standardized error message props to underlying components */\n getErrorMessageProps: ReturnType<typeof useInput>['getErrorMessageProps'];\n /** Helper to spread standardized helper wrapper props (for spacing/animation) */\n getHelperWrapperProps: ReturnType<typeof useInput>['getHelperWrapperProps'];\n /** Helper to spread standardized label props to underlying components */\n getLabelProps: ReturnType<typeof useInput>['getLabelProps'];\n /** Access current form values (converted to validation-friendly format) */\n getValues: ReturnType<typeof useFormContext<TFieldValues>>['getValues'];\n /** Whether the field should show invalid state (debounced for smooth animations). True when field is invalid AND (dirty OR touched OR submitted) */\n invalid: boolean;\n /** Computed label node including optional test id copy button */\n label: ReactNode | null;\n /** onBlur handler from controller */\n onBlur: ReturnType<typeof useController<TFieldValues>>['field']['onBlur'];\n /** onChange handler from controller (with transform applied) */\n onChange: ReturnType<typeof useController<TFieldValues>>['field']['onChange'];\n /** Ref to forward to underlying control */\n ref: ReturnType<typeof useController<TFieldValues>>['field']['ref'];\n /** Whether the field is required according to validation schema */\n required: boolean;\n /** Reset a specific field in the form */\n resetField: ReturnType<typeof useFormContext<TFieldValues>>['resetField'];\n /** Generated HTML data-testid for the field */\n testId: string;\n}\n\n/**\n * Combines frequently used form field logic into a single hook.\n *\n * Provides:\n * - Enhanced form context (validation-aware state, `testId`, value transforms)\n * - Controller field with nullish conversion handling\n * - Value transformation via `transform` prop:\n * • Allows disentangled display and form values (e.g., string ↔ object, boolean ↔ array)\n * • Automatically applies `toDisplayValue` to field value for components\n * • Automatically applies `toFormValue` to display value when onChange is called\n * • Works with `type` prop for automatic number/string conversion\n * • Examples: storing objects while displaying strings, storing booleans as arrays, enriching values with metadata\n * - Debounced `invalid` state with smart timing:\n * • `true` (field becomes invalid): applies immediately so errors show right away\n * • `false` (field becomes valid): delayed 200ms to allow smooth exit animations\n * • Respects `prefers-reduced-motion` by skipping delays when user prefers reduced motion\n * - Smart `invalid` visibility (via `showInvalid`):\n * • Shows errors when field is dirty OR touched OR form has been submitted\n * • Prevents showing errors on pristine/untouched fields for better UX\n * • Works well for all field types (text inputs, checkboxes, radios, arrays)\n * - Prebuilt `errorMessage` React node using `FieldValidationError`\n * - Computed `label` node which appends a `FieldCopyTestIdButton` in\n * `debug-testids` mode\n * - `defaultValue` for uncontrolled defaults and all usual field handlers\n * - Access to form utilities: `control`, `getValues`, `resetField`\n * - Presentation helpers: `getLabelProps`, `getErrorMessageProps`,\n * `getHelperWrapperProps` for consistent wiring to underlying UI components\n */\nexport function useUniformField<\n TFieldValues extends FieldValues = FieldValues,\n TDisplay = unknown,\n>(\n params: UseUniformFieldParams<TFieldValues, TDisplay>,\n): UseUniformFieldReturn<TFieldValues> {\n const {\n name,\n disabled = false,\n testId: explicitTestId,\n label,\n type,\n transform,\n } = params;\n\n const {\n control,\n debugMode,\n formState: { submitCount },\n getFieldState,\n getValues,\n resetField,\n } = useFormContext<TFieldValues>();\n\n const {\n error,\n invalid: rawInvalid,\n isDirty,\n isTouched,\n required,\n testId,\n } = getFieldState(name, explicitTestId);\n\n const { field } = useController<TFieldValues>({\n control,\n disabled,\n name,\n });\n const {\n onChange: fieldOnChange,\n value: fieldValue,\n disabled: isDisabled,\n onBlur,\n ref,\n } = field;\n\n // Get transform utilities (but don't apply them automatically)\n // Components can choose how to use them (directly or via useInputValueDebounce)\n const { toDisplayValue, toFormValue } = useInputValueTransform<TDisplay>({\n type,\n transform,\n });\n\n // For components without special needs: apply transform to value and onChange\n const transformedValue = toDisplayValue(fieldValue);\n const transformedOnChange = (eventOrValue: TDisplay | React.ChangeEvent) => {\n // Extract value from event or use value directly\n const displayValue =\n (eventOrValue as React.ChangeEvent<HTMLInputElement>)?.target?.value ??\n eventOrValue;\n const formValue = toFormValue(displayValue as TDisplay);\n fieldOnChange(formValue as typeof fieldValue);\n };\n\n const defaultValue = (getValues() as Record<string, unknown>)?.[\n name as string\n ];\n\n /**\n * Determine when to show the invalid state to the user.\n *\n * Show errors when the field is invalid AND any of these conditions are met:\n * - Field is dirty (value changed from initial) - good for checkboxes/radios/arrays\n * - Field is touched (focused and blurred) - good for text inputs\n * - Form has been submitted - shows all errors after submit attempt\n *\n * This prevents showing errors on pristine/untouched fields for better UX.\n * Examples:\n * - Text input: User loads form with empty required field → no error shown yet\n * - Text input: User focuses and blurs → error shows (via isTouched)\n * - Checkbox group: User clicks first checkbox → error shows immediately (via isDirty)\n * - Any field: User submits form → all errors show (via submitCount)\n *\n * The entire condition is debounced to prevent flickering and allow smooth animations\n * when any of the states (invalid, isDirty, isTouched, submitCount) change.\n */\n const showInvalid = rawInvalid && (isDirty || isTouched || submitCount > 0);\n const invalid = useDebouncedInvalid(showInvalid, 200);\n\n // Build a label node that:\n // - shows the provided label (unless explicitly set to false)\n // - appends a copy-to-clipboard button for the test id in `debug-testids` mode\n // Consumers can pass this directly to component `label` props\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const labelNode: ReactNode | null =\n !!label || showTestIdCopyButton ? (\n <>\n {label !== false ? label : null}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </>\n ) : null;\n\n // Ready-to-render error message; consumers can drop this into their\n // component `errorMessage` prop without repeating mapping/markup\n const errorMessage = <FieldValidationError error={error} testId={testId} />;\n\n // Generate standardized props for label, helper wrapper and error message\n // so consumers can spread them directly into UI components (e.g. HeroUI),\n // keeping animations/spacing consistent across fields\n const { getErrorMessageProps, getLabelProps, getHelperWrapperProps } =\n useInput({\n ref,\n classNames: {\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n },\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n return {\n control,\n debugMode,\n defaultValue,\n disabled: isDisabled,\n error,\n errorMessage,\n field: {\n ...field,\n value: transformedValue as typeof field.value,\n onChange: transformedOnChange as typeof field.onChange,\n },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getValues,\n invalid,\n label: labelNode,\n onBlur,\n onChange: transformedOnChange as typeof field.onChange,\n ref,\n required,\n resetField,\n testId,\n };\n}\n\nexport default useUniformField;\n"]}
|
package/dist/chunk-DJKC3SR6.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FieldCopyTestIdButton_default
|
|
3
|
-
} from "./chunk-NTDKZW4E.js";
|
|
4
|
-
import {
|
|
5
|
-
FieldValidationError_default
|
|
6
|
-
} from "./chunk-ELYGQTXB.js";
|
|
7
|
-
import {
|
|
8
|
-
useController
|
|
9
|
-
} from "./chunk-5MTIQ6WD.js";
|
|
10
|
-
import {
|
|
11
|
-
useInput
|
|
12
|
-
} from "./chunk-AHJJIANM.js";
|
|
13
|
-
import {
|
|
14
|
-
useFormContext
|
|
15
|
-
} from "./chunk-SJWL6EMI.js";
|
|
16
|
-
import {
|
|
17
|
-
__spreadProps,
|
|
18
|
-
__spreadValues
|
|
19
|
-
} from "./chunk-K2V4ULA2.js";
|
|
20
|
-
|
|
21
|
-
// src/Switch/Switch.tsx
|
|
22
|
-
import { Switch as HeroSwitch } from "@heroui/switch";
|
|
23
|
-
import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
24
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
-
var switchVariants = tv({
|
|
26
|
-
slots: {
|
|
27
|
-
base: "",
|
|
28
|
-
endContent: "",
|
|
29
|
-
errorMessage: "ml-1 mt-1",
|
|
30
|
-
// see HeroUI styles for group-data condition,
|
|
31
|
-
// e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts
|
|
32
|
-
label: 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-["*"]',
|
|
33
|
-
outerWrapper: "place-content-center",
|
|
34
|
-
startContent: "",
|
|
35
|
-
thumb: "",
|
|
36
|
-
thumbIcon: "",
|
|
37
|
-
wrapper: ""
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
var Switch = ({
|
|
41
|
-
className = void 0,
|
|
42
|
-
disabled = false,
|
|
43
|
-
endContent = void 0,
|
|
44
|
-
label: _label = void 0,
|
|
45
|
-
name,
|
|
46
|
-
size = void 0,
|
|
47
|
-
startContent = void 0,
|
|
48
|
-
testId: _testId = void 0,
|
|
49
|
-
thumbIcon = void 0
|
|
50
|
-
}) => {
|
|
51
|
-
const { control, debugMode, getFieldState } = useFormContext();
|
|
52
|
-
const { error, required, testId, invalid } = getFieldState(name, _testId);
|
|
53
|
-
const { field } = useController({ name, control, disabled });
|
|
54
|
-
const { disabled: isDisabled, value, ref, onBlur, onChange } = field;
|
|
55
|
-
const { label, getInputProps, getErrorMessageProps } = useInput({
|
|
56
|
-
errorMessage: JSON.stringify(error),
|
|
57
|
-
isInvalid: invalid,
|
|
58
|
-
isRequired: required,
|
|
59
|
-
label: _label,
|
|
60
|
-
labelPlacement: "outside",
|
|
61
|
-
placeholder: " "
|
|
62
|
-
});
|
|
63
|
-
const showTestIdCopyButton = debugMode === "debug-testids";
|
|
64
|
-
const variants = switchVariants();
|
|
65
|
-
const classNames = variantsToClassNames(variants, className, "outerWrapper");
|
|
66
|
-
return /* @__PURE__ */ jsxs("div", { className: classNames.outerWrapper, children: [
|
|
67
|
-
/* @__PURE__ */ jsxs(
|
|
68
|
-
HeroSwitch,
|
|
69
|
-
{
|
|
70
|
-
ref,
|
|
71
|
-
"aria-describedby": getInputProps()["aria-describedby"],
|
|
72
|
-
classNames,
|
|
73
|
-
"data-invalid": invalid,
|
|
74
|
-
"data-required": required,
|
|
75
|
-
"data-testid": testId,
|
|
76
|
-
endContent,
|
|
77
|
-
isDisabled,
|
|
78
|
-
isSelected: !!value,
|
|
79
|
-
name,
|
|
80
|
-
onBlur,
|
|
81
|
-
onValueChange: onChange,
|
|
82
|
-
required,
|
|
83
|
-
size,
|
|
84
|
-
startContent,
|
|
85
|
-
thumbIcon,
|
|
86
|
-
value,
|
|
87
|
-
children: [
|
|
88
|
-
label,
|
|
89
|
-
showTestIdCopyButton ? /* @__PURE__ */ jsx(FieldCopyTestIdButton_default, { testId }) : null
|
|
90
|
-
]
|
|
91
|
-
}
|
|
92
|
-
),
|
|
93
|
-
error ? /* @__PURE__ */ jsx("div", { className: classNames.errorMessage, children: /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, getErrorMessageProps()), { children: /* @__PURE__ */ jsx(FieldValidationError_default, { error, testId }) })) }) : null
|
|
94
|
-
] });
|
|
95
|
-
};
|
|
96
|
-
var Switch_default = Switch;
|
|
97
|
-
|
|
98
|
-
// src/Switch/index.ts
|
|
99
|
-
var Switch_default2 = Switch_default;
|
|
100
|
-
|
|
101
|
-
export {
|
|
102
|
-
Switch_default,
|
|
103
|
-
Switch_default2
|
|
104
|
-
};
|
|
105
|
-
//# sourceMappingURL=chunk-DJKC3SR6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Switch/Switch.tsx","../src/Switch/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { SwitchProps as HeroSwitchProps } from '@heroui/switch';\nimport type { ReactNode } from 'react';\nimport type { FieldValues } from 'react-hook-form';\n\nimport { Switch as HeroSwitch } from '@heroui/switch';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useController, useFormContext, useInput } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const switchVariants = tv({\n slots: {\n base: '',\n endContent: '',\n errorMessage: 'ml-1 mt-1',\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 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n outerWrapper: 'place-content-center',\n startContent: '',\n thumb: '',\n thumbIcon: '',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof switchVariants>;\ntype ClassName = TVClassName<typeof switchVariants>;\n\nexport interface SwitchProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** whether the select should be disabled */\n disabled?: boolean;\n /** Icon to be displayed at the end of the switch (when enabled) */\n endContent?: ReactNode;\n /** component displayed next to the switch */\n label?: ReactNode;\n /** name the field is registered under */\n name: string;\n /* Size of the switch */\n size?: 'sm' | 'md' | 'lg';\n /** Icon to be displayed at the start of the switch (when disabled) */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Icon to be displayed inside the thumb */\n thumbIcon?: HeroSwitchProps['thumbIcon'];\n}\n\n/**\n * Switch component based on [HeroUI Switch](https://www.heroui.com//docs/components/switch)\n */\nconst Switch = ({\n className = undefined,\n disabled = false,\n endContent = undefined,\n label: _label = undefined,\n name,\n size = undefined,\n startContent = undefined,\n testId: _testId = undefined,\n thumbIcon = undefined,\n}: SwitchProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, required, testId, invalid } = getFieldState(name, _testId);\n\n const { field } = useController<FieldValues>({ name, control, disabled });\n const { disabled: isDisabled, value, ref, onBlur, onChange } = field;\n\n const { label, getInputProps, getErrorMessageProps } = useInput({\n errorMessage: JSON.stringify(error),\n isInvalid: invalid,\n isRequired: required,\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\n });\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n\n // classNames from slots\n const variants = switchVariants();\n const classNames = variantsToClassNames(variants, className, 'outerWrapper');\n\n return (\n <div className={classNames.outerWrapper}>\n <HeroSwitch\n ref={ref}\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 aria-describedby={getInputProps()['aria-describedby']}\n classNames={classNames}\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n endContent={endContent}\n isDisabled={isDisabled}\n isSelected={!!value}\n name={name}\n onBlur={onBlur}\n onValueChange={onChange}\n required={required}\n size={size}\n startContent={startContent}\n thumbIcon={thumbIcon}\n value={value}\n >\n {label}\n {showTestIdCopyButton ? (\n <FieldCopyTestIdButton testId={testId} />\n ) : null}\n </HeroSwitch>\n {error ? (\n <div className={classNames.errorMessage}>\n <div {...getErrorMessageProps()}>\n <FieldValidationError error={error} testId={testId} />\n </div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Switch;\n","import Switch from './Switch';\n\nexport type { SwitchProps } from './Switch';\n\nexport { Switch };\n\nexport default Switch;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAKA,SAAS,UAAU,kBAAkB;AAErC,SAAS,IAAI,4BAA4B;AAoFnC,SAuBI,KAvBJ;AA9EC,IAAM,iBAAiB,GAAG;AAAA,EAC/B,OAAO;AAAA,IACL,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,cAAc;AAAA;AAAA;AAAA,IAGd,OACE;AAAA,IACF,cAAc;AAAA,IACd,cAAc;AAAA,IACd,OAAO;AAAA,IACP,WAAW;AAAA,IACX,SAAS;AAAA,EACX;AACF,CAAC;AA6BD,IAAM,SAAS,CAAC;AAAA,EACd,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,aAAa;AAAA,EACb,OAAO,SAAS;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,EACP,eAAe;AAAA,EACf,QAAQ,UAAU;AAAA,EAClB,YAAY;AACd,MAAmB;AACjB,QAAM,EAAE,SAAS,WAAW,cAAc,IAAI,eAAe;AAC7D,QAAM,EAAE,OAAO,UAAU,QAAQ,QAAQ,IAAI,cAAc,MAAM,OAAO;AAExE,QAAM,EAAE,MAAM,IAAI,cAA2B,EAAE,MAAM,SAAS,SAAS,CAAC;AACxE,QAAM,EAAE,UAAU,YAAY,OAAO,KAAK,QAAQ,SAAS,IAAI;AAE/D,QAAM,EAAE,OAAO,eAAe,qBAAqB,IAAI,SAAS;AAAA,IAC9D,cAAc,KAAK,UAAU,KAAK;AAAA,IAClC,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,gBAAgB;AAAA,IAChB,aAAa;AAAA,EACf,CAAC;AAED,QAAM,uBAAuB,cAAc;AAG3C,QAAM,WAAW,eAAe;AAChC,QAAM,aAAa,qBAAqB,UAAU,WAAW,cAAc;AAE3E,SACE,qBAAC,SAAI,WAAW,WAAW,cACzB;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QAGA,oBAAkB,cAAc,EAAE,kBAAkB;AAAA,QACpD;AAAA,QACA,gBAAc;AAAA,QACd,iBAAe;AAAA,QACf,eAAa;AAAA,QACb;AAAA,QACA;AAAA,QACA,YAAY,CAAC,CAAC;AAAA,QACd;AAAA,QACA;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,UACA,uBACC,oBAAC,iCAAsB,QAAgB,IACrC;AAAA;AAAA;AAAA,IACN;AAAA,IACC,QACC,oBAAC,SAAI,WAAW,WAAW,cACzB,8BAAC,wCAAQ,qBAAqB,IAA7B,EACC,8BAAC,gCAAqB,OAAc,QAAgB,IACtD,GACF,IACE;AAAA,KACN;AAEJ;AAEA,IAAO,iBAAQ;;;AC1Hf,IAAOA,kBAAQ;","names":["Switch_default"]}
|
package/dist/chunk-HUDJU756.cjs
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunk27MWGFXRcjs = require('./chunk-27MWGFXR.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunk555JRYCScjs = require('./chunk-555JRYCS.cjs');
|
|
9
|
-
|
|
10
|
-
// src/RadioBoxes/RadioBoxes.tsx
|
|
11
|
-
var _radio = require('@heroui/radio');
|
|
12
|
-
var _pixelutils = require('@fuf-stack/pixel-utils');
|
|
13
|
-
|
|
14
|
-
// src/RadioBoxes/RadioBox.tsx
|
|
15
|
-
|
|
16
|
-
var _visuallyhidden = require('@react-aria/visually-hidden');
|
|
17
|
-
|
|
18
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
19
|
-
var RadioBox = (_a) => {
|
|
20
|
-
var _b = _a, { icon = void 0 } = _b, props = _chunk555JRYCScjs.__objRest.call(void 0, _b, ["icon"]);
|
|
21
|
-
const {
|
|
22
|
-
children,
|
|
23
|
-
Component,
|
|
24
|
-
description,
|
|
25
|
-
getBaseProps,
|
|
26
|
-
getControlProps,
|
|
27
|
-
getInputProps,
|
|
28
|
-
getLabelProps,
|
|
29
|
-
getLabelWrapperProps,
|
|
30
|
-
getWrapperProps,
|
|
31
|
-
isDisabled
|
|
32
|
-
} = _radio.useRadio.call(void 0, props);
|
|
33
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
34
|
-
Component,
|
|
35
|
-
_chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getBaseProps()), {
|
|
36
|
-
className: _pixelutils.cn.call(void 0,
|
|
37
|
-
"group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-focus",
|
|
38
|
-
{
|
|
39
|
-
// disabled styles
|
|
40
|
-
"pointer-events-none opacity-disabled": isDisabled
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _visuallyhidden.VisuallyHidden, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "input", _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getInputProps())) }),
|
|
45
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", _chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getWrapperProps()), { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getControlProps())) })),
|
|
46
|
-
icon,
|
|
47
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
48
|
-
"div",
|
|
49
|
-
_chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getLabelWrapperProps()), {
|
|
50
|
-
className: _pixelutils.cn.call(void 0, getLabelWrapperProps().className, "grow"),
|
|
51
|
-
children: [
|
|
52
|
-
children ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", _chunk555JRYCScjs.__spreadProps.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {}, getLabelProps()), { children })) : null,
|
|
53
|
-
description ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-foreground opacity-70 text-small", children: description }) : null
|
|
54
|
-
]
|
|
55
|
-
})
|
|
56
|
-
)
|
|
57
|
-
]
|
|
58
|
-
})
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// src/RadioBoxes/RadioBoxes.tsx
|
|
63
|
-
|
|
64
|
-
var radioBoxesVariants = _pixelutils.tv.call(void 0, {
|
|
65
|
-
slots: {
|
|
66
|
-
base: "group gap-0",
|
|
67
|
-
// Needs group for group-data condition
|
|
68
|
-
itemBase: "",
|
|
69
|
-
itemControl: "bg-focus group-data-[invalid=true]:bg-danger",
|
|
70
|
-
itemDescription: "",
|
|
71
|
-
itemLabel: "text-sm",
|
|
72
|
-
itemLabelWrapper: "",
|
|
73
|
-
itemWrapper: 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid="true"]):not(group-data-[selected="false"])]:border-focus',
|
|
74
|
-
// TODO: get rid of !.
|
|
75
|
-
// see HeroUI styles for group-data condition,
|
|
76
|
-
// e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts
|
|
77
|
-
label: "mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger",
|
|
78
|
-
wrapper: ""
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
var RadioBoxes = (_a) => {
|
|
82
|
-
var _b = _a, {
|
|
83
|
-
className = void 0,
|
|
84
|
-
inline = false,
|
|
85
|
-
name,
|
|
86
|
-
options
|
|
87
|
-
} = _b, uniformFieldProps = _chunk555JRYCScjs.__objRest.call(void 0, _b, [
|
|
88
|
-
"className",
|
|
89
|
-
"inline",
|
|
90
|
-
"name",
|
|
91
|
-
"options"
|
|
92
|
-
]);
|
|
93
|
-
const {
|
|
94
|
-
defaultValue,
|
|
95
|
-
errorMessage,
|
|
96
|
-
invalid,
|
|
97
|
-
disabled,
|
|
98
|
-
label,
|
|
99
|
-
onBlur,
|
|
100
|
-
onChange,
|
|
101
|
-
ref,
|
|
102
|
-
required,
|
|
103
|
-
testId
|
|
104
|
-
} = _chunk27MWGFXRcjs.useUniformField.call(void 0, _chunk555JRYCScjs.__spreadValues.call(void 0, {
|
|
105
|
-
name
|
|
106
|
-
}, uniformFieldProps));
|
|
107
|
-
const variants = radioBoxesVariants();
|
|
108
|
-
const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
|
|
109
|
-
const itemClassNames = {
|
|
110
|
-
base: classNames.itemBase,
|
|
111
|
-
control: classNames.itemControl,
|
|
112
|
-
description: classNames.itemDescription,
|
|
113
|
-
label: classNames.itemLabel,
|
|
114
|
-
labelWrapper: classNames.itemLabelWrapper,
|
|
115
|
-
wrapper: classNames.itemWrapper
|
|
116
|
-
};
|
|
117
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
118
|
-
_radio.RadioGroup,
|
|
119
|
-
{
|
|
120
|
-
ref,
|
|
121
|
-
classNames,
|
|
122
|
-
"data-invalid": invalid,
|
|
123
|
-
"data-required": required,
|
|
124
|
-
"data-testid": testId,
|
|
125
|
-
defaultValue,
|
|
126
|
-
errorMessage,
|
|
127
|
-
isDisabled: disabled,
|
|
128
|
-
isInvalid: invalid,
|
|
129
|
-
isRequired: required,
|
|
130
|
-
label: label ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "legend", { children: label }) : null,
|
|
131
|
-
name,
|
|
132
|
-
onBlur,
|
|
133
|
-
orientation: inline ? "horizontal" : "vertical",
|
|
134
|
-
children: options.map((option) => {
|
|
135
|
-
var _a2, _b2;
|
|
136
|
-
if ("value" in option) {
|
|
137
|
-
const optionTestId = _pixelutils.slugify.call(void 0,
|
|
138
|
-
`${testId}_option_${(_a2 = option.testId) != null ? _a2 : option.value}`,
|
|
139
|
-
{ replaceDots: true }
|
|
140
|
-
);
|
|
141
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
142
|
-
RadioBox,
|
|
143
|
-
{
|
|
144
|
-
classNames: itemClassNames,
|
|
145
|
-
"data-testid": optionTestId,
|
|
146
|
-
description: option.description,
|
|
147
|
-
icon: option.icon,
|
|
148
|
-
isDisabled: !!disabled || option.disabled,
|
|
149
|
-
onChange,
|
|
150
|
-
value: option.value,
|
|
151
|
-
children: (_b2 = option.label) != null ? _b2 : option.value
|
|
152
|
-
},
|
|
153
|
-
option.value
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
})
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
var RadioBoxes_default = RadioBoxes;
|
|
162
|
-
|
|
163
|
-
// src/RadioBoxes/index.ts
|
|
164
|
-
var RadioBoxes_default2 = RadioBoxes_default;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
exports.RadioBoxes_default = RadioBoxes_default; exports.RadioBoxes_default2 = RadioBoxes_default2;
|
|
170
|
-
//# sourceMappingURL=chunk-HUDJU756.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-HUDJU756.cjs","../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/RadioBox.tsx","../src/RadioBoxes/index.ts"],"names":["jsx","_a","_b","RadioBoxes_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACNA,sCAA6C;AAE7C,oDAAkD;ADOlD;AACA;AEVA;AACA,6DAA+B;AAE/B;AAiCQ,+CAAA;AA1BD,IAAM,SAAA,EAAW,CAAC,EAAA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A,EAAQ;AACrB,UAAA,MAAM,aAAA,EAAe,iCAAA;AAAA,YACnB,CAAA,EAAA;AACA,YAAA;AACF,UAAA;AACA,UAAA;AACG,YAAA;AAAA,YAAA;AAAA,cAAA;AAEa,cAAA;AACC,cAAA;AACO,cAAA;AACP,cAAA;AACoB,cAAA;AACjC,cAAA;AACc,cAAA;AAEU,YAAA;AATnB,YAAA;AAUP,UAAA;AAEJ,QAAA;AACA,QAAA;AACD,MAAA;AAAA,IAAA;AACH,EAAA;AAEJ;AAEO;ADaM;AACA;AG5JNC;AH8JM;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-HUDJU756.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks';\n//\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n itemBase: '',\n itemControl: 'bg-focus group-data-[invalid=true]:bg-danger',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper:\n 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid=\"true\"]):not(group-data-[selected=\"false\"])]:border-focus', // TODO: get rid of !.\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 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioBoxesVariants>;\ntype ClassName = TVClassName<typeof radioBoxesVariants>;\n\nexport interface RadioBoxesOption {\n /** Description of the value. Works with variant radioBox. */\n description?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string;\n}\n\nexport interface RadioBoxesProps extends VariantProps {\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioBoxesOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst RadioBoxes = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadioBoxesProps) => {\n const {\n defaultValue,\n errorMessage,\n invalid,\n disabled,\n label,\n onBlur,\n onChange,\n ref,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // classNames from slots\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n const itemClassNames = {\n base: classNames.itemBase,\n control: classNames.itemControl,\n description: classNames.itemDescription,\n label: classNames.itemLabel,\n labelWrapper: classNames.itemLabelWrapper,\n wrapper: classNames.itemWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n classNames={classNames}\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-required={required}\n data-testid={testId}\n defaultValue={defaultValue as string}\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 orientation={inline ? 'horizontal' : 'vertical'}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId ?? option.value}`,\n { replaceDots: true },\n );\n return (\n <RadioBox\n key={option.value}\n classNames={itemClassNames}\n data-testid={optionTestId}\n description={option.description}\n icon={option.icon}\n isDisabled={!!disabled || option.disabled}\n onChange={onChange}\n value={option.value}\n >\n {option.label ?? option.value}\n </RadioBox>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default RadioBoxes;\n","import type { RadioProps as HeroRadioProps } from '@heroui/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface RadioProps extends HeroRadioProps {\n /** icon for the option */\n icon?: ReactNode;\n}\n\nexport const RadioBox = ({ icon = undefined, ...props }: RadioProps) => {\n const {\n children,\n Component,\n description,\n getBaseProps,\n getControlProps,\n getInputProps,\n getLabelProps,\n getLabelWrapperProps,\n getWrapperProps,\n isDisabled,\n } = useRadio(props);\n\n return (\n <Component\n {...getBaseProps()}\n className={cn(\n 'group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-focus',\n {\n // disabled styles\n 'pointer-events-none opacity-disabled': isDisabled,\n },\n )}\n >\n <VisuallyHidden>\n <input {...getInputProps()} />\n </VisuallyHidden>\n <span {...getWrapperProps()}>\n <span {...getControlProps()} />\n </span>\n {icon}\n <div\n {...getLabelWrapperProps()}\n className={cn(getLabelWrapperProps().className, 'grow')}\n >\n {children ? <span {...getLabelProps()}>{children}</span> : null}\n {description ? (\n <span className=\"text-foreground opacity-70 text-small\">\n {description}\n </span>\n ) : null}\n </div>\n </Component>\n );\n};\n\nexport default RadioBox;\n","import RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps } from './RadioBoxes';\n\nexport { RadioBoxes };\n\nexport default RadioBoxes;\n"]}
|