@hitachivantara/uikit-react-core 5.87.0 → 5.87.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/BaseRadio/BaseRadio.styles.cjs +7 -6
- package/dist/cjs/BulkActions/BulkActions.cjs +9 -18
- package/dist/cjs/CheckBoxGroup/CheckBoxGroup.cjs +9 -9
- package/dist/cjs/FilterGroup/RightPanel/RightPanel.cjs +11 -12
- package/dist/cjs/Radio/Radio.cjs +2 -1
- package/dist/cjs/Radio/Radio.styles.cjs +7 -27
- package/dist/cjs/Table/TableCell/TableCell.styles.cjs +14 -14
- package/dist/cjs/Table/TableHeader/TableHeader.styles.cjs +16 -15
- package/dist/cjs/utils/CounterLabel.cjs +15 -0
- package/dist/esm/BaseRadio/BaseRadio.styles.js +7 -6
- package/dist/esm/BaseRadio/BaseRadio.styles.js.map +1 -1
- package/dist/esm/BulkActions/BulkActions.js +10 -19
- package/dist/esm/BulkActions/BulkActions.js.map +1 -1
- package/dist/esm/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js +10 -10
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/dist/esm/Dialog/Dialog.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js +11 -12
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js.map +1 -1
- package/dist/esm/Radio/Radio.js +2 -1
- package/dist/esm/Radio/Radio.js.map +1 -1
- package/dist/esm/Radio/Radio.styles.js +7 -27
- package/dist/esm/Radio/Radio.styles.js.map +1 -1
- package/dist/esm/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/SnackbarProvider/SnackbarProvider.js.map +1 -1
- package/dist/esm/Switch/Switch.js.map +1 -1
- package/dist/esm/Table/TableCell/TableCell.styles.js +14 -14
- package/dist/esm/Table/TableCell/TableCell.styles.js.map +1 -1
- package/dist/esm/Table/TableHeader/TableHeader.styles.js +16 -15
- package/dist/esm/Table/TableHeader/TableHeader.styles.js.map +1 -1
- package/dist/esm/Tag/Tag.js.map +1 -1
- package/dist/esm/ToggleButton/ToggleButton.js.map +1 -1
- package/dist/esm/TreeView/TreeView.js.map +1 -1
- package/dist/esm/utils/CounterLabel.js +15 -0
- package/dist/esm/utils/CounterLabel.js.map +1 -0
- package/dist/types/index.d.ts +23 -14
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnackbarProvider.js","sources":["../../../src/SnackbarProvider/SnackbarProvider.tsx"],"sourcesContent":["import { forwardRef, useCallback, useMemo } from \"react\";\nimport { SnackbarOrigin } from \"@mui/material/Snackbar\";\nimport {\n OptionsObject,\n SnackbarContent,\n SnackbarProvider,\n SnackbarProviderProps,\n useSnackbar,\n} from \"notistack\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport {\n HvSnackbarContent,\n HvSnackbarContentProps,\n} from \"../Snackbar/SnackbarContent\";\nimport { HvSnackbarVariant } from \"../Snackbar/types\";\nimport { staticClasses, useClasses } from \"./SnackbarProvider.styles\";\n\nexport { staticClasses as snackbarProviderClasses };\n\nexport type HvSnackbarProviderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarProviderProps {\n /** Your component tree. */\n children: React.ReactNode;\n /** Max visible snackbars. */\n maxSnack?: number;\n /** How much time the snackbar remains visible in milliseconds. */\n autoHideDuration?: number;\n /** Where is the snackbar placed. */\n anchorOrigin?: SnackbarOrigin;\n /** Class object used to override notistack classes. */\n notistackClassesOverride?: SnackbarProviderProps[\"classes\"];\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarProviderClasses;\n /** Class names to be applied. */\n className?: string;\n /** The container the snackbar should slide from. */\n container?: SnackbarProviderProps[\"domRoot\"];\n}\n\nexport interface HvNotistackSnackMessageProps extends OptionsObject {\n /** Id to be applied to the root node. */\n id?: string;\n /** class name to apply on the root node */\n className?: string;\n /** Your component tree. */\n message?: React.ReactNode;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Extra values to pass to the snackbar. */\n snackbarContentProps?: HvSnackbarContentProps;\n}\n\nconst HvNotistackSnackMessage = forwardRef<\n HTMLDivElement,\n HvNotistackSnackMessageProps\n>(function HvNotistackSnackMessage(props, ref) {\n const { id, message, variant = \"success\", snackbarContentProps } = props;\n\n return (\n <SnackbarContent ref={ref}>\n <HvSnackbarContent\n id={id}\n variant={variant}\n showIcon\n label={message}\n role=\"none\"\n {...snackbarContentProps}\n />\n </SnackbarContent>\n );\n});\n\n// We override notistack hook to be able to customize the snackbar that should be called.\nexport const useHvSnackbar = () => {\n const snackbarContext = useSnackbar();\n\n if (!snackbarContext) {\n throw new Error(\"useHvSnackbar must be used within an HvSnackbarProvider\");\n }\n\n const { enqueueSnackbar: enqueueNotistackSnackbar, closeSnackbar } =\n snackbarContext;\n\n const enqueueSnackbar = useCallback(\n (message: React.ReactNode, options: HvNotistackSnackMessageProps = {}) => {\n const {\n id,\n variant = \"success\",\n snackbarContentProps,\n className,\n ...otherOptions\n } = options;\n\n return enqueueNotistackSnackbar(\n <HvNotistackSnackMessage\n id={id}\n message={message}\n variant={variant}\n snackbarContentProps={snackbarContentProps}\n />,\n { ...otherOptions, className },\n );\n },\n [enqueueNotistackSnackbar],\n );\n return useMemo(\n () => ({\n enqueueSnackbar,\n closeSnackbar,\n }),\n [enqueueSnackbar, closeSnackbar],\n );\n};\n\nexport const HvSnackbarProvider = ({\n children,\n notistackClassesOverride,\n maxSnack = 5,\n autoHideDuration = 5000,\n anchorOrigin = {\n vertical: \"top\",\n horizontal: \"right\",\n },\n classes: classesProp,\n className,\n container,\n ...others\n}: HvSnackbarProviderProps) => {\n const { classes, css, cx } = useClasses(classesProp);\n\n const { containerRoot, ...otherNotistackClasses } =\n notistackClassesOverride || {};\n\n const notistackClasses: SnackbarProviderProps[\"classes\"] = {\n containerRoot: cx(\n css({\n pointerEvents: \"all\",\n \"& > div > div\": {\n // Overrides notistack extra padding\n padding: \"0 !important\",\n transition: \"all 0s ease 0s !important\",\n },\n }),\n containerRoot,\n ),\n ...otherNotistackClasses,\n };\n\n return (\n <SnackbarProvider\n classes={notistackClasses}\n maxSnack={maxSnack}\n autoHideDuration={autoHideDuration}\n anchorOrigin={anchorOrigin}\n className={cx(classes.snackItemRoot, className)}\n domRoot={container}\n {...others}\n >\n {children}\n </SnackbarProvider>\n );\n};\n"],"names":["HvNotistackSnackMessage"],"mappings":";;;;;;AAsDA,MAAM,0BAA0B,WAG9B,SAASA,yBAAwB,OAAO,KAAK;AAC7C,QAAM,EAAE,IAAI,SAAS,UAAU,WAAW,yBAAyB;AAGjE,SAAA,oBAAC,mBAAgB,KACf,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAK;AAAA,MACJ,GAAG;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ,CAAC;AAGM,MAAM,gBAAgB,MAAM;AACjC,QAAM,kBAAkB,YAAY;AAEpC,MAAI,CAAC,iBAAiB;AACd,UAAA,IAAI,MAAM,yDAAyD;AAAA,EAAA;AAG3E,QAAM,EAAE,iBAAiB,0BAA0B,cACjD,IAAA;AAEF,QAAM,kBAAkB;AAAA,IACtB,CAAC,SAA0B,UAAwC,OAAO;AAClE,YAAA;AAAA,QACJ;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MAAA,IACD;AAEG,aAAA;AAAA,QACL;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,QACA,EAAE,GAAG,cAAc,UAAU;AAAA,MAC/B;AAAA,IACF;AAAA,IACA,CAAC,wBAAwB;AAAA,EAC3B;AACO,SAAA;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,CAAC,iBAAiB,aAAa;AAAA,EACjC;AACF;
|
|
1
|
+
{"version":3,"file":"SnackbarProvider.js","sources":["../../../src/SnackbarProvider/SnackbarProvider.tsx"],"sourcesContent":["import { forwardRef, useCallback, useMemo } from \"react\";\nimport { SnackbarOrigin } from \"@mui/material/Snackbar\";\nimport {\n OptionsObject,\n SnackbarContent,\n SnackbarProvider,\n SnackbarProviderProps,\n useSnackbar,\n} from \"notistack\";\nimport { type ExtractNames } from \"@hitachivantara/uikit-react-utils\";\n\nimport {\n HvSnackbarContent,\n HvSnackbarContentProps,\n} from \"../Snackbar/SnackbarContent\";\nimport { HvSnackbarVariant } from \"../Snackbar/types\";\nimport { staticClasses, useClasses } from \"./SnackbarProvider.styles\";\n\nexport { staticClasses as snackbarProviderClasses };\n\nexport type HvSnackbarProviderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvSnackbarProviderProps {\n /** Your component tree. */\n children: React.ReactNode;\n /** Max visible snackbars. */\n maxSnack?: number;\n /** How much time the snackbar remains visible in milliseconds. */\n autoHideDuration?: number;\n /** Where is the snackbar placed. */\n anchorOrigin?: SnackbarOrigin;\n /** Class object used to override notistack classes. */\n notistackClassesOverride?: SnackbarProviderProps[\"classes\"];\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvSnackbarProviderClasses;\n /** Class names to be applied. */\n className?: string;\n /** The container the snackbar should slide from. */\n container?: SnackbarProviderProps[\"domRoot\"];\n}\n\nexport interface HvNotistackSnackMessageProps extends OptionsObject {\n /** Id to be applied to the root node. */\n id?: string;\n /** class name to apply on the root node */\n className?: string;\n /** Your component tree. */\n message?: React.ReactNode;\n /** Variant of the snackbar. */\n variant?: HvSnackbarVariant;\n /** Extra values to pass to the snackbar. */\n snackbarContentProps?: HvSnackbarContentProps;\n}\n\nconst HvNotistackSnackMessage = forwardRef<\n HTMLDivElement,\n HvNotistackSnackMessageProps\n>(function HvNotistackSnackMessage(props, ref) {\n const { id, message, variant = \"success\", snackbarContentProps } = props;\n\n return (\n <SnackbarContent ref={ref}>\n <HvSnackbarContent\n id={id}\n variant={variant}\n showIcon\n label={message}\n role=\"none\"\n {...snackbarContentProps}\n />\n </SnackbarContent>\n );\n});\n\n// We override notistack hook to be able to customize the snackbar that should be called.\nexport const useHvSnackbar = () => {\n const snackbarContext = useSnackbar();\n\n if (!snackbarContext) {\n throw new Error(\"useHvSnackbar must be used within an HvSnackbarProvider\");\n }\n\n const { enqueueSnackbar: enqueueNotistackSnackbar, closeSnackbar } =\n snackbarContext;\n\n const enqueueSnackbar = useCallback(\n (message: React.ReactNode, options: HvNotistackSnackMessageProps = {}) => {\n const {\n id,\n variant = \"success\",\n snackbarContentProps,\n className,\n ...otherOptions\n } = options;\n\n return enqueueNotistackSnackbar(\n <HvNotistackSnackMessage\n id={id}\n message={message}\n variant={variant}\n snackbarContentProps={snackbarContentProps}\n />,\n { ...otherOptions, className },\n );\n },\n [enqueueNotistackSnackbar],\n );\n return useMemo(\n () => ({\n enqueueSnackbar,\n closeSnackbar,\n }),\n [enqueueSnackbar, closeSnackbar],\n );\n};\n\n/**\n * A snackbar provider to control the stacking of multiple snackbars in the app.\n *\n * This component uses of the [Notistack](https://github.com/iamhosseindhv/notistack) library.\n * Please refer to its [API Reference](https://notistack.com/v2.x/api-reference) for more complex usage scenarios.\n */\nexport const HvSnackbarProvider = ({\n children,\n notistackClassesOverride,\n maxSnack = 5,\n autoHideDuration = 5000,\n anchorOrigin = {\n vertical: \"top\",\n horizontal: \"right\",\n },\n classes: classesProp,\n className,\n container,\n ...others\n}: HvSnackbarProviderProps) => {\n const { classes, css, cx } = useClasses(classesProp);\n\n const { containerRoot, ...otherNotistackClasses } =\n notistackClassesOverride || {};\n\n const notistackClasses: SnackbarProviderProps[\"classes\"] = {\n containerRoot: cx(\n css({\n pointerEvents: \"all\",\n \"& > div > div\": {\n // Overrides notistack extra padding\n padding: \"0 !important\",\n transition: \"all 0s ease 0s !important\",\n },\n }),\n containerRoot,\n ),\n ...otherNotistackClasses,\n };\n\n return (\n <SnackbarProvider\n classes={notistackClasses}\n maxSnack={maxSnack}\n autoHideDuration={autoHideDuration}\n anchorOrigin={anchorOrigin}\n className={cx(classes.snackItemRoot, className)}\n domRoot={container}\n {...others}\n >\n {children}\n </SnackbarProvider>\n );\n};\n"],"names":["HvNotistackSnackMessage"],"mappings":";;;;;;AAsDA,MAAM,0BAA0B,WAG9B,SAASA,yBAAwB,OAAO,KAAK;AAC7C,QAAM,EAAE,IAAI,SAAS,UAAU,WAAW,yBAAyB;AAGjE,SAAA,oBAAC,mBAAgB,KACf,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,UAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAK;AAAA,MACJ,GAAG;AAAA,IAAA;AAAA,EAAA,GAER;AAEJ,CAAC;AAGM,MAAM,gBAAgB,MAAM;AACjC,QAAM,kBAAkB,YAAY;AAEpC,MAAI,CAAC,iBAAiB;AACd,UAAA,IAAI,MAAM,yDAAyD;AAAA,EAAA;AAG3E,QAAM,EAAE,iBAAiB,0BAA0B,cACjD,IAAA;AAEF,QAAM,kBAAkB;AAAA,IACtB,CAAC,SAA0B,UAAwC,OAAO;AAClE,YAAA;AAAA,QACJ;AAAA,QACA,UAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MAAA,IACD;AAEG,aAAA;AAAA,QACL;AAAA,UAAC;AAAA,UAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QACF;AAAA,QACA,EAAE,GAAG,cAAc,UAAU;AAAA,MAC/B;AAAA,IACF;AAAA,IACA,CAAC,wBAAwB;AAAA,EAC3B;AACO,SAAA;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IAAA;AAAA,IAEF,CAAC,iBAAiB,aAAa;AAAA,EACjC;AACF;AAQO,MAAM,qBAAqB,CAAC;AAAA,EACjC;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,mBAAmB;AAAA,EACnB,eAAe;AAAA,IACb,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA+B;AAC7B,QAAM,EAAE,SAAS,KAAK,GAAG,IAAI,WAAW,WAAW;AAEnD,QAAM,EAAE,eAAe,GAAG,sBAAsB,IAC9C,4BAA4B,CAAC;AAE/B,QAAM,mBAAqD;AAAA,IACzD,eAAe;AAAA,MACb,IAAI;AAAA,QACF,eAAe;AAAA,QACf,iBAAiB;AAAA;AAAA,UAEf,SAAS;AAAA,UACT,YAAY;AAAA,QAAA;AAAA,MACd,CACD;AAAA,MACD;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,GAAG,QAAQ,eAAe,SAAS;AAAA,MAC9C,SAAS;AAAA,MACR,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","sources":["../../../src/Switch/Switch.tsx"],"sourcesContent":["import { forwardRef, useCallback } from \"react\";\nimport { SwitchProps as MuiSwitchProps } from \"@mui/material/Switch\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { getColor, HvColorAny } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseSwitch } from \"../BaseSwitch\";\nimport {\n HvFormElement,\n HvFormStatus,\n HvLabel,\n HvLabelProps,\n HvWarningText,\n isInvalid,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\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, \"color\" | \"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?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any,\n ) => 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 /** Color applied to the switch. */\n color?: HvColorAny;\n}\n\nconst isSemantical = (color: HvColorAny) =>\n [\"positive\", \"negative\", \"warning\"].includes(color);\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 function HvSwitch(props, ref) {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n value = \"on\",\n required,\n readOnly,\n disabled,\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 color,\n\n ...others\n } = useDefaultProps(\"HvSwitch\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const [isChecked, setIsChecked] = useControlled(checked, defaultChecked);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>, newChecked: boolean) => {\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 showGutter\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 {...(color && {\n classes: {\n switchBase: css({\n \"&&&+.HvBaseSwitch-track,&&&.HvBaseSwitch-checked+.HvBaseSwitch-track\":\n {\n backgroundColor: getColor(color),\n borderColor: isSemantical(color)\n ? getColor(`${color}_120`)\n : \"#00000032\",\n },\n }),\n },\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"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM,eAAe,CAAC,UACpB,CAAC,YAAY,YAAY,SAAS,EAAE,SAAS,KAAK;AAQ7C,MAAM,WAAW;AAAA,EACtB,SAASA,UAAS,OAAO,KAAK;AACtB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MAEA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAA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AA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"Switch.js","sources":["../../../src/Switch/Switch.tsx"],"sourcesContent":["import { forwardRef, useCallback } from \"react\";\nimport { SwitchProps as MuiSwitchProps } from \"@mui/material/Switch\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { getColor, HvColorAny } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseSwitch } from \"../BaseSwitch\";\nimport {\n HvFormElement,\n HvFormStatus,\n HvLabel,\n HvLabelProps,\n HvWarningText,\n isInvalid,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\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, \"color\" | \"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?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n value: any,\n ) => 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 /** Color applied to the switch. */\n color?: HvColorAny;\n}\n\nconst isSemantical = (color: HvColorAny) =>\n [\"positive\", \"negative\", \"warning\"].includes(color);\n\n/**\n * A Switch is **binary** and works as a digital on/off button.\n *\n * Use when two states are **opposite** and to trigger immediate changes in the system.\n */\nexport const HvSwitch = forwardRef<HTMLButtonElement, HvSwitchProps>(\n function HvSwitch(props, ref) {\n const {\n classes: classesProp,\n className,\n\n id,\n name,\n value = \"on\",\n required,\n readOnly,\n disabled,\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 color,\n\n ...others\n } = useDefaultProps(\"HvSwitch\", props);\n\n const { classes, cx, css } = useClasses(classesProp);\n\n const elementId = useUniqueId(id);\n\n const [isChecked, setIsChecked] = useControlled(checked, defaultChecked);\n\n const [validationState, setValidationState] = useControlled<HvFormStatus>(\n status,\n \"standBy\",\n );\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n\n const onLocalChange = useCallback(\n (evt: React.ChangeEvent<HTMLInputElement>, newChecked: boolean) => {\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 showGutter\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 {...(color && {\n classes: {\n switchBase: css({\n \"&&&+.HvBaseSwitch-track,&&&.HvBaseSwitch-checked+.HvBaseSwitch-track\":\n {\n backgroundColor: getColor(color),\n borderColor: isSemantical(color)\n ? getColor(`${color}_120`)\n : \"#00000032\",\n },\n }),\n },\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"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM,eAAe,CAAC,UACpB,CAAC,YAAY,YAAY,SAAS,EAAE,SAAS,KAAK;AAO7C,MAAM,WAAW;AAAA,EACtB,SAASA,UAAS,OAAO,KAAK;AACtB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MAEA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,MACA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB;AAAA,MAEA;AAAA,MACA,iBAAiB;AAAA,MAEjB;AAAA,MAEA;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MAErB;AAAA,MAEA;AAAA,MAEA,GAAG;AAAA,IAAA,IACD,gBAAgB,YAAY,KAAK;AAErC,UAAM,EAAE,SAAS,IAAI,IAAI,IAAI,WAAW,WAAW;AAE7C,UAAA,YAAY,YAAY,EAAE;AAEhC,UAAM,CAAC,WAAW,YAAY,IAAI,cAAc,SAAS,cAAc;AAEjE,UAAA,CAAC,iBAAiB,kBAAkB,IAAI;AAAA,MAC5C;AAAA,MACA;AAAA,IACF;AAEA,UAAM,CAAC,iBAAiB,IAAI,cAAc,eAAe,UAAU;AAEnE,UAAM,gBAAgB;AAAA,MACpB,CAAC,KAA0C,eAAwB;AACjE,qBAAa,MAAM;AAEb,cAAA,YAAY,CAAC,YAAY;AAC3B,+BAAmB,SAAS;AAAA,UAAA,OACvB;AACL,+BAAmB,OAAO;AAAA,UAAA;AAGrB,iBAAA;AAAA,QAAA,CACR;AAEU,mBAAA,KA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BACP,YAAY,IAAI;AAAA,wBACd,wEACE;AAAA,0BACE,iBAAiB,SAAS,KAAK;AAAA,0BAC/B,aAAa,aAAa,KAAK,IAC3B,SAAS,GAAG,KAAK,MAAM,IACvB;AAAA,wBAAA;AAAA,sBAET,CAAA;AAAA,oBAAA;AAAA,kBAEL;AAAA,kBACC,GAAG;AAAA,gBAAA;AAAA,cAAA;AAAA,YACN;AAAA,UACF;AAAA,UACC,gBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,IAAI,MAAM,WAAW,OAAO;AAAA,cAC5B,WAAW,QAAQ;AAAA,cACnB,eAAa;AAAA,cACb,kBAAgB;AAAA,cAChB,UAAQ;AAAA,cAEP,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
|
@@ -6,8 +6,9 @@ const { staticClasses, useClasses } = createClasses("HvTableCell", {
|
|
|
6
6
|
verticalAlign: "inherit",
|
|
7
7
|
alignContent: "inherit",
|
|
8
8
|
textAlign: "left",
|
|
9
|
+
borderColor: theme.colors.atmo4,
|
|
9
10
|
padding: `calc(${theme.space.xs} - 2px ) ${theme.space.xs} calc(${theme.space.xs} - 3px ) ${theme.spacing(4)}`,
|
|
10
|
-
|
|
11
|
+
borderBottomWidth: 1
|
|
11
12
|
},
|
|
12
13
|
/** Styles applied to the cell when it's in the table head. */
|
|
13
14
|
head: {
|
|
@@ -16,7 +17,6 @@ const { staticClasses, useClasses } = createClasses("HvTableCell", {
|
|
|
16
17
|
alignContent: "start",
|
|
17
18
|
backgroundColor: theme.colors.atmo1,
|
|
18
19
|
borderTop: "1px solid transparent",
|
|
19
|
-
borderBottom: `1px solid ${theme.colors.atmo4}`,
|
|
20
20
|
...theme.typography.label
|
|
21
21
|
},
|
|
22
22
|
/** Styles applied to the cell when it's in the table body. */
|
|
@@ -61,7 +61,7 @@ const { staticClasses, useClasses } = createClasses("HvTableCell", {
|
|
|
61
61
|
padding: 0,
|
|
62
62
|
width: 32,
|
|
63
63
|
maxWidth: 32,
|
|
64
|
-
|
|
64
|
+
borderRightWidth: 1
|
|
65
65
|
},
|
|
66
66
|
/** Styles applied to the component root when its variant is actions */
|
|
67
67
|
variantActions: {
|
|
@@ -69,7 +69,7 @@ const { staticClasses, useClasses } = createClasses("HvTableCell", {
|
|
|
69
69
|
padding: 0,
|
|
70
70
|
width: 32,
|
|
71
71
|
maxWidth: 32,
|
|
72
|
-
|
|
72
|
+
borderLeftWidth: 1
|
|
73
73
|
},
|
|
74
74
|
/** Styles applied to the component root when its variant is expand */
|
|
75
75
|
variantExpand: {
|
|
@@ -84,7 +84,7 @@ const { staticClasses, useClasses } = createClasses("HvTableCell", {
|
|
|
84
84
|
height: 52
|
|
85
85
|
},
|
|
86
86
|
padding: "0, 0, 0, 32px",
|
|
87
|
-
|
|
87
|
+
borderWidth: 0
|
|
88
88
|
},
|
|
89
89
|
/** Styles applied to the cell when its variant is list and the type is head. */
|
|
90
90
|
variantListHead: {
|
|
@@ -122,40 +122,40 @@ const { staticClasses, useClasses } = createClasses("HvTableCell", {
|
|
|
122
122
|
},
|
|
123
123
|
/** Styles applied to the cell when it's part of the last sticky to the left column. */
|
|
124
124
|
stickyColumnMostLeft: {
|
|
125
|
-
|
|
125
|
+
borderRightWidth: 1
|
|
126
126
|
},
|
|
127
127
|
/** Styles applied to the cell when it's part of the first right sticky column. */
|
|
128
128
|
stickyColumnLeastRight: {
|
|
129
|
-
|
|
129
|
+
borderLeftWidth: 1
|
|
130
130
|
},
|
|
131
131
|
/** Styles applied to the cell when it's part of the first column in the group. */
|
|
132
132
|
groupColumnMostLeft: {
|
|
133
|
-
|
|
133
|
+
borderLeftWidth: 1,
|
|
134
134
|
"&:first-of-type": {
|
|
135
|
-
|
|
135
|
+
borderLeftWidth: 0
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
138
|
/** Styles applied to the cell when it's part of the last column in the group. */
|
|
139
139
|
groupColumnMostRight: {
|
|
140
|
-
|
|
140
|
+
borderRightWidth: 1,
|
|
141
141
|
// due to the ":has()" selector not being supported in browsers,
|
|
142
142
|
// this need to be managed with inline styles
|
|
143
143
|
// To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)
|
|
144
144
|
// "&:last-child,&:has(+ $stickyColumnLeastRight)": {
|
|
145
145
|
"&:last-child": {
|
|
146
|
-
|
|
146
|
+
borderRightWidth: 0
|
|
147
147
|
},
|
|
148
148
|
"&+:not($stickyColumn)": {
|
|
149
|
-
|
|
149
|
+
borderLeftWidth: 0
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
/** Styles applied to the cell when it's part of a resizable column. */
|
|
153
153
|
resizable: {
|
|
154
|
-
|
|
154
|
+
borderRightWidth: 1
|
|
155
155
|
},
|
|
156
156
|
/** Styles applied to the cell when it's part of a resizing column. */
|
|
157
157
|
resizing: {
|
|
158
|
-
borderRight: `solid
|
|
158
|
+
borderRight: `2px solid ${theme.colors.primary_80}`
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
161
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.styles.js","sources":["../../../../src/Table/TableCell/TableCell.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableCell\", {\n /** Styles applied to the component root class. */\n root: {\n verticalAlign: \"inherit\",\n alignContent: \"inherit\",\n textAlign: \"left\",\n padding: `calc(${theme.space.xs} - 2px ) ${theme.space.xs} calc(${\n theme.space.xs\n } - 3px ) ${theme.spacing(4)}`,\n
|
|
1
|
+
{"version":3,"file":"TableCell.styles.js","sources":["../../../../src/Table/TableCell/TableCell.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableCell\", {\n /** Styles applied to the component root class. */\n root: {\n verticalAlign: \"inherit\",\n alignContent: \"inherit\",\n textAlign: \"left\",\n borderColor: theme.colors.atmo4,\n padding: `calc(${theme.space.xs} - 2px ) ${theme.space.xs} calc(${\n theme.space.xs\n } - 3px ) ${theme.spacing(4)}`,\n borderBottomWidth: 1,\n },\n /** Styles applied to the cell when it's in the table head. */\n head: {\n height: 52,\n verticalAlign: \"top\",\n alignContent: \"start\",\n\n backgroundColor: theme.colors.atmo1,\n borderTop: \"1px solid transparent\",\n ...theme.typography.label,\n },\n /** Styles applied to the cell when it's in the table body. */\n body: {\n minHeight: 32,\n \"td&\": {\n height: 32,\n },\n backgroundColor: \"inherit\",\n\n \"&$sorted\": {\n backgroundColor: theme.alpha(\"primary\", 0.1),\n },\n },\n /** Styles applied to the cell when it's in the table footer. */\n footer: {},\n /** Styles applied to the cell when it's part of a sorted column. */\n sorted: {},\n /** Styles applied to the component root when it is left aligned */\n alignLeft: {\n textAlign: \"left\",\n },\n /** Styles applied to the component root when it is center aligned */\n alignCenter: {\n textAlign: \"center\",\n },\n /** Styles applied to the component root when it is right aligned */\n alignRight: {\n textAlign: \"right\",\n flexDirection: \"row-reverse\",\n },\n /** Styles applied to the component root when it is justified */\n alignJustify: {\n textAlign: \"justify\",\n },\n\n /** Styles applied to the component root when its variant is none */\n variantNone: {\n padding: 0,\n },\n /** Styles applied to the component root when its variant is checkbox */\n variantCheckbox: {\n boxSizing: \"content-box\",\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderRightWidth: 1,\n },\n /** Styles applied to the component root when its variant is actions */\n variantActions: {\n boxSizing: \"content-box\",\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderLeftWidth: 1,\n },\n /** Styles applied to the component root when its variant is expand */\n variantExpand: {\n paddingLeft: 0,\n paddingTop: 0,\n paddingBottom: 0,\n },\n /** Styles applied to the component root when its variant is list */\n variantList: {\n minHeight: 52,\n \"td&\": {\n height: 52,\n },\n padding: \"0, 0, 0, 32px\",\n borderWidth: 0,\n },\n /** Styles applied to the cell when its variant is list and the type is head. */\n variantListHead: {\n backgroundColor: \"inherit\",\n \"td&\": {\n height: 16,\n },\n },\n /** Styles applied to the cell when its variant is list and actions. */\n variantListactions: {\n verticalAlign: \"middle\",\n alignContent: \"center\",\n borderLeft: \"none\",\n paddingLeft: \"0\",\n textAlign: \"center\",\n width: 130,\n maxWidth: 130,\n },\n /** Styles applied to the cell when its variant is list and checkbox. */\n variantListcheckbox: {\n borderRight: \"none\",\n padding: 0,\n textAlign: \"center\",\n width: 34,\n maxWidth: 34,\n },\n /** Styles applied to the cell when it's part of a sticky column. */\n stickyColumn: {\n position: \"sticky\",\n zIndex: 2,\n backgroundColor: theme.colors.atmo2,\n\n \"&$groupColumnMostRight+$stickyColumn\": {\n borderLeft: 0,\n },\n },\n /** Styles applied to the cell when it's part of the last sticky to the left column. */\n stickyColumnMostLeft: {\n borderRightWidth: 1,\n },\n /** Styles applied to the cell when it's part of the first right sticky column. */\n stickyColumnLeastRight: {\n borderLeftWidth: 1,\n },\n\n /** Styles applied to the cell when it's part of the first column in the group. */\n groupColumnMostLeft: {\n borderLeftWidth: 1,\n\n \"&:first-of-type\": {\n borderLeftWidth: 0,\n },\n },\n /** Styles applied to the cell when it's part of the last column in the group. */\n groupColumnMostRight: {\n borderRightWidth: 1,\n\n // due to the \":has()\" selector not being supported in browsers,\n // this need to be managed with inline styles\n // To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)\n // \"&:last-child,&:has(+ $stickyColumnLeastRight)\": {\n \"&:last-child\": {\n borderRightWidth: 0,\n },\n\n \"&+:not($stickyColumn)\": {\n borderLeftWidth: 0,\n },\n },\n\n /** Styles applied to the cell when it's part of a resizable column. */\n resizable: {\n borderRightWidth: 1,\n },\n /** Styles applied to the cell when it's part of a resizing column. */\n resizing: {\n borderRight: `2px solid ${theme.colors.primary_80}`,\n },\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,eAAe;AAAA;AAAA,EA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AAAA,IACR,aAAa,aAAa,MAAM,OAAO,UAAU;AAAA,EAAA;AAErD,CAAC;"}
|
|
@@ -9,7 +9,8 @@ const { staticClasses, useClasses } = createClasses("HvTableHeader", {
|
|
|
9
9
|
alignContent: "inherit",
|
|
10
10
|
textAlign: "left",
|
|
11
11
|
padding: theme.spacing(0, 1, 0, 4),
|
|
12
|
-
|
|
12
|
+
borderColor: theme.colors.atmo4,
|
|
13
|
+
borderBottomWidth: 1
|
|
13
14
|
},
|
|
14
15
|
head: {
|
|
15
16
|
paddingTop: 8,
|
|
@@ -17,14 +18,14 @@ const { staticClasses, useClasses } = createClasses("HvTableHeader", {
|
|
|
17
18
|
alignContent: "start",
|
|
18
19
|
...theme.typography.label,
|
|
19
20
|
backgroundColor: theme.colors.atmo1,
|
|
20
|
-
|
|
21
|
+
borderBottomWidth: 1,
|
|
21
22
|
"*:first-of-type > &": {
|
|
22
23
|
height: "var(--first-row-cell-height)",
|
|
23
24
|
borderTop: "1px solid transparent"
|
|
24
25
|
},
|
|
25
26
|
"&$variantList": {
|
|
26
27
|
backgroundColor: "inherit",
|
|
27
|
-
|
|
28
|
+
borderBottomWidth: 0,
|
|
28
29
|
"*:first-of-type > &": {
|
|
29
30
|
borderTop: 0
|
|
30
31
|
}
|
|
@@ -58,23 +59,23 @@ const { staticClasses, useClasses } = createClasses("HvTableHeader", {
|
|
|
58
59
|
position: "sticky",
|
|
59
60
|
zIndex: 2,
|
|
60
61
|
"&$groupColumnMostRight+$stickyColumn": {
|
|
61
|
-
|
|
62
|
+
borderLeftWidth: 0
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
|
-
stickyColumnMostLeft: {
|
|
65
|
-
stickyColumnLeastRight: {
|
|
66
|
-
groupColumnMostLeft: {
|
|
65
|
+
stickyColumnMostLeft: { borderRightWidth: 1 },
|
|
66
|
+
stickyColumnLeastRight: { borderLeftWidth: 1 },
|
|
67
|
+
groupColumnMostLeft: { borderLeftWidth: 1 },
|
|
67
68
|
groupColumnMostRight: {
|
|
68
|
-
|
|
69
|
+
borderRightWidth: 1,
|
|
69
70
|
// due to the ":has()" selector not being supported in browsers,
|
|
70
71
|
// this need to be managed with inline styles
|
|
71
72
|
// To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)
|
|
72
73
|
// "&:last-child,&:has(+ $stickyColumnLeastRight)": {
|
|
73
74
|
"&:last-child": {
|
|
74
|
-
|
|
75
|
+
borderRightWidth: 0
|
|
75
76
|
},
|
|
76
77
|
"&+:not($stickyColumn)": {
|
|
77
|
-
|
|
78
|
+
borderLeftWidth: 0
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
81
|
headerContent: { display: "flex", alignItems: "flex-start", width: "100%" },
|
|
@@ -106,27 +107,27 @@ const { staticClasses, useClasses } = createClasses("HvTableHeader", {
|
|
|
106
107
|
padding: 0,
|
|
107
108
|
width: 32,
|
|
108
109
|
maxWidth: 32,
|
|
109
|
-
|
|
110
|
+
borderRightWidth: 1
|
|
110
111
|
},
|
|
111
112
|
variantExpand: {},
|
|
112
113
|
variantActions: {
|
|
113
114
|
padding: 0,
|
|
114
115
|
width: 32,
|
|
115
116
|
maxWidth: 32,
|
|
116
|
-
|
|
117
|
+
borderLeftWidth: 1
|
|
117
118
|
},
|
|
118
119
|
variantNone: { padding: 0 },
|
|
119
120
|
variantList: {
|
|
120
121
|
backgroundColor: "inherit",
|
|
121
|
-
|
|
122
|
+
borderBottomWidth: 0,
|
|
122
123
|
height: 16,
|
|
123
124
|
":first-of-type > &": {
|
|
124
|
-
|
|
125
|
+
borderTopWidth: 0,
|
|
125
126
|
height: 16
|
|
126
127
|
}
|
|
127
128
|
},
|
|
128
129
|
resizable: {
|
|
129
|
-
|
|
130
|
+
borderRightWidth: 1,
|
|
130
131
|
":has($resizer:hover)": {
|
|
131
132
|
borderRight: `2px solid ${theme.colors.primary_80}`
|
|
132
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.styles.js","sources":["../../../../src/Table/TableHeader/TableHeader.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableHeader\", {\n root: {\n \"--first-row-cell-height\": \"52px\",\n \"--cell-height\": \"32px\",\n height: \"var(--cell-height)\",\n verticalAlign: \"inherit\",\n alignContent: \"inherit\",\n textAlign: \"left\",\n padding: theme.spacing(0, 1, 0, 4),\n
|
|
1
|
+
{"version":3,"file":"TableHeader.styles.js","sources":["../../../../src/Table/TableHeader/TableHeader.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTableHeader\", {\n root: {\n \"--first-row-cell-height\": \"52px\",\n \"--cell-height\": \"32px\",\n height: \"var(--cell-height)\",\n verticalAlign: \"inherit\",\n alignContent: \"inherit\",\n textAlign: \"left\",\n padding: theme.spacing(0, 1, 0, 4),\n borderColor: theme.colors.atmo4,\n borderBottomWidth: 1,\n },\n head: {\n paddingTop: 8,\n verticalAlign: \"top\",\n alignContent: \"start\",\n ...theme.typography.label,\n backgroundColor: theme.colors.atmo1,\n borderBottomWidth: 1,\n\n \"*:first-of-type > &\": {\n height: \"var(--first-row-cell-height)\",\n borderTop: \"1px solid transparent\",\n },\n\n \"&$variantList\": {\n backgroundColor: \"inherit\",\n borderBottomWidth: 0,\n \"*:first-of-type > &\": {\n borderTop: 0,\n },\n },\n\n \"&$sortable\": {\n verticalAlign: \"initial\",\n alignContent: \"initial\",\n paddingTop: 0,\n paddingLeft: 0,\n cursor: \"pointer\",\n\n \":hover, :focus-within\": {\n backgroundColor: theme.colors.containerBackgroundHover,\n \"& $sortIcon\": {\n opacity: 1,\n },\n },\n },\n },\n body: {\n backgroundColor: \"inherit\",\n ...theme.typography.body,\n \":where($sorted)\": {\n backgroundColor: theme.alpha(\"atmo1\", 0.4),\n },\n \"&$sortable:not($variantNone)\": {\n paddingLeft: 32,\n },\n },\n footer: {},\n stickyColumn: {\n position: \"sticky\",\n zIndex: 2,\n\n \"&$groupColumnMostRight+$stickyColumn\": {\n borderLeftWidth: 0,\n },\n },\n stickyColumnMostLeft: { borderRightWidth: 1 },\n stickyColumnLeastRight: { borderLeftWidth: 1 },\n groupColumnMostLeft: { borderLeftWidth: 1 },\n groupColumnMostRight: {\n borderRightWidth: 1,\n // due to the \":has()\" selector not being supported in browsers,\n // this need to be managed with inline styles\n // To be uncommented when not needed (see comment in src/Table/hooks/useSticky.js)\n // \"&:last-child,&:has(+ $stickyColumnLeastRight)\": {\n \"&:last-child\": {\n borderRightWidth: 0,\n },\n \"&+:not($stickyColumn)\": {\n borderLeftWidth: 0,\n },\n },\n headerContent: { display: \"flex\", alignItems: \"flex-start\", width: \"100%\" },\n headerText: { overflow: \"hidden\", textOverflow: \"ellipsis\" },\n headerParagraph: { overflow: \"hidden\", display: \"-webkit-box\" },\n sortableHeaderText: { paddingTop: \"8px\" },\n sorted: {\n \"& $sortIcon\": {\n opacity: 1,\n },\n },\n sortable: {},\n sortButton: {\n \":focus-visible\": {\n boxShadow: \"none\",\n backgroundColor: \"transparent\",\n },\n },\n sortIcon: { opacity: 0 },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\", flexDirection: \"row-reverse\" },\n alignCenter: { textAlign: \"center\" },\n alignJustify: { textAlign: \"justify\" },\n alignFlexLeft: { justifyContent: \"flex-start\" },\n alignFlexRight: { justifyContent: \"flex-end\" },\n alignFlexCenter: { justifyContent: \"center\" },\n alignFlexJustify: { textAlign: \"justify\" },\n variantCheckbox: {\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderRightWidth: 1,\n },\n variantExpand: {},\n variantActions: {\n padding: 0,\n width: 32,\n maxWidth: 32,\n borderLeftWidth: 1,\n },\n variantNone: { padding: 0 },\n variantList: {\n backgroundColor: \"inherit\",\n borderBottomWidth: 0,\n height: 16,\n \":first-of-type > &\": {\n borderTopWidth: 0,\n height: 16,\n },\n },\n resizable: {\n borderRightWidth: 1,\n \":has($resizer:hover)\": {\n borderRight: `2px solid ${theme.colors.primary_80}`,\n },\n },\n resizing: { borderRight: `2px solid ${theme.colors.primary_80}` },\n resizer: {\n display: \"inline-block\",\n width: 16,\n height: \"100%\",\n position: \"absolute\",\n right: 0,\n top: 0,\n transform: \"translateX(50%)\",\n zIndex: 1,\n touchAction: \"none\",\n },\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,iBAAiB;AAAA,EAC1E,MAAM;AAAA,IACJ,2BAA2B;AAAA,IAC3B,iBAAiB;AAAA,IACjB,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,cAAc;AAAA,IACd,WAAW;AAAA,IACX,SAAS,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC;AAAA,IACjC,aAAa,MAAM,OAAO;AAAA,IAC1B,mBAAmB;AAAA,EACrB;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,cAAc;AAAA,IACd,GAAG,MAAM,WAAW;AAAA,IACpB,iBAAiB,MAAM,OAAO;AAAA,IAC9B,mBAAmB;AAAA,IAEnB,uBAAuB;AAAA,MACrB,QAAQ;AAAA,MACR,WAAW;AAAA,IACb;AAAA,IAEA,iBAAiB;AAAA,MACf,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,MACnB,uBAAuB;AAAA,QACrB,WAAW;AAAA,MAAA;AAAA,IAEf;AAAA,IAEA,cAAc;AAAA,MACZ,eAAe;AAAA,MACf,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,QAAQ;AAAA,MAER,yBAAyB;AAAA,QACvB,iBAAiB,MAAM,OAAO;AAAA,QAC9B,eAAe;AAAA,UACb,SAAS;AAAA,QAAA;AAAA,MACX;AAAA,IACF;AAAA,EAEJ;AAAA,EACA,MAAM;AAAA,IACJ,iBAAiB;A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E,gBAAgB,aAAa;AAAA,EAC9C,gBAAgB,EAAE,gBAAgB,WAAW;AAAA,EAC7C,iBAAiB,EAAE,gBAAgB,SAAS;AAAA,EAC5C,kBAAkB,EAAE,WAAW,UAAU;AAAA,EACzC,iBAAiB;AAAA,IACf,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,kBAAkB;AAAA,EACpB;AAAA,EACA,eAAe,CAAC;AAAA,EAChB,gBAAgB;AAAA,IACd,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,aAAa,EAAE,SAAS,EAAE;AAAA,EAC1B,aAAa;AAAA,IACX,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,QAAQ;AAAA,IACR,sBAAsB;AAAA,MACpB,gBAAgB;AAAA,MAChB,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAAA,EACA,WAAW;AAAA,IACT,kBAAkB;AAAA,IAClB,wBAAwB;AAAA,MACtB,aAAa,aAAa,MAAM,OAAO,UAAU;AAAA,IAAA;AAAA,EAErD;AAAA,EACA,UAAU,EAAE,aAAa,aAAa,MAAM,OAAO,UAAU,GAAG;AAAA,EAChE,SAAS;AAAA,IACP,SAAS;AAAA,IACT,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,OAAO;AAAA,IACP,KAAK;AAAA,IACL,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,aAAa;AAAA,EAAA;AAEjB,CAAC;"}
|
package/dist/esm/Tag/Tag.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","sources":["../../../src/Tag/Tag.tsx"],"sourcesContent":["import { cloneElement, forwardRef, isValidElement } from \"react\";\nimport {\n Checkbox,\n CheckboxCheck,\n CloseXS,\n} from \"@hitachivantara/uikit-react-icons\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { getColor, HvColorAny, theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvButtonBase, HvButtonBaseProps } from \"../ButtonBase\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { HvTypography } from \"../Typography\";\nimport { isDeleteKey } from \"../utils/keyboardUtils\";\nimport { staticClasses, useClasses } from \"./Tag.styles\";\n\nexport { staticClasses as tagClasses };\n\nexport type HvTagClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagProps\n extends Omit<\n HvButtonBaseProps,\n \"type\" | \"color\" | \"classes\" | \"onClick\" | \"onToggle\"\n > {\n /** The label of the tag element. */\n label?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** The type of the tag element. A tag can be of semantic or categoric type. */\n type?: \"semantic\" | \"categorical\";\n /** The color variant of the tag */\n color?: HvColorAny;\n /** Icon used to customize the delete icon */\n deleteIcon?: React.ReactElement;\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component, in order to render the delete icon\n * */\n onDelete?: React.EventHandler<any>;\n /** Callback triggered when any item is clicked. */\n onClick?: (event: React.MouseEvent<HTMLElement>, selected?: boolean) => void;\n /** Aria properties to apply to delete button in tag\n * @deprecated no longer used\n */\n deleteButtonArialLabel?: string;\n /** Props to apply to delete icon */\n deleteButtonProps?: React.HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagClasses;\n /** Determines whether or not the tag is selectable. */\n selectable?: boolean;\n /** Defines if the tag is selected. When defined the tag state becomes controlled. */\n selected?: boolean;\n /** When uncontrolled, defines the initial selected state. */\n defaultSelected?: boolean;\n}\n\n/**\n * A Tag is one word that describes a specific aspect of an asset. A single asset can have\n * multiple tags.\n * Use tags to highlight an item's status for quick recognition and navigation\n * Use color to indicate meanings that users can learn and recognize across products\n *\n * It leverages the Chip component
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../../src/Tag/Tag.tsx"],"sourcesContent":["import { cloneElement, forwardRef, isValidElement } from \"react\";\nimport {\n Checkbox,\n CheckboxCheck,\n CloseXS,\n} from \"@hitachivantara/uikit-react-icons\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport { getColor, HvColorAny, theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvButtonBase, HvButtonBaseProps } from \"../ButtonBase\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { HvTypography } from \"../Typography\";\nimport { isDeleteKey } from \"../utils/keyboardUtils\";\nimport { staticClasses, useClasses } from \"./Tag.styles\";\n\nexport { staticClasses as tagClasses };\n\nexport type HvTagClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTagProps\n extends Omit<\n HvButtonBaseProps,\n \"type\" | \"color\" | \"classes\" | \"onClick\" | \"onToggle\"\n > {\n /** The label of the tag element. */\n label?: React.ReactNode;\n /** Indicates that the form element is disabled. */\n disabled?: boolean;\n /** The type of the tag element. A tag can be of semantic or categoric type. */\n type?: \"semantic\" | \"categorical\";\n /** The color variant of the tag */\n color?: HvColorAny;\n /** Icon used to customize the delete icon */\n deleteIcon?: React.ReactElement;\n /**\n * The callback fired when the delete icon is pressed.\n * This function has to be provided to the component, in order to render the delete icon\n * */\n onDelete?: React.EventHandler<any>;\n /** Callback triggered when any item is clicked. */\n onClick?: (event: React.MouseEvent<HTMLElement>, selected?: boolean) => void;\n /** Aria properties to apply to delete button in tag\n * @deprecated no longer used\n */\n deleteButtonArialLabel?: string;\n /** Props to apply to delete icon */\n deleteButtonProps?: React.HTMLAttributes<HTMLDivElement>;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTagClasses;\n /** Determines whether or not the tag is selectable. */\n selectable?: boolean;\n /** Defines if the tag is selected. When defined the tag state becomes controlled. */\n selected?: boolean;\n /** When uncontrolled, defines the initial selected state. */\n defaultSelected?: boolean;\n}\n\n/**\n * A Tag is one word that describes a specific aspect of an asset. A single asset can have\n * multiple tags.\n * Use tags to highlight an item's status for quick recognition and navigation\n * Use color to indicate meanings that users can learn and recognize across products\n *\n * It leverages the [MUI Chip](https://mui.com/material-ui/react-chip/) component\n */\nexport const HvTag = forwardRef<\n // no-indent\n HTMLElement,\n HvTagProps\n>(function HvTag(props, ref) {\n const {\n classes: classesProp,\n className,\n component,\n style,\n label,\n disabled,\n type = \"semantic\",\n selectable,\n selected,\n defaultSelected = false,\n color,\n deleteIcon: deleteIconProp,\n onDelete,\n onClick,\n onKeyDown,\n onKeyUp,\n // TODO: remove from API\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n deleteButtonArialLabel = \"Delete tag\",\n deleteButtonProps = {},\n ...others\n } = useDefaultProps(\"HvTag\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const [isSelected, setIsSelected] = useControlled(\n selected,\n Boolean(defaultSelected),\n );\n\n const handleDeleteClick = (event: React.MouseEvent) => {\n // Stop the event from bubbling up to the tag\n event.stopPropagation();\n onDelete?.(event);\n };\n\n const backgroundColor =\n (type === \"semantic\" && getColor(color, \"neutral_20\")) ||\n (type === \"categorical\" && theme.alpha(getColor(color, \"cat1\")!, 0.2)) ||\n undefined;\n\n const isClickable = !!(onClick || onDelete || selectable);\n\n const CheckboxIcon = isSelected ? CheckboxCheck : Checkbox;\n\n const deleteIcon =\n deleteIconProp && isValidElement(deleteIconProp) ? (\n cloneElement<any>(deleteIconProp, {\n className: cx(classes.deleteIcon, {\n [classes.disabledDeleteIcon]: disabled,\n }),\n onClick: handleDeleteClick,\n })\n ) : (\n <CloseXS\n size=\"XS\"\n onClick={handleDeleteClick}\n className={cx(classes.deleteIcon, classes.button, classes.tagButton)}\n {...deleteButtonProps}\n />\n );\n\n return (\n <HvButtonBase\n ref={ref as any}\n component={isClickable ? HvButtonBase : \"div\"}\n disabled={disabled}\n data-color={color}\n style={mergeStyles(style, {\n \"--bgColor\": backgroundColor,\n })}\n className={cx(classes.root, classes.chipRoot, className, {\n [classes.disabled]: disabled,\n [classes.selected]: isSelected,\n [classes.clickable]: isClickable && !disabled,\n [classes.categorical]: type === \"categorical\",\n [classes.categoricalFocus]: type === \"categorical\" && !disabled,\n [classes.categoricalDisabled]: type === \"categorical\" && disabled,\n })}\n onKeyUp={(event: React.KeyboardEvent<HTMLButtonElement>) => {\n // Ignore events from children.\n if (event.currentTarget === event.target && isDeleteKey(event)) {\n onDelete?.(event);\n }\n\n onKeyUp?.(event);\n }}\n onClick={(event: React.MouseEvent<HTMLButtonElement>) => {\n if (disabled) return;\n if (selectable) setIsSelected(!isSelected);\n onClick?.(event, !isSelected);\n }}\n selected={isClickable && isSelected}\n {...others}\n >\n {selectable && type === \"semantic\" && (\n <CheckboxIcon\n className={classes.icon}\n color={(disabled && [\"atmo3\", \"secondary_60\"]) || undefined}\n size=\"XS\"\n />\n )}\n <HvTypography\n noWrap\n variant=\"caption2\"\n component=\"span\"\n className={classes.label}\n >\n {label}\n </HvTypography>\n {onDelete && deleteIcon}\n </HvButtonBase>\n );\n});\n"],"names":["HvTag"],"mappings":";;;;;;;;;;;AAqEO,MAAM,QAAQ,WAInB,SAASA,OAAM,OAAO,KAAK;AACrB,QAAA;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAAA;AAAA,IAGA,yBAAyB;AAAA,IACzB,oBAAoB,CAAC;AAAA,IACrB,GAAG;AAAA,EAAA,IACD,gBAAgB,SAAS,KAAK;AAClC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA,IACA,QAAQ,eAAe;AAAA,EACzB;AAEM,QAAA,oBAAoB,CAAC,UAA4B;AAErD,UAAM,gBAAgB;AACtB,eAAW,KAAK;AAAA,EAClB;AAEA,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ACA,SAAS,CAAC,UAA+C;AACvD,YAAI,SAAU;AACV,YAAA,WAA0B,eAAA,CAAC,UAAU;AAC/B,kBAAA,OAAO,CAAC,UAAU;AAAA,MAC9B;AAAA,MACA,UAAU,eAAe;AAAA,MACxB,GAAG;AAAA,MAEH,UAAA;AAAA,QAAA,cAAc,SAAS,cACtB;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAW,QAAQ;AAAA,YACnB,OAAQ,YAAY,CAAC,SAAS,cAAc,KAAM;AAAA,YAClD,MAAK;AAAA,UAAA;AAAA,QACP;AAAA,QAEF;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,QAAM;AAAA,YACN,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,WAAW,QAAQ;AAAA,YAElB,UAAA;AAAA,UAAA;AAAA,QACH;AAAA,QACC,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACf;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleButton.js","sources":["../../../src/ToggleButton/ToggleButton.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { useDefaultProps } from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton } from \"../Button\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { HvBaseProps } from \"../types/generic\";\n\nexport interface HvToggleButtonProps\n extends HvBaseProps<HTMLButtonElement, \"onClick\"> {\n /** When uncontrolled, defines the initial selected state. */\n defaultSelected?: boolean;\n /** Defines if the button is selected. When defined the button state becomes controlled. */\n selected?: boolean;\n /** Defines if the button is disabled. */\n disabled?: boolean;\n /** Icon for when not selected. Ignored if the component has children. */\n notSelectedIcon?: React.ReactNode;\n /** Icon for when selected. Ignored if the component has children. */\n selectedIcon?: React.ReactNode;\n /** Function called when icon is clicked. */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement>,\n selected: boolean,\n ) => void;\n}\n\nexport const HvToggleButton = forwardRef<\n HTMLButtonElement,\n HvToggleButtonProps\n>(function HvToggleButton(props, ref) {\n const {\n defaultSelected,\n selected,\n notSelectedIcon,\n selectedIcon = null,\n onClick,\n children,\n ...others\n } = useDefaultProps(\"HvToggleButton\", props);\n\n const [isSelected, setIsSelected] = useControlled(\n selected,\n Boolean(defaultSelected),\n );\n\n return (\n <HvButton\n ref={ref}\n icon\n selected={isSelected}\n onClick={(event) => {\n setIsSelected(!isSelected);\n onClick?.(event, !isSelected);\n }}\n {...others}\n >\n {children || (!isSelected ? notSelectedIcon : selectedIcon)}\n </HvButton>\n );\n});\n"],"names":["HvToggleButton"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"ToggleButton.js","sources":["../../../src/ToggleButton/ToggleButton.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport { useDefaultProps } from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton } from \"../Button\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { HvBaseProps } from \"../types/generic\";\n\nexport interface HvToggleButtonProps\n extends HvBaseProps<HTMLButtonElement, \"onClick\"> {\n /** When uncontrolled, defines the initial selected state. */\n defaultSelected?: boolean;\n /** Defines if the button is selected. When defined the button state becomes controlled. */\n selected?: boolean;\n /** Defines if the button is disabled. */\n disabled?: boolean;\n /** Icon for when not selected. Ignored if the component has children. */\n notSelectedIcon?: React.ReactNode;\n /** Icon for when selected. Ignored if the component has children. */\n selectedIcon?: React.ReactNode;\n /** Function called when icon is clicked. */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement>,\n selected: boolean,\n ) => void;\n}\n\n/**\n * Use when two instances are opposite and the on/off analogy doesn’t apply. Only well-known icons should be used, otherwise, use a single checkbox for the same situation.\n */\nexport const HvToggleButton = forwardRef<\n HTMLButtonElement,\n HvToggleButtonProps\n>(function HvToggleButton(props, ref) {\n const {\n defaultSelected,\n selected,\n notSelectedIcon,\n selectedIcon = null,\n onClick,\n children,\n ...others\n } = useDefaultProps(\"HvToggleButton\", props);\n\n const [isSelected, setIsSelected] = useControlled(\n selected,\n Boolean(defaultSelected),\n );\n\n return (\n <HvButton\n ref={ref}\n icon\n selected={isSelected}\n onClick={(event) => {\n setIsSelected(!isSelected);\n onClick?.(event, !isSelected);\n }}\n {...others}\n >\n {children || (!isSelected ? notSelectedIcon : selectedIcon)}\n </HvButton>\n );\n});\n"],"names":["HvToggleButton"],"mappings":";;;;;AA6BO,MAAM,iBAAiB,WAG5B,SAASA,gBAAe,OAAO,KAAK;AAC9B,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,kBAAkB,KAAK;AAErC,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC;AAAA,IACA,QAAQ,eAAe;AAAA,EACzB;AAGE,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,MAAI;AAAA,MACJ,UAAU;AAAA,MACV,SAAS,CAAC,UAAU;AAClB,sBAAc,CAAC,UAAU;AACf,kBAAA,OAAO,CAAC,UAAU;AAAA,MAC9B;AAAA,MACC,GAAG;AAAA,MAEH,UAAA,aAAa,CAAC,aAAa,kBAAkB;AAAA,IAAA;AAAA,EAChD;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.js","sources":["../../../src/TreeView/TreeView.tsx"],"sourcesContent":["import { useSlotProps } from \"@mui/base/utils\";\nimport { DropDownXS, DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { fixedForwardRef, HvBaseProps } from \"../types/generic\";\nimport {\n DEFAULT_TREE_VIEW_PLUGINS,\n DefaultTreeViewPluginParameters,\n} from \"./internals/hooks/plugins\";\nimport { useTreeView } from \"./internals/hooks/useTreeView\";\nimport { TreeViewProvider } from \"./internals/TreeViewProvider\";\nimport { staticClasses, useClasses } from \"./TreeView.styles\";\n\nexport { staticClasses as treeView2Classes }; // TODO: remove old `treeViewClasses`\n\nexport type HvTreeViewClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTreeViewProps<Multiple extends boolean | undefined>\n extends HvBaseProps<HTMLUListElement>,\n DefaultTreeViewPluginParameters<Multiple> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvTreeViewClasses;\n /** Tree View children. Usually a `HvTreeItem` instance, or a custom variation of it */\n children?: React.ReactNode;\n}\n\n/**\n * A Tree View displays hierarchical structures.\n * It also facilitates the exploration of categorical levels and their content.\n *\n * Tree structures are built through composing the `HvTreeItem` component,\n * or a custom variation of it.\n *\n * It is based on MUI
|
|
1
|
+
{"version":3,"file":"TreeView.js","sources":["../../../src/TreeView/TreeView.tsx"],"sourcesContent":["import { useSlotProps } from \"@mui/base/utils\";\nimport { DropDownXS, DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { fixedForwardRef, HvBaseProps } from \"../types/generic\";\nimport {\n DEFAULT_TREE_VIEW_PLUGINS,\n DefaultTreeViewPluginParameters,\n} from \"./internals/hooks/plugins\";\nimport { useTreeView } from \"./internals/hooks/useTreeView\";\nimport { TreeViewProvider } from \"./internals/TreeViewProvider\";\nimport { staticClasses, useClasses } from \"./TreeView.styles\";\n\nexport { staticClasses as treeView2Classes }; // TODO: remove old `treeViewClasses`\n\nexport type HvTreeViewClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvTreeViewProps<Multiple extends boolean | undefined>\n extends HvBaseProps<HTMLUListElement>,\n DefaultTreeViewPluginParameters<Multiple> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvTreeViewClasses;\n /** Tree View children. Usually a `HvTreeItem` instance, or a custom variation of it */\n children?: React.ReactNode;\n}\n\n/**\n * A Tree View displays hierarchical structures.\n * It also facilitates the exploration of categorical levels and their content.\n *\n * Tree structures are built through composing the `HvTreeItem` component,\n * or a custom variation of it.\n *\n * It is based on the [MUI X TreeView](https://mui.com/x/react-tree-view) component.\n *\n * @example\n * ```tsx\n * <HvTreeView>\n * <HvTreeItem nodeId=\"1\" label=\"File1\" />\n * </HvTreeView>\n * ```\n */\nexport const HvTreeView = fixedForwardRef(function HvTreeView<\n Multiple extends boolean | undefined,\n>(props: HvTreeViewProps<Multiple>, ref: React.Ref<HTMLUListElement>) {\n const {\n id,\n children,\n classes: classesProp,\n className,\n\n disabledItemsFocusable,\n multiSelect,\n expanded,\n defaultExpanded,\n selected,\n defaultSelected,\n disableSelection,\n defaultCollapseIcon = <DropDownXS />,\n defaultExpandIcon = <DropRightXS />,\n defaultEndIcon,\n defaultParentIcon,\n onNodeSelect,\n onNodeToggle,\n onNodeFocus,\n ...others\n } = useDefaultProps(\"HvTreeView\", props);\n const { classes, cx } = useClasses(classesProp);\n\n const { getRootProps, contextValue } = useTreeView({\n disabledItemsFocusable,\n expanded,\n defaultExpanded,\n onNodeToggle,\n onNodeFocus,\n disableSelection,\n defaultSelected,\n selected,\n multiSelect,\n onNodeSelect: onNodeSelect as HvTreeViewProps<any>[\"onNodeSelect\"],\n id,\n defaultCollapseIcon,\n defaultEndIcon,\n defaultExpandIcon,\n defaultParentIcon,\n plugins: DEFAULT_TREE_VIEW_PLUGINS,\n rootRef: ref,\n });\n\n const rootProps = useSlotProps({\n elementType: \"ul\",\n externalSlotProps: {},\n externalForwardedProps: others,\n className: classes.root,\n getSlotProps: getRootProps,\n ownerState: props,\n });\n\n return (\n <TreeViewProvider value={contextValue}>\n <ul className={cx(classes.root, className)} {...rootProps} {...others}>\n {children}\n </ul>\n </TreeViewProvider>\n );\n});\n"],"names":["HvTreeView"],"mappings":";;;;;;;;;;AA6CO,MAAM,aAAa,gBAAgB,SAASA,YAEjD,OAAkC,KAAkC;AAC9D,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,0CAAuB,YAAW,EAAA;AAAA,IAClC,wCAAqB,aAAY,EAAA;AAAA,IACjC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD,gBAAgB,cAAc,KAAK;AACvC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,QAAM,EAAE,cAAc,aAAa,IAAI,YAAY;AAAA,IACjD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,SAAS;AAAA,EAAA,CACV;AAED,QAAM,YAAY,aAAa;AAAA,IAC7B,aAAa;AAAA,IACb,mBAAmB,CAAC;AAAA,IACpB,wBAAwB;AAAA,IACxB,WAAW,QAAQ;AAAA,IACnB,cAAc;AAAA,IACd,YAAY;AAAA,EAAA,CACb;AAED,6BACG,kBAAiB,EAAA,OAAO,cACvB,UAAA,oBAAC,QAAG,WAAW,GAAG,QAAQ,MAAM,SAAS,GAAI,GAAG,WAAY,GAAG,QAC5D,SACH,CAAA,GACF;AAEJ,CAAC;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
const CounterLabel = ({
|
|
3
|
+
selected,
|
|
4
|
+
total,
|
|
5
|
+
conjunctionLabel = "/"
|
|
6
|
+
}) => {
|
|
7
|
+
return /* @__PURE__ */ jsxs("span", { children: [
|
|
8
|
+
/* @__PURE__ */ jsx("b", { children: selected }),
|
|
9
|
+
" ",
|
|
10
|
+
` ${conjunctionLabel} ${total}`
|
|
11
|
+
] });
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
CounterLabel
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CounterLabel.js","sources":["../../../src/utils/CounterLabel.tsx"],"sourcesContent":["/** A utility counter component (eg. X / Y) */\nexport const CounterLabel = ({\n selected,\n total,\n conjunctionLabel = \"/\",\n}: {\n selected: number;\n total: number;\n conjunctionLabel?: React.ReactNode;\n}) => {\n return (\n <span>\n <b>{selected}</b> {` ${conjunctionLabel} ${total}`}\n </span>\n );\n};\n"],"names":[],"mappings":";AACO,MAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,mBAAmB;AACrB,MAIM;AACJ,8BACG,QACC,EAAA,UAAA;AAAA,IAAA,oBAAC,OAAG,UAAS,SAAA,CAAA;AAAA,IAAI;AAAA,IAAE,IAAI,gBAAgB,IAAI,KAAK;AAAA,EAAA,GAClD;AAEJ;"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1915,7 +1915,7 @@ export declare type HvBulkActionsClasses = ExtractNames<typeof useClasses_35>;
|
|
|
1915
1915
|
export declare type HvBulkActionsPropGetter<D extends object> = PropGetter<D, HvTAbleBulkActionsProps>;
|
|
1916
1916
|
|
|
1917
1917
|
export declare interface HvBulkActionsProps extends HvBaseProps {
|
|
1918
|
-
/** Custom label for select all checkbox */
|
|
1918
|
+
/** Custom label for select all checkbox. @deprecated no longer used */
|
|
1919
1919
|
selectAllLabel?: React.ReactNode;
|
|
1920
1920
|
/** Custom label for select all checkbox conjunction */
|
|
1921
1921
|
selectAllConjunctionLabel?: string;
|
|
@@ -2399,7 +2399,7 @@ export declare interface HvCharCounterProps extends HvBaseProps {
|
|
|
2399
2399
|
* A Checkbox is a mechanism that allows the user to select one or more options.
|
|
2400
2400
|
*
|
|
2401
2401
|
* Usually used in a Checkbox Group to present the user with a range of options from
|
|
2402
|
-
* which the user
|
|
2402
|
+
* which the user **may select any number of options** to complete their task.
|
|
2403
2403
|
*
|
|
2404
2404
|
* It can also be used individually to represent the toggle of a single option, when
|
|
2405
2405
|
* the Toggle Switch and Toggle Button aren't more appropriate.
|
|
@@ -2487,7 +2487,7 @@ export declare interface HvCheckBoxGroupProps extends HvBaseProps<HTMLDivElement
|
|
|
2487
2487
|
*/
|
|
2488
2488
|
showSelectAll?: boolean;
|
|
2489
2489
|
/**
|
|
2490
|
-
* The label of the select all checkbox. Defaults to "All".
|
|
2490
|
+
* The label of the select all checkbox. Defaults to "All". @deprecated no longer used
|
|
2491
2491
|
*/
|
|
2492
2492
|
selectAllLabel?: string;
|
|
2493
2493
|
/**
|
|
@@ -2860,6 +2860,9 @@ export declare interface HvDatePickerProps extends Omit<HvFormElementProps, "onC
|
|
|
2860
2860
|
/** @deprecated use `HvFormStatus` instead */
|
|
2861
2861
|
export declare type HvDatePickerStatus = HvFormStatus;
|
|
2862
2862
|
|
|
2863
|
+
/**
|
|
2864
|
+
* A Dialog is a graphical control element in the form of a small panel that communicates information and prompts for a response.
|
|
2865
|
+
*/
|
|
2863
2866
|
export declare const HvDialog: (props: HvDialogProps) => JSX_3.Element;
|
|
2864
2867
|
|
|
2865
2868
|
export declare type HvDialogActionClasses = ExtractNames<typeof useClasses_63>;
|
|
@@ -5131,7 +5134,7 @@ export declare type HvQueryBuilderRenderers = Record<string, ValueRenderer>;
|
|
|
5131
5134
|
* A Radio Button is a mechanism that allows user to select just an option from a group of options.
|
|
5132
5135
|
*
|
|
5133
5136
|
* It should used in a Radio Button Group to present the user with a range of options from
|
|
5134
|
-
* which the user
|
|
5137
|
+
* which the user **may select just one option** to complete their task.
|
|
5135
5138
|
*
|
|
5136
5139
|
* Individual use of radio buttons, at least uncontrolled, is unadvised as React state management doesn't
|
|
5137
5140
|
* respond to the browser's native management of radio inputs checked state.
|
|
@@ -5141,8 +5144,6 @@ export declare const HvRadio: ForwardRefExoticComponent<Omit<HvRadioProps, "ref"
|
|
|
5141
5144
|
export declare type HvRadioClasses = ExtractNames<typeof useClasses_97>;
|
|
5142
5145
|
|
|
5143
5146
|
/**
|
|
5144
|
-
* A group of radio buttons.
|
|
5145
|
-
*
|
|
5146
5147
|
* A radio group is a type of selection list that can only have a single entry checked at any one time.
|
|
5147
5148
|
*/
|
|
5148
5149
|
export declare const HvRadioGroup: ForwardRefExoticComponent<HvRadioGroupProps & RefAttributes<HTMLDivElement>>;
|
|
@@ -5809,9 +5810,9 @@ export declare interface HvSliderProps extends HvBaseProps<HTMLDivElement, "onCh
|
|
|
5809
5810
|
* A Snackbar provides brief messages about app processes.
|
|
5810
5811
|
* It is dismissed automatically after a given interval.
|
|
5811
5812
|
*
|
|
5812
|
-
* Snackbar can be built with two different components
|
|
5813
|
-
*
|
|
5814
|
-
*
|
|
5813
|
+
* Snackbar can be built with two different components:
|
|
5814
|
+
* - `HvSnackbar`, which wraps all the positioning, transition, auto hide, etc.
|
|
5815
|
+
* - `HvSnackbarContent`, which allows a finer control and customization of the content of the Snackbar.
|
|
5815
5816
|
*/
|
|
5816
5817
|
export declare const HvSnackbar: ForwardRefExoticComponent<Omit<HvSnackbarProps, "ref"> & RefAttributes<unknown>>;
|
|
5817
5818
|
|
|
@@ -5893,6 +5894,12 @@ export declare interface HvSnackbarProps extends Omit<SnackbarProps, "action" |
|
|
|
5893
5894
|
ref?: SnackbarProps["ref"];
|
|
5894
5895
|
}
|
|
5895
5896
|
|
|
5897
|
+
/**
|
|
5898
|
+
* A snackbar provider to control the stacking of multiple snackbars in the app.
|
|
5899
|
+
*
|
|
5900
|
+
* This component uses of the [Notistack](https://github.com/iamhosseindhv/notistack) library.
|
|
5901
|
+
* Please refer to its [API Reference](https://notistack.com/v2.x/api-reference) for more complex usage scenarios.
|
|
5902
|
+
*/
|
|
5896
5903
|
export declare const HvSnackbarProvider: ({ children, notistackClassesOverride, maxSnack, autoHideDuration, anchorOrigin, classes: classesProp, className, container, ...others }: HvSnackbarProviderProps) => JSX_3.Element;
|
|
5897
5904
|
|
|
5898
5905
|
export declare type HvSnackbarProviderClasses = ExtractNames<typeof useClasses_107>;
|
|
@@ -5998,10 +6005,9 @@ export declare type HvSupportColorKeys = HvSupportColor;
|
|
|
5998
6005
|
export declare type HvSupportColors = Record<HvSupportColorKeys, string>;
|
|
5999
6006
|
|
|
6000
6007
|
/**
|
|
6001
|
-
* A Switch is
|
|
6008
|
+
* A Switch is **binary** and works as a digital on/off button.
|
|
6002
6009
|
*
|
|
6003
|
-
* Use when two states are
|
|
6004
|
-
* changes in the system.
|
|
6010
|
+
* Use when two states are **opposite** and to trigger immediate changes in the system.
|
|
6005
6011
|
*/
|
|
6006
6012
|
export declare const HvSwitch: ForwardRefExoticComponent<Omit<HvSwitchProps, "ref"> & RefAttributes<HTMLButtonElement>>;
|
|
6007
6013
|
|
|
@@ -6479,7 +6485,7 @@ export declare interface HvTabsProps extends Omit<TabsProps, "onChange"> {
|
|
|
6479
6485
|
* Use tags to highlight an item's status for quick recognition and navigation
|
|
6480
6486
|
* Use color to indicate meanings that users can learn and recognize across products
|
|
6481
6487
|
*
|
|
6482
|
-
* It leverages the Chip component
|
|
6488
|
+
* It leverages the [MUI Chip](https://mui.com/material-ui/react-chip/) component
|
|
6483
6489
|
*/
|
|
6484
6490
|
export declare const HvTag: ForwardRefExoticComponent<Omit<HvTagProps, "ref"> & RefAttributes<HTMLElement>>;
|
|
6485
6491
|
|
|
@@ -6846,6 +6852,9 @@ export declare type HvTimePickerValue = {
|
|
|
6846
6852
|
seconds: number;
|
|
6847
6853
|
};
|
|
6848
6854
|
|
|
6855
|
+
/**
|
|
6856
|
+
* Use when two instances are opposite and the on/off analogy doesn’t apply. Only well-known icons should be used, otherwise, use a single checkbox for the same situation.
|
|
6857
|
+
*/
|
|
6849
6858
|
export declare const HvToggleButton: ForwardRefExoticComponent<HvToggleButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
6850
6859
|
|
|
6851
6860
|
export declare interface HvToggleButtonProps extends HvBaseProps<HTMLButtonElement, "onClick"> {
|
|
@@ -6984,7 +6993,7 @@ export declare interface HvTreeItemProps extends React.HTMLAttributes<HTMLElemen
|
|
|
6984
6993
|
* Tree structures are built through composing the `HvTreeItem` component,
|
|
6985
6994
|
* or a custom variation of it.
|
|
6986
6995
|
*
|
|
6987
|
-
* It is based on MUI
|
|
6996
|
+
* It is based on the [MUI X TreeView](https://mui.com/x/react-tree-view) component.
|
|
6988
6997
|
*
|
|
6989
6998
|
* @example
|
|
6990
6999
|
* ```tsx
|