@payfit/unity-components 2.46.38 → 2.46.40
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/esm/components/multi-select/MultiSelect.d.ts +6 -1
- package/dist/esm/components/multi-select/MultiSelect.js +286 -238
- package/dist/esm/components/multi-select/Multiselect.context.d.ts +1 -1
- package/dist/esm/components/multi-select/MultiselectTypes.d.ts +5 -4
- package/dist/esm/components/multi-select/parts/MultiSelectOptGroup.d.ts +20 -13
- package/dist/esm/components/multi-select/parts/MultiSelectOptGroup.js +33 -22
- package/dist/esm/components/multi-select/parts/MultiSelectOption.d.ts +6 -3
- package/dist/esm/components/multi-select/parts/MultiSelectOption.js +51 -59
- package/dist/esm/components/multi-select/utils/selection-adapter.d.ts +5 -0
- package/dist/esm/components/multi-select/utils/selection-adapter.js +18 -0
- package/dist/esm/components/phone-number/PhoneNumberInput.js +38 -36
- package/dist/esm/components/select/Select.js +47 -44
- package/package.json +10 -10
- package/dist/esm/components/multi-select/hooks/use-combobox-filter.d.ts +0 -12
- package/dist/esm/components/multi-select/hooks/use-combobox-filter.js +0 -22
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.d.ts +0 -14
- package/dist/esm/components/multi-select/hooks/use-multiselection-state.js +0 -47
- package/dist/esm/components/multi-select/parts/MultiSelectButton.d.ts +0 -18
- package/dist/esm/components/multi-select/parts/MultiSelectButton.js +0 -174
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.d.ts +0 -7
- package/dist/esm/components/multi-select/parts/MultiSelectPopover.js +0 -65
- package/dist/esm/components/select/parts/SearchInput.d.ts +0 -5
- package/dist/esm/components/select/parts/SearchInput.js +0 -59
|
@@ -1,87 +1,90 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as C, useState as F, useMemo as
|
|
1
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as C, useState as F, useMemo as k } from "react";
|
|
3
3
|
import { uyTv as A } from "@payfit/unity-themes";
|
|
4
|
-
import { useFilter as
|
|
5
|
-
import { Select as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
4
|
+
import { useFilter as I, Autocomplete as T } from "react-aria-components/Autocomplete";
|
|
5
|
+
import { Select as U, Popover as V, ListBox as m } from "react-aria-components/Select";
|
|
6
|
+
import { Separator as $ } from "react-aria-components/Separator";
|
|
7
|
+
import { Virtualizer as y, ListLayout as f } from "react-aria-components/Virtualizer";
|
|
8
|
+
import { useIntl as q } from "react-intl";
|
|
9
|
+
import { Search as G } from "../search/Search.js";
|
|
10
|
+
import { SelectButton as H } from "./parts/SelectButton.js";
|
|
11
|
+
const J = A({
|
|
11
12
|
slots: {
|
|
12
13
|
base: "uy:flex uy:flex-col uy:gap-100 uy:w-full",
|
|
13
14
|
popover: "uy:rounded-100 uy:sm:rounded-75 uy:border uy:border-solid uy:border-border-neutral uy:w-[var(--trigger-width)] uy:bg-surface-neutral uy:shadow-300",
|
|
14
15
|
listbox: "uy:overflow-y-auto uy:max-h-[296px] uy:pt-100 uy:pb-100"
|
|
15
16
|
}
|
|
16
|
-
}),
|
|
17
|
+
}), K = ({
|
|
17
18
|
children: r,
|
|
18
19
|
items: t,
|
|
19
20
|
placeholder: s,
|
|
20
21
|
isDisabled: l,
|
|
21
|
-
isInvalid:
|
|
22
|
+
isInvalid: a,
|
|
22
23
|
isReadOnly: i,
|
|
23
|
-
value:
|
|
24
|
+
value: n,
|
|
24
25
|
defaultValue: b,
|
|
25
26
|
onChange: u,
|
|
26
27
|
isSearchable: h = !1,
|
|
27
28
|
onBlur: v,
|
|
28
29
|
placement: x,
|
|
29
|
-
searchInputAriaLabel:
|
|
30
|
+
searchInputAriaLabel: S,
|
|
30
31
|
renderEmptyState: e,
|
|
31
|
-
renderValue:
|
|
32
|
-
...
|
|
33
|
-
},
|
|
34
|
-
const O =
|
|
35
|
-
value:
|
|
32
|
+
renderValue: g,
|
|
33
|
+
...N
|
|
34
|
+
}, w) => {
|
|
35
|
+
const O = q(), [L, M] = F(!1), { contains: P } = I({ sensitivity: "base" }), { base: j, popover: z, listbox: c } = J(), B = n !== void 0 || u !== void 0 ? {
|
|
36
|
+
value: n,
|
|
36
37
|
onChange: u
|
|
37
|
-
} : { defaultValue: b },
|
|
38
|
+
} : { defaultValue: b }, d = k(() => {
|
|
38
39
|
if (e !== void 0)
|
|
39
40
|
return typeof e == "function" ? e : () => e;
|
|
40
41
|
}, [e]);
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
|
|
42
|
+
return /* @__PURE__ */ p(
|
|
43
|
+
U,
|
|
43
44
|
{
|
|
44
45
|
onOpenChange: M,
|
|
45
|
-
...
|
|
46
|
-
ref:
|
|
46
|
+
...N,
|
|
47
|
+
ref: w,
|
|
47
48
|
className: j(),
|
|
48
49
|
placeholder: l ? void 0 : s,
|
|
49
50
|
isDisabled: l || i,
|
|
50
|
-
isInvalid:
|
|
51
|
+
isInvalid: a,
|
|
51
52
|
onBlur: v,
|
|
52
53
|
...B,
|
|
53
54
|
children: [
|
|
54
55
|
/* @__PURE__ */ o(
|
|
55
|
-
|
|
56
|
+
H,
|
|
56
57
|
{
|
|
57
58
|
isDisabled: l,
|
|
58
|
-
isInvalid:
|
|
59
|
+
isInvalid: a,
|
|
59
60
|
isReadOnly: i,
|
|
60
61
|
isOpen: L,
|
|
61
|
-
renderValue:
|
|
62
|
+
renderValue: g
|
|
62
63
|
}
|
|
63
64
|
),
|
|
64
65
|
/* @__PURE__ */ o(
|
|
65
|
-
|
|
66
|
+
V,
|
|
66
67
|
{
|
|
67
68
|
offset: 1,
|
|
68
69
|
containerPadding: 8,
|
|
69
70
|
className: z(),
|
|
70
71
|
placement: x,
|
|
71
|
-
children: h ? /* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */ o(
|
|
73
|
-
|
|
72
|
+
children: h ? /* @__PURE__ */ p(T, { filter: P, children: [
|
|
73
|
+
/* @__PURE__ */ o("div", { className: "uy:m-100", children: /* @__PURE__ */ o(
|
|
74
|
+
G,
|
|
74
75
|
{
|
|
75
|
-
|
|
76
|
+
label: S ?? O.formatMessage({
|
|
76
77
|
id: "unity:component:select:search:label",
|
|
77
78
|
defaultMessage: "Search options"
|
|
78
|
-
})
|
|
79
|
+
}),
|
|
80
|
+
"data-dd-privacy": "mask"
|
|
79
81
|
}
|
|
80
|
-
),
|
|
82
|
+
) }),
|
|
83
|
+
/* @__PURE__ */ o($, { className: "uy:mx-100 uy:border-t uy:border-border-neutral uy:border-solid" }),
|
|
81
84
|
/* @__PURE__ */ o(
|
|
82
|
-
|
|
85
|
+
y,
|
|
83
86
|
{
|
|
84
|
-
layout:
|
|
87
|
+
layout: f,
|
|
85
88
|
layoutOptions: {
|
|
86
89
|
padding: 8
|
|
87
90
|
},
|
|
@@ -90,16 +93,16 @@ const H = A({
|
|
|
90
93
|
{
|
|
91
94
|
items: t,
|
|
92
95
|
className: c(),
|
|
93
|
-
renderEmptyState:
|
|
96
|
+
renderEmptyState: d,
|
|
94
97
|
children: r
|
|
95
98
|
}
|
|
96
99
|
)
|
|
97
100
|
}
|
|
98
101
|
)
|
|
99
102
|
] }) : /* @__PURE__ */ o(
|
|
100
|
-
|
|
103
|
+
y,
|
|
101
104
|
{
|
|
102
|
-
layout:
|
|
105
|
+
layout: f,
|
|
103
106
|
layoutOptions: {
|
|
104
107
|
padding: 8
|
|
105
108
|
},
|
|
@@ -108,7 +111,7 @@ const H = A({
|
|
|
108
111
|
{
|
|
109
112
|
items: t,
|
|
110
113
|
className: c(),
|
|
111
|
-
renderEmptyState:
|
|
114
|
+
renderEmptyState: d,
|
|
112
115
|
children: r
|
|
113
116
|
}
|
|
114
117
|
)
|
|
@@ -119,10 +122,10 @@ const H = A({
|
|
|
119
122
|
]
|
|
120
123
|
}
|
|
121
124
|
);
|
|
122
|
-
},
|
|
123
|
-
return
|
|
125
|
+
}, Q = C(function(t, s) {
|
|
126
|
+
return K(t, s);
|
|
124
127
|
});
|
|
125
|
-
|
|
128
|
+
Q.displayName = "Select";
|
|
126
129
|
export {
|
|
127
|
-
|
|
130
|
+
Q as Select
|
|
128
131
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/unity-components",
|
|
3
|
-
"version": "2.46.
|
|
3
|
+
"version": "2.46.40",
|
|
4
4
|
"module": "./dist/esm/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"skills"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@ariakit/react": "0.4.
|
|
61
|
+
"@ariakit/react": "0.4.29",
|
|
62
62
|
"@formatjs/intl": "4.1.12",
|
|
63
63
|
"@hookform/devtools": "4.4.0",
|
|
64
64
|
"@hookform/resolvers": "5.2.1",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"tailwind-variants": "3.2.2",
|
|
93
93
|
"usehooks-ts": "3.1.1",
|
|
94
94
|
"zod": "4.4.3",
|
|
95
|
-
"@payfit/unity-illustrations": "2.46.
|
|
95
|
+
"@payfit/unity-illustrations": "2.46.40"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"@hookform/devtools": "^4",
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"react-hook-form": "^7",
|
|
105
105
|
"react-router-dom": "^5",
|
|
106
106
|
"zod": "^3 || ^4",
|
|
107
|
-
"@payfit/unity-icons": "2.46.
|
|
108
|
-
"@payfit/unity-themes": "2.46.
|
|
107
|
+
"@payfit/unity-icons": "2.46.40",
|
|
108
|
+
"@payfit/unity-themes": "2.46.40"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@figma/code-connect": "1.4.8",
|
|
@@ -150,14 +150,14 @@
|
|
|
150
150
|
"vite": "7.1.12",
|
|
151
151
|
"vite-plugin-node-polyfills": "0.24.0",
|
|
152
152
|
"vitest": "4.1.0",
|
|
153
|
-
"@payfit/hr-app-eslint": "0.0.0-use.local",
|
|
154
153
|
"@payfit/hr-apps-tsconfigs": "0.0.0-use.local",
|
|
155
154
|
"@payfit/storybook-addon-console-errors": "0.0.0-use.local",
|
|
155
|
+
"@payfit/hr-app-eslint": "0.0.0-use.local",
|
|
156
156
|
"@payfit/storybook-config": "0.0.0-use.local",
|
|
157
|
-
"@payfit/unity-icons": "2.46.
|
|
158
|
-
"@payfit/unity-illustrations": "2.46.
|
|
159
|
-
"@payfit/
|
|
160
|
-
"@payfit/
|
|
157
|
+
"@payfit/unity-icons": "2.46.40",
|
|
158
|
+
"@payfit/unity-illustrations": "2.46.40",
|
|
159
|
+
"@payfit/vite-configs": "0.0.0-use.local",
|
|
160
|
+
"@payfit/unity-themes": "2.46.40"
|
|
161
161
|
},
|
|
162
162
|
"peerDependenciesMeta": {
|
|
163
163
|
"@hookform/devtools": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface UseComboboxFilterProps<T> {
|
|
2
|
-
items?: T[];
|
|
3
|
-
extractSearchableText?: (item: T) => string[];
|
|
4
|
-
enabled?: boolean;
|
|
5
|
-
searchOptions?: Intl.CollatorOptions;
|
|
6
|
-
}
|
|
7
|
-
export interface UseComboboxFilterReturn<T> {
|
|
8
|
-
searchQuery: string;
|
|
9
|
-
setSearchQuery: (value: string) => void;
|
|
10
|
-
matchingItems: T[];
|
|
11
|
-
}
|
|
12
|
-
export declare function useComboboxFilter<T>({ items, extractSearchableText, enabled, searchOptions, }: UseComboboxFilterProps<T>): UseComboboxFilterReturn<T>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useState as m, useMemo as l, startTransition as y } from "react";
|
|
2
|
-
import { useFilter as b } from "react-aria-components/Autocomplete";
|
|
3
|
-
function p({
|
|
4
|
-
items: e = [],
|
|
5
|
-
extractSearchableText: s = (t) => [String(t)],
|
|
6
|
-
enabled: n = !1,
|
|
7
|
-
searchOptions: c = { sensitivity: "base" }
|
|
8
|
-
}) {
|
|
9
|
-
const [t, a] = m(""), o = b(c), i = o.contains.bind(o), u = (r) => {
|
|
10
|
-
y(() => {
|
|
11
|
-
a(r);
|
|
12
|
-
});
|
|
13
|
-
}, h = l(() => !n || t.length === 0 ? e : e.filter((r) => s(r).some((f) => i(f, t))), [n, e, t, s, i]);
|
|
14
|
-
return {
|
|
15
|
-
searchQuery: t,
|
|
16
|
-
setSearchQuery: u,
|
|
17
|
-
matchingItems: h
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export {
|
|
21
|
-
p as useComboboxFilter
|
|
22
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
interface UseMultiSelectionStateProps<V extends string | number = string> {
|
|
2
|
-
selectedKeys?: Set<V>;
|
|
3
|
-
defaultSelectedKeys?: Set<V>;
|
|
4
|
-
onSelectionChange?: (keys: Set<V>) => void;
|
|
5
|
-
}
|
|
6
|
-
interface UseMultiSelectionStateReturn<V extends string | number = string> {
|
|
7
|
-
selectedKeys: Set<V>;
|
|
8
|
-
isSelected: (key: V) => boolean;
|
|
9
|
-
selectKey: (key: V) => void;
|
|
10
|
-
unselectKey: (key: V) => void;
|
|
11
|
-
toggleKey: (key: V) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function useMultiSelectionState<V extends string | number = string>({ selectedKeys: controlledKeys, defaultSelectedKeys, onSelectionChange, }: UseMultiSelectionStateProps<V>): UseMultiSelectionStateReturn<V>;
|
|
14
|
-
export {};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useState as w } from "react";
|
|
2
|
-
function a({
|
|
3
|
-
selectedKeys: c,
|
|
4
|
-
defaultSelectedKeys: K,
|
|
5
|
-
onSelectionChange: d
|
|
6
|
-
}) {
|
|
7
|
-
const [u, r] = w(
|
|
8
|
-
() => K ?? /* @__PURE__ */ new Set()
|
|
9
|
-
), n = c !== void 0, l = n ? c : u;
|
|
10
|
-
return {
|
|
11
|
-
selectedKeys: l,
|
|
12
|
-
isSelected: (t) => l.has(t),
|
|
13
|
-
selectKey: (t) => {
|
|
14
|
-
if (n && d) {
|
|
15
|
-
const e = new Set(l);
|
|
16
|
-
e.add(t), d(e);
|
|
17
|
-
} else
|
|
18
|
-
r((e) => {
|
|
19
|
-
const s = new Set(e);
|
|
20
|
-
return s.add(t), d?.(s), s;
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
unselectKey: (t) => {
|
|
24
|
-
if (n && d) {
|
|
25
|
-
const e = new Set(l);
|
|
26
|
-
e.delete(t), d(e);
|
|
27
|
-
} else
|
|
28
|
-
r((e) => {
|
|
29
|
-
const s = new Set(e);
|
|
30
|
-
return s.delete(t), d?.(s), s;
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
toggleKey: (t) => {
|
|
34
|
-
if (n && d) {
|
|
35
|
-
const e = new Set(l);
|
|
36
|
-
e.has(t) ? e.delete(t) : e.add(t), d(e);
|
|
37
|
-
} else
|
|
38
|
-
r((e) => {
|
|
39
|
-
const s = new Set(e);
|
|
40
|
-
return s.has(t) ? s.delete(t) : s.add(t), d?.(s), s;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
a as useMultiSelectionState
|
|
47
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ForwardedRef, ReactElement } from 'react';
|
|
2
|
-
export interface MultiSelectButtonProps<TItem> {
|
|
3
|
-
placeholder?: string;
|
|
4
|
-
isDisabled?: boolean;
|
|
5
|
-
isReadOnly?: boolean;
|
|
6
|
-
isLoading?: boolean;
|
|
7
|
-
isInvalid?: boolean;
|
|
8
|
-
/** The selected items to show in the button */
|
|
9
|
-
selectedItems: Set<TItem>;
|
|
10
|
-
/** Function to render the selected items */
|
|
11
|
-
renderValue: (values: Set<TItem>) => string;
|
|
12
|
-
onClearButtonPress?: () => void;
|
|
13
|
-
onBlur?: () => void;
|
|
14
|
-
onFocus?: () => void;
|
|
15
|
-
}
|
|
16
|
-
export declare const MultiSelectButton: <TItem>(props: MultiSelectButtonProps<TItem> & {
|
|
17
|
-
ref?: ForwardedRef<HTMLButtonElement>;
|
|
18
|
-
}) => ReactElement;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { memo as D, forwardRef as k, useContext as A, useMemo as K } from "react";
|
|
3
|
-
import { useSelectContext as R, useStoreState as $, Select as L } from "@ariakit/react";
|
|
4
|
-
import { uyTv as P } from "@payfit/unity-themes";
|
|
5
|
-
import { useId as T } from "react-aria/useId";
|
|
6
|
-
import { useIntl as U } from "react-intl";
|
|
7
|
-
import { Badge as W } from "../../badge/Badge.js";
|
|
8
|
-
import { CircularIconButton as q } from "../../icon-button/CircularIconButton.js";
|
|
9
|
-
import { Icon as b } from "../../icon/Icon.js";
|
|
10
|
-
import { Spinner as F } from "../../spinner/Spinner.js";
|
|
11
|
-
import { MultiSelectContext as G } from "../Multiselect.context.js";
|
|
12
|
-
const H = P({
|
|
13
|
-
slots: {
|
|
14
|
-
base: "uy:h-5.5 uy:sm:h-500 uy:flex uy:items-center uy:justify-between uy:py-125 uy:sm:py-100 uy:px-150 uy:w-full uy:border uy:border-solid uy:rounded-100 uy:sm:rounded-75 uy:focus-within:outline-none uy:focus-within:ring-2 uy:focus-within:ring-utility-focus-ring uy:focus-within:ring-offset-2 uy:active:not([disabled]):border-border-form-active uy:pointer-events-auto!",
|
|
15
|
-
inputValue: "uy:flex-1 uy:typography-body uy:text-left uy:line-clamp-1",
|
|
16
|
-
state: "uy:grow-0 uy:outline-none uy:typography-body uy:placeholder:text-content-neutral-lowest uy:inline-flex uy:gap-50 uy:items-center uy:px-100",
|
|
17
|
-
suffix: "uy:text-content-neutral-lowest"
|
|
18
|
-
},
|
|
19
|
-
variants: {
|
|
20
|
-
isDisabled: {
|
|
21
|
-
true: {
|
|
22
|
-
base: "uy:bg-surface-form-disabled uy:cursor-not-allowed uy:border-border-form-disabled uy:text-content-form-disabled",
|
|
23
|
-
inputValue: "uy:text-content-form-disabled!",
|
|
24
|
-
state: "uy:text-content-form-disabled",
|
|
25
|
-
suffix: "uy:text-content-form-disabled"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
isReadOnly: {
|
|
29
|
-
true: {
|
|
30
|
-
base: "uy:bg-surface-form-disabled uy:cursor-not-allowed uy:border-border-form-disabled",
|
|
31
|
-
inputValue: "uy:text-content-form-disabled",
|
|
32
|
-
state: "uy:text-content-form-disabled",
|
|
33
|
-
suffix: "uy:text-content-form-disabled"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
isInvalid: {
|
|
37
|
-
true: {
|
|
38
|
-
base: "uy:bg-surface-form-error uy:border-border-form-error",
|
|
39
|
-
inputValue: "uy:text-content-form-error",
|
|
40
|
-
state: "uy:text-content-form-error"
|
|
41
|
-
// suffix: 'uy:text-content-form-error',
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
isEmpty: {
|
|
45
|
-
true: {
|
|
46
|
-
inputValue: "uy:text-content-neutral-lowest"
|
|
47
|
-
},
|
|
48
|
-
false: {
|
|
49
|
-
inputValue: "uy:text-content-form-enabled"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
compoundVariants: [
|
|
54
|
-
{
|
|
55
|
-
isInvalid: !1,
|
|
56
|
-
isDisabled: !1,
|
|
57
|
-
isReadOnly: !1,
|
|
58
|
-
className: {
|
|
59
|
-
base: "uy:border-border-form-enabled uy:bg-surface-form-enabled",
|
|
60
|
-
inputValue: "uy:text-content-form-enabled uy:bg-surface-form-enabled",
|
|
61
|
-
state: "uy:text-content-neutral-disabled"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
isEmpty: !0,
|
|
66
|
-
isDisabled: !1,
|
|
67
|
-
isReadOnly: !1,
|
|
68
|
-
isInvalid: !1,
|
|
69
|
-
className: {
|
|
70
|
-
inputValue: "uy:text-content-neutral-lowest"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
function J({
|
|
76
|
-
isDisabled: n,
|
|
77
|
-
isReadOnly: t,
|
|
78
|
-
isLoading: c,
|
|
79
|
-
isInvalid: r,
|
|
80
|
-
placeholder: s,
|
|
81
|
-
selectedItems: x,
|
|
82
|
-
renderValue: d,
|
|
83
|
-
onClearButtonPress: g,
|
|
84
|
-
onBlur: w,
|
|
85
|
-
onFocus: h,
|
|
86
|
-
...S
|
|
87
|
-
}, v) {
|
|
88
|
-
const m = T(), u = U(), C = R(), I = $(C, "open"), y = A(G), a = y.maxVisibleItems ?? 0, i = y.selectedKeys ?? /* @__PURE__ */ new Set(), o = Array.from(x), { base: M, inputValue: V, state: B, suffix: N } = H({
|
|
89
|
-
isDisabled: !!n,
|
|
90
|
-
isReadOnly: !!t,
|
|
91
|
-
isInvalid: !!r,
|
|
92
|
-
isEmpty: i.size === 0
|
|
93
|
-
}), f = Math.max(
|
|
94
|
-
o.length - a,
|
|
95
|
-
0
|
|
96
|
-
), O = i.size > 0 && !n && !t && !c, z = K(() => {
|
|
97
|
-
if (o.length === 0) return s;
|
|
98
|
-
const E = o.slice(0, a), j = new Set(E);
|
|
99
|
-
return d(j);
|
|
100
|
-
}, [o, a, d, s]);
|
|
101
|
-
return /* @__PURE__ */ l(
|
|
102
|
-
L,
|
|
103
|
-
{
|
|
104
|
-
...S,
|
|
105
|
-
ref: v,
|
|
106
|
-
className: M(),
|
|
107
|
-
disabled: n || t,
|
|
108
|
-
"aria-invalid": r,
|
|
109
|
-
"aria-readonly": t,
|
|
110
|
-
"aria-labelledby": `${m}-select-button-label`,
|
|
111
|
-
"data-dd-privacy": "mask",
|
|
112
|
-
onBlur: w,
|
|
113
|
-
onFocus: h,
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ e("span", { id: `${m}-select-button-label`, className: V(), children: i.size > 0 ? z : s }),
|
|
116
|
-
/* @__PURE__ */ l("div", { className: B(), children: [
|
|
117
|
-
c && /* @__PURE__ */ e(
|
|
118
|
-
F,
|
|
119
|
-
{
|
|
120
|
-
color: "inherit",
|
|
121
|
-
size: "small",
|
|
122
|
-
label: u.formatMessage({
|
|
123
|
-
id: "unity:component:form-field:form-input:spinner:label",
|
|
124
|
-
defaultMessage: "Loading"
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
),
|
|
128
|
-
r && /* @__PURE__ */ e(
|
|
129
|
-
b,
|
|
130
|
-
{
|
|
131
|
-
src: "WarningCircleOutlined",
|
|
132
|
-
color: "content.form.invalid",
|
|
133
|
-
alt: u.formatMessage({
|
|
134
|
-
id: "unity:component:form-field:form-input:error:alt",
|
|
135
|
-
defaultMessage: "Error"
|
|
136
|
-
})
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
f > 0 && /* @__PURE__ */ l(W, { variant: "numeric", children: [
|
|
140
|
-
"+",
|
|
141
|
-
f
|
|
142
|
-
] }),
|
|
143
|
-
O && /* @__PURE__ */ e(
|
|
144
|
-
q,
|
|
145
|
-
{
|
|
146
|
-
title: u.formatMessage({
|
|
147
|
-
id: "unity:component:common:clear:title",
|
|
148
|
-
defaultMessage: "Clear"
|
|
149
|
-
}),
|
|
150
|
-
icon: "CloseOutlined",
|
|
151
|
-
onPress: () => {
|
|
152
|
-
g?.();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
] }),
|
|
157
|
-
/* @__PURE__ */ e(
|
|
158
|
-
b,
|
|
159
|
-
{
|
|
160
|
-
className: N(),
|
|
161
|
-
src: I ? "CaretUpOutlined" : "CaretDownOutlined",
|
|
162
|
-
role: "presentation"
|
|
163
|
-
}
|
|
164
|
-
)
|
|
165
|
-
]
|
|
166
|
-
}
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
const p = D(k(J));
|
|
170
|
-
p.displayName = "MultiselectButton";
|
|
171
|
-
const ue = p;
|
|
172
|
-
export {
|
|
173
|
-
ue as MultiSelectButton
|
|
174
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectPopoverProps } from '@ariakit/react';
|
|
2
|
-
type MultiSelectPopoverProps = SelectPopoverProps & {
|
|
3
|
-
onBlur?: () => void;
|
|
4
|
-
};
|
|
5
|
-
declare function MultiSelectPopoverComponent({ children, ...props }: MultiSelectPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export declare const MultiSelectPopover: import('react').MemoExoticComponent<typeof MultiSelectPopoverComponent>;
|
|
7
|
-
export {};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { jsx as o, jsxs as e, Fragment as m } from "react/jsx-runtime";
|
|
2
|
-
import { memo as b, useContext as f } from "react";
|
|
3
|
-
import { SelectPopover as h, Combobox as v, ComboboxList as x } from "@ariakit/react";
|
|
4
|
-
import { uyTv as t } from "@payfit/unity-themes";
|
|
5
|
-
import { Icon as g } from "../../icon/Icon.js";
|
|
6
|
-
import { MultiSelectContext as w } from "../Multiselect.context.js";
|
|
7
|
-
const S = t({
|
|
8
|
-
slots: {
|
|
9
|
-
base: "uy:shadow-300 uy:absolute uy:top-full uy:left-0 uy:z-50 uy:w-full uy:rounded-100 uy:sm:rounded-75 uy:border uy:border-solid uy:border-border-neutral uy:bg-surface-neutral uy:overflow-auto uy:max-h-[min(var(--popover-available-height,300px),300px)] uy:outline-none",
|
|
10
|
-
list: "uy:p-100"
|
|
11
|
-
}
|
|
12
|
-
}), N = t({
|
|
13
|
-
slots: {
|
|
14
|
-
wrapper: "uy:sticky uy:top-0 uy:bg-surface-neutral uy:pt-100 uy:px-100",
|
|
15
|
-
base: "uy:flex uy:w-full uy:gap-100 uy:sm:h-500 uy:transition-colors uy:rounded-100 uy:sm:rounded-75 uy:py-125 uy:sm:py-100 uy:bg-surface-form-high-enabled uy:px-125 uy:sm:px-150 uy:typography-body uy:focus-within:outline-none uy:focus-within:ring-2 uy:focus-within:ring-utility-focus-ring uy:focus-within:ring-offset-2 uy:active:border uy:active:border-solid uy:active:border-border-form-active",
|
|
16
|
-
input: "uy:focus-visible:outline-none",
|
|
17
|
-
divider: "uy:my-100 uy:border-t uy:border-border-neutral"
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
function C({
|
|
21
|
-
children: r,
|
|
22
|
-
...s
|
|
23
|
-
}) {
|
|
24
|
-
const i = f(w), { base: l, list: u } = S(), { base: n, input: a, wrapper: y, divider: c } = N(), { onBlur: d, ...p } = s;
|
|
25
|
-
return /* @__PURE__ */ o(
|
|
26
|
-
h,
|
|
27
|
-
{
|
|
28
|
-
portal: !0,
|
|
29
|
-
sameWidth: !0,
|
|
30
|
-
unmountOnHide: !0,
|
|
31
|
-
className: l(),
|
|
32
|
-
onClose: () => d?.(),
|
|
33
|
-
...p,
|
|
34
|
-
children: i.isSearchable ? /* @__PURE__ */ e(m, { children: [
|
|
35
|
-
/* @__PURE__ */ e("div", { className: y(), children: [
|
|
36
|
-
/* @__PURE__ */ e("div", { className: n(), children: [
|
|
37
|
-
/* @__PURE__ */ o(
|
|
38
|
-
g,
|
|
39
|
-
{
|
|
40
|
-
src: "MagnifyingGlassOutlined",
|
|
41
|
-
color: "content.neutral.lowest",
|
|
42
|
-
"aria-hidden": !0
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
/* @__PURE__ */ o(
|
|
46
|
-
v,
|
|
47
|
-
{
|
|
48
|
-
autoSelect: !0,
|
|
49
|
-
placeholder: "Search...",
|
|
50
|
-
className: a()
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
|
-
] }),
|
|
54
|
-
/* @__PURE__ */ o("hr", { className: c() })
|
|
55
|
-
] }),
|
|
56
|
-
/* @__PURE__ */ o(x, { className: u(), children: r })
|
|
57
|
-
] }) : /* @__PURE__ */ o("div", { className: u(), children: r })
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
const M = b(C);
|
|
62
|
-
M.displayName = "MultiSelectPopover";
|
|
63
|
-
export {
|
|
64
|
-
M as MultiSelectPopover
|
|
65
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { jsxs as e, Fragment as l, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as m } from "react";
|
|
3
|
-
import { uyTv as c } from "@payfit/unity-themes";
|
|
4
|
-
import { Input as y } from "react-aria-components/Input";
|
|
5
|
-
import { SearchField as d } from "react-aria-components/SearchField";
|
|
6
|
-
import { useIntl as p } from "react-intl";
|
|
7
|
-
import { CircularIconButton as f } from "../../icon-button/CircularIconButton.js";
|
|
8
|
-
import { Icon as b } from "../../icon/Icon.js";
|
|
9
|
-
const h = c({
|
|
10
|
-
slots: {
|
|
11
|
-
base: "uy:flex uy:gap-100 uy:transition-colors uy:py-125 uy:sm:py-100 uy:px-150 uy:rounded-100 uy:sm:rounded-75 uy:bg-surface-form-high-enabled uy:text-content-form-active uy:mt-100 uy:mb-100 uy:ml-100 uy:mr-100 uy:typography-body uy:focus-within:border uy:focus-within:border-solid uy:focus-within:border-border-form-active",
|
|
12
|
-
input: "uy:flex-grow uy:outline-none uy:[&::-webkit-search-cancel-button]:hidden uy:min-h-300",
|
|
13
|
-
button: "uy:text-content-neutral-enabled",
|
|
14
|
-
separator: "uy:h-[1px] uy:bg-surface-neutral-lowest uy:w-full uy:mt-100"
|
|
15
|
-
}
|
|
16
|
-
}), g = m(
|
|
17
|
-
({ "aria-label": r }, o) => {
|
|
18
|
-
const a = p(), { base: u, input: n, button: i, separator: s } = h();
|
|
19
|
-
return /* @__PURE__ */ e(l, { children: [
|
|
20
|
-
/* @__PURE__ */ e(
|
|
21
|
-
d,
|
|
22
|
-
{
|
|
23
|
-
className: u(),
|
|
24
|
-
ref: o,
|
|
25
|
-
"data-dd-privacy": "mask",
|
|
26
|
-
"aria-label": r,
|
|
27
|
-
children: [
|
|
28
|
-
/* @__PURE__ */ t(
|
|
29
|
-
b,
|
|
30
|
-
{
|
|
31
|
-
src: "MagnifyingGlassOutlined",
|
|
32
|
-
"aria-hidden": "true",
|
|
33
|
-
color: "content.neutral.lowest"
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
/* @__PURE__ */ t(y, { className: n() }),
|
|
37
|
-
/* @__PURE__ */ t(
|
|
38
|
-
f,
|
|
39
|
-
{
|
|
40
|
-
title: a.formatMessage({
|
|
41
|
-
id: "unity:component:common:clear:title",
|
|
42
|
-
defaultMessage: "Clear"
|
|
43
|
-
}),
|
|
44
|
-
className: i(),
|
|
45
|
-
icon: "CloseOutlined",
|
|
46
|
-
asElement: "button"
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
),
|
|
52
|
-
/* @__PURE__ */ t("div", { "aria-hidden": "true", className: s() })
|
|
53
|
-
] });
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
g.displayName = "SearchInput";
|
|
57
|
-
export {
|
|
58
|
-
g as SearchInput
|
|
59
|
-
};
|