welcome-ui 1.0.0-beta.6 → 1.0.0-beta.7
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/{AXB53BZF-KWM2jKTz.js → AXB53BZF-CAQ85RSy.js} +1 -1
- package/dist/{AXB53BZF-BxNazDnS.mjs → AXB53BZF-DCqNWRx3.mjs} +2 -2
- package/dist/Accordion.js +1 -1
- package/dist/Accordion.mjs +2 -2
- package/dist/{BYC7LY2E-BkAEL2VD.js → BYC7LY2E-BE1a2svb.js} +1 -1
- package/dist/{BYC7LY2E-BAjGN7k_.mjs → BYC7LY2E-BNqcw1O8.mjs} +2 -2
- package/dist/Breadcrumb.js +1 -1
- package/dist/Breadcrumb.mjs +4 -3
- package/dist/CustomInput-CHhz-wtr.js +1064 -0
- package/dist/CustomInput-DsJYqH0X.mjs +1272 -0
- package/dist/DatePicker.js +1 -1
- package/dist/DatePicker.mjs +1 -1
- package/dist/DateTimePicker.js +1 -1
- package/dist/DateTimePicker.mjs +1 -1
- package/dist/DateTimePickerCommon.js +1 -1
- package/dist/DateTimePickerCommon.mjs +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drawer.mjs +3 -3
- package/dist/DropdownMenu.js +1 -1
- package/dist/DropdownMenu.mjs +5 -5
- package/dist/FileDrop.js +1 -1
- package/dist/FileDrop.mjs +4 -3
- package/dist/{JC64G2H7-CQsqXPS_.mjs → JC64G2H7-HxATiU-t.mjs} +2 -2
- package/dist/{JC64G2H7-YkBMNrtl.js → JC64G2H7-VmOGyhc1.js} +1 -1
- package/dist/{MTZPJQMC-DZ3zg4be.mjs → MTZPJQMC-C9lHSyrL.mjs} +1 -1
- package/dist/{MTZPJQMC-5Xg78Uyy.js → MTZPJQMC-D0pYOjc_.js} +1 -1
- package/dist/Modal.js +1 -1
- package/dist/Modal.mjs +3 -3
- package/dist/{P4IRICAX-DF0_vmod.mjs → P4IRICAX-C0oIr4wI.mjs} +1 -1
- package/dist/{P4IRICAX-nhgZ26A1.js → P4IRICAX-t3xfwWga.js} +1 -1
- package/dist/Popover.js +1 -1
- package/dist/Popover.mjs +1 -1
- package/dist/{QYJ6MIDR-CRK3satR.js → QYJ6MIDR-T-fJ_t8N.js} +1 -1
- package/dist/{QYJ6MIDR-Cy39pEs2.mjs → QYJ6MIDR-YegHsExc.mjs} +2 -2
- package/dist/{SYRFVSLH-BpAfr7UE.js → SYRFVSLH-Babm193P.js} +1 -1
- package/dist/{SYRFVSLH-DyepaZf7.mjs → SYRFVSLH-DXZgEwus.mjs} +1 -1
- package/dist/Search.js +7 -7
- package/dist/Search.mjs +36 -36
- package/dist/Select.js +1 -1
- package/dist/Select.mjs +5 -4
- package/dist/Tabs.js +8 -8
- package/dist/Tabs.mjs +168 -173
- package/dist/TimePicker.js +1 -1
- package/dist/TimePicker.mjs +1 -1
- package/dist/Toast.js +1 -1
- package/dist/Toast.mjs +1 -1
- package/dist/Tooltip.js +1 -1
- package/dist/Tooltip.mjs +2 -2
- package/dist/{VEVQD5MH-mN1wMozH.js → VEVQD5MH-Cal9SWXl.js} +1 -1
- package/dist/{VEVQD5MH-De4r89YE.mjs → VEVQD5MH-DOp_qaPw.mjs} +1 -1
- package/dist/{VGCJ63VH-fv0YLRh8.mjs → VGCJ63VH-BqPfqkK_.mjs} +1 -1
- package/dist/{VGCJ63VH-BNLwLOaC.js → VGCJ63VH-Cuf7P3qW.js} +1 -1
- package/dist/WelcomeLoader.js +1 -11
- package/dist/WelcomeLoader.mjs +25 -5086
- package/dist/{index-BPNky7_R.js → index-B8roHPE-.js} +1 -1
- package/dist/index-BFQbRuqA.mjs +165 -0
- package/dist/{index-BYdkhqH4.mjs → index-BZmKn5VO.mjs} +11 -14
- package/dist/index-BjGfAqCk.mjs +209 -0
- package/dist/{index-BHi0wohR.js → index-CQyLvMJP.js} +23 -23
- package/dist/{index-DG4lwZUW.mjs → index-Cjf3wLkx.mjs} +3 -3
- package/dist/index-CmBs24Im.mjs +413 -0
- package/dist/index-DG7ovxHW.js +117 -0
- package/dist/index-DSZG0Sqy.js +54 -0
- package/dist/index-DhF591OM.js +42 -0
- package/dist/index.js +7 -7
- package/dist/index.mjs +2154 -2216
- package/dist/{usePopover-Bbhh3p_j.mjs → usePopover-AbS2gpZq.mjs} +2 -2
- package/dist/{usePopover-PCWsuJNF.js → usePopover-CzPtX0h_.js} +1 -1
- package/package.json +1 -1
- package/dist/CustomInput-DUq7mNvC.mjs +0 -7826
- package/dist/CustomInput-NV_j0IWq.js +0 -1070
- package/dist/downshift.esm-DAo-GJwH.js +0 -1
- package/dist/downshift.esm-K4YLLQXl.mjs +0 -1085
- package/dist/index-BLom3M2B.js +0 -2
- package/dist/index-BZq8PyIk.js +0 -46
- package/dist/index-CGZVoNIN.mjs +0 -1077
- package/dist/index-DPMCsVtB.js +0 -54
- package/dist/index-R0G4mc9j.mjs +0 -2347
- package/dist/index-SbQUT2mU.mjs +0 -639
- package/dist/index-_oF_K5ZN.js +0 -122
- package/dist/index-mPb8TbpM.mjs +0 -447
|
@@ -4,12 +4,12 @@ import { forwardRef as d } from "./System.mjs";
|
|
|
4
4
|
import a, { css as m, th as n, system as y, useTheme as p } from "@xstyled/styled-components";
|
|
5
5
|
import { Box as i } from "./Box.mjs";
|
|
6
6
|
import { CloseButton as $ } from "./CloseButton.mjs";
|
|
7
|
-
import { D } from "./SYRFVSLH-
|
|
7
|
+
import { D } from "./SYRFVSLH-DXZgEwus.mjs";
|
|
8
8
|
import { Text as f } from "./Text.mjs";
|
|
9
9
|
import { Icon as k } from "./Icon.mjs";
|
|
10
10
|
import { Button as v } from "./Button.mjs";
|
|
11
|
-
import { D as B, u as C } from "./JC64G2H7-
|
|
12
|
-
import { D as I } from "./AXB53BZF-
|
|
11
|
+
import { D as B, u as C } from "./JC64G2H7-HxATiU-t.mjs";
|
|
12
|
+
import { D as I } from "./AXB53BZF-DCqNWRx3.mjs";
|
|
13
13
|
const S = 15, T = 15, _ = '<path fill="currentColor" fill-rule="evenodd" d="M84.496 42.08 26.17 48.79l19.538-21.976a4.112 4.112 0 0 0-.307-5.768 4.02 4.02 0 0 0-5.715.31L13.03 51.338c-.027.03-.044.066-.07.098-.089.105-.166.219-.244.333-.07.105-.144.209-.205.32-.066.119-.116.243-.17.368-.05.118-.104.234-.142.357-.043.129-.067.261-.095.395-.029.129-.058.256-.073.388-.015.128-.014.26-.016.393-.003.104-.02.206-.014.31.003.04.015.078.019.118.003.037-.003.073.001.111.011.108.045.207.065.312.022.115.04.229.07.34.043.157.104.304.165.453.037.088.067.18.109.265.082.166.182.318.285.47.043.06.075.125.12.184.156.208.331.4.524.572l26.658 23.848a4.02 4.02 0 0 0 5.71-.349 4.114 4.114 0 0 0-.345-5.767L25.518 57.088l59.895-6.89c2.219-.256 3.814-2.28 3.56-4.52-.252-2.242-2.253-3.859-4.477-3.597Z" clip-rule="evenodd"/>', j = {
|
|
14
14
|
width: S,
|
|
15
15
|
height: T,
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import i, { useMemo as He, useState as T, useEffect as ce, Fragment as Ne } from "react";
|
|
3
|
+
import de from "downshift";
|
|
4
|
+
import { matchSorter as me } from "match-sorter";
|
|
5
|
+
import { Icon as je, StyledIcon as Ke } from "./Icon.mjs";
|
|
6
|
+
import { ClearButton as qe } from "./ClearButton.mjs";
|
|
7
|
+
import { shouldForwardProp as q, forwardRef as Ge } from "./System.mjs";
|
|
8
|
+
import { c as Le } from "./create-event-rXDe5aCQ.mjs";
|
|
9
|
+
import { d as Ye, F as Je } from "./field-styles-CeV7pnOp.mjs";
|
|
10
|
+
import { StyledTag as Qe, Tag as Xe } from "./Tag.mjs";
|
|
11
|
+
import g, { css as D, system as he, th as u } from "@xstyled/styled-components";
|
|
12
|
+
import { IconWrapper as Oe } from "./Field.mjs";
|
|
13
|
+
import { o as j } from "./overflow-ellipsis-DGV5Kgt-.mjs";
|
|
14
|
+
import { Box as Ue } from "./Box.mjs";
|
|
15
|
+
const Me = 15, et = 15, tt = '<path fill="currentColor" fill-rule="evenodd" d="M50 71a4.399 4.399 0 0 1-2.936-1.119L17.49 43.552a4.468 4.468 0 0 1-.377-6.283 4.416 4.416 0 0 1 6.253-.379l26.278 23.397 26.632-29.81a4.412 4.412 0 0 1 6.253-.338 4.464 4.464 0 0 1 .337 6.283l-29.57 33.1A4.412 4.412 0 0 1 49.998 71Z" clip-rule="evenodd"/>', nt = {
|
|
16
|
+
width: Me,
|
|
17
|
+
height: et,
|
|
18
|
+
block: tt
|
|
19
|
+
}, ot = (e) => /* @__PURE__ */ i.createElement(je, { alt: "Down", content: nt, ...e }), G = "", be = (e) => {
|
|
20
|
+
if (typeof e == "number")
|
|
21
|
+
return String(e);
|
|
22
|
+
if (typeof e == "string") {
|
|
23
|
+
const t = e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);
|
|
24
|
+
return t && t.map((n) => n.toLowerCase()).join("-");
|
|
25
|
+
}
|
|
26
|
+
}, fe = (e) => e ? e.label : G, lt = (e) => e.reduce(
|
|
27
|
+
(t, n) => n.label && t.length > n.label.length ? t : n.label,
|
|
28
|
+
G
|
|
29
|
+
), it = (e, t, n) => {
|
|
30
|
+
const l = t.find((a) => e.value === a.value);
|
|
31
|
+
return l && n ? t.filter((a) => e.value !== a.value) : l ? t : [...t, e];
|
|
32
|
+
}, H = (e, t) => !!t.find((n) => n.value === e), K = (e, t = []) => t.find(
|
|
33
|
+
(l) => l.label === (e.label || e) || l.value === (e.value || e)
|
|
34
|
+
) || { value: be(e), label: e }, rt = (e, t, n = !1) => {
|
|
35
|
+
const l = n ? t.flatMap((a) => a.options) : t;
|
|
36
|
+
return !e && e !== 0 ? [] : Array.isArray(e) ? e.map((a) => K(a, l)) : [K(e, l)];
|
|
37
|
+
}, at = (e, t) => !!t.find((n) => n.value === e.value), st = (e, t) => at(e, t) ? e.value : e.label, ue = (e, t) => {
|
|
38
|
+
if (e)
|
|
39
|
+
return e.map((n) => st(n, t));
|
|
40
|
+
}, ct = (e, t) => {
|
|
41
|
+
if (e)
|
|
42
|
+
return e.filter(
|
|
43
|
+
(n) => !t.find((l) => l.value === n.value)
|
|
44
|
+
);
|
|
45
|
+
}, dt = ({
|
|
46
|
+
inputValue: e,
|
|
47
|
+
isMultiple: t,
|
|
48
|
+
isSearchable: n,
|
|
49
|
+
options: l,
|
|
50
|
+
renderItem: a
|
|
51
|
+
}) => {
|
|
52
|
+
const h = K(e, l);
|
|
53
|
+
return t ? e : h.label ? n ? h.label : a(h) : G;
|
|
54
|
+
}, ve = g(Oe)``, Ie = g(Ue).withConfig({ shouldForwardProp: q })(
|
|
55
|
+
({ disabled: e }) => D`
|
|
56
|
+
position: relative;
|
|
57
|
+
${he}
|
|
58
|
+
${ve} {
|
|
59
|
+
color: ${e ? u("defaultFields.select.disabled.color") : "initial"};
|
|
60
|
+
}
|
|
61
|
+
`
|
|
62
|
+
), mt = g.div`
|
|
63
|
+
position: relative;
|
|
64
|
+
`, pe = g("div").withConfig({ shouldForwardProp: q })(
|
|
65
|
+
({ iconPlacement: e, isClearable: t, size: n, transparent: l, variant: a }) => D`
|
|
66
|
+
position: relative;
|
|
67
|
+
${Ye({
|
|
68
|
+
size: n,
|
|
69
|
+
variant: a,
|
|
70
|
+
transparent: l,
|
|
71
|
+
isClearable: t,
|
|
72
|
+
iconPlacement: e
|
|
73
|
+
})};
|
|
74
|
+
${j};
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
${he}
|
|
77
|
+
line-height: 1em;
|
|
78
|
+
|
|
79
|
+
br {
|
|
80
|
+
display: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&::before {
|
|
84
|
+
content: attr(data-spacer);
|
|
85
|
+
visibility: hidden;
|
|
86
|
+
display: block;
|
|
87
|
+
height: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&:empty {
|
|
91
|
+
&::after {
|
|
92
|
+
content: attr(placeholder);
|
|
93
|
+
position: absolute;
|
|
94
|
+
top: 0;
|
|
95
|
+
right: 0;
|
|
96
|
+
bottom: 0;
|
|
97
|
+
left: 0;
|
|
98
|
+
${j};
|
|
99
|
+
padding: inherit;
|
|
100
|
+
${u("defaultFields.placeholder")}
|
|
101
|
+
}
|
|
102
|
+
&::before {
|
|
103
|
+
height: auto;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
`
|
|
107
|
+
), ft = g.ul`
|
|
108
|
+
${u("defaultFields.select.default")};
|
|
109
|
+
${u("cards.default")};
|
|
110
|
+
position: absolute;
|
|
111
|
+
z-index: 2;
|
|
112
|
+
right: 0;
|
|
113
|
+
left: 0;
|
|
114
|
+
margin: 0;
|
|
115
|
+
margin-top: md;
|
|
116
|
+
padding: 0;
|
|
117
|
+
transition: medium;
|
|
118
|
+
overflow: auto;
|
|
119
|
+
-webkit-overflow-scrolling: touch;
|
|
120
|
+
|
|
121
|
+
&:hover > * {
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
}
|
|
124
|
+
`, N = g.li(
|
|
125
|
+
({
|
|
126
|
+
allowUnselectFromList: e,
|
|
127
|
+
isDisabled: t,
|
|
128
|
+
isHighlighted: n,
|
|
129
|
+
isMultiple: l,
|
|
130
|
+
isSelected: a
|
|
131
|
+
}) => D`
|
|
132
|
+
color: beige-70;
|
|
133
|
+
${n && u("defaultFields.select.highlighted")};
|
|
134
|
+
${a && !l && u("defaultFields.select.selected")};
|
|
135
|
+
${a && l && !e && u("defaultFields.select.existing")};
|
|
136
|
+
${t && u("defaultFields.select.disabled")};
|
|
137
|
+
${j};
|
|
138
|
+
padding: md;
|
|
139
|
+
list-style: none;
|
|
140
|
+
text-decoration: none;
|
|
141
|
+
font-size: sm;
|
|
142
|
+
transition: background ${u.transition("medium")};
|
|
143
|
+
`
|
|
144
|
+
), ut = g.divBox(
|
|
145
|
+
({ size: e }) => D`
|
|
146
|
+
position: absolute;
|
|
147
|
+
padding: 0;
|
|
148
|
+
top: 0;
|
|
149
|
+
bottom: 0;
|
|
150
|
+
right: ${e === "xs" ? "sm" : "md"};
|
|
151
|
+
display: flex;
|
|
152
|
+
gap: xs;
|
|
153
|
+
`
|
|
154
|
+
), ge = g.button.withConfig({ shouldForwardProp: q })(
|
|
155
|
+
({ isOpen: e }) => D`
|
|
156
|
+
position: relative;
|
|
157
|
+
height: 100%;
|
|
158
|
+
padding: 0;
|
|
159
|
+
outline: none !important; /* important for firefox */
|
|
160
|
+
appearance: none;
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
border: none;
|
|
163
|
+
background: transparent;
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
|
|
168
|
+
${Ke} {
|
|
169
|
+
transform: ${e ? "rotate3d(0, 0, 1, 180deg)" : "rotate3d(0)"};
|
|
170
|
+
transition: medium;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&:not(:last-child) {
|
|
174
|
+
width: auto;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:disabled {
|
|
178
|
+
color: ${u("defaultFields.select.disabled.color")};
|
|
179
|
+
}
|
|
180
|
+
`
|
|
181
|
+
), pt = g.divBox`
|
|
182
|
+
margin-top: lg;
|
|
183
|
+
|
|
184
|
+
${/* sc-selector */
|
|
185
|
+
Qe}:not(:last-child) {
|
|
186
|
+
margin-right: sm;
|
|
187
|
+
margin-bottom: sm;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
&:empty {
|
|
191
|
+
display: none;
|
|
192
|
+
}
|
|
193
|
+
`;
|
|
194
|
+
function gt(e, t) {
|
|
195
|
+
return /* @__PURE__ */ i.createElement(pt, { role: "list" }, e.map((n) => /* @__PURE__ */ i.createElement(Xe, { key: n.value, onRemove: () => t(n.value.toString()), role: "listitem" }, n.label)));
|
|
196
|
+
}
|
|
197
|
+
const ht = de.default || de, Rt = Ge(
|
|
198
|
+
({
|
|
199
|
+
allowUnselectFromList: e,
|
|
200
|
+
autoComplete: t = "off",
|
|
201
|
+
autoFocus: n,
|
|
202
|
+
dataTestId: l,
|
|
203
|
+
disableCloseOnSelect: a,
|
|
204
|
+
disabled: h,
|
|
205
|
+
groupsEnabled: x,
|
|
206
|
+
icon: F,
|
|
207
|
+
id: L,
|
|
208
|
+
isClearable: Y,
|
|
209
|
+
isCreatable: _,
|
|
210
|
+
isMultiple: d,
|
|
211
|
+
isSearchable: f,
|
|
212
|
+
name: J,
|
|
213
|
+
onBlur: ye,
|
|
214
|
+
onChange: Q,
|
|
215
|
+
onClick: X,
|
|
216
|
+
onCreate: O,
|
|
217
|
+
onFocus: we,
|
|
218
|
+
options: c = [],
|
|
219
|
+
placeholder: U = "Choose from…",
|
|
220
|
+
renderCreateItem: Ee = (y) => `Create "${y}"`,
|
|
221
|
+
renderGroupHeader: $e,
|
|
222
|
+
renderItem: Z = fe,
|
|
223
|
+
renderMultiple: ke = gt,
|
|
224
|
+
size: R = "md",
|
|
225
|
+
transparent: xe,
|
|
226
|
+
value: M,
|
|
227
|
+
variant: Se,
|
|
228
|
+
...ee
|
|
229
|
+
}, S) => {
|
|
230
|
+
const y = He(
|
|
231
|
+
() => rt(M, c, x),
|
|
232
|
+
[M, c, x]
|
|
233
|
+
), z = !d && y[0] || null, W = z ? z.label : "", [v, B] = T(y), [p, C] = T(W), [V, A] = T(c), [I, w] = T(!1);
|
|
234
|
+
f = _ || f, ce(() => {
|
|
235
|
+
var o;
|
|
236
|
+
n && ((o = S == null ? void 0 : S.current) == null || o.focus(), f && w(!0));
|
|
237
|
+
}, [f, n, S]), ce(() => {
|
|
238
|
+
B(y), C(W), A(c);
|
|
239
|
+
}, [W, c, y]);
|
|
240
|
+
const Ce = (o) => {
|
|
241
|
+
if (f && o !== p) {
|
|
242
|
+
let r = [];
|
|
243
|
+
x ? r = me(c, o, {
|
|
244
|
+
// should match on group.label OR group.options.label
|
|
245
|
+
keys: [(s) => s.label, (s) => s.options.map((E) => E.label)]
|
|
246
|
+
}) : r = me(c, o, { keys: ["label"] }), C(o), A(r);
|
|
247
|
+
}
|
|
248
|
+
}, De = () => {
|
|
249
|
+
f && !I && w(!0);
|
|
250
|
+
}, te = (o) => {
|
|
251
|
+
let r = [];
|
|
252
|
+
x ? r = ue(
|
|
253
|
+
o,
|
|
254
|
+
c.flatMap(($) => $.options)
|
|
255
|
+
) : r = ue(o, c);
|
|
256
|
+
const s = d ? r : r[0], E = Le({ name: J, value: d ? o : o[0] });
|
|
257
|
+
if (Q && Q(s, E), _) {
|
|
258
|
+
const $ = ct(o, c);
|
|
259
|
+
$.length && O && O($[0].label, E);
|
|
260
|
+
}
|
|
261
|
+
}, Fe = (o) => {
|
|
262
|
+
let r, s;
|
|
263
|
+
!o || o != null && o.disabled ? (r = d ? v : [], s = !0) : (r = d ? it(o, v, e) : [o], s = d), s && C(""), A(c), B(r), te(r), a || w(!1);
|
|
264
|
+
}, Re = (o) => {
|
|
265
|
+
const r = v.filter((s) => s.value !== o);
|
|
266
|
+
B(r), te(r);
|
|
267
|
+
}, Ve = (o) => {
|
|
268
|
+
d && o.selectedItem ? C("") : f && o.selectedItem && C(o.selectedItem.label), A(c), w(!1);
|
|
269
|
+
}, Ae = lt(c), ne = dt({
|
|
270
|
+
inputValue: p,
|
|
271
|
+
isMultiple: d,
|
|
272
|
+
isSearchable: f,
|
|
273
|
+
options: c,
|
|
274
|
+
renderItem: Z
|
|
275
|
+
});
|
|
276
|
+
return /* @__PURE__ */ i.createElement(
|
|
277
|
+
ht,
|
|
278
|
+
{
|
|
279
|
+
id: L,
|
|
280
|
+
inputValue: f ? ne : "",
|
|
281
|
+
isOpen: I,
|
|
282
|
+
itemToString: fe,
|
|
283
|
+
onInputValueChange: Ce,
|
|
284
|
+
onOuterClick: Ve,
|
|
285
|
+
onSelect: Fe,
|
|
286
|
+
selectedItem: z
|
|
287
|
+
},
|
|
288
|
+
({
|
|
289
|
+
clearSelection: o,
|
|
290
|
+
getInputProps: r,
|
|
291
|
+
getItemProps: s,
|
|
292
|
+
getMenuProps: E,
|
|
293
|
+
getRootProps: $,
|
|
294
|
+
getToggleButtonProps: Te,
|
|
295
|
+
highlightedIndex: P
|
|
296
|
+
}) => {
|
|
297
|
+
const oe = !!(_ && p && !H(p, v)), _e = I && (V.length || oe), Ze = Y && p, ze = /* @__PURE__ */ i.createElement(ge, { as: "div" }, /* @__PURE__ */ i.createElement(
|
|
298
|
+
qe,
|
|
299
|
+
{
|
|
300
|
+
onClick: o
|
|
301
|
+
}
|
|
302
|
+
)), We = /* @__PURE__ */ i.createElement(
|
|
303
|
+
ge,
|
|
304
|
+
{
|
|
305
|
+
"data-testid": l && `${l}-arrow-icon`,
|
|
306
|
+
disabled: h,
|
|
307
|
+
isOpen: I,
|
|
308
|
+
size: R,
|
|
309
|
+
tabIndex: -1,
|
|
310
|
+
...Te({
|
|
311
|
+
onClick: () => w(!I)
|
|
312
|
+
})
|
|
313
|
+
},
|
|
314
|
+
/* @__PURE__ */ i.createElement(ot, { size: "sm" })
|
|
315
|
+
), Be = (k) => {
|
|
316
|
+
X && X(k), w(!I);
|
|
317
|
+
}, Pe = $(ee), le = r({
|
|
318
|
+
autoComplete: t,
|
|
319
|
+
autoFocus: n,
|
|
320
|
+
"data-spacer": Ae || U,
|
|
321
|
+
"data-testid": l,
|
|
322
|
+
disabled: h,
|
|
323
|
+
iconPlacement: F ? "both" : "right",
|
|
324
|
+
id: L,
|
|
325
|
+
name: J,
|
|
326
|
+
onBlur: ye,
|
|
327
|
+
onClick: h ? void 0 : Be,
|
|
328
|
+
onFocus: we,
|
|
329
|
+
onKeyDown: De,
|
|
330
|
+
placeholder: U,
|
|
331
|
+
ref: S,
|
|
332
|
+
size: R,
|
|
333
|
+
tabIndex: 0,
|
|
334
|
+
variant: I ? "focused" : Se,
|
|
335
|
+
isClearable: Y,
|
|
336
|
+
transparent: xe,
|
|
337
|
+
...ee
|
|
338
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
339
|
+
}), ie = Je[R];
|
|
340
|
+
return /* @__PURE__ */ i.createElement(Ie, { ...Pe, disabled: h }, /* @__PURE__ */ i.createElement(mt, null, f ? /* @__PURE__ */ i.createElement(pe, { as: "input", type: "text", ...le }) : /* @__PURE__ */ i.createElement(pe, { ...le }, ne), F && /* @__PURE__ */ i.createElement(ve, { iconPlacement: "left", size: ie }, i.cloneElement(F, { ...F.props, size: ie })), /* @__PURE__ */ i.createElement(ut, { size: R }, Ze && ze, We)), _e && /* @__PURE__ */ i.createElement(ft, { ...E() }, V.reduce(
|
|
341
|
+
(k, m, re) => {
|
|
342
|
+
if (x && "options" in m)
|
|
343
|
+
k.itemsToRender.push(
|
|
344
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
345
|
+
// @ts-ignore
|
|
346
|
+
/* @__PURE__ */ i.createElement(Ne, { key: m.label }, $e(m), m.options && m.options.map((b) => {
|
|
347
|
+
const ae = k.itemIndex++, se = H(b.value, v);
|
|
348
|
+
return /* @__PURE__ */ i.createElement(
|
|
349
|
+
N,
|
|
350
|
+
{
|
|
351
|
+
allowUnselectFromList: e,
|
|
352
|
+
isDisabled: b.disabled,
|
|
353
|
+
isHighlighted: P === ae,
|
|
354
|
+
isMultiple: d,
|
|
355
|
+
key: b.value,
|
|
356
|
+
...s({
|
|
357
|
+
index: ae,
|
|
358
|
+
isSelected: se,
|
|
359
|
+
item: b
|
|
360
|
+
})
|
|
361
|
+
},
|
|
362
|
+
Z(b, se)
|
|
363
|
+
);
|
|
364
|
+
}))
|
|
365
|
+
);
|
|
366
|
+
else if ("value" in m) {
|
|
367
|
+
const b = H(m.value, v);
|
|
368
|
+
k.itemsToRender.push(
|
|
369
|
+
/* @__PURE__ */ i.createElement(
|
|
370
|
+
N,
|
|
371
|
+
{
|
|
372
|
+
allowUnselectFromList: e,
|
|
373
|
+
isDisabled: m.disabled,
|
|
374
|
+
isHighlighted: P === re,
|
|
375
|
+
isMultiple: d,
|
|
376
|
+
key: m.value,
|
|
377
|
+
...s({
|
|
378
|
+
index: re,
|
|
379
|
+
isSelected: b,
|
|
380
|
+
item: m
|
|
381
|
+
})
|
|
382
|
+
},
|
|
383
|
+
Z(m, b)
|
|
384
|
+
)
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
return k;
|
|
388
|
+
},
|
|
389
|
+
{ itemsToRender: [], itemIndex: 0 }
|
|
390
|
+
).itemsToRender, oe && p.length && /* @__PURE__ */ i.createElement(
|
|
391
|
+
N,
|
|
392
|
+
{
|
|
393
|
+
isHighlighted: P === V.length,
|
|
394
|
+
key: "add",
|
|
395
|
+
...s({
|
|
396
|
+
index: V.length,
|
|
397
|
+
item: {
|
|
398
|
+
value: be(p),
|
|
399
|
+
label: p
|
|
400
|
+
}
|
|
401
|
+
})
|
|
402
|
+
},
|
|
403
|
+
Ee(p)
|
|
404
|
+
)), d && ke(v, Re));
|
|
405
|
+
}
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
), Vt = Ie;
|
|
409
|
+
export {
|
|
410
|
+
ot as D,
|
|
411
|
+
Vt as S,
|
|
412
|
+
Rt as a
|
|
413
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use client";"use strict";const l=require("react"),se=require("downshift"),ie=require("match-sorter"),me=require("./Icon.js"),We=require("./ClearButton.js"),P=require("./System.js"),He=require("./create-event-YSlay9Ef.js"),fe=require("./field-styles-D_gf6ypV.js"),he=require("./Tag.js"),r=require("@xstyled/styled-components"),Ne=require("./Field.js"),H=require("./overflow-ellipsis-C2ESrF8C.js"),_e=require("./Box.js"),je=15,Ke=15,Ge='<path fill="currentColor" fill-rule="evenodd" d="M50 71a4.399 4.399 0 0 1-2.936-1.119L17.49 43.552a4.468 4.468 0 0 1-.377-6.283 4.416 4.416 0 0 1 6.253-.379l26.278 23.397 26.632-29.81a4.412 4.412 0 0 1 6.253-.338 4.464 4.464 0 0 1 .337 6.283l-29.57 33.1A4.412 4.412 0 0 1 49.998 71Z" clip-rule="evenodd"/>',Le={width:je,height:Ke,block:Ge},pe=e=>l.createElement(me.Icon,{alt:"Down",content:Le,...e}),_="",ge=e=>{if(typeof e=="number")return String(e);if(typeof e=="string"){const t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g);return t&&t.map(n=>n.toLowerCase()).join("-")}},ce=e=>e?e.label:_,Ye=e=>e.reduce((t,n)=>n.label&&t.length>n.label.length?t:n.label,_),Je=(e,t,n)=>{const s=t.find(c=>e.value===c.value);return s&&n?t.filter(c=>e.value!==c.value):s?t:[...t,e]},z=(e,t)=>!!t.find(n=>n.value===e),N=(e,t=[])=>t.find(s=>s.label===(e.label||e)||s.value===(e.value||e))||{value:ge(e),label:e},Qe=(e,t,n=!1)=>{const s=n?t.flatMap(c=>c.options):t;return!e&&e!==0?[]:Array.isArray(e)?e.map(c=>N(c,s)):[N(e,s)]},Xe=(e,t)=>!!t.find(n=>n.value===e.value),Oe=(e,t)=>Xe(e,t)?e.value:e.label,ae=(e,t)=>{if(e)return e.map(n=>Oe(n,t))},Ue=(e,t)=>{if(e)return e.filter(n=>!t.find(s=>s.value===n.value))},Me=({inputValue:e,isMultiple:t,isSearchable:n,options:s,renderItem:c})=>{const p=N(e,s);return t?e:p.label?n?p.label:c(p):_},ve=r(Ne.IconWrapper)``,be=r(_e.Box).withConfig({shouldForwardProp:P.shouldForwardProp})(({disabled:e})=>r.css`
|
|
2
|
+
position: relative;
|
|
3
|
+
${r.system}
|
|
4
|
+
${ve} {
|
|
5
|
+
color: ${e?r.th("defaultFields.select.disabled.color"):"initial"};
|
|
6
|
+
}
|
|
7
|
+
`),et=r.div`
|
|
8
|
+
position: relative;
|
|
9
|
+
`,de=r("div").withConfig({shouldForwardProp:P.shouldForwardProp})(({iconPlacement:e,isClearable:t,size:n,transparent:s,variant:c})=>r.css`
|
|
10
|
+
position: relative;
|
|
11
|
+
${fe.defaultFieldStyles({size:n,variant:c,transparent:s,isClearable:t,iconPlacement:e})};
|
|
12
|
+
${H.overflowEllipsis};
|
|
13
|
+
cursor: pointer;
|
|
14
|
+
${r.system}
|
|
15
|
+
line-height: 1em;
|
|
16
|
+
|
|
17
|
+
br {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&::before {
|
|
22
|
+
content: attr(data-spacer);
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
display: block;
|
|
25
|
+
height: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:empty {
|
|
29
|
+
&::after {
|
|
30
|
+
content: attr(placeholder);
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
right: 0;
|
|
34
|
+
bottom: 0;
|
|
35
|
+
left: 0;
|
|
36
|
+
${H.overflowEllipsis};
|
|
37
|
+
padding: inherit;
|
|
38
|
+
${r.th("defaultFields.placeholder")}
|
|
39
|
+
}
|
|
40
|
+
&::before {
|
|
41
|
+
height: auto;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`),tt=r.ul`
|
|
45
|
+
${r.th("defaultFields.select.default")};
|
|
46
|
+
${r.th("cards.default")};
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 2;
|
|
49
|
+
right: 0;
|
|
50
|
+
left: 0;
|
|
51
|
+
margin: 0;
|
|
52
|
+
margin-top: md;
|
|
53
|
+
padding: 0;
|
|
54
|
+
transition: medium;
|
|
55
|
+
overflow: auto;
|
|
56
|
+
-webkit-overflow-scrolling: touch;
|
|
57
|
+
|
|
58
|
+
&:hover > * {
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
`,W=r.li(({allowUnselectFromList:e,isDisabled:t,isHighlighted:n,isMultiple:s,isSelected:c})=>r.css`
|
|
62
|
+
color: beige-70;
|
|
63
|
+
${n&&r.th("defaultFields.select.highlighted")};
|
|
64
|
+
${c&&!s&&r.th("defaultFields.select.selected")};
|
|
65
|
+
${c&&s&&!e&&r.th("defaultFields.select.existing")};
|
|
66
|
+
${t&&r.th("defaultFields.select.disabled")};
|
|
67
|
+
${H.overflowEllipsis};
|
|
68
|
+
padding: md;
|
|
69
|
+
list-style: none;
|
|
70
|
+
text-decoration: none;
|
|
71
|
+
font-size: sm;
|
|
72
|
+
transition: background ${r.th.transition("medium")};
|
|
73
|
+
`),nt=r.divBox(({size:e})=>r.css`
|
|
74
|
+
position: absolute;
|
|
75
|
+
padding: 0;
|
|
76
|
+
top: 0;
|
|
77
|
+
bottom: 0;
|
|
78
|
+
right: ${e==="xs"?"sm":"md"};
|
|
79
|
+
display: flex;
|
|
80
|
+
gap: xs;
|
|
81
|
+
`),ue=r.button.withConfig({shouldForwardProp:P.shouldForwardProp})(({isOpen:e})=>r.css`
|
|
82
|
+
position: relative;
|
|
83
|
+
height: 100%;
|
|
84
|
+
padding: 0;
|
|
85
|
+
outline: none !important; /* important for firefox */
|
|
86
|
+
appearance: none;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
border: none;
|
|
89
|
+
background: transparent;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
|
|
94
|
+
${me.StyledIcon} {
|
|
95
|
+
transform: ${e?"rotate3d(0, 0, 1, 180deg)":"rotate3d(0)"};
|
|
96
|
+
transition: medium;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
&:not(:last-child) {
|
|
100
|
+
width: auto;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:disabled {
|
|
104
|
+
color: ${r.th("defaultFields.select.disabled.color")};
|
|
105
|
+
}
|
|
106
|
+
`),ot=r.divBox`
|
|
107
|
+
margin-top: lg;
|
|
108
|
+
|
|
109
|
+
${he.StyledTag}:not(:last-child) {
|
|
110
|
+
margin-right: sm;
|
|
111
|
+
margin-bottom: sm;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&:empty {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
`;function lt(e,t){return l.createElement(ot,{role:"list"},e.map(n=>l.createElement(he.Tag,{key:n.value,onRemove:()=>t(n.value.toString()),role:"listitem"},n.label)))}const rt=se.default||se,st=P.forwardRef(({allowUnselectFromList:e,autoComplete:t="off",autoFocus:n,dataTestId:s,disableCloseOnSelect:c,disabled:p,groupsEnabled:$,icon:C,id:j,isClearable:K,isCreatable:R,isMultiple:u,isSearchable:f,name:G,onBlur:we,onChange:L,onClick:Y,onCreate:J,onFocus:ye,options:d=[],placeholder:Q="Choose from…",renderCreateItem:Ie=w=>`Create "${w}"`,renderGroupHeader:Ee,renderItem:T=ce,renderMultiple:Se=lt,size:F="md",transparent:$e,value:X,variant:ke,...O},k)=>{const w=l.useMemo(()=>Qe(X,d,$),[X,d,$]),V=!u&&w[0]||null,A=V?V.label:"",[v,B]=l.useState(w),[h,x]=l.useState(A),[q,D]=l.useState(d),[b,y]=l.useState(!1);f=R||f,l.useEffect(()=>{var o;n&&((o=k==null?void 0:k.current)==null||o.focus(),f&&y(!0))},[f,n,k]),l.useEffect(()=>{B(w),x(A),D(d)},[A,d,w]);const xe=o=>{if(f&&o!==h){let i=[];$?i=ie.matchSorter(d,o,{keys:[a=>a.label,a=>a.options.map(I=>I.label)]}):i=ie.matchSorter(d,o,{keys:["label"]}),x(o),D(i)}},Ce=()=>{f&&!b&&y(!0)},U=o=>{let i=[];$?i=ae(o,d.flatMap(E=>E.options)):i=ae(o,d);const a=u?i:i[0],I=He.createEvent({name:G,value:u?o:o[0]});if(L&&L(a,I),R){const E=Ue(o,d);E.length&&J&&J(E[0].label,I)}},Fe=o=>{let i,a;!o||o!=null&&o.disabled?(i=u?v:[],a=!0):(i=u?Je(o,v,e):[o],a=u),a&&x(""),D(d),B(i),U(i),c||y(!1)},qe=o=>{const i=v.filter(a=>a.value!==o);B(i),U(i)},De=o=>{u&&o.selectedItem?x(""):f&&o.selectedItem&&x(o.selectedItem.label),D(d),y(!1)},Pe=Ye(d),M=Me({inputValue:h,isMultiple:u,isSearchable:f,options:d,renderItem:T});return l.createElement(rt,{id:j,inputValue:f?M:"",isOpen:b,itemToString:ce,onInputValueChange:xe,onOuterClick:De,onSelect:Fe,selectedItem:V},({clearSelection:o,getInputProps:i,getItemProps:a,getMenuProps:I,getRootProps:E,getToggleButtonProps:Re,highlightedIndex:Z})=>{const ee=!!(R&&h&&!z(h,v)),Te=b&&(q.length||ee),Ve=K&&h,Ae=l.createElement(ue,{as:"div"},l.createElement(We.ClearButton,{onClick:o})),Be=l.createElement(ue,{"data-testid":s&&`${s}-arrow-icon`,disabled:p,isOpen:b,size:F,tabIndex:-1,...Re({onClick:()=>y(!b)})},l.createElement(pe,{size:"sm"})),Ze=S=>{Y&&Y(S),y(!b)},ze=E(O),te=i({autoComplete:t,autoFocus:n,"data-spacer":Pe||Q,"data-testid":s,disabled:p,iconPlacement:C?"both":"right",id:j,name:G,onBlur:we,onClick:p?void 0:Ze,onFocus:ye,onKeyDown:Ce,placeholder:Q,ref:k,size:F,tabIndex:0,variant:b?"focused":ke,isClearable:K,transparent:$e,...O}),ne=fe.FIELD_ICON_SIZE[F];return l.createElement(be,{...ze,disabled:p},l.createElement(et,null,f?l.createElement(de,{as:"input",type:"text",...te}):l.createElement(de,{...te},M),C&&l.createElement(ve,{iconPlacement:"left",size:ne},l.cloneElement(C,{...C.props,size:ne})),l.createElement(nt,{size:F},Ve&&Ae,Be)),Te&&l.createElement(tt,{...I()},q.reduce((S,m,oe)=>{if($&&"options"in m)S.itemsToRender.push(l.createElement(l.Fragment,{key:m.label},Ee(m),m.options&&m.options.map(g=>{const le=S.itemIndex++,re=z(g.value,v);return l.createElement(W,{allowUnselectFromList:e,isDisabled:g.disabled,isHighlighted:Z===le,isMultiple:u,key:g.value,...a({index:le,isSelected:re,item:g})},T(g,re))})));else if("value"in m){const g=z(m.value,v);S.itemsToRender.push(l.createElement(W,{allowUnselectFromList:e,isDisabled:m.disabled,isHighlighted:Z===oe,isMultiple:u,key:m.value,...a({index:oe,isSelected:g,item:m})},T(m,g)))}return S},{itemsToRender:[],itemIndex:0}).itemsToRender,ee&&h.length&&l.createElement(W,{isHighlighted:Z===q.length,key:"add",...a({index:q.length,item:{value:ge(h),label:h}})},Ie(h))),u&&Se(v,qe))})}),it=be;exports.DownIcon=pe;exports.Select=st;exports.StyledSelect=it;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";"use strict";const t=require("react"),k=require("@juggle/resize-observer");require("./Icon.js");const z=require("./index-BNwz4P5j.js"),y=require("./System.js"),W=require("./throttle-BB1Y3bfD.js"),M=require("./Box.js"),s=require("@xstyled/styled-components"),F=(e,r,i)=>Math.min(Math.max(e,r),i),H=s.aBox`
|
|
2
|
+
${s.th("breadcrumbs.item.default")};
|
|
3
|
+
align-items: center;
|
|
4
|
+
transition: medium;
|
|
5
|
+
direction: initial;
|
|
6
|
+
|
|
7
|
+
&:hover {
|
|
8
|
+
${s.th("breadcrumbs.item.hover")};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&[aria-current='page'] {
|
|
12
|
+
${s.th("breadcrumbs.item.active")};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&[aria-disabled='true'] {
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
cursor: default;
|
|
18
|
+
}
|
|
19
|
+
`,V=s.spanBox`
|
|
20
|
+
${s.th("breadcrumbs.separator")};
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
`,j=y.forwardRef(({children:e,dataTestId:r,isActive:i,separator:c,...o},b)=>{const d=o.href||o.to;return t.createElement(M.Box,{"aria-label":"breadcrumb",as:"li","data-testid":r,display:"inline-flex",flex:"0 0 auto",lineHeight:"normal"},c&&t.createElement(V,{role:"presentation"},c),t.createElement(H,{"aria-current":i?"page":void 0,"aria-disabled":!d,...o,ref:b},e))}),B=(e,r,i)=>parseInt(e.substring(r,i),16),N=e=>/(^[0-9a-fA-F]{6}$)|(^[0-9a-fA-F]{3}$)/.test(e),D=e=>{if(!e||(e=e.replace("#",""),!N(e)))return;e.length===3&&(e=`${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`);const r=o=>B(o,0,2),i=o=>B(o,2,4),c=o=>B(o,4,6);return`${r(e)}, ${i(e)}, ${c(e)}`},G=(e,r=1)=>e?e.startsWith("#")?`rgba(${D(e)}, ${r})`:e:void 0,q=s.spanBox(({gradientBackground:e,theme:r})=>s.css`
|
|
24
|
+
left: 0;
|
|
25
|
+
background-image: ${C(r,e)};
|
|
26
|
+
transform-origin: left;
|
|
27
|
+
`),x=s.spanBox(({gradientBackground:e,theme:r})=>s.css`
|
|
28
|
+
right: 0;
|
|
29
|
+
background-image: ${C(r,e,"left")};
|
|
30
|
+
transform-origin: right;
|
|
31
|
+
`),J=s.divBox`
|
|
32
|
+
${s.th("breadcrumbs.list")};
|
|
33
|
+
height: 100%;
|
|
34
|
+
position: relative;
|
|
35
|
+
overflow-x: hidden;
|
|
36
|
+
|
|
37
|
+
${q},
|
|
38
|
+
${x} {
|
|
39
|
+
position: absolute;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
top: 0;
|
|
42
|
+
width: 30;
|
|
43
|
+
}
|
|
44
|
+
`,K=s.olBox`
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
max-width: 100%;
|
|
48
|
+
height: 100%;
|
|
49
|
+
overflow-x: auto;
|
|
50
|
+
margin: 0;
|
|
51
|
+
padding: 0;
|
|
52
|
+
list-style: none;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
`,C=(e,r,i="right")=>{const c=s.th(`colors.${r}`)({theme:e}),o=G(c,0);return`linear-gradient(to ${i}, ${c}, ${o} 100%)`},v=y.forwardRef(({children:e,gradientBackground:r="neutral-10",lastChildNotClickable:i=!0,separator:c=t.createElement(z.RightIcon,{size:"xs"}),...o},b)=>{const d=t.useRef(null),g=t.useRef(),$=t.useRef(),[p,O]=t.useState(!1),[f,A]=t.useState(0),R=t.Children.toArray(e).filter(Boolean),E=R.length,L=R.map((n,a)=>{const l=E===1||E===a+1,u=l&&i;return t.cloneElement(n,{key:`breadcrumb-${a}`,separator:l?void 0:c,isActive:u,...n.props})});function w(n,a){n&&(n.style.transform=`scale3d(${a}, 1, 1)`)}const m=t.useCallback(n=>{const a=1-n;w(g.current,a),w($.current,n)},[]),S=t.useCallback(()=>{const{current:{offsetWidth:n,scrollLeft:a,scrollWidth:l}}=d,u=l-n,T=F(Math.abs(a-f),0,u)/u;m(T)},[f,m]),I=t.useMemo(()=>W.throttle(n=>{const[{target:{offsetWidth:a,scrollLeft:l,scrollWidth:u}}]=n,h=u-a;f||A(l===0?0:h),O(h>0)},300,!1),[f]);return t.useEffect(()=>{const n=new k.ResizeObserver(I);return n.observe(d.current),()=>n.disconnect()},[]),t.useEffect(()=>{g.current&&$.current&&m(0)},[p,m]),t.createElement(J,{as:"nav",ref:b,...o},p&&t.createElement(q,{gradientBackground:r,ref:g}),t.createElement(K,{dir:"rtl",onScroll:S,ref:d},L.reverse()),p&&t.createElement(x,{gradientBackground:r,ref:$}))});v.displayName="Breadcrumb";const P=Object.assign(v,{Item:j});exports.Breadcrumb=P;exports.BreadcrumbComponent=v;exports.hexToRGBA=G;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";"use strict";const t=require("react"),re=require("react-dropzone"),D=require("./Icon.js"),w=require("./Button.js"),T=require("./System.js"),M=require("./create-event-YSlay9Ef.js"),c=require("@xstyled/styled-components"),$=require("./Text.js"),oe=require("./index-BAD1dszB.js"),I=require("./index-BxWjuyQw.js");function le(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const _=le(re),ie=15,se=15,ae='<path fill="currentColor" fill-rule="evenodd" d="M66.13 15.65a2.4 2.4 0 0 1 3.342-.19l13.363 11.675c.164.143.297.312.414.49.19.092.374.2.541.346 2.365 2.064 3.77 4.98 3.955 8.214.212 3.638-1.16 7.364-3.762 10.22L64.78 67.496a2.383 2.383 0 0 1-1.769.777 2.385 2.385 0 0 1-1.585-.6 2.317 2.317 0 0 1-.182-3.306l19.202-21.089c1.763-1.935 2.696-4.423 2.556-6.825a7.173 7.173 0 0 0-1.627-4.187L33.58 84.755c-.006.008-.015.014-.02.022l-.046.05c-.02.024-.048.039-.07.061a2.214 2.214 0 0 1-.271.241c-.047.036-.1.066-.15.096-.063.04-.119.085-.185.12L10.465 96.738a2.393 2.393 0 0 1-2.675-.336 2.32 2.32 0 0 1-.631-2.585l9.01-23.068.04-.077c.029-.063.061-.123.095-.184.07-.13.154-.252.245-.365.027-.03.04-.068.066-.098L66.13 15.65ZM21.852 73.931h-1.835L13.838 89.75l15.342-7.814-.242-1.857c-.457-3.503-3.503-6.147-7.086-6.147ZM73.724 7.308c4.556-5 12.05-5.76 16.708-1.69 2.12 1.852 3.38 4.468 3.549 7.367.189 3.25-1.036 6.575-3.358 9.125a2.378 2.378 0 0 1-1.767.777c-.56 0-1.123-.194-1.575-.589L73.918 10.625a2.321 2.321 0 0 1-.194-3.317Z" clip-rule="evenodd"/>',ue={width:ie,height:se,block:ae},q=e=>t.createElement(D.Icon,{alt:"Edit",content:ue,...e}),de=15,me=15,pe='<path fill="currentColor" fill-rule="evenodd" d="M70.885 70.969a4.139 4.139 0 0 1-5.568-1.74c-2.784-5.301-8.464-8.146-14.849-7.424-6.595.746-12.761 5.284-15.706 11.559a4.128 4.128 0 0 1-3.742 2.368 4.117 4.117 0 0 1-1.742-.385 4.089 4.089 0 0 1-1.996-5.45c4.196-8.94 12.722-15.163 22.25-16.242 9.706-1.1 18.77 3.525 23.105 11.78a4.09 4.09 0 0 1-1.752 5.534zM34.541 31.95c1.566-.179 3.055.276 4.18 1.275 1.118.993 1.734 2.395 1.734 3.945 0 3.093-2.433 5.791-5.54 6.144a6.041 6.041 0 0 1-.662.038c-1.32 0-2.548-.456-3.516-1.314-1.12-.993-1.736-2.394-1.736-3.946 0-3.092 2.435-5.79 5.54-6.142zm30.542-3.458c1.575-.17 3.052.276 4.18 1.273 1.117.994 1.735 2.395 1.735 3.947 0 3.092-2.434 5.791-5.54 6.142a6.04 6.04 0 0 1-.662.038c-1.32 0-2.549-.455-3.516-1.313-1.12-.994-1.737-2.393-1.737-3.943 0-3.094 2.435-5.793 5.54-6.144zM81.798 14.98c-8.589-7.617-20-11.059-32.126-9.682C25.041 8.086 5 30.28 5 54.769c0 11.957 4.69 22.7 13.202 30.254C25.552 91.542 34.968 95 45.135 95a46.38 46.38 0 0 0 5.193-.295C74.96 91.915 95 69.722 95 45.233c0-11.958-4.688-22.701-13.202-30.254z" clip-rule="evenodd"/>',fe={width:de,height:me,block:pe},C=e=>t.createElement(D.Icon,{alt:"Negative",content:fe,...e}),he=15,ge=15,Ee='<path fill="currentColor" fill-rule="evenodd" d="M72.716 58.953c-4.194 8.94-12.719 15.163-22.25 16.243-.947.107-1.89.16-2.82.16-8.607 0-16.372-4.493-20.284-11.94a4.09 4.09 0 0 1 1.751-5.534c2.022-1.046 4.513-.269 5.568 1.74 2.785 5.301 8.483 8.15 14.851 7.424 6.596-.746 12.76-5.284 15.705-11.559.962-2.052 3.418-2.941 5.483-1.983a4.09 4.09 0 0 1 1.996 5.45ZM34.54 31.951c1.564-.177 3.055.276 4.177 1.275 1.121.992 1.737 2.393 1.737 3.945 0 3.09-2.435 5.79-5.54 6.142a6.048 6.048 0 0 1-.663.038c-1.32 0-2.549-.455-3.516-1.313-1.12-.994-1.735-2.395-1.735-3.945 0-3.094 2.433-5.791 5.54-6.142Zm30.542-3.458c1.575-.176 3.052.274 4.178 1.273 1.12.992 1.737 2.393 1.737 3.945 0 3.094-2.435 5.793-5.54 6.144a6.046 6.046 0 0 1-.664.038c-1.32 0-2.548-.455-3.516-1.313-1.119-.994-1.735-2.393-1.735-3.945 0-3.092 2.434-5.791 5.54-6.142Zm16.715-13.514c-8.589-7.617-20-11.057-32.126-9.683C25.04 8.086 5 30.28 5 54.77c0 11.957 4.688 22.7 13.202 30.253C25.552 91.542 34.968 95 45.135 95c1.711 0 3.445-.098 5.193-.297C74.959 91.914 95 69.72 95 45.231c0-11.956-4.69-22.701-13.202-30.253Z" clip-rule="evenodd"/>',ve={width:he,height:ge,block:Ee},N=e=>t.createElement(D.Icon,{alt:"Positive",content:ve,...e}),Ie=15,we=15,$e='<path fill="currentColor" d="M83.765 11.723c6.352 4.338 6.538 8.858 6.083 11.165a1.37 1.37 0 0 1-.028.109c-.01.033-.019.066-.026.1-.105.914-.933 8.113-2.097 14.758-.08.464-.296.895-.618 1.24-1.16 1.242-2.661 2.383-4.436 3.43-3.078 17.568-7.563 43.031-7.905 44.252-1.125 4.018-5.68 7.078-12.827 8.616-3.491.751-7.257 1.107-10.996 1.107-8.5 0-16.875-1.844-21.654-5.108-2.321-1.586-3.661-3.453-4.096-5.712-.401-2.092-4.849-27.317-7.817-44.175l-.035-.021c-.369-.226-.738-.451-1.083-.687a19.024 19.024 0 0 1-3.33-2.858 2.443 2.443 0 0 1-.6-1.217c-1.267-7.198-2.151-15.002-2.16-15.08a.137.137 0 0 1 0-.029v-.024a8.318 8.318 0 0 1 .007-3.083c1.16-5.89 8.538-10.713 20.242-13.229 18.424-3.965 42.37-1.072 53.376 6.446ZM68.58 31.361c11.274-2.426 15.925-6.585 16.482-9.411.493-2.508-1.931-4.76-4.053-6.21-6.84-4.671-19.828-7.361-32.814-7.361-5.774 0-11.545.531-16.778 1.656-11.274 2.424-15.924 6.584-16.481 9.41-.494 2.507 1.93 4.762 4.053 6.21 9.88 6.749 32.59 9.36 49.59 5.706Zm0 11.126c6.585-1.418 11.67-3.612 14.44-6.22.327-1.916.622-3.854.88-5.652-3.468 2.326-8.31 4.217-14.291 5.503-5.603 1.205-11.718 1.776-17.822 1.776-13.97 0-27.895-2.991-35.556-8.223a1.83 1.83 0 0 1-.064-.047l-.064-.046c.259 1.779.553 3.685.878 5.573a14.852 14.852 0 0 0 2.006 1.63c9.883 6.747 32.591 9.36 49.593 5.706ZM45.093 13.495h9.81c4.564 0 8.277 3.704 8.277 8.256a2.436 2.436 0 0 1-2.44 2.434 2.436 2.436 0 0 1-2.439-2.434 3.398 3.398 0 0 0-3.398-3.389h-9.81a3.398 3.398 0 0 0-3.399 3.39 2.436 2.436 0 0 1-2.44 2.433 2.437 2.437 0 0 1-2.44-2.434c0-4.552 3.715-8.257 8.28-8.257Z"/>',De={width:Ie,height:we,block:$e},S=e=>t.createElement(D.Icon,{alt:"Trash",content:De,...e}),be=c("div").withConfig({shouldForwardProp:T.shouldForwardProp})(({disabled:e,isDragAccept:n,isDragReject:r})=>c.css`
|
|
2
|
+
${c.th("defaultFields.default")};
|
|
3
|
+
${c.th("fileDrops.default")};
|
|
4
|
+
${n&&c.th("fileDrops.dragAccept")};
|
|
5
|
+
${r&&c.css`
|
|
6
|
+
border-color: ${c.th("defaultFields.variants.danger.borderColor")};
|
|
7
|
+
${c.th("fileDrops.dragReject")}
|
|
8
|
+
`};
|
|
9
|
+
position: relative;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: md;
|
|
14
|
+
transition: medium;
|
|
15
|
+
${c.system};
|
|
16
|
+
|
|
17
|
+
&:focus {
|
|
18
|
+
${c.th("defaultFields.focused.default")};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
${e&&c.css`
|
|
22
|
+
${c.th("defaultFields.disabled")};
|
|
23
|
+
${c.th("fileDrops.disabled")};
|
|
24
|
+
`};
|
|
25
|
+
`),ye=c.div`
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
`,U=c.imgBox`
|
|
33
|
+
max-height: 100%;
|
|
34
|
+
max-width: 100%;
|
|
35
|
+
object-fit: contain;
|
|
36
|
+
`,Re=c.div`
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: ${c.th.space("md")};
|
|
39
|
+
right: ${c.th.space("md")};
|
|
40
|
+
display: flex;
|
|
41
|
+
gap: xs;
|
|
42
|
+
`,Z=({disabled:e,fileButtonText:n="Browse file",hint:r="Drag & drop a file here or",openFile:o,title:l="Add file"})=>t.createElement(t.Fragment,null,t.createElement($.Text,{color:"neutral-90",m:"0",variant:"h4"},l),t.createElement($.Text,{color:"beige-70",m:"0",mt:"xs",variant:"sm"},r),t.createElement(w.Button,{disabled:e,mt:"lg",onClick:o,type:"button"},n)),Fe=({file:e,fileName:n,forceFileType:r,previewButtonText:o="Preview"})=>{const l=typeof e=="string",m=I.getFileIcon(e,r),p=e instanceof File?I.getFileSize(e):null,u=l&&n?n:I.getFileName(e);return t.createElement(t.Fragment,null,t.createElement(m,{color:"neutral-90",h:50,mb:"lg",w:50}),t.createElement($.Text,{color:"neutral-90",lines:1,m:0,maxWidth:600,variant:"h4"},u),!l&&t.createElement($.Text,{color:"beige-70",fontWeight:"medium",lines:1,m:0,variant:"sm"},p),l&&t.createElement(w.Button,{as:"a",href:e,mt:"md",rel:"noopener",size:"sm",target:"_blank"},t.createElement("span",null,o),t.createElement(oe.ExternalLinkIcon,null)))},Pe=({disabled:e,error:n,file:r,fileName:o,fileUrl:l,forceFileType:m,isAnImage:p,isHoverAccept:u,isHoverReject:g,openFile:f,wordings:E})=>u?t.createElement(N,null):g?t.createElement(C,null):n?t.createElement(Z,{openFile:f,...E}):l?p?t.createElement(U,{src:l}):t.createElement(Fe,{file:r,fileName:o,forceFileType:m,...E}):t.createElement(Z,{disabled:e,openFile:f,...E}),O=/\.(jpeg|jpg|gif|png|webp)$/,ke=e=>e?typeof e=="string"?!!I.getFileName(e).match(O):e.name?!!e.name.match(O):!1:!1,xe=e=>{let n;if(e instanceof File?n=e.preview:n=e,typeof n!="string"||n.startsWith("blob:"))return n;if(typeof window<"u")try{return new URL(n)}catch{return}},Le=_.useDropzone||_.default.useDropzone,je=2e6,ze="ERROR_INVALID_TYPE",Ae="ERROR_INVALID_SIZE",B=T.forwardRef(({accept:e={"image/*":[]},children:n=Pe,dataTestId:r,disabled:o,fileName:l,forceFileType:m,handleAddFile:p,handleRemoveFile:u,isClearable:g,isEditable:f,maxSize:E=je,multiple:k,name:b,onBlur:x,onChange:h,onError:y,value:R,wordings:V,...W},H)=>{const[s,v]=t.useState(R),[F,P]=t.useState(void 0);t.useEffect(()=>{v(R)},[R]),t.useEffect(()=>()=>s&&s instanceof File&&URL.revokeObjectURL(s.preview),[s]);const Y=d=>{const[i]=d;i instanceof File&&(i.preview=URL.createObjectURL(i)),v(i),P(null);const a=M.createEvent({name:b,value:i});h&&h(a),p&&p(a)},X=(d,i)=>{let a;d.map(({errors:te})=>{te.map(ne=>{const{code:A,message:ce}=ne;A==="file-invalid-type"?a=ze:A==="file-too-large"?a=Ae:a=ce})}),v(null),P(a),y&&y(a),h&&h(i),x&&x()},G=d=>{d.preventDefault(),v(null),P(null);const i=M.createEvent({name:b,value:null});h&&h(i),u&&u(i)},{getInputProps:J,getRootProps:K,isDragAccept:L,isDragActive:Q,isDragReject:j,open:z}=Le({accept:e,disabled:o,maxSize:E,multiple:k,noClick:!0,onDropAccepted:Y,onDropRejected:X}),ee=d=>y(d);return t.createElement(be,{...K({"data-testid":r,handleRemoveFile:u,isEditable:f,isDragActive:Q,isDragAccept:L,isDragReject:j,isClearable:g,disabled:o,ref:H}),...W},t.createElement("input",{...J({disabled:o,multiple:k,name:b,onError:ee}),style:{display:"block",opacity:0,height:0,width:0}}),t.createElement(ye,null,n({disabled:o,error:F,file:s,fileName:l,fileUrl:s&&xe(s),forceFileType:m,isAnImage:m==="image"||ke(s),isHoverAccept:L,isHoverReject:j,openFile:z,wordings:V}),!!s&&(F||f||g)&&t.createElement(Re,null,(F||f)&&t.createElement(w.Button,{onClick:z,shape:"circle",size:"sm",type:"button",variant:"tertiary"},t.createElement(q,null)),g&&t.createElement(w.Button,{danger:!0,onClick:G,shape:"circle",size:"sm",type:"button"},t.createElement(S,null)))))});B.displayName="FileDrop";const Me=U;exports.EditIcon=q;exports.FileDrop=B;exports.ImagePreview=Me;exports.NegativeIcon=C;exports.PositiveIcon=N;exports.TrashIcon=S;
|