@hitachivantara/uikit-react-core 5.63.0 → 5.63.1
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/AppSwitcher/Action/Action.cjs +1 -1
- package/dist/cjs/CheckBoxGroup/CheckBoxGroup.styles.cjs +2 -2
- package/dist/cjs/Dialog/Dialog.cjs +0 -1
- package/dist/cjs/Drawer/Drawer.cjs +0 -5
- package/dist/cjs/FilterGroup/Counter/Counter.cjs +4 -6
- package/dist/cjs/FilterGroup/LeftPanel/LeftPanel.cjs +13 -17
- package/dist/cjs/FilterGroup/RightPanel/RightPanel.styles.cjs +1 -4
- package/dist/cjs/Input/Input.cjs +1 -3
- package/dist/cjs/List/List.cjs +25 -57
- package/dist/cjs/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.cjs +25 -20
- package/dist/cjs/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.cjs +24 -29
- package/dist/cjs/ScrollTo/Horizontal/ScrollToHorizontal.cjs +28 -66
- package/dist/cjs/ScrollTo/Horizontal/ScrollToHorizontal.styles.cjs +3 -20
- package/dist/cjs/ScrollTo/Vertical/ScrollToVertical.cjs +9 -22
- package/dist/cjs/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.cjs +8 -15
- package/dist/cjs/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.cjs +12 -7
- package/dist/esm/AppSwitcher/Action/Action.js +1 -1
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.styles.js +2 -2
- package/dist/esm/CheckBoxGroup/CheckBoxGroup.styles.js.map +1 -1
- package/dist/esm/Dialog/Dialog.js +0 -1
- package/dist/esm/Dialog/Dialog.js.map +1 -1
- package/dist/esm/Drawer/Drawer.js +0 -5
- package/dist/esm/Drawer/Drawer.js.map +1 -1
- package/dist/esm/FilterGroup/Counter/Counter.js +4 -6
- package/dist/esm/FilterGroup/Counter/Counter.js.map +1 -1
- package/dist/esm/FilterGroup/LeftPanel/LeftPanel.js +13 -17
- package/dist/esm/FilterGroup/LeftPanel/LeftPanel.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.js.map +1 -1
- package/dist/esm/FilterGroup/RightPanel/RightPanel.styles.js +1 -4
- package/dist/esm/FilterGroup/RightPanel/RightPanel.styles.js.map +1 -1
- package/dist/esm/Input/Input.js +1 -3
- package/dist/esm/Input/Input.js.map +1 -1
- package/dist/esm/List/List.js +25 -57
- package/dist/esm/List/List.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.js +26 -21
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js +24 -29
- package/dist/esm/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.js +29 -67
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.js.map +1 -1
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.styles.js +3 -20
- package/dist/esm/ScrollTo/Horizontal/ScrollToHorizontal.styles.js.map +1 -1
- package/dist/esm/ScrollTo/Vertical/ScrollToVertical.js +9 -22
- package/dist/esm/ScrollTo/Vertical/ScrollToVertical.js.map +1 -1
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.js +8 -15
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.js.map +1 -1
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.js +12 -7
- package/dist/esm/ScrollTo/Vertical/VerticalScrollListItem/VerticalScrollListItem.styles.js.map +1 -1
- package/dist/types/index.d.ts +17 -14
- package/package.json +5 -5
- package/dist/cjs/ScrollTo/withTooltip.cjs +0 -17
- package/dist/esm/ScrollTo/withTooltip.js +0 -17
- package/dist/esm/ScrollTo/withTooltip.js.map +0 -1
|
@@ -6,10 +6,10 @@ const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
|
6
6
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
7
7
|
const useUniqueId = require("../../hooks/useUniqueId.cjs");
|
|
8
8
|
const Action_styles = require("./Action.styles.cjs");
|
|
9
|
-
const OverflowTooltip = require("../../OverflowTooltip/OverflowTooltip.cjs");
|
|
10
9
|
const Avatar = require("../../Avatar/Avatar.cjs");
|
|
11
10
|
const Typography = require("../../Typography/Typography.cjs");
|
|
12
11
|
const ListItem = require("../../ListContainer/ListItem/ListItem.cjs");
|
|
12
|
+
const OverflowTooltip = require("../../OverflowTooltip/OverflowTooltip.cjs");
|
|
13
13
|
const Tooltip = require("../../Tooltip/Tooltip.cjs");
|
|
14
14
|
const HvAppSwitcherAction = ({
|
|
15
15
|
id,
|
|
@@ -5,8 +5,8 @@ const classes = require("../utils/classes.cjs");
|
|
|
5
5
|
const { staticClasses, useClasses } = classes.createClasses("HvCheckBoxGroup", {
|
|
6
6
|
root: {
|
|
7
7
|
display: "inline-block",
|
|
8
|
-
padding:
|
|
9
|
-
margin:
|
|
8
|
+
padding: 4,
|
|
9
|
+
margin: -4,
|
|
10
10
|
overflow: "hidden",
|
|
11
11
|
verticalAlign: "top"
|
|
12
12
|
},
|
|
@@ -17,7 +17,7 @@ const getExistingFiltersById = (idx, filterValues, filterOptions) => {
|
|
|
17
17
|
const HvFilterGroupCounter = (props) => {
|
|
18
18
|
const {
|
|
19
19
|
className,
|
|
20
|
-
|
|
20
|
+
groupId,
|
|
21
21
|
classes: classesProp
|
|
22
22
|
} = useDefaultProps.useDefaultProps("HvFilterGroupCounter", props);
|
|
23
23
|
const { classes, cx } = Counter_styles.useClasses(classesProp);
|
|
@@ -26,15 +26,13 @@ const HvFilterGroupCounter = (props) => {
|
|
|
26
26
|
filterValues = [],
|
|
27
27
|
appliedFilters = []
|
|
28
28
|
} = React.useContext(FilterGroupContext.HvFilterGroupContext);
|
|
29
|
-
const options =
|
|
30
|
-
|
|
31
|
-
] : filterOptions;
|
|
32
|
-
const optionIdx = filterOptions.findIndex((option) => option.id === id);
|
|
29
|
+
const options = groupId && filterOptions.find((option) => option.id === groupId) ? [filterOptions.find((option) => option.id === groupId)] : filterOptions;
|
|
30
|
+
const optionIdx = filterOptions.findIndex((option) => option.id === groupId);
|
|
33
31
|
let groupsCounter = 0;
|
|
34
32
|
appliedFilters.forEach((fg, i) => {
|
|
35
33
|
groupsCounter += getExistingFiltersById(i, filterValues, filterOptions);
|
|
36
34
|
});
|
|
37
|
-
const partialCounter =
|
|
35
|
+
const partialCounter = groupId ? getExistingFiltersById(optionIdx, filterValues, filterOptions) || 0 : groupsCounter;
|
|
38
36
|
const totalCounter = options.reduce(
|
|
39
37
|
(acc, option) => acc + option.data.length,
|
|
40
38
|
0
|
|
@@ -3,36 +3,32 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const setId = require("../../utils/setId.cjs");
|
|
6
|
-
const wrapperTooltip = require("../../utils/wrapperTooltip.cjs");
|
|
7
6
|
const FilterGroupContext = require("../FilterGroupContext.cjs");
|
|
8
7
|
const LeftPanel_styles = require("./LeftPanel.styles.cjs");
|
|
9
8
|
const Counter = require("../Counter/Counter.cjs");
|
|
10
9
|
const Panel = require("../../Panel/Panel.cjs");
|
|
11
10
|
const ListContainer = require("../../ListContainer/ListContainer.cjs");
|
|
12
11
|
const ListItem = require("../../ListContainer/ListItem/ListItem.cjs");
|
|
12
|
+
const OverflowTooltip = require("../../OverflowTooltip/OverflowTooltip.cjs");
|
|
13
13
|
const HvFilterGroupLeftPanel = ({
|
|
14
14
|
id,
|
|
15
15
|
className,
|
|
16
16
|
emptyElement,
|
|
17
17
|
classes: classesProp
|
|
18
18
|
}) => {
|
|
19
|
-
const { classes
|
|
19
|
+
const { classes } = LeftPanel_styles.useClasses(classesProp);
|
|
20
20
|
const { filterOptions, activeGroup, setActiveGroup } = React.useContext(FilterGroupContext.HvFilterGroupContext);
|
|
21
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Panel.HvPanel, { id: setId.setId(id, "leftPanel"), className, children: filterOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ListContainer.HvListContainer, { id: setId.setId(id, "leftPanel-list"), condensed: true, interactive: true, children: filterOptions.map((group, index) =>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
group.name
|
|
34
|
-
);
|
|
35
|
-
}) }) : emptyElement });
|
|
21
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Panel.HvPanel, { id: setId.setId(id, "leftPanel"), className, children: filterOptions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(ListContainer.HvListContainer, { id: setId.setId(id, "leftPanel-list"), condensed: true, interactive: true, children: filterOptions.map((group, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
22
|
+
ListItem.HvListItem,
|
|
23
|
+
{
|
|
24
|
+
className: classes.listItem,
|
|
25
|
+
onClick: () => setActiveGroup(index),
|
|
26
|
+
selected: filterOptions[activeGroup].id === group.id,
|
|
27
|
+
endAdornment: /* @__PURE__ */ jsxRuntime.jsx(Counter.HvFilterGroupCounter, { groupId: group.id }),
|
|
28
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(OverflowTooltip.HvOverflowTooltip, { data: group.name })
|
|
29
|
+
},
|
|
30
|
+
group.id || group.name
|
|
31
|
+
)) }) : emptyElement });
|
|
36
32
|
};
|
|
37
33
|
exports.filterGroupLeftPanelClasses = LeftPanel_styles.staticClasses;
|
|
38
34
|
exports.HvFilterGroupLeftPanel = HvFilterGroupLeftPanel;
|
|
@@ -8,11 +8,8 @@ const { staticClasses, useClasses } = classes.createClasses(name, {
|
|
|
8
8
|
marginBottom: uikitStyles.theme.spacing("xs")
|
|
9
9
|
},
|
|
10
10
|
list: {
|
|
11
|
-
width: "calc(100% + 8px)",
|
|
12
11
|
height: "calc(100% - 70px)",
|
|
13
|
-
overflowY: "auto"
|
|
14
|
-
margin: -4,
|
|
15
|
-
padding: 4
|
|
12
|
+
overflowY: "auto"
|
|
16
13
|
},
|
|
17
14
|
selectAllContainer: {
|
|
18
15
|
// Prevent the focus ring to be hidden by sibling hover background
|
package/dist/cjs/Input/Input.cjs
CHANGED
|
@@ -11,7 +11,6 @@ const useDefaultProps = require("../hooks/useDefaultProps.cjs");
|
|
|
11
11
|
const useIsMounted = require("../hooks/useIsMounted.cjs");
|
|
12
12
|
const useLabels = require("../hooks/useLabels.cjs");
|
|
13
13
|
const useUniqueId = require("../hooks/useUniqueId.cjs");
|
|
14
|
-
const browser = require("../utils/browser.cjs");
|
|
15
14
|
const keyboardUtils = require("../utils/keyboardUtils.cjs");
|
|
16
15
|
const setId = require("../utils/setId.cjs");
|
|
17
16
|
const Input_styles = require("./Input.styles.cjs");
|
|
@@ -35,9 +34,8 @@ const DEFAULT_LABELS = {
|
|
|
35
34
|
/** The label of the search button. */
|
|
36
35
|
searchButtonLabel: "Search"
|
|
37
36
|
};
|
|
38
|
-
const getFocusedElement = (event) => browser.isBrowser("ie") ? document.activeElement : event.relatedTarget;
|
|
39
37
|
function eventTargetIsInsideContainer(container, event) {
|
|
40
|
-
return container
|
|
38
|
+
return !!container?.contains(event.relatedTarget);
|
|
41
39
|
}
|
|
42
40
|
const changeInputValue = (input, value = "") => {
|
|
43
41
|
const event = new Event("input", { bubbles: true });
|
package/dist/cjs/List/List.cjs
CHANGED
|
@@ -6,13 +6,13 @@ const reactWindow = require("react-window");
|
|
|
6
6
|
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
7
7
|
const useDefaultProps = require("../hooks/useDefaultProps.cjs");
|
|
8
8
|
const setId = require("../utils/setId.cjs");
|
|
9
|
-
const wrapperTooltip = require("../utils/wrapperTooltip.cjs");
|
|
10
9
|
const List_styles = require("./List.styles.cjs");
|
|
11
10
|
const useSelectableList = require("./useSelectableList.cjs");
|
|
12
11
|
const utils = require("./utils.cjs");
|
|
13
12
|
const CheckBox = require("../CheckBox/CheckBox.cjs");
|
|
14
|
-
const
|
|
13
|
+
const OverflowTooltip = require("../OverflowTooltip/OverflowTooltip.cjs");
|
|
15
14
|
const Link = require("../Link/Link.cjs");
|
|
15
|
+
const Radio = require("../Radio/Radio.cjs");
|
|
16
16
|
const ListContainer = require("../ListContainer/ListContainer.cjs");
|
|
17
17
|
const Typography = require("../Typography/Typography.cjs");
|
|
18
18
|
const ListItem = require("../ListContainer/ListItem/ListItem.cjs");
|
|
@@ -26,6 +26,7 @@ const HvList = (props) => {
|
|
|
26
26
|
classes: classesProp,
|
|
27
27
|
className,
|
|
28
28
|
multiSelect = false,
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
30
|
hasTooltips = false,
|
|
30
31
|
showSelectAll = false,
|
|
31
32
|
labels = DEFAULT_LABELS,
|
|
@@ -116,65 +117,32 @@ const HvList = (props) => {
|
|
|
116
117
|
);
|
|
117
118
|
};
|
|
118
119
|
const renderItemText = (item) => {
|
|
119
|
-
|
|
120
|
-
return !multiSelect && item.path ? /* @__PURE__ */ jsxRuntime.jsx(Link.HvLink, { route: item.path, classes: { a: classes.link }, children: /* @__PURE__ */ jsxRuntime.jsx(ItemText, {}) }, item.label) : /* @__PURE__ */ jsxRuntime.jsx(ItemText, {});
|
|
121
|
-
};
|
|
122
|
-
const renderMultiSelectItem = (item, itemId) => {
|
|
123
|
-
if (useSelector) {
|
|
124
|
-
const Selection = wrapperTooltip.wrapperTooltip(
|
|
125
|
-
hasTooltips,
|
|
126
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
-
CheckBox.HvCheckBox,
|
|
128
|
-
{
|
|
129
|
-
id: setId.setId(itemId, "selector"),
|
|
130
|
-
label: item.label,
|
|
131
|
-
checked: item.selected,
|
|
132
|
-
disabled: item.disabled,
|
|
133
|
-
onChange: (evt) => handleSelect(evt, item),
|
|
134
|
-
classes: {
|
|
135
|
-
root: classes.selectorRoot,
|
|
136
|
-
container: classes.selectorContainer,
|
|
137
|
-
label: classes.truncate
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
),
|
|
141
|
-
item.label
|
|
142
|
-
);
|
|
143
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Selection, {});
|
|
144
|
-
}
|
|
145
|
-
return renderItemText(item);
|
|
120
|
+
return !multiSelect && item.path ? /* @__PURE__ */ jsxRuntime.jsx(Link.HvLink, { route: item.path, classes: { a: classes.link }, children: /* @__PURE__ */ jsxRuntime.jsx(OverflowTooltip.HvOverflowTooltip, { data: item.label }) }) : /* @__PURE__ */ jsxRuntime.jsx(OverflowTooltip.HvOverflowTooltip, { data: item.label });
|
|
146
121
|
};
|
|
147
|
-
const
|
|
148
|
-
if (useSelector)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
);
|
|
167
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Selection, {});
|
|
168
|
-
}
|
|
169
|
-
return renderItemText(item);
|
|
122
|
+
const renderSelectItem = (item, itemId) => {
|
|
123
|
+
if (!useSelector)
|
|
124
|
+
return renderItemText(item);
|
|
125
|
+
const Component = multiSelect ? CheckBox.HvCheckBox : Radio.HvRadio;
|
|
126
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
127
|
+
Component,
|
|
128
|
+
{
|
|
129
|
+
id: setId.setId(itemId, "selector"),
|
|
130
|
+
label: /* @__PURE__ */ jsxRuntime.jsx(OverflowTooltip.HvOverflowTooltip, { data: item.label }),
|
|
131
|
+
checked: item.selected || false,
|
|
132
|
+
disabled: item.disabled,
|
|
133
|
+
onChange: multiSelect ? (evt) => handleSelect(evt, item) : void 0,
|
|
134
|
+
classes: {
|
|
135
|
+
root: classes.selectorRoot,
|
|
136
|
+
container: classes.selectorContainer,
|
|
137
|
+
label: classes.truncate
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
);
|
|
170
141
|
};
|
|
171
142
|
const renderListItem = (item, i, otherProps = {}) => {
|
|
172
143
|
const itemId = setId.setId(id, "item", i);
|
|
173
144
|
const selected = item.selected || false;
|
|
174
|
-
|
|
175
|
-
if (!useSelector && item.icon) {
|
|
176
|
-
startAdornment = renderLeftIcon(item);
|
|
177
|
-
}
|
|
145
|
+
const startAdornment = !useSelector && item.icon ? renderLeftIcon(item) : null;
|
|
178
146
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
179
147
|
ListItem.HvListItem,
|
|
180
148
|
{
|
|
@@ -192,7 +160,7 @@ const HvList = (props) => {
|
|
|
192
160
|
startAdornment,
|
|
193
161
|
endAdornment: item.showNavIcon && /* @__PURE__ */ jsxRuntime.jsx(uikitReactIcons.DropRightXS, { className: classes.box, iconSize: "XS" }),
|
|
194
162
|
...otherProps,
|
|
195
|
-
children:
|
|
163
|
+
children: renderSelectItem(item, itemId)
|
|
196
164
|
},
|
|
197
165
|
i
|
|
198
166
|
);
|
|
@@ -4,46 +4,51 @@ const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
|
4
4
|
const useDefaultProps = require("../../../hooks/useDefaultProps.cjs");
|
|
5
5
|
const setId = require("../../../utils/setId.cjs");
|
|
6
6
|
const HorizontalScrollListItem_styles = require("./HorizontalScrollListItem.styles.cjs");
|
|
7
|
+
const OverflowTooltip = require("../../../OverflowTooltip/OverflowTooltip.cjs");
|
|
7
8
|
const HvHorizontalScrollListItem = (props) => {
|
|
8
9
|
const {
|
|
9
10
|
id,
|
|
10
11
|
className,
|
|
11
12
|
classes: classesProp,
|
|
12
13
|
selected,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
onKeyDown,
|
|
16
|
-
tooltipWrapper,
|
|
14
|
+
label,
|
|
15
|
+
tooltipPlacement,
|
|
17
16
|
href,
|
|
17
|
+
iconClasses,
|
|
18
18
|
...others
|
|
19
19
|
} = useDefaultProps.useDefaultProps("HvHorizontalScrollListItem", props);
|
|
20
20
|
const { classes, cx } = HorizontalScrollListItem_styles.useClasses(classesProp);
|
|
21
|
-
const variant = selected ? "label" : "body";
|
|
22
|
-
const labelId = setId.setId(id, "label");
|
|
23
21
|
const buttonId = setId.setId(id, "button");
|
|
24
|
-
const Tooltip = tooltipWrapper;
|
|
25
22
|
const Component = href != null ? "a" : "div";
|
|
26
|
-
return /* @__PURE__ */ jsxRuntime.jsx("li", { id, className: cx(classes.root, className), "aria-current": selected, children: /* @__PURE__ */ jsxRuntime.
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { id, className: cx(classes.root, className), "aria-current": selected, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27
24
|
Component,
|
|
28
25
|
{
|
|
29
26
|
id: buttonId,
|
|
30
27
|
role: href == null ? "button" : void 0,
|
|
31
28
|
tabIndex: 0,
|
|
32
|
-
onClick,
|
|
33
|
-
onKeyDown,
|
|
34
29
|
className: classes.button,
|
|
35
|
-
"aria-labelledby": labelId,
|
|
36
30
|
href,
|
|
37
31
|
...others,
|
|
38
|
-
children:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
34
|
+
OverflowTooltip.HvOverflowTooltip,
|
|
35
|
+
{
|
|
36
|
+
className: cx(classes.text, { [classes.selected]: selected }),
|
|
37
|
+
placement: tooltipPlacement,
|
|
38
|
+
data: label
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
"aria-hidden": true,
|
|
45
|
+
className: cx(classes.bullet, iconClasses, {
|
|
46
|
+
[classes.bulletSelected]: selected
|
|
47
|
+
}),
|
|
48
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", {})
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
]
|
|
47
52
|
}
|
|
48
53
|
) });
|
|
49
54
|
};
|
package/dist/cjs/ScrollTo/Horizontal/HorizontalScrollListItem/HorizontalScrollListItem.styles.cjs
CHANGED
|
@@ -6,49 +6,44 @@ const focusUtils = require("../../../utils/focusUtils.cjs");
|
|
|
6
6
|
const name = "HvHorizontalScrollListItem";
|
|
7
7
|
const { staticClasses, useClasses } = classes.createClasses(name, {
|
|
8
8
|
root: {
|
|
9
|
-
padding: "
|
|
9
|
+
padding: uikitStyles.theme.spacing("xs", 0),
|
|
10
|
+
maxWidth: 120
|
|
10
11
|
},
|
|
11
12
|
button: {
|
|
12
13
|
display: "flex",
|
|
14
|
+
flexDirection: "column",
|
|
13
15
|
justifyContent: "center",
|
|
14
16
|
alignItems: "center",
|
|
15
|
-
height: "48px",
|
|
16
|
-
cursor: "pointer",
|
|
17
|
-
borderBottom: "none",
|
|
18
|
-
"&:hover": {
|
|
19
|
-
backgroundColor: "transparent",
|
|
20
|
-
"& $notSelected": {
|
|
21
|
-
height: "6px",
|
|
22
|
-
width: "6px",
|
|
23
|
-
backgroundColor: uikitStyles.theme.colors.secondary
|
|
24
|
-
},
|
|
25
|
-
"& $notSelectedRoot": {
|
|
26
|
-
backgroundColor: uikitStyles.theme.colors.containerBackgroundHover
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"&:focus": {
|
|
30
|
-
outline: "none"
|
|
31
|
-
},
|
|
32
17
|
"&:focus-visible": {
|
|
33
18
|
...focusUtils.outlineStyles
|
|
34
19
|
}
|
|
35
20
|
},
|
|
36
21
|
text: {
|
|
22
|
+
margin: uikitStyles.theme.spacing("xs", "xs", "0")
|
|
23
|
+
},
|
|
24
|
+
selected: {
|
|
25
|
+
fontWeight: uikitStyles.theme.typography.label.fontWeight
|
|
26
|
+
},
|
|
27
|
+
bullet: {
|
|
37
28
|
display: "flex",
|
|
38
|
-
flexDirection: "column",
|
|
39
|
-
alignItems: "center",
|
|
40
29
|
justifyContent: "center",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
minHeight: 24,
|
|
32
|
+
height: 24,
|
|
33
|
+
width: 24,
|
|
34
|
+
fontSize: 4,
|
|
35
|
+
color: uikitStyles.theme.colors.secondary_60,
|
|
36
|
+
"& > span": {
|
|
37
|
+
margin: "auto",
|
|
38
|
+
width: "1em",
|
|
39
|
+
height: "1em",
|
|
40
|
+
backgroundColor: "currentcolor",
|
|
41
|
+
borderRadius: "50%"
|
|
48
42
|
}
|
|
49
43
|
},
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
bulletSelected: {
|
|
45
|
+
fontSize: 6,
|
|
46
|
+
color: uikitStyles.theme.colors.secondary
|
|
52
47
|
}
|
|
53
48
|
});
|
|
54
49
|
exports.staticClasses = staticClasses;
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
4
|
const styles = require("@mui/material/styles");
|
|
6
5
|
const useMediaQuery = require("@mui/material/useMediaQuery");
|
|
7
|
-
const uikitReactIcons = require("@hitachivantara/uikit-react-icons");
|
|
8
6
|
const uikitStyles = require("@hitachivantara/uikit-styles");
|
|
9
7
|
const useDefaultProps = require("../../hooks/useDefaultProps.cjs");
|
|
10
|
-
const useTheme = require("../../hooks/useTheme.cjs");
|
|
11
|
-
const useUniqueId = require("../../hooks/useUniqueId.cjs");
|
|
12
8
|
const keyboardUtils = require("../../utils/keyboardUtils.cjs");
|
|
13
9
|
const setId = require("../../utils/setId.cjs");
|
|
14
10
|
const useScrollTo = require("../useScrollTo.cjs");
|
|
15
|
-
const withTooltip = require("../withTooltip.cjs");
|
|
16
11
|
const ScrollToHorizontal_styles = require("./ScrollToHorizontal.styles.cjs");
|
|
17
12
|
const HorizontalScrollListItem = require("./HorizontalScrollListItem/HorizontalScrollListItem.cjs");
|
|
18
13
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
@@ -40,8 +35,6 @@ const HvScrollToHorizontal = (props) => {
|
|
|
40
35
|
const muiTheme = styles.useTheme();
|
|
41
36
|
const downSm = useMediaQuery__default.default(muiTheme.breakpoints.down("sm"));
|
|
42
37
|
const upMd = useMediaQuery__default.default(muiTheme.breakpoints.up("md"));
|
|
43
|
-
const { activeTheme } = useTheme.useTheme();
|
|
44
|
-
const elementId = useUniqueId.useUniqueId(id);
|
|
45
38
|
const [selectedIndex, setScrollTo, elements] = useScrollTo.useScrollTo(
|
|
46
39
|
defaultSelectedIndex,
|
|
47
40
|
scrollElementId,
|
|
@@ -51,65 +44,34 @@ const HvScrollToHorizontal = (props) => {
|
|
|
51
44
|
options,
|
|
52
45
|
onChange
|
|
53
46
|
);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const Selected = React.useCallback(() => {
|
|
70
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
71
|
-
uikitReactIcons.CurrentStep,
|
|
72
|
-
{
|
|
73
|
-
height: activeTheme?.scrollTo.dotSelectedSize,
|
|
74
|
-
width: activeTheme?.scrollTo.dotSelectedSize,
|
|
75
|
-
className: classes.selected
|
|
76
|
-
}
|
|
77
|
-
);
|
|
78
|
-
}, [classes.selected, activeTheme?.scrollTo.dotSelectedSize]);
|
|
79
|
-
const tabs = elements.map((option, index) => {
|
|
80
|
-
const selected = selectedIndex === index;
|
|
81
|
-
const tooltipWrapper = tooltipWrappers[index];
|
|
82
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
83
|
-
HorizontalScrollListItem.HvHorizontalScrollListItem,
|
|
84
|
-
{
|
|
85
|
-
id: setId.setId(elementId, `item-${index}`),
|
|
86
|
-
onClick: (event) => {
|
|
87
|
-
if (navigationMode !== "none") {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
}
|
|
90
|
-
handleSelection(event, option.value, index);
|
|
91
|
-
onClick?.(event, index);
|
|
92
|
-
},
|
|
93
|
-
onKeyDown: (event) => {
|
|
94
|
-
if (keyboardUtils.isKey(event, "Enter") === true) {
|
|
95
|
-
if (navigationMode !== "none") {
|
|
96
|
-
event.preventDefault();
|
|
97
|
-
}
|
|
98
|
-
handleSelection(event, option.value, index);
|
|
99
|
-
onEnter?.(event, index);
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
href: navigationMode !== "none" ? option.href : void 0,
|
|
103
|
-
tooltipWrapper,
|
|
104
|
-
selected,
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { children: option.label }),
|
|
107
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(Selected, {}) : /* @__PURE__ */ jsxRuntime.jsx(NotSelected, {})
|
|
108
|
-
]
|
|
47
|
+
const tabs = elements.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
48
|
+
HorizontalScrollListItem.HvHorizontalScrollListItem,
|
|
49
|
+
{
|
|
50
|
+
id: setId.setId(id, `item-${index}`),
|
|
51
|
+
onClick: (event) => {
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
54
|
+
onClick?.(event, index);
|
|
55
|
+
},
|
|
56
|
+
onKeyDown: (event) => {
|
|
57
|
+
if (keyboardUtils.isKey(event, "Enter") !== true)
|
|
58
|
+
return;
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
61
|
+
onEnter?.(event, index);
|
|
109
62
|
},
|
|
110
|
-
option.
|
|
111
|
-
|
|
112
|
-
|
|
63
|
+
href: navigationMode !== "none" ? option.href : void 0,
|
|
64
|
+
tooltipPlacement: tooltipPosition,
|
|
65
|
+
selected: selectedIndex === index,
|
|
66
|
+
label: option.label,
|
|
67
|
+
iconClasses: cx({
|
|
68
|
+
[classes.selected]: selectedIndex === index,
|
|
69
|
+
[classes.notSelected]: selectedIndex !== index,
|
|
70
|
+
[classes.notSelectedRoot]: selectedIndex !== index
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
option.key || option.label
|
|
74
|
+
));
|
|
113
75
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
114
76
|
"ol",
|
|
115
77
|
{
|
|
@@ -128,7 +90,7 @@ const HvScrollToHorizontal = (props) => {
|
|
|
128
90
|
},
|
|
129
91
|
className
|
|
130
92
|
),
|
|
131
|
-
id
|
|
93
|
+
id,
|
|
132
94
|
...others,
|
|
133
95
|
children: tabs
|
|
134
96
|
}
|
|
@@ -25,26 +25,9 @@ const { staticClasses, useClasses } = classes.createClasses(
|
|
|
25
25
|
top: 0,
|
|
26
26
|
left: 0
|
|
27
27
|
},
|
|
28
|
-
notSelectedRoot: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
height: "16px",
|
|
33
|
-
width: "16px",
|
|
34
|
-
borderRadius: "50%"
|
|
35
|
-
},
|
|
36
|
-
notSelected: {
|
|
37
|
-
height: "4px",
|
|
38
|
-
width: "4px",
|
|
39
|
-
borderRadius: "50%",
|
|
40
|
-
display: "inline-block",
|
|
41
|
-
backgroundColor: uikitStyles.theme.colors.secondary_60
|
|
42
|
-
},
|
|
43
|
-
selected: {
|
|
44
|
-
display: "flex",
|
|
45
|
-
height: "16px",
|
|
46
|
-
width: "16px"
|
|
47
|
-
}
|
|
28
|
+
notSelectedRoot: {},
|
|
29
|
+
notSelected: {},
|
|
30
|
+
selected: {}
|
|
48
31
|
}
|
|
49
32
|
);
|
|
50
33
|
exports.staticClasses = staticClasses;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const useDefaultProps = require("../../hooks/useDefaultProps.cjs");
|
|
5
|
-
const useUniqueId = require("../../hooks/useUniqueId.cjs");
|
|
6
5
|
const keyboardUtils = require("../../utils/keyboardUtils.cjs");
|
|
7
6
|
const setId = require("../../utils/setId.cjs");
|
|
8
7
|
const useScrollTo = require("../useScrollTo.cjs");
|
|
@@ -29,7 +28,6 @@ const HvScrollToVertical = (props) => {
|
|
|
29
28
|
...others
|
|
30
29
|
} = useDefaultProps.useDefaultProps("HvScrollToVertical", props);
|
|
31
30
|
const { classes, cx } = ScrollToVertical_styles.useClasses(classesProp);
|
|
32
|
-
const elementId = useUniqueId.useUniqueId(id);
|
|
33
31
|
const [selectedIndex, setScrollTo, elements] = useScrollTo.useScrollTo(
|
|
34
32
|
defaultSelectedIndex,
|
|
35
33
|
scrollElementId,
|
|
@@ -39,32 +37,21 @@ const HvScrollToVertical = (props) => {
|
|
|
39
37
|
options,
|
|
40
38
|
onChange
|
|
41
39
|
);
|
|
42
|
-
const handleSelection = (event, value, index) => {
|
|
43
|
-
event.preventDefault();
|
|
44
|
-
const wrappedOnChange = () => {
|
|
45
|
-
onChange?.(event, index);
|
|
46
|
-
};
|
|
47
|
-
setScrollTo(event, value, index, wrappedOnChange);
|
|
48
|
-
};
|
|
49
40
|
const tabs = elements.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
50
41
|
VerticalScrollListItem.HvVerticalScrollListItem,
|
|
51
42
|
{
|
|
52
|
-
id: setId.setId(
|
|
43
|
+
id: setId.setId(id, `item-${index}`),
|
|
53
44
|
onClick: (event) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
handleSelection(event, option.value, index);
|
|
45
|
+
event.preventDefault();
|
|
46
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
58
47
|
onClick?.(event, index);
|
|
59
48
|
},
|
|
60
49
|
onKeyDown: (event) => {
|
|
61
|
-
if (keyboardUtils.isKey(event, "Enter")
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
onEnter?.(event, index);
|
|
67
|
-
}
|
|
50
|
+
if (keyboardUtils.isKey(event, "Enter") !== true)
|
|
51
|
+
return;
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
setScrollTo(event, option.value, index, () => onChange?.(event, index));
|
|
54
|
+
onEnter?.(event, index);
|
|
68
55
|
},
|
|
69
56
|
href: navigationMode !== "none" ? option.href : void 0,
|
|
70
57
|
tooltipPlacement: tooltipPosition,
|
|
@@ -86,7 +73,7 @@ const HvScrollToVertical = (props) => {
|
|
|
86
73
|
className
|
|
87
74
|
),
|
|
88
75
|
style: { top: `calc(50% - ${positionOffset}px)`, ...style },
|
|
89
|
-
id
|
|
76
|
+
id,
|
|
90
77
|
...others,
|
|
91
78
|
children: tabs
|
|
92
79
|
}
|