@fuf-stack/uniform 1.22.3 → 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/useUniformFieldArray/index.cjs +4 -4
- package/dist/hooks/useUniformFieldArray/index.cjs.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.js +4 -4
- package/dist/hooks/useUniformFieldArray/index.js.map +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 +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +12 -12
- 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-B4jKGy-P.d.ts +0 -167
- package/dist/index-B4jKGy-P.d.ts.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-BDFJDKmz.d.ts +0 -166
- package/dist/index-BDFJDKmz.d.ts.map +0 -1
- package/dist/index-BE4OAqJ2.d.cts +0 -113
- package/dist/index-BE4OAqJ2.d.cts.map +0 -1
- package/dist/index-BMEKfOWp.d.ts +0 -174
- package/dist/index-BMEKfOWp.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-Bgo2Dr6X.d.cts +0 -174
- package/dist/index-Bgo2Dr6X.d.cts.map +0 -1
- package/dist/index-BmMspnsJ.d.cts +0 -137
- package/dist/index-BmMspnsJ.d.cts.map +0 -1
- package/dist/index-BvbHkoH5.d.cts +0 -290
- package/dist/index-BvbHkoH5.d.cts.map +0 -1
- package/dist/index-C6DBVs7t.d.ts +0 -116
- package/dist/index-C6DBVs7t.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-CSRKNes5.d.cts +0 -167
- package/dist/index-CSRKNes5.d.cts.map +0 -1
- package/dist/index-CbPJiRK2.d.ts +0 -83
- package/dist/index-CbPJiRK2.d.ts.map +0 -1
- package/dist/index-CbQ8Ft4o.d.ts +0 -113
- package/dist/index-CbQ8Ft4o.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-Cz4JaCWd.d.ts +0 -122
- package/dist/index-Cz4JaCWd.d.ts.map +0 -1
- package/dist/index-DBsF7xsq.d.cts +0 -147
- package/dist/index-DBsF7xsq.d.cts.map +0 -1
- package/dist/index-DMOhTl4I.d.cts +0 -116
- package/dist/index-DMOhTl4I.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-GqydEAFk.d.ts +0 -290
- package/dist/index-GqydEAFk.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-Q3BWGyUO.d.cts +0 -122
- package/dist/index-Q3BWGyUO.d.cts.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
export { RadioBoxes, RadioBoxes as default, type RadioBoxesProps, radioBoxVariants };
|
|
1
|
+
import { i as RadioBoxesProps, n as RadioBoxOption, r as RadioBoxes, t as radioBoxVariants } from "../index-clztdahp.js";
|
|
2
|
+
export { type RadioBoxOption, RadioBoxes, RadioBoxes as default, type RadioBoxesProps, radioBoxVariants };
|
package/dist/RadioBoxes/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadioBoxes, r as radioBoxVariants, t as RadioBoxes_default } from "../RadioBoxes-
|
|
1
|
+
import { n as RadioBoxes, r as radioBoxVariants, t as RadioBoxes_default } from "../RadioBoxes-DWxJBTKR.js";
|
|
2
2
|
export { RadioBoxes, RadioBoxes_default as default, radioBoxVariants };
|
|
@@ -107,11 +107,11 @@ const RadioBoxes = ({ className = void 0, inline = false, name, options, ...unif
|
|
|
107
107
|
label: label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: label }) : null,
|
|
108
108
|
name,
|
|
109
109
|
onBlur,
|
|
110
|
-
orientation: inline ? "horizontal" : "vertical",
|
|
111
|
-
value: value != null ? String(value) : "",
|
|
112
110
|
onValueChange: (newValue) => {
|
|
113
111
|
onChange(convertToOriginalType(newValue));
|
|
114
112
|
},
|
|
113
|
+
orientation: inline ? "horizontal" : "vertical",
|
|
114
|
+
value: value != null ? String(value) : "",
|
|
115
115
|
children: options.map((option) => {
|
|
116
116
|
if ("value" in option) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioBox, {
|
|
117
117
|
classNames: boxClassNames,
|
|
@@ -150,4 +150,4 @@ Object.defineProperty(exports, "radioBoxVariants", {
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
|
|
153
|
-
//# sourceMappingURL=RadioBoxes-
|
|
153
|
+
//# sourceMappingURL=RadioBoxes-BmLrbYXt.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioBoxes-BmLrbYXt.cjs","names":["VisuallyHidden","useUniformField","createOptionValueConverter","HeroRadioGroup"],"sources":["../src/RadioBoxes/RadioBox.tsx","../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport 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, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const radioBoxVariants = tv({\n slots: {\n base: '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 control: '',\n description: 'text-foreground opacity-70 text-small',\n icon: '',\n label: '',\n labelWrapper: 'grow',\n },\n variants: {\n isDisabled: {\n true: {\n base: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n base: '!border-danger',\n },\n },\n },\n});\n\ntype ClassName = TVClassName<typeof radioBoxVariants>;\n\nexport interface RadioBoxProps extends Omit<HeroRadioProps, 'className'> {\n /** CSS class name */\n className?: ClassName;\n /** icon for the option */\n icon?: ReactNode;\n /** whether the radio is invalid */\n isInvalid?: boolean;\n}\n\nexport const RadioBox = ({\n classNames: _classNames = undefined,\n icon = undefined,\n isInvalid = false,\n ...props\n}: RadioBoxProps) => {\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 as HeroRadioProps);\n\n // classNames from slots\n const variants = radioBoxVariants({\n isDisabled,\n isInvalid,\n });\n const classNames = variantsToClassNames(\n variants,\n // @ts-expect-error not sure here, but it works\n _classNames,\n 'base',\n );\n\n return (\n <Component {...getBaseProps()} className={classNames.base}>\n <VisuallyHidden>\n <input {...getInputProps()} />\n </VisuallyHidden>\n {!icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div\n {...getLabelWrapperProps()}\n className={cn(\n getLabelWrapperProps().className,\n classNames.labelWrapper,\n )}\n >\n {children ? (\n <span\n {...getLabelProps()}\n className={cn(getLabelProps().className, classNames.label)}\n >\n {children}\n </span>\n ) : null}\n {description ? (\n <div className={classNames.description}>{description}</div>\n ) : null}\n </div>\n {icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n </Component>\n );\n};\n\nexport default RadioBox;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n//\nimport type { RadioBoxProps } from './RadioBox';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n boxBase: '',\n boxControl: '',\n boxDescription: '',\n boxLabel: '',\n boxLabelWrapper: '',\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 RadioBoxOption {\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 | number;\n}\n\nexport interface RadioBoxesProps 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 /** 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: RadioBoxOption[];\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 ariaLabel,\n errorMessage,\n invalid,\n disabled,\n label,\n field: { onBlur, onChange, ref, value },\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n const boxClassNames: RadioBoxProps['classNames'] = {\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\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 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 onValueChange={(newValue) => {\n onChange(convertToOriginalType(newValue));\n }}\n orientation={inline ? 'horizontal' : 'vertical'}\n value={value != null ? String(value) : ''}\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={String(option.value)}\n classNames={boxClassNames}\n data-testid={optionTestId}\n description={option.description}\n icon={option.icon}\n isDisabled={!!disabled || option.disabled}\n isInvalid={invalid}\n value={String(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 RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps, RadioBoxOption } from './RadioBoxes';\n\nexport { radioBoxVariants } from './RadioBox';\n\nexport { RadioBoxes };\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;;AASA,MAAa,oBAAA,GAAA,uBAAA,IAAsB;CACjC,OAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,OAAO;EACP,cAAc;CAChB;CACA,UAAU;EACR,YAAY,EACV,MAAM,EACJ,MAAM,uCACR,EACF;EACA,WAAW,EACT,MAAM,EACJ,MAAM,iBACR,EACF;CACF;AACF,CAAC;AAaD,MAAa,YAAY,EACvB,YAAY,cAAc,KAAA,GAC1B,OAAO,KAAA,GACP,YAAY,OACZ,GAAG,YACgB;CACnB,MAAM,EACJ,UACA,WACA,aACA,cACA,iBACA,eACA,eACA,sBACA,iBACA,gBAAA,GAAA,cAAA,UACW,KAAuB;CAOpC,MAAM,cAAA,GAAA,uBAAA,sBAJW,iBAAiB;EAChC;EACA;CACF,CAES,GAEP,aACA,MACF;CAEA,OACE,iBAAA,GAAA,kBAAA,MAAC,WAAD;EAAW,GAAI,aAAa;EAAG,WAAW,WAAW;YAArD;GACE,iBAAA,GAAA,kBAAA,KAACA,4BAAAA,gBAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,SAAD,EAAO,GAAI,cAAc,EAAI,CAAA,EACf,CAAA;GACf,CAAC,OACA,iBAAA,GAAA,kBAAA,KAAC,QAAD;IAAM,GAAI,gBAAgB;cACxB,iBAAA,GAAA,kBAAA,KAAC,QAAD;KACE,GAAI,gBAAgB;KACpB,YAAA,GAAA,uBAAA,IAAc,gBAAgB,EAAE,WAAW,WAAW,OAAO;IAC9D,CAAA;GACG,CAAA,IACJ;GACH,OAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAW,WAAW;cAAO;GAAU,CAAA,IAAI;GACxD,iBAAA,GAAA,kBAAA,MAAC,OAAD;IACE,GAAI,qBAAqB;IACzB,YAAA,GAAA,uBAAA,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EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,iBAAA,GAAA,kBAAA,KAAC,UAAD,EAAA,UAAS,MAAc,CAAA,IAAI;EACpC;EACE;EACR,gBAAgB,aAAa;GAC3B,SAAS,sBAAsB,QAAQ,CAAC;EAC1C;EACA,aAAa,SAAS,eAAe;EACrC,OAAO,SAAS,OAAO,OAAO,KAAK,IAAI;YAEtC,QAAQ,KAAK,WAAW;GACvB,IAAI,WAAW,QAKb,OACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;IAEE,YAAY;IACZ,gBAAA,GAAA,uBAAA,SAPF,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,KAAK,CAMM;IACxB,aAAa,OAAO;IACpB,MAAM,OAAO;IACb,YAAY,CAAC,CAAC,YAAY,OAAO;IACjC,WAAW;IACX,OAAO,OAAO,OAAO,KAAK;cAEzB,OAAO,SAAS,OAAO;GAChB,GAVH,OAAO,OAAO,KAAK,CAUhB;GAGd,OAAO;EACT,CAAC;CACa,CAAA;AAEpB;;;AChJA,IAAA,qBAAe"}
|
|
@@ -106,11 +106,11 @@ const RadioBoxes = ({ className = void 0, inline = false, name, options, ...unif
|
|
|
106
106
|
label: label ? /* @__PURE__ */ jsx("legend", { children: label }) : null,
|
|
107
107
|
name,
|
|
108
108
|
onBlur,
|
|
109
|
-
orientation: inline ? "horizontal" : "vertical",
|
|
110
|
-
value: value != null ? String(value) : "",
|
|
111
109
|
onValueChange: (newValue) => {
|
|
112
110
|
onChange(convertToOriginalType(newValue));
|
|
113
111
|
},
|
|
112
|
+
orientation: inline ? "horizontal" : "vertical",
|
|
113
|
+
value: value != null ? String(value) : "",
|
|
114
114
|
children: options.map((option) => {
|
|
115
115
|
if ("value" in option) return /* @__PURE__ */ jsx(RadioBox, {
|
|
116
116
|
classNames: boxClassNames,
|
|
@@ -132,4 +132,4 @@ var RadioBoxes_default = RadioBoxes;
|
|
|
132
132
|
//#endregion
|
|
133
133
|
export { RadioBoxes as n, radioBoxVariants as r, RadioBoxes_default as t };
|
|
134
134
|
|
|
135
|
-
//# sourceMappingURL=RadioBoxes-
|
|
135
|
+
//# sourceMappingURL=RadioBoxes-DWxJBTKR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioBoxes-DWxJBTKR.js","names":["HeroRadioGroup"],"sources":["../src/RadioBoxes/RadioBox.tsx","../src/RadioBoxes/RadioBoxes.tsx","../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport 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, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const radioBoxVariants = tv({\n slots: {\n base: '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 control: '',\n description: 'text-foreground opacity-70 text-small',\n icon: '',\n label: '',\n labelWrapper: 'grow',\n },\n variants: {\n isDisabled: {\n true: {\n base: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n base: '!border-danger',\n },\n },\n },\n});\n\ntype ClassName = TVClassName<typeof radioBoxVariants>;\n\nexport interface RadioBoxProps extends Omit<HeroRadioProps, 'className'> {\n /** CSS class name */\n className?: ClassName;\n /** icon for the option */\n icon?: ReactNode;\n /** whether the radio is invalid */\n isInvalid?: boolean;\n}\n\nexport const RadioBox = ({\n classNames: _classNames = undefined,\n icon = undefined,\n isInvalid = false,\n ...props\n}: RadioBoxProps) => {\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 as HeroRadioProps);\n\n // classNames from slots\n const variants = radioBoxVariants({\n isDisabled,\n isInvalid,\n });\n const classNames = variantsToClassNames(\n variants,\n // @ts-expect-error not sure here, but it works\n _classNames,\n 'base',\n );\n\n return (\n <Component {...getBaseProps()} className={classNames.base}>\n <VisuallyHidden>\n <input {...getInputProps()} />\n </VisuallyHidden>\n {!icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div\n {...getLabelWrapperProps()}\n className={cn(\n getLabelWrapperProps().className,\n classNames.labelWrapper,\n )}\n >\n {children ? (\n <span\n {...getLabelProps()}\n className={cn(getLabelProps().className, classNames.label)}\n >\n {children}\n </span>\n ) : null}\n {description ? (\n <div className={classNames.description}>{description}</div>\n ) : null}\n </div>\n {icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n </Component>\n );\n};\n\nexport default RadioBox;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n//\nimport type { RadioBoxProps } from './RadioBox';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n boxBase: '',\n boxControl: '',\n boxDescription: '',\n boxLabel: '',\n boxLabelWrapper: '',\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 RadioBoxOption {\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 | number;\n}\n\nexport interface RadioBoxesProps 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 /** 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: RadioBoxOption[];\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 ariaLabel,\n errorMessage,\n invalid,\n disabled,\n label,\n field: { onBlur, onChange, ref, value },\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n const boxClassNames: RadioBoxProps['classNames'] = {\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\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 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 onValueChange={(newValue) => {\n onChange(convertToOriginalType(newValue));\n }}\n orientation={inline ? 'horizontal' : 'vertical'}\n value={value != null ? String(value) : ''}\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={String(option.value)}\n classNames={boxClassNames}\n data-testid={optionTestId}\n description={option.description}\n icon={option.icon}\n isDisabled={!!disabled || option.disabled}\n isInvalid={invalid}\n value={String(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 RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps, RadioBoxOption } from './RadioBoxes';\n\nexport { radioBoxVariants } from './RadioBox';\n\nexport { RadioBoxes };\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;AASA,MAAa,mBAAmB,GAAG;CACjC,OAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,OAAO;EACP,cAAc;CAChB;CACA,UAAU;EACR,YAAY,EACV,MAAM,EACJ,MAAM,uCACR,EACF;EACA,WAAW,EACT,MAAM,EACJ,MAAM,iBACR,EACF;CACF;AACF,CAAC;AAaD,MAAa,YAAY,EACvB,YAAY,cAAc,KAAA,GAC1B,OAAO,KAAA,GACP,YAAY,OACZ,GAAG,YACgB;CACnB,MAAM,EACJ,UACA,WACA,aACA,cACA,iBACA,eACA,eACA,sBACA,iBACA,eACE,SAAS,KAAuB;CAOpC,MAAM,aAAa,qBAJF,iBAAiB;EAChC;EACA;CACF,CAES,GAEP,aACA,MACF;CAEA,OACE,qBAAC,WAAD;EAAW,GAAI,aAAa;EAAG,WAAW,WAAW;YAArD;GACE,oBAAC,gBAAD,EAAA,UACE,oBAAC,SAAD,EAAO,GAAI,cAAc,EAAI,CAAA,EACf,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AW;EAClB,cAAc,WAAW;CAC3B;CAEA,OACE,oBAACA,YAAD;EACO;EACL,cAAY;EACA;EAGZ,gBAAc;EACd,iBAAe;EACf,eAAa;EACC;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,oBAAC,UAAD,EAAA,UAAS,MAAc,CAAA,IAAI;EACpC;EACE;EACR,gBAAgB,aAAa;GAC3B,SAAS,sBAAsB,QAAQ,CAAC;EAC1C;EACA,aAAa,SAAS,eAAe;EACrC,OAAO,SAAS,OAAO,OAAO,KAAK,IAAI;YAEtC,QAAQ,KAAK,WAAW;GACvB,IAAI,WAAW,QAKb,OACE,oBAAC,UAAD;IAEE,YAAY;IACZ,eARiB,QACnB,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,KAAK,CAMM;IACxB,aAAa,OAAO;IACpB,MAAM,OAAO;IACb,YAAY,CAAC,CAAC,YAAY,OAAO;IACjC,WAAW;IACX,OAAO,OAAO,OAAO,KAAK;cAEzB,OAAO,SAAS,OAAO;GAChB,GAVH,OAAO,OAAO,KAAK,CAUhB;GAGd,OAAO;EACT,CAAC;CACa,CAAA;AAEpB;;;AChJA,IAAA,qBAAe"}
|
package/dist/RadioTabs/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_RadioTabs = require("../RadioTabs-
|
|
5
|
+
const require_RadioTabs = require("../RadioTabs-14XTbTJU.cjs");
|
|
6
6
|
exports.RadioTabs = require_RadioTabs.RadioTabs;
|
|
7
7
|
exports.default = require_RadioTabs.RadioTabs_default;
|
|
8
|
+
exports.radioTabsVariants = require_RadioTabs.radioTabsVariants;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadioTabsProps, t as
|
|
2
|
-
export { RadioTabs, RadioTabs as default, type RadioTabsProps };
|
|
1
|
+
import { i as radioTabsVariants, n as RadioTabs, r as RadioTabsProps, t as RadioTabOption } from "../index-QPDvw5Z5.cjs";
|
|
2
|
+
export { type RadioTabOption, RadioTabs, RadioTabs as default, type RadioTabsProps, radioTabsVariants };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadioTabsProps, t as
|
|
2
|
-
export { RadioTabs, RadioTabs as default, type RadioTabsProps };
|
|
1
|
+
import { i as radioTabsVariants, n as RadioTabs, r as RadioTabsProps, t as RadioTabOption } from "../index-OdNTqjhQ.js";
|
|
2
|
+
export { type RadioTabOption, RadioTabs, RadioTabs as default, type RadioTabsProps, radioTabsVariants };
|
package/dist/RadioTabs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadioTabs, t as RadioTabs_default } from "../RadioTabs-
|
|
2
|
-
export { RadioTabs, RadioTabs_default as default };
|
|
1
|
+
import { n as RadioTabs, r as radioTabsVariants, t as RadioTabs_default } from "../RadioTabs-DAY6MYJI.js";
|
|
2
|
+
export { RadioTabs, RadioTabs_default as default, radioTabsVariants };
|
|
@@ -67,16 +67,21 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
67
67
|
"aria-label": ariaLabel,
|
|
68
68
|
name,
|
|
69
69
|
onBlur,
|
|
70
|
-
value: value ?? "",
|
|
71
70
|
onChange: (e) => {
|
|
72
71
|
onChange(convertToOriginalType(e.target.value));
|
|
73
72
|
},
|
|
74
73
|
onFocus: () => {
|
|
75
74
|
(visualRadioGroupRef.current?.querySelector("[role=\"tab\"]"))?.focus();
|
|
76
|
-
}
|
|
75
|
+
},
|
|
76
|
+
value: value ?? ""
|
|
77
77
|
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_heroui_radio.RadioGroup, {
|
|
78
78
|
ref: visualRadioGroupRef,
|
|
79
79
|
"aria-label": ariaLabel,
|
|
80
|
+
classNames: {
|
|
81
|
+
base: classNames.base,
|
|
82
|
+
label: classNames.label,
|
|
83
|
+
wrapper: classNames.wrapper
|
|
84
|
+
},
|
|
80
85
|
"data-invalid": invalid,
|
|
81
86
|
"data-required": required,
|
|
82
87
|
"data-testid": testId,
|
|
@@ -87,17 +92,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
87
92
|
label: label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", { children: label }) : null,
|
|
88
93
|
name: `${name}_radiotabs`,
|
|
89
94
|
orientation: inline ? "horizontal" : "vertical",
|
|
90
|
-
classNames: {
|
|
91
|
-
base: classNames.base,
|
|
92
|
-
label: classNames.label,
|
|
93
|
-
wrapper: classNames.wrapper
|
|
94
|
-
},
|
|
95
95
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_fuf_stack_pixels_Tabs.default, {
|
|
96
|
-
disabledKeys: disabled ? disabledAllKeys : void 0,
|
|
97
|
-
selectedKey: value != null ? String(value) : "",
|
|
98
|
-
tabs: tabOptions,
|
|
99
|
-
testId,
|
|
100
|
-
variant,
|
|
101
96
|
className: {
|
|
102
97
|
base: classNames.tabBase,
|
|
103
98
|
cursor: classNames.cursor,
|
|
@@ -107,9 +102,14 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
107
102
|
tabList: classNames.tabList,
|
|
108
103
|
tabWrapper: classNames.tabWrapper
|
|
109
104
|
},
|
|
105
|
+
disabledKeys: disabled ? disabledAllKeys : void 0,
|
|
110
106
|
onSelectionChange: (key) => {
|
|
111
107
|
if (key != null) onChange(convertToOriginalType(key));
|
|
112
|
-
}
|
|
108
|
+
},
|
|
109
|
+
tabs: tabOptions,
|
|
110
|
+
testId,
|
|
111
|
+
variant,
|
|
112
|
+
selectedKey: value != null ? String(value) : ""
|
|
113
113
|
})
|
|
114
114
|
})] });
|
|
115
115
|
};
|
|
@@ -129,5 +129,11 @@ Object.defineProperty(exports, "RadioTabs_default", {
|
|
|
129
129
|
return RadioTabs_default;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
|
+
Object.defineProperty(exports, "radioTabsVariants", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return radioTabsVariants;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
132
138
|
|
|
133
|
-
//# sourceMappingURL=RadioTabs-
|
|
139
|
+
//# sourceMappingURL=RadioTabs-14XTbTJU.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioTabs-14XTbTJU.cjs","names":["useUniformField","createOptionValueConverter","VisuallyHidden","HeroRadioGroup","Tabs"],"sources":["../src/RadioTabs/RadioTabs.tsx","../src/RadioTabs/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n cursor: '',\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n tab: '',\n tabBase: '',\n tabContent: '',\n tabList: '',\n tabPanel: 'p-3',\n tabWrapper: '',\n wrapper: '',\n },\n variants: {\n hasContent: {\n true: {\n base: '',\n tabBase: 'p-1',\n tabWrapper: [\n // border style\n 'rounded-medium border border-divider',\n // full width\n 'w-full',\n ],\n },\n },\n fullWidth: {\n true: {\n tabWrapper: 'w-full',\n },\n },\n isInvalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabOption {\n /** Optional content inside of the tab */\n content?: 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 | number | boolean;\n}\n\nexport interface RadioTabsProps extends Omit<VariantProps, 'hasContent'> {\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 /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** Whether tabs should take up full container width */\n fullWidth?: 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: RadioTabOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n fullWidth = false,\n inline = false,\n name,\n options,\n variant = undefined,\n ...uniformFieldProps\n}: RadioTabsProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create a ref for the visual radio group to forward focus\n const visualRadioGroupRef = useRef<HTMLDivElement>(null);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const tabOptions = options.map<TabProps>((option) => {\n return {\n content: option?.content,\n disabled: option?.disabled,\n // Tabs component uses string keys internally\n key: String(option.value),\n label: option?.label ?? option?.value,\n testId: slugify(`option_${option?.testId ?? option?.value}`, {\n replaceDots: true,\n }),\n };\n });\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map((option) => {\n return option.key as string;\n });\n\n // check if any option has content\n // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async\n const hasContent = options.some((option) => {\n return option.content;\n });\n\n // classNames from slots\n const variants = radioTabsVariants({\n fullWidth,\n hasContent,\n isInvalid: invalid,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <>\n {/* Visually hidden input for React Hook Form focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n name={name}\n onBlur={onBlur}\n onChange={(e) => {\n onChange(convertToOriginalType(e.target.value));\n }}\n onFocus={() => {\n // Forward focus to the first tab when RHF focuses this input\n const firstTab = visualRadioGroupRef.current?.querySelector(\n '[role=\"tab\"]',\n ) as HTMLElement;\n firstTab?.focus();\n }}\n value={value ?? ''}\n />\n </VisuallyHidden>\n\n <HeroRadioGroup\n ref={visualRadioGroupRef}\n aria-label={ariaLabel}\n classNames={{\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n }}\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 errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={`${name}_radiotabs`}\n orientation={inline ? 'horizontal' : 'vertical'}\n >\n <Tabs\n className={{\n base: classNames.tabBase,\n cursor: classNames.cursor,\n panel: classNames.tabPanel,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n tabList: classNames.tabList,\n tabWrapper: classNames.tabWrapper,\n }}\n disabledKeys={disabled ? disabledAllKeys : undefined}\n onSelectionChange={(key) => {\n if (key != null) {\n onChange(convertToOriginalType(key));\n }\n }}\n tabs={tabOptions}\n testId={testId}\n variant={variant}\n // make sure component is controlled (convert to string for Tabs)\n selectedKey={value != null ? String(value) : ''}\n />\n </HeroRadioGroup>\n </>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps, RadioTabOption } from './RadioTabs';\n\nexport { radioTabsVariants } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,qBAAA,GAAA,uBAAA,IAAuB;CAClC,OAAO;EACL,MAAM;EACN,QAAQ;EACR,OACE;EACF,KAAK;EACL,SAAS;EACT,YAAY;EACZ,SAAS;EACT,UAAU;EACV,YAAY;EACZ,SAAS;CACX;CACA,UAAU;EACR,YAAY,EACV,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,CAEV,wCAEA,QACF;EACF,EACF;EACA,WAAW,EACT,MAAM,EACJ,YAAY,SACd,EACF;EACA,WAAW,EACT,MAAM,EACJ,YAAY,yCACd,EACF;CACF;AACF,CAAC;;;;;AA+CD,MAAM,aAAa,EACjB,YAAY,KAAA,GACZ,YAAY,OACZ,SAAS,OACT,MACA,SACA,UAAU,KAAA,GACV,GAAG,wBAC+B;CAClC,MAAM,EACJ,WACA,UACA,cACA,OAAO,EAAE,QAAQ,UAAU,KAAK,SAChC,SACA,OACA,UACA,WACEA,oCAAAA,gBAAgB;EAClB;EACA,GAAG;CACL,CAAC;CAGD,MAAM,uBAAA,GAAA,MAAA,QAA6C,IAAI;CAGvD,MAAM,EAAE,0BAA0BC,sBAAAA,2BAA2B,OAAO;CAEpE,MAAM,aAAa,QAAQ,KAAe,WAAW;EACnD,OAAO;GACL,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAElB,KAAK,OAAO,OAAO,KAAK;GACxB,OAAO,QAAQ,SAAS,QAAQ;GAChC,SAAA,GAAA,uBAAA,SAAgB,UAAU,QAAQ,UAAU,QAAQ,SAAS,EAC3D,aAAa,KACf,CAAC;EACH;CACF,CAAC;CAED,MAAM,kBAAwC,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Aa,SAAS,OAAO,OAAO,KAAK,IAAI;EAC9C,CAAA;CACa,CAAA,CAChB,EAAA,CAAA;AAEN;;;AC9NA,IAAA,oBAAe"}
|
|
@@ -65,16 +65,21 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
65
65
|
"aria-label": ariaLabel,
|
|
66
66
|
name,
|
|
67
67
|
onBlur,
|
|
68
|
-
value: value ?? "",
|
|
69
68
|
onChange: (e) => {
|
|
70
69
|
onChange(convertToOriginalType(e.target.value));
|
|
71
70
|
},
|
|
72
71
|
onFocus: () => {
|
|
73
72
|
(visualRadioGroupRef.current?.querySelector("[role=\"tab\"]"))?.focus();
|
|
74
|
-
}
|
|
73
|
+
},
|
|
74
|
+
value: value ?? ""
|
|
75
75
|
}) }), /* @__PURE__ */ jsx(RadioGroup, {
|
|
76
76
|
ref: visualRadioGroupRef,
|
|
77
77
|
"aria-label": ariaLabel,
|
|
78
|
+
classNames: {
|
|
79
|
+
base: classNames.base,
|
|
80
|
+
label: classNames.label,
|
|
81
|
+
wrapper: classNames.wrapper
|
|
82
|
+
},
|
|
78
83
|
"data-invalid": invalid,
|
|
79
84
|
"data-required": required,
|
|
80
85
|
"data-testid": testId,
|
|
@@ -85,17 +90,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
85
90
|
label: label ? /* @__PURE__ */ jsx("legend", { children: label }) : null,
|
|
86
91
|
name: `${name}_radiotabs`,
|
|
87
92
|
orientation: inline ? "horizontal" : "vertical",
|
|
88
|
-
classNames: {
|
|
89
|
-
base: classNames.base,
|
|
90
|
-
label: classNames.label,
|
|
91
|
-
wrapper: classNames.wrapper
|
|
92
|
-
},
|
|
93
93
|
children: /* @__PURE__ */ jsx(Tabs, {
|
|
94
|
-
disabledKeys: disabled ? disabledAllKeys : void 0,
|
|
95
|
-
selectedKey: value != null ? String(value) : "",
|
|
96
|
-
tabs: tabOptions,
|
|
97
|
-
testId,
|
|
98
|
-
variant,
|
|
99
94
|
className: {
|
|
100
95
|
base: classNames.tabBase,
|
|
101
96
|
cursor: classNames.cursor,
|
|
@@ -105,9 +100,14 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
105
100
|
tabList: classNames.tabList,
|
|
106
101
|
tabWrapper: classNames.tabWrapper
|
|
107
102
|
},
|
|
103
|
+
disabledKeys: disabled ? disabledAllKeys : void 0,
|
|
108
104
|
onSelectionChange: (key) => {
|
|
109
105
|
if (key != null) onChange(convertToOriginalType(key));
|
|
110
|
-
}
|
|
106
|
+
},
|
|
107
|
+
tabs: tabOptions,
|
|
108
|
+
testId,
|
|
109
|
+
variant,
|
|
110
|
+
selectedKey: value != null ? String(value) : ""
|
|
111
111
|
})
|
|
112
112
|
})] });
|
|
113
113
|
};
|
|
@@ -115,6 +115,6 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
|
|
|
115
115
|
//#region src/RadioTabs/index.ts
|
|
116
116
|
var RadioTabs_default = RadioTabs;
|
|
117
117
|
//#endregion
|
|
118
|
-
export { RadioTabs as n, RadioTabs_default as t };
|
|
118
|
+
export { RadioTabs as n, radioTabsVariants as r, RadioTabs_default as t };
|
|
119
119
|
|
|
120
|
-
//# sourceMappingURL=RadioTabs-
|
|
120
|
+
//# sourceMappingURL=RadioTabs-DAY6MYJI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioTabs-DAY6MYJI.js","names":["HeroRadioGroup"],"sources":["../src/RadioTabs/RadioTabs.tsx","../src/RadioTabs/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabsProps } from '@fuf-stack/pixels';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radioTabsVariants = tv({\n slots: {\n base: 'group gap-0', // Needs group for group-data condition\n cursor: '',\n label:\n 'mb-2 inline-flex text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n tab: '',\n tabBase: '',\n tabContent: '',\n tabList: '',\n tabPanel: 'p-3',\n tabWrapper: '',\n wrapper: '',\n },\n variants: {\n hasContent: {\n true: {\n base: '',\n tabBase: 'p-1',\n tabWrapper: [\n // border style\n 'rounded-medium border border-divider',\n // full width\n 'w-full',\n ],\n },\n },\n fullWidth: {\n true: {\n tabWrapper: 'w-full',\n },\n },\n isInvalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n },\n});\n\ntype VariantProps = TVProps<typeof radioTabsVariants>;\ntype ClassName = TVClassName<typeof radioTabsVariants>;\n\nexport interface RadioTabOption {\n /** Optional content inside of the tab */\n content?: 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 | number | boolean;\n}\n\nexport interface RadioTabsProps extends Omit<VariantProps, 'hasContent'> {\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 /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** Whether tabs should take up full container width */\n fullWidth?: 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: RadioTabOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioTabs should look like. */\n variant?: TabsProps['variant'];\n}\n\n/**\n * RadioTabs component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)\n */\nconst RadioTabs = ({\n className = undefined,\n fullWidth = false,\n inline = false,\n name,\n options,\n variant = undefined,\n ...uniformFieldProps\n}: RadioTabsProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create a ref for the visual radio group to forward focus\n const visualRadioGroupRef = useRef<HTMLDivElement>(null);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const tabOptions = options.map<TabProps>((option) => {\n return {\n content: option?.content,\n disabled: option?.disabled,\n // Tabs component uses string keys internally\n key: String(option.value),\n label: option?.label ?? option?.value,\n testId: slugify(`option_${option?.testId ?? option?.value}`, {\n replaceDots: true,\n }),\n };\n });\n\n const disabledAllKeys: string[] | undefined = tabOptions?.map((option) => {\n return option.key as string;\n });\n\n // check if any option has content\n // eslint-disable-next-line @typescript-eslint/no-misused-promises, @typescript-eslint/promise-function-async\n const hasContent = options.some((option) => {\n return option.content;\n });\n\n // classNames from slots\n const variants = radioTabsVariants({\n fullWidth,\n hasContent,\n isInvalid: invalid,\n });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <>\n {/* Visually hidden input for React Hook Form focus management */}\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={ariaLabel}\n name={name}\n onBlur={onBlur}\n onChange={(e) => {\n onChange(convertToOriginalType(e.target.value));\n }}\n onFocus={() => {\n // Forward focus to the first tab when RHF focuses this input\n const firstTab = visualRadioGroupRef.current?.querySelector(\n '[role=\"tab\"]',\n ) as HTMLElement;\n firstTab?.focus();\n }}\n value={value ?? ''}\n />\n </VisuallyHidden>\n\n <HeroRadioGroup\n ref={visualRadioGroupRef}\n aria-label={ariaLabel}\n classNames={{\n base: classNames.base,\n label: classNames.label,\n wrapper: classNames.wrapper,\n }}\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 errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={`${name}_radiotabs`}\n orientation={inline ? 'horizontal' : 'vertical'}\n >\n <Tabs\n className={{\n base: classNames.tabBase,\n cursor: classNames.cursor,\n panel: classNames.tabPanel,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n tabList: classNames.tabList,\n tabWrapper: classNames.tabWrapper,\n }}\n disabledKeys={disabled ? disabledAllKeys : undefined}\n onSelectionChange={(key) => {\n if (key != null) {\n onChange(convertToOriginalType(key));\n }\n }}\n tabs={tabOptions}\n testId={testId}\n variant={variant}\n // make sure component is controlled (convert to string for Tabs)\n selectedKey={value != null ? String(value) : ''}\n />\n </HeroRadioGroup>\n </>\n );\n};\n\nexport default RadioTabs;\n","import RadioTabs from './RadioTabs';\n\nexport type { RadioTabsProps, RadioTabOption } from './RadioTabs';\n\nexport { radioTabsVariants } from './RadioTabs';\n\nexport { RadioTabs };\n\nexport default RadioTabs;\n"],"mappings":";;;;;;;;;AAgBA,MAAa,oBAAoB,GAAG;CAClC,OAAO;EACL,MAAM;EACN,QAAQ;EACR,OACE;EACF,KAAK;EACL,SAAS;EACT,YAAY;EACZ,SAAS;EACT,UAAU;EACV,YAAY;EACZ,SAAS;CACX;CACA,UAAU;EACR,YAAY,EACV,MAAM;GACJ,MAAM;GACN,SAAS;GACT,YAAY,CAEV,wCAEA,QACF;EACF,EACF;EACA,WAAW,EACT,MAAM,EACJ,YAAY,SACd,EACF;EACA,WAAW,EACT,MAAM,EACJ,YAAY,yCACd,EACF;CACF;AACF,CAAC;;;;;AA+CD,MAAM,aAAa,EACjB,YAAY,KAAA,GACZ,YAAY,OACZ,SAAS,OACT,MACA,SACA,UAAU,KAAA,GACV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AAa,SAAS,eAAe;YAErC,oBAAC,MAAD;GACE,WAAW;IACT,MAAM,WAAW;IACjB,QAAQ,WAAW;IACnB,OAAO,WAAW;IAClB,KAAK,WAAW;IAChB,YAAY,WAAW;IACvB,SAAS,WAAW;IACpB,YAAY,WAAW;GACzB;GACA,cAAc,WAAW,kBAAkB,KAAA;GAC3C,oBAAoB,QAAQ;IAC1B,IAAI,OAAO,MACT,SAAS,sBAAsB,GAAG,CAAC;GAEvC;GACA,MAAM;GACE;GACC;GAET,aAAa,SAAS,OAAO,OAAO,KAAK,IAAI;EAC9C,CAAA;CACa,CAAA,CAChB,EAAA,CAAA;AAEN;;;AC9NA,IAAA,oBAAe"}
|
package/dist/Radios/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_Radios = require("../Radios-
|
|
5
|
+
const require_Radios = require("../Radios-D_B9Y8s2.cjs");
|
|
6
6
|
exports.Radios = require_Radios.Radios;
|
|
7
7
|
exports.default = require_Radios.Radios_default;
|
|
8
|
+
exports.radiosVariants = require_Radios.radiosVariants;
|
package/dist/Radios/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadiosProps, t as
|
|
2
|
-
export { Radios, Radios as default, type RadiosProps };
|
|
1
|
+
import { i as radiosVariants, n as Radios, r as RadiosProps, t as RadioOption } from "../index-CqXEYILn.cjs";
|
|
2
|
+
export { type RadioOption, Radios, Radios as default, type RadiosProps, radiosVariants };
|
package/dist/Radios/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RadiosProps, t as
|
|
2
|
-
export { Radios, Radios as default, type RadiosProps };
|
|
1
|
+
import { i as radiosVariants, n as Radios, r as RadiosProps, t as RadioOption } from "../index-DCwffq1f.js";
|
|
2
|
+
export { type RadioOption, Radios, Radios as default, type RadiosProps, radiosVariants };
|
package/dist/Radios/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Radios, t as Radios_default } from "../Radios-
|
|
2
|
-
export { Radios, Radios_default as default };
|
|
1
|
+
import { n as Radios, r as radiosVariants, t as Radios_default } from "../Radios-C938-msm.js";
|
|
2
|
+
export { Radios, Radios_default as default, radiosVariants };
|
|
@@ -68,6 +68,6 @@ const Radios = ({ className = void 0, inline = false, name, options, ...uniformF
|
|
|
68
68
|
//#region src/Radios/index.ts
|
|
69
69
|
var Radios_default = Radios;
|
|
70
70
|
//#endregion
|
|
71
|
-
export { Radios as n, Radios_default as t };
|
|
71
|
+
export { Radios as n, radiosVariants as r, Radios_default as t };
|
|
72
72
|
|
|
73
|
-
//# sourceMappingURL=Radios-
|
|
73
|
+
//# sourceMappingURL=Radios-C938-msm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radios-
|
|
1
|
+
{"version":3,"file":"Radios-C938-msm.js","names":["HeroRadioGroup","HeroRadio"],"sources":["../src/Radios/Radios.tsx","../src/Radios/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport {\n Radio as HeroRadio,\n RadioGroup as HeroRadioGroup,\n} from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radiosVariants = tv({\n slots: {\n // Needs group for group-data condition\n base: 'group gap-0',\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',\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 radiosVariants>;\ntype ClassName = TVClassName<typeof radiosVariants>;\n\nexport interface RadioOption {\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 | number;\n}\n\nexport interface RadiosProps 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 /** 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: RadioOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * Radios component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst Radios = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadiosProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radiosVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\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 aria-label={ariaLabel}\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 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 value={value != null ? String(value) : ''}\n onValueChange={(newValue) => {\n onChange(convertToOriginalType(newValue));\n }}\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 <HeroRadio\n key={String(option.value)}\n classNames={itemClassNames}\n data-testid={optionTestId}\n isDisabled={!!disabled || option.disabled}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </HeroRadio>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default Radios;\n","import Radios from './Radios';\n\nexport type { RadiosProps, RadioOption } from './Radios';\n\nexport { radiosVariants } from './Radios';\n\nexport { Radios };\n\nexport default Radios;\n"],"mappings":";;;;;;AAaA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;CAEL,MAAM;CACN,UAAU;CACV,aAAa;CACb,iBAAiB;CACjB,WAAW;CACX,kBAAkB;CAClB,aACE;CAEF,OACE;CACF,SAAS;AACX,EACF,CAAC;;;;AAwCD,MAAM,UAAU,EACd,YAAY,KAAA,GACZ,SAAS,OACT,MACA,SACA,GAAG,wBAC4B;CAC/B,MAAM,EACJ,WACA,UACA,cACA,OAAO,EAAE,QAAQ,UAAU,KAAK,SAChC,SACA,OACA,UACA,WACE,gBAAgB;EAClB;EACA,GAAG;CACL,CAAC;CAGD,MAAM,EAAE,0BAA0B,2BAA2B,OAAO;CAIpE,MAAM,aAAa,qBADF,eAC8B,GAAG,WAAW,MAAM;CAEnE,MAAM,iBAAiB;EACrB,MAAM,WAAW;EACjB,SAAS,WAAW;EACpB,aAAa,WAAW;EACxB,OAAO,WAAW;EAClB,cAAc,WAAW;EACzB,SAAS,WAAW;CACtB;CAEA,OACE,oBAACA,YAAD;EACO;EACL,cAAY;EACA;EAGZ,gBAAc;EACd,iBAAe;EACf,eAAa;EACC;EACd,YAAY;EACZ,WAAW;EACX,YAAY;EACZ,OAAO,QAAQ,oBAAC,UAAD,EAAA,UAAS,MAAc,CAAA,IAAI;EACpC;EACE;EACR,aAAa,SAAS,eAAe;EACrC,OAAO,SAAS,OAAO,OAAO,KAAK,IAAI;EACvC,gBAAgB,aAAa;GAC3B,SAAS,sBAAsB,QAAQ,CAAC;EAC1C;YAEC,QAAQ,KAAK,WAAW;GACvB,IAAI,WAAW,QAKb,OACE,oBAACC,OAAD;IAEE,YAAY;IACZ,eARiB,QACnB,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,KAAK,CAMM;IACxB,YAAY,CAAC,CAAC,YAAY,OAAO;IACjC,OAAO,OAAO,OAAO,KAAK;cAEzB,OAAO,SAAS,OAAO;GACf,GAPJ,OAAO,OAAO,KAAK,CAOf;GAGf,OAAO;EACT,CAAC;CACa,CAAA;AAEpB;;;AC/IA,IAAA,iBAAe"}
|
|
@@ -81,5 +81,11 @@ Object.defineProperty(exports, "Radios_default", {
|
|
|
81
81
|
return Radios_default;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "radiosVariants", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function() {
|
|
87
|
+
return radiosVariants;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
84
90
|
|
|
85
|
-
//# sourceMappingURL=Radios-
|
|
91
|
+
//# sourceMappingURL=Radios-D_B9Y8s2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radios-
|
|
1
|
+
{"version":3,"file":"Radios-D_B9Y8s2.cjs","names":["useUniformField","createOptionValueConverter","HeroRadioGroup","HeroRadio"],"sources":["../src/Radios/Radios.tsx","../src/Radios/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport {\n Radio as HeroRadio,\n RadioGroup as HeroRadioGroup,\n} from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const radiosVariants = tv({\n slots: {\n // Needs group for group-data condition\n base: 'group gap-0',\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',\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 radiosVariants>;\ntype ClassName = TVClassName<typeof radiosVariants>;\n\nexport interface RadioOption {\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 | number;\n}\n\nexport interface RadiosProps 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 /** 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: RadioOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * Radios component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst Radios = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadiosProps): ReactElement => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radiosVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\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 aria-label={ariaLabel}\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 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 value={value != null ? String(value) : ''}\n onValueChange={(newValue) => {\n onChange(convertToOriginalType(newValue));\n }}\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 <HeroRadio\n key={String(option.value)}\n classNames={itemClassNames}\n data-testid={optionTestId}\n isDisabled={!!disabled || option.disabled}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </HeroRadio>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default Radios;\n","import Radios from './Radios';\n\nexport type { RadiosProps, RadioOption } from './Radios';\n\nexport { radiosVariants } from './Radios';\n\nexport { Radios };\n\nexport default Radios;\n"],"mappings":";;;;;;;AAaA,MAAa,kBAAA,GAAA,uBAAA,IAAoB,EAC/B,OAAO;CAEL,MAAM;CACN,UAAU;C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GAPJ,OAAO,OAAO,KAAK,CAOf;GAGf,OAAO;EACT,CAAC;CACa,CAAA;AAEpB;;;AC/IA,IAAA,iBAAe"}
|
package/dist/Select/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_Select = require("../Select-
|
|
5
|
+
const require_Select = require("../Select-D66A-hYm.cjs");
|
|
6
6
|
exports.Select = require_Select.Select;
|
|
7
7
|
exports.default = require_Select.Select_default;
|
|
8
|
+
exports.selectVariants = require_Select.selectVariants;
|
package/dist/Select/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SelectProps, t as Select } from "../index-
|
|
2
|
-
export { Select, Select as default, type SelectProps };
|
|
1
|
+
import { i as selectVariants, n as SelectOption, r as SelectProps, t as Select } from "../index-veBM95Gw.cjs";
|
|
2
|
+
export { Select, Select as default, type SelectOption, type SelectProps, selectVariants };
|
package/dist/Select/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SelectProps, t as Select } from "../index-
|
|
2
|
-
export { Select, Select as default, type SelectProps };
|
|
1
|
+
import { i as selectVariants, n as SelectOption, r as SelectProps, t as Select } from "../index-D1cB3mbB.js";
|
|
2
|
+
export { Select, Select as default, type SelectOption, type SelectProps, selectVariants };
|
package/dist/Select/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as Select, t as Select_default } from "../Select-
|
|
2
|
-
export { Select, Select_default as default };
|
|
1
|
+
import { n as Select, r as selectVariants, t as Select_default } from "../Select-BL6k_e-D.js";
|
|
2
|
+
export { Select, Select_default as default, selectVariants };
|
|
@@ -278,6 +278,6 @@ const Select = ({ className = void 0, clearable = true, debugMenuOpen = false, f
|
|
|
278
278
|
//#region src/Select/index.ts
|
|
279
279
|
var Select_default = Select;
|
|
280
280
|
//#endregion
|
|
281
|
-
export { Select as n, Select_default as t };
|
|
281
|
+
export { Select as n, selectVariants as r, Select_default as t };
|
|
282
282
|
|
|
283
|
-
//# sourceMappingURL=Select-
|
|
283
|
+
//# sourceMappingURL=Select-BL6k_e-D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Select-BL6k_e-D.js","names":[],"sources":["../src/Select/Select.tsx","../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\nimport type { MultiValue, Props, SingleValue } from 'react-select';\n\nimport { useState } from 'react';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@heroui/select';\n\nimport { cn, slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter, isValueEmpty } from '../helpers';\nimport { useFormContext } from '../hooks/useFormContext';\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group leading-normal',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'duration-150! rounded-lg border-2 border-default-200 bg-content1 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-focus',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-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 'pointer-events-auto relative bottom-1.5 ml-1 text-foreground subpixel-antialiased text-small group-data-[invalid=true]:!text-danger',\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: 'z-50!',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_disabled:\n 'cursor-not-allowed! hover:cursor-not-allowed! opacity-disabled',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n});\n\nexport interface SelectOption {\n /** set option to disabled state */\n disabled?: boolean;\n /**\n * True when option was auto-generated because the value wasn't found in options.\n * Use in renderOptionLabel to render a component that fetches the real label.\n */\n isFallback?: boolean;\n /** option label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps 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; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Force menu open for debugging or visual testing. */\n debugMenuOpen?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** The options for the Select component */\n options: SelectOption[];\n /** Render custom content when no options match the current search input. */\n renderEmptyOptions?: Props['noOptionsMessage'];\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /**\n * Fallback option(s) for async selects when value isn't in current options.\n * Use when the selected value may not be in the options list (e.g., after\n * search results change). Used only if value not found in options.\n * For single select: pass the option object or undefined\n * For multi-select: pass an array of option objects\n */\n selectedOptionFallback?: SelectOption | SelectOption[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst ControlComponent: typeof components.Control = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n return (\n <div data-testid={testId}>\n <components.Control {...props} />\n </div>\n );\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n const { isDisabled } = props;\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div aria-disabled={isDisabled ? true : undefined} data-testid={testId}>\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [HeroUI Select](https://www.heroui.com//docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n debugMenuOpen = false,\n filterOption = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n renderEmptyOptions = undefined,\n renderOptionLabel = undefined,\n selectedOptionFallback = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const {\n ariaLabel,\n disabled,\n errorMessage,\n field: { onBlur, onChange, ref, value },\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n invalid,\n label,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Get getFieldState to check isTouched in onChange callback\n const { getFieldState } = useFormContext();\n\n // Track if the select is focused\n const [isFocused, setIsFocused] = useState(false);\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n // React-select classNames configuration\n const reactSelectClassNames = {\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n input: () => {\n return classNames.input;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(classNames.multiValueLabel, `${getValueProps().className}`);\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isDisabled: optionIsDisabled,\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }: {\n isDisabled: boolean;\n isFocused: boolean;\n isSelected: boolean;\n }) => {\n return cn(classNames.option, {\n [classNames.option_disabled]: optionIsDisabled,\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.singleValue, `${getValueProps().className}`);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n };\n\n const { getBaseProps, getTriggerProps, getValueProps } = useSelect({\n children: [],\n classNames,\n errorMessage,\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label,\n labelPlacement: 'outside',\n });\n\n // react-select expects `isDisabled`, while our option contract uses `disabled`.\n const reactSelectOptions = options.map((option) => {\n return {\n ...option,\n isDisabled: option.disabled,\n };\n });\n\n // Compute selected option(s) for react-select\n //\n // Priority for finding options:\n // 1. Look in current options list\n // 2. Use selectedOptionFallback prop (for async selects with pre-fetched data)\n // 3. Create fallback with value as label\n //\n // Handles edge cases:\n // - Compares as strings to support both string and number values\n // - Returns null for empty single-select (required by react-select to clear)\n // - Creates fallback options when value exists but isn't in options list\n // (common with async selects where options change after selection)\n const reactSelectValue = (() => {\n // Helper to find option by value\n const findOption = (v: string | number): SelectOption => {\n // First, look in options list\n const inOptions = options.find((option) => {\n return String(option.value) === String(v);\n });\n if (inOptions) {\n return inOptions;\n }\n\n // Second, look in selectedOptionFallback prop (for async selects)\n if (selectedOptionFallback) {\n if (Array.isArray(selectedOptionFallback)) {\n const inSelected = selectedOptionFallback.find((option) => {\n return String(option.value) === String(v);\n });\n if (inSelected) {\n return inSelected;\n }\n } else if (String(selectedOptionFallback.value) === String(v)) {\n return selectedOptionFallback;\n }\n }\n\n // Fallback: create option with value as label, marked as fallback\n return { isFallback: true, label: String(v), value: v };\n };\n\n if (multiSelect) {\n if (!Array.isArray(value) || isValueEmpty(value)) {\n return [];\n }\n return value.map((v) => {\n return findOption(v);\n });\n }\n\n // Single select - use isValueEmpty to handle marker strings (__NULL__, etc.)\n if (isValueEmpty(value)) {\n return null;\n }\n return findOption(value);\n })();\n\n // Handle selection change\n const handleChange = (\n option: MultiValue<SelectOption> | SingleValue<SelectOption>,\n ) => {\n if (multiSelect) {\n onChange(\n (option as SelectOption[])?.map((_option) => {\n return convertToOriginalType(_option.value);\n }),\n );\n } else {\n const newValue = (option as SelectOption)?.value;\n // Pass null explicitly when clearing (not undefined)\n onChange(newValue != null ? convertToOriginalType(newValue) : null);\n }\n\n // Mark field as touched immediately when a selection is made if not already touched\n // This ensures validation errors show right away (isTouched becomes true)\n // For Select components, selecting an option is a complete user action\n // (unlike text inputs where typing is ongoing), so we mark as touched immediately\n const { isTouched: currentIsTouched } = getFieldState(name, testId);\n if (!currentIsTouched) {\n // Defer blur/touched notification until after the onChange value commit.\n // This prevents \"one render cycle behind\" validation states where blur\n // validation runs against the previous value.\n queueMicrotask(() => {\n onBlur();\n });\n }\n };\n\n // Handle blur event\n const handleBlur = () => {\n setIsFocused(false);\n onBlur();\n };\n\n // Handle focus event\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n return (\n <div\n {...getBaseProps()}\n className={cn(classNames.base)}\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-required={required}\n data-testid={`${testId}_wrapper`}\n >\n {label ? (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n {required ? (\n <span aria-hidden className=\"ml-0.5 text-danger\">\n *\n </span>\n ) : null}\n </label>\n ) : null}\n <ReactSelect\n ref={ref}\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={ariaLabel}\n // set aria-labelledby to the label id so that the select is accessible\n aria-labelledby={\n label\n ? getTriggerProps()['aria-labelledby']?.split(' ')[1]\n : undefined\n }\n classNames={reactSelectClassNames}\n components={{\n Control: ControlComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n Input: InputComponent,\n Option: OptionComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n menuIsOpen={debugMenuOpen ? true : undefined}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n name={name}\n noOptionsMessage={renderEmptyOptions}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onInputChange={onInputChange}\n options={reactSelectOptions}\n placeholder={placeholder}\n unstyled\n value={reactSelectValue}\n />\n {invalid ? (\n <div {...getHelperWrapperProps()}>\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps, SelectOption } from './Select';\n\nexport { selectVariants } from './Select';\n\nexport { Select };\n\nexport default Select;\n"],"mappings":";;;;;;;;;AAeA,MAAa,iBAAiB,GAAG,EAC/B,OAAO;CACL,MAAM;CACN,gBACE;CACF,SACE;CACF,iBAAiB;CACjB,WAAW;CACX,aAAa;CACb,mBACE;CACF,OAAO;CACP,cAAc;CACd,qBAAqB;CACrB,oBAAoB;CACpB,OAAO;CAGP,OACE;CACF,kBAAkB;CAClB,gBAAgB;CAChB,MAAM;CACN,UAAU;CAGV,YAAY;CACZ,YAAY;CACZ,qBAAqB;CACrB,iBAAiB;CACjB,kBACE;CACF,kBAAkB;CAClB,QAAQ;CACR,iBACE;CACF,gBAAgB;CAChB,iBAAiB;CACjB,aAAa;CACb,iBAAiB;CACjB,aAAa;CACb,gBAAgB;AAClB,EACF,CAAC;AAkED,MAAM,kBAA2C,UAAU;C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,MAAM,oBAAoB;EACxB,aAAa,IAAI;CACnB;CAEA,OACE,qBAAC,OAAD;EACE,GAAI,aAAa;EACjB,WAAW,GAAG,WAAW,IAAI;EAG7B,iBAAe;EACf,eAAa,GAAG,OAAO;YANzB;GAQG,QACC,qBAAC,SAAD;IACE,WAAW,WAAW;IACtB,aAAU;IACV,SAAS,gBAAgB,KAAK;IAC9B,IAAI,cAAc,EAAE;cAJtB,CAMG,OACA,WACC,oBAAC,QAAD;KAAM,eAAA;KAAY,WAAU;eAAqB;IAE3C,CAAA,IACJ,IACC;QACL;GACJ,oBAAC,aAAD;IACO;IACL,qBAAkB;IAClB,gBAAc;IACd,cAAY;IAEZ,mBACE,QACI,gBAAgB,EAAE,oBAAoB,MAAM,GAAG,EAAE,KACjD,KAAA;IAEN,YAAY;IACZ,YAAY;KACV,SAAS;KACT,mBAAmB;KACnB,OAAO;KACP,QAAQ;IACV;IAEA,eAAa;IACC;IACd,mBAAmB;IACP;IACZ,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,WAAW;IACX,SAAS;IACT,YAAY,gBAAgB,OAAO,KAAA;IAInC,cAAa;IACb,uBAAA;IACM;IACN,kBAAkB;IAClB,QAAQ;IACR,UAAU;IACV,SAAS;IACM;IACf,SAAS;IACI;IACb,UAAA;IACA,OAAO;GACR,CAAA;GACA,UACC,oBAAC,OAAD;IAAK,GAAI,sBAAsB;cAC7B,oBAAC,OAAD;KAAK,GAAI,qBAAqB;eAAI;IAAkB,CAAA;GACjD,CAAA,IACH;EACD;;AAET;;;ACheA,IAAA,iBAAe"}
|
|
@@ -292,5 +292,11 @@ Object.defineProperty(exports, "Select_default", {
|
|
|
292
292
|
return Select_default;
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
|
+
Object.defineProperty(exports, "selectVariants", {
|
|
296
|
+
enumerable: true,
|
|
297
|
+
get: function() {
|
|
298
|
+
return selectVariants;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
295
301
|
|
|
296
|
-
//# sourceMappingURL=Select-
|
|
302
|
+
//# sourceMappingURL=Select-D66A-hYm.cjs.map
|