@hitachivantara/uikit-react-core 5.87.1 → 5.87.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.
- package/dist/cjs/BaseInput/BaseInput.cjs +44 -83
- package/dist/cjs/BaseInput/BaseInput.styles.cjs +68 -142
- package/dist/cjs/BaseRadio/BaseRadio.styles.cjs +7 -6
- package/dist/cjs/BulkActions/BulkActions.cjs +9 -18
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.cjs +0 -6
- package/dist/cjs/Calendar/CalendarHeader/CalendarHeader.styles.cjs +1 -5
- package/dist/cjs/CheckBoxGroup/CheckBoxGroup.cjs +9 -9
- package/dist/cjs/Dropdown/Dropdown.cjs +8 -10
- package/dist/cjs/FilterGroup/RightPanel/RightPanel.cjs +9 -10
- package/dist/cjs/InlineEditor/InlineEditor.cjs +10 -14
- package/dist/cjs/InlineEditor/InlineEditor.styles.cjs +13 -36
- package/dist/cjs/Input/Input.cjs +4 -5
- package/dist/cjs/Input/Input.styles.cjs +5 -19
- package/dist/cjs/List/List.cjs +11 -11
- package/dist/cjs/Pagination/Pagination.styles.cjs +1 -0
- package/dist/cjs/Radio/Radio.cjs +2 -1
- package/dist/cjs/Radio/Radio.styles.cjs +7 -27
- package/dist/cjs/Select/Select.styles.cjs +1 -1
- package/dist/cjs/Table/TableCell/TableCell.styles.cjs +14 -14
- package/dist/cjs/Table/TableHeader/TableHeader.styles.cjs +16 -15
- package/dist/cjs/TagsInput/TagsInput.styles.cjs +3 -8
- package/dist/cjs/TextArea/TextArea.styles.cjs +1 -1
- package/dist/cjs/TimePicker/Unit/Unit.cjs +0 -1
- package/dist/cjs/TimePicker/Unit/Unit.styles.cjs +0 -3
- package/dist/cjs/utils/CounterLabel.cjs +16 -0
- package/dist/esm/BaseInput/BaseInput.js +45 -84
- package/dist/esm/BaseInput/BaseInput.js.map +1 -1
- package/dist/esm/BaseInput/BaseInput.styles.js +68 -142
- package/dist/esm/BaseInput/BaseInput.styles.js.map +1 -1
- 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/Calendar/CalendarHeader/CalendarHeader.js +0 -6
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.styles.js +1 -5
- package/dist/esm/Calendar/CalendarHeader/CalendarHeader.styles.js.map +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js +10 -10
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.js.map +1 -1
- package/dist/esm/Dropdown/Dropdown.js +8 -10
- package/dist/esm/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js +9 -10
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +10 -14
- package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.styles.js +13 -36
- package/dist/esm/InlineEditor/InlineEditor.styles.js.map +1 -1
- package/dist/esm/Input/Input.js +4 -5
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/Input/Input.styles.js +5 -19
- package/dist/esm/Input/Input.styles.js.map +1 -1
- package/dist/esm/List/List.js +11 -11
- package/dist/esm/List/List.js.map +1 -1
- package/dist/esm/Pagination/Pagination.styles.js +1 -0
- package/dist/esm/Pagination/Pagination.styles.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/Select/Select.styles.js +1 -1
- package/dist/esm/Select/Select.styles.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/TagsInput/TagsInput.styles.js +3 -8
- package/dist/esm/TagsInput/TagsInput.styles.js.map +1 -1
- package/dist/esm/TextArea/TextArea.styles.js +1 -1
- package/dist/esm/TextArea/TextArea.styles.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.js +0 -1
- package/dist/esm/TimePicker/Unit/Unit.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.styles.js +0 -3
- package/dist/esm/TimePicker/Unit/Unit.styles.js.map +1 -1
- package/dist/esm/utils/CounterLabel.js +16 -0
- package/dist/esm/utils/CounterLabel.js.map +1 -0
- package/dist/types/index.d.ts +29 -31
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../src/List/List.tsx"],"sourcesContent":["import {\n AriaRole,\n forwardRef,\n isValidElement,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { FixedSizeList } from \"react-window\";\nimport { DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvCheckBox } from \"../CheckBox\";\nimport { HvLink } from \"../Link\";\nimport {\n HvListContainer,\n HvListContainerProps,\n HvListItem,\n} from \"../ListContainer\";\nimport { HvOverflowTooltip } from \"../OverflowTooltip\";\nimport { HvRadio } from \"../Radio\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { HvTypography } from \"../Typography\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./List.styles\";\nimport { HvListLabels, HvListValue } from \"./types\";\nimport { useSelectableList } from \"./useSelectableList\";\nimport { parseList } from \"./utils\";\n\nexport { staticClasses as listClasses };\n\nexport type HvListClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvListProps\n extends HvBaseProps<HTMLUListElement, \"onChange\" | \"onClick\"> {\n /**\n * A list containing the elements to be rendered.\n *\n * - id: The id of the item.\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - isHidden: Is item visible.\n * - icon: The icon.\n * - showNavIcon: If true renders the navigation icon on the right.\n * - path: The path to navigate to.\n */\n values: HvListValue[];\n /** If true renders a multi select list. */\n multiSelect?: boolean;\n /**\n * If true renders select all option for multi selection lists with selectors.\n * note: It will only be rendered if multiSelect and useSelector props are set to true.\n */\n showSelectAll?: boolean;\n /** An object containing all the labels for the dropdown. */\n labels?: HvListLabels;\n /** If true renders list items with radio or checkbox selectors. */\n useSelector?: boolean;\n /** Call back fired when list item is selected. Returns selection state. */\n onChange?: (value: HvListValue[]) => void;\n /** Call back fired when list item is selected. Returns selected item. */\n onClick?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n value: HvListValue,\n ) => void;\n /** If `true` the list items will show the selection state. */\n selectable?: boolean;\n /** If `true`, selection can be toggled when single selection. */\n singleSelectionToggle?: boolean;\n /** If `true` the list will be rendered without vertical spacing. */\n condensed?: boolean;\n /** If `true` the dropdown will show tooltips when user mouseenter text in list. @deprecated this is always enabled */\n hasTooltips?: boolean;\n /** Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used */\n height?: number;\n /** Experimental. Uses dropdown in a virtualized form, where not all options are rendered initially. Good for use cases with a lot of options. */\n virtualized?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvListClasses;\n}\n\nconst DEFAULT_LABELS = {\n selectAll: \"Select All\",\n selectionConjunction: \"/\",\n};\n\n/**\n * Component used to show a set of related data to the user.\n * @deprecated use `HvListContainer` + `HvListItem` instead\n */\nexport const HvList = (props: HvListProps) => {\n const {\n id,\n classes: classesProp,\n className,\n multiSelect = false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n hasTooltips = false,\n showSelectAll = false,\n labels = DEFAULT_LABELS,\n useSelector = false,\n selectable = true,\n singleSelectionToggle = true,\n condensed = false,\n onChange,\n onClick,\n values: valuesProp = [],\n height,\n virtualized = false,\n ...others\n } = useDefaultProps(\"HvList\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [list, setList, selection] = useSelectableList(valuesProp);\n const listRef = useRef<any>(null);\n\n useEffect(() => {\n const passedProps = { multiSelect, selectable, singleSelectionToggle };\n const parsedList: HvListValue[] = parseList(\n undefined,\n passedProps,\n undefined,\n valuesProp,\n );\n\n setList(parsedList);\n }, [valuesProp, multiSelect, selectable, singleSelectionToggle, setList]);\n\n const [role, itemRole] = useMemo<[AriaRole, AriaRole]>(() => {\n // selectors are responsible for the role & selection state\n if (selectable && useSelector) return [\"list\", \"listitem\"];\n\n if (selectable) return [\"listbox\", \"option\"];\n return [\"menu\", \"menuitem\"];\n }, [selectable, useSelector]);\n\n const handleSelect = (\n evt: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLLIElement>,\n item: HvListValue,\n ) => {\n if (!item.path) evt.preventDefault();\n if (item.disabled) return;\n\n const passedProps = { multiSelect, selectable, singleSelectionToggle };\n const parsedList = parseList(item, passedProps, undefined, list);\n setList(parsedList);\n\n onClick?.(evt, item);\n onChange?.(parsedList);\n };\n\n const handleSelectAll = () => {\n const passedProps = { multiSelect, selectable, singleSelectionToggle };\n const anySelectableSelected = list.some(\n (elem) => elem.selected || elem.disabled,\n );\n const parsedList = parseList(\n undefined,\n passedProps,\n !anySelectableSelected,\n list,\n );\n setList(parsedList);\n\n onChange?.(parsedList);\n };\n\n const renderLeftIcon = (item: HvListValue) => {\n return isValidElement(item.icon)\n ? item.icon\n : typeof item.icon === \"function\"\n ? item.icon?.({\n isSelected: item.selected,\n isDisabled: item.disabled,\n })\n : null;\n };\n\n const renderSelectAll = () => {\n const { selectAll, selectionConjunction } = labels;\n\n const anySelected = !!selection?.length;\n const allSelected = selection.length === list.length;\n\n const selectionLabel = (\n <HvTypography component=\"span\">\n {!anySelected ? (\n <>\n <b>{selectAll}</b>\n {` (${list.length})`}\n </>\n ) : (\n <>\n <b>{selection.length}</b>\n {`\\xa0${selectionConjunction}\\xa0`}\n {list.length}\n </>\n )}\n </HvTypography>\n );\n\n return (\n <HvCheckBox\n id={setId(id, \"select-all\")}\n label={selectionLabel}\n onChange={handleSelectAll}\n className={classes.selectAllSelector}\n indeterminate={anySelected && !allSelected}\n checked={allSelected}\n />\n );\n };\n\n const renderItemText = (item: HvListValue) => {\n return !multiSelect && item.path ? (\n <HvLink route={item.path} classes={{ a: classes.link }}>\n <HvOverflowTooltip data={item.label} />\n </HvLink>\n ) : (\n <HvOverflowTooltip data={item.label} />\n );\n };\n\n const renderSelectItem = (item: HvListValue, itemId?: string) => {\n if (!useSelector) return renderItemText(item);\n\n const Component = multiSelect ? HvCheckBox : HvRadio;\n\n return (\n <Component\n id={setId(itemId, \"selector\")}\n label={<HvOverflowTooltip data={item.label} />}\n checked={item.selected || false}\n disabled={item.disabled}\n onChange={multiSelect ? (evt) => handleSelect(evt, item) : undefined}\n classes={{\n root: classes.selectorRoot,\n container: classes.selectorContainer,\n label: classes.truncate,\n }}\n />\n );\n };\n\n const renderListItem = (item: HvListValue, i: number, otherProps = {}) => {\n const itemId = setId(id, \"item\", i);\n const selected = item.selected || false;\n\n const startAdornment =\n !useSelector && item.icon ? renderLeftIcon(item) : null;\n\n return (\n <HvListItem\n key={i}\n id={itemId}\n role={itemRole}\n disabled={item.disabled || undefined}\n className={classes.item}\n classes={{\n selected: cx({\n [classes.itemSelector]: useSelector || multiSelect,\n }),\n }}\n selected={multiSelect || selected ? selected : undefined}\n onClick={(evt) => handleSelect(evt, item)}\n startAdornment={startAdornment}\n endAdornment={\n item.showNavIcon && (\n <DropRightXS className={classes.box} iconSize=\"XS\" />\n )\n }\n {...otherProps}\n >\n {renderSelectItem(item, itemId)}\n </HvListItem>\n );\n };\n\n const filteredList = list.filter((it) => !it.isHidden);\n const anySelected = list\n .map((item) => item.selected && !item.disabled)\n .reduce((result, selected) => result || selected, false);\n\n const selectedItemIndex = list.findIndex((item) => item.selected);\n useEffect(() => {\n if (selectedItemIndex >= 0 && listRef.current !== null) {\n listRef.current.scrollToItem(selectedItemIndex);\n }\n }, [listRef, selectedItemIndex]);\n\n const renderVirtualizedListItem = ({\n index,\n style,\n }: {\n index: number;\n style: Record<string, any>;\n }) => {\n const item = filteredList[index];\n const tabIndex =\n item.tabIndex ||\n (!anySelected && index === 0) ||\n (item.selected && !item.disabled)\n ? 0\n : -1;\n\n return renderListItem(item, index, {\n style: {\n ...style,\n top: `${parseFloat(style.top) + 5}px`,\n left: `${parseFloat(style.left) + 5}px`,\n width: `calc(${parseFloat(style.width)}% - 10px)`,\n },\n tabIndex,\n interactive: true,\n condensed,\n disableGutters: useSelector,\n });\n };\n\n const ariaMultiSelectable = (role === \"listbox\" && multiSelect) || undefined;\n\n const ListContainer = useMemo(() => {\n // eslint-disable-next-line react/display-name\n return forwardRef<HTMLUListElement, HvListContainerProps>(\n ({ ...rest }, ref) => (\n <HvListContainer\n id={id}\n className={cx(classes.root, className)}\n role={role}\n interactive\n condensed={condensed}\n disableGutters={useSelector}\n aria-multiselectable={ariaMultiSelectable}\n ref={ref}\n {...rest}\n />\n ),\n );\n }, [\n cx,\n id,\n useSelector,\n className,\n classes.root,\n role,\n condensed,\n ariaMultiSelectable,\n ]);\n\n // Render nothing if there are no items\n if (filteredList.length === 0) return null;\n\n return (\n <>\n {multiSelect && useSelector && showSelectAll && renderSelectAll()}\n\n {!virtualized ? (\n <HvListContainer\n id={id}\n className={cx(classes.root, className)}\n role={role}\n interactive\n condensed={condensed}\n disableGutters={useSelector}\n aria-multiselectable={ariaMultiSelectable}\n {...others}\n >\n {filteredList.map((item, i) => renderListItem(item, i))}\n </HvListContainer>\n ) : (\n <FixedSizeList\n ref={listRef}\n className={classes.virtualizedRoot}\n height={(height || 0) + 5}\n width=\"100%\"\n itemCount={filteredList.length}\n itemSize={condensed ? 32 : 40}\n innerElementType={ListContainer}\n {...(others as any)}\n >\n {renderVirtualizedListItem}\n </FixedSizeList>\n )}\n </>\n );\n};\n"],"names":["anySelected"],"mappings":";;;;;;;;;;;;;;;;;AAuFA,MAAM,iBAAiB;AAAA,EACrB,WAAW;AAAA,EACX,sBAAsB;AACxB;AAMa,MAAA,SAAS,CAAC,UAAuB;AACtC,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,cAAc;AAAA;AAAA,IAEd,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,aAAa;AAAA,IACb,wBAAwB;AAAA,IACxB,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,QAAQ,aAAa,CAAC;AAAA,IACtB;AAAA,IACA,cAAc;AAAA,IACd,GAAG;AAAA,EAAA,IACD,gBAAgB,UAAU,KAAK;AAEnC,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAE9C,QAAM,CAAC,MAAM,SAAS,SAAS,IAAI,kBAAkB,UAAU;AACzD,QAAA,UAAU,OAAY,IAAI;AAEhC,YAAU,MAAM;AACd,UAAM,cAAc,EAAE,aAAa,YAAY,sBAAsB;AACrE,UAAM,aAA4B;AAAA,MAChC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAEA,YAAQ,UAAU;AAAA,EAAA,GACjB,CAAC,YAAY,aAAa,YAAY,uBAAuB,OAAO,CAAC;AAExE,QAAM,CAAC,MAAM,QAAQ,IAAI,QAA8B,MAAM;AAE3D,QAAI,cAAc,YAAoB,QAAA,CAAC,QAAQ,UAAU;AAEzD,QAAI,WAAY,QAAO,CAAC,WAAW,QAAQ;AACpC,WAAA,CAAC,QAAQ,UAAU;AAAA,EAAA,GACzB,CAAC,YAAY,WAAW,CAAC;AAEtB,QAAA,eAAe,CACnB,KACA,SACG;AACH,QAAI,CAAC,KAAK,KAAM,KAAI,e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IAAA;AAAA,EACH,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../src/List/List.tsx"],"sourcesContent":["import {\n AriaRole,\n forwardRef,\n isValidElement,\n useEffect,\n useMemo,\n useRef,\n} from \"react\";\nimport { FixedSizeList } from \"react-window\";\nimport { DropRightXS } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvCheckBox } from \"../CheckBox\";\nimport { HvLink } from \"../Link\";\nimport {\n HvListContainer,\n HvListContainerProps,\n HvListItem,\n} from \"../ListContainer\";\nimport { HvOverflowTooltip } from \"../OverflowTooltip\";\nimport { HvRadio } from \"../Radio\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { CounterLabel } from \"../utils/CounterLabel\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./List.styles\";\nimport { HvListValue } from \"./types\";\nimport { useSelectableList } from \"./useSelectableList\";\nimport { parseList } from \"./utils\";\n\nexport { staticClasses as listClasses };\n\nexport type HvListClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvListProps\n extends HvBaseProps<HTMLUListElement, \"onChange\" | \"onClick\"> {\n /**\n * A list containing the elements to be rendered.\n *\n * - id: The id of the item.\n * - label: The label of the element to be rendered.\n * - selected: The selection state of the element.\n * - disabled: The disabled state of the element.\n * - isHidden: Is item visible.\n * - icon: The icon.\n * - showNavIcon: If true renders the navigation icon on the right.\n * - path: The path to navigate to.\n */\n values: HvListValue[];\n /** If true renders a multi select list. */\n multiSelect?: boolean;\n /**\n * If true renders select all option for multi selection lists with selectors.\n * note: It will only be rendered if multiSelect and useSelector props are set to true.\n */\n showSelectAll?: boolean;\n /** An object containing all the labels for the dropdown. */\n labels?: HvListLabels;\n /** If true renders list items with radio or checkbox selectors. */\n useSelector?: boolean;\n /** Call back fired when list item is selected. Returns selection state. */\n onChange?: (value: HvListValue[]) => void;\n /** Call back fired when list item is selected. Returns selected item. */\n onClick?: (\n event:\n | React.ChangeEvent<HTMLInputElement>\n | React.MouseEvent<HTMLLIElement>,\n value: HvListValue,\n ) => void;\n /** If `true` the list items will show the selection state. */\n selectable?: boolean;\n /** If `true`, selection can be toggled when single selection. */\n singleSelectionToggle?: boolean;\n /** If `true` the list will be rendered without vertical spacing. */\n condensed?: boolean;\n /** If `true` the dropdown will show tooltips when user mouseenter text in list. @deprecated this is always enabled */\n hasTooltips?: boolean;\n /** Experimental. Height of the dropdown, in case you want to control it from a prop. Styles can also be used through dropdownListContainer class. Required in case virtualized is used */\n height?: number;\n /** Experimental. Uses dropdown in a virtualized form, where not all options are rendered initially. Good for use cases with a lot of options. */\n virtualized?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvListClasses;\n}\n\nconst DEFAULT_LABELS = {\n /** The label used for the All checkbox action. @deprecated no longer used */\n selectAll: \"Select All\",\n /** The label used in the middle of the multi-selection count. */\n selectionConjunction: \"/\",\n};\n\nexport type HvListLabels = Partial<typeof DEFAULT_LABELS>;\n\n/**\n * Component used to show a set of related data to the user.\n * @deprecated use `HvListContainer` + `HvListItem` instead\n */\nexport const HvList = (props: HvListProps) => {\n const {\n id,\n classes: classesProp,\n className,\n multiSelect = false,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n hasTooltips = false,\n showSelectAll = false,\n labels = DEFAULT_LABELS,\n useSelector = false,\n selectable = true,\n singleSelectionToggle = true,\n condensed = false,\n onChange,\n onClick,\n values: valuesProp = [],\n height,\n virtualized = false,\n ...others\n } = useDefaultProps(\"HvList\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n const [list, setList, selection] = useSelectableList(valuesProp);\n const listRef = useRef<any>(null);\n\n useEffect(() => {\n const passedProps = { multiSelect, selectable, singleSelectionToggle };\n const parsedList: HvListValue[] = parseList(\n undefined,\n passedProps,\n undefined,\n valuesProp,\n );\n\n setList(parsedList);\n }, [valuesProp, multiSelect, selectable, singleSelectionToggle, setList]);\n\n const [role, itemRole] = useMemo<[AriaRole, AriaRole]>(() => {\n // selectors are responsible for the role & selection state\n if (selectable && useSelector) return [\"list\", \"listitem\"];\n\n if (selectable) return [\"listbox\", \"option\"];\n return [\"menu\", \"menuitem\"];\n }, [selectable, useSelector]);\n\n const handleSelect = (\n evt: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLLIElement>,\n item: HvListValue,\n ) => {\n if (!item.path) evt.preventDefault();\n if (item.disabled) return;\n\n const passedProps = { multiSelect, selectable, singleSelectionToggle };\n const parsedList = parseList(item, passedProps, undefined, list);\n setList(parsedList);\n\n onClick?.(evt, item);\n onChange?.(parsedList);\n };\n\n const handleSelectAll = () => {\n const passedProps = { multiSelect, selectable, singleSelectionToggle };\n const anySelectableSelected = list.some(\n (elem) => elem.selected || elem.disabled,\n );\n const parsedList = parseList(\n undefined,\n passedProps,\n !anySelectableSelected,\n list,\n );\n setList(parsedList);\n\n onChange?.(parsedList);\n };\n\n const renderLeftIcon = (item: HvListValue) => {\n return isValidElement(item.icon)\n ? item.icon\n : typeof item.icon === \"function\"\n ? item.icon?.({\n isSelected: item.selected,\n isDisabled: item.disabled,\n })\n : null;\n };\n\n const renderSelectAll = () => {\n const anySelected = !!selection?.length;\n const allSelected = selection.length === list.length;\n\n return (\n <HvCheckBox\n id={setId(id, \"select-all\")}\n label={\n <CounterLabel\n selected={selection.length}\n total={list.length}\n conjunctionLabel={labels.selectionConjunction}\n />\n }\n onChange={handleSelectAll}\n className={classes.selectAllSelector}\n indeterminate={anySelected && !allSelected}\n checked={allSelected}\n />\n );\n };\n\n const renderItemText = (item: HvListValue) => {\n return !multiSelect && item.path ? (\n <HvLink route={item.path} classes={{ a: classes.link }}>\n <HvOverflowTooltip data={item.label} />\n </HvLink>\n ) : (\n <HvOverflowTooltip data={item.label} />\n );\n };\n\n const renderSelectItem = (item: HvListValue, itemId?: string) => {\n if (!useSelector) return renderItemText(item);\n\n const Component = multiSelect ? HvCheckBox : HvRadio;\n\n return (\n <Component\n id={setId(itemId, \"selector\")}\n label={<HvOverflowTooltip data={item.label} />}\n checked={item.selected || false}\n disabled={item.disabled}\n onChange={multiSelect ? (evt) => handleSelect(evt, item) : undefined}\n classes={{\n root: classes.selectorRoot,\n container: classes.selectorContainer,\n label: classes.truncate,\n }}\n />\n );\n };\n\n const renderListItem = (item: HvListValue, i: number, otherProps = {}) => {\n const itemId = setId(id, \"item\", i);\n const selected = item.selected || false;\n\n const startAdornment =\n !useSelector && item.icon ? renderLeftIcon(item) : null;\n\n return (\n <HvListItem\n key={i}\n id={itemId}\n role={itemRole}\n disabled={item.disabled || undefined}\n className={classes.item}\n classes={{\n selected: cx({\n [classes.itemSelector]: useSelector || multiSelect,\n }),\n }}\n selected={multiSelect || selected ? selected : undefined}\n onClick={(evt) => handleSelect(evt, item)}\n startAdornment={startAdornment}\n endAdornment={\n item.showNavIcon && (\n <DropRightXS className={classes.box} iconSize=\"XS\" />\n )\n }\n {...otherProps}\n >\n {renderSelectItem(item, itemId)}\n </HvListItem>\n );\n };\n\n const filteredList = list.filter((it) => !it.isHidden);\n const anySelected = list\n .map((item) => item.selected && !item.disabled)\n .reduce((result, selected) => result || selected, false);\n\n const selectedItemIndex = list.findIndex((item) => item.selected);\n useEffect(() => {\n if (selectedItemIndex >= 0 && listRef.current !== null) {\n listRef.current.scrollToItem(selectedItemIndex);\n }\n }, [listRef, selectedItemIndex]);\n\n const renderVirtualizedListItem = ({\n index,\n style,\n }: {\n index: number;\n style: Record<string, any>;\n }) => {\n const item = filteredList[index];\n const tabIndex =\n item.tabIndex ||\n (!anySelected && index === 0) ||\n (item.selected && !item.disabled)\n ? 0\n : -1;\n\n return renderListItem(item, index, {\n style: {\n ...style,\n top: `${parseFloat(style.top) + 5}px`,\n left: `${parseFloat(style.left) + 5}px`,\n width: `calc(${parseFloat(style.width)}% - 10px)`,\n },\n tabIndex,\n interactive: true,\n condensed,\n disableGutters: useSelector,\n });\n };\n\n const ariaMultiSelectable = (role === \"listbox\" && multiSelect) || undefined;\n\n const ListContainer = useMemo(() => {\n // eslint-disable-next-line react/display-name\n return forwardRef<HTMLUListElement, HvListContainerProps>(\n ({ ...rest }, ref) => (\n <HvListContainer\n id={id}\n className={cx(classes.root, className)}\n role={role}\n interactive\n condensed={condensed}\n disableGutters={useSelector}\n aria-multiselectable={ariaMultiSelectable}\n ref={ref}\n {...rest}\n />\n ),\n );\n }, [\n cx,\n id,\n useSelector,\n className,\n classes.root,\n role,\n condensed,\n ariaMultiSelectable,\n ]);\n\n // Render nothing if there are no items\n if (filteredList.length === 0) return null;\n\n return (\n <>\n {multiSelect && useSelector && showSelectAll && renderSelectAll()}\n\n {!virtualized ? (\n <HvListContainer\n id={id}\n className={cx(classes.root, className)}\n role={role}\n interactive\n condensed={condensed}\n disableGutters={useSelector}\n aria-multiselectable={ariaMultiSelectable}\n {...others}\n >\n {filteredList.map((item, i) => renderListItem(item, i))}\n </HvListContainer>\n ) : (\n <FixedSizeList\n ref={listRef}\n className={classes.virtualizedRoot}\n height={(height || 0) + 5}\n width=\"100%\"\n itemCount={filteredList.length}\n itemSize={condensed ? 32 : 40}\n innerElementType={ListContainer}\n {...(others as any)}\n >\n {renderVirtualizedListItem}\n </FixedSizeList>\n )}\n </>\n );\n};\n"],"names":["anySelected"],"mappings":";;;;;;;;;;;;;;;;;AAuFA,MAAM,iBAAiB;AAAA;AAAA,EAErB,WAAW;AAAA;AAAA,EAEX,sBAAsB;AACxB;AAQa,MAAA,SAAS,CAAC,UAAuB;AACtC,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,cAAc;AAAA;AAAA,IAEd,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,SAAS;AAAA,IACT,cAAc;AAAA,IACd,aAAa;AAAA,IACb,wBAAwB;AAAA,IACxB,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,QAAQ,aAAa,CAAC;AAAA,IACtB;AAAA,IACA,cAAc;AAAA,IACd,GAAG;AAAA,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AAA,QACA,gBAAgB;AAAA,QAChB,wBAAsB;AAAA,QACrB,GAAG;AAAA,QAEH,UAAA,aAAa,IAAI,CAAC,MAAM,MAAM,eAAe,MAAM,CAAC,CAAC;AAAA,MAAA;AAAA,IAAA,IAGxD;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL,WAAW,QAAQ;AAAA,QACnB,SAAS,UAAU,KAAK;AAAA,QACxB,OAAM;AAAA,QACN,WAAW,aAAa;AAAA,QACxB,UAAU,YAAY,KAAK;AAAA,QAC3B,kBAAkB;AAAA,QACjB,GAAI;AAAA,QAEJ,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GAEJ;AAEJ;"}
|
|
@@ -3,6 +3,7 @@ import { theme } from "@hitachivantara/uikit-styles";
|
|
|
3
3
|
import { staticClasses as staticClasses$1 } from "../BaseDropdown/BaseDropdown.styles.js";
|
|
4
4
|
import "../BaseDropdown/BaseDropdown.js";
|
|
5
5
|
import { staticClasses as staticClasses$2 } from "../Input/Input.styles.js";
|
|
6
|
+
import "../Input/Input.js";
|
|
6
7
|
const hoverColor = theme.colors.atmo3;
|
|
7
8
|
const { staticClasses, useClasses } = createClasses("HvPagination", {
|
|
8
9
|
/** Styles applied to the component root class. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.styles.js","sources":["../../../src/Pagination/Pagination.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { baseDropdownClasses } from \"../BaseDropdown\";\nimport { inputClasses } from \"../Input\";\n\nconst hoverColor = theme.colors.atmo3;\n\nexport const { staticClasses, useClasses } = createClasses(\"HvPagination\", {\n /** Styles applied to the component root class. */\n root: {\n position: \"relative\",\n zIndex: 1,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"stretch\",\n flexWrap: \"wrap\",\n marginTop: theme.space.sm,\n [`& $pageSizeInput`]: {\n ...(theme.typography.caption2 as React.CSSProperties),\n \"&:focus\": {\n padding: 0,\n },\n },\n [`& $pageSizeInputContainer`]: {\n width: 24,\n minWidth: 24,\n maxWidth: theme.spacing(8),\n },\n [`&& $pageSizeInputRoot`]: {\n backgroundColor: \"transparent\",\n height: \"24px\",\n \"&:focus, &:focus-within, &:hover\": {\n backgroundColor: hoverColor,\n },\n },\n },\n /** Styles applied to the page size selector container. */\n pageSizeOptions: {\n display: \"flex\",\n position: \"absolute\",\n gap: theme.space.xs,\n height: 24,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n left: \"0\",\n },\n pageSizeHeader: {\n height: 24,\n display: \"flex\",\n alignItems: \"center\",\n [`& .${baseDropdownClasses.arrowContainer}`]: {\n marginTop: -2,\n },\n },\n pageSizeRoot: {\n width: \"auto\",\n },\n /** Styles applied to the element that holds the labels for the page size selector */\n pageSizeTextContainer: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"24px\",\n padding: \"8px 0\",\n ...(theme.typography.caption2 as React.CSSProperties),\n },\n totalPagesTextContainer: {\n ...(theme.typography.caption2 as React.CSSProperties),\n },\n /** Styles applied to the page size selector dropdown element. */\n pageSizeOptionsSelect: {\n display: \"inline-block\",\n width: \"auto\",\n\n ...(theme.typography.caption2 as React.CSSProperties),\n },\n /** Styles applied to the page navigation container. */\n pageNavigator: {\n display: \"flex\",\n alignItems: \"center\",\n height: \"32px\",\n gap: 8,\n },\n /** Styles applied to each navigation `HvButton` icon container. */\n iconContainer: {\n padding: 0,\n },\n /** Styles applied to each navigation icon. */\n icon: {},\n /** Styles applied to the central page information container. */\n pageInfo: {\n display: \"inline-block\",\n whiteSpace: \"nowrap\",\n height: \"32px\",\n lineHeight: \"32px\",\n },\n /** Styles applied to the page selector input container. */\n pageJump: {\n display: \"inline-block\",\n marginRight: `4px`,\n [`& .${inputClasses.inputRoot}`]: {\n [`& $pageSizeInput`]: {\n paddingLeft: `4px`,\n paddingRight: `4px`,\n margin: 0,\n textAlign: \"center\",\n borderRadius: theme.radii.base,\n MozAppearance: \"textfield\",\n \"&:focus\": {\n backgroundColor: hoverColor,\n },\n \"&:hover\": {\n cursor: \"pointer\",\n },\n },\n },\n },\n /** Styles passed down to the page selector Input component as `input`. */\n pageSizeInput: {},\n /** Styles passed down to the page selector Input root. */\n pageSizeInputRoot: {},\n /** Styles passed down to the page selector Input component as `container`. */\n pageSizeInputContainer: {},\n});\n"],"names":["baseDropdownClasses","inputClasses"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.styles.js","sources":["../../../src/Pagination/Pagination.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { baseDropdownClasses } from \"../BaseDropdown\";\nimport { inputClasses } from \"../Input\";\n\nconst hoverColor = theme.colors.atmo3;\n\nexport const { staticClasses, useClasses } = createClasses(\"HvPagination\", {\n /** Styles applied to the component root class. */\n root: {\n position: \"relative\",\n zIndex: 1,\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"stretch\",\n flexWrap: \"wrap\",\n marginTop: theme.space.sm,\n [`& $pageSizeInput`]: {\n ...(theme.typography.caption2 as React.CSSProperties),\n \"&:focus\": {\n padding: 0,\n },\n },\n [`& $pageSizeInputContainer`]: {\n width: 24,\n minWidth: 24,\n maxWidth: theme.spacing(8),\n },\n [`&& $pageSizeInputRoot`]: {\n backgroundColor: \"transparent\",\n height: \"24px\",\n \"&:focus, &:focus-within, &:hover\": {\n backgroundColor: hoverColor,\n },\n },\n },\n /** Styles applied to the page size selector container. */\n pageSizeOptions: {\n display: \"flex\",\n position: \"absolute\",\n gap: theme.space.xs,\n height: 24,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n left: \"0\",\n },\n pageSizeHeader: {\n height: 24,\n display: \"flex\",\n alignItems: \"center\",\n [`& .${baseDropdownClasses.arrowContainer}`]: {\n marginTop: -2,\n },\n },\n pageSizeRoot: {\n width: \"auto\",\n },\n /** Styles applied to the element that holds the labels for the page size selector */\n pageSizeTextContainer: {\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n height: \"24px\",\n padding: \"8px 0\",\n ...(theme.typography.caption2 as React.CSSProperties),\n },\n totalPagesTextContainer: {\n ...(theme.typography.caption2 as React.CSSProperties),\n },\n /** Styles applied to the page size selector dropdown element. */\n pageSizeOptionsSelect: {\n display: \"inline-block\",\n width: \"auto\",\n\n ...(theme.typography.caption2 as React.CSSProperties),\n },\n /** Styles applied to the page navigation container. */\n pageNavigator: {\n display: \"flex\",\n alignItems: \"center\",\n height: \"32px\",\n gap: 8,\n },\n /** Styles applied to each navigation `HvButton` icon container. */\n iconContainer: {\n padding: 0,\n },\n /** Styles applied to each navigation icon. */\n icon: {},\n /** Styles applied to the central page information container. */\n pageInfo: {\n display: \"inline-block\",\n whiteSpace: \"nowrap\",\n height: \"32px\",\n lineHeight: \"32px\",\n },\n /** Styles applied to the page selector input container. */\n pageJump: {\n display: \"inline-block\",\n marginRight: `4px`,\n [`& .${inputClasses.inputRoot}`]: {\n [`& $pageSizeInput`]: {\n paddingLeft: `4px`,\n paddingRight: `4px`,\n margin: 0,\n textAlign: \"center\",\n borderRadius: theme.radii.base,\n MozAppearance: \"textfield\",\n \"&:focus\": {\n backgroundColor: hoverColor,\n },\n \"&:hover\": {\n cursor: \"pointer\",\n },\n },\n },\n },\n /** Styles passed down to the page selector Input component as `input`. */\n pageSizeInput: {},\n /** Styles passed down to the page selector Input root. */\n pageSizeInputRoot: {},\n /** Styles passed down to the page selector Input component as `container`. */\n pageSizeInputContainer: {},\n});\n"],"names":["baseDropdownClasses","inputClasses"],"mappings":";;;;;;AAMA,MAAM,aAAa,MAAM,OAAO;AAEzB,MAAM,EAAE,eAAe,eAAe,cAAc,gBAAgB;AAAA;AAAA,EAEzE,MAAM;AAAA,IACJ,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;A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AAA,EACP;AAAA;AAAA,EAEA,eAAe;AAAA,IACb,SAAS;AAAA,EACX;AAAA;AAAA,EAEA,MAAM,CAAC;AAAA;AAAA,EAEP,UAAU;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,YAAY;AAAA,EACd;AAAA;AAAA,EAEA,UAAU;AAAA,IACR,SAAS;AAAA,IACT,aAAa;AAAA,IACb,CAAC,MAAMC,gBAAa,SAAS,EAAE,GAAG;AAAA,MAChC,CAAC,kBAAkB,GAAG;AAAA,QACpB,aAAa;AAAA,QACb,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,WAAW;AAAA,QACX,cAAc,MAAM,MAAM;AAAA,QAC1B,eAAe;AAAA,QACf,WAAW;AAAA,UACT,iBAAiB;AAAA,QACnB;AAAA,QACA,WAAW;AAAA,UACT,QAAQ;AAAA,QAAA;AAAA,MACV;AAAA,IACF;AAAA,EAEJ;AAAA;AAAA,EAEA,eAAe,CAAC;AAAA;AAAA,EAEhB,mBAAmB,CAAC;AAAA;AAAA,EAEpB,wBAAwB,CAAA;AAC1B,CAAC;"}
|
package/dist/esm/Radio/Radio.js
CHANGED
|
@@ -125,6 +125,7 @@ const HvRadio = forwardRef(
|
|
|
125
125
|
/* @__PURE__ */ jsx(
|
|
126
126
|
HvLabel,
|
|
127
127
|
{
|
|
128
|
+
noWrap: true,
|
|
128
129
|
id: setId(elementId, "label"),
|
|
129
130
|
htmlFor: setId(elementId, "input"),
|
|
130
131
|
label,
|
|
@@ -135,7 +136,7 @@ const HvRadio = forwardRef(
|
|
|
135
136
|
]
|
|
136
137
|
}
|
|
137
138
|
) : radio,
|
|
138
|
-
canShowError && /* @__PURE__ */ jsx(HvWarningText, { id: setId(elementId, "error"),
|
|
139
|
+
canShowError && /* @__PURE__ */ jsx(HvWarningText, { id: setId(elementId, "error"), children: statusMessage })
|
|
139
140
|
]
|
|
140
141
|
}
|
|
141
142
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../src/Radio/Radio.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport { RadioProps as MuiRadioProps } from \"@mui/material/Radio\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseRadio } from \"../BaseRadio\";\nimport {\n HvFormElement,\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 \"./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 **may select just one option** 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 function HvRadio(props, ref) {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value = \"on\",\n required,\n readOnly,\n disabled,\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,\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);\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(checked, defaultChecked);\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 [classes.checked]: isChecked,\n [classes.semantic]: semantic,\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"],"mappings":";;;;;;;;;;;;;AAqIO,MAAM,UAAU;AAAA,EACrB,SAASA,SAAQ,OAAO,KAAK;AACrB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBAAgB,WAAW,KAAK;AAEpC,UAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAExC,UAAA,YAAY,YAAY,EAAE;AAEhC,UAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AAEtD,UAAM,yBAAyB;AAAA,MAC7B,CAAC,QAA+B;AAC9B,wBAAgB,IAAI;AACpB,yBAAiB,GAAG;AAAA,MACtB;AAAA,MACA,CAAC,cAAc;AAAA,IACjB;AAEA,UAAM,iBAAiB;AAAA,MACrB,CAAC,QAA+B;AAC9B,wBAAgB,KAAK;AACrB,iBAAS,GAAG;AAAA,MACd;AAAA,MACA,CAAC,MAAM;AAAA,IACT;AAEA,UAAM,CAAC,WAAW,YAAY,IAAI,cAAc,SAAS,cAAc;AAEvE,UAAM,gBAAgB;AAAA,MACpB,CAAC,KAA0C,eAAwB;AACjE,qBAA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AAAA,gBAC5B,CAAC,QAAQ,OAAO,GAAG;AAAA,gBACnB,CAAC,QAAQ,QAAQ,GAAG;AAAA,cAAA,CACrB;AAAA,cAEA,UAAA;AAAA,gBAAA;AAAA,gBACD;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,IAAI,MAAM,WAAW,OAAO;AAAA,oBAC5B,SAAS,MAAM,WAAW,OAAO;AAAA,oBACjC;AAAA,oBACA,WAAW,QAAQ;AAAA,oBAClB,GAAG;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACN;AAAA,YAAA;AAAA,UAAA,IAGF;AAAA,UAED,gBACE,oBAAA,eAAA,EAAc,IAAI,MAAM,WAAW,OAAO,GAAG,eAAa,MACxD,UACH,cAAA,CAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../src/Radio/Radio.tsx"],"sourcesContent":["import { forwardRef, useCallback, useState } from \"react\";\nimport { RadioProps as MuiRadioProps } from \"@mui/material/Radio\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseRadio } from \"../BaseRadio\";\nimport {\n HvFormElement,\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 \"./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 **may select just one option** 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 function HvRadio(props, ref) {\n const {\n classes: classesProp,\n className,\n id,\n name,\n value = \"on\",\n required,\n readOnly,\n disabled,\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,\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);\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(checked, defaultChecked);\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 [classes.checked]: isChecked,\n [classes.semantic]: semantic,\n })}\n >\n {radio}\n <HvLabel\n noWrap\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\")}>\n {statusMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["HvRadio"],"mappings":";;;;;;;;;;;;;AAqIO,MAAM,UAAU;AAAA,EACrB,SAASA,SAAQ,OAAO,KAAK;AACrB,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjB;AAAA,MACA,SAAS;AAAA,MACT;AAAA,MACA,qBAAqB;AAAA,MACrB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IAAA,IACD,gBA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14
|
-
"&:hover": {
|
|
15
|
-
backgroundColor: theme.colors.containerBackgroundHover,
|
|
16
|
-
borderRadius: theme.radii.base
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
invalidContainer: {
|
|
20
|
-
borderBottom: `1px solid ${theme.colors.negative_120}`,
|
|
21
|
-
"&:hover": {
|
|
22
|
-
borderBottomLeftRadius: "0px",
|
|
23
|
-
borderBottomRightRadius: "0px"
|
|
9
|
+
alignItems: "center",
|
|
10
|
+
transition: "background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms",
|
|
11
|
+
borderRadius: theme.radii.base,
|
|
12
|
+
":hover:not($disabled)": {
|
|
13
|
+
backgroundColor: theme.colors.containerBackgroundHover
|
|
24
14
|
}
|
|
25
15
|
},
|
|
16
|
+
invalidContainer: {},
|
|
26
17
|
disabled: {
|
|
27
18
|
cursor: "not-allowed",
|
|
28
19
|
"& $label": { color: theme.colors.secondary_60, cursor: "not-allowed" }
|
|
29
20
|
},
|
|
30
21
|
radio: {
|
|
31
|
-
height: "32px",
|
|
32
22
|
"& svg": {
|
|
33
23
|
outline: "none",
|
|
34
24
|
boxShadow: "none"
|
|
35
25
|
}
|
|
36
26
|
},
|
|
37
|
-
invalidRadio: {
|
|
38
|
-
borderBottom: `1px solid ${theme.colors.negative_120}`,
|
|
39
|
-
"&:hover": {
|
|
40
|
-
borderBottomLeftRadius: "0px",
|
|
41
|
-
borderBottomRightRadius: "0px"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
27
|
+
invalidRadio: {},
|
|
44
28
|
label: {
|
|
45
|
-
overflow: "hidden",
|
|
46
|
-
textOverflow: "ellipsis",
|
|
47
29
|
verticalAlign: "middle",
|
|
48
30
|
paddingRight: theme.space.xs,
|
|
49
|
-
whiteSpace: "nowrap",
|
|
50
31
|
...theme.typography.body,
|
|
51
32
|
cursor: "pointer",
|
|
52
|
-
height: "32px",
|
|
53
33
|
lineHeight: "32px",
|
|
54
34
|
width: "100%"
|
|
55
35
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.styles.js","sources":["../../../src/Radio/Radio.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvRadio\", {\n root: { display: \"inline-block\" },\n container: {\n cursor: \"pointer\",\n display: \"flex\",\n
|
|
1
|
+
{"version":3,"file":"Radio.styles.js","sources":["../../../src/Radio/Radio.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { outlineStyles } from \"../utils/focusUtils\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvRadio\", {\n root: { display: \"inline-block\" },\n container: {\n cursor: \"pointer\",\n display: \"flex\",\n alignItems: \"center\",\n transition: \"background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms\",\n borderRadius: theme.radii.base,\n\n \":hover:not($disabled)\": {\n backgroundColor: theme.colors.containerBackgroundHover,\n },\n },\n invalidContainer: {},\n disabled: {\n cursor: \"not-allowed\",\n\n \"& $label\": { color: theme.colors.secondary_60, cursor: \"not-allowed\" },\n },\n radio: {\n \"& svg\": {\n outline: \"none\",\n boxShadow: \"none\",\n },\n },\n invalidRadio: {},\n label: {\n verticalAlign: \"middle\",\n paddingRight: theme.space.xs,\n ...theme.typography.body,\n cursor: \"pointer\",\n lineHeight: \"32px\",\n width: \"100%\",\n },\n focusVisible: { backgroundColor: theme.colors.atmo3, ...outlineStyles },\n checked: {},\n semantic: {},\n});\n"],"names":[],"mappings":";;;AAKO,MAAM,EAAE,eAAe,eAAe,cAAc,WAAW;AAAA,EACpE,MAAM,EAAE,SAAS,eAAe;AAAA,EAChC,WAAW;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,cAAc,MAAM,MAAM;AAAA,IAE1B,yBAAyB;AAAA,MACvB,iBAAiB,MAAM,OAAO;AAAA,IAAA;AAAA,EAElC;AAAA,EACA,kBAAkB,CAAC;AAAA,EACnB,UAAU;AAAA,IACR,QAAQ;AAAA,IAER,YAAY,EAAE,OAAO,MAAM,OAAO,cAAc,QAAQ,cAAc;AAAA,EACxE;AAAA,EACA,OAAO;AAAA,IACL,SAAS;AAAA,MACP,SAAS;AAAA,MACT,WAAW;AAAA,IAAA;AAAA,EAEf;AAAA,EACA,cAAc,CAAC;AAAA,EACf,OAAO;AAAA,IACL,eAAe;AAAA,IACf,cAAc,MAAM,MAAM;AAAA,IAC1B,GAAG,MAAM,WAAW;AAAA,IACpB,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AAAA,EACA,cAAc,EAAE,iBAAiB,MAAM,OAAO,OAAO,GAAG,cAAc;AAAA,EACtE,SAAS,CAAC;AAAA,EACV,UAAU,CAAA;AACZ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.styles.js","sources":["../../../src/Select/Select.styles.ts"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvSelect\", {\n root: {\n position: \"relative\",\n \"&$disabled,&$readOnly\": {\n pointerEvents: \"none\",\n },\n },\n disabled: {},\n readOnly: {},\n invalid: {\n
|
|
1
|
+
{"version":3,"file":"Select.styles.js","sources":["../../../src/Select/Select.styles.ts"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvSelect\", {\n root: {\n position: \"relative\",\n \"&$disabled,&$readOnly\": {\n pointerEvents: \"none\",\n },\n },\n disabled: {},\n readOnly: {},\n invalid: {\n borderColor: theme.colors.negative_120,\n },\n labelContainer: {\n display: \"flex\",\n alignItems: \"flex-start\",\n },\n label: {},\n description: {},\n select: {},\n popper: {\n zIndex: theme.zIndices.popover,\n },\n panel: {\n maxHeight: 400,\n border: `1px solid ${theme.colors.secondary}`,\n marginTop: -1,\n marginBottom: -1,\n\n // panel styles\n position: \"relative\",\n padding: theme.space.xs,\n backgroundColor: theme.colors.atmo1,\n overflowY: \"auto\",\n borderRadius: \"inherit\",\n },\n panelOpenedUp: {\n borderRadius: `${theme.radii.base} ${theme.radii.base} 0 0`,\n },\n panelOpenedDown: {\n borderRadius: `0 0 ${theme.radii.base} ${theme.radii.base}`,\n },\n error: {},\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,YAAY;AAAA,EACrE,MAAM;AAAA,IACJ,UAAU;AAAA,IACV,yBAAyB;AAAA,MACvB,eAAe;AAAA,IAAA;AAAA,EAEnB;AAAA,EACA,UAAU,CAAC;AAAA,EACX,UAAU,CAAC;AAAA,EACX,SAAS;AAAA,IACP,aAAa,MAAM,OAAO;AAAA,EAC5B;AAAA,EACA,gBAAgB;AAAA,IACd,SAAS;AAAA,IACT,YAAY;AAAA,EACd;AAAA,EACA,OAAO,CAAC;AAAA,EACR,aAAa,CAAC;AAAA,EACd,QAAQ,CAAC;AAAA,EACT,QAAQ;AAAA,IACN,QAAQ,MAAM,SAAS;AAAA,EACzB;AAAA,EACA,OAAO;AAAA,IACL,WAAW;AAAA,IACX,QAAQ,aAAa,MAAM,OAAO,SAAS;AAAA,IAC3C,WAAW;AAAA,IACX,cAAc;AAAA;AAAA,IAGd,UAAU;AAAA,IACV,SAAS,MAAM,MAAM;AAAA,IACrB,iBAAiB,MAAM,OAAO;AAAA,IAC9B,WAAW;AAAA,IACX,cAAc;AAAA,EAChB;AAAA,EACA,eAAe;AAAA,IACb,cAAc,GAAG,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EACvD;AAAA,EACA,iBAAiB;AAAA,IACf,cAAc,OAAO,MAAM,MAAM,IAAI,IAAI,MAAM,MAAM,IAAI;AAAA,EAC3D;AAAA,EACA,OAAO,CAAA;AACT,CAAC;"}
|
|
@@ -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,EAExE,MAAM;AAAA,IACJ,eAAe;AAAA,IACf,cAAc;AAAA,IACd,WAAW;AAAA,IACX,aAAa,MAAM,OAAO;AAAA,IAC1B,SAAS,QAAQ,MAAM,MAAM,EAAE,YAAY,MAAM,MAAM,EAAE,SACvD,MAAM,MAAM,EACd,YAAY,MAAM,QAAQ,CAAC,CAAC;AAAA,IAC5B,mBAAmB;AAAA,EACrB;AAAA;AAAA,EAEA,MAAM;AAAA,IACJ,QAAQ;AAAA,IACR,eAAe;AAAA,IACf,cAAc;AAAA,IAEd,iBAAiB,MAAM,OAAO;AAAA,IAC9B,WAAW;AAAA,IACX,GAAG,MAAM,WAAW;AAAA,EACt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ACX,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA;AAAA,EAEA,qBAAqB;AAAA,IACnB,aAAa;AAAA,IACb,SAAS;AAAA,IACT,WAAW;AAAA,IACX,OAAO;AAAA,IACP,UAAU;AAAA,EACZ;AAAA;AAAA,EAEA,cAAc;AAAA,IACZ,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,iBAAiB,MAAM,OAAO;AAAA,IAE9B,wCAAwC;AAAA,MACtC,YAAY;AAAA,IAAA;AAAA,EAEhB;AAAA;AAAA,EAEA,sBAAsB;AAAA,IACpB,kBAAkB;AAAA,EACpB;AAAA;AAAA,EAEA,wBAAwB;AAAA,IACtB,iBAAiB;AAAA,EACnB;AAAA;AAAA,EAGA,qBAAqB;AAAA,IACnB,iBAAiB;AAAA,IAEjB,mBAAmB;AAAA,MACjB,iBAAiB;AAAA,IAAA;AAAA,EAErB;AAAA;AAAA,EAEA,sBAAsB;AAAA,IACpB,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,IAMlB,gBAAgB;AAAA,MACd,kBAAkB;AAAA,IACpB;AAAA,IAEA,yBAAyB;AAAA,MACvB,iBAAiB;AAAA,IAAA;AAAA,EAErB;AAAA;AAAA,EAGA,WAAW;AAAA,IACT,kBAAkB;AAAA,EACpB;AAAA;AAAA,EAEA,UAAU;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,i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B,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;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createClasses } from "@hitachivantara/uikit-react-utils";
|
|
2
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
3
|
import { staticClasses as staticClasses$1 } from "../BaseInput/BaseInput.styles.js";
|
|
4
|
+
import "../BaseInput/BaseInput.js";
|
|
4
5
|
import { staticClasses as staticClasses$2 } from "../FormElement/Suggestions/Suggestions.styles.js";
|
|
5
6
|
const { staticClasses, useClasses } = createClasses("HvTagsInput", {
|
|
6
7
|
input: {
|
|
@@ -113,10 +114,7 @@ const { staticClasses, useClasses } = createClasses("HvTagsInput", {
|
|
|
113
114
|
tagInputRoot: {
|
|
114
115
|
[`& .${staticClasses$1.root}`]: {
|
|
115
116
|
width: "100%",
|
|
116
|
-
border: "none"
|
|
117
|
-
"&:hover $tagInputBorderContainer": {
|
|
118
|
-
background: "none"
|
|
119
|
-
}
|
|
117
|
+
border: "none"
|
|
120
118
|
},
|
|
121
119
|
[`&& .${staticClasses$1.inputRoot}`]: {
|
|
122
120
|
marginLeft: 0,
|
|
@@ -127,10 +125,6 @@ const { staticClasses, useClasses } = createClasses("HvTagsInput", {
|
|
|
127
125
|
padding: 0,
|
|
128
126
|
border: "none"
|
|
129
127
|
},
|
|
130
|
-
[`& .${staticClasses$1.inputBorderContainer}`]: {
|
|
131
|
-
border: "none",
|
|
132
|
-
background: "none"
|
|
133
|
-
},
|
|
134
128
|
[`& .${staticClasses$1.inputRootFocused}`]: {
|
|
135
129
|
outline: "none",
|
|
136
130
|
boxShadow: "none"
|
|
@@ -153,6 +147,7 @@ const { staticClasses, useClasses } = createClasses("HvTagsInput", {
|
|
|
153
147
|
outlineOffset: "-1px",
|
|
154
148
|
boxShadow: "0 0 0 1px #52A8EC, 0 0 0 4px rgba(29,155,209,.3)"
|
|
155
149
|
},
|
|
150
|
+
/** @deprecated unused. use `::after` instead */
|
|
156
151
|
tagInputBorderContainer: {},
|
|
157
152
|
tagInputRootFocused: {},
|
|
158
153
|
tagInputRootEmpty: {},
|