@hitachivantara/uikit-react-core 5.38.1 → 5.38.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 (52) hide show
  1. package/dist/cjs/components/Banner/Banner.cjs.map +1 -1
  2. package/dist/cjs/components/Banner/BannerContent/BannerContent.cjs.map +1 -1
  3. package/dist/cjs/components/BaseCheckBox/BaseCheckBox.cjs.map +1 -1
  4. package/dist/cjs/components/BaseInput/BaseInput.cjs +1 -1
  5. package/dist/cjs/components/BaseInput/BaseInput.cjs.map +1 -1
  6. package/dist/cjs/components/BaseRadio/BaseRadio.cjs.map +1 -1
  7. package/dist/cjs/components/BaseSwitch/BaseSwitch.cjs.map +1 -1
  8. package/dist/cjs/components/Box/Box.cjs.map +1 -1
  9. package/dist/cjs/components/Button/Button.styles.cjs +7 -18
  10. package/dist/cjs/components/Button/Button.styles.cjs.map +1 -1
  11. package/dist/cjs/components/Card/Content/Content.cjs.map +1 -1
  12. package/dist/cjs/components/Card/Header/Header.cjs.map +1 -1
  13. package/dist/cjs/components/Container/Container.cjs.map +1 -1
  14. package/dist/cjs/components/Dialog/Actions/Actions.cjs.map +1 -1
  15. package/dist/cjs/components/Dialog/Content/Content.cjs.map +1 -1
  16. package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -1
  17. package/dist/cjs/components/Drawer/Drawer.cjs.map +1 -1
  18. package/dist/cjs/components/Grid/Grid.cjs.map +1 -1
  19. package/dist/cjs/components/ListContainer/ListItem/ListItem.cjs.map +1 -1
  20. package/dist/cjs/components/Radio/Radio.cjs.map +1 -1
  21. package/dist/cjs/components/Section/Section.cjs.map +1 -1
  22. package/dist/cjs/components/Snackbar/Snackbar.cjs.map +1 -1
  23. package/dist/cjs/components/Snackbar/SnackbarContent/SnackbarContent.cjs.map +1 -1
  24. package/dist/cjs/components/Switch/Switch.cjs.map +1 -1
  25. package/dist/cjs/components/Tab/Tab.cjs.map +1 -1
  26. package/dist/esm/components/Banner/Banner.js.map +1 -1
  27. package/dist/esm/components/Banner/BannerContent/BannerContent.js.map +1 -1
  28. package/dist/esm/components/BaseCheckBox/BaseCheckBox.js.map +1 -1
  29. package/dist/esm/components/BaseInput/BaseInput.js +1 -1
  30. package/dist/esm/components/BaseInput/BaseInput.js.map +1 -1
  31. package/dist/esm/components/BaseRadio/BaseRadio.js.map +1 -1
  32. package/dist/esm/components/BaseSwitch/BaseSwitch.js.map +1 -1
  33. package/dist/esm/components/Box/Box.js.map +1 -1
  34. package/dist/esm/components/Button/Button.styles.js +7 -18
  35. package/dist/esm/components/Button/Button.styles.js.map +1 -1
  36. package/dist/esm/components/Card/Content/Content.js.map +1 -1
  37. package/dist/esm/components/Card/Header/Header.js.map +1 -1
  38. package/dist/esm/components/Container/Container.js.map +1 -1
  39. package/dist/esm/components/Dialog/Actions/Actions.js.map +1 -1
  40. package/dist/esm/components/Dialog/Content/Content.js.map +1 -1
  41. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  42. package/dist/esm/components/Drawer/Drawer.js.map +1 -1
  43. package/dist/esm/components/Grid/Grid.js.map +1 -1
  44. package/dist/esm/components/ListContainer/ListItem/ListItem.js.map +1 -1
  45. package/dist/esm/components/Radio/Radio.js.map +1 -1
  46. package/dist/esm/components/Section/Section.js.map +1 -1
  47. package/dist/esm/components/Snackbar/Snackbar.js.map +1 -1
  48. package/dist/esm/components/Snackbar/SnackbarContent/SnackbarContent.js.map +1 -1
  49. package/dist/esm/components/Switch/Switch.js.map +1 -1
  50. package/dist/esm/components/Tab/Tab.js.map +1 -1
  51. package/dist/types/index.d.ts +23 -27
  52. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useState } from \"react\";\n\nimport { RadioProps as MuiRadioProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { HvBaseRadio } from \"@core/components/BaseRadio\";\nimport {\n HvWarningText,\n HvLabelProps,\n isInvalid,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Radio.styles\";\n\nexport { staticClasses as radioClasses };\n\nexport type HvRadioClasses = ExtractNames<typeof useClasses>;\n\nexport type HvRadioStatus = \"standBy\" | \"valid\" | \"invalid\";\n\nexport interface HvRadioProps\n extends Omit<MuiRadioProps, \"onChange\" | \"classes\">,\n HvBaseProps<HTMLButtonElement, \"onChange\" | \"color\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes?: HvRadioClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * The default value is \"on\".\n */\n value?: any;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that user input is required on the form element.\n *\n * If a single radio button in a group has the required attribute, a radio button in\n * that group must be check, though it doesn't have to be the one with the attribute is applied.\n *\n * For that reason, the component doesn't make any uncontrolled changes to its validation status.\n * That should ideally be managed in the context of a radio button group.\n */\n required?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * If `true` the radio button is selected, if set to `false` the radio button is not selected.\n *\n * When defined the radio button state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n */\n status?: HvRadioStatus;\n /**\n * The error message to show when `status` is \"invalid\".\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the radio button.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the radio button is pressed.\n */\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any\n ) => void;\n /**\n * Whether the selector should use semantic colors.\n */\n semantic?: boolean;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * Callback fired when the component is focused with a keyboard.\n * We trigger a `onFocus` callback too.\n */\n onFocusVisible?: (event: React.FocusEvent<any>) => void;\n /** @ignore */\n ref?: MuiRadioProps[\"ref\"];\n /** @ignore */\n component?: MuiRadioProps[\"component\"];\n}\n\n/**\n * A Radio Button is a mechanism that allows user to select just an option from a group of options.\n *\n * It should used in a Radio Button Group to present the user with a range of options from\n * which the user <b>may select just one option</b> to complete their task.\n *\n * Individual use of radio buttons, at least uncontrolled, is unadvised as React state management doesn't\n * respond to the browser's native management of radio inputs checked state.\n */\nexport const HvRadio = forwardRef<HTMLButtonElement, HvRadioProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n checked,\n defaultChecked = false,\n onChange,\n status = \"standBy\",\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n semantic = false,\n inputProps,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvRadio\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvradio\");\n\n const [focusVisible, setFocusVisible] = useState(false);\n\n const onFocusVisibleCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(true);\n onFocusVisible?.(evt);\n },\n [onFocusVisible]\n );\n\n const onBlurCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(false);\n onBlur?.(evt);\n },\n [onBlur]\n );\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>, newChecked: boolean) => {\n setIsChecked(newChecked);\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, setIsChecked, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled\n const canShowError =\n ariaErrorMessage == null &&\n status !== undefined &&\n statusMessage !== undefined;\n\n const hasLabel = label != null;\n\n const isStateInvalid = isInvalid(status);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n const radio = (\n <HvBaseRadio\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n className={cx(classes.radio, {\n [classes.invalidRadio]: isStateInvalid,\n })}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n semantic={semantic}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={status || \"standBy\"}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {hasLabel ? (\n <div\n className={cx(classes.container, {\n [classes.disabled]: disabled,\n [classes.focusVisible]: !!(focusVisible && label),\n [classes.invalidContainer]: isStateInvalid,\n })}\n >\n {radio}\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n </div>\n ) : (\n radio\n )}\n {canShowError && (\n <HvWarningText id={setId(elementId, \"error\")} disableBorder>\n {statusMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvRadio","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","semantic","inputProps","onFocusVisible","onBlur","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","focusVisible","setFocusVisible","useState","onFocusVisibleCallback","useCallback","evt","onBlurCallback","isChecked","setIsChecked","useControlled","Boolean","onLocalChange","newChecked","canShowError","undefined","hasLabel","isStateInvalid","isInvalid","errorMessageId","setId","radio","invalidRadio","root","container","invalidContainer"],"mappings":";;;;;;;;;;;;;AAuIO,MAAMA,UAAUC,WACrB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC;AAAAA,IACAC,iBAAiB;AAAA,IACjBC;AAAAA,IACAC,SAAS;AAAA,IACTC;AAAAA,IACA,qBAAqBC;AAAAA,IACrBC,WAAW;AAAA,IACXC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,WAAW3B,KAAK;AAE9B,QAAA;AAAA,IAAEE;AAAAA,IAAS0B;AAAAA,EAAAA,IAAOC,WAAW1B,WAAW;AAExC2B,QAAAA,YAAYC,YAAY1B,IAAI,SAAS;AAE3C,QAAM,CAAC2B,cAAcC,eAAe,IAAIC,SAAS,KAAK;AAEhDC,QAAAA,yBAAyBC,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U,WAClB,UACA,UACA,UACA,WAAWS,GAAG1B,QAAQoD,MAAMlD,SAAS,GAEpC2C,UAAAA;AAAAA,IAAAA,WACE,qBAAA,OAAA,EACC,WAAWnB,GAAG1B,QAAQqD,WAAW;AAAA,MAC/B,CAACrD,QAAQQ,QAAQ,GAAGA;AAAAA,MACpB,CAACR,QAAQ8B,YAAY,GAAG,CAAC,EAAEA,gBAAgBrB;AAAAA,MAC3C,CAACT,QAAQsD,gBAAgB,GAAGR;AAAAA,IAC7B,CAAA,GAEAI,UAAAA;AAAAA,MAAAA;AAAAA,0BACA,SACC,EAAA,IAAID,MAAMrB,WAAW,OAAO,GAC5B,SAASqB,MAAMrB,WAAW,OAAO,GACjC,OACA,WAAW5B,QAAQS,OACnB,GAAII,YAAW;AAAA,IAAA,EAAA,CAEnB,IAEAqC;AAAAA,IAEDP,gBACE,oBAAA,eAAA,EAAc,IAAIM,MAAMrB,WAAW,OAAO,GAAG,eAAa,MACxDV,UACH,cAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
1
+ {"version":3,"file":"Radio.js","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useState } from \"react\";\n\nimport { RadioProps as MuiRadioProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseRadio } from \"@core/components/BaseRadio\";\nimport {\n HvWarningText,\n HvLabelProps,\n isInvalid,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Radio.styles\";\n\nexport { staticClasses as radioClasses };\n\nexport type HvRadioClasses = ExtractNames<typeof useClasses>;\n\nexport type HvRadioStatus = \"standBy\" | \"valid\" | \"invalid\";\n\nexport interface HvRadioProps\n extends Omit<MuiRadioProps, \"onChange\" | \"classes\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the radio button.\n */\n classes?: HvRadioClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * The default value is \"on\".\n */\n value?: any;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be provided.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that user input is required on the form element.\n *\n * If a single radio button in a group has the required attribute, a radio button in\n * that group must be check, though it doesn't have to be the one with the attribute is applied.\n *\n * For that reason, the component doesn't make any uncontrolled changes to its validation status.\n * That should ideally be managed in the context of a radio button group.\n */\n required?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * If `true` the radio button is selected, if set to `false` the radio button is not selected.\n *\n * When defined the radio button state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n */\n status?: HvRadioStatus;\n /**\n * The error message to show when `status` is \"invalid\".\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the radio button.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the radio button is pressed.\n */\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any\n ) => void;\n /**\n * Whether the selector should use semantic colors.\n */\n semantic?: boolean;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /**\n * Callback fired when the component is focused with a keyboard.\n * We trigger a `onFocus` callback too.\n */\n onFocusVisible?: (event: React.FocusEvent<any>) => void;\n /** @ignore */\n ref?: MuiRadioProps[\"ref\"];\n /** @ignore */\n component?: MuiRadioProps[\"component\"];\n}\n\n/**\n * A Radio Button is a mechanism that allows user to select just an option from a group of options.\n *\n * It should used in a Radio Button Group to present the user with a range of options from\n * which the user <b>may select just one option</b> to complete their task.\n *\n * Individual use of radio buttons, at least uncontrolled, is unadvised as React state management doesn't\n * respond to the browser's native management of radio inputs checked state.\n */\nexport const HvRadio = forwardRef<HTMLButtonElement, HvRadioProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n checked,\n defaultChecked = false,\n onChange,\n status = \"standBy\",\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n semantic = false,\n inputProps,\n onFocusVisible,\n onBlur,\n ...others\n } = useDefaultProps(\"HvRadio\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvradio\");\n\n const [focusVisible, setFocusVisible] = useState(false);\n\n const onFocusVisibleCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(true);\n onFocusVisible?.(evt);\n },\n [onFocusVisible]\n );\n\n const onBlurCallback = useCallback(\n (evt: React.FocusEvent<any>) => {\n setFocusVisible(false);\n onBlur?.(evt);\n },\n [onBlur]\n );\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>, newChecked: boolean) => {\n setIsChecked(newChecked);\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, setIsChecked, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled\n const canShowError =\n ariaErrorMessage == null &&\n status !== undefined &&\n statusMessage !== undefined;\n\n const hasLabel = label != null;\n\n const isStateInvalid = isInvalid(status);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n const radio = (\n <HvBaseRadio\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n className={cx(classes.radio, {\n [classes.invalidRadio]: isStateInvalid,\n })}\n disabled={disabled}\n readOnly={readOnly}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n semantic={semantic}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n onFocusVisible={onFocusVisibleCallback}\n onBlur={onBlurCallback}\n {...others}\n />\n );\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={status || \"standBy\"}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {hasLabel ? (\n <div\n className={cx(classes.container, {\n [classes.disabled]: disabled,\n [classes.focusVisible]: !!(focusVisible && label),\n [classes.invalidContainer]: isStateInvalid,\n })}\n >\n {radio}\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n </div>\n ) : (\n radio\n )}\n {canShowError && (\n <HvWarningText id={setId(elementId, \"error\")} disableBorder>\n {statusMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvRadio","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","semantic","inputProps","onFocusVisible","onBlur","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","focusVisible","setFocusVisible","useState","onFocusVisibleCallback","useCallback","evt","onBlurCallback","isChecked","setIsChecked","useControlled","Boolean","onLocalChange","newChecked","canShowError","undefined","hasLabel","isStateInvalid","isInvalid","errorMessageId","setId","radio","invalidRadio","root","container","invalidContainer"],"mappings":";;;;;;;;;;;;;AAqIO,MAAMA,UAAUC,WACrB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IACnB,oBAAoBC;AAAAA,IACpBC;AAAAA,IACAC;AAAAA,IACAC,iBAAiB;AAAA,IACjBC;AAAAA,IACAC,SAAS;AAAA,IACTC;AAAAA,IACA,qBAAqBC;AAAAA,IACrBC,WAAW;AAAA,IACXC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,WAAW3B,KAAK;AAE9B,QAAA;AAAA,IAAEE;AAAAA,IAAS0B;AAAAA,EAAAA,IAAOC,WAAW1B,WAAW;AAExC2B,QAAAA,YAAYC,YAAY1B,IAAI,SAAS;AAE3C,QAAM,CAAC2B,cAAcC,eAAe,IAAIC,SAAS,KAAK;AAEhDC,QAAAA,yBAAyBC,YAC7B,CAACC,QAA+B;AAC9BJ,oBAAgB,IAAI;AACpBT,qBAAiBa,GAAG;AAAA,EAAA,GAEtB,CAACb,cAAc,CACjB;AAEMc,QAAAA,iBAAiBF,YACrB,CAACC,QAA+B;AAC9BJ,oBAAgB,KAAK;AACrBR,aAASY,GAAG;AAAA,EAAA,GAEd,CAACZ,MAAM,CACT;AAEM,QAAA,CAACc,WAAWC,YAAY,IAAIC,cAChCzB,SACA0B,QAAQzB,cAAc,CACxB;AAEA,QAAM0B,gBAAgBP,YACpB,CAACC,KAA0CO,eAAwB;AACjEJ,iBAAaI,UAAU;AAEZP,eAAAA,KAAKO,YAAYrC,KAAK;AAAA,EAEnC,GAAA,CAACW,U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,OACA,WAAW5B,QAAQS,OACnB,GAAII,YAAW;AAAA,IAAA,EAAA,CAEnB,IAEAqC;AAAAA,IAEDP,gBACE,oBAAA,eAAA,EAAc,IAAIM,MAAMrB,WAAW,OAAO,GAAG,eAAa,MACxDV,UACH,cAAA,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Section.js","sources":["../../../../src/components/Section/Section.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { Down, Up } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { setId } from \"@core/utils/setId\";\n\nimport { staticClasses, useClasses } from \"./Section.styles\";\n\nexport { staticClasses as sectionClasses };\n\nexport type HvSectionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSectionProps\n extends Omit<HvBaseProps<HTMLDivElement>, \"title\"> {\n /** The title of the section */\n title?: React.ReactNode;\n /** Whether or not the section is expandable. */\n expandable?: boolean;\n /** Whether the section is open or not, if this property is defined the accordion must be fully controlled. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** Section actions */\n actions?: React.ReactNode;\n /** Section onExpand callback */\n onToggle?: (\n event: React.MouseEventHandler<HTMLButtonElement>,\n open: boolean\n ) => void;\n /** Props to be passed to the expand button */\n expandButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the empty state component. */\n classes?: HvSectionClasses;\n}\n\n/**\n * Sections allow grouping information on a page under the same topic.\n */\nexport const HvSection = forwardRef<HTMLDivElement, HvSectionProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n title,\n expandable,\n expanded,\n defaultExpanded = true,\n actions,\n onToggle,\n expandButtonProps,\n children,\n ...others\n } = useDefaultProps(\"HvSection\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n\n const elementId = useUniqueId(id, \"hvSection\");\n const contentId = setId(elementId, \"content\");\n\n const showContent = expandable ? !!isOpen : true;\n\n return (\n <div\n ref={ref}\n id={elementId}\n className={cx(classes.root, className)}\n {...others}\n >\n <div className={classes.header}>\n {expandable && (\n <HvButton\n icon\n onClick={(event) => {\n setIsOpen((o) => !o);\n onToggle?.(event, !isOpen);\n }}\n aria-expanded={isOpen}\n aria-controls={contentId}\n aria-label={isOpen ? \"Collapse\" : \"Expand\"}\n {...expandButtonProps}\n >\n {isOpen ? <Up /> : <Down />}\n </HvButton>\n )}\n {title}\n <div className={classes.actions}>{actions}</div>\n </div>\n <div\n id={contentId}\n hidden={!isOpen}\n className={cx(classes.content, { [classes.hidden]: !showContent })}\n >\n {children}\n </div>\n </div>\n );\n }\n);\n"],"names":["HvSection","forwardRef","props","ref","id","classes","classesProp","className","title","expandable","expanded","defaultExpanded","actions","onToggle","expandButtonProps","children","others","useDefaultProps","cx","useClasses","isOpen","setIsOpen","useControlled","Boolean","elementId","useUniqueId","contentId","setId","showContent","root","header","event","o","content","hidden"],"mappings":";;;;;;;;;;AA2CO,MAAMA,YAAYC,WACvB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,kBAAkB;AAAA,IAClBC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,aAAaf,KAAK;AAEhC,QAAA;AAAA,IAAEG;AAAAA,IAASa;AAAAA,EAAAA,IAAOC,WAAWb,WAAW;AAExC,QAAA,CAACc,QAAQC,SAAS,IAAIC,cAC1BZ,UACAa,QAAQZ,eAAe,CACzB;AAEMa,QAAAA,YAAYC,YAAYrB,IAAI,WAAW;AACvCsB,QAAAA,YAAYC,MAAMH,WAAW,SAAS;AAE5C,QAAMI,cAAcnB,aAAa,CAAC,CAACW,SAAS;AAE5C,SACG,qBAAA,OAAA,EACC,KACA,IAAII,WACJ,WAAWN,GAAGb,QAAQwB,MAAMtB,SAAS,GACrC,GAAIS,QAEJ,UAAA;AAAA,IAAC,qBAAA,OAAA,EAAI,WAAWX,QAAQyB,QACrBrB,UAAAA;AAAAA,MAAAA,cACE,oBAAA,UAAA,EACC,MAAI,MACJ,SAAUsB,CAAU,UAAA;AACPC,kBAAAA,CAAAA,MAAM,CAACA,CAAC;AACRD,mBAAAA,OAAO,CAACX,MAAM;AAAA,MAAA,GAE3B,iBAAeA,QACf,iBAAeM,WACf,cAAYN,SAAS,aAAa,UAC9BN,GAAAA,mBAEHM,UAAS,SAAA,oBAAC,MAAK,IAAG,oBAAC,OAAO,CAAA,GAC7B;AAAA,MAEDZ;AAAAA,MACA,oBAAA,OAAA,EAAI,WAAWH,QAAQO,SAAUA,UAAQ,SAAA;AAAA,IAAA,GAC5C;AAAA,IACA,oBAAC,OACC,EAAA,IAAIc,WACJ,QAAQ,CAACN,QACT,WAAWF,GAAGb,QAAQ4B,SAAS;AAAA,MAAE,CAAC5B,QAAQ6B,MAAM,GAAG,CAACN;AAAAA,IAAAA,CAAa,GAEhEb,SACH,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ,CACF;"}
1
+ {"version":3,"file":"Section.js","sources":["../../../../src/components/Section/Section.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { Down, Up } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { HvButton, HvButtonProps } from \"@core/components/Button\";\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { setId } from \"@core/utils/setId\";\n\nimport { staticClasses, useClasses } from \"./Section.styles\";\n\nexport { staticClasses as sectionClasses };\n\nexport type HvSectionClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSectionProps\n extends Omit<HvBaseProps<HTMLDivElement>, \"title\"> {\n /** The title of the section */\n title?: React.ReactNode;\n /** Whether or not the section is expandable. */\n expandable?: boolean;\n /** Whether the section is open or not, if this property is defined the accordion must be fully controlled. */\n expanded?: boolean;\n /** When uncontrolled, defines the initial expanded state. */\n defaultExpanded?: boolean;\n /** Section actions */\n actions?: React.ReactNode;\n /** Section onExpand callback */\n onToggle?: (\n event: React.MouseEvent<HTMLButtonElement>,\n open: boolean\n ) => void;\n /** Props to be passed to the expand button */\n expandButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the empty state component. */\n classes?: HvSectionClasses;\n}\n\n/**\n * Sections allow grouping information on a page under the same topic.\n */\nexport const HvSection = forwardRef<HTMLDivElement, HvSectionProps>(\n (props, ref) => {\n const {\n id,\n classes: classesProp,\n className,\n title,\n expandable,\n expanded,\n defaultExpanded = true,\n actions,\n onToggle,\n expandButtonProps,\n children,\n ...others\n } = useDefaultProps(\"HvSection\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [isOpen, setIsOpen] = useControlled(\n expanded,\n Boolean(defaultExpanded)\n );\n\n const elementId = useUniqueId(id, \"hvSection\");\n const contentId = setId(elementId, \"content\");\n\n const showContent = expandable ? !!isOpen : true;\n\n return (\n <div\n ref={ref}\n id={elementId}\n className={cx(classes.root, className)}\n {...others}\n >\n <div className={classes.header}>\n {expandable && (\n <HvButton\n icon\n onClick={(event) => {\n setIsOpen((o) => !o);\n onToggle?.(event, !isOpen);\n }}\n aria-expanded={isOpen}\n aria-controls={contentId}\n aria-label={isOpen ? \"Collapse\" : \"Expand\"}\n {...expandButtonProps}\n >\n {isOpen ? <Up /> : <Down />}\n </HvButton>\n )}\n {title}\n <div className={classes.actions}>{actions}</div>\n </div>\n <div\n id={contentId}\n hidden={!isOpen}\n className={cx(classes.content, { [classes.hidden]: !showContent })}\n >\n {children}\n </div>\n </div>\n );\n }\n);\n"],"names":["HvSection","forwardRef","props","ref","id","classes","classesProp","className","title","expandable","expanded","defaultExpanded","actions","onToggle","expandButtonProps","children","others","useDefaultProps","cx","useClasses","isOpen","setIsOpen","useControlled","Boolean","elementId","useUniqueId","contentId","setId","showContent","root","header","event","o","content","hidden"],"mappings":";;;;;;;;;;AA2CO,MAAMA,YAAYC,WACvB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,kBAAkB;AAAA,IAClBC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,aAAaf,KAAK;AAEhC,QAAA;AAAA,IAAEG;AAAAA,IAASa;AAAAA,EAAAA,IAAOC,WAAWb,WAAW;AAExC,QAAA,CAACc,QAAQC,SAAS,IAAIC,cAC1BZ,UACAa,QAAQZ,eAAe,CACzB;AAEMa,QAAAA,YAAYC,YAAYrB,IAAI,WAAW;AACvCsB,QAAAA,YAAYC,MAAMH,WAAW,SAAS;AAE5C,QAAMI,cAAcnB,aAAa,CAAC,CAACW,SAAS;AAE5C,SACG,qBAAA,OAAA,EACC,KACA,IAAII,WACJ,WAAWN,GAAGb,QAAQwB,MAAMtB,SAAS,GACrC,GAAIS,QAEJ,UAAA;AAAA,IAAC,qBAAA,OAAA,EAAI,WAAWX,QAAQyB,QACrBrB,UAAAA;AAAAA,MAAAA,cACE,oBAAA,UAAA,EACC,MAAI,MACJ,SAAUsB,CAAU,UAAA;AACPC,kBAAAA,CAAAA,MAAM,CAACA,CAAC;AACRD,mBAAAA,OAAO,CAACX,MAAM;AAAA,MAAA,GAE3B,iBAAeA,QACf,iBAAeM,WACf,cAAYN,SAAS,aAAa,UAC9BN,GAAAA,mBAEHM,UAAS,SAAA,oBAAC,MAAK,IAAG,oBAAC,OAAO,CAAA,GAC7B;AAAA,MAEDZ;AAAAA,MACA,oBAAA,OAAA,EAAI,WAAWH,QAAQO,SAAUA,UAAQ,SAAA;AAAA,IAAA,GAC5C;AAAA,IACA,oBAAC,OACC,EAAA,IAAIc,WACJ,QAAQ,CAACN,QACT,WAAWF,GAAGb,QAAQ4B,SAAS;AAAA,MAAE,CAAC5B,QAAQ6B,MAAM,GAAG,CAACN;AAAAA,IAAAA,CAAa,GAEhEb,SACH,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ,CACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Snackbar.js","sources":["../../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import { SyntheticEvent } from \"react\";\nimport Slide from \"@mui/material/Slide\";\nimport {\n SnackbarCloseReason,\n SnackbarOrigin,\n SnackbarProps as MuiSnackbarProps,\n} from \"@mui/material/Snackbar\";\nimport { Snackbar as MuiSnackbar } from \"@mui/material\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvActionGeneric } from \"@core/components/ActionsGeneric\";\n\nimport { HvSnackbarContentProps, HvSnackbarContent } from \"./SnackbarContent\";\nimport { staticClasses, useClasses } from \"./Snackbar.styles\";\nimport { HvSnackbarVariant } from \"./types\";\n\nexport { staticClasses as snackbarClasses };\n\nexport type HvSnackbarClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarProps\n extends Omit<MuiSnackbarProps, \"action\" | \"classes\">,\n Omit<HvBaseProps, \"children\"> {\n /** If true, Snackbar is open. */\n open?: boolean;\n /** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */\n onClose?:\n | ((\n event: Event | SyntheticEvent<any, Event>,\n reason: SnackbarCloseReason\n ) => void)\n | undefined;\n /** The message to display. */\n label?: React.ReactNode;\n /** The anchor of the Snackbar. vertical: \"top\", \"bottom\" | horizontal: \"left\",\"center\",\"right. It defines where the snackbar will end his animation */\n anchorOrigin?: SnackbarOrigin;\n /** The number of milliseconds to wait before automatically calling the onClose function. onClose should then set the state of the open prop to hide the Snackbar */\n autoHideDuration?: number;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Custom icon to replace the variant default. */\n customIcon?: React.ReactNode;\n /** Controls if the associated icon to the variant should be shown. */\n showIcon?: boolean;\n /** Action to display. */\n action?: React.ReactNode | HvActionGeneric;\n /** The callback function ran when an action is triggered, receiving `action` as param */\n actionCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric\n ) => void;\n /** Duration of transition in milliseconds. */\n transitionDuration?: number;\n /** Direction of slide transition. */\n transitionDirection?: \"up\" | \"down\" | \"left\" | \"right\";\n /** Custom offset from top/bottom of the page, in px. */\n offset?: number;\n /** Others applied to the content of the snackbar. */\n snackbarContentProps?: HvSnackbarContentProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarClasses;\n /** @ignore */\n ref?: MuiSnackbarProps[\"ref\"];\n}\n\nconst transLeft = (props) => <Slide {...props} direction=\"left\" />;\nconst transRight = (props) => <Slide {...props} direction=\"right\" />;\nconst transUp = (props) => <Slide {...props} direction=\"up\" />;\nconst transDown = (props) => <Slide {...props} direction=\"down\" />;\n\nconst snackBarDirComponent = (direction) => {\n switch (direction) {\n case \"right\":\n return transRight;\n case \"up\":\n return transUp;\n case \"down\":\n return transDown;\n case \"left\":\n default:\n return transLeft;\n }\n};\n\n/**\n * A Snackbar provides brief messages about app processes.\n * It is dismissed automatically after a given interval.\n *\n * Snackbar can be built with two different components.\n * One is the HvSnackbar, which wraps all the positioning, transition, auto hide, etc.\n * The other is the HvSnackbarContent, which allows a finer control and customization of the content of the Snackbar.\n */\nexport const HvSnackbar = ({\n classes: classesProp,\n className,\n id,\n open = false,\n onClose,\n label = \"\",\n anchorOrigin = { vertical: \"top\", horizontal: \"right\" },\n autoHideDuration = 5000,\n variant = \"default\",\n showIcon = false,\n customIcon = null,\n action = null,\n actionCallback,\n transitionDuration = 300,\n transitionDirection = \"left\",\n offset = 60,\n snackbarContentProps,\n ...others\n}: HvSnackbarProps) => {\n const { classes } = useClasses(classesProp);\n\n const anchorOriginOffset = {\n anchorOriginTop: {\n top: `${offset}px`,\n },\n anchorOriginBottom: {\n bottom: `${offset}px`,\n },\n };\n\n return (\n <MuiSnackbar\n style={\n anchorOriginOffset[`anchorOrigin${capitalize(anchorOrigin.vertical)}`]\n }\n classes={classes}\n className={className}\n id={id}\n anchorOrigin={anchorOrigin}\n open={open}\n onClose={onClose}\n autoHideDuration={autoHideDuration}\n transitionDuration={transitionDuration}\n TransitionComponent={snackBarDirComponent(transitionDirection)}\n {...others}\n >\n <HvSnackbarContent\n id={setId(id, \"content\")}\n label={label}\n variant={variant}\n customIcon={customIcon}\n showIcon={showIcon}\n action={action}\n actionCallback={actionCallback}\n {...snackbarContentProps}\n />\n </MuiSnackbar>\n );\n};\n"],"names":["transLeft","props","transRight","transUp","transDown","snackBarDirComponent","direction","HvSnackbar","classes","classesProp","className","id","open","onClose","label","anchorOrigin","vertical","horizontal","autoHideDuration","variant","showIcon","customIcon","action","actionCallback","transitionDuration","transitionDirection","offset","snackbarContentProps","others","useClasses","anchorOriginOffset","anchorOriginTop","top","anchorOriginBottom","bottom","MuiSnackbar","capitalize","setId"],"mappings":";;;;;;;;AAsEA,MAAMA,YAAaC,CAAU,UAAA,oBAAC,SAAUA,GAAAA,OAAO,WAAU,OAAS,CAAA;AAClE,MAAMC,aAAcD,CAAU,UAAA,oBAAC,SAAUA,GAAAA,OAAO,WAAU,QAAU,CAAA;AACpE,MAAME,UAAWF,CAAU,UAAA,oBAAC,SAAUA,GAAAA,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,CAAA;AAEJ;"}
1
+ {"version":3,"file":"Snackbar.js","sources":["../../../../src/components/Snackbar/Snackbar.tsx"],"sourcesContent":["import { SyntheticEvent } from \"react\";\nimport Slide from \"@mui/material/Slide\";\nimport {\n SnackbarCloseReason,\n SnackbarOrigin,\n SnackbarProps as MuiSnackbarProps,\n} from \"@mui/material/Snackbar\";\nimport { Snackbar as MuiSnackbar } from \"@mui/material\";\n\nimport capitalize from \"lodash/capitalize\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { HvActionGeneric } from \"@core/components/ActionsGeneric\";\n\nimport { HvSnackbarContentProps, HvSnackbarContent } from \"./SnackbarContent\";\nimport { staticClasses, useClasses } from \"./Snackbar.styles\";\nimport { HvSnackbarVariant } from \"./types\";\n\nexport { staticClasses as snackbarClasses };\n\nexport type HvSnackbarClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarProps\n extends Omit<MuiSnackbarProps, \"action\" | \"classes\" | \"children\"> {\n /** If true, Snackbar is open. */\n open?: boolean;\n /** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */\n onClose?:\n | ((\n event: Event | SyntheticEvent<any, Event>,\n reason: SnackbarCloseReason\n ) => void)\n | undefined;\n /** The message to display. */\n label?: React.ReactNode;\n /** The anchor of the Snackbar. vertical: \"top\", \"bottom\" | horizontal: \"left\",\"center\",\"right. It defines where the snackbar will end his animation */\n anchorOrigin?: SnackbarOrigin;\n /** The number of milliseconds to wait before automatically calling the onClose function. onClose should then set the state of the open prop to hide the Snackbar */\n autoHideDuration?: number;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Custom icon to replace the variant default. */\n customIcon?: React.ReactNode;\n /** Controls if the associated icon to the variant should be shown. */\n showIcon?: boolean;\n /** Action to display. */\n action?: React.ReactNode | HvActionGeneric;\n /** The callback function ran when an action is triggered, receiving `action` as param */\n actionCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric\n ) => void;\n /** Duration of transition in milliseconds. */\n transitionDuration?: number;\n /** Direction of slide transition. */\n transitionDirection?: \"up\" | \"down\" | \"left\" | \"right\";\n /** Custom offset from top/bottom of the page, in px. */\n offset?: number;\n /** Others applied to the content of the snackbar. */\n snackbarContentProps?: HvSnackbarContentProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarClasses;\n /** @ignore */\n ref?: MuiSnackbarProps[\"ref\"];\n}\n\nconst transLeft = (props) => <Slide {...props} direction=\"left\" />;\nconst transRight = (props) => <Slide {...props} direction=\"right\" />;\nconst transUp = (props) => <Slide {...props} direction=\"up\" />;\nconst transDown = (props) => <Slide {...props} direction=\"down\" />;\n\nconst snackBarDirComponent = (direction) => {\n switch (direction) {\n case \"right\":\n return transRight;\n case \"up\":\n return transUp;\n case \"down\":\n return transDown;\n case \"left\":\n default:\n return transLeft;\n }\n};\n\n/**\n * A Snackbar provides brief messages about app processes.\n * It is dismissed automatically after a given interval.\n *\n * Snackbar can be built with two different components.\n * One is the HvSnackbar, which wraps all the positioning, transition, auto hide, etc.\n * The other is the HvSnackbarContent, which allows a finer control and customization of the content of the Snackbar.\n */\nexport const HvSnackbar = ({\n classes: classesProp,\n className,\n id,\n open = false,\n onClose,\n label = \"\",\n anchorOrigin = { vertical: \"top\", horizontal: \"right\" },\n autoHideDuration = 5000,\n variant = \"default\",\n showIcon = false,\n customIcon = null,\n action = null,\n actionCallback,\n transitionDuration = 300,\n transitionDirection = \"left\",\n offset = 60,\n snackbarContentProps,\n ...others\n}: HvSnackbarProps) => {\n const { classes } = useClasses(classesProp);\n\n const anchorOriginOffset = {\n anchorOriginTop: {\n top: `${offset}px`,\n },\n anchorOriginBottom: {\n bottom: `${offset}px`,\n },\n };\n\n return (\n <MuiSnackbar\n style={\n anchorOriginOffset[`anchorOrigin${capitalize(anchorOrigin.vertical)}`]\n }\n classes={classes}\n className={className}\n id={id}\n anchorOrigin={anchorOrigin}\n open={open}\n onClose={onClose}\n autoHideDuration={autoHideDuration}\n transitionDuration={transitionDuration}\n TransitionComponent={snackBarDirComponent(transitionDirection)}\n {...others}\n >\n <HvSnackbarContent\n id={setId(id, \"content\")}\n label={label}\n variant={variant}\n customIcon={customIcon}\n showIcon={showIcon}\n action={action}\n actionCallback={actionCallback}\n {...snackbarContentProps}\n />\n </MuiSnackbar>\n );\n};\n"],"names":["transLeft","props","transRight","transUp","transDown","snackBarDirComponent","direction","HvSnackbar","classes","classesProp","className","id","open","onClose","label","anchorOrigin","vertical","horizontal","autoHideDuration","variant","showIcon","customIcon","action","actionCallback","transitionDuration","transitionDirection","offset","snackbarContentProps","others","useClasses","anchorOriginOffset","anchorOriginTop","top","anchorOriginBottom","bottom","MuiSnackbar","capitalize","setId"],"mappings":";;;;;;;;AAoEA,MAAMA,YAAaC,CAAU,UAAA,oBAAC,SAAUA,GAAAA,OAAO,WAAU,OAAS,CAAA;AAClE,MAAMC,aAAcD,CAAU,UAAA,oBAAC,SAAUA,GAAAA,OAAO,WAAU,QAAU,CAAA;AACpE,MAAME,UAAWF,CAAU,UAAA,oBAAC,SAAUA,GAAAA,OAAO,WAAU,KAAO,CAAA;AAC9D,MAAMG,YAAaH,CAAU,UAAA,oBAAC,SAAUA,GAAAA,OAAO,WAAU,OAAS,CAAA;AAElE,MAAMI,uBAAwBC,CAAc,cAAA;AAC1C,UAAQA,WAAS;AAAA,IACf,KAAK;AACIJ,aAAAA;AAAAA,IACT,KAAK;AACIC,aAAAA;AAAAA,IACT,KAAK;AACIC,aAAAA;AAAAA,IACT,KAAK;AAAA,IACL;AACSJ,aAAAA;AAAAA,EACX;AACF;AAUO,MAAMO,aAAaA,CAAC;AAAA,EACzBC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC,OAAO;AAAA,EACPC;AAAAA,EACAC,QAAQ;AAAA,EACRC,eAAe;AAAA,IAAEC,UAAU;AAAA,IAAOC,YAAY;AAAA,EAAQ;AAAA,EACtDC,mBAAmB;AAAA,EACnBC,UAAU;AAAA,EACVC,WAAW;AAAA,EACXC,aAAa;AAAA,EACbC,SAAS;AAAA,EACTC;AAAAA,EACAC,qBAAqB;AAAA,EACrBC,sBAAsB;AAAA,EACtBC,SAAS;AAAA,EACTC;AAAAA,EACA,GAAGC;AACY,MAAM;AACf,QAAA;AAAA,IAAEpB;AAAAA,EAAAA,IAAYqB,WAAWpB,WAAW;AAE1C,QAAMqB,qBAAqB;AAAA,IACzBC,iBAAiB;AAAA,MACfC,KAAM,GAAEN,MAAO;AAAA,IACjB;AAAA,IACAO,oBAAoB;AAAA,MAClBC,QAAS,GAAER,MAAO;AAAA,IACpB;AAAA,EAAA;AAGF,6BACGS,UACC,EAAA,OACEL,mBAAoB,eAAcM,WAAWrB,aAAaC,QAAQ,CAAE,EAAC,GAEvE,SACA,WACA,IACA,cACA,MACA,SACA,kBACA,oBACA,qBAAqBX,qBAAqBoB,mBAAmB,GAC7D,GAAIG,QAEJ,8BAAC,mBACC,EAAA,IAAIS,MAAM1B,IAAI,SAAS,GACvB,OACA,SACA,YACA,UACA,QACA,gBACIgB,GAAAA,sBAAqB,EAE7B,CAAA;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SnackbarContent.js","sources":["../../../../../src/components/Snackbar/SnackbarContent/SnackbarContent.tsx"],"sourcesContent":["import { forwardRef, isValidElement } from \"react\";\n\nimport SnackbarContent, {\n SnackbarContentProps as MuiSnackbarContentProps,\n} from \"@mui/material/SnackbarContent\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { iconVariant } from \"@core/utils/iconVariant\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport {\n HvActionsGeneric,\n HvActionGeneric,\n} from \"@core/components/ActionsGeneric\";\nimport { HvButtonVariant } from \"@core/components/Button\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport { staticClasses, useClasses } from \"./SnackbarContent.styles\";\nimport { HvSnackbarVariant } from \"../types\";\n\nexport { staticClasses as snackbarContentClasses };\n\nexport type HvSnackbarContentClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarContentProps\n extends Omit<MuiSnackbarContentProps, \"variant\" | \"action\" | \"classes\">,\n HvBaseProps {\n /** The message to display. */\n label?: React.ReactNode;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Controls if the associated icon to the variant should be shown. */\n showIcon?: boolean;\n /** Custom icon to replace the variant default. */\n customIcon?: React.ReactNode;\n /** Action to display. */\n action?: React.ReactNode | HvActionGeneric;\n /** The callback function ran when an action is triggered, receiving `action` as param */\n actionCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric\n ) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarContentClasses;\n}\n\nexport const HvSnackbarContent = forwardRef<\n HTMLDivElement,\n HvSnackbarContentProps\n>((props: HvSnackbarContentProps, ref) => {\n const {\n className,\n id,\n classes: classesProp,\n label,\n variant = \"default\",\n showIcon,\n customIcon,\n action,\n actionCallback,\n ...others\n } = useDefaultProps(\"HvSnackbarContent\", props);\n\n const icon = customIcon || (showIcon && iconVariant(variant, \"base_dark\"));\n const innerAction: any = isValidElement(action) ? action : [action];\n\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n return (\n <SnackbarContent\n ref={ref}\n id={id}\n classes={{\n root: classes.root,\n message: classes.message,\n }}\n className={cx(classes?.[variant], className)}\n message={\n <div id={setId(id, \"message\")} className={classes.messageSpan}>\n {icon && <div className={classes.iconVariant}>{icon}</div>}\n <div className={classes.messageText}>{label}</div>\n {action && (\n <div id={setId(id, \"action\")} className={classes.action}>\n <HvActionsGeneric\n id={id}\n category={\n activeTheme?.snackbar.actionButtonVariant as HvButtonVariant\n }\n actions={innerAction}\n actionsCallback={actionCallback}\n />\n </div>\n )}\n </div>\n }\n {...others}\n />\n );\n});\n"],"names":["HvSnackbarContent","forwardRef","props","ref","className","id","classes","classesProp","label","variant","showIcon","customIcon","action","actionCallback","others","useDefaultProps","icon","iconVariant","innerAction","isValidElement","cx","useClasses","activeTheme","useTheme","root","message","setId","messageSpan","messageText","snackbar","actionButtonVariant"],"mappings":";;;;;;;;;;AAiDO,MAAMA,oBAAoBC,WAG/B,CAACC,OAA+BC,QAAQ;AAClC,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC,UAAU;AAAA,IACVC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,qBAAqBb,KAAK;AAE9C,QAAMc,OAAOL,cAAeD,YAAYO,YAAYR,SAAS,WAAW;AACxE,QAAMS,cAAmBC,eAAeP,MAAM,IAAIA,SAAS,CAACA,MAAM;AAE5D,QAAA;AAAA,IAAEN;AAAAA,IAASc;AAAAA,EAAAA,IAAOC,WAAWd,WAAW;AACxC,QAAA;AAAA,IAAEe;AAAAA,MAAgBC,SAAS;AAEjC,SACG,oBAAA,iBAAA,EACC,KACA,IACA,SAAS;AAAA,IACPC,MAAMlB,QAAQkB;AAAAA,IACdC,SAASnB,QAAQmB;AAAAA,EAAAA,GAEnB,WAAWL,GAAGd,UAAUG,OAAO,GAAGL,SAAS,GAC3C,SACG,qBAAA,OAAA,EAAI,IAAIsB,MAAMrB,IAAI,SAAS,GAAG,WAAWC,QAAQqB,aAC/CX,UAAAA;AAAAA,IAAAA,QAAS,oBAAA,OAAA,EAAI,WAAWV,QAAQW,aAAcD,UAAK,MAAA;AAAA,IACnD,oBAAA,OAAA,EAAI,WAAWV,QAAQsB,aAAcpB,UAAM,OAAA;AAAA,IAC3CI,8BACE,OAAI,EAAA,IAAIc,MAAMrB,IAAI,QAAQ,GAAG,WAAWC,QAAQM,QAC/C,8BAAC,kBACC,EAAA,IACA,UACEU,aAAaO,SAASC,qBAExB,SAASZ,aACT,iBAAiBL,eAAAA,CAAe,EAEpC,CAAA;AAAA,EAAA,GAEJ,GAEEC,GAAAA,OACJ,CAAA;AAEN,CAAC;"}
1
+ {"version":3,"file":"SnackbarContent.js","sources":["../../../../../src/components/Snackbar/SnackbarContent/SnackbarContent.tsx"],"sourcesContent":["import { forwardRef, isValidElement } from \"react\";\n\nimport SnackbarContent, {\n SnackbarContentProps as MuiSnackbarContentProps,\n} from \"@mui/material/SnackbarContent\";\n\nimport { ExtractNames } from \"@core/utils/classes\";\nimport { setId } from \"@core/utils/setId\";\nimport { iconVariant } from \"@core/utils/iconVariant\";\nimport {\n HvActionsGeneric,\n HvActionGeneric,\n} from \"@core/components/ActionsGeneric\";\nimport { HvButtonVariant } from \"@core/components/Button\";\nimport { useTheme } from \"@core/hooks/useTheme\";\n\nimport { useDefaultProps } from \"@core/hooks\";\n\nimport { staticClasses, useClasses } from \"./SnackbarContent.styles\";\nimport { HvSnackbarVariant } from \"../types\";\n\nexport { staticClasses as snackbarContentClasses };\n\nexport type HvSnackbarContentClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarContentProps\n extends Omit<MuiSnackbarContentProps, \"variant\" | \"action\" | \"classes\"> {\n /** The message to display. */\n label?: React.ReactNode;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Controls if the associated icon to the variant should be shown. */\n showIcon?: boolean;\n /** Custom icon to replace the variant default. */\n customIcon?: React.ReactNode;\n /** Action to display. */\n action?: React.ReactNode | HvActionGeneric;\n /** The callback function ran when an action is triggered, receiving `action` as param */\n actionCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric\n ) => void;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarContentClasses;\n}\n\nexport const HvSnackbarContent = forwardRef<\n HTMLDivElement,\n HvSnackbarContentProps\n>((props: HvSnackbarContentProps, ref) => {\n const {\n className,\n id,\n classes: classesProp,\n label,\n variant = \"default\",\n showIcon,\n customIcon,\n action,\n actionCallback,\n ...others\n } = useDefaultProps(\"HvSnackbarContent\", props);\n\n const icon = customIcon || (showIcon && iconVariant(variant, \"base_dark\"));\n const innerAction: any = isValidElement(action) ? action : [action];\n\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n return (\n <SnackbarContent\n ref={ref}\n id={id}\n classes={{\n root: classes.root,\n message: classes.message,\n }}\n className={cx(classes?.[variant], className)}\n message={\n <div id={setId(id, \"message\")} className={classes.messageSpan}>\n {icon && <div className={classes.iconVariant}>{icon}</div>}\n <div className={classes.messageText}>{label}</div>\n {action && (\n <div id={setId(id, \"action\")} className={classes.action}>\n <HvActionsGeneric\n id={id}\n category={\n activeTheme?.snackbar.actionButtonVariant as HvButtonVariant\n }\n actions={innerAction}\n actionsCallback={actionCallback}\n />\n </div>\n )}\n </div>\n }\n {...others}\n />\n );\n});\n"],"names":["HvSnackbarContent","forwardRef","props","ref","className","id","classes","classesProp","label","variant","showIcon","customIcon","action","actionCallback","others","useDefaultProps","icon","iconVariant","innerAction","isValidElement","cx","useClasses","activeTheme","useTheme","root","message","setId","messageSpan","messageText","snackbar","actionButtonVariant"],"mappings":";;;;;;;;;;AA+CO,MAAMA,oBAAoBC,WAG/B,CAACC,OAA+BC,QAAQ;AAClC,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAC,UAAU;AAAA,IACVC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACA,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,qBAAqBb,KAAK;AAE9C,QAAMc,OAAOL,cAAeD,YAAYO,YAAYR,SAAS,WAAW;AACxE,QAAMS,cAAmBC,eAAeP,MAAM,IAAIA,SAAS,CAACA,MAAM;AAE5D,QAAA;AAAA,IAAEN;AAAAA,IAASc;AAAAA,EAAAA,IAAOC,WAAWd,WAAW;AACxC,QAAA;AAAA,IAAEe;AAAAA,MAAgBC,SAAS;AAEjC,SACG,oBAAA,iBAAA,EACC,KACA,IACA,SAAS;AAAA,IACPC,MAAMlB,QAAQkB;AAAAA,IACdC,SAASnB,QAAQmB;AAAAA,EAAAA,GAEnB,WAAWL,GAAGd,UAAUG,OAAO,GAAGL,SAAS,GAC3C,SACG,qBAAA,OAAA,EAAI,IAAIsB,MAAMrB,IAAI,SAAS,GAAG,WAAWC,QAAQqB,aAC/CX,UAAAA;AAAAA,IAAAA,QAAS,oBAAA,OAAA,EAAI,WAAWV,QAAQW,aAAcD,UAAK,MAAA;AAAA,IACnD,oBAAA,OAAA,EAAI,WAAWV,QAAQsB,aAAcpB,UAAM,OAAA;AAAA,IAC3CI,8BACE,OAAI,EAAA,IAAIc,MAAMrB,IAAI,QAAQ,GAAG,WAAWC,QAAQM,QAC/C,8BAAC,kBACC,EAAA,IACA,UACEU,aAAaO,SAASC,qBAExB,SAASZ,aACT,iBAAiBL,eAAAA,CAAe,EAEpC,CAAA;AAAA,EAAA,GAEJ,GAEEC,GAAAA,OACJ,CAAA;AAEN,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from \"react\";\n\nimport { SwitchProps as MuiSwitchProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport {\n HvWarningText,\n HvLabelProps,\n HvFormStatus,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { HvBaseSwitch } from \"@core/components/BaseSwitch\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { isInvalid } from \"@core/components/Forms/FormElement/validationStates\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Switch.styles\";\n\nexport { staticClasses as switchClasses };\n\nexport type HvSwitchClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSwitchProps\n extends Omit<MuiSwitchProps, \"onChange\" | \"classes\">,\n HvBaseProps<HTMLButtonElement, \"onChange\" | \"color\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the switch.\n */\n classes?: HvSwitchClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * Is up to the application's logic when to consider the submission of this value.\n * Generally it should be used only when the switch is neither unchecked nor indeterminate.\n *\n * The default value is \"on\".\n */\n value?: any;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be inputted via inputProps.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * If `true` the switch is selected, if set to `false` the switch is not selected.\n *\n * When defined the switch state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to `checked`, depending of the values of both `required` and `checked`.\n */\n status?: HvFormStatus;\n /**\n * The error message to show when the validation status is \"invalid\".\n *\n * Defaults to \"Required\" when the status is uncontrolled and no `aria-errormessage` is provided.\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the switch.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the switch is pressed.\n */\n onChange?: (event: React.ChangeEvent, checked: boolean, value: any) => void;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /** @ignore */\n ref?: MuiSwitchProps[\"ref\"];\n /** @ignore */\n component?: MuiSwitchProps[\"component\"];\n}\n\n/**\n * A Switch is <b>binary</b> and work as a digital on/off button.\n *\n * Use when two states are <b>opposite</b> and to trigger immediate\n * changes in the system.\n */\nexport const HvSwitch = forwardRef<HTMLButtonElement, HvSwitchProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n\n checked,\n defaultChecked = false,\n\n onChange,\n\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n inputProps,\n\n ...others\n } = useDefaultProps(\"HvSwitch\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvswitch\");\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const [validationState, setValidationState] = useControlled(\n status,\n \"standBy\"\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const onLocalChange = useCallback(\n (evt, newChecked) => {\n setIsChecked(() => {\n // this will only run if uncontrolled\n if (required && !newChecked) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newChecked;\n });\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, required, setIsChecked, setValidationState, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const isStateInvalid = isInvalid(validationState);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {label && (\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n <div\n className={cx(classes.switchContainer, {\n [classes.invalidSwitch]: isStateInvalid,\n })}\n >\n <HvBaseSwitch\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n {...others}\n />\n </div>\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n className={classes.error}\n disableBorder\n disableAdornment\n hideText\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvSwitch","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","inputProps","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","isChecked","setIsChecked","useControlled","Boolean","validationState","setValidationState","validationMessage","onLocalChange","useCallback","evt","newChecked","canShowError","undefined","isStateInvalid","isInvalid","errorMessageId","setId","root","switchContainer","invalidSwitch","error"],"mappings":";;;;;;;;;;;;;AAwHO,MAAMA,WAAWC,WACtB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IAEXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBAAmBC;AAAAA,IAC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C,MAAMlB,WAAW,OAAO,GAC5B,SAASkB,MAAMlB,WAAW,OAAO,GACjC,OACA,WAAWzB,QAAQS,OACnB,GAAII,YAEP;AAAA,IACA,oBAAA,OAAA,EACC,WAAWU,GAAGvB,QAAQ6C,iBAAiB;AAAA,MACrC,CAAC7C,QAAQ8C,aAAa,GAAGN;AAAAA,IAC1B,CAAA,GAED,UAAA,oBAAC,cACC,EAAA,KACA,IAAI/B,QAAQkC,MAAMlB,WAAW,OAAO,IAAIkB,MAAMxC,IAAI,OAAO,GACzD,MACA,UACA,UACA,UACA,UAAU+B,eACV,OACA,SAASP,WACT,YAAY;AAAA,MACV,gBAAgBa,iBAAiB,OAAOD;AAAAA,MACxC,qBAAqBG;AAAAA,MACrB,cAAchC;AAAAA,MACd,mBAAmBC;AAAAA,MACnB,oBAAoBC;AAAAA,MACpB,GAAGQ;AAAAA,IAAAA,GAEDC,GAAAA,OAAO,CAAA,GAEf;AAAA,IACCiB,gBACE,oBAAA,eAAA,EACC,IAAIK,MAAMlB,WAAW,OAAO,GAC5B,WAAWzB,QAAQ+C,OACnB,eAAa,MACb,kBAAgB,MAChB,UAAQ,MAEPd,UACH,mBAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import React, { forwardRef, useCallback } from \"react\";\n\nimport { SwitchProps as MuiSwitchProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { useUniqueId } from \"@core/hooks/useUniqueId\";\nimport { useControlled } from \"@core/hooks/useControlled\";\nimport { setId } from \"@core/utils/setId\";\nimport {\n HvWarningText,\n HvLabelProps,\n HvFormStatus,\n HvFormElement,\n HvLabel,\n} from \"@core/components/Forms\";\nimport { HvBaseSwitch } from \"@core/components/BaseSwitch\";\nimport { isInvalid } from \"@core/components/Forms/FormElement/validationStates\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Switch.styles\";\n\nexport { staticClasses as switchClasses };\n\nexport type HvSwitchClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSwitchProps\n extends Omit<MuiSwitchProps, \"onChange\" | \"classes\"> {\n /**\n * A Jss Object used to override or extend the styles applied to the switch.\n */\n classes?: HvSwitchClasses;\n /**\n * The form element name.\n */\n name?: string;\n /**\n * The value of the form element.\n *\n * Is up to the application's logic when to consider the submission of this value.\n * Generally it should be used only when the switch is neither unchecked nor indeterminate.\n *\n * The default value is \"on\".\n */\n value?: any;\n /**\n * The label of the form element.\n *\n * The form element must be labeled for accessibility reasons.\n * If not provided, an aria-label or aria-labelledby must be inputted via inputProps.\n */\n label?: React.ReactNode;\n /**\n * Properties passed on to the label element.\n */\n labelProps?: HvLabelProps;\n /**\n * Indicates that the form element is disabled.\n */\n disabled?: boolean;\n /**\n * Indicates that the form element is not editable.\n */\n readOnly?: boolean;\n /**\n * Indicates that user input is required on the form element.\n */\n required?: boolean;\n /**\n * If `true` the switch is selected, if set to `false` the switch is not selected.\n *\n * When defined the switch state becomes controlled.\n */\n checked?: boolean;\n /**\n * When uncontrolled, defines the initial checked state.\n */\n defaultChecked?: boolean;\n /**\n * The status of the form element.\n *\n * Valid is correct, invalid is incorrect and standBy means no validations have run.\n *\n * When uncontrolled and unspecified it will default to \"standBy\" and change to either \"valid\"\n * or \"invalid\" after any change to `checked`, depending of the values of both `required` and `checked`.\n */\n status?: HvFormStatus;\n /**\n * The error message to show when the validation status is \"invalid\".\n *\n * Defaults to \"Required\" when the status is uncontrolled and no `aria-errormessage` is provided.\n */\n statusMessage?: string;\n /**\n * Identifies the element that provides an error message for the switch.\n *\n * Will only be used when the validation status is invalid.\n */\n \"aria-errormessage\"?: string;\n /**\n * The callback fired when the switch is pressed.\n */\n onChange?: (event: React.ChangeEvent, checked: boolean, value: any) => void;\n /**\n * Properties passed on to the input element.\n */\n inputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n /** @ignore */\n ref?: MuiSwitchProps[\"ref\"];\n /** @ignore */\n component?: MuiSwitchProps[\"component\"];\n}\n\n/**\n * A Switch is <b>binary</b> and work as a digital on/off button.\n *\n * Use when two states are <b>opposite</b> and to trigger immediate\n * changes in the system.\n */\nexport const HvSwitch = forwardRef<HTMLButtonElement, HvSwitchProps>(\n (props, ref) => {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n value = \"on\",\n required = false,\n readOnly = false,\n disabled = false,\n\n label,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n labelProps,\n\n checked,\n defaultChecked = false,\n\n onChange,\n\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n inputProps,\n\n ...others\n } = useDefaultProps(\"HvSwitch\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const elementId = useUniqueId(id, \"hvswitch\");\n\n const [isChecked, setIsChecked] = useControlled(\n checked,\n Boolean(defaultChecked)\n );\n\n const [validationState, setValidationState] = useControlled(\n status,\n \"standBy\"\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const onLocalChange = useCallback(\n (evt, newChecked) => {\n setIsChecked(() => {\n // this will only run if uncontrolled\n if (required && !newChecked) {\n setValidationState(\"invalid\");\n } else {\n setValidationState(\"valid\");\n }\n\n return newChecked;\n });\n\n onChange?.(evt, newChecked, value);\n },\n [onChange, required, setIsChecked, setValidationState, value]\n );\n\n // the error message area will only be created if:\n // - an external element that provides an error message isn't identified via aria-errormessage AND\n // - both status and statusMessage properties are being controlled OR\n // - status is uncontrolled and required is true\n const canShowError =\n ariaErrorMessage == null &&\n ((status !== undefined && statusMessage !== undefined) ||\n (status === undefined && required));\n\n const isStateInvalid = isInvalid(validationState);\n\n let errorMessageId: string | undefined;\n if (isStateInvalid) {\n errorMessageId = canShowError\n ? setId(elementId, \"error\")\n : ariaErrorMessage;\n }\n\n return (\n <HvFormElement\n id={id}\n name={name}\n status={validationState}\n disabled={disabled}\n required={required}\n readOnly={readOnly}\n className={cx(classes.root, className)}\n >\n {label && (\n <HvLabel\n id={setId(elementId, \"label\")}\n htmlFor={setId(elementId, \"input\")}\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n <div\n className={cx(classes.switchContainer, {\n [classes.invalidSwitch]: isStateInvalid,\n })}\n >\n <HvBaseSwitch\n ref={ref}\n id={label ? setId(elementId, \"input\") : setId(id, \"input\")}\n name={name}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n onChange={onLocalChange}\n value={value}\n checked={isChecked}\n inputProps={{\n \"aria-invalid\": isStateInvalid ? true : undefined,\n \"aria-errormessage\": errorMessageId,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n ...inputProps,\n }}\n {...others}\n />\n </div>\n {canShowError && (\n <HvWarningText\n id={setId(elementId, \"error\")}\n className={classes.error}\n disableBorder\n disableAdornment\n hideText\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n }\n);\n"],"names":["HvSwitch","forwardRef","props","ref","classes","classesProp","className","id","name","value","required","readOnly","disabled","label","ariaLabel","ariaLabelledBy","ariaDescribedBy","labelProps","checked","defaultChecked","onChange","status","statusMessage","ariaErrorMessage","inputProps","others","useDefaultProps","cx","useClasses","elementId","useUniqueId","isChecked","setIsChecked","useControlled","Boolean","validationState","setValidationState","validationMessage","onLocalChange","useCallback","evt","newChecked","canShowError","undefined","isStateInvalid","isInvalid","errorMessageId","setId","root","switchContainer","invalidSwitch","error"],"mappings":";;;;;;;;;;;;;AAsHO,MAAMA,WAAWC,WACtB,CAACC,OAAOC,QAAQ;AACR,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC;AAAAA,IAEAC;AAAAA,IACAC;AAAAA,IACAC,QAAQ;AAAA,IACRC,WAAW;AAAA,IACXC,WAAW;AAAA,IACXC,WAAW;AAAA,IAEXC;AAAAA,IACA,cAAcC;AAAAA,IACd,mBA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ACC,EAAA,IAAIkC,MAAMlB,WAAW,OAAO,GAC5B,SAASkB,MAAMlB,WAAW,OAAO,GACjC,OACA,WAAWzB,QAAQS,OACnB,GAAII,YAEP;AAAA,IACA,oBAAA,OAAA,EACC,WAAWU,GAAGvB,QAAQ6C,iBAAiB;AAAA,MACrC,CAAC7C,QAAQ8C,aAAa,GAAGN;AAAAA,IAC1B,CAAA,GAED,UAAA,oBAAC,cACC,EAAA,KACA,IAAI/B,QAAQkC,MAAMlB,WAAW,OAAO,IAAIkB,MAAMxC,IAAI,OAAO,GACzD,MACA,UACA,UACA,UACA,UAAU+B,eACV,OACA,SAASP,WACT,YAAY;AAAA,MACV,gBAAgBa,iBAAiB,OAAOD;AAAAA,MACxC,qBAAqBG;AAAAA,MACrB,cAAchC;AAAAA,MACd,mBAAmBC;AAAAA,MACnB,oBAAoBC;AAAAA,MACpB,GAAGQ;AAAAA,IAAAA,GAEDC,GAAAA,OAAO,CAAA,GAEf;AAAA,IACCiB,gBACE,oBAAA,eAAA,EACC,IAAIK,MAAMlB,WAAW,OAAO,GAC5B,WAAWzB,QAAQ+C,OACnB,eAAa,MACb,kBAAgB,MAChB,UAAQ,MAEPd,UACH,mBAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,CACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","sources":["../../../../src/components/Tab/Tab.tsx"],"sourcesContent":["import { Tab, TabProps as MuiTabProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Tab.styles\";\n\nexport { staticClasses as tabClasses };\n\nexport type HvTabClasses = ExtractNames<typeof useClasses>;\n\n// Mui Tab props: https://mui.com/material-ui/api/tab/#props\nexport interface HvTabProps\n extends Omit<MuiTabProps, \"children\">,\n HvBaseProps<HTMLDivElement, \"children\"> {\n /** If `true`, the tab will be disabled. */\n disabled?: boolean;\n /** The icon element. */\n icon?: React.ReactElement | string;\n /** The label element. */\n label?: React.ReactNode;\n /** The position of the icon relative to the label. */\n iconPosition?: \"bottom\" | \"end\" | \"start\" | \"top\";\n /** A Jss Object used to override or extend the component styles. */\n classes?: HvTabClasses;\n}\n\nexport const HvTab = (props: HvTabProps) => {\n const {\n classes: classesProp,\n iconPosition = \"top\",\n disabled = false,\n ...others\n } = useDefaultProps(\"HvTab\", props);\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <Tab\n classes={{\n root: classes.root,\n selected: classes.selected,\n disabled: classes.disabled,\n }}\n disableRipple\n disableTouchRipple\n // expose the global class HvIsFocusVisible as a marker\n // not to be styled directly, only as helper in specific css queries\n focusVisibleClassName={cx(\"HvIsFocusVisible\", classes.focusVisible)}\n disabled={disabled}\n iconPosition={iconPosition}\n {...others}\n />\n );\n};\n"],"names":["HvTab","props","classes","classesProp","iconPosition","disabled","others","useDefaultProps","cx","useClasses","root","selected","focusVisible"],"mappings":";;;;;AA4BaA,MAAAA,QAAQA,CAACC,UAAsB;AACpC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC,eAAe;AAAA,IACfC,WAAW;AAAA,IACX,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,SAASN,KAAK;AAC5B,QAAA;AAAA,IAAEC;AAAAA,IAASM;AAAAA,EAAAA,IAAOC,WAAWN,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACPO,MAAMR,QAAQQ;AAAAA,QACdC,UAAUT,QAAQS;AAAAA,QAClBN,UAAUH,QAAQG;AAAAA,MACpB;AAAA,MACA,eAAa;AAAA,MACb,oBAAA;AAAA,MAGA,uBAAuBG,GAAG,oBAAoBN,QAAQU,YAAY;AAAA,MAClE;AAAA,MACA;AAAA,MACA,GAAIN;AAAAA,IAAAA;AAAAA,EAAAA;AAGV;"}
1
+ {"version":3,"file":"Tab.js","sources":["../../../../src/components/Tab/Tab.tsx"],"sourcesContent":["import { Tab, TabProps as MuiTabProps } from \"@mui/material\";\n\nimport { useDefaultProps } from \"@core/hooks/useDefaultProps\";\nimport { ExtractNames } from \"@core/utils/classes\";\n\nimport { staticClasses, useClasses } from \"./Tab.styles\";\n\nexport { staticClasses as tabClasses };\n\nexport type HvTabClasses = ExtractNames<typeof useClasses>;\n\n// Mui Tab props: https://mui.com/material-ui/api/tab/#props\nexport interface HvTabProps extends Omit<MuiTabProps, \"children\"> {\n /** If `true`, the tab will be disabled. */\n disabled?: boolean;\n /** The icon element. */\n icon?: React.ReactElement | string;\n /** The label element. */\n label?: React.ReactNode;\n /** The position of the icon relative to the label. */\n iconPosition?: \"bottom\" | \"end\" | \"start\" | \"top\";\n /** A Jss Object used to override or extend the component styles. */\n classes?: HvTabClasses;\n}\n\nexport const HvTab = (props: HvTabProps) => {\n const {\n classes: classesProp,\n iconPosition = \"top\",\n disabled = false,\n ...others\n } = useDefaultProps(\"HvTab\", props);\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <Tab\n classes={{\n root: classes.root,\n selected: classes.selected,\n disabled: classes.disabled,\n }}\n disableRipple\n disableTouchRipple\n // expose the global class HvIsFocusVisible as a marker\n // not to be styled directly, only as helper in specific css queries\n focusVisibleClassName={cx(\"HvIsFocusVisible\", classes.focusVisible)}\n disabled={disabled}\n iconPosition={iconPosition}\n {...others}\n />\n );\n};\n"],"names":["HvTab","props","classes","classesProp","iconPosition","disabled","others","useDefaultProps","cx","useClasses","root","selected","focusVisible"],"mappings":";;;;;AAyBaA,MAAAA,QAAQA,CAACC,UAAsB;AACpC,QAAA;AAAA,IACJC,SAASC;AAAAA,IACTC,eAAe;AAAA,IACfC,WAAW;AAAA,IACX,GAAGC;AAAAA,EAAAA,IACDC,gBAAgB,SAASN,KAAK;AAC5B,QAAA;AAAA,IAAEC;AAAAA,IAASM;AAAAA,EAAAA,IAAOC,WAAWN,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,QACPO,MAAMR,QAAQQ;AAAAA,QACdC,UAAUT,QAAQS;AAAAA,QAClBN,UAAUH,QAAQG;AAAAA,MACpB;AAAA,MACA,eAAa;AAAA,MACb,oBAAA;AAAA,MAGA,uBAAuBG,GAAG,oBAAoBN,QAAQU,YAAY;AAAA,MAClE;AAAA,MACA;AAAA,MACA,GAAIN;AAAAA,IAAAA;AAAAA,EAAAA;AAGV;"}
@@ -836,6 +836,8 @@ export declare const findDescriptors: (children: any, descriptors?: {
836
836
  HvCalendarHeader?: Descriptor[] | undefined;
837
837
  };
838
838
 
839
+ declare type FixComponentProps<T> = T extends any ? T : never;
840
+
839
841
  export declare const focusClasses: {
840
842
  root: "HvFocus-root";
841
843
  disabled: "HvFocus-disabled";
@@ -1320,7 +1322,7 @@ export declare const HvBannerContent: ForwardRefExoticComponent<Omit<HvBannerCon
1320
1322
 
1321
1323
  export declare type HvBannerContentClasses = ExtractNames<typeof useClasses_75>;
1322
1324
 
1323
- export declare interface HvBannerContentProps extends Omit<SnackbarContentProps, "variant" | "classes" | "onClose">, HvBaseProps {
1325
+ export declare interface HvBannerContentProps extends Omit<SnackbarContentProps, "variant" | "classes" | "onClose"> {
1324
1326
  /** The message to display. */
1325
1327
  content?: string;
1326
1328
  /** Variant of the snackbar. */
@@ -1343,7 +1345,7 @@ export declare interface HvBannerContentProps extends Omit<SnackbarContentProps,
1343
1345
  classes?: HvBannerContentClasses;
1344
1346
  }
1345
1347
 
1346
- export declare interface HvBannerProps extends Omit<SnackbarProps, "anchorOrigin" | "classes" | "onClose">, HvBaseProps<HTMLDivElement, "children"> {
1348
+ export declare interface HvBannerProps extends Omit<SnackbarProps, "anchorOrigin" | "classes" | "onClose"> {
1347
1349
  /** If true, the snackbar is open. */
1348
1350
  open: boolean;
1349
1351
  /** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */
@@ -1390,7 +1392,7 @@ export declare const HvBaseCheckBox: React_2.ForwardRefExoticComponent<Omit<HvBa
1390
1392
 
1391
1393
  export declare type HvBaseCheckBoxClasses = ExtractNames<typeof useClasses_52>;
1392
1394
 
1393
- export declare interface HvBaseCheckBoxProps extends Omit<CheckboxProps, "onChange" | "classes">, HvBaseProps<HTMLButtonElement, "onChange" | "color"> {
1395
+ export declare interface HvBaseCheckBoxProps extends Omit<CheckboxProps, "onChange" | "classes"> {
1394
1396
  /**
1395
1397
  * The input name.
1396
1398
  */
@@ -1562,7 +1564,7 @@ export declare const HvBaseInput: (props: HvBaseInputProps) => JSX_2.Element;
1562
1564
 
1563
1565
  export declare type HvBaseInputClasses = ExtractNames<typeof useClasses_13>;
1564
1566
 
1565
- export declare interface HvBaseInputProps extends Omit<InputProps, "onChange" | "classes">, HvBaseProps<HTMLDivElement, "onChange" | "color" | "onBlur" | "onFocus" | "onInvalid" | "onKeyDown" | "onKeyUp"> {
1567
+ export declare interface HvBaseInputProps extends Omit<InputProps, "onChange" | "classes"> {
1566
1568
  /** The input name. */
1567
1569
  name?: string;
1568
1570
  /** The value of the input, when controlled. */
@@ -1609,7 +1611,7 @@ export declare const HvBaseRadio: React_2.ForwardRefExoticComponent<Omit<HvBaseR
1609
1611
 
1610
1612
  export declare type HvBaseRadioClasses = ExtractNames<typeof useClasses_53>;
1611
1613
 
1612
- export declare interface HvBaseRadioProps extends Omit<RadioProps, "onChange" | "classes">, HvBaseProps<HTMLButtonElement, "onChange" | "color"> {
1614
+ export declare interface HvBaseRadioProps extends Omit<RadioProps, "onChange" | "classes"> {
1613
1615
  /**
1614
1616
  * Class names to be applied.
1615
1617
  */
@@ -1687,7 +1689,7 @@ export declare const HvBaseSwitch: React_2.ForwardRefExoticComponent<Omit<HvBase
1687
1689
 
1688
1690
  export declare type HvBaseSwitchClasses = ExtractNames<typeof useClasses_56>;
1689
1691
 
1690
- export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange" | "classes">, HvBaseProps<HTMLButtonElement, "onChange" | "color"> {
1692
+ export declare interface HvBaseSwitchProps extends Omit<SwitchProps, "onChange" | "classes"> {
1691
1693
  /**
1692
1694
  * Class names to be applied.
1693
1695
  */
@@ -2049,9 +2051,7 @@ export declare const HvCardContent: ({ id, classes: classesProp, className, chil
2049
2051
 
2050
2052
  export declare type HvCardContentClasses = ExtractNames<typeof useClasses_22>;
2051
2053
 
2052
- export declare interface HvCardContentProps extends Omit<CardContentProps, "classes">, HvBaseProps {
2053
- /** Id to be applied to the root node. */
2054
- id?: string;
2054
+ export declare interface HvCardContentProps extends Omit<CardContentProps, "classes"> {
2055
2055
  /** The function that will be executed when this section is clicked. */
2056
2056
  onClick?: (event: React.SyntheticEvent) => void;
2057
2057
  /** A Jss Object used to override or extend the styles applied to the component. */
@@ -2062,7 +2062,7 @@ export declare const HvCardHeader: (props: HvCardHeaderProps) => JSX_2.Element;
2062
2062
 
2063
2063
  export declare type HvCardHeaderClasses = ExtractNames<typeof useClasses_21>;
2064
2064
 
2065
- export declare interface HvCardHeaderProps extends Omit<CardHeaderProps, "classes">, HvBaseProps<HTMLDivElement, "title"> {
2065
+ export declare interface HvCardHeaderProps extends Omit<CardHeaderProps, "classes"> {
2066
2066
  /** The renderable content inside the title slot of the header. */
2067
2067
  title: React.ReactNode;
2068
2068
  /** The renderable content inside the subheader slot of the header. */
@@ -2513,7 +2513,7 @@ export declare const HvContainer: ForwardRefExoticComponent<Omit<HvContainerProp
2513
2513
 
2514
2514
  export declare type HvContainerClasses = ExtractNames<typeof useClasses_24>;
2515
2515
 
2516
- export declare interface HvContainerProps extends Omit<ContainerProps, "classes">, HvBaseProps {
2516
+ export declare interface HvContainerProps extends Omit<ContainerProps, "classes"> {
2517
2517
  /**
2518
2518
  * The component used for the root node.
2519
2519
  * Either a string to use a DOM element or a component.
@@ -2732,7 +2732,7 @@ export declare type HvDialogActionClasses = ExtractNames<typeof useClasses_27>;
2732
2732
 
2733
2733
  export declare const HvDialogActions: (props: HvDialogActionsProps) => JSX_2.Element;
2734
2734
 
2735
- export declare interface HvDialogActionsProps extends Omit<DialogActionsProps, "classes">, HvBaseProps {
2735
+ export declare interface HvDialogActionsProps extends Omit<DialogActionsProps, "classes"> {
2736
2736
  /** Set the dialog to fullscreen mode. @deprecated set `fullscreen` in `HvDialog` */
2737
2737
  fullscreen?: boolean;
2738
2738
  /** A Jss Object used to override or extend the styles applied to the component. */
@@ -2745,14 +2745,14 @@ export declare const HvDialogContent: (props: HvDialogContentProps) => JSX_2.Ele
2745
2745
 
2746
2746
  export declare type HvDialogContentClasses = ExtractNames<typeof useClasses_26>;
2747
2747
 
2748
- export declare interface HvDialogContentProps extends Omit<DialogContentProps, "classes">, HvBaseProps {
2748
+ export declare interface HvDialogContentProps extends Omit<DialogContentProps, "classes"> {
2749
2749
  /** Content should be indented in relationship to the Dialog title. */
2750
2750
  indentContent?: boolean;
2751
2751
  /** A Jss Object used to override or extend the styles applied to the component. */
2752
2752
  classes?: HvDialogContentClasses;
2753
2753
  }
2754
2754
 
2755
- export declare interface HvDialogProps extends Omit<DialogProps, "fullScreen" | "classes" | "open">, HvBaseProps {
2755
+ export declare interface HvDialogProps extends Omit<DialogProps, "fullScreen" | "classes" | "open"> {
2756
2756
  /** Current state of the Dialog. */
2757
2757
  open?: boolean;
2758
2758
  /** Callback fired when the component requests to be closed. */
@@ -2852,7 +2852,7 @@ export declare const HvDrawer: (props: HvDrawerProps) => JSX_2.Element;
2852
2852
 
2853
2853
  export declare type HvDrawerClasses = ExtractNames<typeof useClasses_29>;
2854
2854
 
2855
- export declare interface HvDrawerProps extends DrawerProps, Omit<DrawerProps, "classes">, HvBaseProps<HTMLDivElement> {
2855
+ export declare interface HvDrawerProps extends Omit<DrawerProps, "classes"> {
2856
2856
  /**
2857
2857
  * Class names to be applied.
2858
2858
  */
@@ -3784,7 +3784,7 @@ export declare type HvGridClasses = ExtractNames<typeof useClasses_32>;
3784
3784
 
3785
3785
  export declare type HvGridDirection = "row" | "row-reverse" | "column" | "column-reverse";
3786
3786
 
3787
- export declare interface HvGridProps extends Omit<GridProps, "classes" | "columns">, HvBaseProps<HTMLDivElement, "color"> {
3787
+ export declare interface HvGridProps extends Omit<GridProps, "classes" | "columns"> {
3788
3788
  /**
3789
3789
  * If `true`, the component will have the flex *container* behavior.
3790
3790
  * You should be wrapping *items* with a *container*.
@@ -4347,10 +4347,6 @@ export declare const HvListItem: React_2.ForwardRefExoticComponent<HvListItemPro
4347
4347
  export declare type HvListItemClasses = ExtractNames<typeof useClasses_4>;
4348
4348
 
4349
4349
  export declare interface HvListItemProps extends HvBaseProps<HTMLLIElement> {
4350
- /**
4351
- * Overrides the implicit list item role.
4352
- */
4353
- role?: HvBaseProps<HTMLLIElement>["role"];
4354
4350
  /** Indicates if the list item is selected. */
4355
4351
  selected?: boolean;
4356
4352
  /** If true, the list item will be disabled. */
@@ -5217,7 +5213,7 @@ export declare interface HvRadioGroupProps extends HvBaseProps<HTMLDivElement, "
5217
5213
  classes?: HvRadioGroupClasses;
5218
5214
  }
5219
5215
 
5220
- export declare interface HvRadioProps extends Omit<RadioProps_2, "onChange" | "classes">, HvBaseProps<HTMLButtonElement, "onChange" | "color"> {
5216
+ export declare interface HvRadioProps extends Omit<RadioProps_2, "onChange" | "classes"> {
5221
5217
  /**
5222
5218
  * A Jss Object used to override or extend the styles applied to the radio button.
5223
5219
  */
@@ -5471,7 +5467,7 @@ export declare interface HvSectionProps extends Omit<HvBaseProps<HTMLDivElement>
5471
5467
  /** Section actions */
5472
5468
  actions?: React.ReactNode;
5473
5469
  /** Section onExpand callback */
5474
- onToggle?: (event: React.MouseEventHandler<HTMLButtonElement>, open: boolean) => void;
5470
+ onToggle?: (event: React.MouseEvent<HTMLButtonElement>, open: boolean) => void;
5475
5471
  /** Props to be passed to the expand button */
5476
5472
  expandButtonProps?: HvButtonProps;
5477
5473
  /** A Jss Object used to override or extend the styles applied to the empty state component. */
@@ -5735,7 +5731,7 @@ export declare const HvSnackbarContent: ForwardRefExoticComponent<Omit<HvSnackba
5735
5731
 
5736
5732
  export declare type HvSnackbarContentClasses = ExtractNames<typeof useClasses_77>;
5737
5733
 
5738
- export declare interface HvSnackbarContentProps extends Omit<SnackbarContentProps, "variant" | "action" | "classes">, HvBaseProps {
5734
+ export declare interface HvSnackbarContentProps extends Omit<SnackbarContentProps, "variant" | "action" | "classes"> {
5739
5735
  /** The message to display. */
5740
5736
  label?: React.ReactNode;
5741
5737
  /** Variant of the snackbar. */
@@ -5752,7 +5748,7 @@ export declare interface HvSnackbarContentProps extends Omit<SnackbarContentProp
5752
5748
  classes?: HvSnackbarContentClasses;
5753
5749
  }
5754
5750
 
5755
- export declare interface HvSnackbarProps extends Omit<SnackbarProps, "action" | "classes">, Omit<HvBaseProps, "children"> {
5751
+ export declare interface HvSnackbarProps extends Omit<SnackbarProps, "action" | "classes" | "children"> {
5756
5752
  /** If true, Snackbar is open. */
5757
5753
  open?: boolean;
5758
5754
  /** Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway. */
@@ -5904,7 +5900,7 @@ export declare interface HvSwitchColumnCellProp {
5904
5900
  switchProps?: HvBaseSwitchProps;
5905
5901
  }
5906
5902
 
5907
- export declare interface HvSwitchProps extends Omit<SwitchProps_2, "onChange" | "classes">, HvBaseProps<HTMLButtonElement, "onChange" | "color"> {
5903
+ export declare interface HvSwitchProps extends Omit<SwitchProps_2, "onChange" | "classes"> {
5908
5904
  /**
5909
5905
  * A Jss Object used to override or extend the styles applied to the switch.
5910
5906
  */
@@ -6297,7 +6293,7 @@ export declare interface HvTableState<D extends object = Record<string, unknown>
6297
6293
 
6298
6294
  export declare type HvTableVariant = "listrow" | "default";
6299
6295
 
6300
- export declare interface HvTabProps extends Omit<TabProps, "children">, HvBaseProps<HTMLDivElement, "children"> {
6296
+ export declare interface HvTabProps extends Omit<TabProps, "children"> {
6301
6297
  /** If `true`, the tab will be disabled. */
6302
6298
  disabled?: boolean;
6303
6299
  /** The icon element. */
@@ -7619,7 +7615,7 @@ export declare const panelClasses: {
7619
7615
  root: "HvPanel-root";
7620
7616
  };
7621
7617
 
7622
- declare type PolymorphicComponent<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
7618
+ declare type PolymorphicComponent<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & AsProp<C>> & FixComponentProps<Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>>;
7623
7619
 
7624
7620
  export declare type PolymorphicComponentRef<C extends React.ElementType, Props = {}> = PolymorphicComponent<C, Props> & {
7625
7621
  ref?: PolymorphicRef<C>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "5.38.1",
3
+ "version": "5.38.3",
4
4
  "private": false,
5
5
  "author": "Hitachi Vantara UI Kit Team",
6
6
  "description": "Core React components for the NEXT Design System.",
@@ -64,7 +64,7 @@
64
64
  "access": "public",
65
65
  "directory": "package"
66
66
  },
67
- "gitHead": "9a3c1e9133fd88de735dfc01248aa83abe4f7c98",
67
+ "gitHead": "2cc1a282b228d97c1c4540b65132062f5c951eeb",
68
68
  "main": "dist/cjs/index.cjs",
69
69
  "exports": {
70
70
  ".": {