@salt-ds/core 1.8.0-rc.1 → 1.8.0-rc.3

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 (131) hide show
  1. package/dist-cjs/button/Button.css.js +1 -1
  2. package/dist-cjs/checkbox/Checkbox.css.js +1 -1
  3. package/dist-cjs/checkbox/Checkbox.js +55 -20
  4. package/dist-cjs/checkbox/Checkbox.js.map +1 -1
  5. package/dist-cjs/checkbox/CheckboxGroup.css.js +1 -1
  6. package/dist-cjs/checkbox/CheckboxGroup.js +25 -3
  7. package/dist-cjs/checkbox/CheckboxGroup.js.map +1 -1
  8. package/dist-cjs/checkbox/CheckboxIcon.css.js +1 -1
  9. package/dist-cjs/checkbox/CheckboxIcon.js +46 -26
  10. package/dist-cjs/checkbox/CheckboxIcon.js.map +1 -1
  11. package/dist-cjs/checkbox/internal/CheckboxGroupContext.js.map +1 -1
  12. package/dist-cjs/form-field/FormField.css.js +1 -1
  13. package/dist-cjs/form-field/FormField.js +4 -2
  14. package/dist-cjs/form-field/FormField.js.map +1 -1
  15. package/dist-cjs/form-field/FormFieldHelperText.css.js +1 -1
  16. package/dist-cjs/form-field/FormFieldLabel.css.js +1 -1
  17. package/dist-cjs/form-field/FormFieldLabel.js +19 -6
  18. package/dist-cjs/form-field/FormFieldLabel.js.map +1 -1
  19. package/dist-cjs/form-field-context/FormFieldContext.js.map +1 -1
  20. package/dist-cjs/index.js +2 -4
  21. package/dist-cjs/index.js.map +1 -1
  22. package/dist-cjs/input/Input.css.js +1 -1
  23. package/dist-cjs/input/Input.js +11 -7
  24. package/dist-cjs/input/Input.js.map +1 -1
  25. package/dist-cjs/radio-button/RadioButton.css.js +1 -1
  26. package/dist-cjs/radio-button/RadioButton.js +49 -10
  27. package/dist-cjs/radio-button/RadioButton.js.map +1 -1
  28. package/dist-cjs/radio-button/RadioButtonGroup.css.js +1 -1
  29. package/dist-cjs/radio-button/RadioButtonGroup.js +23 -1
  30. package/dist-cjs/radio-button/RadioButtonGroup.js.map +1 -1
  31. package/dist-cjs/radio-button/RadioButtonIcon.css.js +1 -1
  32. package/dist-cjs/radio-button/RadioButtonIcon.js +29 -24
  33. package/dist-cjs/radio-button/RadioButtonIcon.js.map +1 -1
  34. package/dist-cjs/radio-button/internal/RadioGroupContext.js.map +1 -1
  35. package/dist-cjs/status-adornment/StatusAdornment.css.js +1 -1
  36. package/dist-cjs/status-adornment/StatusAdornment.js.map +1 -1
  37. package/dist-cjs/utils/useResponsiveProp.js +7 -5
  38. package/dist-cjs/utils/useResponsiveProp.js.map +1 -1
  39. package/dist-es/button/Button.css.js +1 -1
  40. package/dist-es/checkbox/Checkbox.css.js +1 -1
  41. package/dist-es/checkbox/Checkbox.js +55 -20
  42. package/dist-es/checkbox/Checkbox.js.map +1 -1
  43. package/dist-es/checkbox/CheckboxGroup.css.js +1 -1
  44. package/dist-es/checkbox/CheckboxGroup.js +25 -3
  45. package/dist-es/checkbox/CheckboxGroup.js.map +1 -1
  46. package/dist-es/checkbox/CheckboxIcon.css.js +1 -1
  47. package/dist-es/checkbox/CheckboxIcon.js +47 -27
  48. package/dist-es/checkbox/CheckboxIcon.js.map +1 -1
  49. package/dist-es/checkbox/internal/CheckboxGroupContext.js.map +1 -1
  50. package/dist-es/form-field/FormField.css.js +1 -1
  51. package/dist-es/form-field/FormField.js +4 -2
  52. package/dist-es/form-field/FormField.js.map +1 -1
  53. package/dist-es/form-field/FormFieldHelperText.css.js +1 -1
  54. package/dist-es/form-field/FormFieldLabel.css.js +1 -1
  55. package/dist-es/form-field/FormFieldLabel.js +20 -7
  56. package/dist-es/form-field/FormFieldLabel.js.map +1 -1
  57. package/dist-es/form-field-context/FormFieldContext.js.map +1 -1
  58. package/dist-es/index.js +1 -2
  59. package/dist-es/index.js.map +1 -1
  60. package/dist-es/input/Input.css.js +1 -1
  61. package/dist-es/input/Input.js +11 -7
  62. package/dist-es/input/Input.js.map +1 -1
  63. package/dist-es/radio-button/RadioButton.css.js +1 -1
  64. package/dist-es/radio-button/RadioButton.js +49 -10
  65. package/dist-es/radio-button/RadioButton.js.map +1 -1
  66. package/dist-es/radio-button/RadioButtonGroup.css.js +1 -1
  67. package/dist-es/radio-button/RadioButtonGroup.js +23 -1
  68. package/dist-es/radio-button/RadioButtonGroup.js.map +1 -1
  69. package/dist-es/radio-button/RadioButtonIcon.css.js +1 -1
  70. package/dist-es/radio-button/RadioButtonIcon.js +30 -25
  71. package/dist-es/radio-button/RadioButtonIcon.js.map +1 -1
  72. package/dist-es/radio-button/internal/RadioGroupContext.js.map +1 -1
  73. package/dist-es/status-adornment/StatusAdornment.css.js +1 -1
  74. package/dist-es/status-adornment/StatusAdornment.js.map +1 -1
  75. package/dist-es/utils/useResponsiveProp.js +7 -5
  76. package/dist-es/utils/useResponsiveProp.js.map +1 -1
  77. package/dist-types/checkbox/Checkbox.d.ts +9 -0
  78. package/dist-types/checkbox/CheckboxGroup.d.ts +13 -0
  79. package/dist-types/checkbox/CheckboxIcon.d.ts +7 -1
  80. package/dist-types/checkbox/internal/CheckboxGroupContext.d.ts +6 -0
  81. package/dist-types/form-field/FormField.d.ts +5 -1
  82. package/dist-types/form-field/FormFieldLabel.d.ts +3 -1
  83. package/dist-types/form-field/index.d.ts +0 -1
  84. package/dist-types/form-field-context/FormFieldContext.d.ts +3 -0
  85. package/dist-types/index.d.ts +1 -0
  86. package/dist-types/input/index.d.ts +0 -1
  87. package/dist-types/radio-button/RadioButton.d.ts +15 -2
  88. package/dist-types/radio-button/RadioButtonGroup.d.ts +12 -0
  89. package/dist-types/radio-button/RadioButtonIcon.d.ts +10 -4
  90. package/dist-types/radio-button/internal/RadioGroupContext.d.ts +6 -0
  91. package/dist-types/status-adornment/StatusAdornment.d.ts +1 -2
  92. package/package.json +4 -3
  93. package/dist-cjs/checkbox/assets/CheckboxCheckedIcon.js +0 -33
  94. package/dist-cjs/checkbox/assets/CheckboxCheckedIcon.js.map +0 -1
  95. package/dist-cjs/checkbox/assets/CheckboxCheckedIconHD.js +0 -32
  96. package/dist-cjs/checkbox/assets/CheckboxCheckedIconHD.js.map +0 -1
  97. package/dist-cjs/checkbox/assets/CheckboxIndeterminateIcon.js +0 -37
  98. package/dist-cjs/checkbox/assets/CheckboxIndeterminateIcon.js.map +0 -1
  99. package/dist-cjs/checkbox/assets/CheckboxUncheckedIcon.js +0 -26
  100. package/dist-cjs/checkbox/assets/CheckboxUncheckedIcon.js.map +0 -1
  101. package/dist-cjs/form-field/FormFieldControlWrapper.css.js +0 -6
  102. package/dist-cjs/form-field/FormFieldControlWrapper.css.js.map +0 -1
  103. package/dist-cjs/form-field/FormFieldControlWrapper.js +0 -32
  104. package/dist-cjs/form-field/FormFieldControlWrapper.js.map +0 -1
  105. package/dist-cjs/input/adornment-button/AdornmentButton.css.js +0 -6
  106. package/dist-cjs/input/adornment-button/AdornmentButton.css.js.map +0 -1
  107. package/dist-cjs/input/adornment-button/AdornmentButton.js +0 -41
  108. package/dist-cjs/input/adornment-button/AdornmentButton.js.map +0 -1
  109. package/dist-es/checkbox/assets/CheckboxCheckedIcon.js +0 -29
  110. package/dist-es/checkbox/assets/CheckboxCheckedIcon.js.map +0 -1
  111. package/dist-es/checkbox/assets/CheckboxCheckedIconHD.js +0 -28
  112. package/dist-es/checkbox/assets/CheckboxCheckedIconHD.js.map +0 -1
  113. package/dist-es/checkbox/assets/CheckboxIndeterminateIcon.js +0 -33
  114. package/dist-es/checkbox/assets/CheckboxIndeterminateIcon.js.map +0 -1
  115. package/dist-es/checkbox/assets/CheckboxUncheckedIcon.js +0 -22
  116. package/dist-es/checkbox/assets/CheckboxUncheckedIcon.js.map +0 -1
  117. package/dist-es/form-field/FormFieldControlWrapper.css.js +0 -4
  118. package/dist-es/form-field/FormFieldControlWrapper.css.js.map +0 -1
  119. package/dist-es/form-field/FormFieldControlWrapper.js +0 -28
  120. package/dist-es/form-field/FormFieldControlWrapper.js.map +0 -1
  121. package/dist-es/input/adornment-button/AdornmentButton.css.js +0 -4
  122. package/dist-es/input/adornment-button/AdornmentButton.css.js.map +0 -1
  123. package/dist-es/input/adornment-button/AdornmentButton.js +0 -37
  124. package/dist-es/input/adornment-button/AdornmentButton.js.map +0 -1
  125. package/dist-types/checkbox/assets/CheckboxCheckedIcon.d.ts +0 -4
  126. package/dist-types/checkbox/assets/CheckboxCheckedIconHD.d.ts +0 -4
  127. package/dist-types/checkbox/assets/CheckboxIndeterminateIcon.d.ts +0 -4
  128. package/dist-types/checkbox/assets/CheckboxUncheckedIcon.d.ts +0 -4
  129. package/dist-types/checkbox/assets/index.d.ts +0 -4
  130. package/dist-types/form-field/FormFieldControlWrapper.d.ts +0 -2
  131. package/dist-types/input/adornment-button/AdornmentButton.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButton.js","sources":["../src/radio-button/RadioButton.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n ChangeEventHandler,\n FocusEventHandler,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n ReactNode,\n} from \"react\";\nimport { makePrefixer, useControlled } from \"../utils\";\nimport { useRadioGroup } from \"./internal/useRadioGroup\";\nimport { RadioButtonIcon } from \"./RadioButtonIcon\";\n\nimport radioButtonCss from \"./RadioButton.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nconst withBaseName = makePrefixer(\"saltRadioButton\");\n\nexport interface RadioButtonProps\n extends Omit<\n HTMLAttributes<HTMLLabelElement>,\n \"onChange\" | \"onBlur\" | \"onFocus\"\n > {\n /**\n * Set the default selected radio button in the group\n */\n checked?: boolean;\n /**\n * Set the disabled state\n */\n disabled?: boolean;\n /**\n * Set the error state\n */\n error?: boolean;\n /**\n * Props to be passed to the radio input\n */\n inputProps?: Partial<InputHTMLAttributes<HTMLInputElement>>;\n /**\n * The label to be shown next to the radio icon\n */\n label?: ReactNode;\n /**\n * Name of the radio group\n */\n name?: string;\n /**\n * Callback for blur event\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Callback for change event\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Callback for focus event\n */\n onFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Value of radio button\n */\n value?: string;\n}\n\nexport const RadioButton = forwardRef<HTMLLabelElement, RadioButtonProps>(\n function RadioButton(props, ref) {\n const {\n checked: checkedProp,\n className,\n disabled,\n error,\n inputProps,\n label,\n name: nameProp,\n onFocus,\n onBlur,\n onChange,\n value,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-radio-button\",\n css: radioButtonCss,\n window: targetWindow,\n });\n\n const radioGroup = useRadioGroup();\n\n const radioGroupChecked =\n radioGroup.value != null && value != null\n ? radioGroup.value === value\n : checkedProp;\n const name = nameProp ?? radioGroup.name;\n\n const [checked, setCheckedState] = useControlled({\n controlled: radioGroupChecked,\n default: Boolean(checkedProp),\n name: \"RadioBase\",\n state: \"checked\",\n });\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n const newChecked = event.target.checked;\n setCheckedState(newChecked);\n\n onChange?.(event);\n radioGroup.onChange?.(event);\n };\n\n return (\n <label\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n },\n className\n )}\n ref={ref}\n {...rest}\n >\n <input\n className={withBaseName(\"input\")}\n {...inputProps}\n checked={checked}\n disabled={disabled}\n name={name}\n value={value}\n onBlur={onBlur}\n onChange={handleChange}\n onFocus={onFocus}\n type=\"radio\"\n />\n <RadioButtonIcon checked={checked} error={error} disabled={disabled} />\n {label}\n </label>\n );\n }\n);\n"],"names":["RadioButton","radioButtonCss"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,YAAA,GAAe,aAAa,iBAAiB,CAAA,CAAA;AAiD5C,MAAM,WAAc,GAAA,UAAA;AAAA,EACzB,SAASA,YAAY,CAAA,KAAA,EAAO,GAAK,EAAA;AAC/B,IAAM,MAAA;AAAA,MACJ,OAAS,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AAA,CAAA,IAAA,CAAA,UAAA,EAAA,KAAA,CAAA,CAAA;AAAA,KACxB,CAAA;AAEA,IAAA,uBACG,IAAA,CAAA,OAAA,EAAA;AAAA,MACC,SAAW,EAAA,IAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb;AAAA,UACE,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,SAC9B;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACA,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,OAAA,EAAA;AAAA,UACC,SAAA,EAAW,aAAa,OAAO,CAAA;AAAA,UAC9B,GAAG,UAAA;AAAA,UACJ,OAAA;AAAA,UACA,QAAA;AAAA,UACA,IAAA;AAAA,UACA,KAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAU,EAAA,YAAA;AAAA,UACV,OAAA;AAAA,UACA,IAAK,EAAA,OAAA;AAAA,SACP,CAAA;AAAA,wBACC,GAAA,CAAA,eAAA,EAAA;AAAA,UAAgB,OAAA;AAAA,UAAkB,KAAA;AAAA,UAAc,QAAA;AAAA,SAAoB,CAAA;AAAA,QACpE,KAAA;AAAA,OAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
1
+ {"version":3,"file":"RadioButton.js","sources":["../src/radio-button/RadioButton.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n FocusEventHandler,\n forwardRef,\n InputHTMLAttributes,\n ReactNode,\n} from \"react\";\nimport { makePrefixer, useControlled } from \"../utils\";\nimport { useRadioGroup } from \"./internal/useRadioGroup\";\nimport { RadioButtonIcon } from \"./RadioButtonIcon\";\n\nimport radioButtonCss from \"./RadioButton.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { AdornmentValidationStatus } from \"../status-adornment\";\n\nconst withBaseName = makePrefixer(\"saltRadioButton\");\n\nexport interface RadioButtonProps\n extends Omit<\n ComponentPropsWithoutRef<\"label\">,\n \"onChange\" | \"onBlur\" | \"onFocus\"\n > {\n /**\n * Set the default selected radio button in the group\n */\n checked?: boolean;\n /**\n * Set the disabled state\n */\n disabled?: boolean;\n /**\n * **Deprecated**: Use validationStatus instead\n * Set the error state\n */\n error?: boolean;\n /**\n * Props to be passed to the radio input\n */\n inputProps?: Partial<InputHTMLAttributes<HTMLInputElement>>;\n /**\n * The label to be shown next to the radio icon\n */\n label?: ReactNode;\n /**\n * Name of the radio group\n */\n name?: string;\n /**\n * Callback for blur event\n */\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Callback for change event\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Callback for focus event\n */\n onFocus?: FocusEventHandler<HTMLInputElement>;\n /**\n * Set the read only state.\n */\n readOnly?: boolean;\n /**\n * Value of radio button\n */\n value?: string;\n /**\n * Validation status, one of \"warning\" | \"error\" | \"success\"\n *\n * RadioButton has styling variants for \"error\" and \"warning\".\n * No visual styling will be applied on \"success\" variant.\n */\n validationStatus?: AdornmentValidationStatus;\n}\n\nexport const RadioButton = forwardRef<HTMLLabelElement, RadioButtonProps>(\n function RadioButton(props, ref) {\n const {\n checked: checkedProp,\n className,\n disabled: disabledProp,\n error,\n inputProps = {},\n label,\n name: nameProp,\n onFocus,\n onBlur,\n onChange,\n readOnly: readOnlyProp,\n value,\n validationStatus: validationStatusProp,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-radio-button\",\n css: radioButtonCss,\n window: targetWindow,\n });\n\n const {\n a11yProps: formFieldA11yProps,\n disabled: formFieldDisabled,\n readOnly: formFieldReadOnly,\n validationStatus: formFieldValidationStatus,\n } = useFormFieldProps();\n\n const radioGroup = useRadioGroup();\n\n const {\n \"aria-describedby\": inputDescribedBy,\n \"aria-labelledby\": inputLabelledBy,\n className: inputClassName,\n onChange: inputOnChange,\n ...restInputProps\n } = inputProps;\n\n const disabled = radioGroup.disabled ?? formFieldDisabled ?? disabledProp;\n const readOnly = radioGroup.readOnly ?? formFieldReadOnly ?? readOnlyProp;\n const validationStatus = !disabled\n ? radioGroup.validationStatus ??\n formFieldValidationStatus ??\n validationStatusProp\n : undefined;\n\n const radioGroupChecked =\n radioGroup.value != null && value != null\n ? radioGroup.value === value\n : checkedProp;\n const name = nameProp ?? radioGroup.name;\n\n const [checked, setCheckedState] = useControlled({\n controlled: radioGroupChecked,\n default: Boolean(checkedProp),\n name: \"RadioBase\",\n state: \"checked\",\n });\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (readOnly) return;\n\n const newChecked = event.target.checked;\n setCheckedState(newChecked);\n\n onChange?.(event);\n inputOnChange?.(event);\n radioGroup.onChange?.(event);\n };\n\n return (\n <label\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"readOnly\")]: readOnly,\n [withBaseName(\"error\")]: error /* **Deprecated** */,\n [withBaseName(validationStatus || \"\")]: validationStatus,\n },\n className\n )}\n ref={ref}\n {...rest}\n >\n <input\n aria-describedby={clsx(\n radioGroup.a11yProps?.[\"aria-describedby\"] ??\n formFieldA11yProps?.[\"aria-describedby\"],\n inputDescribedBy\n )}\n aria-labelledby={clsx(\n radioGroup.a11yProps?.[\"aria-labelledby\"] ??\n formFieldA11yProps?.[\"aria-labelledby\"],\n inputLabelledBy\n )}\n className={clsx(withBaseName(\"input\"), inputClassName)}\n // From ADA: read-only field doesn't need to be focusable since it's not a field but text\n tabIndex={readOnly ? -1 : undefined}\n checked={checked}\n disabled={disabled}\n readOnly={readOnly}\n name={name}\n value={value}\n onBlur={onBlur}\n onChange={handleChange}\n onFocus={onFocus}\n type=\"radio\"\n {...restInputProps}\n />\n <RadioButtonIcon\n checked={checked}\n disabled={disabled}\n readOnly={readOnly}\n validationStatus={validationStatus}\n error={error}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AAA,CAAA,KAAvB,YACE,kBAAqB,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,kBAAA,CAAA,iBAAA,CAAA;AAAA,YACvB,eAAA;AAAA,WACF;AAAA,UACA,SAAW,EAAA,IAAA,CAAK,YAAa,CAAA,OAAO,GAAG,cAAc,CAAA;AAAA,UAErD,QAAA,EAAU,WAAW,CAAK,CAAA,GAAA,KAAA,CAAA;AAAA,UAC1B,OAAA;AAAA,UACA,QAAA;AAAA,UACA,QAAA;AAAA,UACA,IAAA;AAAA,UACA,KAAA;AAAA,UACA,MAAA;AAAA,UACA,QAAU,EAAA,YAAA;AAAA,UACV,OAAA;AAAA,UACA,IAAK,EAAA,OAAA;AAAA,UACJ,GAAG,cAAA;AAAA,SACN,CAAA;AAAA,wBACC,GAAA,CAAA,eAAA,EAAA;AAAA,UACC,OAAA;AAAA,UACA,QAAA;AAAA,UACA,QAAA;AAAA,UACA,gBAAA;AAAA,UACA,KAAA;AAAA,SACF,CAAA;AAAA,QACC,KAAA;AAAA,OAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -1,4 +1,4 @@
1
- var css_248z = "/* Styles applied to root element */\n.saltRadioButtonGroup {\n border: none;\n margin: 0;\n padding: 0;\n}\n\n/* Styles applied when direction is vertical */\n.saltRadioButtonGroup-vertical {\n display: flex;\n gap: var(--salt-size-unit);\n flex-direction: column;\n}\n\n/* Styles applied when direction is horizontal */\n.saltRadioButtonGroup-horizontal {\n display: flex;\n gap: var(--salt-size-unit);\n flex-direction: row;\n flex-wrap: wrap;\n}\n\n.saltRadioButtonGroup-noWrap {\n flex-wrap: nowrap;\n}\n.saltRadioButtonGroup-noWrap .saltRadioButton {\n white-space: break-spaces;\n}\n\n/* Styles applied to radio group's legend */\n.saltRadioButtonGroup-legend {\n display: inline-block;\n font-size: var(--formFieldLegacy-label-fontSize); /* TODO: V2 Form Field work */\n color: var(--salt-text-primary-foreground);\n margin-bottom: calc(var(--salt-size-unit) * 2);\n}\n";
1
+ var css_248z = "/* Styles applied to root element */\n.saltRadioButtonGroup {\n border: none;\n margin: 0;\n padding: 0;\n}\n\n/* Styles applied when direction is vertical */\n.saltRadioButtonGroup-vertical {\n display: flex;\n gap: var(--salt-spacing-100);\n flex-direction: column;\n}\n\n/* Styles applied when direction is horizontal */\n.saltRadioButtonGroup-horizontal {\n display: flex;\n gap: var(--salt-spacing-200);\n flex-direction: row;\n flex-wrap: wrap;\n}\n\n.saltRadioButtonGroup-noWrap {\n flex-wrap: nowrap;\n}\n.saltRadioButtonGroup-noWrap .saltRadioButton {\n white-space: break-spaces;\n}\n\n/* Styles applied to radio group's legend */\n.saltRadioButtonGroup-legend {\n display: inline-block;\n font-size: var(--formFieldLegacy-label-fontSize); /* TODO: V2 Form Field work */\n color: var(--salt-text-primary-foreground);\n margin-bottom: var(--salt-spacing-200);\n}\n";
2
2
 
3
3
  export { css_248z as default };
4
4
  //# sourceMappingURL=RadioButtonGroup.css.js.map
@@ -11,6 +11,8 @@ import { RadioGroupContext } from './internal/RadioGroupContext.js';
11
11
  import css_248z from './RadioButtonGroup.css.js';
12
12
  import { useWindow } from '@salt-ds/window';
13
13
  import { useComponentCssInjection } from '@salt-ds/styles';
14
+ import '../form-field-context/FormFieldContext.js';
15
+ import { useFormFieldProps } from '../form-field-context/useFormFieldProps.js';
14
16
 
15
17
  const withBaseName = makePrefixer("saltRadioButtonGroup");
16
18
  const RadioButtonGroup = forwardRef(function RadioButtonGroup2(props, ref) {
@@ -19,10 +21,13 @@ const RadioButtonGroup = forwardRef(function RadioButtonGroup2(props, ref) {
19
21
  className,
20
22
  defaultValue,
21
23
  direction = "vertical",
24
+ disabled: disabledProp,
22
25
  wrap = true,
23
26
  name: nameProp,
24
27
  onChange,
28
+ readOnly: readOnlyProp,
25
29
  value: valueProp,
30
+ validationStatus: validationStatusProp,
26
31
  ...rest
27
32
  } = props;
28
33
  const targetWindow = useWindow();
@@ -31,6 +36,15 @@ const RadioButtonGroup = forwardRef(function RadioButtonGroup2(props, ref) {
31
36
  css: css_248z,
32
37
  window: targetWindow
33
38
  });
39
+ const {
40
+ a11yProps,
41
+ disabled: formFieldDisabled,
42
+ readOnly: formFieldReadOnly,
43
+ validationStatus: formFieldValidationStatus
44
+ } = useFormFieldProps();
45
+ const disabled = formFieldDisabled != null ? formFieldDisabled : disabledProp;
46
+ const readOnly = formFieldReadOnly != null ? formFieldReadOnly : readOnlyProp;
47
+ const validationStatus = formFieldValidationStatus != null ? formFieldValidationStatus : validationStatusProp;
34
48
  const [value, setStateValue] = useControlled({
35
49
  controlled: valueProp,
36
50
  default: defaultValue,
@@ -55,7 +69,15 @@ const RadioButtonGroup = forwardRef(function RadioButtonGroup2(props, ref) {
55
69
  ref,
56
70
  ...rest,
57
71
  children: /* @__PURE__ */ jsx(RadioGroupContext.Provider, {
58
- value: { name, onChange: handleChange, value },
72
+ value: {
73
+ a11yProps,
74
+ disabled,
75
+ name,
76
+ onChange: handleChange,
77
+ readOnly,
78
+ validationStatus,
79
+ value
80
+ },
59
81
  children
60
82
  })
61
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonGroup.js","sources":["../src/radio-button/RadioButtonGroup.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n forwardRef,\n} from \"react\";\nimport { makePrefixer, useControlled, useId } from \"../utils\";\nimport { RadioGroupContext } from \"./internal/RadioGroupContext\";\n\nimport radioButtonGroupCss from \"./RadioButtonGroup.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nconst withBaseName = makePrefixer(\"saltRadioButtonGroup\");\n\nexport interface RadioButtonGroupProps\n extends Omit<ComponentPropsWithoutRef<\"fieldset\">, \"onChange\"> {\n /**\n * Set the selected value when initialized.\n */\n defaultValue?: string;\n /**\n * Set the group direction.\n */\n direction?: \"horizontal\" | \"vertical\";\n /**\n * Only for horizontal direction. When `true` the text in radio button label will wrap to fit within the container. Otherwise the radio buttons will wrap onto the next line.\n */\n wrap?: boolean;\n /**\n * The name to be set on each radio button within the group. If not set, then one will be generated for you.\n */\n name?: string;\n /**\n * Callback for change event.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * The value of the radio group, required for a controlled component.\n */\n value?: string;\n}\n\nexport const RadioButtonGroup = forwardRef<\n HTMLFieldSetElement,\n RadioButtonGroupProps\n>(function RadioButtonGroup(props, ref) {\n const {\n children,\n className,\n defaultValue,\n direction = \"vertical\",\n wrap = true,\n name: nameProp,\n onChange,\n value: valueProp,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-radio-button-group\",\n css: radioButtonGroupCss,\n window: targetWindow,\n });\n\n const [value, setStateValue] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n state: \"value\",\n name: \"RadioButtonGroup\",\n });\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n setStateValue(event.target.value);\n onChange?.(event);\n };\n\n const name = useId(nameProp);\n\n return (\n <fieldset\n className={clsx(\n withBaseName(),\n withBaseName(direction),\n {\n [withBaseName(\"noWrap\")]: !wrap,\n },\n className\n )}\n data-testid=\"radio-button-group\"\n ref={ref}\n {...rest}\n >\n <RadioGroupContext.Provider\n value={{ name, onChange: handleChange, value }}\n >\n {children}\n </RadioGroupContext.Provider>\n </fieldset>\n );\n});\n"],"names":["RadioButtonGroup","radioButtonGroupCss"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,YAAA,GAAe,aAAa,sBAAsB,CAAA,CAAA;AA8BjD,MAAM,gBAAmB,GAAA,UAAA,CAG9B,SAASA,iBAAAA,CAAiB,OAAO,GAAK,EAAA;AACtC,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAY,GAAA,UAAA;AAAA,IACZ,IAAO,GAAA,IAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN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F,CAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"RadioButtonGroup.js","sources":["../src/radio-button/RadioButtonGroup.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n ChangeEventHandler,\n ComponentPropsWithoutRef,\n forwardRef,\n} from \"react\";\nimport { makePrefixer, useControlled, useId } from \"../utils\";\nimport { RadioGroupContext } from \"./internal/RadioGroupContext\";\n\nimport radioButtonGroupCss from \"./RadioButtonGroup.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useFormFieldProps } from \"../form-field-context\";\n\nconst withBaseName = makePrefixer(\"saltRadioButtonGroup\");\n\nexport interface RadioButtonGroupProps\n extends Omit<ComponentPropsWithoutRef<\"fieldset\">, \"onChange\"> {\n /**\n * Set the selected value when initialized.\n */\n defaultValue?: string;\n /**\n * Set the group direction.\n */\n direction?: \"horizontal\" | \"vertical\";\n /**\n * Disable the RadioButton group\n */\n disabled?: boolean;\n /**\n * Only for horizontal direction. When `true` the text in radio button label will wrap to fit within the container. Otherwise the radio buttons will wrap onto the next line.\n */\n wrap?: boolean;\n /**\n * The name to be set on each radio button within the group. If not set, then one will be generated for you.\n */\n name?: string;\n /**\n * Callback for change event.\n */\n onChange?: ChangeEventHandler<HTMLInputElement>;\n /**\n * Set the RadioButton group to read only.\n */\n readOnly?: boolean;\n /**\n * The value of the radio group, required for a controlled component.\n */\n value?: string;\n /**\n * Validation status.\n */\n validationStatus?: \"error\" | \"warning\";\n}\n\nexport const RadioButtonGroup = forwardRef<\n HTMLFieldSetElement,\n RadioButtonGroupProps\n>(function RadioButtonGroup(props, ref) {\n const {\n children,\n className,\n defaultValue,\n direction = \"vertical\",\n disabled: disabledProp,\n wrap = true,\n name: nameProp,\n onChange,\n readOnly: readOnlyProp,\n value: valueProp,\n validationStatus: validationStatusProp,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-radio-button-group\",\n css: radioButtonGroupCss,\n window: targetWindow,\n });\n\n const {\n a11yProps,\n disabled: formFieldDisabled,\n readOnly: formFieldReadOnly,\n validationStatus: formFieldValidationStatus,\n } = useFormFieldProps();\n\n const disabled = formFieldDisabled ?? disabledProp;\n const readOnly = formFieldReadOnly ?? readOnlyProp;\n const validationStatus = formFieldValidationStatus ?? validationStatusProp;\n\n const [value, setStateValue] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n state: \"value\",\n name: \"RadioButtonGroup\",\n });\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n setStateValue(event.target.value);\n onChange?.(event);\n };\n\n const name = useId(nameProp);\n\n return (\n <fieldset\n className={clsx(\n withBaseName(),\n withBaseName(direction),\n {\n [withBaseName(\"noWrap\")]: !wrap,\n },\n className\n )}\n data-testid=\"radio-button-group\"\n ref={ref}\n {...rest}\n >\n <RadioGroupContext.Provider\n value={{\n a11yProps,\n disabled,\n name,\n onChange: handleChange,\n readOnly,\n validationStatus,\n value,\n }}\n >\n {children}\n </RadioGroupContext.Provider>\n </fieldset>\n );\n});\n"],"names":["RadioButtonGroup","radioButtonGroupCss"],"mappings":";;;;;;;;;;;;;;;;AAcA,MAAM,YAAA,GAAe,aAAa,sBAAsB,CAAA,CAAA;AA0CjD,MAAM,gBAAmB,GAAA,UAAA,CAG9B,SAASA,iBAAAA,CAAiB,OAAO,GAAK,EAAA;AACtC,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAY,GAAA,UAAA;AAAA,IACZ,QAAU,EAAA,YAAA;AAAA,IACV,IAAO,GAAA,IAAA;AAAA,IACP,IAAM,EAAA,QAAA;AAAA,IACN,QAAA;AAAA,IACA,QAAU,EAAA,YAAA;AAAA,IACV,KAAO,EAAA,SAAA;AAAA,IACP,gBAAkB,EAAA,oBAAA;AAAA,IACf,GAAA,IAAA;AAAA,GACD,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,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AAA,OAC7B;AAAA,MACA,SAAA;AAAA,KACF;AAAA,IACA,aAAY,EAAA,oBAAA;AAAA,IACZ,GAAA;AAAA,IACC,GAAG,IAAA;AAAA,IAEJ,QAAA,kBAAA,GAAA,CAAC,kBAAkB,QAAlB,EAAA;AAAA,MACC,KAAO,EAAA;AAAA,QACL,SAAA;AAAA,QACA,QAAA;AAAA,QACA,IAAA;AAAA,QACA,QAAU,EAAA,YAAA;AAAA,QACV,QAAA;AAAA,QACA,gBAAA;AAAA,QACA,KAAA;AAAA,OACF;AAAA,MAEC,QAAA;AAAA,KACH,CAAA;AAAA,GACF,CAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- var css_248z = "/* Styles applied to radio button icon */\n.saltRadioButtonIcon {\n width: var(--salt-size-selectable);\n height: var(--salt-size-selectable);\n border-radius: 50%;\n flex: none;\n margin-top: var(--salt-size-border);\n}\n\n/* Styles applied to radio button icon circle */\n.saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-fill, var(--salt-container-primary-background));\n stroke: var(--saltRadioButton-icon-stroke, var(--salt-selectable-foreground));\n stroke-width: var(--salt-size-border);\n}\n\n/* Styles applied to radio button icon on hover */\n.saltRadioButton:hover .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-hover-fill, var(--salt-selectable-background-hover));\n stroke: var(--saltRadioButton-icon-stroke-hover, var(--salt-selectable-foreground-hover));\n}\n\n/* Styles applied to radio button icon if checked */\n.saltRadioButtonIcon-checked .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-checked .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-checked-fill, var(--salt-selectable-foreground-selected));\n stroke: var(--saltRadioButton-icon-checked-stroke, var(--salt-selectable-foreground-selected));\n}\n\n/* Styles applied to radio button icon if disabled */\n.saltRadioButtonIcon-disabled .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-disabled .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-disabled-fill, var(--salt-selectable-background));\n stroke: var(--saltRadioButton-icon-disabled-stroke, var(--salt-selectable-foreground-disabled));\n}\n\n/* Styles applied to radio button icon if checked and disabled */\n.saltRadioButtonIcon-disabled.saltRadioButtonIcon-checked .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-disabled.saltRadioButtonIcon-checked .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-checked-disabled-fill, var(--salt-container-primary-background-disabled));\n stroke: var(--saltRadioButton-icon-checked-disabled-stroke, var(--salt-selectable-foreground-selectedDisabled));\n stroke-width: calc(var(--salt-size-border) * 6.5);\n}\n\n/* Styles applied to radio button icon with error */\n.saltRadioButtonIcon-error .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-error .saltRadioButtonIcon-circle {\n stroke: var(--saltRadioButton-icon-error-stroke, var(--salt-status-error-foreground));\n}\n\n.saltRadioButton:hover .saltRadioButtonIcon-error .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-error-hover-fill, var(--salt-status-error-background));\n}\n\n/* Styles applied to radio button icon with error and disabled */\n.saltRadioButtonIcon-error.saltRadioButtonIcon-disabled .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-error.saltRadioButtonIcon-disabled .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-error-disabled-fill, var(--salt-selectable-background));\n stroke: var(--saltRadioButton-icon-error-disabled-stroke, var(--salt-status-error-foreground-disabled));\n}\n\n/* Styles applied to radio button icon when checked and with error */\n.saltRadioButtonIcon-checked.saltRadioButtonIcon-error .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-checked.saltRadioButtonIcon-error .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-error-fill, var(--salt-status-error-foreground));\n stroke: var(--saltRadioButton-icon-error-stroke, var(--salt-status-error-foreground));\n}\n\n/* Styles applied to radio button icon when checked and with error and disabled */\n.saltRadioButtonIcon-disabled.saltRadioButtonIcon-checked.saltRadioButtonIcon-error .saltRadioButtonIcon-circle,\n.saltRadioButton:hover .saltRadioButtonIcon-disabled.saltRadioButtonIcon-checked.saltRadioButtonIcon-error .saltRadioButtonIcon-circle {\n fill: var(--saltRadioButton-icon-error-disabled-fill, var(--salt-container-primary-background-disabled));\n stroke: var(--saltRadioButton-icon-error-disabled-stroke, var(--salt-status-error-foreground-disabled));\n}\n\n/* Styles applied to checked inner circle */\n.saltRadioButtonIcon-checked-circle {\n fill: var(--saltRadioButton-icon-inner-fill, var(--salt-container-primary-background));\n}\n\n/* Styles applied to checked inner circle when disabled */\n.saltRadioButtonIcon-disabled .saltRadioButtonIcon-checked-circle {\n fill: var(--saltRadioButton-icon-inner-disabled-fill, var(--salt-container-primary-background-disabled));\n}\n";
1
+ var css_248z = "/* Styles applied to radio button icon */\n.saltRadioButtonIcon {\n --radioButton-size: var(--salt-size-selectable);\n width: var(--radioButton-size);\n height: var(--radioButton-size);\n min-width: var(--radioButton-size);\n min-height: var(--radioButton-size);\n border-radius: 50%;\n\n border: var(--salt-size-border) var(--salt-container-borderStyle) var(--salt-selectable-borderColor);\n color: var(--salt-selectable-foreground);\n background: var(--salt-container-primary-background);\n --saltIcon-color: currentColor;\n --saltIcon-size: 100%;\n display: flex;\n}\n\n.saltRadioButton:hover .saltRadioButtonIcon {\n border-color: var(--salt-selectable-borderColor-hover);\n color: var(--salt-selectable-foreground-hover);\n}\n\n.saltRadioButtonIcon-checked {\n border-color: var(--salt-selectable-borderColor-selected);\n color: var(--salt-selectable-foreground-selected);\n}\n\n.saltRadioButtonIcon-disabled,\n.saltRadioButton:hover .saltRadioButtonIcon-disabled {\n border-color: var(--salt-selectable-borderColor-disabled);\n background: var(--salt-container-primary-background-disabled);\n color: var(--salt-selectable-foreground-disabled);\n}\n\n.saltRadioButtonIcon-checked.saltRadioButtonIcon-disabled,\n.saltRadioButton:hover .saltRadioButtonIcon-checked.saltRadioButtonIcon-disabled {\n border-color: var(--salt-selectable-borderColor-selectedDisabled);\n color: var(--salt-selectable-foreground-selectedDisabled);\n}\n\n.saltRadioButtonIcon-error,\n.saltRadioButton:hover .saltRadioButtonIcon-error {\n color: var(--salt-status-error-foreground);\n border-color: var(--salt-status-error-borderColor);\n outline-color: var(--salt-status-error-foreground);\n}\n\n.saltRadioButtonIcon-warning,\n.saltRadioButton:hover .saltRadioButtonIcon-warning {\n color: var(--salt-status-warning-foreground);\n border-color: var(--salt-status-warning-borderColor);\n outline-color: var(--salt-status-warning-foreground);\n}\n\n.saltRadioButtonIcon-readOnly,\n.saltRadioButton:hover .saltRadioButtonIcon-readOnly {\n border-color: var(--salt-selectable-borderColor-readonly);\n color: var(--salt-text-primary-foreground);\n}\n";
2
2
 
3
3
  export { css_248z as default };
4
4
  //# sourceMappingURL=RadioButtonIcon.css.js.map
@@ -1,4 +1,4 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
1
+ import { jsx } from 'react/jsx-runtime';
2
2
  import 'react';
3
3
  import { makePrefixer } from '../utils/makePrefixer.js';
4
4
  import '../utils/useFloatingUI.js';
@@ -6,15 +6,19 @@ import '../utils/useId.js';
6
6
  import '../salt-provider/SaltProvider.js';
7
7
  import '../viewport/ViewportProvider.js';
8
8
  import { clsx } from 'clsx';
9
- import css_248z from './RadioButtonIcon.css.js';
10
9
  import { useComponentCssInjection } from '@salt-ds/styles';
11
10
  import { useWindow } from '@salt-ds/window';
11
+ import css_248z from './RadioButtonIcon.css.js';
12
12
 
13
13
  const withBaseName = makePrefixer("saltRadioButtonIcon");
14
14
  const RadioButtonIcon = ({
15
15
  checked,
16
+ className,
16
17
  error,
17
- disabled
18
+ disabled,
19
+ validationStatus,
20
+ readOnly,
21
+ ...rest
18
22
  }) => {
19
23
  const targetWindow = useWindow();
20
24
  useComponentCssInjection({
@@ -22,29 +26,30 @@ const RadioButtonIcon = ({
22
26
  css: css_248z,
23
27
  window: targetWindow
24
28
  });
25
- return /* @__PURE__ */ jsxs("svg", {
26
- className: clsx(withBaseName(), {
27
- [withBaseName("checked")]: checked,
28
- [withBaseName("error")]: error,
29
- [withBaseName("disabled")]: disabled
30
- }),
31
- height: "14",
32
- viewBox: "0 0 14 14",
33
- width: "14",
34
- children: [
35
- /* @__PURE__ */ jsx("circle", {
36
- className: withBaseName("circle"),
37
- cx: "7",
38
- cy: "7",
39
- r: "6.5"
40
- }),
41
- checked && /* @__PURE__ */ jsx("circle", {
42
- className: withBaseName("checked-circle"),
43
- cx: "7",
44
- cy: "7",
45
- r: "3.2"
29
+ return /* @__PURE__ */ jsx("div", {
30
+ "aria-hidden": "true",
31
+ className: clsx(
32
+ withBaseName(),
33
+ {
34
+ [withBaseName("checked")]: checked,
35
+ [withBaseName("error")]: error,
36
+ [withBaseName("disabled")]: disabled,
37
+ [withBaseName(validationStatus || "")]: validationStatus,
38
+ [withBaseName("readOnly")]: readOnly
39
+ },
40
+ className
41
+ ),
42
+ ...rest,
43
+ children: checked && /* @__PURE__ */ jsx("svg", {
44
+ xmlns: "http://www.w3.org/2000/svg",
45
+ viewBox: "0 0 12 12",
46
+ fill: "currentColor",
47
+ children: /* @__PURE__ */ jsx("path", {
48
+ fillRule: "evenodd",
49
+ d: "M0 6a6 6 0 1 1 12 0A6 6 0 0 1 0 6Zm6 3a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z",
50
+ clipRule: "evenodd"
46
51
  })
47
- ]
52
+ })
48
53
  });
49
54
  };
50
55
 
@@ -1 +1 @@
1
- {"version":3,"file":"RadioButtonIcon.js","sources":["../src/radio-button/RadioButtonIcon.tsx"],"sourcesContent":["import { makePrefixer } from \"../utils\";\nimport { clsx } from \"clsx\";\nimport radioButtonIconCss from \"./RadioButtonIcon.css\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nconst withBaseName = makePrefixer(\"saltRadioButtonIcon\");\n\nexport interface RadioButtonIconProps {\n checked?: boolean;\n error?: boolean;\n disabled?: boolean;\n}\n\n/**\n * Default radio icon\n */\nexport const RadioButtonIcon = ({\n checked,\n error,\n disabled,\n}: RadioButtonIconProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-radio-button-icon\",\n css: radioButtonIconCss,\n window: targetWindow,\n });\n return (\n <svg\n className={clsx(withBaseName(), {\n [withBaseName(\"checked\")]: checked,\n [withBaseName(\"error\")]: error,\n [withBaseName(\"disabled\")]: disabled,\n })}\n height=\"14\"\n viewBox=\"0 0 14 14\"\n width=\"14\"\n >\n <circle className={withBaseName(\"circle\")} cx=\"7\" cy=\"7\" r=\"6.5\" />\n {checked && (\n <circle\n className={withBaseName(\"checked-circle\")}\n cx=\"7\"\n cy=\"7\"\n r=\"3.2\"\n />\n )}\n </svg>\n );\n};\n"],"names":["radioButtonIconCss"],"mappings":";;;;;;;;;;;;AAMA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA,CAAA;AAWhD,MAAM,kBAAkB,CAAC;AAAA,EAC9B,OAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AACF,CAA4B,KAAA;AAC1B,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,wBAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AACD,EAAA,uBACG,IAAA,CAAA,KAAA,EAAA;AAAA,IACC,SAAA,EAAW,IAAK,CAAA,YAAA,EAAgB,EAAA;AAAA,MAC9B,CAAC,YAAa,CAAA,SAAS,CAAI,GAAA,OAAA;AAAA,MAC3B,CAAC,YAAa,CAAA,OAAO,CAAI,GAAA,KAAA;AAAA,MACzB,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,KAC7B,CAAA;AAAA,IACD,MAAO,EAAA,IAAA;AAAA,IACP,OAAQ,EAAA,WAAA;AAAA,IACR,KAAM,EAAA,IAAA;AAAA,IAEN,QAAA,EAAA;AAAA,sBAAC,GAAA,CAAA,QAAA,EAAA;AAAA,QAAO,SAAA,EAAW,aAAa,QAAQ,CAAA;AAAA,QAAG,EAAG,EAAA,GAAA;AAAA,QAAI,EAAG,EAAA,GAAA;AAAA,QAAI,CAAE,EAAA,KAAA;AAAA,OAAM,CAAA;AAAA,MAChE,2BACE,GAAA,CAAA,QAAA,EAAA;AAAA,QACC,SAAA,EAAW,aAAa,gBAAgB,CAAA;AAAA,QACxC,EAAG,EAAA,GAAA;AAAA,QACH,EAAG,EAAA,GAAA;AAAA,QACH,CAAE,EAAA,KAAA;AAAA,OACJ,CAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RadioButtonIcon.js","sources":["../src/radio-button/RadioButtonIcon.tsx"],"sourcesContent":["import { makePrefixer } from \"../utils\";\nimport { clsx } from \"clsx\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { AdornmentValidationStatus } from \"../status-adornment\";\nimport radioButtonIconCss from \"./RadioButtonIcon.css\";\nimport { ComponentPropsWithoutRef } from \"react\";\n\nconst withBaseName = makePrefixer(\"saltRadioButtonIcon\");\n\nexport interface RadioButtonIconProps extends ComponentPropsWithoutRef<\"div\"> {\n checked?: boolean;\n disabled?: boolean;\n /**\n * @deprecated Use validationStatus instead\n */\n error?: boolean;\n readOnly?: boolean;\n validationStatus?: AdornmentValidationStatus;\n}\n\n/**\n * Default radio icon\n */\nexport const RadioButtonIcon = ({\n checked,\n className,\n error,\n disabled,\n validationStatus,\n readOnly,\n ...rest\n}: RadioButtonIconProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-radio-button-icon\",\n css: radioButtonIconCss,\n window: targetWindow,\n });\n return (\n <div\n aria-hidden=\"true\"\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"checked\")]: checked,\n [withBaseName(\"error\")]: error,\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(validationStatus || \"\")]: validationStatus,\n [withBaseName(\"readOnly\")]: readOnly,\n },\n className\n )}\n {...rest}\n >\n {checked && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 12 12\"\n fill=\"currentColor\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M0 6a6 6 0 1 1 12 0A6 6 0 0 1 0 6Zm6 3a3 3 0 1 1 0-6 3 3 0 0 1 0 6Z\"\n clipRule=\"evenodd\"\n />\n </svg>\n )}\n </div>\n );\n};\n"],"names":["radioButtonIconCss"],"mappings":";;;;;;;;;;;;AAQA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA,CAAA;AAgBhD,MAAM,kBAAkB,CAAC;AAAA,EAC9B,OAAA;AAAA,EACA,SAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,gBAAA;AAAA,EACA,QAAA;AAAA,EACG,GAAA,IAAA;AACL,CAA4B,KAAA;AAC1B,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,wBAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AACD,EAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,IACC,aAAY,EAAA,MAAA;AAAA,IACZ,SAAW,EAAA,IAAA;AAAA,MACT,YAAa,EAAA;AAAA,MACb;AAAA,QACE,CAAC,YAAa,CAAA,SAAS,CAAI,GAAA,OAAA;AAAA,QAC3B,CAAC,YAAa,CAAA,OAAO,CAAI,GAAA,KAAA;AAAA,QACzB,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,QAC5B,CAAC,YAAA,CAAa,gBAAoB,IAAA,EAAE,CAAI,GAAA,gBAAA;AAAA,QACxC,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,OAC9B;AAAA,MACA,SAAA;AAAA,KACF;AAAA,IACC,GAAG,IAAA;AAAA,IAEH,qCACE,GAAA,CAAA,KAAA,EAAA;AAAA,MACC,KAAM,EAAA,4BAAA;AAAA,MACN,OAAQ,EAAA,WAAA;AAAA,MACR,IAAK,EAAA,cAAA;AAAA,MAEL,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,QACC,QAAS,EAAA,SAAA;AAAA,QACT,CAAE,EAAA,qEAAA;AAAA,QACF,QAAS,EAAA,SAAA;AAAA,OACX,CAAA;AAAA,KACF,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroupContext.js","sources":["../src/radio-button/internal/RadioGroupContext.tsx"],"sourcesContent":["import { ChangeEventHandler } from \"react\";\nimport { createContext } from \"../../utils\";\n\nexport interface RadioGroupContextValue {\n name?: string;\n value?: string;\n onChange?: ChangeEventHandler<HTMLElement>;\n}\n\nexport const RadioGroupContext = createContext<RadioGroupContextValue>(\n \"RadioGroupContext\",\n {}\n);\n"],"names":[],"mappings":";;;;;;;;AASO,MAAM,iBAAoB,GAAA,aAAA;AAAA,EAC/B,mBAAA;AAAA,EACA,EAAC;AACH;;;;"}
1
+ {"version":3,"file":"RadioGroupContext.js","sources":["../src/radio-button/internal/RadioGroupContext.tsx"],"sourcesContent":["import { ChangeEventHandler } from \"react\";\nimport { a11yValueAriaProps } from \"../../form-field-context\";\nimport { AdornmentValidationStatus } from \"../../status-adornment\";\nimport { createContext } from \"../../utils\";\n\nexport interface RadioGroupContextValue {\n a11yProps?: a11yValueAriaProps;\n disabled?: boolean;\n name?: string;\n value?: string;\n onChange?: ChangeEventHandler<HTMLElement>;\n readOnly?: boolean;\n validationStatus?: AdornmentValidationStatus;\n}\n\nexport const RadioGroupContext = createContext<RadioGroupContextValue>(\n \"RadioGroupContext\",\n {}\n);\n"],"names":[],"mappings":";;;;;;;;AAeO,MAAM,iBAAoB,GAAA,aAAA;AAAA,EAC/B,mBAAA;AAAA,EACA,EAAC;AACH;;;;"}
@@ -1,4 +1,4 @@
1
- var css_248z = ".saltStatusAdornment {\n fill: var(--saltStatusAdornment-color, var(--statusAdornment-color));\n display: inline-block;\n position: relative;\n height: var(--salt-icon-size-status-adornment);\n min-height: var(--salt-icon-size-status-adornment);\n}\n\n.saltStatusAdornment-error {\n --statusAdornment-color: var(--salt-status-error-foreground);\n}\n\n.saltStatusAdornment-warning {\n --statusAdornment-color: var(--salt-status-warning-foreground);\n}\n";
1
+ var css_248z = ".saltStatusAdornment {\n align-self: center;\n display: inline-block;\n fill: var(--saltStatusAdornment-color, var(--statusAdornment-color));\n height: var(--salt-icon-size-status-adornment);\n min-height: var(--salt-icon-size-status-adornment);\n padding-left: var(--salt-spacing-100);\n position: relative;\n}\n\n.saltStatusAdornment-error {\n --statusAdornment-color: var(--salt-status-error-foreground);\n}\n\n.saltStatusAdornment-warning {\n --statusAdornment-color: var(--salt-status-warning-foreground);\n}\n\n.saltStatusAdornment-success {\n --statusAdornment-color: var(--salt-status-success-foreground);\n}\n";
2
2
 
3
3
  export { css_248z as default };
4
4
  //# sourceMappingURL=StatusAdornment.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusAdornment.js","sources":["../src/status-adornment/StatusAdornment.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef } from \"react\";\nimport { IconProps } from \"@salt-ds/icons\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer } from \"../utils\";\nimport { ErrorAdornmentIcon } from \"./ErrorAdornment\";\nimport { SuccessAdornmentIcon } from \"./SuccessAdornment\";\nimport { WarningAdornmentIcon } from \"./WarningAdornment\";\n\nimport statusAdornmentCss from \"./StatusAdornment.css\";\n\nconst icons = {\n error: ErrorAdornmentIcon,\n warning: WarningAdornmentIcon,\n success: SuccessAdornmentIcon,\n};\n\ntype AdornmentValidationStatus = Exclude<ValidationStatus, \"info\">;\n\nexport interface StatusAdornmentProps extends IconProps {\n /**\n * Status adornment to be displayed.\n */\n status: AdornmentValidationStatus;\n}\n\nconst statusToAriaLabelMap: Record<AdornmentValidationStatus, string> = {\n error: \"error\",\n warning: \"warning\",\n success: \"success\",\n};\n\nconst withBaseName = makePrefixer(\"saltStatusAdornment\");\n\nexport const StatusAdornment = forwardRef<SVGSVGElement, StatusAdornmentProps>(\n function StatusAdornment({ className, status, ...restProps }, ref) {\n const AdornmentComponent = icons[status];\n const ariaLabel = statusToAriaLabelMap[status];\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-status-adornment\",\n css: statusAdornmentCss,\n window: targetWindow,\n });\n\n return (\n <AdornmentComponent\n className={clsx(withBaseName(), withBaseName(status), className)}\n aria-label={ariaLabel}\n {...restProps}\n ref={ref}\n />\n );\n }\n);\n"],"names":["StatusAdornment","statusAdornmentCss"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,KAAQ,GAAA;AAAA,EACZ,KAAO,EAAA,kBAAA;AAAA,EACP,OAAS,EAAA,oBAAA;AAAA,EACT,OAAS,EAAA,oBAAA;AACX,CAAA,CAAA;AAWA,MAAM,oBAAkE,GAAA;AAAA,EACtE,KAAO,EAAA,OAAA;AAAA,EACP,OAAS,EAAA,SAAA;AAAA,EACT,OAAS,EAAA,SAAA;AACX,CAAA,CAAA;AAEA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA,CAAA;AAEhD,MAAM,eAAkB,GAAA,UAAA;AAAA,EAC7B,SAASA,gBAAgB,CAAA,EAAE,WAAW,MAAW,EAAA,GAAA,SAAA,IAAa,GAAK,EAAA;AACjE,IAAA,MAAM,qBAAqB,KAAM,CAAA,MAAA,CAAA,CAAA;AACjC,IAAA,MAAM,YAAY,oBAAqB,CAAA,MAAA,CAAA,CAAA;AAEvC,IAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,uBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,uBACG,GAAA,CAAA,kBAAA,EAAA;AAAA,MACC,WAAW,IAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAM,GAAG,SAAS,CAAA;AAAA,MAC/D,YAAY,EAAA,SAAA;AAAA,MACX,GAAG,SAAA;AAAA,MACJ,GAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
1
+ {"version":3,"file":"StatusAdornment.js","sources":["../src/status-adornment/StatusAdornment.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef } from \"react\";\nimport { IconProps } from \"@salt-ds/icons\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer } from \"../utils\";\nimport { ErrorAdornmentIcon } from \"./ErrorAdornment\";\nimport { SuccessAdornmentIcon } from \"./SuccessAdornment\";\nimport { WarningAdornmentIcon } from \"./WarningAdornment\";\n\nimport statusAdornmentCss from \"./StatusAdornment.css\";\n\nconst icons = {\n error: ErrorAdornmentIcon,\n warning: WarningAdornmentIcon,\n success: SuccessAdornmentIcon,\n};\n\nexport type AdornmentValidationStatus = Exclude<ValidationStatus, \"info\">;\n\nexport interface StatusAdornmentProps extends IconProps {\n /**\n * Status adornment to be displayed.\n */\n status: AdornmentValidationStatus;\n}\n\nconst statusToAriaLabelMap: Record<AdornmentValidationStatus, string> = {\n error: \"error\",\n warning: \"warning\",\n success: \"success\",\n};\n\nconst withBaseName = makePrefixer(\"saltStatusAdornment\");\n\nexport const StatusAdornment = forwardRef<SVGSVGElement, StatusAdornmentProps>(\n function StatusAdornment({ className, status, ...restProps }, ref) {\n const AdornmentComponent = icons[status];\n const ariaLabel = statusToAriaLabelMap[status];\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-status-adornment\",\n css: statusAdornmentCss,\n window: targetWindow,\n });\n\n return (\n <AdornmentComponent\n className={clsx(withBaseName(), withBaseName(status), className)}\n aria-label={ariaLabel}\n {...restProps}\n ref={ref}\n />\n );\n }\n);\n"],"names":["StatusAdornment","statusAdornmentCss"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,KAAQ,GAAA;AAAA,EACZ,KAAO,EAAA,kBAAA;AAAA,EACP,OAAS,EAAA,oBAAA;AAAA,EACT,OAAS,EAAA,oBAAA;AACX,CAAA,CAAA;AAWA,MAAM,oBAAkE,GAAA;AAAA,EACtE,KAAO,EAAA,OAAA;AAAA,EACP,OAAS,EAAA,SAAA;AAAA,EACT,OAAS,EAAA,SAAA;AACX,CAAA,CAAA;AAEA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA,CAAA;AAEhD,MAAM,eAAkB,GAAA,UAAA;AAAA,EAC7B,SAASA,gBAAgB,CAAA,EAAE,WAAW,MAAW,EAAA,GAAA,SAAA,IAAa,GAAK,EAAA;AACjE,IAAA,MAAM,qBAAqB,KAAM,CAAA,MAAA,CAAA,CAAA;AACjC,IAAA,MAAM,YAAY,oBAAqB,CAAA,MAAA,CAAA,CAAA;AAEvC,IAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,uBAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,uBACG,GAAA,CAAA,kBAAA,EAAA;AAAA,MACC,WAAW,IAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,MAAM,GAAG,SAAS,CAAA;AAAA,MAC/D,YAAY,EAAA,SAAA;AAAA,MACX,GAAG,SAAA;AAAA,MACJ,GAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -2,7 +2,9 @@ import { useBreakpoints } from '../salt-provider/SaltProvider.js';
2
2
  import { useViewport } from '../viewport/ViewportProvider.js';
3
3
 
4
4
  const getCurrentBreakpoint = (breakpoints, width) => {
5
- const breakpointList = Object.entries(breakpoints);
5
+ const breakpointList = Object.entries(breakpoints).sort(
6
+ ([, a], [, b]) => a - b
7
+ );
6
8
  const [currentBreakpoint] = breakpointList.reduce((acc, val) => {
7
9
  const [, accWidth] = acc;
8
10
  const [breakpoint, breakpointWidth] = val;
@@ -20,8 +22,7 @@ const useCurrentBreakpoint = () => {
20
22
  };
21
23
  const useOrderedBreakpoints = () => {
22
24
  const breakpoints = useBreakpoints();
23
- const orderedBreakpoints = Object.entries(breakpoints).sort(([, a], [, b]) => a - b).map(([key]) => key);
24
- return orderedBreakpoints;
25
+ return Object.entries(breakpoints).sort(([, a], [, b]) => a - b).map(([key]) => key);
25
26
  };
26
27
  const isObject = (value) => {
27
28
  const type = typeof value;
@@ -31,7 +32,7 @@ const hasBreakpointValues = (value, breakpoints) => {
31
32
  return isObject(value) && Object.keys(value).every((key) => key in breakpoints);
32
33
  };
33
34
  const getResponsiveValue = (breakpointValues, breakpoints, viewport, defaultValue) => {
34
- const value = Object.entries(breakpointValues).reduce(
35
+ return Object.entries(breakpointValues).reduce(
35
36
  (acc, val) => {
36
37
  const [accWidth] = acc;
37
38
  const [breakpoint, breakpointValue] = val;
@@ -43,11 +44,12 @@ const getResponsiveValue = (breakpointValues, breakpoints, viewport, defaultValu
43
44
  },
44
45
  [0, defaultValue]
45
46
  )[1];
46
- return value;
47
47
  };
48
48
  const useResponsiveProp = (value, defaultValue) => {
49
49
  const breakpoints = useBreakpoints();
50
50
  const viewport = useViewport();
51
+ if (value === defaultValue)
52
+ return defaultValue;
51
53
  const currentViewport = getCurrentBreakpoint(breakpoints, viewport);
52
54
  if (hasBreakpointValues(value, breakpoints)) {
53
55
  return getResponsiveValue(
@@ -1 +1 @@
1
- {"version":3,"file":"useResponsiveProp.js","sources":["../src/utils/useResponsiveProp.ts"],"sourcesContent":["import { Breakpoints } from \"../breakpoints\";\nimport { useBreakpoints } from \"../salt-provider\";\nimport { useViewport } from \"../viewport\";\n\ntype BreakpointProp<T> = {\n [K in keyof Breakpoints]?: T;\n};\n\nexport type ResponsiveProp<T> = T | BreakpointProp<T>;\n\nexport const getCurrentBreakpoint = (\n breakpoints: Breakpoints,\n width: number\n) => {\n const breakpointList = Object.entries(breakpoints);\n\n const [currentBreakpoint] = (\n breakpointList as [keyof Breakpoints, number][]\n ).reduce((acc, val) => {\n const [, accWidth] = acc;\n const [breakpoint, breakpointWidth] = val;\n if (breakpointWidth < width && breakpointWidth > accWidth) {\n return [breakpoint, breakpointWidth];\n }\n return [...acc];\n }, breakpointList[0] as [keyof Breakpoints, number]);\n\n return currentBreakpoint;\n};\n\nexport const useCurrentBreakpoint = () => {\n const viewport = useViewport();\n\n const breakpoints = useBreakpoints();\n\n return getCurrentBreakpoint(breakpoints, viewport);\n};\n\nexport const useOrderedBreakpoints = () => {\n const breakpoints = useBreakpoints();\n\n const orderedBreakpoints = Object.entries(breakpoints)\n .sort(([, a], [, b]) => a - b)\n .map(([key]) => key);\n\n return orderedBreakpoints;\n};\n\nconst isObject = <T>(\n value: T\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): value is Record<string | number | symbol, any> => {\n const type = typeof value;\n return value !== null && (type === \"object\" || type === \"function\");\n};\n\nconst hasBreakpointValues = <T>(\n value: ResponsiveProp<T>,\n breakpoints: Breakpoints\n): value is BreakpointProp<T> => {\n return (\n isObject(value) && Object.keys(value).every((key) => key in breakpoints)\n );\n};\n\nconst getResponsiveValue = <T>(\n breakpointValues: BreakpointProp<T>,\n breakpoints: Breakpoints,\n viewport: keyof Breakpoints,\n defaultValue: T\n) => {\n const value = Object.entries(breakpointValues).reduce<[number, T]>(\n (acc, val) => {\n const [accWidth] = acc;\n const [breakpoint, breakpointValue] = val;\n\n const breakpointWidth =\n breakpoints[breakpoint as keyof typeof breakpoints];\n\n if (\n breakpointWidth >= accWidth &&\n breakpointWidth <= breakpoints[viewport]\n ) {\n return [breakpointWidth, breakpointValue];\n }\n\n return acc;\n },\n [0, defaultValue]\n )[1];\n\n return value;\n};\n\nexport const useResponsiveProp = <T>(\n value: ResponsiveProp<T>,\n defaultValue: T\n) => {\n const breakpoints = useBreakpoints();\n const viewport = useViewport();\n\n const currentViewport = getCurrentBreakpoint(breakpoints, viewport);\n\n if (hasBreakpointValues(value, breakpoints)) {\n return getResponsiveValue(\n value,\n breakpoints,\n currentViewport,\n defaultValue\n );\n }\n return value;\n};\n"],"names":[],"mappings":";;;AAUa,MAAA,oBAAA,GAAuB,CAClC,WAAA,EACA,KACG,KAAA;AACH,EAAM,MAAA,cAAA,GAAiB,MAAO,CAAA,OAAA,CAAQ,WAAW,CAAA,CAAA;AAEjD,EAAA,MAAM,CAAC,iBAAiB,CAAA,GACtB,eACA,MAAO,CAAA,CAAC,KAAK,GAAQ,KAAA;AACrB,IAAM,MAAA,GAAG,QAAQ,CAAI,GAAA,GAAA,CAAA;AACrB,IAAM,MAAA,CAAC,UAAY,EAAA,eAAe,CAAI,GAAA,GAAA,CAAA;AACtC,IAAI,IAAA,eAAA,GAAkB,KAAS,IAAA,eAAA,GAAkB,QAAU,EAAA;AACzD,MAAO,OAAA,CAAC,YAAY,eAAe,CAAA,CAAA;AAAA,KACrC;AACA,IAAO,OAAA,CAAC,GAAG,GAAG,CAAA,CAAA;AAAA,GAChB,EAAG,eAAe,CAAiC,CAAA,CAAA,CAAA;AAEnD,EAAO,OAAA,iBAAA,CAAA;AACT,EAAA;AAEO,MAAM,uBAAuB,MAAM;AACxC,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAE7B,EAAA,MAAM,cAAc,cAAe,EAAA,CAAA;AAEnC,EAAO,OAAA,oBAAA,CAAqB,aAAa,QAAQ,CAAA,CAAA;AACnD,EAAA;AAEO,MAAM,wBAAwB,MAAM;AACzC,EAAA,MAAM,cAAc,cAAe,EAAA,CAA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CAAA;AAAA,KACT;AAAA,IACA,CAAC,GAAG,YAAY,CAAA;AAAA,GAChB,CAAA,CAAA,CAAA,CAAA;AAEF,EAAO,OAAA,KAAA,CAAA;AACT,CAAA,CAAA;AAEa,MAAA,iBAAA,GAAoB,CAC/B,KAAA,EACA,YACG,KAAA;AACH,EAAA,MAAM,cAAc,cAAe,EAAA,CAAA;AACnC,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAE7B,EAAM,MAAA,eAAA,GAAkB,oBAAqB,CAAA,WAAA,EAAa,QAAQ,CAAA,CAAA;AAElE,EAAI,IAAA,mBAAA,CAAoB,KAAO,EAAA,WAAW,CAAG,EAAA;AAC3C,IAAO,OAAA,kBAAA;AAAA,MACL,KAAA;AAAA,MACA,WAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,KACF,CAAA;AAAA,GACF;AACA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
1
+ {"version":3,"file":"useResponsiveProp.js","sources":["../src/utils/useResponsiveProp.ts"],"sourcesContent":["import { Breakpoints } from \"../breakpoints\";\nimport { useBreakpoints } from \"../salt-provider\";\nimport { useViewport } from \"../viewport\";\n\ntype BreakpointProp<T> = {\n [K in keyof Breakpoints]?: T;\n};\n\nexport type ResponsiveProp<T> = T | BreakpointProp<T>;\n\nexport const getCurrentBreakpoint = (\n breakpoints: Breakpoints,\n width: number\n) => {\n const breakpointList = Object.entries(breakpoints).sort(\n ([, a], [, b]) => a - b\n );\n const [currentBreakpoint] = (\n breakpointList as [keyof Breakpoints, number][]\n ).reduce((acc, val) => {\n const [, accWidth] = acc;\n const [breakpoint, breakpointWidth] = val;\n if (breakpointWidth < width && breakpointWidth > accWidth) {\n return [breakpoint, breakpointWidth];\n }\n return [...acc];\n }, breakpointList[0] as [keyof Breakpoints, number]);\n\n return currentBreakpoint;\n};\n\nexport const useCurrentBreakpoint = () => {\n const viewport = useViewport();\n\n const breakpoints = useBreakpoints();\n\n return getCurrentBreakpoint(breakpoints, viewport);\n};\n\nexport const useOrderedBreakpoints = () => {\n const breakpoints = useBreakpoints();\n\n return Object.entries(breakpoints)\n .sort(([, a], [, b]) => a - b)\n .map(([key]) => key);\n};\n\nconst isObject = <T>(\n value: T\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): value is Record<string | number | symbol, any> => {\n const type = typeof value;\n return value !== null && (type === \"object\" || type === \"function\");\n};\n\nconst hasBreakpointValues = <T>(\n value: ResponsiveProp<T>,\n breakpoints: Breakpoints\n): value is BreakpointProp<T> => {\n return (\n isObject(value) && Object.keys(value).every((key) => key in breakpoints)\n );\n};\n\nconst getResponsiveValue = <T>(\n breakpointValues: BreakpointProp<T>,\n breakpoints: Breakpoints,\n viewport: keyof Breakpoints,\n defaultValue: T\n) => {\n return Object.entries(breakpointValues).reduce<[number, T]>(\n (acc, val) => {\n const [accWidth] = acc;\n const [breakpoint, breakpointValue] = val;\n\n const breakpointWidth =\n breakpoints[breakpoint as keyof typeof breakpoints];\n\n if (\n breakpointWidth >= accWidth &&\n breakpointWidth <= breakpoints[viewport]\n ) {\n return [breakpointWidth, breakpointValue];\n }\n\n return acc;\n },\n [0, defaultValue]\n )[1];\n};\n\nexport const useResponsiveProp = <T>(\n value: ResponsiveProp<T>,\n defaultValue: T\n) => {\n const breakpoints = useBreakpoints();\n const viewport = useViewport();\n // return early if the values are the same\n if (value === defaultValue) return defaultValue;\n\n const currentViewport = getCurrentBreakpoint(breakpoints, viewport);\n if (hasBreakpointValues(value, breakpoints)) {\n return getResponsiveValue(\n value,\n breakpoints,\n currentViewport,\n defaultValue\n );\n }\n return value;\n};\n"],"names":[],"mappings":";;;AAUa,MAAA,oBAAA,GAAuB,CAClC,WAAA,EACA,KACG,KAAA;AACH,EAAA,MAAM,cAAiB,GAAA,MAAA,CAAO,OAAQ,CAAA,WAAW,CAAE,CAAA,IAAA;AAAA,IACjD,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAA,KAAM,CAAI,GAAA,CAAA;AAAA,GACx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AAAA,GACF;AACA,EAAO,OAAA,KAAA,CAAA;AACT;;;;"}
@@ -1,4 +1,5 @@
1
1
  import { ChangeEventHandler, FocusEventHandler, InputHTMLAttributes, ReactNode } from "react";
2
+ import { AdornmentValidationStatus } from "../status-adornment";
2
3
  export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement>, "onChange" | "onBlur" | "onFocus"> {
3
4
  /**
4
5
  * If `true`, the checkbox will be checked.
@@ -14,6 +15,7 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement
14
15
  */
15
16
  disabled?: boolean;
16
17
  /**
18
+ * **Deprecated**: Use validationStatus instead
17
19
  * If `true`, the checkbox will be in the error state.
18
20
  */
19
21
  error?: boolean;
@@ -51,5 +53,12 @@ export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLLabelElement
51
53
  * The value of the checkbox.
52
54
  */
53
55
  value?: string;
56
+ /**
57
+ * Validation status, one of "warning" | "error" | "success"
58
+ *
59
+ * Checkbox has styling variants for "error" and "warning".
60
+ * No visual styling will be applied on "success" variant.
61
+ */
62
+ validationStatus?: AdornmentValidationStatus;
54
63
  }
55
64
  export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLLabelElement>>;
@@ -1,4 +1,5 @@
1
1
  import { ChangeEventHandler, ComponentPropsWithoutRef } from "react";
2
+ import { AdornmentValidationStatus } from "../status-adornment";
2
3
  export interface CheckboxGroupProps extends Omit<ComponentPropsWithoutRef<"fieldset">, "onChange"> {
3
4
  /**
4
5
  * The current checked options.
@@ -12,6 +13,10 @@ export interface CheckboxGroupProps extends Omit<ComponentPropsWithoutRef<"field
12
13
  * Display group of elements in a compact row.
13
14
  */
14
15
  direction?: "horizontal" | "vertical";
16
+ /**
17
+ * Disable the Checkbox group
18
+ */
19
+ disabled?: boolean;
15
20
  /**
16
21
  * The name used to reference the value of the control.
17
22
  */
@@ -21,9 +26,17 @@ export interface CheckboxGroupProps extends Omit<ComponentPropsWithoutRef<"field
21
26
  * `event.target.value` returns the value of the checkbox that was clicked.
22
27
  */
23
28
  onChange?: ChangeEventHandler<HTMLInputElement>;
29
+ /**
30
+ * If `true`, the component is read only.
31
+ */
32
+ readOnly?: boolean;
24
33
  /**
25
34
  * Only for horizontal direction. When `true` the text in radio button label will wrap to fit within the container. Otherwise, the checkboxes will wrap onto the next line.
26
35
  */
27
36
  wrap?: boolean;
37
+ /**
38
+ * Validation status.
39
+ */
40
+ validationStatus?: AdornmentValidationStatus;
28
41
  }
29
42
  export declare const CheckboxGroup: import("react").ForwardRefExoticComponent<CheckboxGroupProps & import("react").RefAttributes<HTMLFieldSetElement>>;
@@ -1,9 +1,15 @@
1
1
  /// <reference types="react" />
2
+ import { AdornmentValidationStatus } from "../status-adornment";
2
3
  export interface CheckboxIconProps {
3
4
  checked?: boolean;
4
5
  className?: string;
5
6
  disabled?: boolean;
7
+ /**
8
+ * @deprecated Use validationStatus instead
9
+ */
6
10
  error?: boolean;
7
11
  indeterminate?: boolean;
12
+ readOnly?: boolean;
13
+ validationStatus?: AdornmentValidationStatus;
8
14
  }
9
- export declare const CheckboxIcon: ({ checked, className: classNameProp, disabled, error, indeterminate, }: CheckboxIconProps) => JSX.Element;
15
+ export declare const CheckboxIcon: ({ checked, className, disabled, error, indeterminate, validationStatus, readOnly, }: CheckboxIconProps) => JSX.Element;
@@ -1,9 +1,15 @@
1
1
  /// <reference types="react" />
2
+ import { a11yValueAriaProps } from "../../form-field-context";
3
+ import { AdornmentValidationStatus } from "../../status-adornment";
2
4
  import { CheckboxGroupProps } from "../CheckboxGroup";
3
5
  export interface CheckboxGroupState {
6
+ a11yProps?: a11yValueAriaProps;
7
+ disabled?: boolean;
4
8
  name?: CheckboxGroupProps["name"];
5
9
  onChange?: CheckboxGroupProps["onChange"];
6
10
  checkedValues?: CheckboxGroupProps["checkedValues"];
11
+ readOnly?: boolean;
12
+ validationStatus?: AdornmentValidationStatus;
7
13
  }
8
14
  declare const CheckboxGroupContext: import("react").Context<CheckboxGroupState>;
9
15
  export { CheckboxGroupContext };
@@ -1,6 +1,6 @@
1
1
  import { HTMLAttributes } from "react";
2
2
  import { A11yValueProps } from "../form-field-context";
3
- export declare type FormFieldLabelPlacement = "top" | "left";
3
+ export declare type FormFieldLabelPlacement = "top" | "left" | "right";
4
4
  export interface FormFieldProps extends HTMLAttributes<HTMLDivElement>, A11yValueProps {
5
5
  /**
6
6
  * Disabled prop
@@ -21,6 +21,10 @@ export interface FormFieldProps extends HTMLAttributes<HTMLDivElement>, A11yValu
21
21
  * Used as suffix of FormFieldHelperText id: `helperText-{id}`
22
22
  */
23
23
  id?: string;
24
+ /**
25
+ * Displays necessity on label
26
+ */
27
+ necessity?: "required" | "optional" | "asterisk";
24
28
  /**
25
29
  * Validation status
26
30
  */
@@ -1,3 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { TextProps } from "../text";
3
- export declare const FormFieldLabel: ({ className, children, ...restProps }: Omit<TextProps<"label">, "variant" | "styleAs">) => JSX.Element;
3
+ export declare const FormFieldLabel: ({ className, children, pronounced, ...restProps }: Omit<TextProps<"label">, "variant" | "styleAs"> & {
4
+ pronounced?: boolean | undefined;
5
+ }) => JSX.Element;
@@ -1,4 +1,3 @@
1
1
  export * from "./FormField";
2
- export * from "./FormFieldControlWrapper";
3
2
  export * from "./FormFieldHelperText";
4
3
  export * from "./FormFieldLabel";
@@ -9,6 +9,7 @@ export interface A11yValueProps {
9
9
  */
10
10
  labelId?: string;
11
11
  }
12
+ declare type NecessityType = "required" | "optional" | "asterisk";
12
13
  export interface a11yValueAriaProps {
13
14
  "aria-labelledby": A11yValueProps["labelId"];
14
15
  "aria-describedby": A11yValueProps["helperTextId"] | undefined;
@@ -16,7 +17,9 @@ export interface a11yValueAriaProps {
16
17
  export interface FormFieldContextValue {
17
18
  a11yProps: a11yValueAriaProps;
18
19
  disabled: boolean;
20
+ necessity: NecessityType | undefined;
19
21
  readOnly: boolean;
20
22
  validationStatus: "error" | "warning" | "success" | undefined;
21
23
  }
22
24
  export declare const FormFieldContext: import("react").Context<FormFieldContextValue>;
25
+ export {};
@@ -20,6 +20,7 @@ export * from "./panel";
20
20
  export * from "./radio-button";
21
21
  export * from "./spinner";
22
22
  export * from "./stack-layout";
23
+ export * from "./status-adornment";
23
24
  export * from "./status-indicator";
24
25
  export * from "./text";
25
26
  export * from "./theme";
@@ -1,2 +1 @@
1
1
  export * from "./Input";
2
- export * from "./adornment-button/AdornmentButton";
@@ -1,5 +1,6 @@
1
- import { ChangeEventHandler, FocusEventHandler, HTMLAttributes, InputHTMLAttributes, ReactNode } from "react";
2
- export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLLabelElement>, "onChange" | "onBlur" | "onFocus"> {
1
+ import { ChangeEventHandler, ComponentPropsWithoutRef, FocusEventHandler, InputHTMLAttributes, ReactNode } from "react";
2
+ import { AdornmentValidationStatus } from "../status-adornment";
3
+ export interface RadioButtonProps extends Omit<ComponentPropsWithoutRef<"label">, "onChange" | "onBlur" | "onFocus"> {
3
4
  /**
4
5
  * Set the default selected radio button in the group
5
6
  */
@@ -9,6 +10,7 @@ export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLLabelElement>,
9
10
  */
10
11
  disabled?: boolean;
11
12
  /**
13
+ * **Deprecated**: Use validationStatus instead
12
14
  * Set the error state
13
15
  */
14
16
  error?: boolean;
@@ -36,9 +38,20 @@ export interface RadioButtonProps extends Omit<HTMLAttributes<HTMLLabelElement>,
36
38
  * Callback for focus event
37
39
  */
38
40
  onFocus?: FocusEventHandler<HTMLInputElement>;
41
+ /**
42
+ * Set the read only state.
43
+ */
44
+ readOnly?: boolean;
39
45
  /**
40
46
  * Value of radio button
41
47
  */
42
48
  value?: string;
49
+ /**
50
+ * Validation status, one of "warning" | "error" | "success"
51
+ *
52
+ * RadioButton has styling variants for "error" and "warning".
53
+ * No visual styling will be applied on "success" variant.
54
+ */
55
+ validationStatus?: AdornmentValidationStatus;
43
56
  }
44
57
  export declare const RadioButton: import("react").ForwardRefExoticComponent<RadioButtonProps & import("react").RefAttributes<HTMLLabelElement>>;
@@ -8,6 +8,10 @@ export interface RadioButtonGroupProps extends Omit<ComponentPropsWithoutRef<"fi
8
8
  * Set the group direction.
9
9
  */
10
10
  direction?: "horizontal" | "vertical";
11
+ /**
12
+ * Disable the RadioButton group
13
+ */
14
+ disabled?: boolean;
11
15
  /**
12
16
  * Only for horizontal direction. When `true` the text in radio button label will wrap to fit within the container. Otherwise the radio buttons will wrap onto the next line.
13
17
  */
@@ -20,9 +24,17 @@ export interface RadioButtonGroupProps extends Omit<ComponentPropsWithoutRef<"fi
20
24
  * Callback for change event.
21
25
  */
22
26
  onChange?: ChangeEventHandler<HTMLInputElement>;
27
+ /**
28
+ * Set the RadioButton group to read only.
29
+ */
30
+ readOnly?: boolean;
23
31
  /**
24
32
  * The value of the radio group, required for a controlled component.
25
33
  */
26
34
  value?: string;
35
+ /**
36
+ * Validation status.
37
+ */
38
+ validationStatus?: "error" | "warning";
27
39
  }
28
40
  export declare const RadioButtonGroup: import("react").ForwardRefExoticComponent<RadioButtonGroupProps & import("react").RefAttributes<HTMLFieldSetElement>>;