@fuf-stack/uniform 1.28.1 → 1.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +6 -0
  2. package/dist/Checkboxes/index.d.mts +57 -10
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +8 -3
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +129 -1120
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +38 -32
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.mjs +2 -2
  11. package/dist/FieldCard/index.mjs +1 -1
  12. package/dist/FieldReset/index.d.mts +415 -0
  13. package/dist/FieldReset/index.d.mts.map +1 -0
  14. package/dist/FieldReset/index.mjs +241 -0
  15. package/dist/FieldReset/index.mjs.map +1 -0
  16. package/dist/Form/index.d.mts +2 -2
  17. package/dist/Form/index.mjs +2 -2
  18. package/dist/Form/index.mjs.map +1 -1
  19. package/dist/{FormContext-BnNJYZOo.d.mts → FormContext-Dvt3MiKq.d.mts} +3 -3
  20. package/dist/{FormContext-BnNJYZOo.d.mts.map → FormContext-Dvt3MiKq.d.mts.map} +1 -1
  21. package/dist/Input/index.d.mts +63 -452
  22. package/dist/Input/index.d.mts.map +1 -1
  23. package/dist/Input/index.mjs +20 -15
  24. package/dist/Input/index.mjs.map +1 -1
  25. package/dist/RadioBoxes/index.d.mts +163 -894
  26. package/dist/RadioBoxes/index.d.mts.map +1 -1
  27. package/dist/RadioBoxes/index.mjs +27 -20
  28. package/dist/RadioBoxes/index.mjs.map +1 -1
  29. package/dist/RadioTabs/index.d.mts +93 -43
  30. package/dist/RadioTabs/index.d.mts.map +1 -1
  31. package/dist/RadioTabs/index.mjs +8 -5
  32. package/dist/RadioTabs/index.mjs.map +1 -1
  33. package/dist/Radios/index.d.mts +122 -1027
  34. package/dist/Radios/index.d.mts.map +1 -1
  35. package/dist/Radios/index.mjs +22 -18
  36. package/dist/Radios/index.mjs.map +1 -1
  37. package/dist/Select/index.d.mts +440 -3028
  38. package/dist/Select/index.d.mts.map +1 -1
  39. package/dist/Select/index.mjs +79 -45
  40. package/dist/Select/index.mjs.map +1 -1
  41. package/dist/Slider/index.d.mts +162 -1325
  42. package/dist/Slider/index.d.mts.map +1 -1
  43. package/dist/Slider/index.mjs +41 -28
  44. package/dist/Slider/index.mjs.map +1 -1
  45. package/dist/Switch/index.d.mts +125 -944
  46. package/dist/Switch/index.d.mts.map +1 -1
  47. package/dist/Switch/index.mjs +18 -14
  48. package/dist/Switch/index.mjs.map +1 -1
  49. package/dist/SwitchBox/index.d.mts +140 -99
  50. package/dist/SwitchBox/index.d.mts.map +1 -1
  51. package/dist/SwitchBox/index.mjs +9 -6
  52. package/dist/SwitchBox/index.mjs.map +1 -1
  53. package/dist/TextArea/index.d.mts +63 -452
  54. package/dist/TextArea/index.d.mts.map +1 -1
  55. package/dist/TextArea/index.mjs +17 -13
  56. package/dist/TextArea/index.mjs.map +1 -1
  57. package/dist/Time/index.d.mts +82 -729
  58. package/dist/Time/index.d.mts.map +1 -1
  59. package/dist/Time/index.mjs +22 -18
  60. package/dist/Time/index.mjs.map +1 -1
  61. package/dist/hooks/useFormContext/index.d.mts +1 -1
  62. package/dist/hooks/useUniformField/index.d.mts +1 -1
  63. package/dist/hooks/useUniformField/index.mjs +5 -1
  64. package/dist/hooks/useUniformField/index.mjs.map +1 -1
  65. package/dist/hooks/useUniformFieldArray/index.d.mts +1 -1
  66. package/dist/{index-DaiTW5Bl.d.mts → index-DsB0_365.d.mts} +9 -2
  67. package/dist/index-DsB0_365.d.mts.map +1 -0
  68. package/dist/{useFormContext-BhPzFXwF.d.mts → useFormContext-BSSUZ0Md.d.mts} +2 -2
  69. package/dist/{useFormContext-BhPzFXwF.d.mts.map → useFormContext-BSSUZ0Md.d.mts.map} +1 -1
  70. package/package.json +5 -4
  71. package/dist/index-DaiTW5Bl.d.mts.map +0 -1
@@ -31,7 +31,8 @@ const radioTabsVariants = tv({
31
31
  tabWrapper: ["rounded-medium border border-divider", "w-full"]
32
32
  } },
33
33
  fullWidth: { true: { tabWrapper: "w-full" } },
34
- isInvalid: { true: { tabWrapper: "rounded-medium border-2 !border-danger" } }
34
+ invalid: { true: { tabWrapper: "rounded-medium border-2 !border-danger" } },
35
+ readOnly: { true: { base: "**:cursor-not-allowed cursor-not-allowed opacity-disabled" } }
35
36
  }
36
37
  });
37
38
  /**
@@ -39,7 +40,7 @@ const radioTabsVariants = tv({
39
40
  * and [HeroUI Tabs](https://www.heroui.com//docs/components/tabs)
40
41
  */
41
42
  const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name, options, variant = void 0, ...uniformFieldProps }) => {
42
- const { ariaLabel, disabled, errorMessage, field: { onBlur, onChange, ref, value }, invalid, label, required, testId } = useUniformField({
43
+ const { ariaLabel, disabled, errorMessage, field: { onBlur, onChange, ref, value }, invalid, label, readOnly, required, testId } = useUniformField({
43
44
  name,
44
45
  ...uniformFieldProps
45
46
  });
@@ -63,7 +64,8 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
63
64
  const variants = radioTabsVariants({
64
65
  fullWidth,
65
66
  hasContent,
66
- isInvalid: invalid
67
+ invalid,
68
+ readOnly
67
69
  });
68
70
  const classNames = variantsToClassNames(variants, className, "base");
69
71
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", {
@@ -72,7 +74,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
72
74
  name,
73
75
  onBlur,
74
76
  onChange: (e) => {
75
- onChange(convertToOriginalType(e.target.value));
77
+ if (!readOnly) onChange(convertToOriginalType(e.target.value));
76
78
  },
77
79
  onFocus: () => {
78
80
  (visualRadioGroupRef.current?.querySelector("[role=\"tab\"]"))?.focus();
@@ -92,6 +94,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
92
94
  errorMessage,
93
95
  isDisabled: disabled,
94
96
  isInvalid: invalid,
97
+ isReadOnly: readOnly,
95
98
  isRequired: required,
96
99
  label: label ? /* @__PURE__ */ jsx("legend", { children: label }) : null,
97
100
  name: `${name}_radiotabs`,
@@ -108,7 +111,7 @@ const RadioTabs = ({ className = void 0, fullWidth = false, inline = false, name
108
111
  },
109
112
  disabledKeys: disabled ? disabledAllKeys : void 0,
110
113
  onSelectionChange: (key) => {
111
- if (key != null) onChange(convertToOriginalType(key));
114
+ if (key != null && !readOnly) onChange(convertToOriginalType(key));
112
115
  },
113
116
  tabs: tabOptions,
114
117
  testId,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","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: [\n // Needs group for group-data condition.\n 'group',\n // Match shared field wrapper layout.\n 'flex w-full flex-col',\n // Keep spacing between label/tabs consistent.\n 'gap-y-1.5',\n ],\n cursor: '',\n label:\n 'mb-2 inline-flex cursor-default 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 icon */\n icon?: ReactNode;\n /** option label */\n label?: 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 default RadioTabs;\n"],"mappings":";;;;;;;;;AAgBA,MAAa,oBAAoB,GAAG;CAClC,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;EACF;EACA,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,WACE,gBAAgB;EAClB;EACA,GAAG;CACL,CAAC;CAGD,MAAM,sBAAsB,OAAuB,IAAI;CAGvD,MAAM,EAAE,0BAA0B,2BAA2B,OAAO;CAEpE,MAAM,aAAa,QAAQ,KAAe,WAAW;EACnD,OAAO;GACL,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAElB,KAAK,OAAO,OAAO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vC;GACA,MAAM;GACE;GACC;GAET,aAAa,SAAS,OAAO,OAAO,KAAK,IAAI;EAC9C,CAAA;CACa,CAAA,CAChB,EAAA,CAAA;AAEN;;ACvOA,IAAA,oBAAe"}
1
+ {"version":3,"file":"index.mjs","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: [\n // Needs group for group-data condition.\n 'group',\n // Match shared field wrapper layout.\n 'flex w-full flex-col',\n // Keep spacing between label/tabs consistent.\n 'gap-y-1.5',\n ],\n cursor: '',\n label:\n 'mb-2 inline-flex cursor-default 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 invalid: {\n true: {\n tabWrapper: 'rounded-medium border-2 !border-danger',\n },\n },\n readOnly: {\n true: {\n // Inner controls set their own cursors, so override every descendant.\n base: '**:cursor-not-allowed cursor-not-allowed opacity-disabled',\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 icon */\n icon?: ReactNode;\n /** option label */\n label?: 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<\n VariantProps,\n 'hasContent' | 'invalid'\n> {\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 /** Prevents changes while keeping the tabs focusable and its value in validation and submission */\n readOnly?: boolean;\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 readOnly,\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 invalid,\n readOnly,\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 if (!readOnly) {\n onChange(convertToOriginalType(e.target.value));\n }\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 isReadOnly={readOnly}\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 // Tabs have no read-only mode: selection stays controlled and\n // changes are ignored, while tabs remain focusable.\n onSelectionChange={(key) => {\n if (key != null && !readOnly) {\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 default RadioTabs;\n"],"mappings":";;;;;;;;;AAgBA,MAAa,oBAAoB,GAAG;CAClC,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;EACF;EACA,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,SAAS,EACP,MAAM,EACJ,YAAY,yCACd,EACF;EACA,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF;CACF;AACF,CAAC;;;;;AAoDD,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,UACA,WACE,gBAAgB;EAClB;EACA,GAAG;CACL,CAAC;CAGD,MAAM,sBAAsB,OAAuB,IAAI;CAGvD,MAAM,EAAE,0BAA0B,2BAA2B,OAAO;CAEpE,MAAM,aAAa,QAAQ,KAAe,WAAW;EACnD,OAAO;GACL,SAAS,QAAQ;GACjB,UAAU,QAAQ;GAElB,KAAK,OAAO,OA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