@hitachivantara/uikit-react-core 5.91.2 → 5.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Accordion/Accordion.cjs +2 -2
- package/dist/cjs/ActionsGeneric/ActionsGeneric.cjs +2 -2
- package/dist/cjs/AppSwitcher/Action/Action.cjs +10 -2
- package/dist/cjs/Avatar/Avatar.cjs +3 -2
- package/dist/cjs/BaseCheckBox/BaseCheckBox.styles.cjs +4 -8
- package/dist/cjs/BaseCheckBox/CheckBoxIcon.cjs +4 -8
- package/dist/cjs/BaseDropdown/BaseDropdown.cjs +5 -5
- package/dist/cjs/BaseInput/BaseInput.styles.cjs +4 -1
- package/dist/cjs/BaseRadio/RadioIcon.cjs +2 -7
- package/dist/cjs/BreadCrumb/PathElement/PathElement.cjs +4 -2
- package/dist/cjs/BreadCrumb/utils.cjs +2 -2
- package/dist/cjs/ButtonBase/ButtonBase.styles.cjs +1 -4
- package/dist/cjs/Calendar/CalendarNavigation/Navigation/Navigation.cjs +3 -3
- package/dist/cjs/Carousel/Carousel.cjs +4 -4
- package/dist/cjs/Carousel/CarouselControls.cjs +3 -3
- package/dist/cjs/CheckBox/CheckBox.cjs +1 -1
- package/dist/cjs/CheckBox/CheckBox.styles.cjs +13 -39
- package/dist/cjs/ColorPicker/ColorPicker.cjs +2 -2
- package/dist/cjs/ColorPicker/ColorPicker.styles.cjs +4 -2
- package/dist/cjs/ColorPicker/SavedColors/SavedColors.cjs +3 -3
- package/dist/cjs/ColorPicker/SavedColors/SavedColors.styles.cjs +1 -10
- package/dist/cjs/DatePicker/DatePicker.cjs +2 -2
- package/dist/cjs/Dialog/Dialog.cjs +2 -2
- package/dist/cjs/Drawer/Drawer.cjs +2 -2
- package/dist/cjs/DropDownMenu/DropDownMenu.cjs +2 -2
- package/dist/cjs/DropDownMenu/DropDownMenu.styles.cjs +6 -1
- package/dist/cjs/Dropdown/List/List.cjs +12 -18
- package/dist/cjs/Dropdown/List/List.styles.cjs +0 -2
- package/dist/cjs/DropdownButton/DropdownButton.cjs +5 -4
- package/dist/cjs/FileUploader/DropZone/DropZone.cjs +9 -2
- package/dist/cjs/FileUploader/File/File.cjs +4 -4
- package/dist/cjs/FileUploader/Preview/Preview.cjs +2 -2
- package/dist/cjs/FilterGroup/FilterContent/FilterContent.cjs +2 -2
- package/dist/cjs/FormElement/Adornment/Adornment.styles.cjs +5 -1
- package/dist/cjs/FormElement/InfoMessage/InfoMessage.styles.cjs +1 -1
- package/dist/cjs/FormElement/Label/Label.styles.cjs +1 -1
- package/dist/cjs/FormElement/Suggestions/Suggestions.cjs +2 -2
- package/dist/cjs/FormElement/WarningText/WarningText.cjs +2 -2
- package/dist/cjs/FormElement/WarningText/WarningText.styles.cjs +1 -1
- package/dist/cjs/InlineEditor/InlineEditor.cjs +3 -2
- package/dist/cjs/Input/Input.cjs +17 -26
- package/dist/cjs/Input/Input.styles.cjs +10 -6
- package/dist/cjs/Input/icons.cjs +22 -0
- package/dist/cjs/List/List.cjs +2 -2
- package/dist/cjs/Pagination/Pagination.cjs +5 -5
- package/dist/cjs/QueryBuilder/Rule/Rule.cjs +2 -2
- package/dist/cjs/QueryBuilder/RuleGroup/RuleGroup.cjs +6 -5
- package/dist/cjs/Radio/Radio.styles.cjs +8 -5
- package/dist/cjs/Section/Section.cjs +2 -2
- package/dist/cjs/Table/TableHeader/TableHeader.cjs +8 -5
- package/dist/cjs/Table/TableHeader/utils.cjs +5 -6
- package/dist/cjs/Table/hooks/useHvRowExpand.cjs +2 -2
- package/dist/cjs/Table/renderers/renderers.cjs +2 -2
- package/dist/cjs/Tag/Tag.cjs +6 -5
- package/dist/cjs/Tag/Tag.styles.cjs +8 -3
- package/dist/cjs/TimePicker/TimePicker.cjs +2 -8
- package/dist/cjs/TimePicker/Unit/Unit.cjs +4 -5
- package/dist/cjs/TimePicker/Unit/Unit.styles.cjs +0 -6
- package/dist/cjs/TreeView/TreeView.cjs +3 -3
- package/dist/cjs/VerticalNavigation/Header/Header.cjs +4 -4
- package/dist/cjs/VerticalNavigation/NavigationSlider/NavigationSlider.cjs +2 -2
- package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.cjs +3 -3
- package/dist/cjs/VerticalNavigation/TreeView/TreeViewItem.styles.cjs +1 -1
- package/dist/cjs/VerticalNavigation/VerticalNavigation.styles.cjs +1 -4
- package/dist/cjs/icons.cjs +98 -0
- package/dist/cjs/utils/Callout.cjs +5 -3
- package/dist/cjs/utils/iconVariant.cjs +9 -13
- package/dist/esm/Accordion/Accordion.js +2 -2
- package/dist/esm/Accordion/Accordion.js.map +1 -1
- package/dist/esm/ActionsGeneric/ActionsGeneric.js +2 -2
- package/dist/esm/ActionsGeneric/ActionsGeneric.js.map +1 -1
- package/dist/esm/AppSwitcher/Action/Action.js +10 -2
- package/dist/esm/AppSwitcher/Action/Action.js.map +1 -1
- package/dist/esm/Avatar/Avatar.js +3 -2
- package/dist/esm/Avatar/Avatar.js.map +1 -1
- package/dist/esm/BaseCheckBox/BaseCheckBox.styles.js +4 -8
- package/dist/esm/BaseCheckBox/BaseCheckBox.styles.js.map +1 -1
- package/dist/esm/BaseCheckBox/CheckBoxIcon.js +4 -8
- package/dist/esm/BaseCheckBox/CheckBoxIcon.js.map +1 -1
- package/dist/esm/BaseDropdown/BaseDropdown.js +5 -5
- package/dist/esm/BaseDropdown/BaseDropdown.js.map +1 -1
- package/dist/esm/BaseInput/BaseInput.styles.js +4 -1
- package/dist/esm/BaseInput/BaseInput.styles.js.map +1 -1
- package/dist/esm/BaseRadio/RadioIcon.js +2 -7
- package/dist/esm/BaseRadio/RadioIcon.js.map +1 -1
- package/dist/esm/BreadCrumb/PathElement/PathElement.js +4 -2
- package/dist/esm/BreadCrumb/PathElement/PathElement.js.map +1 -1
- package/dist/esm/BreadCrumb/utils.js +2 -2
- package/dist/esm/BreadCrumb/utils.js.map +1 -1
- package/dist/esm/ButtonBase/ButtonBase.styles.js +1 -4
- package/dist/esm/ButtonBase/ButtonBase.styles.js.map +1 -1
- package/dist/esm/Calendar/CalendarNavigation/Navigation/Navigation.js +3 -3
- package/dist/esm/Calendar/CalendarNavigation/Navigation/Navigation.js.map +1 -1
- package/dist/esm/Carousel/Carousel.js +4 -4
- package/dist/esm/Carousel/Carousel.js.map +1 -1
- package/dist/esm/Carousel/CarouselControls.js +3 -3
- package/dist/esm/Carousel/CarouselControls.js.map +1 -1
- package/dist/esm/CheckBox/CheckBox.js +1 -1
- package/dist/esm/CheckBox/CheckBox.js.map +1 -1
- package/dist/esm/CheckBox/CheckBox.styles.js +13 -39
- package/dist/esm/CheckBox/CheckBox.styles.js.map +1 -1
- package/dist/esm/ColorPicker/ColorPicker.js +2 -2
- package/dist/esm/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/esm/ColorPicker/ColorPicker.styles.js +4 -2
- package/dist/esm/ColorPicker/ColorPicker.styles.js.map +1 -1
- package/dist/esm/ColorPicker/SavedColors/SavedColors.js +3 -3
- package/dist/esm/ColorPicker/SavedColors/SavedColors.js.map +1 -1
- package/dist/esm/ColorPicker/SavedColors/SavedColors.styles.js +1 -10
- package/dist/esm/ColorPicker/SavedColors/SavedColors.styles.js.map +1 -1
- package/dist/esm/DatePicker/DatePicker.js +2 -2
- package/dist/esm/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/Dialog/Dialog.js +2 -2
- package/dist/esm/Dialog/Dialog.js.map +1 -1
- package/dist/esm/Drawer/Drawer.js +2 -2
- package/dist/esm/Drawer/Drawer.js.map +1 -1
- package/dist/esm/DropDownMenu/DropDownMenu.js +2 -2
- package/dist/esm/DropDownMenu/DropDownMenu.js.map +1 -1
- package/dist/esm/DropDownMenu/DropDownMenu.styles.js +6 -1
- package/dist/esm/DropDownMenu/DropDownMenu.styles.js.map +1 -1
- package/dist/esm/Dropdown/List/List.js +13 -19
- package/dist/esm/Dropdown/List/List.js.map +1 -1
- package/dist/esm/Dropdown/List/List.styles.js +0 -2
- package/dist/esm/Dropdown/List/List.styles.js.map +1 -1
- package/dist/esm/Dropdown/utils.js.map +1 -1
- package/dist/esm/DropdownButton/DropdownButton.js +5 -4
- package/dist/esm/DropdownButton/DropdownButton.js.map +1 -1
- package/dist/esm/FileUploader/DropZone/DropZone.js +9 -2
- package/dist/esm/FileUploader/DropZone/DropZone.js.map +1 -1
- package/dist/esm/FileUploader/File/File.js +4 -4
- package/dist/esm/FileUploader/File/File.js.map +1 -1
- package/dist/esm/FileUploader/Preview/Preview.js +2 -2
- package/dist/esm/FileUploader/Preview/Preview.js.map +1 -1
- package/dist/esm/FilterGroup/FilterContent/FilterContent.js +2 -2
- package/dist/esm/FilterGroup/FilterContent/FilterContent.js.map +1 -1
- package/dist/esm/FormElement/Adornment/Adornment.styles.js +5 -1
- package/dist/esm/FormElement/Adornment/Adornment.styles.js.map +1 -1
- package/dist/esm/FormElement/InfoMessage/InfoMessage.styles.js +1 -1
- package/dist/esm/FormElement/InfoMessage/InfoMessage.styles.js.map +1 -1
- package/dist/esm/FormElement/Label/Label.styles.js +1 -1
- package/dist/esm/FormElement/Label/Label.styles.js.map +1 -1
- package/dist/esm/FormElement/Suggestions/Suggestions.js +2 -2
- package/dist/esm/FormElement/Suggestions/Suggestions.js.map +1 -1
- package/dist/esm/FormElement/WarningText/WarningText.js +2 -2
- package/dist/esm/FormElement/WarningText/WarningText.js.map +1 -1
- package/dist/esm/FormElement/WarningText/WarningText.styles.js +1 -1
- package/dist/esm/FormElement/WarningText/WarningText.styles.js.map +1 -1
- package/dist/esm/InlineEditor/InlineEditor.js +3 -2
- package/dist/esm/InlineEditor/InlineEditor.js.map +1 -1
- package/dist/esm/Input/Input.js +18 -27
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/Input/Input.styles.js +10 -6
- package/dist/esm/Input/Input.styles.js.map +1 -1
- package/dist/esm/Input/icons.js +22 -0
- package/dist/esm/Input/icons.js.map +1 -0
- package/dist/esm/List/List.js +2 -2
- package/dist/esm/List/List.js.map +1 -1
- package/dist/esm/Pagination/Pagination.js +5 -5
- package/dist/esm/Pagination/Pagination.js.map +1 -1
- package/dist/esm/QueryBuilder/Rule/Rule.js +2 -2
- package/dist/esm/QueryBuilder/Rule/Rule.js.map +1 -1
- package/dist/esm/QueryBuilder/RuleGroup/RuleGroup.js +6 -5
- package/dist/esm/QueryBuilder/RuleGroup/RuleGroup.js.map +1 -1
- package/dist/esm/Radio/Radio.styles.js +8 -5
- package/dist/esm/Radio/Radio.styles.js.map +1 -1
- package/dist/esm/Section/Section.js +2 -2
- package/dist/esm/Section/Section.js.map +1 -1
- package/dist/esm/Table/TableHeader/TableHeader.js +10 -7
- package/dist/esm/Table/TableHeader/TableHeader.js.map +1 -1
- package/dist/esm/Table/TableHeader/utils.js +5 -6
- package/dist/esm/Table/TableHeader/utils.js.map +1 -1
- package/dist/esm/Table/hooks/useHvRowExpand.js +2 -2
- package/dist/esm/Table/hooks/useHvRowExpand.js.map +1 -1
- package/dist/esm/Table/renderers/renderers.js +2 -2
- package/dist/esm/Table/renderers/renderers.js.map +1 -1
- package/dist/esm/Tag/Tag.js +6 -5
- package/dist/esm/Tag/Tag.js.map +1 -1
- package/dist/esm/Tag/Tag.styles.js +8 -3
- package/dist/esm/Tag/Tag.styles.js.map +1 -1
- package/dist/esm/TimePicker/TimePicker.js +4 -10
- package/dist/esm/TimePicker/TimePicker.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.js +4 -5
- package/dist/esm/TimePicker/Unit/Unit.js.map +1 -1
- package/dist/esm/TimePicker/Unit/Unit.styles.js +0 -6
- package/dist/esm/TimePicker/Unit/Unit.styles.js.map +1 -1
- package/dist/esm/TreeView/TreeView.js +3 -3
- package/dist/esm/TreeView/TreeView.js.map +1 -1
- package/dist/esm/VerticalNavigation/Header/Header.js +4 -4
- package/dist/esm/VerticalNavigation/Header/Header.js.map +1 -1
- package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.js +2 -2
- package/dist/esm/VerticalNavigation/NavigationSlider/NavigationSlider.js.map +1 -1
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js +3 -3
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.js.map +1 -1
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.styles.js +1 -1
- package/dist/esm/VerticalNavigation/TreeView/TreeViewItem.styles.js.map +1 -1
- package/dist/esm/VerticalNavigation/VerticalNavigation.styles.js +1 -4
- package/dist/esm/VerticalNavigation/VerticalNavigation.styles.js.map +1 -1
- package/dist/esm/icons.js +96 -0
- package/dist/esm/icons.js.map +1 -0
- package/dist/esm/utils/Callout.js +5 -3
- package/dist/esm/utils/Callout.js.map +1 -1
- package/dist/esm/utils/iconVariant.js +9 -13
- package/dist/esm/utils/iconVariant.js.map +1 -1
- package/dist/types/index.d.ts +7 -10
- package/package.json +5 -6
package/dist/esm/Tag/Tag.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, isValidElement, cloneElement } from "react";
|
|
3
|
-
import { CloseXS } from "@hitachivantara/uikit-react-icons";
|
|
4
3
|
import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
|
|
5
4
|
import { theme, getColor } from "@hitachivantara/uikit-styles";
|
|
6
5
|
import { HvCheckBoxIcon } from "../BaseCheckBox/CheckBoxIcon.js";
|
|
7
6
|
import { useControlled } from "../hooks/useControlled.js";
|
|
7
|
+
import { HvIcon } from "../icons.js";
|
|
8
8
|
import { isDeleteKey } from "../utils/keyboardUtils.js";
|
|
9
9
|
import { useClasses } from "./Tag.styles.js";
|
|
10
10
|
import { staticClasses } from "./Tag.styles.js";
|
|
@@ -56,15 +56,16 @@ const HvTag = forwardRef(function HvTag2(props, ref) {
|
|
|
56
56
|
[classes.disabledDeleteIcon]: disabled
|
|
57
57
|
}),
|
|
58
58
|
onClick: handleDeleteClick
|
|
59
|
-
}) : /* @__PURE__ */ jsx(
|
|
60
|
-
|
|
59
|
+
}) : /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
60
|
+
HvIcon,
|
|
61
61
|
{
|
|
62
|
-
|
|
62
|
+
compact: true,
|
|
63
|
+
name: "Close",
|
|
63
64
|
onClick: handleDeleteClick,
|
|
64
65
|
className: cx(classes.deleteIcon, classes.button, classes.tagButton),
|
|
65
66
|
...deleteButtonProps
|
|
66
67
|
}
|
|
67
|
-
);
|
|
68
|
+
) });
|
|
68
69
|
return /* @__PURE__ */ jsxs(
|
|
69
70
|
HvButtonBase,
|
|
70
71
|
{
|
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 {
|
|
1
|
+
{"version":3,"file":"Tag.js","sources":["../../../src/Tag/Tag.tsx"],"sourcesContent":["import { cloneElement, forwardRef, isValidElement } from \"react\";\nimport {\n mergeStyles,\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\nimport {\n getColor,\n theme,\n type HvColorAny,\n type HvSize,\n} from \"@hitachivantara/uikit-styles\";\n\nimport { HvCheckBoxIcon } from \"../BaseCheckBox/CheckBoxIcon\";\nimport { HvButtonBase, HvButtonBaseProps } from \"../ButtonBase\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { HvIcon } from \"../icons\";\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 /** @deprecated */\n variant?: \"filled\" | \"outlined\";\n size?: Extract<HvSize, \"xs\" | \"sm\" | \"md\">;\n icon?: React.ReactNode;\n /** Whether to show the select icon checkbox. */\n showSelectIcon?: boolean;\n /** The color variant of the tag */\n color?: HvColorAny;\n /** Icon used to customize the delete icon */\n deleteIcon?: React.ReactElement<any>;\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. @deprecated no longer used */\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 */\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 size = \"xs\",\n variant,\n type = \"semantic\",\n selectable,\n selected,\n defaultSelected = false,\n showSelectIcon = selectable,\n color,\n icon: iconProp,\n deleteIcon: deleteIconProp,\n onDelete,\n onClick,\n onKeyDown,\n onKeyUp,\n deleteButtonArialLabel,\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 tagColor =\n // backwards-compatibility for `type` prop\n (type === \"categorical\" && theme.alpha(color || \"cat1\", 0.2)) ||\n // use the palette color if it matches\n theme.palette[color as keyof typeof theme.palette]?.[600] ||\n getColor(color);\n\n const isClickable = !!(onClick || onDelete || selectable);\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 <div>\n <HvIcon\n compact\n name=\"Close\"\n onClick={handleDeleteClick as any}\n className={cx(classes.deleteIcon, classes.button, classes.tagButton)}\n {...(deleteButtonProps as any)}\n />\n </div>\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 \"--tagColor\": tagColor,\n })}\n className={cx(classes.root, classes.chipRoot, classes[size], className, {\n [classes.hasIcon]: iconProp || (selectable && showSelectIcon),\n [classes.clickable]: isClickable && !disabled,\n [classes.selected]: isSelected,\n [classes.disabled]: disabled,\n [classes.outlined]: variant === \"outlined\",\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 {iconProp}\n {selectable && showSelectIcon && (\n <HvCheckBoxIcon\n className={classes.icon}\n variant={isSelected ? \"checked\" : \"default\"}\n disabled={disabled}\n />\n )}\n <HvTypography\n noWrap\n variant=\"caption2\"\n component=\"span\"\n className={classes.label}\n >\n {label}\n </HvTypography>\n {onDelete && !disabled && deleteIcon}\n </HvButtonBase>\n );\n});\n"],"names":["HvTag"],"mappings":";;;;;;;;;;;;AAyEO,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,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,IACjB;AAAA,IACA,MAAM;AAAA,IACN,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,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;AAEM,QAAA;AAAA;AAAA,IAEH,SAAS,iBAAiB,MAAM,MAAM,SAAS,QAAQ,GAAG;AAAA,IAE3D,MAAM,QAAQ,KAAmC,IAAI,GAAG,KACxD,SAAS,KAAK;AAAA;AAEhB,QAAM,cAAc,CAAC,EAAE,WAAW,YAAY;AAE9C,QAAM,aACJ,kBAAkB,eAAe,cAAc,IAC7C,aAAkB,gBAAgB;AAAA,IAChC,WAAW,GAAG,QAAQ,YAAY;AAAA,MAChC,CAAC,QAAQ,kBAAkB,GAAG;AAAA,IAAA,CAC/B;AAAA,IACD,SAAS;AAAA,EACV,CAAA,IAED,oBAAC,OACC,EAAA,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA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nB,SAAS,aAAa,YAAY;AAAA,YAClC;AAAA,UAAA;AAAA,QACF;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,CAAC,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EAC5B;AAEJ,CAAC;"}
|
|
@@ -14,6 +14,11 @@ const { staticClasses, useClasses } = createClasses("HvTag", {
|
|
|
14
14
|
transition: "background-color 0.3s ease",
|
|
15
15
|
"&,:hover,:focus-visible": {
|
|
16
16
|
backgroundColor: "var(--tagColor)"
|
|
17
|
+
},
|
|
18
|
+
"& div:has($deleteIcon)": {
|
|
19
|
+
// ensure icon container doesn't grow into $label
|
|
20
|
+
width: "max-content",
|
|
21
|
+
lineHeight: 0
|
|
17
22
|
}
|
|
18
23
|
},
|
|
19
24
|
hasIcon: {
|
|
@@ -63,9 +68,9 @@ const { staticClasses, useClasses } = createClasses("HvTag", {
|
|
|
63
68
|
color: "inherit"
|
|
64
69
|
},
|
|
65
70
|
deleteIcon: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"
|
|
71
|
+
margin: 0,
|
|
72
|
+
padding: 2,
|
|
73
|
+
":hover": {
|
|
69
74
|
backgroundColor: theme.colors.bgHover
|
|
70
75
|
}
|
|
71
76
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.styles.js","sources":["../../../src/Tag/Tag.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTag\", {\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"default\",\n color: theme.colors.textDark,\n borderColor: theme.colors.border,\n borderRadius: 0,\n maxWidth: 180,\n whiteSpace: \"nowrap\",\n transition: \"background-color 0.3s ease\",\n\n \"&,:hover,:focus-visible\": {\n backgroundColor: \"var(--tagColor)\",\n },\n },\n hasIcon: {\n paddingLeft: 2,\n },\n /** @deprecated */\n outlined: {\n outlineStyle: \"solid\",\n },\n /** @deprecated */\n categorical: {\n borderRadius: 8,\n \"& $label\": {\n color: theme.colors.text,\n },\n \"& $icon\": {\n display: \"none\",\n },\n },\n xs: {\n height: 16,\n },\n sm: {\n height: 24,\n \"& $label\": {\n ...theme.typography.caption1,\n color: \"inherit\",\n },\n },\n md: {\n height: 32,\n \"& $label\": {\n ...theme.typography.body,\n color: \"inherit\",\n },\n },\n\n disabled: {\n \"&,:hover,:focus-visible\": {\n backgroundColor: theme.colors.bgDisabled,\n },\n \"& $label\": {\n color: theme.colors.textDisabled,\n },\n },\n label: {\n padding: theme.spacing(0, \"xxs\"),\n color: \"inherit\",\n },\n deleteIcon: {\n
|
|
1
|
+
{"version":3,"file":"Tag.styles.js","sources":["../../../src/Tag/Tag.styles.tsx"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTag\", {\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n cursor: \"default\",\n color: theme.colors.textDark,\n borderColor: theme.colors.border,\n borderRadius: 0,\n maxWidth: 180,\n whiteSpace: \"nowrap\",\n transition: \"background-color 0.3s ease\",\n\n \"&,:hover,:focus-visible\": {\n backgroundColor: \"var(--tagColor)\",\n },\n \"& div:has($deleteIcon)\": {\n // ensure icon container doesn't grow into $label\n width: \"max-content\",\n lineHeight: 0,\n },\n },\n hasIcon: {\n paddingLeft: 2,\n },\n /** @deprecated */\n outlined: {\n outlineStyle: \"solid\",\n },\n /** @deprecated */\n categorical: {\n borderRadius: 8,\n \"& $label\": {\n color: theme.colors.text,\n },\n \"& $icon\": {\n display: \"none\",\n },\n },\n xs: {\n height: 16,\n },\n sm: {\n height: 24,\n \"& $label\": {\n ...theme.typography.caption1,\n color: \"inherit\",\n },\n },\n md: {\n height: 32,\n \"& $label\": {\n ...theme.typography.body,\n color: \"inherit\",\n },\n },\n\n disabled: {\n \"&,:hover,:focus-visible\": {\n backgroundColor: theme.colors.bgDisabled,\n },\n \"& $label\": {\n color: theme.colors.textDisabled,\n },\n },\n label: {\n padding: theme.spacing(0, \"xxs\"),\n color: \"inherit\",\n },\n deleteIcon: {\n margin: 0,\n padding: 2,\n \":hover\": {\n backgroundColor: theme.colors.bgHover,\n },\n },\n selected: {},\n clickable: {\n cursor: \"pointer\",\n },\n // TODO: remove in favour of `hasIcon` once it's no longer needed\n icon: {\n fontSize: 12,\n },\n\n /** @deprecated use `root` instead */\n chipRoot: {},\n /** @deprecated unused */\n // TODO: redundant - use deleteIcon. remove in v6\n /** @deprecated */\n button: {},\n /** @deprecated */\n tagButton: {},\n // TODO: redundant - use $clickable or :not($disabled). remove in v6\n /** @deprecated */\n focusVisible: {},\n /** @deprecated */\n disabledDeleteIcon: {},\n /** @deprecated */\n categoricalFocus: {},\n /** @deprecated */\n categoricalDisabled: {},\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,SAAS;AAAA,EAClE,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,QAAQ;AAAA,IACR,OAAO,MAAM,OAAO;AAAA,IACpB,aAAa,MAAM,OAAO;AAAA,IAC1B,cAAc;AAAA,IACd,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,YAAY;AAAA,IAEZ,2BAA2B;AAAA,MACzB,iBAAiB;AAAA,IACnB;AAAA,IACA,0BAA0B;AAAA;AAAA,MAExB,OAAO;AAAA,MACP,YAAY;AAAA,IAAA;AAAA,EAEhB;AAAA,EACA,SAAS;AAAA,IACP,aAAa;AAAA,EACf;AAAA;AAAA,EAEA,UAAU;AAAA,IACR,cAAc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
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useRef, useState, useMemo } from "react";
|
|
3
|
-
import { Time
|
|
3
|
+
import { Time } from "@internationalized/date";
|
|
4
4
|
import { useForkRef } from "@mui/material/utils";
|
|
5
5
|
import { useTimeField } from "@react-aria/datepicker";
|
|
6
6
|
import { useTimeFieldState } from "@react-stately/datepicker";
|
|
7
|
-
import { Time } from "@hitachivantara/uikit-react-icons";
|
|
8
7
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
9
8
|
import { DEFAULT_LOCALE } from "../Calendar/utils.js";
|
|
10
9
|
import { useControlled } from "../hooks/useControlled.js";
|
|
11
10
|
import { useUniqueId } from "../hooks/useUniqueId.js";
|
|
11
|
+
import { HvIcon } from "../icons.js";
|
|
12
12
|
import { setId } from "../utils/setId.js";
|
|
13
13
|
import { Placeholder } from "./Placeholder.js";
|
|
14
14
|
import { useClasses } from "./TimePicker.styles.js";
|
|
@@ -22,7 +22,7 @@ import { HvWarningText } from "../FormElement/WarningText/WarningText.js";
|
|
|
22
22
|
const toTime = (value) => {
|
|
23
23
|
if (!value) return value;
|
|
24
24
|
const { hours, minutes, seconds } = value;
|
|
25
|
-
return new Time
|
|
25
|
+
return new Time(hours, minutes, seconds);
|
|
26
26
|
};
|
|
27
27
|
const HvTimePicker = forwardRef(
|
|
28
28
|
function HvTimePicker2(props, ref) {
|
|
@@ -165,13 +165,7 @@ const HvTimePicker = forwardRef(
|
|
|
165
165
|
headerOpen: classes.dropdownHeaderOpen
|
|
166
166
|
},
|
|
167
167
|
placement: "right",
|
|
168
|
-
adornment: /* @__PURE__ */ jsx(
|
|
169
|
-
Time,
|
|
170
|
-
{
|
|
171
|
-
color: disabled ? "textDisabled" : void 0,
|
|
172
|
-
className: classes.icon
|
|
173
|
-
}
|
|
174
|
-
),
|
|
168
|
+
adornment: /* @__PURE__ */ jsx(HvIcon, { name: "Time", className: classes.icon }),
|
|
175
169
|
expanded: open,
|
|
176
170
|
onToggle: (evt, newOpen) => {
|
|
177
171
|
if (disableExpand) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker.js","sources":["../../../src/TimePicker/TimePicker.tsx"],"sourcesContent":["import { forwardRef, useMemo, useRef, useState } from \"react\";\nimport { Time } from \"@internationalized/date\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport { useTimeField } from \"@react-aria/datepicker\";\nimport {\n useTimeFieldState,\n type TimeFieldStateOptions,\n} from \"@react-stately/datepicker\";\nimport { Time as TimeIcon } from \"@hitachivantara/uikit-react-icons\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseDropdown, HvBaseDropdownProps } from \"../BaseDropdown\";\nimport { DEFAULT_LOCALE } from \"../Calendar/utils\";\nimport {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { setId } from \"../utils/setId\";\nimport { Placeholder, PlaceholderProps } from \"./Placeholder\";\nimport { staticClasses, useClasses } from \"./TimePicker.styles\";\nimport { Unit } from \"./Unit\";\n\nconst toTime = (value?: HvTimePickerValue | null) => {\n if (!value) return value;\n const { hours, minutes, seconds } = value;\n return new Time(hours, minutes, seconds);\n};\n\nexport { staticClasses as timePickerClasses };\n\nexport type TimeFormat = \"12\" | \"24\";\n\nexport type HvTimePickerClasses = ExtractNames<typeof useClasses>;\n\nexport type HvTimePickerClassKey =\n | \"root\"\n | \"input\"\n | \"label\"\n | \"placeholder\"\n | \"timePopperContainer\"\n | \"separator\"\n | \"periodContainer\"\n | \"formElementRoot\"\n | \"dropdownPlaceholder\"\n | \"iconBaseRoot\"\n | \"error\"\n | \"labelContainer\"\n | \"description\"\n | \"dropdownHeaderInvalid\"\n | \"dropdownPlaceholderDisabled\"\n | \"dropdownHeaderOpen\";\n\nexport type HvTimePickerValue = {\n hours: number;\n minutes: number;\n seconds: number;\n};\n\nexport interface HvTimePickerProps\n extends Omit<\n HvFormElementProps,\n \"classes\" | \"value\" | \"defaultValue\" | \"onChange\"\n > {\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTimePickerClasses;\n /** Current value of the element when _controlled_. Follows the 24-hour format. */\n value?: HvTimePickerValue | null;\n /** Initial value of the element when _uncontrolled_. Follows the 24-hour format. */\n defaultValue?: HvTimePickerValue | null;\n /** The placeholder value when no time is selected. */\n placeholder?: string;\n /** The placeholder of the hours input. */\n hoursPlaceholder?: string;\n /** The placeholder of the minutes input. */\n minutesPlaceholder?: string;\n /** The placeholder of the seconds input. */\n secondsPlaceholder?: string;\n /**\n * Whether the time picker should show the AM/PM 12-hour clock or the 24-hour one.\n * If undefined, the component will use a format according to the passed locale.\n */\n timeFormat?: TimeFormat;\n /** Whether to visually show the seconds control */\n showSeconds?: boolean;\n /** Locale that will provide the time format(12 or 24 hour format). It is \"overwritten\" by `showAmPm` */\n locale?: string;\n /** Whether the dropdown is expandable. */\n disableExpand?: boolean;\n /**\n * Callback function to be triggered when the input value is changed.\n * It is invoked with a `{hours, minutes, seconds}` object, always in the 24h format\n */\n onChange?: (value: HvTimePickerValue) => void;\n /** Callback called when dropdown changes the expanded state. */\n onToggle?: (event: Event, isOpen: boolean) => void;\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Sets if the calendar container should follow the date picker input out of the screen or stay visible. */\n escapeWithReference?: boolean;\n /** Extra properties to be passed to the TimePicker's dropdown. */\n dropdownProps?: Partial<HvBaseDropdownProps>;\n}\n\n/**\n * A Time Picker allows the user to choose a specific time or a time range.\n */\nexport const HvTimePicker = forwardRef<HTMLDivElement, HvTimePickerProps>(\n function HvTimePicker(props, ref) {\n const {\n classes: classesProp,\n className,\n\n id: idProp,\n name,\n required,\n disabled,\n readOnly,\n label,\n\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n placeholder,\n hoursPlaceholder = \"hh\",\n minutesPlaceholder = \"mm\",\n secondsPlaceholder = \"ss\",\n\n value: valueProp,\n defaultValue: defaultValueProp,\n\n timeFormat,\n showSeconds,\n disableExpand,\n locale = DEFAULT_LOCALE,\n\n onToggle,\n onChange,\n\n // misc properties:\n disablePortal = true,\n escapeWithReference = true,\n dropdownProps = {},\n ...others\n } = useDefaultProps(\"HvTimePicker\", props);\n\n const id = useUniqueId(idProp);\n\n const { classes, cx } = useClasses(classesProp);\n\n const timeFieldRef = useRef<HTMLDivElement>(null);\n\n const { ref: refProp, ...otherDropdownProps } = dropdownProps;\n const dropdownForkedRef = useForkRef(ref, refProp);\n\n const stateProps: TimeFieldStateOptions = {\n value: toTime(valueProp),\n defaultValue: toTime(defaultValueProp),\n label,\n locale,\n isRequired: required,\n isReadOnly: readOnly,\n isDisabled: disabled,\n granularity: showSeconds === false ? \"minute\" : \"second\",\n hourCycle: timeFormat === \"12\" ? 12 : 24,\n onChange: (value) => {\n if (!value) return;\n const { hour: hours, minute: minutes, second: seconds } = value;\n onChange?.({ hours, minutes, seconds });\n },\n };\n const state = useTimeFieldState(stateProps);\n const { labelProps, fieldProps, descriptionProps } = useTimeField(\n {\n ...stateProps,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n },\n state,\n timeFieldRef,\n );\n\n const [open, setOpen] = useState(false);\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n const [validationState] = useControlled<HvFormStatus>(status, \"standBy\");\n\n const placeholders: PlaceholderProps[\"placeholders\"] = useMemo(\n () => ({\n hour: hoursPlaceholder,\n minute: minutesPlaceholder,\n second: secondsPlaceholder,\n }),\n [hoursPlaceholder, minutesPlaceholder, secondsPlaceholder],\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 = validationState === \"invalid\";\n const errorMessageId = isStateInvalid\n ? canShowError\n ? setId(id, \"error\")\n : ariaErrorMessage\n : undefined;\n\n return (\n <HvFormElement\n name={name}\n required={required}\n disabled={disabled}\n status={validationState}\n className={cx(classes.root, className)}\n {...others}\n >\n {(label || description) && (\n <div className={classes.labelContainer}>\n {label && (\n <HvLabel\n showGutter\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n {description && (\n <HvInfoMessage\n className={classes.description}\n {...descriptionProps}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n <HvBaseDropdown\n ref={dropdownForkedRef}\n role=\"combobox\"\n variableWidth\n disabled={disabled}\n readOnly={readOnly}\n placeholder={\n placeholder && !state.value ? (\n placeholder\n ) : (\n <Placeholder\n ref={timeFieldRef}\n name={name}\n state={state}\n placeholders={placeholders}\n className={cx(classes.placeholder, {\n [classes.placeholderDisabled]: disabled,\n })}\n {...fieldProps}\n />\n )\n }\n classes={{\n header: cx(classes.dropdownHeader, {\n [classes.dropdownHeaderInvalid]: isStateInvalid,\n }),\n panel: classes.dropdownPanel,\n headerOpen: classes.dropdownHeaderOpen,\n }}\n placement=\"right\"\n adornment={\n <TimeIcon\n color={disabled ? \"textDisabled\" : undefined}\n className={classes.icon}\n />\n }\n expanded={open}\n onToggle={(evt, newOpen) => {\n if (disableExpand) return;\n setOpen(newOpen);\n onToggle?.(evt, newOpen);\n }}\n onContainerCreation={(containerRef) => {\n containerRef?.getElementsByTagName(\"input\")[0]?.focus();\n }}\n aria-haspopup=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={fieldProps[\"aria-labelledby\"]}\n aria-describedby={fieldProps[\"aria-describedby\"]}\n aria-invalid={isStateInvalid ? true : undefined}\n aria-errormessage={errorMessageId}\n disablePortal={disablePortal}\n popperProps={{\n modifiers: [\n { name: \"preventOverflow\", enabled: escapeWithReference },\n ],\n }}\n {...otherDropdownProps}\n >\n <div ref={timeFieldRef} className={classes.timePopperContainer}>\n {state.segments.map((segment, i) => (\n <Unit\n key={i}\n state={state}\n segment={segment}\n placeholder={placeholders[segment.type]}\n onAdd={() => state.increment(segment.type)}\n onSub={() => state.decrement(segment.type)}\n onChange={(evt, val) => {\n state.setSegment(segment.type, Number(val));\n }}\n />\n ))}\n </div>\n </HvBaseDropdown>\n\n {canShowError && (\n <HvWarningText\n id={setId(id, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["Time","HvTimePicker","TimeIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS,CAAC,UAAqC;AAC/C,MAAA,CAAC,MAAc,QAAA;AACnB,QAAM,EAAE,OAAO,SAAS,QAAY,IAAA;AACpC,SAAO,IAAIA,OAAK,OAAO,SAAS,OAAO;AACzC;AAgFO,MAAM,eAAe;AAAA,EAC1B,SAASC,cAAa,OAAO,KAAK;AAC1B,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MAEA,IAAI;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MAErB;AAAA,MACA,mBAAmB;AAAA,MACnB,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,MAErB,OAAO;AAAA,MACP,cAAc;AAAA,MAEd;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MAET;AAAA,MACA;AAAA;AAAA,MAGA,gBAAgB;AAAA,MAChB,sBAAsB;AAAA,MACtB,gBAAgB,CAAC;AA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b,WAAW,QAAQ;AAAA,cAElB,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"TimePicker.js","sources":["../../../src/TimePicker/TimePicker.tsx"],"sourcesContent":["import { forwardRef, useMemo, useRef, useState } from \"react\";\nimport { Time } from \"@internationalized/date\";\nimport { useForkRef } from \"@mui/material/utils\";\nimport { useTimeField } from \"@react-aria/datepicker\";\nimport {\n useTimeFieldState,\n type TimeFieldStateOptions,\n} from \"@react-stately/datepicker\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvBaseDropdown, HvBaseDropdownProps } from \"../BaseDropdown\";\nimport { DEFAULT_LOCALE } from \"../Calendar/utils\";\nimport {\n HvFormElement,\n HvFormElementProps,\n HvFormStatus,\n HvInfoMessage,\n HvLabel,\n HvWarningText,\n} from \"../FormElement\";\nimport { useControlled } from \"../hooks/useControlled\";\nimport { useUniqueId } from \"../hooks/useUniqueId\";\nimport { HvIcon } from \"../icons\";\nimport { setId } from \"../utils/setId\";\nimport { Placeholder, PlaceholderProps } from \"./Placeholder\";\nimport { staticClasses, useClasses } from \"./TimePicker.styles\";\nimport { Unit } from \"./Unit\";\n\nconst toTime = (value?: HvTimePickerValue | null) => {\n if (!value) return value;\n const { hours, minutes, seconds } = value;\n return new Time(hours, minutes, seconds);\n};\n\nexport { staticClasses as timePickerClasses };\n\nexport type TimeFormat = \"12\" | \"24\";\n\nexport type HvTimePickerClasses = ExtractNames<typeof useClasses>;\n\nexport type HvTimePickerClassKey =\n | \"root\"\n | \"input\"\n | \"label\"\n | \"placeholder\"\n | \"timePopperContainer\"\n | \"separator\"\n | \"periodContainer\"\n | \"formElementRoot\"\n | \"dropdownPlaceholder\"\n | \"iconBaseRoot\"\n | \"error\"\n | \"labelContainer\"\n | \"description\"\n | \"dropdownHeaderInvalid\"\n | \"dropdownPlaceholderDisabled\"\n | \"dropdownHeaderOpen\";\n\nexport type HvTimePickerValue = {\n hours: number;\n minutes: number;\n seconds: number;\n};\n\nexport interface HvTimePickerProps\n extends Omit<\n HvFormElementProps,\n \"classes\" | \"value\" | \"defaultValue\" | \"onChange\"\n > {\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTimePickerClasses;\n /** Current value of the element when _controlled_. Follows the 24-hour format. */\n value?: HvTimePickerValue | null;\n /** Initial value of the element when _uncontrolled_. Follows the 24-hour format. */\n defaultValue?: HvTimePickerValue | null;\n /** The placeholder value when no time is selected. */\n placeholder?: string;\n /** The placeholder of the hours input. */\n hoursPlaceholder?: string;\n /** The placeholder of the minutes input. */\n minutesPlaceholder?: string;\n /** The placeholder of the seconds input. */\n secondsPlaceholder?: string;\n /**\n * Whether the time picker should show the AM/PM 12-hour clock or the 24-hour one.\n * If undefined, the component will use a format according to the passed locale.\n */\n timeFormat?: TimeFormat;\n /** Whether to visually show the seconds control */\n showSeconds?: boolean;\n /** Locale that will provide the time format(12 or 24 hour format). It is \"overwritten\" by `showAmPm` */\n locale?: string;\n /** Whether the dropdown is expandable. */\n disableExpand?: boolean;\n /**\n * Callback function to be triggered when the input value is changed.\n * It is invoked with a `{hours, minutes, seconds}` object, always in the 24h format\n */\n onChange?: (value: HvTimePickerValue) => void;\n /** Callback called when dropdown changes the expanded state. */\n onToggle?: (event: Event, isOpen: boolean) => void;\n /** Disable the portal behavior. The children stay within it's parent DOM hierarchy. */\n disablePortal?: boolean;\n /** Sets if the calendar container should follow the date picker input out of the screen or stay visible. */\n escapeWithReference?: boolean;\n /** Extra properties to be passed to the TimePicker's dropdown. */\n dropdownProps?: Partial<HvBaseDropdownProps>;\n}\n\n/**\n * A Time Picker allows the user to choose a specific time or a time range.\n */\nexport const HvTimePicker = forwardRef<HTMLDivElement, HvTimePickerProps>(\n function HvTimePicker(props, ref) {\n const {\n classes: classesProp,\n className,\n\n id: idProp,\n name,\n required,\n disabled,\n readOnly,\n label,\n\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n description,\n \"aria-describedby\": ariaDescribedBy,\n status,\n statusMessage,\n \"aria-errormessage\": ariaErrorMessage,\n\n placeholder,\n hoursPlaceholder = \"hh\",\n minutesPlaceholder = \"mm\",\n secondsPlaceholder = \"ss\",\n\n value: valueProp,\n defaultValue: defaultValueProp,\n\n timeFormat,\n showSeconds,\n disableExpand,\n locale = DEFAULT_LOCALE,\n\n onToggle,\n onChange,\n\n // misc properties:\n disablePortal = true,\n escapeWithReference = true,\n dropdownProps = {},\n ...others\n } = useDefaultProps(\"HvTimePicker\", props);\n\n const id = useUniqueId(idProp);\n\n const { classes, cx } = useClasses(classesProp);\n\n const timeFieldRef = useRef<HTMLDivElement>(null);\n\n const { ref: refProp, ...otherDropdownProps } = dropdownProps;\n const dropdownForkedRef = useForkRef(ref, refProp);\n\n const stateProps: TimeFieldStateOptions = {\n value: toTime(valueProp),\n defaultValue: toTime(defaultValueProp),\n label,\n locale,\n isRequired: required,\n isReadOnly: readOnly,\n isDisabled: disabled,\n granularity: showSeconds === false ? \"minute\" : \"second\",\n hourCycle: timeFormat === \"12\" ? 12 : 24,\n onChange: (value) => {\n if (!value) return;\n const { hour: hours, minute: minutes, second: seconds } = value;\n onChange?.({ hours, minutes, seconds });\n },\n };\n const state = useTimeFieldState(stateProps);\n const { labelProps, fieldProps, descriptionProps } = useTimeField(\n {\n ...stateProps,\n id,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n },\n state,\n timeFieldRef,\n );\n\n const [open, setOpen] = useState(false);\n\n const [validationMessage] = useControlled(statusMessage, \"Required\");\n const [validationState] = useControlled<HvFormStatus>(status, \"standBy\");\n\n const placeholders: PlaceholderProps[\"placeholders\"] = useMemo(\n () => ({\n hour: hoursPlaceholder,\n minute: minutesPlaceholder,\n second: secondsPlaceholder,\n }),\n [hoursPlaceholder, minutesPlaceholder, secondsPlaceholder],\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 = validationState === \"invalid\";\n const errorMessageId = isStateInvalid\n ? canShowError\n ? setId(id, \"error\")\n : ariaErrorMessage\n : undefined;\n\n return (\n <HvFormElement\n name={name}\n required={required}\n disabled={disabled}\n status={validationState}\n className={cx(classes.root, className)}\n {...others}\n >\n {(label || description) && (\n <div className={classes.labelContainer}>\n {label && (\n <HvLabel\n showGutter\n label={label}\n className={classes.label}\n {...labelProps}\n />\n )}\n {description && (\n <HvInfoMessage\n className={classes.description}\n {...descriptionProps}\n >\n {description}\n </HvInfoMessage>\n )}\n </div>\n )}\n\n <HvBaseDropdown\n ref={dropdownForkedRef}\n role=\"combobox\"\n variableWidth\n disabled={disabled}\n readOnly={readOnly}\n placeholder={\n placeholder && !state.value ? (\n placeholder\n ) : (\n <Placeholder\n ref={timeFieldRef}\n name={name}\n state={state}\n placeholders={placeholders}\n className={cx(classes.placeholder, {\n [classes.placeholderDisabled]: disabled,\n })}\n {...fieldProps}\n />\n )\n }\n classes={{\n header: cx(classes.dropdownHeader, {\n [classes.dropdownHeaderInvalid]: isStateInvalid,\n }),\n panel: classes.dropdownPanel,\n headerOpen: classes.dropdownHeaderOpen,\n }}\n placement=\"right\"\n adornment={<HvIcon name=\"Time\" className={classes.icon} />}\n expanded={open}\n onToggle={(evt, newOpen) => {\n if (disableExpand) return;\n setOpen(newOpen);\n onToggle?.(evt, newOpen);\n }}\n onContainerCreation={(containerRef) => {\n containerRef?.getElementsByTagName(\"input\")[0]?.focus();\n }}\n aria-haspopup=\"dialog\"\n aria-label={ariaLabel}\n aria-labelledby={fieldProps[\"aria-labelledby\"]}\n aria-describedby={fieldProps[\"aria-describedby\"]}\n aria-invalid={isStateInvalid ? true : undefined}\n aria-errormessage={errorMessageId}\n disablePortal={disablePortal}\n popperProps={{\n modifiers: [\n { name: \"preventOverflow\", enabled: escapeWithReference },\n ],\n }}\n {...otherDropdownProps}\n >\n <div ref={timeFieldRef} className={classes.timePopperContainer}>\n {state.segments.map((segment, i) => (\n <Unit\n key={i}\n state={state}\n segment={segment}\n placeholder={placeholders[segment.type]}\n onAdd={() => state.increment(segment.type)}\n onSub={() => state.decrement(segment.type)}\n onChange={(evt, val) => {\n state.setSegment(segment.type, Number(val));\n }}\n />\n ))}\n </div>\n </HvBaseDropdown>\n\n {canShowError && (\n <HvWarningText\n id={setId(id, \"error\")}\n disableBorder\n className={classes.error}\n >\n {validationMessage}\n </HvWarningText>\n )}\n </HvFormElement>\n );\n },\n);\n"],"names":["HvTimePicker"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,SAAS,CAAC,UAAqC;AAC/C,MAAA,CAAC,MAAc,QAAA;AACnB,QAAM,EAAE,OAAO,SAAS,QAAY,IAAA;AACpC,SAAO,IAAI,KAAK,OAAO,SAAS,OAAO;AACzC;AAgFO,MAAM,eAAe;AAAA,EAC1B,SAASA,cAAa,OAAO,KAAK;AAC1B,UAAA;AAAA,MACJ,SAAS;AAAA,MACT;AAAA,MAEA,IAAI;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,cAAc;AAAA,MACd,mBAAmB;AAAA,MACnB;AAAA,MACA,oBAAoB;AAAA,MACpB;AAAA,MACA;AAAA,MACA,qBAAqB;AAAA,MAErB;AAAA,MACA,mBAAmB;AAAA,MACnB,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,MAErB,OAAO;AAAA,MACP,cAAc;AAAA,MAEd;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAS;AAAA,MAET;AAAA,MACA;AAAA;AAAA,MAGA,gBAAgB;AAAA,MAChB,sBAAsB;AAAA,MACtB,gBAAgB,CAAC;AAAA,MACjB,GAAG;AAAA,IAA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,IAEJ;AAAA,EAAA;AAGN;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DropUpXS, DropDownXS } from "@hitachivantara/uikit-react-icons";
|
|
3
2
|
import { theme } from "@hitachivantara/uikit-styles";
|
|
3
|
+
import { HvIcon } from "../../icons.js";
|
|
4
4
|
import { useClasses } from "./Unit.styles.js";
|
|
5
5
|
import { HvButton } from "../../Button/Button.js";
|
|
6
6
|
import { HvBaseInput } from "../../BaseInput/BaseInput.js";
|
|
@@ -17,7 +17,7 @@ const Unit = ({
|
|
|
17
17
|
const { type, text } = segment;
|
|
18
18
|
const placeholder = placeholderProp ?? segment.placeholder;
|
|
19
19
|
return /* @__PURE__ */ jsxs("div", { className: classes.root, children: [
|
|
20
|
-
type !== "literal" && /* @__PURE__ */ jsx(
|
|
20
|
+
type !== "literal" && /* @__PURE__ */ jsx(HvIcon, { name: "CaretDown", size: "xs", rotate: true, onClick: onAdd }),
|
|
21
21
|
type === "literal" && /* @__PURE__ */ jsx("div", { className: classes.separator, children: text }),
|
|
22
22
|
type === "dayPeriod" && /* @__PURE__ */ jsx(HvButton, { icon: true, className: classes.periodToggle, onClick: onAdd, children: text }),
|
|
23
23
|
["hour", "minute", "second"].includes(type) && /* @__PURE__ */ jsx(
|
|
@@ -29,8 +29,7 @@ const Unit = ({
|
|
|
29
29
|
},
|
|
30
30
|
classes: {
|
|
31
31
|
input: classes.input,
|
|
32
|
-
root: classes.
|
|
33
|
-
inputRoot: classes.inputRoot
|
|
32
|
+
root: classes.inputRoot
|
|
34
33
|
},
|
|
35
34
|
onKeyDown: (event) => {
|
|
36
35
|
if ("key" in event && event.key === "Enter") {
|
|
@@ -46,7 +45,7 @@ const Unit = ({
|
|
|
46
45
|
inputProps: { autoComplete: "off", type: "number" }
|
|
47
46
|
}
|
|
48
47
|
),
|
|
49
|
-
type !== "literal" && /* @__PURE__ */ jsx(
|
|
48
|
+
type !== "literal" && /* @__PURE__ */ jsx(HvIcon, { name: "CaretDown", size: "xs", onClick: onSub })
|
|
50
49
|
] });
|
|
51
50
|
};
|
|
52
51
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unit.js","sources":["../../../../src/TimePicker/Unit/Unit.tsx"],"sourcesContent":["import { DateFieldState, DateSegment } from \"@react-stately/datepicker\";\nimport {
|
|
1
|
+
{"version":3,"file":"Unit.js","sources":["../../../../src/TimePicker/Unit/Unit.tsx"],"sourcesContent":["import { DateFieldState, DateSegment } from \"@react-stately/datepicker\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nimport { HvBaseInput, HvBaseInputProps } from \"../../BaseInput\";\nimport { HvButton } from \"../../Button\";\nimport { HvIcon } from \"../../icons\";\nimport { useClasses } from \"./Unit.styles\";\n\ninterface UnitProps {\n id?: string;\n state: DateFieldState;\n segment: DateSegment;\n placeholder?: string;\n /** Called when the value changes */\n onChange?: HvBaseInputProps[\"onChange\"];\n /** Called when the up/add arrow is pressed */\n onAdd?: () => void;\n /** Called when the down/subtract arrow is pressed */\n onSub?: () => void;\n}\n\nexport const Unit = ({\n id,\n state,\n segment,\n placeholder: placeholderProp,\n onChange,\n onAdd,\n onSub,\n}: UnitProps) => {\n const { classes } = useClasses();\n const { type, text } = segment;\n const placeholder = placeholderProp ?? segment.placeholder;\n\n return (\n <div className={classes.root}>\n {type !== \"literal\" && (\n <HvIcon name=\"CaretDown\" size=\"xs\" rotate onClick={onAdd} />\n )}\n {type === \"literal\" && <div className={classes.separator}>{text}</div>}\n {type === \"dayPeriod\" && (\n <HvButton icon className={classes.periodToggle} onClick={onAdd}>\n {text}\n </HvButton>\n )}\n {[\"hour\", \"minute\", \"second\"].includes(type) && (\n <HvBaseInput\n id={id}\n style={{\n ...theme.typography.title3,\n }}\n classes={{\n input: classes.input,\n root: classes.inputRoot,\n }}\n onKeyDown={(event) => {\n if (\"key\" in event && event.key === \"Enter\") {\n event.preventDefault();\n event.stopPropagation();\n }\n }}\n required\n invalid={state.isInvalid}\n value={text.padStart(2, \"0\")}\n onChange={onChange}\n placeholder={placeholder}\n inputProps={{ autoComplete: \"off\", type: \"number\" }}\n />\n )}\n {type !== \"literal\" && (\n <HvIcon name=\"CaretDown\" size=\"xs\" onClick={onSub} />\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,OAAO,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA;AACF,MAAiB;AACT,QAAA,EAAE,QAAQ,IAAI,WAAW;AACzB,QAAA,EAAE,MAAM,KAAA,IAAS;AACjB,QAAA,cAAc,mBAAmB,QAAQ;AAE/C,SACG,qBAAA,OAAA,EAAI,WAAW,QAAQ,MACrB,UAAA;AAAA,IAAS,SAAA,aACP,oBAAA,QAAA,EAAO,MAAK,aAAY,MAAK,MAAK,QAAM,MAAC,SAAS,MAAO,CAAA;AAAA,IAE3D,SAAS,aAAa,oBAAC,SAAI,WAAW,QAAQ,WAAY,UAAK,MAAA;AAAA,IAC/D,SAAS,eACR,oBAAC,UAAS,EAAA,MAAI,MAAC,WAAW,QAAQ,cAAc,SAAS,OACtD,UACH,KAAA,CAAA;AAAA,IAED,CAAC,QAAQ,UAAU,QAAQ,EAAE,SAAS,IAAI,KACzC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,GAAG,MAAM,WAAW;AAAA,QACtB;AAAA,QACA,SAAS;AAAA,UACP,OAAO,QAAQ;AAAA,UACf,MAAM,QAAQ;AAAA,QAChB;AAAA,QACA,WAAW,CAAC,UAAU;AACpB,cAAI,SAAS,SAAS,MAAM,QAAQ,SAAS;AAC3C,kBAAM,eAAe;AACrB,kBAAM,gBAAgB;AAAA,UAAA;AAAA,QAE1B;AAAA,QACA,UAAQ;AAAA,QACR,SAAS,MAAM;AAAA,QACf,OAAO,KAAK,SAAS,GAAG,GAAG;AAAA,QAC3B;AAAA,QACA;AAAA,QACA,YAAY,EAAE,cAAc,OAAO,MAAM,SAAS;AAAA,MAAA;AAAA,IACpD;AAAA,IAED,SAAS,aACP,oBAAA,QAAA,EAAO,MAAK,aAAY,MAAK,MAAK,SAAS,MAAO,CAAA;AAAA,EAAA,GAEvD;AAEJ;"}
|
|
@@ -27,8 +27,6 @@ const { staticClasses, useClasses } = createClasses("HvTimePickerUnit", {
|
|
|
27
27
|
...theme.typography.title3,
|
|
28
28
|
fontWeight: 600,
|
|
29
29
|
textAlign: "center",
|
|
30
|
-
height: 40,
|
|
31
|
-
width: 40,
|
|
32
30
|
padding: 0,
|
|
33
31
|
margin: 0,
|
|
34
32
|
"&::placeholder": {
|
|
@@ -42,10 +40,6 @@ const { staticClasses, useClasses } = createClasses("HvTimePickerUnit", {
|
|
|
42
40
|
},
|
|
43
41
|
subtractIcon: {
|
|
44
42
|
marginTop: theme.space.xs
|
|
45
|
-
},
|
|
46
|
-
inputContainer: {
|
|
47
|
-
minWidth: 40,
|
|
48
|
-
maxWidth: 40
|
|
49
43
|
}
|
|
50
44
|
});
|
|
51
45
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unit.styles.js","sources":["../../../../src/TimePicker/Unit/Unit.styles.ts"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTimePickerUnit\", {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n textAlign: \"center\",\n ...theme.typography.title3,\n },\n\n separator: {\n width: 8,\n },\n\n periodToggle: {\n height: 40,\n width: 40,\n },\n\n element: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n height: 40,\n width: 40,\n },\n\n input: {\n ...theme.typography.title3,\n fontWeight: 600,\n textAlign: \"center\",\n
|
|
1
|
+
{"version":3,"file":"Unit.styles.js","sources":["../../../../src/TimePicker/Unit/Unit.styles.ts"],"sourcesContent":["import { createClasses } from \"@hitachivantara/uikit-react-utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvTimePickerUnit\", {\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n textAlign: \"center\",\n ...theme.typography.title3,\n },\n\n separator: {\n width: 8,\n },\n\n periodToggle: {\n height: 40,\n width: 40,\n },\n\n element: {\n display: \"flex\",\n justifyContent: \"center\",\n alignItems: \"center\",\n height: 40,\n width: 40,\n },\n\n input: {\n ...theme.typography.title3,\n fontWeight: 600,\n textAlign: \"center\",\n padding: 0,\n margin: 0,\n \"&::placeholder\": {\n fontSize: 16,\n fontWeight: 600,\n },\n },\n inputRoot: {\n width: 40,\n height: 40,\n },\n\n subtractIcon: {\n marginTop: theme.space.xs,\n },\n});\n"],"names":[],"mappings":";;AAGO,MAAM,EAAE,eAAe,eAAe,cAAc,oBAAoB;AAAA,EAC7E,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,GAAG,MAAM,WAAW;AAAA,EACtB;AAAA,EAEA,WAAW;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EAEA,cAAc;AAAA,IACZ,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAAA,EAEA,SAAS;AAAA,IACP,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,OAAO;AAAA,EACT;AAAA,EAEA,OAAO;AAAA,IACL,GAAG,MAAM,WAAW;AAAA,IACpB,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,kBAAkB;AAAA,MAChB,UAAU;AAAA,MACV,YAAY;AAAA,IAAA;AAAA,EAEhB;AAAA,EACA,WAAW;AAAA,IACT,OAAO;AAAA,IACP,QAAQ;AAAA,EACV;AAAA,EAEA,cAAc;AAAA,IACZ,WAAW,MAAM,MAAM;AAAA,EAAA;AAE3B,CAAC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useSlotProps } from "@mui/base/utils";
|
|
3
|
-
import { DropDownXS, DropRightXS } from "@hitachivantara/uikit-react-icons";
|
|
4
3
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
4
|
+
import { HvIcon } from "../icons.js";
|
|
5
5
|
import { fixedForwardRef } from "../types/generic.js";
|
|
6
6
|
import { useTreeView } from "./internals/hooks/useTreeView.js";
|
|
7
7
|
import { TreeViewProvider } from "./internals/TreeViewProvider.js";
|
|
@@ -21,8 +21,8 @@ const HvTreeView = fixedForwardRef(function HvTreeView2(props, ref) {
|
|
|
21
21
|
selected,
|
|
22
22
|
defaultSelected,
|
|
23
23
|
disableSelection,
|
|
24
|
-
defaultCollapseIcon = /* @__PURE__ */ jsx(
|
|
25
|
-
defaultExpandIcon = /* @__PURE__ */ jsx(
|
|
24
|
+
defaultCollapseIcon = /* @__PURE__ */ jsx(HvIcon, { name: "CaretDown", size: "xs" }),
|
|
25
|
+
defaultExpandIcon = /* @__PURE__ */ jsx(HvIcon, { name: "CaretRight", size: "xs" }),
|
|
26
26
|
defaultEndIcon,
|
|
27
27
|
defaultParentIcon,
|
|
28
28
|
onNodeSelect,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.js","sources":["../../../src/TreeView/TreeView.tsx"],"sourcesContent":["import { useSlotProps } from \"@mui/base/utils\";\nimport {
|
|
1
|
+
{"version":3,"file":"TreeView.js","sources":["../../../src/TreeView/TreeView.tsx"],"sourcesContent":["import { useSlotProps } from \"@mui/base/utils\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvIcon } from \"../icons\";\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 = <HvIcon name=\"CaretDown\" size=\"xs\" />,\n defaultExpandIcon = <HvIcon name=\"CaretRight\" size=\"xs\" />,\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,sBAAuB,oBAAA,QAAA,EAAO,MAAK,aAAY,MAAK,MAAK;AAAA,IACzD,oBAAqB,oBAAA,QAAA,EAAO,MAAK,cAAa,MAAK,MAAK;AAAA,IACxD;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;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useMemo } from "react";
|
|
3
|
-
import { Backwards, Menu, Forwards } from "@hitachivantara/uikit-react-icons";
|
|
4
3
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
4
|
+
import { HvIcon } from "../../icons.js";
|
|
5
5
|
import { VerticalNavigationContext } from "../VerticalNavigationContext.js";
|
|
6
6
|
import { useClasses } from "./Header.styles.js";
|
|
7
7
|
import { staticClasses } from "./Header.styles.js";
|
|
@@ -33,8 +33,8 @@ const HvVerticalNavigationHeader = (props) => {
|
|
|
33
33
|
[parentItem, slider]
|
|
34
34
|
);
|
|
35
35
|
if (!shouldShowTitle) return null;
|
|
36
|
-
const openIcon = openIconProp ??
|
|
37
|
-
const closeIcon = closeIconProp ?? /* @__PURE__ */ jsx(
|
|
36
|
+
const openIcon = openIconProp ?? /* @__PURE__ */ jsx(HvIcon, { name: useIcons ? "Forwards" : "Menu" });
|
|
37
|
+
const closeIcon = closeIconProp ?? /* @__PURE__ */ jsx(HvIcon, { name: "Backwards" });
|
|
38
38
|
const handleClickBack = () => navigateToParentHandler?.();
|
|
39
39
|
const { className: backButtonClassName, ...otherBackButtonProps } = backButtonProps;
|
|
40
40
|
const {
|
|
@@ -56,7 +56,7 @@ const HvVerticalNavigationHeader = (props) => {
|
|
|
56
56
|
className: cx(classes.backButton, backButtonClassName),
|
|
57
57
|
"aria-label": "Back",
|
|
58
58
|
...otherBackButtonProps,
|
|
59
|
-
children: /* @__PURE__ */ jsx(
|
|
59
|
+
children: /* @__PURE__ */ jsx(HvIcon, { name: "Backwards", size: "xs" })
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
62
|
isOpen && /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sources":["../../../../src/VerticalNavigation/Header/Header.tsx"],"sourcesContent":["import { useContext, useMemo } from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"Header.js","sources":["../../../../src/VerticalNavigation/Header/Header.tsx"],"sourcesContent":["import { useContext, useMemo } from \"react\";\nimport {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton, HvButtonProps } from \"../../Button\";\nimport { HvIcon } from \"../../icons\";\nimport { HvBaseProps } from \"../../types/generic\";\nimport { HvTypography } from \"../../Typography\";\nimport { VerticalNavigationContext } from \"../VerticalNavigationContext\";\nimport { staticClasses, useClasses } from \"./Header.styles\";\n\nexport { staticClasses as verticalNavigationHeaderClasses };\n\nexport type HvVerticalNavigationHeaderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvVerticalNavigationHeaderProps extends HvBaseProps {\n /** The title text to show on header. */\n title?: string;\n /** Icon to show when vertical navigation is collapsed. */\n openIcon?: React.ReactNode;\n /** Icon to show when vertical navigation is expanded. */\n closeIcon?: React.ReactNode;\n /** Props for the collapse button. */\n collapseButtonProps?: HvButtonProps;\n /** Props for the back button. */\n backButtonProps?: HvButtonProps;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvVerticalNavigationHeaderClasses;\n /** Handler for the collapse button. */\n onCollapseButtonClick?: React.MouseEventHandler<HTMLElement>;\n}\n\nexport const HvVerticalNavigationHeader = (\n props: HvVerticalNavigationHeaderProps,\n) => {\n const {\n title,\n openIcon: openIconProp,\n closeIcon: closeIconProp,\n collapseButtonProps = {},\n backButtonProps = {},\n className,\n classes: classesProp,\n onCollapseButtonClick,\n ...others\n } = useDefaultProps(\"HvVerticalNavigationHeader\", props);\n\n const {\n isOpen,\n useIcons,\n headerTitle,\n slider,\n navigateToParentHandler,\n parentItem,\n } = useContext(VerticalNavigationContext);\n\n const { classes, cx } = useClasses(classesProp);\n\n // whenever we're in a sublevel, the parentItem is always a single item.\n // In the first level it's always an array with the first level elements.\n const shouldShowTitle = useMemo(\n () => !slider || (slider && !Array.isArray(parentItem)),\n [parentItem, slider],\n );\n\n if (!shouldShowTitle) return null;\n\n const openIcon = openIconProp ?? (\n <HvIcon name={useIcons ? \"Forwards\" : \"Menu\"} />\n );\n const closeIcon = closeIconProp ?? <HvIcon name=\"Backwards\" />;\n\n const handleClickBack = () => navigateToParentHandler?.();\n\n const { className: backButtonClassName, ...otherBackButtonProps } =\n backButtonProps;\n\n const {\n className: collapseButtonClassName,\n classes: collapseButtonClasses,\n ...otherCollapseButtonProps\n } = collapseButtonProps;\n\n return (\n <div\n className={cx(classes.root, { [classes.minimized]: !isOpen }, className)}\n {...others}\n >\n {isOpen && headerTitle && slider && (\n <HvButton\n icon\n onClick={handleClickBack}\n className={cx(classes.backButton, backButtonClassName)}\n aria-label=\"Back\"\n {...otherBackButtonProps}\n >\n <HvIcon name=\"Backwards\" size=\"xs\" />\n </HvButton>\n )}\n {isOpen && (\n <HvTypography\n variant={slider ? \"label\" : \"title3\"}\n className={classes.title}\n >\n {headerTitle && slider ? headerTitle : title}\n </HvTypography>\n )}\n {onCollapseButtonClick && (\n <HvButton\n icon\n onClick={onCollapseButtonClick}\n className={cx(classes.collapseButton, collapseButtonClassName)}\n classes={{\n ...collapseButtonClasses,\n root: cx(\n { [classes.minimized]: !isOpen }, // TODO - v6 don't use minimized classes in two different places\n collapseButtonClasses?.root,\n ),\n }}\n {...otherCollapseButtonProps}\n >\n {isOpen ? closeIcon : openIcon}\n </HvButton>\n )}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAkCa,MAAA,6BAA6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AAAA,QACrC;AAAA,QAED,UACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,SAAS,SAAS,UAAU;AAAA,YAC5B,WAAW,QAAQ;AAAA,YAElB,UAAA,eAAe,SAAS,cAAc;AAAA,UAAA;AAAA,QACzC;AAAA,QAED,yBACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAI;AAAA,YACJ,SAAS;AAAA,YACT,WAAW,GAAG,QAAQ,gBAAgB,uBAAuB;AAAA,YAC7D,SAAS;AAAA,cACP,GAAG;AAAA,cACH,MAAM;AAAA,gBACJ,EAAE,CAAC,QAAQ,SAAS,GAAG,CAAC,OAAO;AAAA;AAAA,gBAC/B,uBAAuB;AAAA,cAAA;AAAA,YAE3B;AAAA,YACC,GAAG;AAAA,YAEH,mBAAS,YAAY;AAAA,UAAA;AAAA,QAAA;AAAA,MACxB;AAAA,IAAA;AAAA,EAEJ;AAEJ;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { DropRightXS } from "@hitachivantara/uikit-react-icons";
|
|
3
2
|
import { useDefaultProps } from "@hitachivantara/uikit-react-utils";
|
|
3
|
+
import { HvIcon } from "../../icons.js";
|
|
4
4
|
import { useClasses } from "./NavigationSlider.styles.js";
|
|
5
5
|
import { staticClasses } from "./NavigationSlider.styles.js";
|
|
6
6
|
import { HvButton } from "../../Button/Button.js";
|
|
@@ -50,7 +50,7 @@ const HvVerticalNavigationSlider = (props) => {
|
|
|
50
50
|
},
|
|
51
51
|
className: classes.forwardButton,
|
|
52
52
|
"aria-label": forwardButtonAriaLabel,
|
|
53
|
-
children: /* @__PURE__ */ jsx(
|
|
53
|
+
children: /* @__PURE__ */ jsx(HvIcon, { name: "CaretRight", size: "xs" })
|
|
54
54
|
}
|
|
55
55
|
) : void 0,
|
|
56
56
|
children: /* @__PURE__ */ jsx(HvOverflowTooltip, { data: item.label })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationSlider.js","sources":["../../../../src/VerticalNavigation/NavigationSlider/NavigationSlider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"NavigationSlider.js","sources":["../../../../src/VerticalNavigation/NavigationSlider/NavigationSlider.tsx"],"sourcesContent":["import {\n useDefaultProps,\n type ExtractNames,\n} from \"@hitachivantara/uikit-react-utils\";\n\nimport { HvButton } from \"../../Button\";\nimport { HvIcon } from \"../../icons\";\nimport {\n HvListContainer,\n HvListContainerProps,\n HvListItem,\n} from \"../../ListContainer\";\nimport { HvOverflowTooltip } from \"../../OverflowTooltip\";\nimport { NavigationData } from \"../VerticalNavigationContext\";\nimport { staticClasses, useClasses } from \"./NavigationSlider.styles\";\n\nexport { staticClasses as verticalNavigationSliderClasses };\n\nexport type HvVerticalNavigationSliderClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvVerticalNavigationSliderProps\n extends Omit<HvListContainerProps, \"classes\"> {\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvVerticalNavigationSliderClasses;\n /**\n * An array containing the data for each menu item.\n *\n * id - the id to be applied to the root element.\n * label - the label to be rendered on the menu item.\n * icon - the icon react element\n * data - sub-menu items\n * href - the url used for navigation.\n * target - the behavior when opening an url.\n */\n data?: NavigationData[];\n /** The selected item id. */\n selected?: string;\n /** Triggered when the item is clicked. */\n onNavigateToTarget?: (\n event: React.MouseEvent<HTMLLIElement>,\n item: NavigationData,\n ) => void;\n /** Triggered when the navigate to child button is clicked. */\n onNavigateToChild?: (\n event: React.MouseEvent<HTMLButtonElement>,\n item: NavigationData,\n ) => void;\n /** Aria label to apply to the navigate to submenu button on the list items. */\n forwardButtonAriaLabel?: string;\n}\n\nexport const HvVerticalNavigationSlider = (\n props: HvVerticalNavigationSliderProps,\n) => {\n const {\n className,\n classes: classesProp,\n data,\n selected,\n onNavigateToTarget,\n onNavigateToChild,\n forwardButtonAriaLabel = \"Navigate to submenu\",\n ...others\n } = useDefaultProps(\"HvVerticalNavigationSlider\", props);\n\n const { classes, cx } = useClasses(classesProp);\n\n return (\n <HvListContainer\n interactive\n className={cx(classes.listContainer, className)}\n {...others}\n >\n {data?.map((item) => (\n <HvListItem\n key={item.id}\n classes={{\n root: classes.root,\n selected: classes.listItemSelected,\n focus: classes.listItemFocus,\n disabled: classes.listItemDisabled,\n }}\n onClick={(event) => {\n onNavigateToTarget?.(event, item);\n }}\n aria-label={item.label}\n aria-current={\n selected === item.id ? (item.href ? \"page\" : true) : undefined\n }\n selected={selected === item.id}\n startAdornment={item.icon ? <div>{item.icon}</div> : undefined}\n endAdornment={\n item.data && item.data.length > 0 ? (\n <HvButton\n icon\n onClick={(event) => {\n onNavigateToChild?.(event, item);\n }}\n className={classes.forwardButton}\n aria-label={forwardButtonAriaLabel}\n >\n <HvIcon name=\"CaretRight\" size=\"xs\" />\n </HvButton>\n ) : undefined\n }\n >\n <HvOverflowTooltip data={item.label} />\n </HvListItem>\n ))}\n </HvListContainer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAmDa,MAAA,6BAA6B,CACxC,UACG;AACG,QAAA;AAAA,IACJ;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,yBAAyB;AAAA,IACzB,GAAG;AAAA,EAAA,IACD,gBAAgB,8BAA8B,KAAK;AAEvD,QAAM,EAAE,SAAS,OAAO,WAAW,WAAW;AAG5C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAW;AAAA,MACX,WAAW,GAAG,QAAQ,eAAe,SAAS;AAAA,MAC7C,GAAG;AAAA,MAEH,UAAA,MAAM,IAAI,CAAC,SACV;AAAA,QAAC;AAAA,QAAA;AAAA,UAEC,SAAS;AAAA,YACP,MAAM,QAAQ;AAAA,YACd,UAAU,QAAQ;AAAA,YAClB,OAAO,QAAQ;AAAA,YACf,UAAU,QAAQ;AAAA,UACpB;AAAA,UACA,SAAS,CAAC,UAAU;AAClB,iCAAqB,OAAO,IAAI;AAAA,UAClC;AAAA,UACA,cAAY,KAAK;AAAA,UACjB,gBACE,aAAa,KAAK,KAAM,KAAK,OAAO,SAAS,OAAQ;AAAA,UAEvD,UAAU,aAAa,KAAK;AAAA,UAC5B,gBAAgB,KAAK,2BAAQ,OAAK,EAAA,UAAA,KAAK,KAAK,CAAA,IAAS;AAAA,UACrD,cACE,KAAK,QAAQ,KAAK,KAAK,SAAS,IAC9B;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAI;AAAA,cACJ,SAAS,CAAC,UAAU;AAClB,oCAAoB,OAAO,IAAI;AAAA,cACjC;AAAA,cACA,WAAW,QAAQ;AAAA,cACnB,cAAY;AAAA,cAEZ,UAAC,oBAAA,QAAA,EAAO,MAAK,cAAa,MAAK,KAAK,CAAA;AAAA,YAAA;AAAA,UAAA,IAEpC;AAAA,UAGN,UAAC,oBAAA,mBAAA,EAAkB,MAAM,KAAK,MAAO,CAAA;AAAA,QAAA;AAAA,QA/BhC,KAAK;AAAA,MAiCb,CAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useContext, useState, useRef, useMemo, useEffect, useCallback } from "react";
|
|
3
|
-
import { Forwards, DropDownXS } from "@hitachivantara/uikit-react-icons";
|
|
4
3
|
import { useDefaultProps, mergeStyles } from "@hitachivantara/uikit-react-utils";
|
|
5
4
|
import { useForkRef } from "../../hooks/useForkRef.js";
|
|
5
|
+
import { HvIcon } from "../../icons.js";
|
|
6
6
|
import { useDescendant, DescendantProvider } from "../../TreeView/internals/DescendantProvider.js";
|
|
7
7
|
import { setId } from "../../utils/setId.js";
|
|
8
8
|
import { VerticalNavigationContext } from "../VerticalNavigationContext.js";
|
|
@@ -313,7 +313,7 @@ const HvVerticalNavigationTreeViewItem = forwardRef(
|
|
|
313
313
|
children: payload?.label?.substring(0, 1)
|
|
314
314
|
}
|
|
315
315
|
) : useIcons && icon,
|
|
316
|
-
hasChildren && !isOpen ? /* @__PURE__ */ jsx(
|
|
316
|
+
hasChildren && !isOpen ? /* @__PURE__ */ jsx(HvIcon, { name: "Forwards", size: "xs", compact: true }) : hasAnyChildWithData && !isOpen && /* @__PURE__ */ jsx("div", {})
|
|
317
317
|
]
|
|
318
318
|
}
|
|
319
319
|
),
|
|
@@ -327,7 +327,7 @@ const HvVerticalNavigationTreeViewItem = forwardRef(
|
|
|
327
327
|
children: /* @__PURE__ */ jsx(HvOverflowTooltip, { data: label })
|
|
328
328
|
}
|
|
329
329
|
),
|
|
330
|
-
isOpen && expandable && /* @__PURE__ */ jsx(
|
|
330
|
+
isOpen && expandable && /* @__PURE__ */ jsx(HvIcon, { name: "CaretDown", size: "xs", rotate: expanded })
|
|
331
331
|
]
|
|
332
332
|
}
|
|
333
333
|
) });
|