@alphakits/ui 2.3.1 → 2.4.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/__internal/utils/index.d.ts +1 -1
- package/dist/__internal/utils/index.js +4 -4
- package/dist/amount-input/component.js +41 -41
- package/dist/avatar/component.js +2 -18
- package/dist/badge/component.d.ts +1 -1
- package/dist/base-card/component.js +1 -7
- package/dist/bottom-sheet/component.d.ts +1 -1
- package/dist/bottom-sheet/component.js +9 -13
- package/dist/box/component.d.ts +2 -2
- package/dist/box/component.js +4 -4
- package/dist/button/component.js +9 -9
- package/dist/button-arrow/component.js +6 -1
- package/dist/calendar/component.d.ts +1 -2
- package/dist/calendar/component.js +77 -74
- package/dist/calendar/components/days-table/component.js +31 -34
- package/dist/calendar/components/header/{/321/201omponent.js → component.js} +3 -12
- package/dist/calendar/components/header/index.d.ts +1 -1
- package/dist/calendar/components/header/index.js +1 -1
- package/dist/calendar/components/months-table/{/321/201omponent.js → component.js} +7 -7
- package/dist/calendar/components/months-table/index.d.ts +1 -1
- package/dist/calendar/components/months-table/index.js +1 -1
- package/dist/calendar/components/select-button/{/321/201omponent.d.ts → component.d.ts} +3 -3
- package/dist/calendar/components/select-button/{/321/201omponent.js → component.js} +5 -11
- package/dist/calendar/components/select-button/index.d.ts +1 -1
- package/dist/calendar/components/select-button/index.js +1 -1
- package/dist/calendar/components/years-table/{/321/201omponent.js → component.js} +14 -14
- package/dist/calendar/components/years-table/index.d.ts +1 -1
- package/dist/calendar/components/years-table/index.js +1 -1
- package/dist/calendar/index.d.ts +2 -2
- package/dist/calendar/index.js +4 -4
- package/dist/calendar/use-calendar.js +51 -47
- package/dist/calendar/utils.js +7 -9
- package/dist/calendar-input/component.js +22 -22
- package/dist/card/component.js +2 -18
- package/dist/cell/base/component.js +31 -31
- package/dist/cell/pure/component.js +2 -2
- package/dist/checkbox/component.js +11 -11
- package/dist/checkbox-group/component.js +23 -24
- package/dist/checkbox-lists/component.d.ts +1 -2
- package/dist/checkbox-lists/component.js +59 -61
- package/dist/collapsable-row/addons.d.ts +3 -4
- package/dist/collapsable-row/addons.js +6 -9
- package/dist/collapsable-row/component.d.ts +1 -1
- package/dist/collapsable-row/component.js +7 -7
- package/dist/collapse/component.js +45 -54
- package/dist/copy-button/component.d.ts +1 -2
- package/dist/copy-button/component.js +1 -5
- package/dist/date/component.js +1 -1
- package/dist/date-switcher/component.d.ts +1 -2
- package/dist/date-switcher/component.js +8 -8
- package/dist/decorated-item/component.js +10 -20
- package/dist/dot/component.js +1 -4
- package/dist/empty-page/component.js +1 -9
- package/dist/filter-tag/component.d.ts +1 -1
- package/dist/flex/component.d.ts +2 -2
- package/dist/footer/component.js +57 -53
- package/dist/form/component.d.ts +1 -2
- package/dist/form/component.js +2 -12
- package/dist/form/templates/base-form/index.d.ts +3 -3
- package/dist/form/templates/base-form/index.js +26 -26
- package/dist/form/templates/filters-form/index.d.ts +1 -1
- package/dist/form/templates/filters-form/index.js +20 -23
- package/dist/form/templates/rest-form/form.d.ts +1 -2
- package/dist/form/templates/rest-form/form.js +77 -80
- package/dist/form/templates/rest-form/index.d.ts +3 -3
- package/dist/form/templates/rest-form/index.js +16 -27
- package/dist/form/utils/get-default-values.js +3 -6
- package/dist/form/utils/remove-undefined-from-object.js +1 -3
- package/dist/form-control/component.js +1 -1
- package/dist/formik/index.d.ts +2 -2
- package/dist/header-search/component.js +1 -6
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +10 -10
- package/dist/hooks/use-get-one/index.js +16 -16
- package/dist/icon-button/component.d.ts +3 -3
- package/dist/icon-button/component.js +2 -8
- package/dist/image/component.js +52 -30
- package/dist/image/image-base.js +1 -7
- package/dist/image/use-image-render-component.d.ts +1 -1
- package/dist/image/use-image-render-component.js +11 -14
- package/dist/image-gallery/component.js +40 -45
- package/dist/image-uploader/component.js +56 -53
- package/dist/index.js +41 -41
- package/dist/info-block-wrapper/component.d.ts +1 -1
- package/dist/input/component.js +1 -1
- package/dist/input-autocomplete/autocomplete-field/index.d.ts +1 -2
- package/dist/input-autocomplete/autocomplete-field/index.js +6 -6
- package/dist/input-autocomplete/component.d.ts +26 -26
- package/dist/input-ghost/component.d.ts +1 -1
- package/dist/link/component.d.ts +2 -2
- package/dist/link/component.js +1 -1
- package/dist/loader/component.js +6 -5
- package/dist/masked-input/component.js +7 -16
- package/dist/menu/component.js +12 -17
- package/dist/menu/components/content-header/index.js +1 -9
- package/dist/menu/components/menu-avatar/index.js +1 -6
- package/dist/menu/components/menu-button/index.js +1 -10
- package/dist/menu/components/menu-buttons-list/index.d.ts +1 -1
- package/dist/menu/components/menu-buttons-list/index.js +1 -7
- package/dist/menu/hooks/use-menu.js +12 -12
- package/dist/message/component.js +33 -14
- package/dist/modal/components/modals/modal.d.ts +1 -2
- package/dist/modal/components/modals/modal.js +30 -33
- package/dist/modal/context.js +12 -9
- package/dist/modal/hooks/use-modal.d.ts +1 -1
- package/dist/modal/hooks/use-modal.js +22 -22
- package/dist/mq/component.js +1 -6
- package/dist/notification/component.js +14 -12
- package/dist/page-container/component.js +1 -6
- package/dist/page-loading/component.d.ts +1 -2
- package/dist/page-with-controls/component.js +4 -7
- package/dist/picker-button/common/labeled-button/index.js +18 -12
- package/dist/picker-button/component.js +5 -5
- package/dist/picker-button/field/{Component.d.ts → component.d.ts} +1 -2
- package/dist/picker-button/field/index.d.ts +1 -1
- package/dist/picker-button/field/index.js +1 -1
- package/dist/picker-button/index.d.ts +1 -1
- package/dist/picker-button/index.js +4 -4
- package/dist/popover/component.d.ts +2 -2
- package/dist/popover/component.js +77 -79
- package/dist/radio/component.js +7 -7
- package/dist/radio-groups/component.d.ts +1 -2
- package/dist/radio-groups/component.js +9 -7
- package/dist/select/component.d.ts +8 -9
- package/dist/select/component.js +1 -9
- package/dist/select/components/arrow/component.d.ts +1 -2
- package/dist/select/components/base-select/component.js +97 -90
- package/dist/select/components/checkmark/component.d.ts +1 -2
- package/dist/select/components/field/component.d.ts +1 -2
- package/dist/select/components/field/component.js +8 -5
- package/dist/select/components/native-select/component.js +4 -11
- package/dist/select/components/optgroup/component.d.ts +1 -2
- package/dist/select/components/optgroup/component.js +4 -4
- package/dist/select/components/option/component.js +1 -1
- package/dist/select/components/options-list/component.d.ts +1 -2
- package/dist/select/components/options-list/component.js +25 -23
- package/dist/select/components/select-search/index.d.ts +1 -1
- package/dist/select/components/select-search/index.js +28 -26
- package/dist/select/components/virtual-options-list/component.d.ts +1 -2
- package/dist/select/components/virtual-options-list/component.js +52 -45
- package/dist/select/index.js +4 -4
- package/dist/select/presets/index.d.ts +1 -1
- package/dist/select/presets/index.js +4 -4
- package/dist/select/presets/use-lazy-loading/index.d.ts +3 -4
- package/dist/select/presets/use-lazy-loading/index.js +45 -43
- package/dist/select/presets/use-select-with-loading/hook.d.ts +1 -2
- package/dist/select/presets/use-select-with-loading/hook.js +8 -1
- package/dist/select/utils.js +32 -32
- package/dist/sidepanel/component.js +21 -15
- package/dist/sidepanel-header/component.js +17 -16
- package/dist/skeleton/component.js +4 -4
- package/dist/space/component.d.ts +2 -2
- package/dist/space/component.js +42 -45
- package/dist/space/{Item.d.ts → item.d.ts} +2 -2
- package/dist/spinner/component.js +6 -5
- package/dist/stack/index.d.ts +1 -1
- package/dist/stack/index.js +5 -5
- package/dist/stepped-progress-bar/components/step-bar.js +3 -3
- package/dist/stepped-progress-bar/index.d.ts +2 -2
- package/dist/stepped-progress-bar/index.js +37 -22
- package/dist/sticker/component.js +1 -17
- package/dist/suffix-input/component.js +13 -13
- package/dist/switch/component.js +7 -7
- package/dist/table/components/cells/index.d.ts +1 -2
- package/dist/table/components/empty-list/index.d.ts +3 -3
- package/dist/table/components/empty-list/index.js +6 -3
- package/dist/table/components/error/index.d.ts +3 -3
- package/dist/table/components/error/index.js +8 -5
- package/dist/table/components/loading/index.d.ts +1 -1
- package/dist/table/components/loading/index.js +18 -12
- package/dist/table/components/pagination/index.js +56 -53
- package/dist/table/components/table-header/index.js +59 -56
- package/dist/table/hooks/use-table-data.js +64 -59
- package/dist/table/table.d.ts +1 -1
- package/dist/table/table.js +80 -80
- package/dist/table/types.d.ts +3 -3
- package/dist/table/utils/get-query-from-url.js +1 -8
- package/dist/table/utils/get-tags.d.ts +1 -1
- package/dist/table/utils/get-tags.js +9 -12
- package/dist/table/utils/index.d.ts +1 -1
- package/dist/table/utils/index.js +4 -4
- package/dist/table/utils/parse-query-params.js +5 -1
- package/dist/table/utils/prepare-rows.d.ts +1 -2
- package/dist/table/utils/prepare-rows.js +4 -3
- package/dist/table/utils/query-adapter.d.ts +1 -1
- package/dist/table/utils/query-adapter.js +5 -5
- package/dist/table/utils/remove-query-param.js +3 -1
- package/dist/table/utils/reset-query-param.js +16 -9
- package/dist/table-status/component.js +5 -1
- package/dist/textarea/component.js +36 -28
- package/dist/theme-provider/component.js +33 -29
- package/dist/toast/component.d.ts +7 -8
- package/dist/toast/component.js +6 -6
- package/dist/toast-notifier/component.js +13 -13
- package/dist/toast-notifier/use-timer.d.ts +1 -1
- package/dist/toast-notifier/use-timer.js +5 -5
- package/dist/toast-plate/component.d.ts +3 -3
- package/dist/toast-plate/component.js +7 -7
- package/dist/tooltip/component.js +35 -35
- package/dist/tooltip/node-resolver.js +7 -7
- package/dist/typings/api.d.ts +3 -5
- package/dist/typography/colors.d.ts +1 -1
- package/dist/typography/title/component.d.ts +3 -3
- package/dist/typography/title/index.d.ts +1 -1
- package/dist/typography/title/index.js +3 -3
- package/dist/utils/date/index.js +12 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +14 -14
- package/dist/utils/split-amount/util.js +4 -4
- package/dist/with-suffix/component.d.ts +13 -13
- package/dist/with-suffix/component.js +8 -8
- package/package.json +9 -34
- /package/dist/__internal/utils/{getDataTestId.d.ts → get-data-test-id.d.ts} +0 -0
- /package/dist/__internal/utils/{getDataTestId.js → get-data-test-id.js} +0 -0
- /package/dist/calendar/components/header/{/321/201omponent.d.ts" → component.d.ts} +0 -0
- /package/dist/calendar/components/months-table/{/321/201omponent.d.ts" → component.d.ts} +0 -0
- /package/dist/calendar/components/years-table/{/321/201omponent.d.ts" → component.d.ts} +0 -0
- /package/dist/picker-button/field/{Component.js → component.js} +0 -0
- /package/dist/space/{Item.js → item.js} +0 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { jsx as a, jsxs as rt } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import re from "classnames";
|
|
3
|
+
import { useMultipleSelection as se, useCombobox as L } from "downshift";
|
|
4
|
+
import st, { forwardRef as ot, useRef as y, useMemo as T, useCallback as W, useEffect as j } from "react";
|
|
5
|
+
import oe from "react-merge-refs";
|
|
6
6
|
import { ResizeObserver as ct } from "resize-observer";
|
|
7
|
-
import { getDataTestId as A } from "../../../__internal/utils/
|
|
7
|
+
import { getDataTestId as A } from "../../../__internal/utils/get-data-test-id.js";
|
|
8
8
|
import { Popover as it } from "../../../popover/component.js";
|
|
9
9
|
import { processOptions as lt } from "../../utils.js";
|
|
10
10
|
import { NativeSelect as at } from "../native-select/component.js";
|
|
11
|
-
import
|
|
12
|
-
const ce = (
|
|
13
|
-
const
|
|
14
|
-
return
|
|
11
|
+
import v from "./index.module.css.js";
|
|
12
|
+
const ce = (o) => o ? o.key?.toString() : "", ie = (o) => {
|
|
13
|
+
const x = y(o);
|
|
14
|
+
return x.current = o, x;
|
|
15
15
|
}, kt = ot(
|
|
16
16
|
({
|
|
17
|
-
dataTestId:
|
|
18
|
-
className:
|
|
17
|
+
dataTestId: o = "",
|
|
18
|
+
className: x,
|
|
19
19
|
fieldClassName: le,
|
|
20
20
|
filteredOptions: ae,
|
|
21
21
|
popoverOuterClassname: de,
|
|
22
22
|
optionsListClassName: ue,
|
|
23
23
|
optionClassName: $,
|
|
24
|
-
options:
|
|
24
|
+
options: R,
|
|
25
25
|
actionButton: H,
|
|
26
|
-
autocomplete:
|
|
26
|
+
autocomplete: I = !1,
|
|
27
27
|
multiple: m = !1,
|
|
28
28
|
allowUnselect: M = !1,
|
|
29
29
|
disabled: u = !1,
|
|
30
30
|
closeOnSelect: U = !m,
|
|
31
31
|
circularNavigation: fe = !1,
|
|
32
|
-
nativeSelect:
|
|
32
|
+
nativeSelect: w = !1,
|
|
33
33
|
defaultOpen: V = !1,
|
|
34
34
|
open: N,
|
|
35
35
|
popoverPosition: pe = "bottom-start",
|
|
@@ -67,15 +67,15 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
67
67
|
showEmptyOptionsList: Be = !1,
|
|
68
68
|
visibleOptions: Le
|
|
69
69
|
}, We) => {
|
|
70
|
-
const
|
|
71
|
-
() => lt(
|
|
72
|
-
[
|
|
70
|
+
const b = y(null), Q = y(null), k = y(null), X = y(null), g = y(null), Y = ie(Pe), Z = ie(De), { flatOptions: c, selectedOptions: ee } = T(
|
|
71
|
+
() => lt(R || [], C),
|
|
72
|
+
[R, C]
|
|
73
73
|
), te = T(() => {
|
|
74
74
|
const e = /* @__PURE__ */ new Map();
|
|
75
|
-
return
|
|
76
|
-
e.set(t.key,
|
|
75
|
+
return c.forEach((t, s) => {
|
|
76
|
+
e.set(t.key, s);
|
|
77
77
|
}), e;
|
|
78
|
-
}, [
|
|
78
|
+
}, [c]), je = T(
|
|
79
79
|
() => ({
|
|
80
80
|
itemToString: ce,
|
|
81
81
|
onSelectedItemsChange: (e) => {
|
|
@@ -87,21 +87,21 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
87
87
|
});
|
|
88
88
|
},
|
|
89
89
|
stateReducer: (e, t) => {
|
|
90
|
-
const { type:
|
|
91
|
-
return !M &&
|
|
90
|
+
const { type: s, changes: n } = t;
|
|
91
|
+
return !M && s === se.stateChangeTypes.DropdownKeyDownBackspace ? e : n;
|
|
92
92
|
},
|
|
93
93
|
...C !== void 0 ? { selectedItems: ee } : {}
|
|
94
94
|
}),
|
|
95
95
|
[M, h, C, ee, Y]
|
|
96
96
|
), {
|
|
97
|
-
selectedItems:
|
|
97
|
+
selectedItems: i,
|
|
98
98
|
addSelectedItem: Ae,
|
|
99
99
|
setSelectedItems: E,
|
|
100
100
|
removeSelectedItem: $e,
|
|
101
101
|
getDropdownProps: He
|
|
102
|
-
} =
|
|
103
|
-
() => new Set(
|
|
104
|
-
[
|
|
102
|
+
} = se(je), F = T(
|
|
103
|
+
() => new Set(i.map((e) => e.key)),
|
|
104
|
+
[i]
|
|
105
105
|
), {
|
|
106
106
|
isOpen: l,
|
|
107
107
|
getMenuProps: Ue,
|
|
@@ -112,25 +112,25 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
112
112
|
highlightedIndex: P,
|
|
113
113
|
toggleMenu: K,
|
|
114
114
|
openMenu: f
|
|
115
|
-
} =
|
|
115
|
+
} = L({
|
|
116
116
|
id: ye,
|
|
117
117
|
isOpen: N,
|
|
118
118
|
circularNavigation: fe,
|
|
119
|
-
items:
|
|
119
|
+
items: c,
|
|
120
120
|
itemToString: ce,
|
|
121
|
-
defaultHighlightedIndex:
|
|
121
|
+
defaultHighlightedIndex: i.length === 0 ? -1 : void 0,
|
|
122
122
|
onIsOpenChange: (e) => {
|
|
123
123
|
Z.current && setTimeout(() => {
|
|
124
124
|
Z.current?.({ open: e.isOpen, name: h });
|
|
125
125
|
}, 0);
|
|
126
126
|
},
|
|
127
127
|
stateReducer: (e, t) => {
|
|
128
|
-
const { type:
|
|
129
|
-
switch (
|
|
130
|
-
case
|
|
131
|
-
case
|
|
128
|
+
const { type: s, changes: n } = t, { selectedItem: d } = n;
|
|
129
|
+
switch (s) {
|
|
130
|
+
case L.stateChangeTypes.InputKeyDownEnter:
|
|
131
|
+
case L.stateChangeTypes.ItemClick:
|
|
132
132
|
if (d && !d.disabled) {
|
|
133
|
-
const D = F.has(d.key), r = M || m &&
|
|
133
|
+
const D = F.has(d.key), r = M || m && i.length > 1;
|
|
134
134
|
D && r && $e(d), D || (m ? Ae(d) : E([d]));
|
|
135
135
|
}
|
|
136
136
|
return {
|
|
@@ -143,33 +143,33 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}), ze = Ue(
|
|
146
|
-
{ ref:
|
|
146
|
+
{ ref: k },
|
|
147
147
|
{ suppressRefError: !0 }
|
|
148
|
-
), p = Ve(He({ ref:
|
|
149
|
-
Te?.(e),
|
|
148
|
+
), p = Ve(He({ ref: oe([We, Q]) })), Ge = (e) => {
|
|
149
|
+
Te?.(e), I && !l && f();
|
|
150
150
|
}, Je = (e) => {
|
|
151
151
|
const t = e.relatedTarget || document.activeElement;
|
|
152
|
-
!!(t &&
|
|
152
|
+
!!(t && k.current?.contains(t)) || (Me?.(e), p.onBlur(e));
|
|
153
153
|
}, Qe = (e) => {
|
|
154
|
-
p.onKeyDown(e),
|
|
154
|
+
p.onKeyDown(e), I && !l && e.key.length === 1 && f(), [" ", "Enter"].includes(e.key) && !I && !w && e.target.tagName !== "INPUT" && (e.preventDefault(), (!l || P === -1) && K());
|
|
155
155
|
}, Xe = (e) => {
|
|
156
|
-
|
|
157
|
-
}, Ye =
|
|
156
|
+
k.current?.contains(e.target) || (!I || e.target.tagName !== "INPUT" ? K() : f());
|
|
157
|
+
}, Ye = W(
|
|
158
158
|
(e) => {
|
|
159
159
|
E(
|
|
160
160
|
Array.from(e.target.options).reduce(
|
|
161
|
-
(t,
|
|
161
|
+
(t, s, n) => s.selected ? t.concat(c[n]) : t,
|
|
162
162
|
[]
|
|
163
163
|
)
|
|
164
164
|
);
|
|
165
165
|
},
|
|
166
|
-
[
|
|
167
|
-
), Ze =
|
|
168
|
-
({ option: e, index: t, ...
|
|
166
|
+
[c, E]
|
|
167
|
+
), Ze = W(
|
|
168
|
+
({ option: e, index: t, ...s }) => {
|
|
169
169
|
if (!e) return null;
|
|
170
170
|
const n = te.get(e.key);
|
|
171
171
|
if (n === void 0) return null;
|
|
172
|
-
const d =
|
|
172
|
+
const d = c[n], D = ne({
|
|
173
173
|
item: d,
|
|
174
174
|
index: n,
|
|
175
175
|
disabled: e.disabled,
|
|
@@ -186,7 +186,7 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
186
186
|
});
|
|
187
187
|
return /* @__PURE__ */ a(st.Fragment, { children: J({
|
|
188
188
|
...z,
|
|
189
|
-
...
|
|
189
|
+
...s,
|
|
190
190
|
className: $,
|
|
191
191
|
innerProps: D,
|
|
192
192
|
index: t,
|
|
@@ -199,7 +199,7 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
199
199
|
},
|
|
200
200
|
[
|
|
201
201
|
z,
|
|
202
|
-
|
|
202
|
+
c,
|
|
203
203
|
te,
|
|
204
204
|
$,
|
|
205
205
|
ne,
|
|
@@ -209,56 +209,56 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
209
209
|
J
|
|
210
210
|
]
|
|
211
211
|
);
|
|
212
|
-
|
|
212
|
+
j(() => {
|
|
213
213
|
V && f();
|
|
214
|
-
}, [V, f]),
|
|
214
|
+
}, [V, f]), j(() => {
|
|
215
215
|
N === !0 && f();
|
|
216
216
|
}, [N, f]);
|
|
217
|
-
const B =
|
|
218
|
-
if (!
|
|
219
|
-
const e = _ === "field" ? "width" : "minWidth", t = Math.round(
|
|
220
|
-
X.current !== t && (X.current = t,
|
|
217
|
+
const B = W(() => {
|
|
218
|
+
if (!k.current || !b.current) return;
|
|
219
|
+
const e = _ === "field" ? "width" : "minWidth", t = Math.round(b.current.getBoundingClientRect().width);
|
|
220
|
+
X.current !== t && (X.current = t, k.current.style[e] = `${t}px`);
|
|
221
221
|
}, [_]);
|
|
222
|
-
|
|
223
|
-
if (!l || !
|
|
222
|
+
j(() => {
|
|
223
|
+
if (!l || !b.current) return;
|
|
224
224
|
const e = () => {
|
|
225
225
|
g.current && window.clearTimeout(g.current), g.current = window.setTimeout(B, 50);
|
|
226
226
|
}, t = new ct(e);
|
|
227
|
-
return t.observe(
|
|
227
|
+
return t.observe(b.current), B(), () => {
|
|
228
228
|
t.disconnect(), g.current && window.clearTimeout(g.current), g.current = null;
|
|
229
229
|
};
|
|
230
|
-
}, [l, B
|
|
231
|
-
const et = m ?
|
|
230
|
+
}, [l, B]);
|
|
231
|
+
const et = m ? i.map((e) => e.key?.toString()) : i[0]?.key?.toString(), tt = c.length > 0 || Be || !!H, nt = O ? /* @__PURE__ */ a("span", { ...qe(), children: Ie ? `${O} *` : O }) : void 0;
|
|
232
232
|
return /* @__PURE__ */ rt(
|
|
233
233
|
"div",
|
|
234
234
|
{
|
|
235
235
|
..._e({
|
|
236
|
-
ref:
|
|
236
|
+
ref: b,
|
|
237
237
|
...u && { "aria-disabled": !0 },
|
|
238
|
-
className:
|
|
238
|
+
className: re(v.component, { [v.block]: ke }, x)
|
|
239
239
|
}),
|
|
240
240
|
onKeyDown: u ? void 0 : Qe,
|
|
241
241
|
tabIndex: -1,
|
|
242
242
|
id: "slect_wrapper",
|
|
243
|
-
"data-test-id": A("combobox",
|
|
243
|
+
"data-test-id": A("combobox", o),
|
|
244
244
|
children: [
|
|
245
|
-
|
|
245
|
+
w && /* @__PURE__ */ a(
|
|
246
246
|
at,
|
|
247
247
|
{
|
|
248
|
-
className:
|
|
248
|
+
className: v.nativeSelect,
|
|
249
249
|
disabled: u,
|
|
250
250
|
multiple: m,
|
|
251
251
|
name: h,
|
|
252
252
|
value: et,
|
|
253
253
|
onChange: Ye,
|
|
254
|
-
options:
|
|
254
|
+
options: R
|
|
255
255
|
}
|
|
256
256
|
),
|
|
257
257
|
/* @__PURE__ */ a(
|
|
258
258
|
Se,
|
|
259
259
|
{
|
|
260
|
-
selectedMultiple:
|
|
261
|
-
selected:
|
|
260
|
+
selectedMultiple: i,
|
|
261
|
+
selected: i[0],
|
|
262
262
|
multiple: m,
|
|
263
263
|
open: l,
|
|
264
264
|
disabled: u,
|
|
@@ -274,19 +274,19 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
274
274
|
onBlur: Je,
|
|
275
275
|
onFocus: u ? void 0 : Ge,
|
|
276
276
|
onClick: u ? void 0 : Xe,
|
|
277
|
-
tabIndex:
|
|
278
|
-
ref:
|
|
277
|
+
tabIndex: w || u ? -1 : 0,
|
|
278
|
+
ref: oe([p.ref]),
|
|
279
279
|
id: p.id,
|
|
280
280
|
"aria-labelledby": p["aria-labelledby"],
|
|
281
281
|
"aria-controls": p["aria-controls"],
|
|
282
|
-
"aria-autocomplete":
|
|
282
|
+
"aria-autocomplete": I ? p["aria-autocomplete"] : void 0
|
|
283
283
|
},
|
|
284
|
-
dataTestId: A("field",
|
|
284
|
+
dataTestId: A("field", o),
|
|
285
285
|
...xe
|
|
286
286
|
}
|
|
287
287
|
),
|
|
288
|
-
h && !
|
|
289
|
-
!
|
|
288
|
+
h && !w && i.map((e) => /* @__PURE__ */ a("input", { type: "hidden", name: h, value: e.key }, e.key)),
|
|
289
|
+
!w && /* @__PURE__ */ a(
|
|
290
290
|
it,
|
|
291
291
|
{
|
|
292
292
|
open: l,
|
|
@@ -297,27 +297,34 @@ const ce = (c) => c ? c.key?.toString() : "", ie = (c) => {
|
|
|
297
297
|
withArrow: he,
|
|
298
298
|
preventFlip: ge,
|
|
299
299
|
className: de,
|
|
300
|
-
popperClassName:
|
|
300
|
+
popperClassName: v.popoverInner,
|
|
301
301
|
update: Fe,
|
|
302
302
|
zIndex: Ke,
|
|
303
|
-
children: tt && /* @__PURE__ */ a(
|
|
304
|
-
|
|
303
|
+
children: tt && /* @__PURE__ */ a(
|
|
304
|
+
"div",
|
|
305
305
|
{
|
|
306
|
-
...
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
306
|
+
...ze,
|
|
307
|
+
className: re(ue, v.optionsList),
|
|
308
|
+
children: /* @__PURE__ */ a(
|
|
309
|
+
Oe,
|
|
310
|
+
{
|
|
311
|
+
...Re,
|
|
312
|
+
flatOptions: c,
|
|
313
|
+
highlightedIndex: P,
|
|
314
|
+
open: l,
|
|
315
|
+
size: S,
|
|
316
|
+
toggleMenu: K,
|
|
317
|
+
actionButton: H,
|
|
318
|
+
options: ae ?? R,
|
|
319
|
+
Optgroup: Ee,
|
|
320
|
+
Option: Ze,
|
|
321
|
+
visibleOptions: Le,
|
|
322
|
+
onScroll: Ne,
|
|
323
|
+
dataTestId: A("options-list", o)
|
|
324
|
+
}
|
|
325
|
+
)
|
|
319
326
|
}
|
|
320
|
-
)
|
|
327
|
+
)
|
|
321
328
|
}
|
|
322
329
|
)
|
|
323
330
|
]
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { CheckmarkProps } from '../../typings';
|
|
3
|
-
export declare const Checkmark: ({ selected }: CheckmarkProps) =>
|
|
2
|
+
export declare const Checkmark: ({ selected }: CheckmarkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { FormControlProps } from '../../../form-control';
|
|
3
2
|
import { SelectFieldProps as BaseFieldProps } from '../../typings';
|
|
4
|
-
export declare const SelectField: ({ size, open, multiple, error, hint, disabled, label, placeholder, selectedMultiple, selected, rightAddons, valueRenderer, Arrow, innerProps, dataTestId, fieldClassName, ...restProps }: BaseFieldProps & FormControlProps) =>
|
|
3
|
+
export declare const SelectField: ({ size, open, multiple, error, hint, disabled, label, placeholder, selectedMultiple, selected, rightAddons, valueRenderer, Arrow, innerProps, dataTestId, fieldClassName, ...restProps }: BaseFieldProps & FormControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import L from "
|
|
2
|
+
import w from "classnames";
|
|
3
|
+
import d, { useState as E, useRef as L, useCallback as f } from "react";
|
|
4
4
|
import { FormControl as O } from "../../../form-control/component.js";
|
|
5
5
|
import { useFocus as W } from "../../../hooks/useFocus/index.js";
|
|
6
6
|
import { joinOptions as q } from "../../utils.js";
|
|
@@ -24,7 +24,7 @@ const P = ({
|
|
|
24
24
|
fieldClassName: B,
|
|
25
25
|
...C
|
|
26
26
|
}) => {
|
|
27
|
-
const [R, a] =
|
|
27
|
+
const [R, a] = E(!1), i = L(null), [y] = W(i, "keyboard"), S = f(() => a(!0), []), V = f(() => a(!1), []), m = j({ selected: v, selectedMultiple: N }), s = !!m, g = !!n && (s || !l);
|
|
28
28
|
return /* @__PURE__ */ o(
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
@@ -35,7 +35,7 @@ const P = ({
|
|
|
35
35
|
children: /* @__PURE__ */ o(
|
|
36
36
|
O,
|
|
37
37
|
{
|
|
38
|
-
fieldClassName:
|
|
38
|
+
fieldClassName: w(e.field, B, {
|
|
39
39
|
[e.disabled]: c,
|
|
40
40
|
[e.focusVisible]: y
|
|
41
41
|
}),
|
|
@@ -49,7 +49,10 @@ const P = ({
|
|
|
49
49
|
hint: b,
|
|
50
50
|
rightAddons: (t || r) && /* @__PURE__ */ u(d.Fragment, { children: [
|
|
51
51
|
r,
|
|
52
|
-
t ? d.cloneElement(
|
|
52
|
+
t ? d.cloneElement(
|
|
53
|
+
t,
|
|
54
|
+
{ className: e.arrow }
|
|
55
|
+
) : null
|
|
53
56
|
] }),
|
|
54
57
|
"data-test-id": x,
|
|
55
58
|
...C,
|
|
@@ -2,16 +2,7 @@ import { jsx as l } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as f, useCallback as p, createElement as u } from "react";
|
|
3
3
|
import { isGroup as y } from "../../utils.js";
|
|
4
4
|
const a = ({ option: e }) => /* @__PURE__ */ l("option", { value: e.key, disabled: e.disabled, children: typeof e.content == "string" ? e.content : e.key }), b = ({ label: e, options: c }) => /* @__PURE__ */ l("optgroup", { label: e, children: c.map((t) => /* @__PURE__ */ l(a, { option: t }, t.key)) }), v = f(
|
|
5
|
-
({
|
|
6
|
-
className: e,
|
|
7
|
-
disabled: c,
|
|
8
|
-
multiple: t,
|
|
9
|
-
value: s,
|
|
10
|
-
name: n,
|
|
11
|
-
options: d,
|
|
12
|
-
onChange: m,
|
|
13
|
-
...k
|
|
14
|
-
}, o) => {
|
|
5
|
+
({ className: e, disabled: c, multiple: t, value: s, name: n, options: d, onChange: m, ...k }, o) => {
|
|
15
6
|
const i = p((r) => {
|
|
16
7
|
r.stopPropagation();
|
|
17
8
|
}, []);
|
|
@@ -27,7 +18,9 @@ const a = ({ option: e }) => /* @__PURE__ */ l("option", { value: e.key, disable
|
|
|
27
18
|
onClick: i,
|
|
28
19
|
ref: o,
|
|
29
20
|
...k,
|
|
30
|
-
children: d.map(
|
|
21
|
+
children: d.map(
|
|
22
|
+
(r) => y(r) ? /* @__PURE__ */ u(b, { ...r, key: r.label }) : /* @__PURE__ */ l(a, { option: r }, r.key)
|
|
23
|
+
)
|
|
31
24
|
}
|
|
32
25
|
);
|
|
33
26
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { OptgroupProps } from '../../typings';
|
|
3
|
-
export declare const Optgroup: ({ children, label, size }: OptgroupProps) =>
|
|
2
|
+
export declare const Optgroup: ({ children, label, size }: OptgroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import p from "
|
|
3
|
-
import a from "
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import a from "react";
|
|
4
4
|
import r from "./index.module.css.js";
|
|
5
|
-
const d = ({ children: s, label: m, size: t = "s" }) => /* @__PURE__ */ e(
|
|
6
|
-
/* @__PURE__ */ o("div", { className:
|
|
5
|
+
const d = ({ children: s, label: m, size: t = "s" }) => /* @__PURE__ */ e(a.Fragment, { children: [
|
|
6
|
+
/* @__PURE__ */ o("div", { className: p(r.optgroup, r[t]), children: /* @__PURE__ */ o("span", { className: r.label, children: m }) }),
|
|
7
7
|
s
|
|
8
8
|
] });
|
|
9
9
|
export {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as f, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { isValidElement as k } from "react";
|
|
3
2
|
import s from "classnames";
|
|
3
|
+
import { isValidElement as k } from "react";
|
|
4
4
|
import { Skeleton as x } from "../../../skeleton/component.js";
|
|
5
5
|
import { Checkmark as g } from "../checkmark/component.js";
|
|
6
6
|
import t from "./index.module.css.js";
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { OptionsListProps } from '../../typings';
|
|
3
|
-
export declare const OptionsList:
|
|
2
|
+
export declare const OptionsList: import('react').ForwardRefExoticComponent<OptionsListProps & import('react').RefAttributes<unknown>>;
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import w from "
|
|
5
|
-
import G from "
|
|
1
|
+
import { jsx as s, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import R from "@alphakits/icons/dist/ClockCircleM";
|
|
3
|
+
import N from "classnames";
|
|
4
|
+
import { forwardRef as g, useRef as j, useCallback as w } from "react";
|
|
5
|
+
import G from "react-merge-refs";
|
|
6
6
|
import { Button as L } from "../../../button/component.js";
|
|
7
|
-
import { useVisibleOptions as
|
|
7
|
+
import { useVisibleOptions as M, isGroup as O } from "../../utils.js";
|
|
8
8
|
import { Optgroup as V } from "../optgroup/component.js";
|
|
9
9
|
import t from "./index.module.css.js";
|
|
10
10
|
const W = () => {
|
|
11
11
|
let e = 0;
|
|
12
12
|
return () => e++;
|
|
13
|
-
}, K =
|
|
13
|
+
}, K = g(
|
|
14
14
|
({
|
|
15
15
|
size: e = "s",
|
|
16
|
-
className:
|
|
17
|
-
Option:
|
|
16
|
+
className: d,
|
|
17
|
+
Option: m,
|
|
18
18
|
options: l = [],
|
|
19
19
|
actionButton: i,
|
|
20
|
-
Optgroup:
|
|
20
|
+
Optgroup: c = V,
|
|
21
21
|
dataTestId: p,
|
|
22
|
-
emptyPlaceholder:
|
|
22
|
+
emptyPlaceholder: o,
|
|
23
23
|
visibleOptions: u = 5,
|
|
24
24
|
onScroll: b,
|
|
25
25
|
toggleMenu: h,
|
|
26
26
|
open: x
|
|
27
27
|
}, C) => {
|
|
28
|
-
const
|
|
29
|
-
(r) => /* @__PURE__ */ s(
|
|
28
|
+
const a = j(null), n = W(), v = w(
|
|
29
|
+
(r) => /* @__PURE__ */ s(c, { label: r.label, size: e, children: r.options.map((k) => m({ option: k, index: n() })) }, r.label),
|
|
30
30
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
31
|
-
[
|
|
31
|
+
[m, n, e, c]
|
|
32
32
|
);
|
|
33
|
-
return
|
|
33
|
+
return M({
|
|
34
34
|
visibleOptions: u,
|
|
35
|
-
listRef:
|
|
35
|
+
listRef: a,
|
|
36
36
|
open: x,
|
|
37
37
|
invalidate: l
|
|
38
|
-
}), l.length === 0 && !
|
|
38
|
+
}), l.length === 0 && !o && !i ? null : /* @__PURE__ */ f(
|
|
39
39
|
"div",
|
|
40
40
|
{
|
|
41
|
-
className:
|
|
41
|
+
className: N(t.optionsList, t[e], d),
|
|
42
42
|
"data-test-id": p,
|
|
43
|
-
ref:
|
|
43
|
+
ref: G([a, C]),
|
|
44
44
|
onScroll: b,
|
|
45
45
|
children: [
|
|
46
|
-
l.map(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
l.map(
|
|
47
|
+
(r) => O(r) ? v(r) : m({ option: r, index: n() })
|
|
48
|
+
),
|
|
49
|
+
o && l.length === 0 && /* @__PURE__ */ f("div", { className: t.emptyPlaceholder, children: [
|
|
50
|
+
/* @__PURE__ */ s(R, {}),
|
|
51
|
+
o
|
|
50
52
|
] }),
|
|
51
53
|
!!i && /* @__PURE__ */ s("div", { className: t.actionButtonWrapper, children: /* @__PURE__ */ s(
|
|
52
54
|
L,
|
|
@@ -8,4 +8,4 @@ type SelectSearchProps = Omit<SelectProps, 'options'> & {
|
|
|
8
8
|
options: any;
|
|
9
9
|
searchType?: 'text' | 'number';
|
|
10
10
|
};
|
|
11
|
-
export declare const SelectSearch: ({ options, searchType, onChange, selected, ...restProps }: SelectSearchProps) =>
|
|
11
|
+
export declare const SelectSearch: ({ options, searchType, onChange, selected, ...restProps }: SelectSearchProps) => import("react/jsx-runtime").JSX.Element;
|