@loadsmart/loadsmart-ui 8.0.0 → 8.0.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/DragDropFile.context-oKnUu6d3.js.map +1 -1
- package/dist/common/BackButton/BackButton.d.ts +2 -1
- package/dist/common/CloseButton/CloseButton.d.ts +3 -2
- package/dist/common/SelectionWrapper.d.ts +8 -8
- package/dist/components/Accordion/Accordion.context.d.ts +6 -6
- package/dist/components/Accordion/Accordion.d.ts +11 -11
- package/dist/components/Accordion/Accordion.stories.d.ts +5 -4
- package/dist/components/Banner/Banner.d.ts +14 -14
- package/dist/components/Banner/Banner.stories.d.ts +11 -11
- package/dist/components/Breadcrumbs/Breadcrumb.d.ts +5 -5
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -6
- package/dist/components/Button/Button.d.ts +8 -8
- package/dist/components/Button/Button.stories.d.ts +7 -7
- package/dist/components/Calendar/Calendar.d.ts +3 -2
- package/dist/components/Calendar/Calendar.stories.d.ts +3 -2
- package/dist/components/Calendar/Calendar.types.d.ts +4 -4
- package/dist/components/Calendar/Date.helper.d.ts +27 -54
- package/dist/components/Calendar/DateFormat.helper.d.ts +1 -3
- package/dist/components/Calendar/Month.helper.d.ts +5 -5
- package/dist/components/Calendar/PickerModeToggle.d.ts +2 -1
- package/dist/components/Calendar/Pickers/DayPicker.d.ts +2 -1
- package/dist/components/Calendar/Pickers/MonthPicker.d.ts +2 -1
- package/dist/components/Calendar/Pickers/YearPicker.d.ts +2 -1
- package/dist/components/Calendar/useCalendar.d.ts +4 -9
- package/dist/components/Card/Card.d.ts +5 -5
- package/dist/components/Card/CardTitle.d.ts +3 -3
- package/dist/components/Checkbox/Checkbox.d.ts +6 -6
- package/dist/components/Checkbox/Checkbox.stories.d.ts +2 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -2
- package/dist/components/DatePicker/DatePicker.stories.d.ts +2 -1
- package/dist/components/DatePicker/DateRangePicker.d.ts +2 -1
- package/dist/components/DatePicker/DateRangePicker.stories.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts +13 -13
- package/dist/components/Dialog/Dialog.stories.d.ts +10 -9
- package/dist/components/DragDropFile/DragDropFile.context.d.ts +1 -1
- package/dist/components/DragDropFile/DragDropFile.d.ts +2 -2
- package/dist/components/DragDropFile/DragDropFile.stories.d.ts +5 -4
- package/dist/components/DragDropFile/components/DropZone.d.ts +2 -1
- package/dist/components/DragDropFile/components/FileItem.d.ts +2 -1
- package/dist/components/DragDropFile/components/FileList.d.ts +2 -1
- package/dist/components/DragDropFile/types.d.ts +4 -4
- package/dist/components/Drawer/Drawer.d.ts +7 -7
- package/dist/components/Dropdown/Dropdown.d.ts +2 -5
- package/dist/components/Dropdown/Dropdown.types.d.ts +1 -1
- package/dist/components/Dropdown/DropdownMenu.d.ts +2 -2
- package/dist/components/Dropdown/DropdownTrigger.d.ts +9 -9
- package/dist/components/EmptyState/EmptyState.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.stories.d.ts +8 -7
- package/dist/components/EmptyState/EmptyState.types.d.ts +2 -2
- package/dist/components/EmptyState/index.d.ts +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +3 -2
- package/dist/components/HighlightMatch/HighlightMatch.d.ts +4 -4
- package/dist/components/IconFactory/IconFactory.d.ts +8 -8
- package/dist/components/IconFactory/IconFactory.fixtures.d.ts +6 -6
- package/dist/components/Label/Label.d.ts +9 -9
- package/dist/components/Label/Label.stories.d.ts +2 -1
- package/dist/components/Layout/Box.d.ts +8 -9
- package/dist/components/Layout/Grid.d.ts +4 -5
- package/dist/components/Layout/Group.d.ts +5 -6
- package/dist/components/Layout/Layout.stories.d.ts +8 -7
- package/dist/components/Layout/Sidebar.d.ts +6 -7
- package/dist/components/Layout/Stack.d.ts +5 -6
- package/dist/components/Layout/Switcher.d.ts +5 -6
- package/dist/components/Link/Link.d.ts +3 -3
- package/dist/components/Link/Link.stories.d.ts +2 -1
- package/dist/components/Loaders/LoadingBar.d.ts +6 -6
- package/dist/components/Loaders/LoadingDots.d.ts +4 -3
- package/dist/components/Loaders/Spinner.d.ts +4 -3
- package/dist/components/Modal/Modal.d.ts +3 -3
- package/dist/components/Modal/Modal.stories.d.ts +4 -3
- package/dist/components/Pagination/Pagination.d.ts +2 -1
- package/dist/components/Pagination/Pagination.types.d.ts +4 -4
- package/dist/components/Pagination/PaginationItem.d.ts +2 -1
- package/dist/components/Popover/Popover.d.ts +4 -3
- package/dist/components/ProgressBar/ProgressBar.d.ts +6 -6
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +2 -1
- package/dist/components/Radio/Radio.d.ts +6 -6
- package/dist/components/Radio/Radio.stories.d.ts +2 -1
- package/dist/components/Section/Section.d.ts +4 -4
- package/dist/components/Section/Sections.stories.d.ts +2 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Select/Select.fixtures.d.ts +4 -4
- package/dist/components/Select/Select.types.d.ts +14 -14
- package/dist/components/Select/SelectCreatableOption.d.ts +2 -1
- package/dist/components/Select/SelectEmpty.d.ts +2 -1
- package/dist/components/Select/SelectOption.d.ts +2 -1
- package/dist/components/Select/useSelect.d.ts +0 -2
- package/dist/components/SideNavigation/Logo/Logo.d.ts +4 -4
- package/dist/components/SideNavigation/Menu/Menu.d.ts +5 -5
- package/dist/components/SideNavigation/Menu/MenuBaseItem.d.ts +7 -7
- package/dist/components/SideNavigation/Menu/MenuExpandable.d.ts +3 -3
- package/dist/components/SideNavigation/Menu/MenuLink.d.ts +5 -5
- package/dist/components/SideNavigation/Separator/Separator.d.ts +3 -2
- package/dist/components/SideNavigation/SideNavigation.d.ts +13 -13
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +2 -1
- package/dist/components/Steps/ProgressSteps/ProgressStep.d.ts +5 -5
- package/dist/components/Steps/ProgressSteps/ProgressSteps.d.ts +4 -3
- package/dist/components/Steps/Steps.d.ts +7 -7
- package/dist/components/Steps/Steps.types.d.ts +2 -2
- package/dist/components/Steps/StepsStep.d.ts +4 -4
- package/dist/components/Steps/useSteps.d.ts +2 -2
- package/dist/components/Switch/Switch.d.ts +6 -6
- package/dist/components/Table/Selection.d.ts +5 -5
- package/dist/components/Table/Table.d.ts +14 -13
- package/dist/components/Table/Table.stories.d.ts +7 -6
- package/dist/components/Table/Table.types.d.ts +5 -5
- package/dist/components/Table/TableSortHandle.d.ts +3 -2
- package/dist/components/Table/useSortBy.d.ts +3 -3
- package/dist/components/TablePagination/RowsPerPage.d.ts +2 -1
- package/dist/components/TablePagination/TablePagination.d.ts +2 -1
- package/dist/components/TablePagination/TablePaginationActions.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +10 -10
- package/dist/components/Tabs/Tabs.stories.d.ts +3 -2
- package/dist/components/Tag/Tag.d.ts +11 -11
- package/dist/components/Tag/Tag.stories.d.ts +5 -5
- package/dist/components/TextField/TextField.d.ts +7 -7
- package/dist/components/TextField/TextField.stories.d.ts +2 -1
- package/dist/components/Textarea/Textarea.d.ts +7 -7
- package/dist/components/Textarea/Textarea.stories.d.ts +2 -1
- package/dist/components/Toast/Toast.d.ts +7 -7
- package/dist/components/Toast/Toast.stories.d.ts +2 -1
- package/dist/components/ToggleGroup/Toggle.d.ts +2 -1
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +3 -2
- package/dist/components/Tooltip/Tooltip.d.ts +6 -6
- package/dist/components/Tooltip/Tooltip.stories.d.ts +4 -3
- package/dist/components/TopNavigation/Logo/Logo.d.ts +4 -4
- package/dist/components/TopNavigation/Menu/Menu.d.ts +7 -7
- package/dist/components/TopNavigation/Menu/MenuItemDropdown.d.ts +8 -8
- package/dist/components/TopNavigation/Menu/MenuItemIcon.d.ts +7 -7
- package/dist/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.d.ts +6 -5
- package/dist/components/TopNavigation/TopNavigation.d.ts +5 -5
- package/dist/components/TopNavigation/TopNavigation.stories.d.ts +2 -1
- package/dist/components/VisuallyHidden/VisuallyHidden.stories.d.ts +2 -1
- package/dist/hooks/useDidMount/useDidMount.d.ts +1 -1
- package/dist/hooks/useFingerprint/useFingerprint.d.ts +0 -1
- package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +7 -8
- package/dist/hooks/useFocusWithin/useFocusWithin.d.ts +1 -1
- package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.d.ts +3 -3
- package/dist/hooks/useSelectable/SelectableStrategy.d.ts +4 -4
- package/dist/hooks/useSelectable/useSelectable.types.d.ts +2 -2
- package/dist/index.js +316 -257
- package/dist/index.js.map +1 -1
- package/dist/{miranda-compatibility.theme-kYNEZ7mW.js → miranda-compatibility.theme-CIu9fa89.js} +2 -2
- package/dist/miranda-compatibility.theme-CIu9fa89.js.map +1 -0
- package/dist/{prop-K2Z3EsyG.js → prop-Fs2axl9W.js} +12 -18
- package/dist/prop-Fs2axl9W.js.map +1 -0
- package/dist/styles/activatable.d.ts +2 -3
- package/dist/styles/disableable.d.ts +3 -3
- package/dist/styles/ellipsizable.d.ts +1 -2
- package/dist/styles/focusable.d.ts +3 -3
- package/dist/styles/font.d.ts +0 -1
- package/dist/styles/hidden.d.ts +1 -2
- package/dist/styles/hoverable.d.ts +3 -3
- package/dist/styles/transition.d.ts +0 -1
- package/dist/styles/typography.d.ts +6 -7
- package/dist/testing/DatePickerEvent/DatePickerEvent.d.ts +7 -12
- package/dist/testing/DatePickerEvent/DateRangePickerEvent.d.ts +7 -12
- package/dist/testing/SelectEvent/SelectEvent.d.ts +11 -19
- package/dist/testing/getInterpolatedStyles/getInterpolatedStyles.d.ts +2 -2
- package/dist/testing/index.js +7 -9
- package/dist/testing/index.js.map +1 -1
- package/dist/tests/generator.d.ts +2 -2
- package/dist/tests/renderer.d.ts +5 -4
- package/dist/theming/index.d.ts +3 -3
- package/dist/theming/index.js +2 -2
- package/dist/theming/index.js.map +1 -1
- package/dist/theming/theming.helpers.d.ts +2 -2
- package/dist/toArray-BJJzFRD1.js +13 -0
- package/dist/toArray-BJJzFRD1.js.map +1 -0
- package/dist/tools/conditional.d.ts +3 -3
- package/dist/tools/index.js +1 -1
- package/dist/tools/prop.d.ts +1 -1
- package/dist/utils/toolset/getID.d.ts +0 -6
- package/dist/utils/toolset/highlightMatch.d.ts +5 -6
- package/dist/utils/toolset/keyboard.d.ts +3 -4
- package/dist/utils/toolset/toArray.d.ts +7 -1
- package/package.json +53 -56
- package/dist/miranda-compatibility.theme-kYNEZ7mW.js.map +0 -1
- package/dist/prop-K2Z3EsyG.js.map +0 -1
- package/dist/toArray-Dxb1kUxx.js +0 -14
- package/dist/toArray-Dxb1kUxx.js.map +0 -1
- package/dist/utils/toolset/flatten.d.ts +0 -2
- package/dist/utils/toolset/isThenable.d.ts +0 -5
- package/dist/utils/toolset/isThenable.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import React__default, { forwardRef,
|
|
2
|
+
import React__default, { forwardRef, useState, useRef, useCallback, useEffect, createContext, useMemo, useReducer, useContext, useLayoutEffect, Fragment, Children as Children$5, isValidElement } from "react";
|
|
3
3
|
import styled, { css, keyframes, useTheme } from "styled-components";
|
|
4
4
|
import { getToken } from "./theming/index.js";
|
|
5
|
-
import { isEmpty,
|
|
6
|
-
import { t as toArray } from "./toArray-
|
|
7
|
-
import { c as conditional, w as whenProps, p as prop } from "./prop-
|
|
8
|
-
import { r as rem, B as BASE_PIXELS } from "./miranda-compatibility.theme-
|
|
5
|
+
import { isEmpty, omit, get, range } from "lodash-es";
|
|
6
|
+
import { t as toArray } from "./toArray-BJJzFRD1.js";
|
|
7
|
+
import { c as conditional, w as whenProps, p as prop } from "./prop-Fs2axl9W.js";
|
|
8
|
+
import { r as rem, B as BASE_PIXELS } from "./miranda-compatibility.theme-CIu9fa89.js";
|
|
9
9
|
import { isFunction, identity } from "@loadsmart/utils-function";
|
|
10
10
|
import clsx from "clsx";
|
|
11
11
|
import { isBlank } from "@loadsmart/utils-string";
|
|
12
|
-
import { isNil
|
|
12
|
+
import { isNil } from "@loadsmart/utils-object";
|
|
13
13
|
import ReactDOM from "react-dom";
|
|
14
14
|
import { useFloating, autoUpdate, offset, flip, shift, arrow } from "@floating-ui/react-dom";
|
|
15
15
|
import { u as useDragDropFileContext } from "./DragDropFile.context-oKnUu6d3.js";
|
|
@@ -33,8 +33,10 @@ function UnknownIcon() {
|
|
|
33
33
|
}
|
|
34
34
|
function IconFactory(map) {
|
|
35
35
|
function getIcon(name) {
|
|
36
|
-
name =
|
|
37
|
-
if (!(name in map))
|
|
36
|
+
name = (name ?? "").toLowerCase();
|
|
37
|
+
if (!(name in map)) {
|
|
38
|
+
return UnknownIcon;
|
|
39
|
+
}
|
|
38
40
|
return map[name];
|
|
39
41
|
}
|
|
40
42
|
return function Icon2(props) {
|
|
@@ -101,15 +103,17 @@ function interleave(array1, array2) {
|
|
|
101
103
|
const safeArray2 = toArray(array2);
|
|
102
104
|
if (isEmpty(safeArray1) && isEmpty(safeArray2)) {
|
|
103
105
|
return [];
|
|
104
|
-
}
|
|
106
|
+
}
|
|
107
|
+
if (isEmpty(safeArray1)) {
|
|
105
108
|
return safeArray2;
|
|
106
|
-
}
|
|
109
|
+
}
|
|
110
|
+
if (isEmpty(safeArray2)) {
|
|
107
111
|
return safeArray1;
|
|
108
112
|
}
|
|
109
|
-
return
|
|
113
|
+
return safeArray1.flatMap((element, index) => [element, safeArray2[index]]);
|
|
110
114
|
}
|
|
111
|
-
function activatableStyle(strings, ...args) {
|
|
112
|
-
const safeStrings =
|
|
115
|
+
function activatableStyle(strings = [], ...args) {
|
|
116
|
+
const safeStrings = strings.concat();
|
|
113
117
|
return [`
|
|
114
118
|
&:enabled:not(.is-disabled) {
|
|
115
119
|
&:active {`, ...interleave(safeStrings, args), `
|
|
@@ -117,8 +121,8 @@ function activatableStyle(strings, ...args) {
|
|
|
117
121
|
}
|
|
118
122
|
`];
|
|
119
123
|
}
|
|
120
|
-
function disableableStyle(strings, ...args) {
|
|
121
|
-
const safeStrings =
|
|
124
|
+
function disableableStyle(strings = [], ...args) {
|
|
125
|
+
const safeStrings = strings.concat();
|
|
122
126
|
return [`
|
|
123
127
|
&.is-disabled,
|
|
124
128
|
&:disabled {
|
|
@@ -148,8 +152,8 @@ function ellipsizableStyle() {
|
|
|
148
152
|
white-space: nowrap;
|
|
149
153
|
`;
|
|
150
154
|
}
|
|
151
|
-
function focusableStyle(strings, ...args) {
|
|
152
|
-
const safeStrings =
|
|
155
|
+
function focusableStyle(strings = [], ...args) {
|
|
156
|
+
const safeStrings = strings.concat();
|
|
153
157
|
return [`
|
|
154
158
|
outline: none;
|
|
155
159
|
|
|
@@ -160,8 +164,8 @@ function focusableStyle(strings, ...args) {
|
|
|
160
164
|
}
|
|
161
165
|
`];
|
|
162
166
|
}
|
|
163
|
-
function hoverableStyle(strings, ...args) {
|
|
164
|
-
const safeStrings =
|
|
167
|
+
function hoverableStyle(strings = [], ...args) {
|
|
168
|
+
const safeStrings = strings.concat();
|
|
165
169
|
return [`
|
|
166
170
|
&:not(.is-disabled):not(:disabled) {
|
|
167
171
|
&:hover {`, ...interleave(safeStrings, args), `
|
|
@@ -577,7 +581,7 @@ Layout.Box = Box$1;
|
|
|
577
581
|
Layout.Sidebar = Sidebar;
|
|
578
582
|
Layout.Switcher = Switcher;
|
|
579
583
|
Layout.Grid = Grid$1;
|
|
580
|
-
const loading = keyframes`
|
|
584
|
+
const loading = keyframes`from{width:0}to{width:100%}`;
|
|
581
585
|
const Bar$1 = styled.div.withConfig({
|
|
582
586
|
displayName: "Bar",
|
|
583
587
|
componentId: "ls-ui__sc-hqt3sp-0"
|
|
@@ -590,7 +594,7 @@ function LoadingBar({
|
|
|
590
594
|
alignment,
|
|
591
595
|
title,
|
|
592
596
|
secondaryTitle,
|
|
593
|
-
width
|
|
597
|
+
width,
|
|
594
598
|
velocity = 2.5
|
|
595
599
|
}) {
|
|
596
600
|
return /* @__PURE__ */ React__default.createElement(Layout.Box, { textAlign: alignment }, /* @__PURE__ */ React__default.createElement(Layout.Stack, { space: "s" }, title, /* @__PURE__ */ React__default.createElement(Bar$1, { width, velocity }), secondaryTitle));
|
|
@@ -1098,7 +1102,7 @@ function ButtonChildrenWrapper({
|
|
|
1098
1102
|
if (loading2) {
|
|
1099
1103
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(ButtonLoadingDots, { buttonVariant: variant }), /* @__PURE__ */ React__default.createElement(TextHidden, null, children));
|
|
1100
1104
|
}
|
|
1101
|
-
return
|
|
1105
|
+
return children;
|
|
1102
1106
|
}
|
|
1103
1107
|
const BaseButton = forwardRef(function BaseButton2({
|
|
1104
1108
|
scale = "default",
|
|
@@ -1347,7 +1351,7 @@ function Checkbox({
|
|
|
1347
1351
|
scale = "default",
|
|
1348
1352
|
...others
|
|
1349
1353
|
}) {
|
|
1350
|
-
return /* @__PURE__ */ React__default.createElement(SelectionWrapper, { scheme, scale, selector: /* @__PURE__ */ React__default.createElement(Fragment, null, /* @__PURE__ */ React__default.createElement(Selector$2, { "data-testid": "selector", ...others, scheme, disabled, type: "checkbox" }), /* @__PURE__ */ React__default.createElement(Check$1, { name: "check", size: 14, className: "check" })), leading, trailing, className: clsx({
|
|
1354
|
+
return /* @__PURE__ */ React__default.createElement(SelectionWrapper, { scheme, scale, selector: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Selector$2, { "data-testid": "selector", ...others, scheme, disabled, type: "checkbox" }), /* @__PURE__ */ React__default.createElement(Check$1, { name: "check", size: 14, className: "check" })), leading, trailing, className: clsx({
|
|
1351
1355
|
"is-disabled": disabled
|
|
1352
1356
|
}, className), "data-testid": "checkbox" }, children);
|
|
1353
1357
|
}
|
|
@@ -1435,7 +1439,7 @@ function Radio({
|
|
|
1435
1439
|
scheme = "light",
|
|
1436
1440
|
...others
|
|
1437
1441
|
}) {
|
|
1438
|
-
return /* @__PURE__ */ React__default.createElement(SelectionWrapper, { scheme, selector: /* @__PURE__ */ React__default.createElement(Fragment, null, /* @__PURE__ */ React__default.createElement(Selector$1, { "data-testid": "selector", ...others, scheme, disabled, type: "radio" }), /* @__PURE__ */ React__default.createElement(Check, { name: "circle", className: "check" })), leading, trailing, className: clsx({
|
|
1442
|
+
return /* @__PURE__ */ React__default.createElement(SelectionWrapper, { scheme, selector: /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Selector$1, { "data-testid": "selector", ...others, scheme, disabled, type: "radio" }), /* @__PURE__ */ React__default.createElement(Check, { name: "circle", className: "check" })), leading, trailing, className: clsx({
|
|
1439
1443
|
"is-disabled": disabled
|
|
1440
1444
|
}, className), "data-testid": "radio" }, children);
|
|
1441
1445
|
}
|
|
@@ -1669,14 +1673,9 @@ function useTextField({
|
|
|
1669
1673
|
value: valueProp
|
|
1670
1674
|
}) {
|
|
1671
1675
|
const [value, setValue] = useState(valueProp || "");
|
|
1672
|
-
const onChange = useCallback(function handleChange(
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
value: value2
|
|
1676
|
-
}
|
|
1677
|
-
} = e;
|
|
1678
|
-
setValue(value2);
|
|
1679
|
-
onChangeProp?.(e);
|
|
1676
|
+
const onChange = useCallback(function handleChange(event) {
|
|
1677
|
+
setValue(event.target.value);
|
|
1678
|
+
onChangeProp?.(event);
|
|
1680
1679
|
}, [onChangeProp]);
|
|
1681
1680
|
return [value, onChange];
|
|
1682
1681
|
}
|
|
@@ -1866,7 +1865,8 @@ function checkHref(props) {
|
|
|
1866
1865
|
if (isBlank(href || "")) {
|
|
1867
1866
|
return props;
|
|
1868
1867
|
}
|
|
1869
|
-
|
|
1868
|
+
const normalizedHref = (href || "").trim().replace(/^[\u0000-\u001F]+/u, "");
|
|
1869
|
+
if (INSECURE_HREF.test(normalizedHref)) {
|
|
1870
1870
|
return others;
|
|
1871
1871
|
}
|
|
1872
1872
|
return props;
|
|
@@ -2002,7 +2002,7 @@ const StyledBackButton = styled(BackButton).withConfig({
|
|
|
2002
2002
|
componentId: "ls-ui__sc-146a5ne-2"
|
|
2003
2003
|
})`margin:0 ${getToken("space-m")} 0 0;`;
|
|
2004
2004
|
function Breadcrumbs({
|
|
2005
|
-
entries
|
|
2005
|
+
entries,
|
|
2006
2006
|
onBack,
|
|
2007
2007
|
disabled,
|
|
2008
2008
|
...others
|
|
@@ -2023,24 +2023,6 @@ const GenericAdapter$1 = {
|
|
|
2023
2023
|
return get(o, "value");
|
|
2024
2024
|
}
|
|
2025
2025
|
};
|
|
2026
|
-
function createSelectionStrategy(props) {
|
|
2027
|
-
const {
|
|
2028
|
-
adapters,
|
|
2029
|
-
multiple
|
|
2030
|
-
} = props;
|
|
2031
|
-
const context = {
|
|
2032
|
-
getAdapter(type) {
|
|
2033
|
-
if (type == null) {
|
|
2034
|
-
return GenericAdapter$1;
|
|
2035
|
-
}
|
|
2036
|
-
return adapters[type] || GenericAdapter$1;
|
|
2037
|
-
}
|
|
2038
|
-
};
|
|
2039
|
-
if (multiple) {
|
|
2040
|
-
return MultipleSelectionStrategy(context);
|
|
2041
|
-
}
|
|
2042
|
-
return SingleSelectionStrategy(context);
|
|
2043
|
-
}
|
|
2044
2026
|
function SingleSelectionStrategy(context) {
|
|
2045
2027
|
return {
|
|
2046
2028
|
type() {
|
|
@@ -2120,6 +2102,24 @@ function MultipleSelectionStrategy(context) {
|
|
|
2120
2102
|
}
|
|
2121
2103
|
};
|
|
2122
2104
|
}
|
|
2105
|
+
function createSelectionStrategy(props) {
|
|
2106
|
+
const {
|
|
2107
|
+
adapters,
|
|
2108
|
+
multiple
|
|
2109
|
+
} = props;
|
|
2110
|
+
const context = {
|
|
2111
|
+
getAdapter(type) {
|
|
2112
|
+
if (type == null) {
|
|
2113
|
+
return GenericAdapter$1;
|
|
2114
|
+
}
|
|
2115
|
+
return adapters[type] || GenericAdapter$1;
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
if (multiple) {
|
|
2119
|
+
return MultipleSelectionStrategy(context);
|
|
2120
|
+
}
|
|
2121
|
+
return SingleSelectionStrategy(context);
|
|
2122
|
+
}
|
|
2123
2123
|
const MAX_LENGTH = 15;
|
|
2124
2124
|
const INITIAL_LENGTH = 2;
|
|
2125
2125
|
const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-";
|
|
@@ -2129,7 +2129,11 @@ function IDGenerator({
|
|
|
2129
2129
|
alphabet
|
|
2130
2130
|
}) {
|
|
2131
2131
|
let currentLength = initialIDLength;
|
|
2132
|
-
let filledCharacters = [...Array
|
|
2132
|
+
let filledCharacters = [...Array.from({
|
|
2133
|
+
length: maxIDLength - currentLength
|
|
2134
|
+
}).fill(-1), ...Array.from({
|
|
2135
|
+
length: currentLength
|
|
2136
|
+
}).fill(0)];
|
|
2133
2137
|
let availableIDs = range(initialIDLength, maxIDLength + 1).reduce(
|
|
2134
2138
|
// using arrangement with repetition formula
|
|
2135
2139
|
(acc, n) => acc + Math.pow(alphabet.length, n),
|
|
@@ -2160,9 +2164,9 @@ const getID = IDGenerator({
|
|
|
2160
2164
|
function useFingerprint(adapter, items) {
|
|
2161
2165
|
const knownRef = useRef({});
|
|
2162
2166
|
const [fingerprint, setFingerprint] = useState(() => getFingerprint("", items, true));
|
|
2163
|
-
function getFingerprint(currentFingerprint,
|
|
2167
|
+
function getFingerprint(currentFingerprint, fingerprintItems, update = false) {
|
|
2164
2168
|
const known = knownRef.current;
|
|
2165
|
-
const safeItems =
|
|
2169
|
+
const safeItems = fingerprintItems ?? [];
|
|
2166
2170
|
let newKnown = {};
|
|
2167
2171
|
let hasSameItems = Object.keys(known).length === safeItems.length;
|
|
2168
2172
|
for (let i = 0; i < safeItems.length; i++) {
|
|
@@ -2181,23 +2185,20 @@ function useFingerprint(adapter, items) {
|
|
|
2181
2185
|
if (update) {
|
|
2182
2186
|
knownRef.current = newKnown;
|
|
2183
2187
|
}
|
|
2184
|
-
|
|
2185
|
-
return `${
|
|
2188
|
+
return Object.keys(newKnown).sort().reduce((computedSignature, item) => {
|
|
2189
|
+
return `${computedSignature}${newKnown[item]}`;
|
|
2186
2190
|
}, "");
|
|
2187
|
-
return fingerprint2;
|
|
2188
2191
|
}
|
|
2189
2192
|
return {
|
|
2190
2193
|
fingerprint,
|
|
2191
|
-
getFingerprint(
|
|
2192
|
-
return getFingerprint(fingerprint,
|
|
2194
|
+
getFingerprint(fingerprintItems, update = false) {
|
|
2195
|
+
return getFingerprint(fingerprint, fingerprintItems, update);
|
|
2193
2196
|
},
|
|
2194
|
-
resetFingerprint(
|
|
2195
|
-
setFingerprint(getFingerprint(fingerprint,
|
|
2197
|
+
resetFingerprint(fingerprintItems) {
|
|
2198
|
+
setFingerprint(getFingerprint(fingerprint, fingerprintItems, true));
|
|
2196
2199
|
},
|
|
2197
2200
|
/**
|
|
2198
2201
|
* Check if the provided items have the same fingerprint.
|
|
2199
|
-
* @param {string[]} otherItems - items
|
|
2200
|
-
* @returns {boolean}
|
|
2201
2202
|
*/
|
|
2202
2203
|
hasSameFingerprint(otherItems) {
|
|
2203
2204
|
return fingerprint === getFingerprint(fingerprint, otherItems);
|
|
@@ -2501,7 +2502,7 @@ function Toggle({
|
|
|
2501
2502
|
const group = useContext(ToggleGroupContext);
|
|
2502
2503
|
const selectable = useContext(SelectableContext$1);
|
|
2503
2504
|
if (isEmpty(selectable)) {
|
|
2504
|
-
throw Error("A Toggle options must be rendered inside a ToggleGroup");
|
|
2505
|
+
throw new Error("A Toggle options must be rendered inside a ToggleGroup");
|
|
2505
2506
|
}
|
|
2506
2507
|
const selected = selectable.selected.has(value);
|
|
2507
2508
|
return /* @__PURE__ */ React__default.createElement(ToggleButton, { ...others, $type: selectable.type(), type: "button", role: isMultiple(selectable.type()) ? "checkbox" : "radio", "aria-checked": selected, disabled: Boolean(disabled || group.disabled), onClick: () => {
|
|
@@ -2594,29 +2595,29 @@ const Container$a = styled(Group$1).withConfig({
|
|
|
2594
2595
|
})};}`;
|
|
2595
2596
|
function fromValueToSelected(value) {
|
|
2596
2597
|
const valueAsArray = toArray(value);
|
|
2597
|
-
return valueAsArray.map((
|
|
2598
|
-
value:
|
|
2598
|
+
return valueAsArray.map((optionValue) => ({
|
|
2599
|
+
value: optionValue
|
|
2599
2600
|
}));
|
|
2600
2601
|
}
|
|
2601
2602
|
function fromSelectedToValue(selected, multiple) {
|
|
2602
2603
|
const pairs = Array.from(selected);
|
|
2603
2604
|
if (multiple) {
|
|
2604
2605
|
const value = [];
|
|
2605
|
-
for (const [,
|
|
2606
|
-
value.push(
|
|
2606
|
+
for (const [, option2] of pairs) {
|
|
2607
|
+
value.push(option2.value);
|
|
2607
2608
|
}
|
|
2608
2609
|
return value;
|
|
2609
|
-
} else {
|
|
2610
|
-
if (isEmpty(pairs)) {
|
|
2611
|
-
return null;
|
|
2612
|
-
}
|
|
2613
|
-
const [[, option]] = pairs;
|
|
2614
|
-
return option.value;
|
|
2615
2610
|
}
|
|
2611
|
+
if (isEmpty(pairs)) {
|
|
2612
|
+
return null;
|
|
2613
|
+
}
|
|
2614
|
+
const [[, option]] = pairs;
|
|
2615
|
+
return option.value;
|
|
2616
2616
|
}
|
|
2617
2617
|
const DEFAULT_SELECTED = [];
|
|
2618
2618
|
function ToggleGroup(props) {
|
|
2619
2619
|
const {
|
|
2620
|
+
value,
|
|
2620
2621
|
disabled = false,
|
|
2621
2622
|
multiple = false,
|
|
2622
2623
|
scale = "default",
|
|
@@ -2630,7 +2631,7 @@ function ToggleGroup(props) {
|
|
|
2630
2631
|
} = props;
|
|
2631
2632
|
const selectable = useSelectable$1({
|
|
2632
2633
|
multiple,
|
|
2633
|
-
selected: fromValueToSelected(
|
|
2634
|
+
selected: fromValueToSelected(value ?? DEFAULT_SELECTED),
|
|
2634
2635
|
onChange: useCallback(function handleSelectionChange(selected) {
|
|
2635
2636
|
onChange?.({
|
|
2636
2637
|
target: {
|
|
@@ -2646,14 +2647,14 @@ function ToggleGroup(props) {
|
|
|
2646
2647
|
}), id, role: multiple ? "group" : "radiogroup", align: "center", space: "xs", $multiple: multiple, $scale: scale }, /* @__PURE__ */ React__default.createElement(ToggleGroupContext.Provider, { value: {
|
|
2647
2648
|
scale,
|
|
2648
2649
|
disabled
|
|
2649
|
-
} }, /* @__PURE__ */ React__default.createElement(SelectableContext$1.Provider, { value: selectable }, children ??
|
|
2650
|
+
} }, /* @__PURE__ */ React__default.createElement(SelectableContext$1.Provider, { value: selectable }, children ?? options?.map(function renderOption(option) {
|
|
2650
2651
|
const {
|
|
2651
2652
|
label,
|
|
2652
|
-
value,
|
|
2653
|
-
...
|
|
2653
|
+
value: optionValue,
|
|
2654
|
+
...additionalProps
|
|
2654
2655
|
} = option;
|
|
2655
|
-
const key = String(
|
|
2656
|
-
return /* @__PURE__ */ React__default.createElement(Toggle$1, { key, ...
|
|
2656
|
+
const key = String(optionValue);
|
|
2657
|
+
return /* @__PURE__ */ React__default.createElement(Toggle$1, { key, ...additionalProps, disabled: Boolean(disabled || option.disabled), value: optionValue }, label);
|
|
2657
2658
|
}))));
|
|
2658
2659
|
}
|
|
2659
2660
|
ToggleGroup.Option = Toggle$1;
|
|
@@ -2763,10 +2764,10 @@ function TabsItem({
|
|
|
2763
2764
|
direction
|
|
2764
2765
|
} = useContext(TabContext);
|
|
2765
2766
|
const isActive = activeTab === name;
|
|
2766
|
-
|
|
2767
|
+
const handleSelect = (event) => {
|
|
2767
2768
|
setActiveTab(name);
|
|
2768
2769
|
onChange?.(event);
|
|
2769
|
-
}
|
|
2770
|
+
};
|
|
2770
2771
|
useEffect(() => {
|
|
2771
2772
|
if (!activeTab && isDefault) {
|
|
2772
2773
|
setActiveTab(name);
|
|
@@ -3031,7 +3032,7 @@ function AccordionBody({
|
|
|
3031
3032
|
...props
|
|
3032
3033
|
}) {
|
|
3033
3034
|
const [open] = useAccordionContext();
|
|
3034
|
-
return /* @__PURE__ */ React__default.createElement(Fragment, null, /* @__PURE__ */ React__default.createElement(HiddenInput$2, { type: "checkbox", checked: open, onChange: identity }), /* @__PURE__ */ React__default.createElement(StyledContent, { open, className: clsx({
|
|
3035
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(HiddenInput$2, { type: "checkbox", checked: open, onChange: identity }), /* @__PURE__ */ React__default.createElement(StyledContent, { open, className: clsx({
|
|
3035
3036
|
"is-open": open
|
|
3036
3037
|
}), "aria-hidden": !open ? "true" : "false", "data-testid": "accordion-content", ...props }, children));
|
|
3037
3038
|
}
|
|
@@ -3272,7 +3273,9 @@ function Banner({
|
|
|
3272
3273
|
...others
|
|
3273
3274
|
}) {
|
|
3274
3275
|
const [visible, setVisible] = useState(true);
|
|
3275
|
-
if (!visible)
|
|
3276
|
+
if (!visible) {
|
|
3277
|
+
return null;
|
|
3278
|
+
}
|
|
3276
3279
|
return /* @__PURE__ */ React__default.createElement(StyledBanner, { ...others, scale, variant }, /* @__PURE__ */ React__default.createElement(TextWrapper, null, getAlertIcon(variant, scale, icon), /* @__PURE__ */ React__default.createElement(TextSection, { $dismissible: dismissible }, scale === "default" ? React__default.isValidElement(title) ? title : /* @__PURE__ */ React__default.createElement(Title, { variant }, title) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, React__default.isValidElement(title) ? title : /* @__PURE__ */ React__default.createElement(Title, null, title), description && (React__default.isValidElement(description) ? description : /* @__PURE__ */ React__default.createElement(Description, null, description))))), dismissible && /* @__PURE__ */ React__default.createElement(CloseButton$2, { scale, onClick: () => {
|
|
3277
3280
|
onClose?.();
|
|
3278
3281
|
setVisible(false);
|
|
@@ -3289,7 +3292,9 @@ function BannerLarge({
|
|
|
3289
3292
|
...others
|
|
3290
3293
|
}) {
|
|
3291
3294
|
const [visible, setVisible] = useState(true);
|
|
3292
|
-
if (!visible)
|
|
3295
|
+
if (!visible) {
|
|
3296
|
+
return null;
|
|
3297
|
+
}
|
|
3293
3298
|
return /* @__PURE__ */ React__default.createElement(StyledBanner, { ...others, scale, variant }, getAlertIcon(variant, scale, icon), /* @__PURE__ */ React__default.createElement(TextSection, { $dismissible: dismissible }, React__default.isValidElement(title) ? title : /* @__PURE__ */ React__default.createElement(Title, null, title), React__default.isValidElement(description) ? description : /* @__PURE__ */ React__default.createElement(Description, null, description)), dismissible && /* @__PURE__ */ React__default.createElement(CloseButton$2, { scale, onClick: () => {
|
|
3294
3299
|
onClose?.();
|
|
3295
3300
|
setVisible(false);
|
|
@@ -3323,7 +3328,9 @@ function BannerActionLarge({
|
|
|
3323
3328
|
...others
|
|
3324
3329
|
}) {
|
|
3325
3330
|
const [visible, setVisible] = useState(true);
|
|
3326
|
-
if (!visible)
|
|
3331
|
+
if (!visible) {
|
|
3332
|
+
return null;
|
|
3333
|
+
}
|
|
3327
3334
|
return /* @__PURE__ */ React__default.createElement(StyledBanner, { ...others, scale, variant }, getAlertIcon(variant, scale, icon), /* @__PURE__ */ React__default.createElement(TextSection, { $dismissible: dismissible }, React__default.isValidElement(title) ? title : /* @__PURE__ */ React__default.createElement(Title, null, title), React__default.isValidElement(description) ? description : /* @__PURE__ */ React__default.createElement(Description, null, description), /* @__PURE__ */ React__default.createElement(LargeButtonWrapper, null, /* @__PURE__ */ React__default.createElement(Button$1, { scale: "small", variant: "primary", className: variant, type: "button", onClick: onActionButtonClick }, action), secondaryAction && /* @__PURE__ */ React__default.createElement(Button$1, { scale: "small", className: variant, variant: "secondary", type: "button", onClick: onSecondaryActionButtonClick }, secondaryAction))), dismissible && /* @__PURE__ */ React__default.createElement(CloseButton$2, { scale, onClick: () => {
|
|
3328
3335
|
onClose?.();
|
|
3329
3336
|
setVisible(false);
|
|
@@ -3447,14 +3454,14 @@ function DialogActions({
|
|
|
3447
3454
|
return /* @__PURE__ */ React__default.createElement(StyledDialogActions, { $scale: scale, $direction: direction }, children);
|
|
3448
3455
|
}
|
|
3449
3456
|
function DialogActionConfirm({
|
|
3450
|
-
onConfirm
|
|
3457
|
+
onConfirm,
|
|
3451
3458
|
children = "CONFIRM",
|
|
3452
3459
|
...others
|
|
3453
3460
|
}) {
|
|
3454
3461
|
return /* @__PURE__ */ React__default.createElement(ActionWrapper, null, /* @__PURE__ */ React__default.createElement(Button$3, { ...others, onClick: onConfirm, variant: "primary" }, children));
|
|
3455
3462
|
}
|
|
3456
3463
|
function DialogActionCancel({
|
|
3457
|
-
onCancel
|
|
3464
|
+
onCancel,
|
|
3458
3465
|
children = "CANCEL",
|
|
3459
3466
|
...others
|
|
3460
3467
|
}) {
|
|
@@ -3532,7 +3539,7 @@ function Popover(props) {
|
|
|
3532
3539
|
// update fixed positions after scrolling.
|
|
3533
3540
|
whileElementsMounted: autoUpdate
|
|
3534
3541
|
});
|
|
3535
|
-
const [resultPosition
|
|
3542
|
+
const [resultPosition, resultAlign] = floating.placement.split("-");
|
|
3536
3543
|
const value = useMemo(() => ({
|
|
3537
3544
|
strategy,
|
|
3538
3545
|
register: {
|
|
@@ -3698,7 +3705,7 @@ function Label({
|
|
|
3698
3705
|
tipProps = {},
|
|
3699
3706
|
...others
|
|
3700
3707
|
}) {
|
|
3701
|
-
const tag =
|
|
3708
|
+
const tag = as || "label";
|
|
3702
3709
|
return /* @__PURE__ */ React__default.createElement(StyledWrapper, { "data-testid": "label", as: tag, className: clsx(className, {
|
|
3703
3710
|
"is-disabled": disabled
|
|
3704
3711
|
}), ...others }, /* @__PURE__ */ React__default.createElement(StyledChildren, { scheme }, children), required && /* @__PURE__ */ React__default.createElement(StyledRequired, null, "*"), !isNil(tip) && /* @__PURE__ */ React__default.createElement(Tooltip, { scheme, message: tip || "", ...tipProps }, /* @__PURE__ */ React__default.createElement(StyledTooltipAnchor, { scheme }, "?")));
|
|
@@ -3866,33 +3873,38 @@ function usePagination(props) {
|
|
|
3866
3873
|
function getButtonPage(item) {
|
|
3867
3874
|
if (typeof item === "number") {
|
|
3868
3875
|
return item;
|
|
3869
|
-
}
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
}
|
|
3876
|
+
}
|
|
3877
|
+
switch (item) {
|
|
3878
|
+
case PAGINATION_ITEM_TYPE.previous:
|
|
3879
|
+
return page - 1;
|
|
3880
|
+
case PAGINATION_ITEM_TYPE.next:
|
|
3881
|
+
return page + 1;
|
|
3882
|
+
case PAGINATION_ITEM_TYPE.startEllipsis:
|
|
3883
|
+
return siblingsStart - 1;
|
|
3884
|
+
case PAGINATION_ITEM_TYPE.endEllipsis:
|
|
3885
|
+
return siblingsEnd + 1;
|
|
3886
|
+
default:
|
|
3887
|
+
return null;
|
|
3882
3888
|
}
|
|
3883
3889
|
}
|
|
3884
3890
|
function isDisabled(item) {
|
|
3885
|
-
if (item === PAGINATION_ITEM_TYPE.previous)
|
|
3886
|
-
|
|
3891
|
+
if (item === PAGINATION_ITEM_TYPE.previous) {
|
|
3892
|
+
return page <= 1;
|
|
3893
|
+
}
|
|
3894
|
+
if (item === PAGINATION_ITEM_TYPE.next) {
|
|
3895
|
+
return page >= count;
|
|
3896
|
+
}
|
|
3887
3897
|
return false;
|
|
3888
3898
|
}
|
|
3889
3899
|
return itemList.map((item) => {
|
|
3890
3900
|
const isNumber = typeof item === "number";
|
|
3891
3901
|
return {
|
|
3892
|
-
onClick: () =>
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3902
|
+
onClick: () => {
|
|
3903
|
+
handleClick({
|
|
3904
|
+
page: getButtonPage(item)
|
|
3905
|
+
});
|
|
3906
|
+
},
|
|
3907
|
+
itemType: isNumber ? PAGINATION_ITEM_TYPE.page : item,
|
|
3896
3908
|
page: getButtonPage(item),
|
|
3897
3909
|
disabled: disabled || isDisabled(item),
|
|
3898
3910
|
...isNumber && {
|
|
@@ -3919,7 +3931,7 @@ function Pagination(props) {
|
|
|
3919
3931
|
page,
|
|
3920
3932
|
siblingCount
|
|
3921
3933
|
});
|
|
3922
|
-
return /* @__PURE__ */ React__default.createElement("nav", { "aria-label": "pagination navigation", ...others }, /* @__PURE__ */ React__default.createElement(Layout.Group, { space: "none", align: "center" }, items.map((item) => /* @__PURE__ */ React__default.createElement(PaginationItem, {
|
|
3934
|
+
return /* @__PURE__ */ React__default.createElement("nav", { "aria-label": "pagination navigation", ...others }, /* @__PURE__ */ React__default.createElement(Layout.Group, { space: "none", align: "center" }, items.map((item) => /* @__PURE__ */ React__default.createElement(PaginationItem, { key: `${item.itemType}${item.page || ""}`, ...item }))));
|
|
3923
3935
|
}
|
|
3924
3936
|
const Bar = styled.div.withConfig({
|
|
3925
3937
|
displayName: "Bar",
|
|
@@ -4665,21 +4677,23 @@ function Toast({
|
|
|
4665
4677
|
}) {
|
|
4666
4678
|
const [count, setCount] = useState(100);
|
|
4667
4679
|
useEffect(() => {
|
|
4668
|
-
if (!timeout)
|
|
4680
|
+
if (!timeout) {
|
|
4681
|
+
return;
|
|
4682
|
+
}
|
|
4669
4683
|
const decrementBy = INTERVAL * 100 / timeout;
|
|
4670
|
-
const interval =
|
|
4684
|
+
const interval = globalThis.setTimeout(() => {
|
|
4671
4685
|
if (count <= 0) {
|
|
4672
|
-
|
|
4686
|
+
globalThis.clearTimeout(interval);
|
|
4673
4687
|
onClose();
|
|
4674
4688
|
} else {
|
|
4675
4689
|
setCount((value) => value - decrementBy);
|
|
4676
4690
|
}
|
|
4677
4691
|
}, INTERVAL);
|
|
4678
4692
|
return () => {
|
|
4679
|
-
|
|
4693
|
+
globalThis.clearTimeout(interval);
|
|
4680
4694
|
};
|
|
4681
4695
|
}, [count, onClose, timeout]);
|
|
4682
|
-
return /* @__PURE__ */ React__default.createElement(Container$8, { status, "aria-live": "polite", role: "alert" }, showIcon && /* @__PURE__ */ React__default.createElement(Leading$3, null, /* @__PURE__ */ React__default.createElement(ToastIcon, { status })), /* @__PURE__ */ React__default.createElement(Content, null, message), Boolean(timeout) && /* @__PURE__ */ React__default.createElement(ToastCountDown, { value: count, status }),
|
|
4696
|
+
return /* @__PURE__ */ React__default.createElement(Container$8, { status, "aria-live": "polite", role: "alert" }, showIcon && /* @__PURE__ */ React__default.createElement(Leading$3, null, /* @__PURE__ */ React__default.createElement(ToastIcon, { status })), /* @__PURE__ */ React__default.createElement(Content, null, message), Boolean(timeout) && /* @__PURE__ */ React__default.createElement(ToastCountDown, { value: count, status }), /* @__PURE__ */ React__default.createElement(CloseButton$1, { onClick: onClose, size: 14 }));
|
|
4683
4697
|
}
|
|
4684
4698
|
function ToastIcon({
|
|
4685
4699
|
status
|
|
@@ -4828,7 +4842,7 @@ function StepsProgress(props) {
|
|
|
4828
4842
|
steps,
|
|
4829
4843
|
current
|
|
4830
4844
|
} = props;
|
|
4831
|
-
return /* @__PURE__ */ React__default.createElement(ProgressWrapper, { steps
|
|
4845
|
+
return /* @__PURE__ */ React__default.createElement(ProgressWrapper, { steps }, steps.map(function renderStep(step, index) {
|
|
4832
4846
|
const {
|
|
4833
4847
|
id
|
|
4834
4848
|
} = step;
|
|
@@ -4852,7 +4866,7 @@ function StepsStep({
|
|
|
4852
4866
|
...others
|
|
4853
4867
|
}) {
|
|
4854
4868
|
const StepsID = useContext(StepsContext);
|
|
4855
|
-
return /* @__PURE__ */ React__default.createElement(Fragment, null, /* @__PURE__ */ React__default.createElement(Selector, { type: "radio", className: "visually-hidden", id: getPanelRadioID(id), name: String(StepsID), value: id, "data-testid": "panel-radio", tabIndex: -1 }), /* @__PURE__ */ React__default.createElement(StepWrapper, { "data-testid": "steps-step", ...others, id: String(id) }, children));
|
|
4869
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Selector, { type: "radio", className: "visually-hidden", id: getPanelRadioID(id), name: String(StepsID), value: id, "data-testid": "panel-radio", tabIndex: -1 }), /* @__PURE__ */ React__default.createElement(StepWrapper, { "data-testid": "steps-step", ...others, id: String(id) }, children));
|
|
4856
4870
|
}
|
|
4857
4871
|
const StepsWrapper = styled.section.withConfig({
|
|
4858
4872
|
displayName: "StepsWrapper",
|
|
@@ -4878,9 +4892,9 @@ function useSteps({
|
|
|
4878
4892
|
const stepIndexByID = useRef({});
|
|
4879
4893
|
useEffect(function initStepIndexByIDMap() {
|
|
4880
4894
|
stepIndexByID.current = {};
|
|
4881
|
-
(
|
|
4895
|
+
for (const [index, step] of steps.entries()) {
|
|
4882
4896
|
stepIndexByID.current[step.id] = index;
|
|
4883
|
-
}
|
|
4897
|
+
}
|
|
4884
4898
|
}, [steps]);
|
|
4885
4899
|
const [state, dispatch] = useReducer(reducer, init(steps, currentProp));
|
|
4886
4900
|
function reducer(state2, action) {
|
|
@@ -5044,7 +5058,7 @@ const DropdownContext = createContext({
|
|
|
5044
5058
|
disabled: false,
|
|
5045
5059
|
expandDisabled: false,
|
|
5046
5060
|
expanded: false,
|
|
5047
|
-
toggle
|
|
5061
|
+
toggle() {
|
|
5048
5062
|
}
|
|
5049
5063
|
});
|
|
5050
5064
|
const StyledPopover = styled(Popover.Floating).withConfig({
|
|
@@ -5174,18 +5188,11 @@ const SUPPORTED_KEYS = {
|
|
|
5174
5188
|
PLUS: "+",
|
|
5175
5189
|
MINUS: "-"
|
|
5176
5190
|
};
|
|
5177
|
-
function
|
|
5178
|
-
if (e.keyCode >= 37 && e.keyCode <= 40 && e.key.indexOf("Arrow") !== 0) {
|
|
5179
|
-
return `Arrow${e.key}`;
|
|
5180
|
-
}
|
|
5181
|
-
return e.key;
|
|
5182
|
-
}
|
|
5183
|
-
function KeyboardKey(e) {
|
|
5184
|
-
const key = getKeyboardKey(e);
|
|
5191
|
+
function KeyboardKey(event) {
|
|
5185
5192
|
return {
|
|
5186
5193
|
is(otherKeys) {
|
|
5187
5194
|
const expectedKeys = toArray(otherKeys).map((otherKey) => SUPPORTED_KEYS[otherKey]);
|
|
5188
|
-
return toArray(expectedKeys).includes(key);
|
|
5195
|
+
return toArray(expectedKeys).includes(event.key);
|
|
5189
5196
|
}
|
|
5190
5197
|
};
|
|
5191
5198
|
}
|
|
@@ -5195,9 +5202,6 @@ function useClickOutside(container, callback, disabled = false) {
|
|
|
5195
5202
|
return container.current;
|
|
5196
5203
|
}, [container]);
|
|
5197
5204
|
const handleEvent = useCallback(function handleEvent2(event) {
|
|
5198
|
-
function hasPressedEsc() {
|
|
5199
|
-
return KeyboardKey(event).is("ESCAPE");
|
|
5200
|
-
}
|
|
5201
5205
|
if (!getContainer() || disabled) {
|
|
5202
5206
|
return;
|
|
5203
5207
|
}
|
|
@@ -5205,7 +5209,7 @@ function useClickOutside(container, callback, disabled = false) {
|
|
|
5205
5209
|
const hasTarget = getContainer()?.contains(target);
|
|
5206
5210
|
if (!active && hasTarget) {
|
|
5207
5211
|
setActive(true);
|
|
5208
|
-
} else if (active && (!hasTarget ||
|
|
5212
|
+
} else if (active && (!hasTarget || event instanceof KeyboardEvent && KeyboardKey(event).is("ESCAPE"))) {
|
|
5209
5213
|
setActive(false);
|
|
5210
5214
|
callback(event);
|
|
5211
5215
|
}
|
|
@@ -5292,7 +5296,7 @@ const TriggerButton$1 = styled(SelectorButton).attrs(triggerButtonAttrs).withCon
|
|
|
5292
5296
|
children,
|
|
5293
5297
|
outlined
|
|
5294
5298
|
}) => {
|
|
5295
|
-
if (outlined
|
|
5299
|
+
if (!outlined && typeof children === "string") {
|
|
5296
5300
|
return css`& > span:first-child{display:inline-flex;flex-direction:column;align-items:center;justify-content:space-between;text-decoration:none;}& > span:first-child::after{height:0;overflow:hidden;font-weight:${getToken("font-weight-bold")};visibility:hidden;content:'${children}';content:'${children}' / '';user-select:none;pointer-events:none;@media speech{display:none;}}`;
|
|
5297
5301
|
}
|
|
5298
5302
|
}}`;
|
|
@@ -5414,11 +5418,11 @@ function DropdownTriggerButton(props) {
|
|
|
5414
5418
|
onClick,
|
|
5415
5419
|
...others
|
|
5416
5420
|
} = props;
|
|
5417
|
-
|
|
5421
|
+
const handleClick = (e) => {
|
|
5418
5422
|
e.persist();
|
|
5419
5423
|
toggle();
|
|
5420
5424
|
onClick?.(e);
|
|
5421
|
-
}
|
|
5425
|
+
};
|
|
5422
5426
|
function renderChildren() {
|
|
5423
5427
|
if (isFunction(children)) {
|
|
5424
5428
|
return children(contextValue);
|
|
@@ -5438,11 +5442,11 @@ function DropdownTriggerHandle(props) {
|
|
|
5438
5442
|
onClick,
|
|
5439
5443
|
...others
|
|
5440
5444
|
} = props;
|
|
5441
|
-
|
|
5445
|
+
const handleClick = (e) => {
|
|
5442
5446
|
e.persist();
|
|
5443
5447
|
toggle();
|
|
5444
5448
|
onClick?.(e);
|
|
5445
|
-
}
|
|
5449
|
+
};
|
|
5446
5450
|
return /* @__PURE__ */ React__default.createElement(TriggerHandle, { onClick: handleClick, "data-testid": "dropdown-trigger-handle", ...others, disabled: disabled || expandDisabled, type: "button", tabIndex: -1 }, /* @__PURE__ */ React__default.createElement(Caret$1, { $rotate: expanded }));
|
|
5447
5451
|
}
|
|
5448
5452
|
function GenericDropdownTrigger(props) {
|
|
@@ -5613,11 +5617,11 @@ const SelectTrigger = forwardRef(function SelectTrigger2(props, ref) {
|
|
|
5613
5617
|
const {
|
|
5614
5618
|
register
|
|
5615
5619
|
} = usePopover();
|
|
5616
|
-
|
|
5620
|
+
const handleClick = () => {
|
|
5617
5621
|
if (!expanded) {
|
|
5618
5622
|
toggle();
|
|
5619
5623
|
}
|
|
5620
|
-
}
|
|
5624
|
+
};
|
|
5621
5625
|
return /* @__PURE__ */ React__default.createElement(GenericSelectTrigger, { className }, /* @__PURE__ */ React__default.createElement(SelectTriggerSearchField, { ...others, "data-testid": "select-trigger-search-field", ref: (node) => {
|
|
5622
5626
|
if (isFunction(ref)) {
|
|
5623
5627
|
ref(node);
|
|
@@ -5627,8 +5631,8 @@ const SelectTrigger = forwardRef(function SelectTrigger2(props, ref) {
|
|
|
5627
5631
|
});
|
|
5628
5632
|
function getFocusedIndexAfterKeyPress(e, currentFocused, focusableCounter) {
|
|
5629
5633
|
const keyHandler = {
|
|
5630
|
-
Tab(
|
|
5631
|
-
return
|
|
5634
|
+
Tab(event) {
|
|
5635
|
+
return event.shiftKey ? -1 : 1;
|
|
5632
5636
|
},
|
|
5633
5637
|
ArrowUp() {
|
|
5634
5638
|
return -1;
|
|
@@ -5640,7 +5644,7 @@ function getFocusedIndexAfterKeyPress(e, currentFocused, focusableCounter) {
|
|
|
5640
5644
|
function unknownKey() {
|
|
5641
5645
|
return 0;
|
|
5642
5646
|
}
|
|
5643
|
-
const key =
|
|
5647
|
+
const key = e.key;
|
|
5644
5648
|
const increment = (keyHandler[key] || unknownKey)(e);
|
|
5645
5649
|
if (currentFocused === -1 && increment === -1) {
|
|
5646
5650
|
return (increment + focusableCounter) % focusableCounter;
|
|
@@ -5651,7 +5655,7 @@ function getTabbableDescendants(container) {
|
|
|
5651
5655
|
if (container == null) {
|
|
5652
5656
|
return [];
|
|
5653
5657
|
}
|
|
5654
|
-
return Array.from(container.querySelectorAll("button")
|
|
5658
|
+
return Array.from(container.querySelectorAll("button"));
|
|
5655
5659
|
}
|
|
5656
5660
|
function useFocusTrap(props) {
|
|
5657
5661
|
const {
|
|
@@ -5664,7 +5668,7 @@ function useFocusTrap(props) {
|
|
|
5664
5668
|
const mutationObserverRef = useRef();
|
|
5665
5669
|
const [focusableDescendants, setFocusableDescendants] = useState([]);
|
|
5666
5670
|
function subscribeToDOMMutationEvents(container) {
|
|
5667
|
-
mutationObserverRef.current = new MutationObserver(
|
|
5671
|
+
mutationObserverRef.current = new MutationObserver(() => {
|
|
5668
5672
|
setFocusableDescendants(getTabbableDescendants(container));
|
|
5669
5673
|
});
|
|
5670
5674
|
mutationObserverRef.current.observe(container, {
|
|
@@ -5674,7 +5678,7 @@ function useFocusTrap(props) {
|
|
|
5674
5678
|
function unsubscribeToDOMMutationEvents() {
|
|
5675
5679
|
setCurrentFocused(-1);
|
|
5676
5680
|
if (mutationObserverRef.current) {
|
|
5677
|
-
mutationObserverRef.current
|
|
5681
|
+
mutationObserverRef.current.disconnect();
|
|
5678
5682
|
}
|
|
5679
5683
|
}
|
|
5680
5684
|
const containerRef = useCallback(function initialize(container) {
|
|
@@ -5730,9 +5734,6 @@ function useFocusTrap(props) {
|
|
|
5730
5734
|
deactivate
|
|
5731
5735
|
};
|
|
5732
5736
|
}
|
|
5733
|
-
function isThenable(object) {
|
|
5734
|
-
return isObject(object) && isFunction(object["then"]);
|
|
5735
|
-
}
|
|
5736
5737
|
const GenericAdapter = {
|
|
5737
5738
|
getKey(o) {
|
|
5738
5739
|
return get(o, "value");
|
|
@@ -5754,17 +5755,16 @@ function getValue(selection, multiple) {
|
|
|
5754
5755
|
}
|
|
5755
5756
|
if (multiple) {
|
|
5756
5757
|
const options = [];
|
|
5757
|
-
for (const [,
|
|
5758
|
-
options.push(
|
|
5758
|
+
for (const [, option2] of pairs) {
|
|
5759
|
+
options.push(option2);
|
|
5759
5760
|
}
|
|
5760
5761
|
return options;
|
|
5761
|
-
} else {
|
|
5762
|
-
const [[, option]] = pairs;
|
|
5763
|
-
return option;
|
|
5764
5762
|
}
|
|
5763
|
+
const [[, option]] = pairs;
|
|
5764
|
+
return option;
|
|
5765
5765
|
}
|
|
5766
5766
|
function toSelection(value) {
|
|
5767
|
-
const safeValue = toArray(value
|
|
5767
|
+
const safeValue = toArray(value ?? []);
|
|
5768
5768
|
return safeValue.filter((option) => !isEmpty(option));
|
|
5769
5769
|
}
|
|
5770
5770
|
function getDisplayValue(adapters, selection, multiple) {
|
|
@@ -5773,14 +5773,13 @@ function getDisplayValue(adapters, selection, multiple) {
|
|
|
5773
5773
|
}
|
|
5774
5774
|
if (multiple) {
|
|
5775
5775
|
return "";
|
|
5776
|
-
} else {
|
|
5777
|
-
const value = getValue(selection, multiple);
|
|
5778
|
-
const adapter = getAdapter(adapters, value._type);
|
|
5779
|
-
return adapter.getLabel(value) ?? "";
|
|
5780
5776
|
}
|
|
5777
|
+
const value = getValue(selection, multiple);
|
|
5778
|
+
const adapter = getAdapter(adapters, value._type);
|
|
5779
|
+
return adapter.getLabel(value) ?? "";
|
|
5781
5780
|
}
|
|
5782
5781
|
function escapeRegExp(value) {
|
|
5783
|
-
return
|
|
5782
|
+
return (value || "").replaceAll(/[.*+?^${}()|[\]\\]/g, String.raw`\$&`);
|
|
5784
5783
|
}
|
|
5785
5784
|
async function getData(datasources, query) {
|
|
5786
5785
|
const regex = new RegExp(escapeRegExp(query), "i");
|
|
@@ -5795,9 +5794,9 @@ async function getData(datasources, query) {
|
|
|
5795
5794
|
}
|
|
5796
5795
|
const results = await Promise.allSettled(promises);
|
|
5797
5796
|
let items = [];
|
|
5798
|
-
results.
|
|
5797
|
+
for (const [index, result] of results.entries()) {
|
|
5799
5798
|
if (result.status === "rejected") {
|
|
5800
|
-
|
|
5799
|
+
continue;
|
|
5801
5800
|
}
|
|
5802
5801
|
const type = types[index];
|
|
5803
5802
|
items = items.concat((result.value || []).map((item) => {
|
|
@@ -5806,7 +5805,7 @@ async function getData(datasources, query) {
|
|
|
5806
5805
|
_type: type
|
|
5807
5806
|
};
|
|
5808
5807
|
}));
|
|
5809
|
-
}
|
|
5808
|
+
}
|
|
5810
5809
|
return items;
|
|
5811
5810
|
}
|
|
5812
5811
|
function getDatasources(props) {
|
|
@@ -5846,10 +5845,10 @@ function TriggerOnFocusHandler(e) {
|
|
|
5846
5845
|
}
|
|
5847
5846
|
function mapOptions(items, adapters) {
|
|
5848
5847
|
const options = /* @__PURE__ */ new Map();
|
|
5849
|
-
|
|
5848
|
+
for (const item of items) {
|
|
5850
5849
|
const adapter = getAdapter(adapters, item._type);
|
|
5851
5850
|
options.set(adapter.getKey(item), item);
|
|
5852
|
-
}
|
|
5851
|
+
}
|
|
5853
5852
|
return options;
|
|
5854
5853
|
}
|
|
5855
5854
|
function useOptions(props) {
|
|
@@ -5917,7 +5916,7 @@ function useSelect(props) {
|
|
|
5917
5916
|
name,
|
|
5918
5917
|
disabled = false,
|
|
5919
5918
|
onBlur,
|
|
5920
|
-
isValidNewOption =
|
|
5919
|
+
isValidNewOption = Boolean,
|
|
5921
5920
|
createOptionPosition = "last"
|
|
5922
5921
|
} = props;
|
|
5923
5922
|
const datasources = useMemo(() => getDatasources(props), [props.datasources, props.options]);
|
|
@@ -5987,10 +5986,10 @@ function useSelect(props) {
|
|
|
5987
5986
|
expanded: dropdown.expanded,
|
|
5988
5987
|
onBlur(event) {
|
|
5989
5988
|
setQueryTyped(false);
|
|
5990
|
-
if (
|
|
5991
|
-
setQuery(getDisplayValue(adapters, selectable.selected, multiple));
|
|
5992
|
-
} else {
|
|
5989
|
+
if (multiple) {
|
|
5993
5990
|
setQuery("");
|
|
5991
|
+
} else {
|
|
5992
|
+
setQuery(getDisplayValue(adapters, selectable.selected, multiple));
|
|
5994
5993
|
}
|
|
5995
5994
|
options.reset();
|
|
5996
5995
|
onBlur?.(event);
|
|
@@ -6039,8 +6038,7 @@ function useSelect(props) {
|
|
|
6039
6038
|
}) {
|
|
6040
6039
|
const {
|
|
6041
6040
|
value,
|
|
6042
|
-
checked
|
|
6043
|
-
label
|
|
6041
|
+
checked
|
|
6044
6042
|
} = getSelectableOption(option);
|
|
6045
6043
|
return {
|
|
6046
6044
|
role: "option",
|
|
@@ -6061,15 +6059,13 @@ function useSelect(props) {
|
|
|
6061
6059
|
return {
|
|
6062
6060
|
onClick: function onClick() {
|
|
6063
6061
|
async function asyncOnClick() {
|
|
6064
|
-
if (!isFunction(onCreate))
|
|
6062
|
+
if (!isFunction(onCreate)) {
|
|
6063
|
+
return;
|
|
6064
|
+
}
|
|
6065
6065
|
const onCreateReturn = onCreate(query);
|
|
6066
6066
|
let option;
|
|
6067
6067
|
if (onCreateReturn) {
|
|
6068
|
-
|
|
6069
|
-
option = await onCreateReturn;
|
|
6070
|
-
} else {
|
|
6071
|
-
option = onCreateReturn;
|
|
6072
|
-
}
|
|
6068
|
+
option = await onCreateReturn;
|
|
6073
6069
|
}
|
|
6074
6070
|
options.fetch(query);
|
|
6075
6071
|
if (option) {
|
|
@@ -6147,10 +6143,12 @@ function useSelect(props) {
|
|
|
6147
6143
|
}
|
|
6148
6144
|
function highlightMatch(str, match) {
|
|
6149
6145
|
if (str == null || match == null) {
|
|
6150
|
-
return
|
|
6146
|
+
return str;
|
|
6151
6147
|
}
|
|
6152
6148
|
const index = String(str).toLowerCase().indexOf(String(match).toLowerCase());
|
|
6153
|
-
if (index === -1)
|
|
6149
|
+
if (index === -1) {
|
|
6150
|
+
return str;
|
|
6151
|
+
}
|
|
6154
6152
|
const pre = str.slice(0, index);
|
|
6155
6153
|
const mid = str.slice(index, index + match.length);
|
|
6156
6154
|
const post = str.slice(index + match.length);
|
|
@@ -6205,8 +6203,12 @@ function SelectOption({
|
|
|
6205
6203
|
label
|
|
6206
6204
|
} = select.getSelectableOption(option);
|
|
6207
6205
|
function renderContent() {
|
|
6208
|
-
if (children)
|
|
6209
|
-
|
|
6206
|
+
if (children) {
|
|
6207
|
+
return children;
|
|
6208
|
+
}
|
|
6209
|
+
if (checked && type === "multiple") {
|
|
6210
|
+
return label;
|
|
6211
|
+
}
|
|
6210
6212
|
return /* @__PURE__ */ React__default.createElement(HighlightMatch, { text: label, match: select.query });
|
|
6211
6213
|
}
|
|
6212
6214
|
return /* @__PURE__ */ React__default.createElement(DefaultSelectOption, { ...rest, ...select.getOptionProps({
|
|
@@ -6282,8 +6284,12 @@ function Separator$1({
|
|
|
6282
6284
|
before = []
|
|
6283
6285
|
}) {
|
|
6284
6286
|
if (!isQuerying(status)) {
|
|
6285
|
-
if (isEmpty(after) && !isEmpty(before))
|
|
6286
|
-
|
|
6287
|
+
if (isEmpty(after) && !isEmpty(before)) {
|
|
6288
|
+
return /* @__PURE__ */ React__default.createElement(Divider$1, null);
|
|
6289
|
+
}
|
|
6290
|
+
if (isEmpty(after)) {
|
|
6291
|
+
return null;
|
|
6292
|
+
}
|
|
6287
6293
|
}
|
|
6288
6294
|
return /* @__PURE__ */ React__default.createElement("div", { style: {
|
|
6289
6295
|
position: "relative"
|
|
@@ -6327,14 +6333,14 @@ function renderOptionsMultiple(select, components) {
|
|
|
6327
6333
|
}
|
|
6328
6334
|
return [...remaining2, option];
|
|
6329
6335
|
}, []);
|
|
6330
|
-
let remaining = /* @__PURE__ */ React__default.createElement(Fragment, null, select.createOptionPosition === "first" && isCreatable ? /* @__PURE__ */ React__default.createElement(CreatableOption, null) : null, remainingOptions.map((option) => /* @__PURE__ */ React__default.createElement(Option, { key: String(option.value), value: option.value })), select.createOptionPosition === "last" && isCreatable ? /* @__PURE__ */ React__default.createElement(CreatableOption, null) : null);
|
|
6336
|
+
let remaining = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, select.createOptionPosition === "first" && isCreatable ? /* @__PURE__ */ React__default.createElement(CreatableOption, null) : null, remainingOptions.map((option) => /* @__PURE__ */ React__default.createElement(Option, { key: String(option.value), value: option.value })), select.createOptionPosition === "last" && isCreatable ? /* @__PURE__ */ React__default.createElement(CreatableOption, null) : null);
|
|
6331
6337
|
if (!isQuerying(select.status) && isEmpty(remainingOptions)) {
|
|
6332
6338
|
remaining = isCreatable ? /* @__PURE__ */ React__default.createElement(CreatableOption, null) : /* @__PURE__ */ React__default.createElement(Empty, null, "No more options.");
|
|
6333
6339
|
}
|
|
6334
6340
|
if (!isQuerying(select.status) && isEmpty(select.options)) {
|
|
6335
6341
|
remaining = isCreatable ? /* @__PURE__ */ React__default.createElement(CreatableOption, null) : /* @__PURE__ */ React__default.createElement(Empty, null, "No results found.");
|
|
6336
6342
|
}
|
|
6337
|
-
return /* @__PURE__ */ React__default.createElement(Fragment, null, selectedOptions.map((option) => /* @__PURE__ */ React__default.createElement(Option, { key: String(option.value), value: option.value })), /* @__PURE__ */ React__default.createElement(Separator$1, { status: select.status, before: selectedOptions, after: remainingOptions }), remaining);
|
|
6343
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, selectedOptions.map((option) => /* @__PURE__ */ React__default.createElement(Option, { key: String(option.value), value: option.value })), /* @__PURE__ */ React__default.createElement(Separator$1, { status: select.status, before: selectedOptions, after: remainingOptions }), remaining);
|
|
6338
6344
|
}
|
|
6339
6345
|
function Select(props) {
|
|
6340
6346
|
const {
|
|
@@ -6425,7 +6431,9 @@ function useHeightExpansionToggler(targetElRef) {
|
|
|
6425
6431
|
childList: true
|
|
6426
6432
|
});
|
|
6427
6433
|
}
|
|
6428
|
-
return () =>
|
|
6434
|
+
return () => {
|
|
6435
|
+
observer.disconnect();
|
|
6436
|
+
};
|
|
6429
6437
|
}, [targetElRef]);
|
|
6430
6438
|
const mounted = useDidMount();
|
|
6431
6439
|
const finalHeight = !mounted ? "auto" : state ? totalHeight : 0;
|
|
@@ -6529,8 +6537,10 @@ function MenuExpandable({
|
|
|
6529
6537
|
toggle,
|
|
6530
6538
|
height
|
|
6531
6539
|
} = useHeightExpansionToggler(expandableItemsRef);
|
|
6532
|
-
return /* @__PURE__ */ React__default.createElement("div", { ...props, role: "none" }, /* @__PURE__ */ React__default.createElement(MenuBaseItem, { onClick: toggle, label, trailing: /* @__PURE__ */ React__default.createElement(IconWrapper$1, null, /* @__PURE__ */ React__default.createElement(StyledIcon, { $expanded: expanded, name: "chevron-down", size: 16 })), "aria-haspopup": "true", "aria-expanded": expanded }), /* @__PURE__ */ React__default.createElement(ExpandableItems, { $height: height, role: "menu" }, /* @__PURE__ */ React__default.createElement(ItemsWrapper, { $expanded: expanded, ref: expandableItemsRef, role: "presentation" }, /* @__PURE__ */ React__default.createElement(Fragment, null, React__default.Children.map(children, (child) => {
|
|
6533
|
-
if (!child)
|
|
6540
|
+
return /* @__PURE__ */ React__default.createElement("div", { ...props, role: "none" }, /* @__PURE__ */ React__default.createElement(MenuBaseItem, { onClick: toggle, label, trailing: /* @__PURE__ */ React__default.createElement(IconWrapper$1, null, /* @__PURE__ */ React__default.createElement(StyledIcon, { $expanded: expanded, name: "chevron-down", size: 16 })), "aria-haspopup": "true", "aria-expanded": expanded }), /* @__PURE__ */ React__default.createElement(ExpandableItems, { $height: height, role: "menu" }, /* @__PURE__ */ React__default.createElement(ItemsWrapper, { $expanded: expanded, ref: expandableItemsRef, role: "presentation" }, /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, React__default.Children.map(children, (child) => {
|
|
6541
|
+
if (!child) {
|
|
6542
|
+
return null;
|
|
6543
|
+
}
|
|
6534
6544
|
if (typeof child === "object" && "type" in child) {
|
|
6535
6545
|
return React__default.cloneElement(child, {
|
|
6536
6546
|
key: label,
|
|
@@ -6542,9 +6552,9 @@ function MenuExpandable({
|
|
|
6542
6552
|
})))));
|
|
6543
6553
|
}
|
|
6544
6554
|
function styledCompounds(Parent, compounds) {
|
|
6545
|
-
Object.keys(compounds)
|
|
6555
|
+
for (const key of Object.keys(compounds)) {
|
|
6546
6556
|
Parent[key] = compounds[key];
|
|
6547
|
-
}
|
|
6557
|
+
}
|
|
6548
6558
|
return Parent;
|
|
6549
6559
|
}
|
|
6550
6560
|
const MenuTitle = styled.div.withConfig({
|
|
@@ -6610,15 +6620,17 @@ function useWindowSize() {
|
|
|
6610
6620
|
});
|
|
6611
6621
|
}
|
|
6612
6622
|
window.addEventListener("resize", handleResize);
|
|
6613
|
-
return () =>
|
|
6623
|
+
return () => {
|
|
6624
|
+
window.removeEventListener("resize", handleResize);
|
|
6625
|
+
};
|
|
6614
6626
|
}, []);
|
|
6615
6627
|
return windowSize;
|
|
6616
6628
|
}
|
|
6617
6629
|
function transformInPixels(value) {
|
|
6618
|
-
if (value.
|
|
6619
|
-
return parseFloat(value) * BASE_PIXELS;
|
|
6630
|
+
if (value.includes("rem")) {
|
|
6631
|
+
return Number.parseFloat(value) * BASE_PIXELS;
|
|
6620
6632
|
}
|
|
6621
|
-
return parseFloat(value);
|
|
6633
|
+
return Number.parseFloat(value);
|
|
6622
6634
|
}
|
|
6623
6635
|
function useSideNavigation() {
|
|
6624
6636
|
const size = useWindowSize();
|
|
@@ -6706,11 +6718,11 @@ function Drawer({
|
|
|
6706
6718
|
}) {
|
|
6707
6719
|
const [invisible, setInvisible] = useState(!open);
|
|
6708
6720
|
const ref = useRef(null);
|
|
6709
|
-
|
|
6721
|
+
const handleTransitionEnd = () => {
|
|
6710
6722
|
if (!open) {
|
|
6711
6723
|
setInvisible(true);
|
|
6712
6724
|
}
|
|
6713
|
-
}
|
|
6725
|
+
};
|
|
6714
6726
|
useEffect(() => {
|
|
6715
6727
|
if (open) {
|
|
6716
6728
|
setInvisible(false);
|
|
@@ -6721,10 +6733,14 @@ function Drawer({
|
|
|
6721
6733
|
if (currentRef && onClickOutside) {
|
|
6722
6734
|
const handleClick = (event) => {
|
|
6723
6735
|
const hasClickedOutside = currentRef.isSameNode(event.target);
|
|
6724
|
-
if (hasClickedOutside)
|
|
6736
|
+
if (hasClickedOutside) {
|
|
6737
|
+
onClickOutside();
|
|
6738
|
+
}
|
|
6725
6739
|
};
|
|
6726
6740
|
currentRef.addEventListener("mouseup", handleClick);
|
|
6727
|
-
return () =>
|
|
6741
|
+
return () => {
|
|
6742
|
+
currentRef.removeEventListener("mouseup", handleClick);
|
|
6743
|
+
};
|
|
6728
6744
|
}
|
|
6729
6745
|
}, [onClickOutside]);
|
|
6730
6746
|
return ReactDOM.createPortal(/* @__PURE__ */ React__default.createElement(StyledAside, { open: !invisible, ref }, /* @__PURE__ */ React__default.createElement(StyledSection, { ...others, className, open, onTransitionEnd: handleTransitionEnd, role: "dialog", "aria-modal": "true", "aria-label": "drawer" }, Boolean(onClose) && /* @__PURE__ */ React__default.createElement(CloseButton, { onClick: onClose, "aria-label": "close" }), children)), document.body);
|
|
@@ -6746,7 +6762,9 @@ function getSelectableProps(config) {
|
|
|
6746
6762
|
}
|
|
6747
6763
|
}
|
|
6748
6764
|
};
|
|
6749
|
-
if (!config || config === true)
|
|
6765
|
+
if (!config || config === true) {
|
|
6766
|
+
return defaults;
|
|
6767
|
+
}
|
|
6750
6768
|
return {
|
|
6751
6769
|
...defaults,
|
|
6752
6770
|
...config
|
|
@@ -6767,7 +6785,7 @@ function useTableSelectionCore(config) {
|
|
|
6767
6785
|
} = useSelectable2({
|
|
6768
6786
|
...selectableProps,
|
|
6769
6787
|
onChange(value) {
|
|
6770
|
-
|
|
6788
|
+
selectableProps.onChange(value ? [...value.values()] : []);
|
|
6771
6789
|
}
|
|
6772
6790
|
});
|
|
6773
6791
|
const allRowsAreSelected = selected.size === registered.length;
|
|
@@ -6780,7 +6798,9 @@ function useTableSelectionCore(config) {
|
|
|
6780
6798
|
return key;
|
|
6781
6799
|
}, [selectableProps]);
|
|
6782
6800
|
const register = useCallback((row) => {
|
|
6783
|
-
if (!row)
|
|
6801
|
+
if (!row) {
|
|
6802
|
+
return;
|
|
6803
|
+
}
|
|
6784
6804
|
const key = getKey(row);
|
|
6785
6805
|
setRegistered((prev) => {
|
|
6786
6806
|
const alreadyRegistered = prev.some((prevRow) => getKey(prevRow) === key);
|
|
@@ -6792,13 +6812,17 @@ function useTableSelectionCore(config) {
|
|
|
6792
6812
|
}, [getKey]);
|
|
6793
6813
|
function toggleAll() {
|
|
6794
6814
|
if (allRowsAreSelected) {
|
|
6795
|
-
|
|
6815
|
+
for (const row of registered) {
|
|
6796
6816
|
const key = getKey(row);
|
|
6797
|
-
if (!key)
|
|
6817
|
+
if (!key) {
|
|
6818
|
+
continue;
|
|
6819
|
+
}
|
|
6798
6820
|
unselect(key);
|
|
6799
|
-
}
|
|
6821
|
+
}
|
|
6800
6822
|
} else {
|
|
6801
|
-
|
|
6823
|
+
for (const row of registered) {
|
|
6824
|
+
select(row);
|
|
6825
|
+
}
|
|
6802
6826
|
}
|
|
6803
6827
|
}
|
|
6804
6828
|
return {
|
|
@@ -6850,7 +6874,9 @@ function isCellSelected(value, selectedRows, config) {
|
|
|
6850
6874
|
} = config;
|
|
6851
6875
|
const adapter = adapters?.[value._type || "generic"];
|
|
6852
6876
|
const key = adapter?.getKey(value);
|
|
6853
|
-
if (!key)
|
|
6877
|
+
if (!key) {
|
|
6878
|
+
return false;
|
|
6879
|
+
}
|
|
6854
6880
|
return selectedRows.has(key);
|
|
6855
6881
|
}
|
|
6856
6882
|
function useIsCellSelected(value) {
|
|
@@ -6858,7 +6884,9 @@ function useIsCellSelected(value) {
|
|
|
6858
6884
|
selected,
|
|
6859
6885
|
config
|
|
6860
6886
|
} = useTableSelection();
|
|
6861
|
-
if (!value || !selected)
|
|
6887
|
+
if (!value || !selected) {
|
|
6888
|
+
return false;
|
|
6889
|
+
}
|
|
6862
6890
|
return isCellSelected(value, selected, config);
|
|
6863
6891
|
}
|
|
6864
6892
|
const Box = styled(Box$1).withConfig({
|
|
@@ -7052,7 +7080,9 @@ function SelectionCell({
|
|
|
7052
7080
|
config
|
|
7053
7081
|
} = useTableSelection();
|
|
7054
7082
|
const selected = useIsCellSelected(value);
|
|
7055
|
-
const action = () =>
|
|
7083
|
+
const action = () => {
|
|
7084
|
+
toggle(value);
|
|
7085
|
+
};
|
|
7056
7086
|
useEffect(() => {
|
|
7057
7087
|
register(value);
|
|
7058
7088
|
}, [value, register]);
|
|
@@ -7065,16 +7095,21 @@ function SelectionCell({
|
|
|
7065
7095
|
const Input = config.multiple ? Checkbox : Radio;
|
|
7066
7096
|
return /* @__PURE__ */ React__default.createElement(TableCell, { ...props }, value ? /* @__PURE__ */ React__default.createElement(Input, { checked: selected, scale: "small", onChange: action }) : null);
|
|
7067
7097
|
}
|
|
7068
|
-
function SelectionHeadCell(
|
|
7098
|
+
function SelectionHeadCell({
|
|
7099
|
+
children,
|
|
7100
|
+
...props
|
|
7101
|
+
}) {
|
|
7069
7102
|
const {
|
|
7070
7103
|
allRowsAreSelected,
|
|
7071
7104
|
toggleAll,
|
|
7072
7105
|
config
|
|
7073
7106
|
} = useTableSelection();
|
|
7074
7107
|
const selected = allRowsAreSelected;
|
|
7075
|
-
const action = () =>
|
|
7076
|
-
|
|
7077
|
-
|
|
7108
|
+
const action = () => {
|
|
7109
|
+
toggleAll();
|
|
7110
|
+
};
|
|
7111
|
+
if (children) {
|
|
7112
|
+
return /* @__PURE__ */ React__default.createElement(TableHeadCell, { ...props }, children({
|
|
7078
7113
|
selected,
|
|
7079
7114
|
toggle: action
|
|
7080
7115
|
}));
|
|
@@ -7107,11 +7142,13 @@ function ExpandableTableRow({
|
|
|
7107
7142
|
if (propsLeading) {
|
|
7108
7143
|
leading = isFunction(propsLeading) ? propsLeading(open) : propsLeading;
|
|
7109
7144
|
}
|
|
7110
|
-
|
|
7111
|
-
if (!expandableContent)
|
|
7145
|
+
const toggle = () => {
|
|
7146
|
+
if (!expandableContent) {
|
|
7147
|
+
return;
|
|
7148
|
+
}
|
|
7112
7149
|
onExpandedChange?.(!open);
|
|
7113
7150
|
setOpenState(!open);
|
|
7114
|
-
}
|
|
7151
|
+
};
|
|
7115
7152
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(StyledTableRow, { ...others, onClick: toggle, isExpanded, selected }, /* @__PURE__ */ React__default.createElement(TableCell, null, expandableContent && leading), children), isExpanded && /* @__PURE__ */ React__default.createElement(StyledExpandableContentRow, null, /* @__PURE__ */ React__default.createElement(StyledTableCell, { colSpan }, expandableContent)));
|
|
7116
7153
|
}
|
|
7117
7154
|
function TableHeadCell({
|
|
@@ -7171,23 +7208,29 @@ function TablePicker({
|
|
|
7171
7208
|
}) {
|
|
7172
7209
|
return /* @__PURE__ */ React__default.createElement(Dropdown, { align }, /* @__PURE__ */ React__default.createElement(StyledPickerTrigger, { trailing: null, scale: "small", ...props }, propsTrigger !== void 0 ? ({
|
|
7173
7210
|
expanded
|
|
7174
|
-
}) => isFunction(propsTrigger) ? propsTrigger(expanded) : propsTrigger : /* @__PURE__ */ React__default.createElement(TriggerIcon, null)), /* @__PURE__ */ React__default.createElement(Dropdown.Menu, { role: "listbox" }, children || options?.map((option
|
|
7211
|
+
}) => isFunction(propsTrigger) ? propsTrigger(expanded) : propsTrigger : /* @__PURE__ */ React__default.createElement(TriggerIcon, null)), /* @__PURE__ */ React__default.createElement(Dropdown.Menu, { role: "listbox" }, children || options?.map((option) => /* @__PURE__ */ React__default.createElement(TablePickerItem, { key: option.key, option, checked: option.key === value?.key, onClick: () => onChange?.(option) }))));
|
|
7175
7212
|
}
|
|
7176
7213
|
function useIsRowSelected(children) {
|
|
7177
7214
|
const {
|
|
7178
7215
|
selected,
|
|
7179
7216
|
config
|
|
7180
7217
|
} = useTableSelection();
|
|
7181
|
-
if (!selected)
|
|
7218
|
+
if (!selected) {
|
|
7219
|
+
return false;
|
|
7220
|
+
}
|
|
7182
7221
|
const arrChildren = Children$5.toArray(children);
|
|
7183
7222
|
const selectionCellChild = arrChildren.find((child) => {
|
|
7184
7223
|
return isValidElement(child) && child.type === SelectionCell;
|
|
7185
7224
|
});
|
|
7186
|
-
if (!selectionCellChild)
|
|
7225
|
+
if (!selectionCellChild) {
|
|
7226
|
+
return false;
|
|
7227
|
+
}
|
|
7187
7228
|
const {
|
|
7188
7229
|
value
|
|
7189
7230
|
} = selectionCellChild.props;
|
|
7190
|
-
if (!value)
|
|
7231
|
+
if (!value) {
|
|
7232
|
+
return false;
|
|
7233
|
+
}
|
|
7191
7234
|
return isCellSelected(value, selected, config);
|
|
7192
7235
|
}
|
|
7193
7236
|
Table.Head = TableHead;
|
|
@@ -7309,17 +7352,20 @@ const MenuContainer = styled.nav.withConfig({
|
|
|
7309
7352
|
$align: "right"
|
|
7310
7353
|
})
|
|
7311
7354
|
})} display:flex;flex-direction:row;align-items:center;& > * + *{margin-left:${getToken("space-m")};}& > * + ${MenuDropdown}{margin-left:${getToken("space-xl")};}`;
|
|
7312
|
-
function MenuItem(
|
|
7313
|
-
|
|
7314
|
-
|
|
7355
|
+
function MenuItem({
|
|
7356
|
+
children,
|
|
7357
|
+
...props
|
|
7358
|
+
}) {
|
|
7359
|
+
if (children) {
|
|
7360
|
+
return /* @__PURE__ */ React__default.createElement(MenuItemDropdown, { ...props }, children);
|
|
7315
7361
|
}
|
|
7316
7362
|
return /* @__PURE__ */ React__default.createElement(MenuItemIcon, { ...props });
|
|
7317
7363
|
}
|
|
7318
|
-
function Menu(
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
return /* @__PURE__ */ React__default.createElement(MenuContainer, { $align: align },
|
|
7364
|
+
function Menu({
|
|
7365
|
+
align = "left",
|
|
7366
|
+
children
|
|
7367
|
+
}) {
|
|
7368
|
+
return /* @__PURE__ */ React__default.createElement(MenuContainer, { $align: align }, children);
|
|
7323
7369
|
}
|
|
7324
7370
|
Menu.Item = MenuItem;
|
|
7325
7371
|
Menu.SubItem = MenuDropdownSubItem;
|
|
@@ -7355,7 +7401,7 @@ const VerticalWrapper = styled(Stack).withConfig({
|
|
|
7355
7401
|
componentId: "ls-ui__sc-bl43p-0"
|
|
7356
7402
|
})`text-align:center;`;
|
|
7357
7403
|
const EmptyStateWithIcon = ({
|
|
7358
|
-
variant
|
|
7404
|
+
variant,
|
|
7359
7405
|
icon,
|
|
7360
7406
|
title,
|
|
7361
7407
|
action,
|
|
@@ -7364,7 +7410,7 @@ const EmptyStateWithIcon = ({
|
|
|
7364
7410
|
}) => {
|
|
7365
7411
|
const isHorizontal = variant === "horizontal-card";
|
|
7366
7412
|
const Wrapper2 = isHorizontal ? Group$1 : VerticalWrapper;
|
|
7367
|
-
return /* @__PURE__ */ React__default.createElement(Wrapper2, { ...props, space: isHorizontal ? "s" : "xs", align: "center", justify: "center" }, children || /* @__PURE__ */ React__default.createElement(Fragment, null, icon, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "caption-bold" }, title), action && /* @__PURE__ */ React__default.createElement(Button$3, { variant: "primary", scale: "small", ...action }, action.label)));
|
|
7413
|
+
return /* @__PURE__ */ React__default.createElement(Wrapper2, { ...props, space: isHorizontal ? "s" : "xs", align: "center", justify: "center" }, children || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, icon, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "caption-bold" }, title), action && /* @__PURE__ */ React__default.createElement(Button$3, { variant: "primary", scale: "small", ...action }, action.label)));
|
|
7368
7414
|
};
|
|
7369
7415
|
const Wrapper$2 = styled.div.withConfig({
|
|
7370
7416
|
displayName: "Wrapper",
|
|
@@ -7387,7 +7433,7 @@ const Wrapper$1 = styled(Stack).withConfig({
|
|
|
7387
7433
|
componentId: "ls-ui__sc-8ms4vl-0"
|
|
7388
7434
|
})`max-width:320px;text-align:center;`;
|
|
7389
7435
|
const EmptyStateWithIllustration = ({
|
|
7390
|
-
variant
|
|
7436
|
+
variant,
|
|
7391
7437
|
illustration,
|
|
7392
7438
|
title,
|
|
7393
7439
|
description,
|
|
@@ -7396,7 +7442,7 @@ const EmptyStateWithIllustration = ({
|
|
|
7396
7442
|
...props
|
|
7397
7443
|
}) => {
|
|
7398
7444
|
const isPageVariant = variant === "page";
|
|
7399
|
-
return /* @__PURE__ */ React__default.createElement(Wrapper$1, { ...props, align: "center", justify: "center", space: "m" }, children || /* @__PURE__ */ React__default.createElement(Fragment, null, illustration && /* @__PURE__ */ React__default.createElement(Illustration, { illustration, scale: isPageVariant ? "large" : "default" }), (title || description) && /* @__PURE__ */ React__default.createElement(Stack, { space: "xs" }, title && /* @__PURE__ */ React__default.createElement(Text$1, { variant: isPageVariant ? "heading-sm-bold" : "body-bold", color: isPageVariant ? "color-neutral-darkest" : "color-neutral-darker" }, title), description && /* @__PURE__ */ React__default.createElement(Text$1, { "data-testid": "empty-state-description", variant: isPageVariant ? "body" : "caption", color: "color-neutral-darkest" }, description)), action && /* @__PURE__ */ React__default.createElement(Button$3, { className: "empty-state-action", variant: "primary", scale: isPageVariant ? "default" : "small", ...action }, action.label)));
|
|
7445
|
+
return /* @__PURE__ */ React__default.createElement(Wrapper$1, { ...props, align: "center", justify: "center", space: "m" }, children || /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, illustration && /* @__PURE__ */ React__default.createElement(Illustration, { illustration, scale: isPageVariant ? "large" : "default" }), (title || description) && /* @__PURE__ */ React__default.createElement(Stack, { space: "xs" }, title && /* @__PURE__ */ React__default.createElement(Text$1, { variant: isPageVariant ? "heading-sm-bold" : "body-bold", color: isPageVariant ? "color-neutral-darkest" : "color-neutral-darker" }, title), description && /* @__PURE__ */ React__default.createElement(Text$1, { "data-testid": "empty-state-description", variant: isPageVariant ? "body" : "caption", color: "color-neutral-darkest" }, description)), action && /* @__PURE__ */ React__default.createElement(Button$3, { className: "empty-state-action", variant: "primary", scale: isPageVariant ? "default" : "small", ...action }, action.label)));
|
|
7400
7446
|
};
|
|
7401
7447
|
const EmptyState = (props) => {
|
|
7402
7448
|
if (["card", "horizontal-card"].includes(props.variant)) {
|
|
@@ -7578,14 +7624,14 @@ function DateHelper(dateArg, optionsArg = DEFAULT_OPTIONS) {
|
|
|
7578
7624
|
...DEFAULT_OPTIONS,
|
|
7579
7625
|
...optionsArg
|
|
7580
7626
|
};
|
|
7581
|
-
const utcDate = function normalizeToUTC() {
|
|
7627
|
+
const utcDate = (function normalizeToUTC() {
|
|
7582
7628
|
let date = /* @__PURE__ */ new Date();
|
|
7583
7629
|
if (dateArg != null) {
|
|
7584
7630
|
date = new Date(dateArg);
|
|
7585
7631
|
}
|
|
7586
7632
|
const utcDate2 = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), options.normalize ? 12 : date.getUTCHours(), options.normalize ? 0 : date.getUTCMinutes(), options.normalize ? 0 : date.getUTCSeconds(), options.normalize ? 0 : date.getUTCMilliseconds()));
|
|
7587
7633
|
return utcDate2;
|
|
7588
|
-
}();
|
|
7634
|
+
})();
|
|
7589
7635
|
return {
|
|
7590
7636
|
get() {
|
|
7591
7637
|
return utcDate;
|
|
@@ -7815,7 +7861,7 @@ function useCalendar(props) {
|
|
|
7815
7861
|
mode,
|
|
7816
7862
|
months: renderableMonths,
|
|
7817
7863
|
selected,
|
|
7818
|
-
constraints: toArray(constraints
|
|
7864
|
+
constraints: toArray(constraints).filter((constraint) => constraint != null),
|
|
7819
7865
|
clear,
|
|
7820
7866
|
set,
|
|
7821
7867
|
select
|
|
@@ -7979,7 +8025,7 @@ const ADDITIONAL_FORMATTERS = {
|
|
|
7979
8025
|
const COMPOUND_FORMATTERS = {
|
|
7980
8026
|
o: {
|
|
7981
8027
|
valid: (token) => (/* @__PURE__ */ new Set(["D", "DD"])).has(token),
|
|
7982
|
-
format: (value) => getOrdinalSuffix(parseInt(value, 10))
|
|
8028
|
+
format: (value) => getOrdinalSuffix(Number.parseInt(value, 10))
|
|
7983
8029
|
}
|
|
7984
8030
|
};
|
|
7985
8031
|
const PickerButton$1 = styled(BaseButton).withConfig({
|
|
@@ -8111,15 +8157,20 @@ function getStatus$2(calendar, date) {
|
|
|
8111
8157
|
const isPastYearDay = date.getYear() < calendar.months[0].year && date.getMonth() > calendar.months[0].month;
|
|
8112
8158
|
if (calendar.selected[0] == date.getTime()) {
|
|
8113
8159
|
return "selection-start";
|
|
8114
|
-
}
|
|
8160
|
+
}
|
|
8161
|
+
if (calendar.selected[1] == date.getTime()) {
|
|
8115
8162
|
return "selection-end";
|
|
8116
|
-
}
|
|
8163
|
+
}
|
|
8164
|
+
if (calendar.selected[0] != null && date.getTime() > calendar.selected[0] && calendar.selected[1] != null && date.getTime() < calendar.selected[1]) {
|
|
8117
8165
|
return "selection";
|
|
8118
|
-
}
|
|
8166
|
+
}
|
|
8167
|
+
if (calendar.mode === "single" && (isPastYearDay || date.getMonth() < calendar.months[0].month)) {
|
|
8119
8168
|
return "faded";
|
|
8120
|
-
}
|
|
8169
|
+
}
|
|
8170
|
+
if (calendar.mode === "single" && date.getMonth() > calendar.months[0].month) {
|
|
8121
8171
|
return "next-month-day";
|
|
8122
|
-
}
|
|
8172
|
+
}
|
|
8173
|
+
if (date.getTime() == TODAY.getTime()) {
|
|
8123
8174
|
return "current-day";
|
|
8124
8175
|
}
|
|
8125
8176
|
return "default";
|
|
@@ -8142,7 +8193,7 @@ function CalendarDayPicker({
|
|
|
8142
8193
|
} }, weekday));
|
|
8143
8194
|
}
|
|
8144
8195
|
function renderDaysOfMonth(month) {
|
|
8145
|
-
const constraints = calendar.constraints
|
|
8196
|
+
const constraints = calendar.constraints;
|
|
8146
8197
|
return month.days.map((day) => {
|
|
8147
8198
|
const status = getStatus$2(calendar, day);
|
|
8148
8199
|
const formatted = formatter$1.format(day);
|
|
@@ -8506,7 +8557,7 @@ const DateInput = forwardRef(function DateInput2(props, ref) {
|
|
|
8506
8557
|
...rest
|
|
8507
8558
|
} = props;
|
|
8508
8559
|
const dropdown = useContext(DropdownContext);
|
|
8509
|
-
|
|
8560
|
+
const handleInputChange = (event) => {
|
|
8510
8561
|
const {
|
|
8511
8562
|
target: {
|
|
8512
8563
|
value
|
|
@@ -8516,7 +8567,7 @@ const DateInput = forwardRef(function DateInput2(props, ref) {
|
|
|
8516
8567
|
return;
|
|
8517
8568
|
}
|
|
8518
8569
|
onChange(DateHelper(value));
|
|
8519
|
-
}
|
|
8570
|
+
};
|
|
8520
8571
|
return /* @__PURE__ */ React__default.createElement(TextField, { placeholder: "00/00/0000", ...rest, ref, type: "text", disabled: dropdown.disabled, leading: /* @__PURE__ */ React__default.createElement(Icon$2, { name: "calendar" }), onChange: handleInputChange });
|
|
8521
8572
|
});
|
|
8522
8573
|
function DatePicker(props) {
|
|
@@ -8573,13 +8624,13 @@ function useDateRangePicker(props) {
|
|
|
8573
8624
|
const inputsRef = useRef([null, null]);
|
|
8574
8625
|
const currentlyPickingRef = useRef("none");
|
|
8575
8626
|
function handleDateSelect(selected) {
|
|
8576
|
-
[AT_RANGE_START, AT_RANGE_END]
|
|
8627
|
+
for (const index of [AT_RANGE_START, AT_RANGE_END]) {
|
|
8577
8628
|
const input = inputsRef.current[index];
|
|
8578
8629
|
const formattedDate = formatDate(selected[index]);
|
|
8579
8630
|
if (formattedDate != formatDate(getInputValue(input))) {
|
|
8580
8631
|
setInputValue(input, formattedDate);
|
|
8581
8632
|
}
|
|
8582
|
-
}
|
|
8633
|
+
}
|
|
8583
8634
|
onChange?.({
|
|
8584
8635
|
target: {
|
|
8585
8636
|
id,
|
|
@@ -8638,9 +8689,9 @@ function useDateRangePicker(props) {
|
|
|
8638
8689
|
calendar.clear();
|
|
8639
8690
|
} else {
|
|
8640
8691
|
const selected = getSelection(calendar.selected).map(formatDate);
|
|
8641
|
-
[AT_RANGE_START, AT_RANGE_END]
|
|
8692
|
+
for (const index of [AT_RANGE_START, AT_RANGE_END]) {
|
|
8642
8693
|
setInputValue(inputsRef.current[index], selected[index]);
|
|
8643
|
-
}
|
|
8694
|
+
}
|
|
8644
8695
|
}
|
|
8645
8696
|
}
|
|
8646
8697
|
function handleDoneClick() {
|
|
@@ -8719,9 +8770,9 @@ function useDateRangePicker(props) {
|
|
|
8719
8770
|
return newSelected[index] != currSelected[index];
|
|
8720
8771
|
});
|
|
8721
8772
|
if (hasChanged) {
|
|
8722
|
-
[AT_RANGE_START, AT_RANGE_END]
|
|
8773
|
+
for (const index of [AT_RANGE_START, AT_RANGE_END]) {
|
|
8723
8774
|
setInputValue(inputsRef.current[index], formatDate(newSelected[index]));
|
|
8724
|
-
}
|
|
8775
|
+
}
|
|
8725
8776
|
calendar.select(newSelected);
|
|
8726
8777
|
calendar.set(getInitialCalendarSetup(newSelected));
|
|
8727
8778
|
}
|
|
@@ -8877,7 +8928,7 @@ const DropZone = ({
|
|
|
8877
8928
|
const onChangeInput = useCallback((event) => {
|
|
8878
8929
|
event.preventDefault();
|
|
8879
8930
|
event.stopPropagation();
|
|
8880
|
-
onFilesAdded(Array.from(event.currentTarget.files
|
|
8931
|
+
onFilesAdded(Array.from(event.currentTarget.files ?? []));
|
|
8881
8932
|
}, [onFilesAdded]);
|
|
8882
8933
|
const onKeyPress = useCallback((event) => {
|
|
8883
8934
|
if (!disabled && inputRef.current && KeyboardKey(event).is("ENTER")) {
|
|
@@ -8891,7 +8942,7 @@ const DropZone = ({
|
|
|
8891
8942
|
if (isDragging) {
|
|
8892
8943
|
setIsDragging(false);
|
|
8893
8944
|
}
|
|
8894
|
-
onFilesAdded(Array.from(event.dataTransfer.files
|
|
8945
|
+
onFilesAdded(Array.from(event.dataTransfer.files ?? []));
|
|
8895
8946
|
}
|
|
8896
8947
|
}, [disabled, isDragging, onFilesAdded]);
|
|
8897
8948
|
const onDragStart = useCallback((event) => {
|
|
@@ -8920,14 +8971,14 @@ const DropZone = ({
|
|
|
8920
8971
|
const BYTES_PER_KILOBYTE = 1024;
|
|
8921
8972
|
const FILE_SIZE_ABBREVIATIONS = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
8922
8973
|
const formatBytes = (bytes, decimals = 2) => {
|
|
8923
|
-
const bytesValue =
|
|
8974
|
+
const bytesValue = bytes;
|
|
8924
8975
|
if (!bytesValue || bytesValue < 0) {
|
|
8925
8976
|
return "0B";
|
|
8926
8977
|
}
|
|
8927
8978
|
const dm = Math.max(0, decimals);
|
|
8928
8979
|
const unit = Math.floor(Math.log(bytesValue) / Math.log(BYTES_PER_KILOBYTE));
|
|
8929
8980
|
const unitAbbr = FILE_SIZE_ABBREVIATIONS[Math.min(unit, FILE_SIZE_ABBREVIATIONS.length - 1)];
|
|
8930
|
-
return `${parseFloat((bytesValue / Math.pow(BYTES_PER_KILOBYTE, unit)).toFixed(dm))}${unitAbbr}`;
|
|
8981
|
+
return `${Number.parseFloat((bytesValue / Math.pow(BYTES_PER_KILOBYTE, unit)).toFixed(dm))}${unitAbbr}`;
|
|
8931
8982
|
};
|
|
8932
8983
|
const FileName = ({
|
|
8933
8984
|
file
|
|
@@ -8988,7 +9039,11 @@ const FileList = ({
|
|
|
8988
9039
|
return null;
|
|
8989
9040
|
}
|
|
8990
9041
|
const uploadedFiles = fileList.filter((file) => file.status === "success").length;
|
|
8991
|
-
return /* @__PURE__ */ React__default.createElement(Stack, { space: "m", ...props }, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "heading-sm-bold" }, `${uploadedFiles} ${pluralize(uploadedFiles, "Files", "File")} uploaded`), /* @__PURE__ */ React__default.createElement(FileListUL, { space: "m" }, fileList.map((item, index) => /* @__PURE__ */ React__default.createElement(FileItem, { key: `file-${item.file.name}-${index}`, disabled, onRemove: () =>
|
|
9042
|
+
return /* @__PURE__ */ React__default.createElement(Stack, { space: "m", ...props }, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "heading-sm-bold" }, `${uploadedFiles} ${pluralize(uploadedFiles, "Files", "File")} uploaded`), /* @__PURE__ */ React__default.createElement(FileListUL, { space: "m" }, fileList.map((item, index) => /* @__PURE__ */ React__default.createElement(FileItem, { key: `file-${item.file.name}-${index}`, disabled, onRemove: () => {
|
|
9043
|
+
onRemoveFile(item, index);
|
|
9044
|
+
}, onRetry: onRetryUpload ? () => {
|
|
9045
|
+
onRetryUpload(item, index);
|
|
9046
|
+
} : void 0, ...item }))));
|
|
8992
9047
|
};
|
|
8993
9048
|
const DragDropFile = () => null;
|
|
8994
9049
|
DragDropFile.Wrapper = Wrapper;
|
|
@@ -9055,7 +9110,9 @@ function TablePaginationActions({
|
|
|
9055
9110
|
return;
|
|
9056
9111
|
}
|
|
9057
9112
|
const numberValue = Number(e.target.value);
|
|
9058
|
-
if (!numberValue || numberValue < 1 || numberValue > totalPages)
|
|
9113
|
+
if (!numberValue || numberValue < 1 || numberValue > totalPages) {
|
|
9114
|
+
return;
|
|
9115
|
+
}
|
|
9059
9116
|
setPageValue(numberValue);
|
|
9060
9117
|
};
|
|
9061
9118
|
return /* @__PURE__ */ React__default.createElement(Layout.Group, { space: "s", align: "center" }, !isCompact && /* @__PURE__ */ React__default.createElement(NoPaddingButton, { onClick: handleFirstPageClick, disabled: page === 0 || disabled, title: "First page" }, /* @__PURE__ */ React__default.createElement(ActionIcon, { name: "caret-right-last", rotate: 180 })), /* @__PURE__ */ React__default.createElement(NoPaddingButton, { onClick: handlePreviousPageClick, disabled: page === 0 || disabled, title: "Previous page" }, /* @__PURE__ */ React__default.createElement(ActionIcon, { name: "caret-left" })), !isCompact && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(TextField$1, { type: "number", min: 1, max: totalPages, disabled: disabled || totalPages === 1, onChange: handlePageChange, onBlur: publishPageChange, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, scale: "small", value: count ? pageValue : 0, title: "Page" }), /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body", color: disabled ? "color-neutral" : "color-neutral-dark" }, "of", " ", /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body-bold", color: disabled ? "color-neutral" : "color-neutral-dark" }, totalPages))), /* @__PURE__ */ React__default.createElement(NoPaddingButton, { onClick: handleNextPageClick, disabled: page >= totalPages - 1 || disabled, title: "Next page" }, /* @__PURE__ */ React__default.createElement(ActionIcon, { name: "caret-right" })), !isCompact && /* @__PURE__ */ React__default.createElement(NoPaddingButton, { onClick: handleLastPageClick, disabled: page >= totalPages - 1 || disabled, title: "Last page" }, /* @__PURE__ */ React__default.createElement(ActionIcon, { name: "caret-right-last" })));
|
|
@@ -9088,7 +9145,9 @@ function RowsPerPage({
|
|
|
9088
9145
|
}
|
|
9089
9146
|
return `${from}-${to}`;
|
|
9090
9147
|
};
|
|
9091
|
-
return /* @__PURE__ */ React__default.createElement(Layout.Group, { space: "s", align: "center" }, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "caption", color: disabled ? "color-neutral" : "color-neutral-dark" }, labelRowsPerPage), /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body", color: disabled ? "color-neutral" : "color-neutral-dark" }, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body-bold", color: disabled ? "color-neutral" : "color-neutral-dark" }, getItemsRange()), " ", "of", " ", /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body-bold", color: disabled ? "color-neutral" : "color-neutral-dark" }, count)), /* @__PURE__ */ React__default.createElement(Dropdown, { position, align }, /* @__PURE__ */ React__default.createElement(TriggerButton, { disabled }), /* @__PURE__ */ React__default.createElement(Dropdown.Menu, null, rowsPerPageOptions.map((option) => /* @__PURE__ */ React__default.createElement(Dropdown.Item, { key: option, onClick: () =>
|
|
9148
|
+
return /* @__PURE__ */ React__default.createElement(Layout.Group, { space: "s", align: "center" }, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "caption", color: disabled ? "color-neutral" : "color-neutral-dark" }, labelRowsPerPage), /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body", color: disabled ? "color-neutral" : "color-neutral-dark" }, /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body-bold", color: disabled ? "color-neutral" : "color-neutral-dark" }, getItemsRange()), " ", "of", " ", /* @__PURE__ */ React__default.createElement(Text$1, { variant: "body-bold", color: disabled ? "color-neutral" : "color-neutral-dark" }, count)), /* @__PURE__ */ React__default.createElement(Dropdown, { position, align }, /* @__PURE__ */ React__default.createElement(TriggerButton, { disabled }), /* @__PURE__ */ React__default.createElement(Dropdown.Menu, null, rowsPerPageOptions.map((option) => /* @__PURE__ */ React__default.createElement(Dropdown.Item, { key: option, onClick: () => {
|
|
9149
|
+
onRowsPerPageChange(option);
|
|
9150
|
+
}, trailing: option === rowsPerPage && /* @__PURE__ */ React__default.createElement(Icon$2, { name: "check", size: 20, color: "accent" }) }, option, " per page")))));
|
|
9092
9151
|
}
|
|
9093
9152
|
function TablePagination(props) {
|
|
9094
9153
|
const {
|