smartsell-ui-kit 0.1.1 → 0.1.2
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/index.cjs +1157 -1573
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +935 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1114 -1529
- package/dist/index.js.map +1 -1
- package/package.json +11 -5
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
// src/components/Button.tsx
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
|
|
4
1
|
// src/foundation/async.ts
|
|
5
2
|
var DEFAULT_ASYNC_SEARCH_DEBOUNCE_MS = 1500;
|
|
6
3
|
|
|
4
|
+
// src/foundation/className.ts
|
|
5
|
+
var cx = (...values) => {
|
|
6
|
+
return values.filter(Boolean).join(" ");
|
|
7
|
+
};
|
|
8
|
+
|
|
7
9
|
// src/foundation/color.ts
|
|
8
10
|
function withAlpha(hex, alpha) {
|
|
9
11
|
const normalized = hex.replace("#", "").trim();
|
|
@@ -31,52 +33,28 @@ var CONTROL_METRICS_BY_SIZE = {
|
|
|
31
33
|
selectIndicatorOffset: 12
|
|
32
34
|
},
|
|
33
35
|
md: {
|
|
34
|
-
height:
|
|
36
|
+
height: 34,
|
|
35
37
|
fontSize: 14,
|
|
36
38
|
lineHeight: "18px",
|
|
37
|
-
paddingX:
|
|
38
|
-
paddingY:
|
|
39
|
-
buttonPaddingX:
|
|
40
|
-
selectPaddingRight:
|
|
41
|
-
selectIndicatorOffset:
|
|
39
|
+
paddingX: 14,
|
|
40
|
+
paddingY: 7,
|
|
41
|
+
buttonPaddingX: 16,
|
|
42
|
+
selectPaddingRight: 42,
|
|
43
|
+
selectIndicatorOffset: 14
|
|
42
44
|
},
|
|
43
45
|
lg: {
|
|
44
|
-
height:
|
|
46
|
+
height: 38,
|
|
45
47
|
fontSize: 15,
|
|
46
48
|
lineHeight: "18px",
|
|
47
|
-
paddingX:
|
|
48
|
-
paddingY:
|
|
49
|
-
buttonPaddingX:
|
|
50
|
-
selectPaddingRight:
|
|
51
|
-
selectIndicatorOffset:
|
|
49
|
+
paddingX: 16,
|
|
50
|
+
paddingY: 9,
|
|
51
|
+
buttonPaddingX: 18,
|
|
52
|
+
selectPaddingRight: 46,
|
|
53
|
+
selectIndicatorOffset: 16
|
|
52
54
|
}
|
|
53
55
|
};
|
|
54
56
|
var getControlMetrics = (size) => CONTROL_METRICS_BY_SIZE[size];
|
|
55
|
-
var getTextInputPadding = (size, options = {}) => {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
const metrics = getControlMetrics(size);
|
|
58
|
-
const leadingInset = (_a = options.leadingInset) != null ? _a : 0;
|
|
59
|
-
const trailingInset = (_b = options.trailingInset) != null ? _b : 0;
|
|
60
|
-
return `${metrics.paddingY}px ${metrics.paddingX + trailingInset}px ${metrics.paddingY}px ${metrics.paddingX + leadingInset}px`;
|
|
61
|
-
};
|
|
62
|
-
var getSelectControlPadding = (size) => {
|
|
63
|
-
const metrics = getControlMetrics(size);
|
|
64
|
-
return `${metrics.paddingY}px ${metrics.selectPaddingRight}px ${metrics.paddingY}px ${metrics.paddingX}px`;
|
|
65
|
-
};
|
|
66
57
|
var getSelectIndicatorOffset = (size) => getControlMetrics(size).selectIndicatorOffset;
|
|
67
|
-
var getButtonSizeStyles = (size) => {
|
|
68
|
-
const metrics = getControlMetrics(size);
|
|
69
|
-
return {
|
|
70
|
-
boxSizing: "border-box",
|
|
71
|
-
height: metrics.height,
|
|
72
|
-
padding: `0 ${metrics.buttonPaddingX}px`,
|
|
73
|
-
fontSize: metrics.fontSize,
|
|
74
|
-
lineHeight: metrics.lineHeight
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
// src/foundation/motion.ts
|
|
79
|
-
var FIELD_SURFACE_TRANSITION = "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease";
|
|
80
58
|
|
|
81
59
|
// src/foundation/shadow.ts
|
|
82
60
|
var LIGHT_SHADOW = "#B8B8B8";
|
|
@@ -88,12 +66,24 @@ function getComponentShadow(theme) {
|
|
|
88
66
|
const shadowColor = (_a = colors.shadow) != null ? _a : fallbackShadow;
|
|
89
67
|
return `${shadowColor} 0px 4px 5px`;
|
|
90
68
|
}
|
|
69
|
+
function getInsetBorderShadow(borderColor, options = {}) {
|
|
70
|
+
const {
|
|
71
|
+
outerShadow,
|
|
72
|
+
componentShadow = "var(--ui-kit-component-shadow)",
|
|
73
|
+
insetWidth = 1
|
|
74
|
+
} = options;
|
|
75
|
+
return [
|
|
76
|
+
outerShadow,
|
|
77
|
+
`inset 0 0 0 ${insetWidth}px ${borderColor}`,
|
|
78
|
+
componentShadow
|
|
79
|
+
].filter(Boolean).join(", ");
|
|
80
|
+
}
|
|
91
81
|
|
|
92
82
|
// src/foundation/shape.ts
|
|
93
83
|
var STANDARD_COMPONENT_BORDER_RADIUS = 16;
|
|
94
84
|
|
|
95
85
|
// src/foundation/theme.ts
|
|
96
|
-
import { useMemo } from "react";
|
|
86
|
+
import { useEffect, useMemo } from "react";
|
|
97
87
|
import {
|
|
98
88
|
darkTheme,
|
|
99
89
|
lightTheme,
|
|
@@ -151,6 +141,47 @@ var assertThemeColorSchema = (theme) => {
|
|
|
151
141
|
};
|
|
152
142
|
assertThemeColorSchema(lightTheme);
|
|
153
143
|
assertThemeColorSchema(darkTheme);
|
|
144
|
+
var ROOT_THEME_VARIABLES = [
|
|
145
|
+
["--theme-primary", "primary"],
|
|
146
|
+
["--theme-primaryLight", "primaryLight"],
|
|
147
|
+
["--theme-primaryDark", "primaryDark"],
|
|
148
|
+
["--theme-shadow", "shadow"],
|
|
149
|
+
["--theme-secondary", "secondary"],
|
|
150
|
+
["--theme-background", "background"],
|
|
151
|
+
["--theme-surface", "surface"],
|
|
152
|
+
["--theme-text", "text"],
|
|
153
|
+
["--theme-textLight", "textLight"],
|
|
154
|
+
["--theme-positive", "positive"],
|
|
155
|
+
["--theme-negative", "negative"],
|
|
156
|
+
["--theme-warning", "warning"],
|
|
157
|
+
["--theme-info", "info"],
|
|
158
|
+
["--theme-onPrimary", "onPrimary"],
|
|
159
|
+
["--theme-onSecondary", "onSecondary"]
|
|
160
|
+
];
|
|
161
|
+
var syncUiKitThemeVariables = (tokens) => {
|
|
162
|
+
if (typeof document === "undefined") {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const rootStyle = document.documentElement.style;
|
|
166
|
+
ROOT_THEME_VARIABLES.forEach(([variableName, colorName]) => {
|
|
167
|
+
rootStyle.setProperty(variableName, tokens.theme.colors[colorName]);
|
|
168
|
+
});
|
|
169
|
+
rootStyle.setProperty("--ui-kit-border-soft", tokens.borderSoft);
|
|
170
|
+
rootStyle.setProperty("--ui-kit-border-strong", tokens.borderStrong);
|
|
171
|
+
rootStyle.setProperty("--ui-kit-surface-muted", tokens.surfaceMuted);
|
|
172
|
+
rootStyle.setProperty("--ui-kit-surface-raised", tokens.surfaceRaised);
|
|
173
|
+
rootStyle.setProperty("--ui-kit-overlay", tokens.overlay);
|
|
174
|
+
rootStyle.setProperty("--ui-kit-focus-ring", tokens.focusRing);
|
|
175
|
+
rootStyle.setProperty("--ui-kit-muted-text", tokens.mutedText);
|
|
176
|
+
rootStyle.setProperty("--ui-kit-component-shadow", getComponentShadow(tokens.theme));
|
|
177
|
+
rootStyle.setProperty("--ui-kit-card-bg", withAlpha(tokens.theme.colors.background, 0.7));
|
|
178
|
+
rootStyle.setProperty("--ui-kit-card-border", withAlpha(tokens.theme.colors.text, 0.5));
|
|
179
|
+
rootStyle.setProperty("--ui-kit-button-outline-hover", withAlpha(tokens.theme.colors.text, 0.08));
|
|
180
|
+
rootStyle.setProperty("--ui-kit-button-outline-active", withAlpha(tokens.theme.colors.text, 0.14));
|
|
181
|
+
rootStyle.setProperty("--ui-kit-button-ghost-border", withAlpha(tokens.theme.colors.primary, 0.5));
|
|
182
|
+
rootStyle.setProperty("--ui-kit-placeholder", withAlpha(tokens.theme.colors.text, 0.5));
|
|
183
|
+
rootStyle.setProperty("--ui-kit-negative-soft", withAlpha(tokens.theme.colors.negative, 0.12));
|
|
184
|
+
};
|
|
154
185
|
function normalizeUiKitTheme(theme) {
|
|
155
186
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
156
187
|
const colors = theme.colors;
|
|
@@ -198,11 +229,61 @@ function createUiKitThemeTokens(themeSource) {
|
|
|
198
229
|
}
|
|
199
230
|
function useUiKitTheme() {
|
|
200
231
|
const activeTheme = useThemeValue();
|
|
201
|
-
|
|
232
|
+
const tokens = useMemo(() => createUiKitThemeTokens(activeTheme), [activeTheme]);
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
syncUiKitThemeVariables(tokens);
|
|
235
|
+
}, [tokens]);
|
|
236
|
+
return tokens;
|
|
202
237
|
}
|
|
203
238
|
|
|
204
239
|
// src/components/Button.tsx
|
|
205
240
|
import { jsxs } from "react/jsx-runtime";
|
|
241
|
+
var BUTTON_SIZE_CLASSNAMES = {
|
|
242
|
+
sm: "h-[30px] px-[14px] text-[13px] leading-4",
|
|
243
|
+
md: "h-[34px] px-4 text-sm leading-[18px]",
|
|
244
|
+
lg: "h-[38px] px-[18px] text-[15px] leading-[18px]"
|
|
245
|
+
};
|
|
246
|
+
var BUTTON_VARIANT_CLASSNAMES = {
|
|
247
|
+
solid: [
|
|
248
|
+
"border-[var(--theme-primary)]",
|
|
249
|
+
"bg-[var(--theme-primary)]",
|
|
250
|
+
"text-[var(--theme-onPrimary)]",
|
|
251
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
252
|
+
"hover:border-[var(--theme-primaryDark)]",
|
|
253
|
+
"hover:bg-[var(--theme-primaryDark)]",
|
|
254
|
+
"hover:-translate-y-[0.5px]",
|
|
255
|
+
"active:translate-y-px",
|
|
256
|
+
"active:scale-[0.985]"
|
|
257
|
+
].join(" "),
|
|
258
|
+
outline: [
|
|
259
|
+
"border-[var(--theme-textLight)]",
|
|
260
|
+
"bg-transparent",
|
|
261
|
+
"text-[var(--theme-text)]",
|
|
262
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
263
|
+
"hover:-translate-y-[0.5px]",
|
|
264
|
+
"hover:bg-[var(--ui-kit-button-outline-hover)]",
|
|
265
|
+
"active:translate-y-px",
|
|
266
|
+
"active:scale-[0.985]",
|
|
267
|
+
"active:bg-[var(--ui-kit-button-outline-active)]"
|
|
268
|
+
].join(" "),
|
|
269
|
+
ghost: [
|
|
270
|
+
"border-transparent",
|
|
271
|
+
"bg-transparent",
|
|
272
|
+
"text-[var(--theme-text)]",
|
|
273
|
+
"shadow-none",
|
|
274
|
+
"hover:-translate-y-[0.5px]",
|
|
275
|
+
"hover:border-[var(--ui-kit-button-ghost-border)]",
|
|
276
|
+
"hover:bg-[var(--theme-primary)]",
|
|
277
|
+
"hover:text-[var(--theme-onPrimary)]",
|
|
278
|
+
"hover:shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
279
|
+
"active:translate-y-px",
|
|
280
|
+
"active:scale-[0.985]",
|
|
281
|
+
"active:border-[var(--ui-kit-button-ghost-border)]",
|
|
282
|
+
"active:bg-[var(--theme-primary)]",
|
|
283
|
+
"active:text-[var(--theme-onPrimary)]",
|
|
284
|
+
"active:shadow-[0px_4px_5px_var(--theme-shadow)]"
|
|
285
|
+
].join(" ")
|
|
286
|
+
};
|
|
206
287
|
function Button({
|
|
207
288
|
variant = "solid",
|
|
208
289
|
size = "sm",
|
|
@@ -210,137 +291,27 @@ function Button({
|
|
|
210
291
|
trailingIcon,
|
|
211
292
|
children,
|
|
212
293
|
disabled,
|
|
213
|
-
|
|
294
|
+
className,
|
|
214
295
|
type = "button",
|
|
215
|
-
onMouseEnter,
|
|
216
|
-
onMouseLeave,
|
|
217
|
-
onMouseDown,
|
|
218
|
-
onMouseUp,
|
|
219
|
-
onBlur,
|
|
220
|
-
onKeyDown,
|
|
221
|
-
onKeyUp,
|
|
222
|
-
onTouchStart,
|
|
223
|
-
onTouchEnd,
|
|
224
|
-
onTouchCancel,
|
|
225
296
|
...rest
|
|
226
297
|
}) {
|
|
227
|
-
var _a, _b;
|
|
228
|
-
const { theme } = useUiKitTheme();
|
|
229
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
230
|
-
const [isPressed, setIsPressed] = useState(false);
|
|
231
|
-
const buttonShadow = getComponentShadow(theme);
|
|
232
|
-
const variantStyles = {
|
|
233
|
-
solid: {
|
|
234
|
-
backgroundColor: theme.colors.primary,
|
|
235
|
-
borderColor: theme.colors.primary,
|
|
236
|
-
color: theme.colors.onPrimary
|
|
237
|
-
},
|
|
238
|
-
outline: {
|
|
239
|
-
backgroundColor: "transparent",
|
|
240
|
-
borderColor: theme.colors.textLight,
|
|
241
|
-
color: theme.colors.text
|
|
242
|
-
},
|
|
243
|
-
ghost: {
|
|
244
|
-
backgroundColor: "transparent",
|
|
245
|
-
borderColor: "transparent"
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
const interactiveColor = variant === "solid" ? theme.colors.primary : theme.colors.text;
|
|
249
|
-
const isInteractive = !disabled;
|
|
250
|
-
const buttonTransform = isPressed ? "translateY(1px) scale(0.985)" : isHovered ? "translateY(-0.5px)" : "translateY(0)";
|
|
251
|
-
const interactionStyles = {
|
|
252
|
-
solid: {
|
|
253
|
-
transform: buttonTransform,
|
|
254
|
-
filter: void 0
|
|
255
|
-
},
|
|
256
|
-
outline: {
|
|
257
|
-
transform: buttonTransform,
|
|
258
|
-
backgroundColor: isPressed ? withAlpha(interactiveColor, 0.14) : isHovered ? withAlpha(interactiveColor, 0.08) : "transparent"
|
|
259
|
-
},
|
|
260
|
-
ghost: {
|
|
261
|
-
transform: buttonTransform,
|
|
262
|
-
backgroundColor: isPressed || isHovered ? theme.colors.primary : "transparent",
|
|
263
|
-
borderColor: isPressed || isHovered ? withAlpha(theme.colors.primary, 0.5) : "transparent",
|
|
264
|
-
color: isPressed || isHovered ? theme.colors.onPrimary : theme.colors.text
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
298
|
return /* @__PURE__ */ jsxs(
|
|
268
299
|
"button",
|
|
269
300
|
{
|
|
270
301
|
...rest,
|
|
271
302
|
type,
|
|
272
303
|
disabled,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
onMouseDown: (event) => {
|
|
285
|
-
if (isInteractive) {
|
|
286
|
-
setIsPressed(true);
|
|
287
|
-
}
|
|
288
|
-
onMouseDown == null ? void 0 : onMouseDown(event);
|
|
289
|
-
},
|
|
290
|
-
onMouseUp: (event) => {
|
|
291
|
-
setIsPressed(false);
|
|
292
|
-
onMouseUp == null ? void 0 : onMouseUp(event);
|
|
293
|
-
},
|
|
294
|
-
onBlur: (event) => {
|
|
295
|
-
setIsHovered(false);
|
|
296
|
-
setIsPressed(false);
|
|
297
|
-
onBlur == null ? void 0 : onBlur(event);
|
|
298
|
-
},
|
|
299
|
-
onKeyDown: (event) => {
|
|
300
|
-
if (isInteractive && (event.key === " " || event.key === "Enter")) {
|
|
301
|
-
setIsPressed(true);
|
|
302
|
-
}
|
|
303
|
-
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
304
|
-
},
|
|
305
|
-
onKeyUp: (event) => {
|
|
306
|
-
setIsPressed(false);
|
|
307
|
-
onKeyUp == null ? void 0 : onKeyUp(event);
|
|
308
|
-
},
|
|
309
|
-
onTouchStart: (event) => {
|
|
310
|
-
if (isInteractive) {
|
|
311
|
-
setIsPressed(true);
|
|
312
|
-
}
|
|
313
|
-
onTouchStart == null ? void 0 : onTouchStart(event);
|
|
314
|
-
},
|
|
315
|
-
onTouchEnd: (event) => {
|
|
316
|
-
setIsPressed(false);
|
|
317
|
-
onTouchEnd == null ? void 0 : onTouchEnd(event);
|
|
318
|
-
},
|
|
319
|
-
onTouchCancel: (event) => {
|
|
320
|
-
setIsPressed(false);
|
|
321
|
-
onTouchCancel == null ? void 0 : onTouchCancel(event);
|
|
322
|
-
},
|
|
323
|
-
style: {
|
|
324
|
-
display: "inline-flex",
|
|
325
|
-
alignItems: "center",
|
|
326
|
-
justifyContent: "center",
|
|
327
|
-
gap: 10,
|
|
328
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
329
|
-
borderStyle: "solid",
|
|
330
|
-
borderWidth: 1,
|
|
331
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
332
|
-
fontWeight: 700,
|
|
333
|
-
letterSpacing: "0.01em",
|
|
334
|
-
opacity: disabled ? DISABLED_COMPONENT_OPACITY : 1,
|
|
335
|
-
boxShadow: variant === "ghost" && !isHovered ? "none" : buttonShadow,
|
|
336
|
-
transitionDuration: "0.3s",
|
|
337
|
-
width: (_a = style == null ? void 0 : style.width) != null ? _a : "fit-content",
|
|
338
|
-
maxWidth: (_b = style == null ? void 0 : style.maxWidth) != null ? _b : "fit-content",
|
|
339
|
-
...getButtonSizeStyles(size),
|
|
340
|
-
...variantStyles[variant],
|
|
341
|
-
...isInteractive ? interactionStyles[variant] : void 0,
|
|
342
|
-
...style
|
|
343
|
-
},
|
|
304
|
+
className: cx(
|
|
305
|
+
"box-border inline-flex w-fit max-w-fit items-center justify-center gap-2.5",
|
|
306
|
+
"rounded-2xl border border-solid font-bold tracking-[0.01em]",
|
|
307
|
+
"cursor-pointer transition-all duration-300",
|
|
308
|
+
`disabled:opacity-[${DISABLED_COMPONENT_OPACITY}]`,
|
|
309
|
+
"disabled:cursor-not-allowed",
|
|
310
|
+
"disabled:translate-y-0 disabled:scale-100",
|
|
311
|
+
BUTTON_SIZE_CLASSNAMES[size],
|
|
312
|
+
BUTTON_VARIANT_CLASSNAMES[variant],
|
|
313
|
+
className
|
|
314
|
+
),
|
|
344
315
|
children: [
|
|
345
316
|
leadingIcon,
|
|
346
317
|
children,
|
|
@@ -358,67 +329,30 @@ function Card({
|
|
|
358
329
|
title,
|
|
359
330
|
action,
|
|
360
331
|
padded = true,
|
|
361
|
-
|
|
332
|
+
className,
|
|
362
333
|
...rest
|
|
363
334
|
}) {
|
|
364
|
-
|
|
365
|
-
const componentShadow = getComponentShadow(theme);
|
|
335
|
+
useUiKitTheme();
|
|
366
336
|
return /* @__PURE__ */ jsxs2(
|
|
367
337
|
"div",
|
|
368
338
|
{
|
|
369
339
|
...rest,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
background:
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
},
|
|
340
|
+
className: cx(
|
|
341
|
+
"rounded-[28px] border text-[var(--theme-text)]",
|
|
342
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
343
|
+
"[background:var(--ui-kit-card-bg)]",
|
|
344
|
+
"[border-color:var(--ui-kit-card-border)]",
|
|
345
|
+
padded && "p-6",
|
|
346
|
+
className
|
|
347
|
+
),
|
|
379
348
|
children: [
|
|
380
|
-
(eyebrow || title || action) && /* @__PURE__ */ jsxs2(
|
|
381
|
-
"div",
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
gap: 16,
|
|
388
|
-
marginBottom: 18
|
|
389
|
-
},
|
|
390
|
-
children: [
|
|
391
|
-
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
392
|
-
eyebrow ? /* @__PURE__ */ jsx(
|
|
393
|
-
"span",
|
|
394
|
-
{
|
|
395
|
-
style: {
|
|
396
|
-
color: theme.colors.textLight,
|
|
397
|
-
fontSize: 12,
|
|
398
|
-
fontWeight: 800,
|
|
399
|
-
letterSpacing: "0.16em",
|
|
400
|
-
textTransform: "uppercase"
|
|
401
|
-
},
|
|
402
|
-
children: eyebrow
|
|
403
|
-
}
|
|
404
|
-
) : null,
|
|
405
|
-
title ? /* @__PURE__ */ jsx(
|
|
406
|
-
"div",
|
|
407
|
-
{
|
|
408
|
-
style: {
|
|
409
|
-
color: theme.colors.text,
|
|
410
|
-
fontSize: 24,
|
|
411
|
-
fontWeight: 700,
|
|
412
|
-
lineHeight: 1.2
|
|
413
|
-
},
|
|
414
|
-
children: title
|
|
415
|
-
}
|
|
416
|
-
) : null
|
|
417
|
-
] }),
|
|
418
|
-
action ? /* @__PURE__ */ jsx("div", { style: { color: theme.colors.text }, children: action }) : null
|
|
419
|
-
]
|
|
420
|
-
}
|
|
421
|
-
),
|
|
349
|
+
(eyebrow || title || action) && /* @__PURE__ */ jsxs2("div", { className: "mb-[18px] flex items-start justify-between gap-4", children: [
|
|
350
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-1.5", children: [
|
|
351
|
+
eyebrow ? /* @__PURE__ */ jsx("span", { className: "text-xs font-extrabold uppercase tracking-[0.16em] text-[var(--theme-textLight)]", children: eyebrow }) : null,
|
|
352
|
+
title ? /* @__PURE__ */ jsx("div", { className: "text-2xl font-bold leading-[1.2] text-[var(--theme-text)]", children: title }) : null
|
|
353
|
+
] }),
|
|
354
|
+
action ? /* @__PURE__ */ jsx("div", { className: "text-[var(--theme-text)]", children: action }) : null
|
|
355
|
+
] }),
|
|
422
356
|
children
|
|
423
357
|
]
|
|
424
358
|
}
|
|
@@ -432,29 +366,25 @@ function CardSmall({
|
|
|
432
366
|
value,
|
|
433
367
|
icon,
|
|
434
368
|
color,
|
|
369
|
+
className,
|
|
435
370
|
style,
|
|
436
371
|
...rest
|
|
437
372
|
}) {
|
|
438
|
-
const { theme
|
|
373
|
+
const { theme } = useUiKitTheme();
|
|
439
374
|
const accentColor = color != null ? color : theme.colors.primary;
|
|
440
|
-
const componentShadow = getComponentShadow(theme);
|
|
441
375
|
return /* @__PURE__ */ jsxs3(
|
|
442
376
|
"div",
|
|
443
377
|
{
|
|
444
378
|
...rest,
|
|
379
|
+
className: cx(
|
|
380
|
+
"relative flex min-h-20 items-center gap-4 overflow-hidden",
|
|
381
|
+
"rounded-2xl border border-solid border-[var(--ui-kit-accent)]",
|
|
382
|
+
"bg-[var(--ui-kit-surface-raised)] pl-6 pr-6 text-[var(--theme-text)]",
|
|
383
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
384
|
+
className
|
|
385
|
+
),
|
|
445
386
|
style: {
|
|
446
|
-
|
|
447
|
-
display: "flex",
|
|
448
|
-
alignItems: "center",
|
|
449
|
-
gap: 16,
|
|
450
|
-
minHeight: 80,
|
|
451
|
-
padding: "0px 0px 0px 24px",
|
|
452
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
453
|
-
overflow: "hidden",
|
|
454
|
-
border: `1px solid ${theme.colors.textLight}`,
|
|
455
|
-
backgroundColor: surfaceRaised,
|
|
456
|
-
boxShadow: componentShadow,
|
|
457
|
-
color: theme.colors.text,
|
|
387
|
+
"--ui-kit-accent": accentColor,
|
|
458
388
|
...style
|
|
459
389
|
},
|
|
460
390
|
children: [
|
|
@@ -462,66 +392,24 @@ function CardSmall({
|
|
|
462
392
|
"div",
|
|
463
393
|
{
|
|
464
394
|
"aria-hidden": "true",
|
|
465
|
-
|
|
466
|
-
position: "absolute",
|
|
467
|
-
left: 0,
|
|
468
|
-
top: 0,
|
|
469
|
-
bottom: 0,
|
|
470
|
-
width: 25,
|
|
471
|
-
backgroundColor: accentColor
|
|
472
|
-
}
|
|
395
|
+
className: "absolute inset-y-0 left-0 w-[25px] bg-[var(--ui-kit-accent)]"
|
|
473
396
|
}
|
|
474
397
|
),
|
|
475
398
|
icon ? /* @__PURE__ */ jsx2(
|
|
476
399
|
"div",
|
|
477
400
|
{
|
|
478
401
|
"aria-hidden": "true",
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
color: accentColor,
|
|
485
|
-
display: "inline-flex",
|
|
486
|
-
alignItems: "center",
|
|
487
|
-
justifyContent: "center",
|
|
488
|
-
flexShrink: 0,
|
|
489
|
-
marginLeft: 16
|
|
490
|
-
},
|
|
402
|
+
className: cx(
|
|
403
|
+
"ml-4 inline-flex h-[52px] w-[52px] shrink-0 items-center justify-center",
|
|
404
|
+
"rounded-xl bg-[color-mix(in_srgb,var(--ui-kit-accent)_24%,transparent)]",
|
|
405
|
+
"text-[var(--ui-kit-accent)]"
|
|
406
|
+
),
|
|
491
407
|
children: icon
|
|
492
408
|
}
|
|
493
409
|
) : null,
|
|
494
|
-
/* @__PURE__ */ jsxs3("div", {
|
|
495
|
-
title ? /* @__PURE__ */ jsx2(
|
|
496
|
-
|
|
497
|
-
{
|
|
498
|
-
style: {
|
|
499
|
-
color: theme.colors.text,
|
|
500
|
-
fontSize: 14,
|
|
501
|
-
fontWeight: 700,
|
|
502
|
-
lineHeight: 1.25,
|
|
503
|
-
overflow: "hidden",
|
|
504
|
-
textOverflow: "ellipsis",
|
|
505
|
-
whiteSpace: "nowrap"
|
|
506
|
-
},
|
|
507
|
-
children: title
|
|
508
|
-
}
|
|
509
|
-
) : null,
|
|
510
|
-
value ? /* @__PURE__ */ jsx2(
|
|
511
|
-
"div",
|
|
512
|
-
{
|
|
513
|
-
style: {
|
|
514
|
-
color: theme.colors.text,
|
|
515
|
-
fontSize: 18,
|
|
516
|
-
fontWeight: 800,
|
|
517
|
-
lineHeight: 1.15,
|
|
518
|
-
overflow: "hidden",
|
|
519
|
-
textOverflow: "ellipsis",
|
|
520
|
-
whiteSpace: "nowrap"
|
|
521
|
-
},
|
|
522
|
-
children: value
|
|
523
|
-
}
|
|
524
|
-
) : null
|
|
410
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
|
|
411
|
+
title ? /* @__PURE__ */ jsx2("div", { className: "truncate text-sm font-bold leading-[1.25] text-[var(--theme-text)]", children: title }) : null,
|
|
412
|
+
value ? /* @__PURE__ */ jsx2("div", { className: "truncate text-[18px] font-extrabold leading-[1.15] text-[var(--theme-text)]", children: value }) : null
|
|
525
413
|
] })
|
|
526
414
|
]
|
|
527
415
|
}
|
|
@@ -529,12 +417,17 @@ function CardSmall({
|
|
|
529
417
|
}
|
|
530
418
|
|
|
531
419
|
// src/components/Checkbox.tsx
|
|
532
|
-
import { useEffect, useId, useRef, useState
|
|
420
|
+
import { useEffect as useEffect2, useId, useRef, useState } from "react";
|
|
533
421
|
import { jsx as jsx3, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
534
422
|
var CHECKBOX_SIZE_BY_CONTROL_SIZE = {
|
|
535
|
-
sm:
|
|
536
|
-
md:
|
|
537
|
-
lg:
|
|
423
|
+
sm: 14,
|
|
424
|
+
md: 16,
|
|
425
|
+
lg: 20
|
|
426
|
+
};
|
|
427
|
+
var CHECKBOX_LABEL_CLASSNAMES = {
|
|
428
|
+
sm: "text-[13px] leading-4",
|
|
429
|
+
md: "text-sm leading-[18px]",
|
|
430
|
+
lg: "text-[15px] leading-[18px]"
|
|
538
431
|
};
|
|
539
432
|
var getCheckboxSize = (controlSize) => CHECKBOX_SIZE_BY_CONTROL_SIZE[controlSize];
|
|
540
433
|
var hasNodeContent = (value) => {
|
|
@@ -623,7 +516,6 @@ function Checkbox({
|
|
|
623
516
|
...rest
|
|
624
517
|
}) {
|
|
625
518
|
const { theme, mutedText } = useUiKitTheme();
|
|
626
|
-
const controlMetrics = getControlMetrics(controlSize);
|
|
627
519
|
const indicatorSize = getCheckboxSize(controlSize);
|
|
628
520
|
const hasLabel = hasNodeContent(label);
|
|
629
521
|
const hasHint = hasNodeContent(hint);
|
|
@@ -631,11 +523,11 @@ function Checkbox({
|
|
|
631
523
|
const hasSecondaryContent = hasLabel && hasHint;
|
|
632
524
|
const resolvedId = id != null ? id : `ss-checkbox-${useId().replace(/:/g, "")}`;
|
|
633
525
|
const inputRef = useRef(null);
|
|
634
|
-
const [isFocused, setIsFocused] =
|
|
635
|
-
const [internalChecked, setInternalChecked] =
|
|
526
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
527
|
+
const [internalChecked, setInternalChecked] = useState(Boolean(defaultChecked));
|
|
636
528
|
const isControlled = checked !== void 0;
|
|
637
529
|
const resolvedChecked = isControlled ? Boolean(checked) : internalChecked;
|
|
638
|
-
|
|
530
|
+
useEffect2(() => {
|
|
639
531
|
if (!inputRef.current) {
|
|
640
532
|
return;
|
|
641
533
|
}
|
|
@@ -644,43 +536,28 @@ function Checkbox({
|
|
|
644
536
|
return /* @__PURE__ */ jsx3(
|
|
645
537
|
"div",
|
|
646
538
|
{
|
|
647
|
-
className,
|
|
648
|
-
style
|
|
649
|
-
width: "100%",
|
|
650
|
-
display: "flex",
|
|
651
|
-
flexDirection: "column",
|
|
652
|
-
gap: 6,
|
|
653
|
-
...style
|
|
654
|
-
},
|
|
539
|
+
className: cx("flex w-full flex-col gap-1.5", className),
|
|
540
|
+
style,
|
|
655
541
|
children: /* @__PURE__ */ jsxs4(
|
|
656
542
|
"label",
|
|
657
543
|
{
|
|
658
544
|
htmlFor: resolvedId,
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
666
|
-
userSelect: "none"
|
|
667
|
-
},
|
|
545
|
+
className: cx(
|
|
546
|
+
"inline-flex select-none gap-2.5",
|
|
547
|
+
hasSecondaryContent ? "items-start" : "items-center",
|
|
548
|
+
hasLabel || hasHint || hasError ? "w-full" : "w-auto",
|
|
549
|
+
disabled ? "cursor-not-allowed opacity-70" : "cursor-pointer"
|
|
550
|
+
),
|
|
668
551
|
children: [
|
|
669
552
|
/* @__PURE__ */ jsxs4(
|
|
670
553
|
"span",
|
|
671
554
|
{
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
padding: 2,
|
|
679
|
-
marginTop: hasSecondaryContent ? 1 : 0,
|
|
680
|
-
borderRadius: 999,
|
|
681
|
-
boxShadow: isFocused ? `0 0 0 3px ${withAlpha(theme.colors.primary, 0.16)}` : "none",
|
|
682
|
-
transition: "box-shadow 140ms ease"
|
|
683
|
-
},
|
|
555
|
+
className: cx(
|
|
556
|
+
"relative inline-flex shrink-0 items-center justify-center rounded-full p-0.5",
|
|
557
|
+
hasSecondaryContent ? "mt-px" : "mt-0",
|
|
558
|
+
"transition-shadow duration-150",
|
|
559
|
+
isFocused ? "shadow-[0_0_0_3px_var(--ui-kit-focus-ring)]" : "shadow-none"
|
|
560
|
+
),
|
|
684
561
|
children: [
|
|
685
562
|
/* @__PURE__ */ jsx3(
|
|
686
563
|
"input",
|
|
@@ -706,15 +583,10 @@ function Checkbox({
|
|
|
706
583
|
setIsFocused(false);
|
|
707
584
|
onBlur == null ? void 0 : onBlur(event);
|
|
708
585
|
},
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
height: "100%",
|
|
714
|
-
margin: 0,
|
|
715
|
-
opacity: 0,
|
|
716
|
-
cursor: disabled ? "not-allowed" : "pointer"
|
|
717
|
-
}
|
|
586
|
+
className: cx(
|
|
587
|
+
"absolute inset-0 m-0 h-full w-full opacity-0",
|
|
588
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
589
|
+
)
|
|
718
590
|
}
|
|
719
591
|
),
|
|
720
592
|
/* @__PURE__ */ jsx3(
|
|
@@ -736,52 +608,17 @@ function Checkbox({
|
|
|
736
608
|
hasLabel || hasHint || hasError ? /* @__PURE__ */ jsxs4(
|
|
737
609
|
"span",
|
|
738
610
|
{
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
justifyContent: hasSecondaryContent ? "flex-start" : "center",
|
|
744
|
-
minWidth: 0
|
|
745
|
-
},
|
|
611
|
+
className: cx(
|
|
612
|
+
"flex min-w-0 flex-col gap-1",
|
|
613
|
+
hasSecondaryContent ? "justify-start" : "justify-center"
|
|
614
|
+
),
|
|
746
615
|
children: [
|
|
747
|
-
label ? /* @__PURE__ */ jsxs4(
|
|
748
|
-
|
|
749
|
-
{
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
lineHeight: controlMetrics.lineHeight,
|
|
754
|
-
fontWeight: 600
|
|
755
|
-
},
|
|
756
|
-
children: [
|
|
757
|
-
label,
|
|
758
|
-
required ? /* @__PURE__ */ jsx3("span", { style: { color: theme.colors.negative, marginLeft: 4 }, children: "*" }) : null
|
|
759
|
-
]
|
|
760
|
-
}
|
|
761
|
-
) : null,
|
|
762
|
-
hint ? /* @__PURE__ */ jsx3(
|
|
763
|
-
"span",
|
|
764
|
-
{
|
|
765
|
-
style: {
|
|
766
|
-
color: mutedText,
|
|
767
|
-
fontSize: 13,
|
|
768
|
-
lineHeight: 1.45
|
|
769
|
-
},
|
|
770
|
-
children: hint
|
|
771
|
-
}
|
|
772
|
-
) : null,
|
|
773
|
-
error ? /* @__PURE__ */ jsx3(
|
|
774
|
-
"span",
|
|
775
|
-
{
|
|
776
|
-
style: {
|
|
777
|
-
color: theme.colors.negative,
|
|
778
|
-
fontSize: 13,
|
|
779
|
-
lineHeight: 1.45,
|
|
780
|
-
fontWeight: 600
|
|
781
|
-
},
|
|
782
|
-
children: error
|
|
783
|
-
}
|
|
784
|
-
) : null
|
|
616
|
+
label ? /* @__PURE__ */ jsxs4("span", { className: cx("font-semibold text-[var(--theme-text)]", CHECKBOX_LABEL_CLASSNAMES[controlSize]), children: [
|
|
617
|
+
label,
|
|
618
|
+
required ? /* @__PURE__ */ jsx3("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
619
|
+
] }) : null,
|
|
620
|
+
hint ? /* @__PURE__ */ jsx3("span", { className: "text-[13px] leading-[1.45] text-[var(--ui-kit-muted-text)]", children: hint }) : null,
|
|
621
|
+
error ? /* @__PURE__ */ jsx3("span", { className: "text-[13px] font-semibold leading-[1.45] text-[var(--theme-negative)]", children: error }) : null
|
|
785
622
|
]
|
|
786
623
|
}
|
|
787
624
|
) : null
|
|
@@ -796,19 +633,8 @@ function Checkbox({
|
|
|
796
633
|
import { useMemo as useMemo3 } from "react";
|
|
797
634
|
|
|
798
635
|
// src/components/Modal.tsx
|
|
799
|
-
import { useEffect as
|
|
636
|
+
import { useEffect as useEffect3, useMemo as useMemo2, useState as useState2 } from "react";
|
|
800
637
|
import { jsx as jsx4, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
801
|
-
var srOnlyStyle = {
|
|
802
|
-
position: "absolute",
|
|
803
|
-
width: 1,
|
|
804
|
-
height: 1,
|
|
805
|
-
padding: 0,
|
|
806
|
-
margin: -1,
|
|
807
|
-
overflow: "hidden",
|
|
808
|
-
clip: "rect(0, 0, 0, 0)",
|
|
809
|
-
whiteSpace: "nowrap",
|
|
810
|
-
border: 0
|
|
811
|
-
};
|
|
812
638
|
var isUiKitThemeTokens = (theme) => {
|
|
813
639
|
return Boolean(theme && typeof theme === "object" && "theme" in theme);
|
|
814
640
|
};
|
|
@@ -859,7 +685,6 @@ function ModalActionButton({
|
|
|
859
685
|
theme
|
|
860
686
|
}) {
|
|
861
687
|
var _a, _b;
|
|
862
|
-
const { colors } = theme;
|
|
863
688
|
const {
|
|
864
689
|
label,
|
|
865
690
|
onClick,
|
|
@@ -867,54 +692,24 @@ function ModalActionButton({
|
|
|
867
692
|
disabled = false,
|
|
868
693
|
style
|
|
869
694
|
} = action;
|
|
870
|
-
const
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
margin: 0,
|
|
883
|
-
textAlign: "center",
|
|
884
|
-
transition: "0.5s",
|
|
885
|
-
opacity: disabled ? DISABLED_COMPONENT_OPACITY : 1,
|
|
886
|
-
filter: disabled ? "saturate(0)" : void 0
|
|
887
|
-
};
|
|
888
|
-
if (appearance === "text") {
|
|
889
|
-
buttonStyle.background = "none";
|
|
890
|
-
buttonStyle.border = "1px solid transparent";
|
|
891
|
-
buttonStyle.color = colors.primary;
|
|
892
|
-
buttonStyle.boxShadow = "none";
|
|
893
|
-
} else if (appearance === "link") {
|
|
894
|
-
buttonStyle.background = "none";
|
|
895
|
-
buttonStyle.border = "none";
|
|
896
|
-
buttonStyle.color = colors.primary;
|
|
897
|
-
buttonStyle.boxShadow = "none";
|
|
898
|
-
} else if (appearance === "outlined") {
|
|
899
|
-
buttonStyle.background = "none";
|
|
900
|
-
buttonStyle.border = `2px solid ${colors.primary}`;
|
|
901
|
-
buttonStyle.color = colors.primary;
|
|
902
|
-
buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.text, 0.08)}`;
|
|
903
|
-
} else {
|
|
904
|
-
buttonStyle.background = colors.primary;
|
|
905
|
-
buttonStyle.border = "1px solid transparent";
|
|
906
|
-
buttonStyle.color = colors.onPrimary;
|
|
907
|
-
buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.primary, 0.22)}`;
|
|
908
|
-
}
|
|
695
|
+
const buttonClassName = cx(
|
|
696
|
+
"flex w-full items-center justify-center rounded-[0.4rem] box-border",
|
|
697
|
+
"m-0 text-center font-bold leading-[1.2]",
|
|
698
|
+
appearance === "link" ? "p-0 text-[1.05rem]" : "px-[1.15rem] py-[0.9rem] text-[1.05rem]",
|
|
699
|
+
disabled ? "cursor-not-allowed saturate-0" : "cursor-pointer",
|
|
700
|
+
appearance === "text" && "border border-transparent bg-transparent text-[var(--ui-kit-modal-primary)] shadow-none",
|
|
701
|
+
appearance === "link" && "border-0 bg-transparent text-[var(--ui-kit-modal-primary)] shadow-none",
|
|
702
|
+
appearance === "outlined" && "border-2 border-[var(--ui-kit-modal-primary)] bg-transparent",
|
|
703
|
+
appearance === "outlined" && "text-[var(--ui-kit-modal-primary)] shadow-[var(--ui-kit-modal-button-shadow-outlined)]",
|
|
704
|
+
appearance === "contained" && "border border-transparent bg-[var(--ui-kit-modal-primary)]",
|
|
705
|
+
appearance === "contained" && "text-[var(--ui-kit-modal-on-primary)] shadow-[var(--ui-kit-modal-button-shadow-contained)]"
|
|
706
|
+
);
|
|
909
707
|
return /* @__PURE__ */ jsx4(
|
|
910
708
|
"div",
|
|
911
709
|
{
|
|
710
|
+
className: "m-0 flex items-center justify-center",
|
|
912
711
|
style: {
|
|
913
712
|
width: (_a = style == null ? void 0 : style.width) != null ? _a : (style == null ? void 0 : style.maxWidth) ? "100%" : "max-content",
|
|
914
|
-
display: "flex",
|
|
915
|
-
alignItems: "center",
|
|
916
|
-
justifyContent: "center",
|
|
917
|
-
margin: 0,
|
|
918
713
|
marginBottom: (_b = style == null ? void 0 : style.marginBottom) != null ? _b : 0,
|
|
919
714
|
...style
|
|
920
715
|
},
|
|
@@ -924,7 +719,8 @@ function ModalActionButton({
|
|
|
924
719
|
type: "button",
|
|
925
720
|
onClick: disabled ? void 0 : onClick,
|
|
926
721
|
disabled,
|
|
927
|
-
|
|
722
|
+
className: buttonClassName,
|
|
723
|
+
style: { opacity: disabled ? DISABLED_COMPONENT_OPACITY : 1 },
|
|
928
724
|
children: label
|
|
929
725
|
}
|
|
930
726
|
)
|
|
@@ -939,19 +735,13 @@ function ModalBusyIndicator({
|
|
|
939
735
|
{
|
|
940
736
|
"aria-live": "polite",
|
|
941
737
|
role: "status",
|
|
738
|
+
className: "relative inline-flex h-14 w-14 items-center justify-center rounded-full",
|
|
942
739
|
style: {
|
|
943
|
-
position: "relative",
|
|
944
|
-
display: "inline-flex",
|
|
945
|
-
alignItems: "center",
|
|
946
|
-
justifyContent: "center",
|
|
947
|
-
width: 56,
|
|
948
|
-
height: 56,
|
|
949
|
-
borderRadius: 999,
|
|
950
740
|
backgroundColor: withAlpha(theme.colors.surface, 0.88),
|
|
951
741
|
boxShadow: `0 18px 36px ${withAlpha(theme.colors.text, 0.08)}`
|
|
952
742
|
},
|
|
953
743
|
children: [
|
|
954
|
-
/* @__PURE__ */ jsx4("span", {
|
|
744
|
+
/* @__PURE__ */ jsx4("span", { className: "ui-kit-sr-only", children: "Loading" }),
|
|
955
745
|
/* @__PURE__ */ jsxs5("svg", { "aria-hidden": "true", width: "32", height: "32", viewBox: "0 0 40 40", fill: "none", children: [
|
|
956
746
|
/* @__PURE__ */ jsx4(
|
|
957
747
|
"circle",
|
|
@@ -988,6 +778,33 @@ function ModalBusyIndicator({
|
|
|
988
778
|
}
|
|
989
779
|
);
|
|
990
780
|
}
|
|
781
|
+
function MaximizeIcon() {
|
|
782
|
+
return /* @__PURE__ */ jsx4("svg", { "aria-hidden": "true", width: "15", height: "15", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx4("rect", { x: "4.25", y: "4.25", width: "11.5", height: "11.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }) });
|
|
783
|
+
}
|
|
784
|
+
function MinimizeIcon() {
|
|
785
|
+
return /* @__PURE__ */ jsxs5("svg", { "aria-hidden": "true", width: "15", height: "15", viewBox: "0 0 20 20", fill: "none", children: [
|
|
786
|
+
/* @__PURE__ */ jsx4(
|
|
787
|
+
"path",
|
|
788
|
+
{
|
|
789
|
+
d: "M6.25 4.75H13a2.25 2.25 0 0 1 2.25 2.25v6.75",
|
|
790
|
+
stroke: "currentColor",
|
|
791
|
+
strokeWidth: "1.7",
|
|
792
|
+
strokeLinecap: "round",
|
|
793
|
+
strokeLinejoin: "round"
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
/* @__PURE__ */ jsx4(
|
|
797
|
+
"path",
|
|
798
|
+
{
|
|
799
|
+
d: "M13.75 9.5v4.25a1.5 1.5 0 0 1-1.5 1.5H6a1.75 1.75 0 0 1-1.75-1.75V7.75A1.5 1.5 0 0 1 5.75 6.25H10",
|
|
800
|
+
stroke: "currentColor",
|
|
801
|
+
strokeWidth: "1.7",
|
|
802
|
+
strokeLinecap: "round",
|
|
803
|
+
strokeLinejoin: "round"
|
|
804
|
+
}
|
|
805
|
+
)
|
|
806
|
+
] });
|
|
807
|
+
}
|
|
991
808
|
function UnifiedModal({
|
|
992
809
|
isOpen,
|
|
993
810
|
onClose,
|
|
@@ -1018,10 +835,25 @@ function UnifiedModal({
|
|
|
1018
835
|
return `0 34px 80px ${withAlpha(modalTheme.theme.colors.shadow, 0.28)}`;
|
|
1019
836
|
}, [modalTheme.theme.colors.shadow]);
|
|
1020
837
|
const controlShadow = useMemo2(() => getComponentShadow(modalTheme.theme), [modalTheme.theme]);
|
|
1021
|
-
const
|
|
838
|
+
const modalVariables = useMemo2(() => ({
|
|
839
|
+
"--ui-kit-modal-overlay": modalTheme.overlay,
|
|
840
|
+
"--ui-kit-modal-surface": modalTheme.colors.surface,
|
|
841
|
+
"--ui-kit-modal-surface-raised": modalTheme.surfaceRaised,
|
|
842
|
+
"--ui-kit-modal-text": modalTheme.colors.text,
|
|
843
|
+
"--ui-kit-modal-border-soft": modalTheme.borderSoft,
|
|
844
|
+
"--ui-kit-modal-divider": withAlpha(modalTheme.colors.text, 0.06),
|
|
845
|
+
"--ui-kit-modal-primary": modalTheme.colors.primary,
|
|
846
|
+
"--ui-kit-modal-on-primary": modalTheme.colors.onPrimary,
|
|
847
|
+
"--ui-kit-modal-shadow": modalShadow,
|
|
848
|
+
"--ui-kit-modal-control-shadow": controlShadow,
|
|
849
|
+
"--ui-kit-modal-busy-overlay": withAlpha(modalTheme.colors.surface, 0.58),
|
|
850
|
+
"--ui-kit-modal-button-shadow-outlined": `0 14px 28px ${withAlpha(modalTheme.colors.text, 0.08)}`,
|
|
851
|
+
"--ui-kit-modal-button-shadow-contained": `0 14px 28px ${withAlpha(modalTheme.colors.primary, 0.22)}`
|
|
852
|
+
}), [controlShadow, modalShadow, modalTheme]);
|
|
853
|
+
const [isMaximized, setIsMaximized] = useState2(maximized != null ? maximized : false);
|
|
1022
854
|
const titleId = useMemo2(() => createTitleId(title), [title]);
|
|
1023
855
|
const shouldDisableDismiss = disableDismiss || isBusy;
|
|
1024
|
-
|
|
856
|
+
useEffect3(() => {
|
|
1025
857
|
if (typeof maximized === "boolean") {
|
|
1026
858
|
setIsMaximized(maximized);
|
|
1027
859
|
return;
|
|
@@ -1030,7 +862,7 @@ function UnifiedModal({
|
|
|
1030
862
|
setIsMaximized(true);
|
|
1031
863
|
}
|
|
1032
864
|
}, [maximized]);
|
|
1033
|
-
|
|
865
|
+
useEffect3(() => {
|
|
1034
866
|
if (!isOpen || typeof window === "undefined" || typeof document === "undefined") {
|
|
1035
867
|
return;
|
|
1036
868
|
}
|
|
@@ -1054,13 +886,7 @@ function UnifiedModal({
|
|
|
1054
886
|
"h2",
|
|
1055
887
|
{
|
|
1056
888
|
id: titleId,
|
|
1057
|
-
|
|
1058
|
-
margin: 0,
|
|
1059
|
-
color: modalTheme.colors.text,
|
|
1060
|
-
fontSize: 24,
|
|
1061
|
-
fontWeight: 800,
|
|
1062
|
-
lineHeight: 1.1
|
|
1063
|
-
},
|
|
889
|
+
className: "m-0 text-2xl font-extrabold leading-[1.1] text-[var(--ui-kit-modal-text)]",
|
|
1064
890
|
children: title
|
|
1065
891
|
}
|
|
1066
892
|
) : null;
|
|
@@ -1125,62 +951,49 @@ function UnifiedModal({
|
|
|
1125
951
|
onClose();
|
|
1126
952
|
}
|
|
1127
953
|
},
|
|
954
|
+
className: "fixed inset-0 z-[70] flex items-center justify-center backdrop-blur-[8px]",
|
|
1128
955
|
style: {
|
|
1129
|
-
|
|
1130
|
-
inset: 0,
|
|
1131
|
-
zIndex: 70,
|
|
1132
|
-
display: "flex",
|
|
1133
|
-
alignItems: "center",
|
|
1134
|
-
justifyContent: "center",
|
|
956
|
+
...modalVariables,
|
|
1135
957
|
padding: isMaximized ? 0 : 16,
|
|
1136
|
-
backgroundColor:
|
|
1137
|
-
backdropFilter: "blur(8px)"
|
|
958
|
+
backgroundColor: "var(--ui-kit-modal-overlay)"
|
|
1138
959
|
},
|
|
1139
960
|
children: /* @__PURE__ */ jsxs5(
|
|
1140
961
|
"div",
|
|
1141
962
|
{
|
|
963
|
+
className: cx(
|
|
964
|
+
"relative flex flex-col overflow-hidden border",
|
|
965
|
+
"bg-[linear-gradient(180deg,var(--ui-kit-modal-surface-raised),var(--ui-kit-modal-surface))]",
|
|
966
|
+
"text-[var(--ui-kit-modal-text)]",
|
|
967
|
+
isMaximized ? "rounded-none" : "rounded-[30px]"
|
|
968
|
+
),
|
|
1142
969
|
style: {
|
|
1143
|
-
position: "relative",
|
|
1144
|
-
display: "flex",
|
|
1145
|
-
flexDirection: "column",
|
|
1146
970
|
width: isMaximized ? "100vw" : "min(100%, 100%)",
|
|
1147
971
|
maxWidth: isMaximized ? "100vw" : normalizeWidth(maxWidth),
|
|
1148
972
|
height: isMaximized ? "100vh" : void 0,
|
|
1149
973
|
maxHeight: isMaximized ? "100vh" : "calc(100vh - 32px)",
|
|
1150
974
|
minWidth: isMaximized ? "100vw" : 300,
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,
|
|
1154
|
-
boxShadow: modalShadow,
|
|
1155
|
-
color: modalTheme.colors.text,
|
|
1156
|
-
overflow: "hidden",
|
|
975
|
+
borderColor: "var(--ui-kit-modal-border-soft)",
|
|
976
|
+
boxShadow: "var(--ui-kit-modal-shadow)",
|
|
1157
977
|
...contentStyle
|
|
1158
978
|
},
|
|
1159
979
|
children: [
|
|
1160
980
|
/* @__PURE__ */ jsxs5(
|
|
1161
981
|
"div",
|
|
1162
982
|
{
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
alignItems: "flex-start",
|
|
1166
|
-
justifyContent: "space-between",
|
|
1167
|
-
gap: 12,
|
|
1168
|
-
padding: "18px 20px 12px",
|
|
1169
|
-
borderBottom: `1px solid ${withAlpha(modalTheme.colors.text, 0.06)}`
|
|
1170
|
-
},
|
|
983
|
+
className: "flex items-start justify-between gap-3 border-b px-5 pb-3 pt-[18px]",
|
|
984
|
+
style: { borderColor: "var(--ui-kit-modal-divider)" },
|
|
1171
985
|
children: [
|
|
1172
986
|
/* @__PURE__ */ jsx4(
|
|
1173
987
|
"div",
|
|
1174
988
|
{
|
|
1175
|
-
|
|
1176
|
-
flex
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
},
|
|
989
|
+
className: cx(
|
|
990
|
+
"flex-1 transition-opacity duration-150",
|
|
991
|
+
isBusy ? "opacity-[0.38]" : "opacity-100"
|
|
992
|
+
),
|
|
1180
993
|
children: resolvedHeader
|
|
1181
994
|
}
|
|
1182
995
|
),
|
|
1183
|
-
/* @__PURE__ */ jsxs5("div", {
|
|
996
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
1184
997
|
!hideExpandButton ? /* @__PURE__ */ jsx4(
|
|
1185
998
|
"button",
|
|
1186
999
|
{
|
|
@@ -1188,19 +1001,9 @@ function UnifiedModal({
|
|
|
1188
1001
|
title: isMaximized ? "Minimize" : "Maximize",
|
|
1189
1002
|
type: "button",
|
|
1190
1003
|
onClick: () => setIsMaximized((current) => !current),
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
borderRadius: 999,
|
|
1195
|
-
border: `1px solid ${modalTheme.borderSoft}`,
|
|
1196
|
-
backgroundColor: "transparent",
|
|
1197
|
-
color: modalTheme.colors.text,
|
|
1198
|
-
cursor: "pointer",
|
|
1199
|
-
fontSize: 18,
|
|
1200
|
-
fontWeight: 700,
|
|
1201
|
-
boxShadow: controlShadow
|
|
1202
|
-
},
|
|
1203
|
-
children: isMaximized ? "\u25A2" : "\u25A1"
|
|
1004
|
+
className: "m-0 inline-flex h-[30px] w-[30px] shrink-0 cursor-pointer appearance-none items-center justify-center rounded-full border bg-transparent p-0 text-[var(--ui-kit-modal-text)] leading-none shadow-[var(--ui-kit-modal-control-shadow)]",
|
|
1005
|
+
style: { borderColor: "var(--ui-kit-modal-border-soft)" },
|
|
1006
|
+
children: isMaximized ? /* @__PURE__ */ jsx4(MinimizeIcon, {}) : /* @__PURE__ */ jsx4(MaximizeIcon, {})
|
|
1204
1007
|
}
|
|
1205
1008
|
) : null,
|
|
1206
1009
|
!hideCloseButton ? /* @__PURE__ */ jsx4(
|
|
@@ -1209,18 +1012,15 @@ function UnifiedModal({
|
|
|
1209
1012
|
"aria-label": "Close modal",
|
|
1210
1013
|
type: "button",
|
|
1211
1014
|
onClick: shouldDisableDismiss ? void 0 : onClose,
|
|
1015
|
+
className: cx(
|
|
1016
|
+
"flex h-[30px] w-[30px] items-center justify-center rounded-full border",
|
|
1017
|
+
"bg-transparent text-[20px] font-bold text-[var(--ui-kit-modal-text)]",
|
|
1018
|
+
"shadow-[var(--ui-kit-modal-control-shadow)]",
|
|
1019
|
+
shouldDisableDismiss ? "cursor-not-allowed" : "cursor-pointer"
|
|
1020
|
+
),
|
|
1212
1021
|
style: {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
borderRadius: 999,
|
|
1216
|
-
border: `1px solid ${modalTheme.borderSoft}`,
|
|
1217
|
-
backgroundColor: "transparent",
|
|
1218
|
-
color: modalTheme.colors.text,
|
|
1219
|
-
cursor: shouldDisableDismiss ? "not-allowed" : "pointer",
|
|
1220
|
-
fontSize: 20,
|
|
1221
|
-
fontWeight: 700,
|
|
1222
|
-
opacity: shouldDisableDismiss ? DISABLED_COMPONENT_OPACITY : 1,
|
|
1223
|
-
boxShadow: controlShadow
|
|
1022
|
+
borderColor: "var(--ui-kit-modal-border-soft)",
|
|
1023
|
+
opacity: shouldDisableDismiss ? DISABLED_COMPONENT_OPACITY : 1
|
|
1224
1024
|
},
|
|
1225
1025
|
children: "\xD7"
|
|
1226
1026
|
}
|
|
@@ -1232,39 +1032,23 @@ function UnifiedModal({
|
|
|
1232
1032
|
/* @__PURE__ */ jsxs5(
|
|
1233
1033
|
"div",
|
|
1234
1034
|
{
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
minHeight: 0,
|
|
1238
|
-
position: "relative",
|
|
1239
|
-
overflow: "auto",
|
|
1240
|
-
padding: 24,
|
|
1241
|
-
...bodyStyle
|
|
1242
|
-
},
|
|
1035
|
+
className: "relative min-h-0 flex-1 overflow-auto p-6",
|
|
1036
|
+
style: bodyStyle,
|
|
1243
1037
|
children: [
|
|
1244
1038
|
/* @__PURE__ */ jsx4(
|
|
1245
1039
|
"div",
|
|
1246
1040
|
{
|
|
1247
|
-
|
|
1248
|
-
opacity
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
transition: "opacity 180ms ease, filter 180ms ease"
|
|
1252
|
-
},
|
|
1041
|
+
className: cx(
|
|
1042
|
+
"transition-[opacity,filter] duration-150",
|
|
1043
|
+
isBusy ? "pointer-events-none opacity-[0.38] saturate-[0.8]" : "pointer-events-auto opacity-100 saturate-100"
|
|
1044
|
+
),
|
|
1253
1045
|
children
|
|
1254
1046
|
}
|
|
1255
1047
|
),
|
|
1256
1048
|
isBusy ? /* @__PURE__ */ jsx4(
|
|
1257
1049
|
"div",
|
|
1258
1050
|
{
|
|
1259
|
-
|
|
1260
|
-
position: "absolute",
|
|
1261
|
-
inset: 0,
|
|
1262
|
-
display: "flex",
|
|
1263
|
-
alignItems: "center",
|
|
1264
|
-
justifyContent: "center",
|
|
1265
|
-
backgroundColor: withAlpha(modalTheme.colors.surface, 0.58),
|
|
1266
|
-
backdropFilter: "blur(2px)"
|
|
1267
|
-
},
|
|
1051
|
+
className: "absolute inset-0 flex items-center justify-center bg-[var(--ui-kit-modal-busy-overlay)] backdrop-blur-[2px]",
|
|
1268
1052
|
children: /* @__PURE__ */ jsx4(ModalBusyIndicator, { theme: modalTheme })
|
|
1269
1053
|
}
|
|
1270
1054
|
) : null
|
|
@@ -1274,13 +1058,8 @@ function UnifiedModal({
|
|
|
1274
1058
|
shouldRenderFooter ? /* @__PURE__ */ jsx4(
|
|
1275
1059
|
"div",
|
|
1276
1060
|
{
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
justifyContent: "flex-end",
|
|
1280
|
-
gap: 10,
|
|
1281
|
-
padding: "12px 20px 16px",
|
|
1282
|
-
borderTop: `1px solid ${withAlpha(modalTheme.colors.text, 0.06)}`
|
|
1283
|
-
},
|
|
1061
|
+
className: "flex justify-end gap-2.5 border-t px-5 pb-4 pt-3",
|
|
1062
|
+
style: { borderColor: "var(--ui-kit-modal-divider)" },
|
|
1284
1063
|
children: footerContent
|
|
1285
1064
|
}
|
|
1286
1065
|
) : null
|
|
@@ -1343,12 +1122,7 @@ function ComposableModal({
|
|
|
1343
1122
|
const defaultHeader = headerFallback != null ? headerFallback : /* @__PURE__ */ jsx5(
|
|
1344
1123
|
"h2",
|
|
1345
1124
|
{
|
|
1346
|
-
|
|
1347
|
-
margin: 0,
|
|
1348
|
-
fontSize: 30,
|
|
1349
|
-
fontWeight: 800,
|
|
1350
|
-
lineHeight: 1.1
|
|
1351
|
-
},
|
|
1125
|
+
className: "m-0 text-[24px] font-extrabold leading-[1.1]",
|
|
1352
1126
|
children: title
|
|
1353
1127
|
}
|
|
1354
1128
|
);
|
|
@@ -1386,14 +1160,14 @@ function ComposableModal({
|
|
|
1386
1160
|
|
|
1387
1161
|
// src/components/DatePicker.tsx
|
|
1388
1162
|
import {
|
|
1389
|
-
useEffect as
|
|
1163
|
+
useEffect as useEffect5,
|
|
1390
1164
|
useMemo as useMemo4,
|
|
1391
1165
|
useRef as useRef3,
|
|
1392
|
-
useState as
|
|
1166
|
+
useState as useState4
|
|
1393
1167
|
} from "react";
|
|
1394
1168
|
|
|
1395
1169
|
// src/components/Input.tsx
|
|
1396
|
-
import { useEffect as
|
|
1170
|
+
import { useEffect as useEffect4, useId as useId2, useRef as useRef2, useState as useState3 } from "react";
|
|
1397
1171
|
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1398
1172
|
var PASSWORD_TOGGLE_METRICS_BY_SIZE = {
|
|
1399
1173
|
sm: {
|
|
@@ -1403,18 +1177,33 @@ var PASSWORD_TOGGLE_METRICS_BY_SIZE = {
|
|
|
1403
1177
|
iconSize: 14
|
|
1404
1178
|
},
|
|
1405
1179
|
md: {
|
|
1180
|
+
buttonSize: 19,
|
|
1181
|
+
leftOffset: 9,
|
|
1182
|
+
contentGap: 9,
|
|
1183
|
+
iconSize: 15
|
|
1184
|
+
},
|
|
1185
|
+
lg: {
|
|
1406
1186
|
buttonSize: 20,
|
|
1407
1187
|
leftOffset: 10,
|
|
1408
1188
|
contentGap: 10,
|
|
1409
1189
|
iconSize: 16
|
|
1410
|
-
},
|
|
1411
|
-
lg: {
|
|
1412
|
-
buttonSize: 22,
|
|
1413
|
-
leftOffset: 12,
|
|
1414
|
-
contentGap: 12,
|
|
1415
|
-
iconSize: 18
|
|
1416
1190
|
}
|
|
1417
1191
|
};
|
|
1192
|
+
var FIELD_HEIGHT_CLASSNAMES = {
|
|
1193
|
+
sm: "h-[30px]",
|
|
1194
|
+
md: "h-[34px]",
|
|
1195
|
+
lg: "h-[38px]"
|
|
1196
|
+
};
|
|
1197
|
+
var FIELD_TEXT_CLASSNAMES = {
|
|
1198
|
+
sm: "text-[13px] leading-4",
|
|
1199
|
+
md: "text-sm leading-[18px]",
|
|
1200
|
+
lg: "text-[15px] leading-[18px]"
|
|
1201
|
+
};
|
|
1202
|
+
var FIELD_PADDING_X_CLASSNAMES = {
|
|
1203
|
+
sm: "px-3",
|
|
1204
|
+
md: "px-[14px]",
|
|
1205
|
+
lg: "px-4"
|
|
1206
|
+
};
|
|
1418
1207
|
var getPasswordToggleMetrics = (size) => PASSWORD_TOGGLE_METRICS_BY_SIZE[size];
|
|
1419
1208
|
function ControlFrame({
|
|
1420
1209
|
label,
|
|
@@ -1426,88 +1215,40 @@ function ControlFrame({
|
|
|
1426
1215
|
children,
|
|
1427
1216
|
style
|
|
1428
1217
|
}) {
|
|
1429
|
-
|
|
1218
|
+
useUiKitTheme();
|
|
1430
1219
|
if (!label && !hint && !error) {
|
|
1431
1220
|
return /* @__PURE__ */ jsx6(Fragment2, { children });
|
|
1432
1221
|
}
|
|
1433
|
-
const labelStyle = {
|
|
1434
|
-
color: theme.colors.text,
|
|
1435
|
-
fontSize: 14,
|
|
1436
|
-
fontWeight: 700,
|
|
1437
|
-
letterSpacing: "0.01em"
|
|
1438
|
-
};
|
|
1439
|
-
const wrapperStyle = {
|
|
1440
|
-
display: "flex",
|
|
1441
|
-
flexDirection: "column",
|
|
1442
|
-
gap: 8,
|
|
1443
|
-
width: "100%",
|
|
1444
|
-
...style
|
|
1445
|
-
};
|
|
1446
1222
|
if (!useLabelWrapper) {
|
|
1447
|
-
return /* @__PURE__ */ jsxs7("div", {
|
|
1448
|
-
label || hint ? /* @__PURE__ */ jsxs7("div", {
|
|
1449
|
-
label ? /* @__PURE__ */ jsxs7(
|
|
1450
|
-
label,
|
|
1451
|
-
required ? /* @__PURE__ */ jsx6("span", { style: { color: theme.colors.negative, marginLeft: 4 }, children: "*" }) : null
|
|
1452
|
-
] }) : null,
|
|
1453
|
-
hint ? /* @__PURE__ */ jsx6(
|
|
1454
|
-
"span",
|
|
1223
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col gap-2", style, children: [
|
|
1224
|
+
label || hint ? /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
1225
|
+
label ? /* @__PURE__ */ jsxs7(
|
|
1226
|
+
"label",
|
|
1455
1227
|
{
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1228
|
+
htmlFor,
|
|
1229
|
+
className: "text-sm font-bold tracking-[0.01em] text-[var(--theme-text)]",
|
|
1230
|
+
children: [
|
|
1231
|
+
label,
|
|
1232
|
+
required ? /* @__PURE__ */ jsx6("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
1233
|
+
]
|
|
1462
1234
|
}
|
|
1463
|
-
) : null
|
|
1235
|
+
) : null,
|
|
1236
|
+
hint ? /* @__PURE__ */ jsx6("span", { className: "text-[13px] leading-[1.45] text-[var(--ui-kit-muted-text)]", children: hint }) : null
|
|
1464
1237
|
] }) : null,
|
|
1465
1238
|
children,
|
|
1466
|
-
error ? /* @__PURE__ */ jsx6(
|
|
1467
|
-
"span",
|
|
1468
|
-
{
|
|
1469
|
-
style: {
|
|
1470
|
-
color: theme.colors.negative,
|
|
1471
|
-
fontSize: 13,
|
|
1472
|
-
fontWeight: 600,
|
|
1473
|
-
lineHeight: 1.45
|
|
1474
|
-
},
|
|
1475
|
-
children: error
|
|
1476
|
-
}
|
|
1477
|
-
) : null
|
|
1239
|
+
error ? /* @__PURE__ */ jsx6("span", { className: "text-[13px] font-semibold leading-[1.45] text-[var(--theme-negative)]", children: error }) : null
|
|
1478
1240
|
] });
|
|
1479
1241
|
}
|
|
1480
|
-
return /* @__PURE__ */ jsxs7("label", { htmlFor,
|
|
1481
|
-
label || hint ? /* @__PURE__ */ jsxs7("div", {
|
|
1482
|
-
label ? /* @__PURE__ */ jsxs7("span", {
|
|
1242
|
+
return /* @__PURE__ */ jsxs7("label", { htmlFor, className: "flex w-full flex-col gap-2", style, children: [
|
|
1243
|
+
label || hint ? /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
1244
|
+
label ? /* @__PURE__ */ jsxs7("span", { className: "text-sm font-bold tracking-[0.01em] text-[var(--theme-text)]", children: [
|
|
1483
1245
|
label,
|
|
1484
|
-
required ? /* @__PURE__ */ jsx6("span", {
|
|
1246
|
+
required ? /* @__PURE__ */ jsx6("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
1485
1247
|
] }) : null,
|
|
1486
|
-
hint ? /* @__PURE__ */ jsx6(
|
|
1487
|
-
"span",
|
|
1488
|
-
{
|
|
1489
|
-
style: {
|
|
1490
|
-
color: mutedText,
|
|
1491
|
-
fontSize: 13,
|
|
1492
|
-
lineHeight: 1.45
|
|
1493
|
-
},
|
|
1494
|
-
children: hint
|
|
1495
|
-
}
|
|
1496
|
-
) : null
|
|
1248
|
+
hint ? /* @__PURE__ */ jsx6("span", { className: "text-[13px] leading-[1.45] text-[var(--ui-kit-muted-text)]", children: hint }) : null
|
|
1497
1249
|
] }) : null,
|
|
1498
1250
|
children,
|
|
1499
|
-
error ? /* @__PURE__ */ jsx6(
|
|
1500
|
-
"span",
|
|
1501
|
-
{
|
|
1502
|
-
style: {
|
|
1503
|
-
color: theme.colors.negative,
|
|
1504
|
-
fontSize: 13,
|
|
1505
|
-
fontWeight: 600,
|
|
1506
|
-
lineHeight: 1.45
|
|
1507
|
-
},
|
|
1508
|
-
children: error
|
|
1509
|
-
}
|
|
1510
|
-
) : null
|
|
1251
|
+
error ? /* @__PURE__ */ jsx6("span", { className: "text-[13px] font-semibold leading-[1.45] text-[var(--theme-negative)]", children: error }) : null
|
|
1511
1252
|
] });
|
|
1512
1253
|
}
|
|
1513
1254
|
function Input({
|
|
@@ -1515,6 +1256,7 @@ function Input({
|
|
|
1515
1256
|
hint,
|
|
1516
1257
|
error,
|
|
1517
1258
|
controlSize = "sm",
|
|
1259
|
+
className,
|
|
1518
1260
|
showPasswordToggle = true,
|
|
1519
1261
|
fileButtonLabel,
|
|
1520
1262
|
id,
|
|
@@ -1525,49 +1267,27 @@ function Input({
|
|
|
1525
1267
|
type = "text",
|
|
1526
1268
|
...rest
|
|
1527
1269
|
}) {
|
|
1528
|
-
|
|
1270
|
+
useUiKitTheme();
|
|
1529
1271
|
const controlMetrics = getControlMetrics(controlSize);
|
|
1530
|
-
const componentShadow = getComponentShadow(theme);
|
|
1531
1272
|
const passwordToggleMetrics = getPasswordToggleMetrics(controlSize);
|
|
1532
1273
|
const generatedId = useId2();
|
|
1533
1274
|
const inputId = id != null ? id : generatedId;
|
|
1534
1275
|
const fileInputRef = useRef2(null);
|
|
1535
|
-
const [isPasswordVisible, setIsPasswordVisible] =
|
|
1536
|
-
const [selectedFileNames, setSelectedFileNames] =
|
|
1276
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState3(false);
|
|
1277
|
+
const [selectedFileNames, setSelectedFileNames] = useState3([]);
|
|
1537
1278
|
const isPasswordField = type === "password";
|
|
1538
1279
|
const isEmailField = type === "email";
|
|
1539
1280
|
const isFileField = type === "file";
|
|
1540
1281
|
const canTogglePasswordVisibility = isPasswordField && showPasswordToggle;
|
|
1541
1282
|
const resolvedType = canTogglePasswordVisibility ? isPasswordVisible ? "text" : "password" : type;
|
|
1542
|
-
|
|
1283
|
+
useEffect4(() => {
|
|
1543
1284
|
if (!isFileField) {
|
|
1544
1285
|
setSelectedFileNames([]);
|
|
1545
1286
|
}
|
|
1546
1287
|
}, [isFileField]);
|
|
1547
|
-
const inputBorderColor = error ? theme.colors.negative : theme.colors.textLight;
|
|
1548
|
-
const adornedFieldShadow = `0 0 0 1px ${inputBorderColor}, ${componentShadow}`;
|
|
1549
|
-
const inputStyle = {
|
|
1550
|
-
width: "100%",
|
|
1551
|
-
boxSizing: "border-box",
|
|
1552
|
-
height: controlMetrics.height,
|
|
1553
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
1554
|
-
border: `1px solid ${inputBorderColor}`,
|
|
1555
|
-
backgroundColor: theme.colors.surface,
|
|
1556
|
-
color: theme.colors.text,
|
|
1557
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
1558
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
1559
|
-
padding: getTextInputPadding(controlSize),
|
|
1560
|
-
outline: "none",
|
|
1561
|
-
boxShadow: componentShadow,
|
|
1562
|
-
fontSize: controlMetrics.fontSize,
|
|
1563
|
-
lineHeight: controlMetrics.lineHeight,
|
|
1564
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
1565
|
-
...style
|
|
1566
|
-
};
|
|
1567
1288
|
const hasFileButtonLabel = typeof fileButtonLabel === "string" ? fileButtonLabel.trim().length > 0 : fileButtonLabel != null;
|
|
1568
1289
|
const hasSelectedFiles = selectedFileNames.length > 0;
|
|
1569
1290
|
const showUploadLabel = hasFileButtonLabel && !hasSelectedFiles;
|
|
1570
|
-
const inputPlaceholderColor = withAlpha(theme.colors.text, 0.5);
|
|
1571
1291
|
const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
|
|
1572
1292
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
1573
1293
|
const fileSelectionText = selectedFileNames.length === 0 ? placeholder != null ? placeholder : "" : selectedFileNames.length === 1 ? selectedFileNames[0] : `${selectedFileNames.length} files selected`;
|
|
@@ -1575,144 +1295,32 @@ function Input({
|
|
|
1575
1295
|
const fileTriggerWidth = controlMetrics.paddingX + fileIconSize;
|
|
1576
1296
|
const emailAdornmentWidth = controlMetrics.paddingX + fileIconSize;
|
|
1577
1297
|
const passwordAdornmentWidth = controlMetrics.paddingX + passwordLockIconSize;
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
border
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
alignItems: "center",
|
|
1605
|
-
justifyContent: "center",
|
|
1606
|
-
color: inputBorderColor
|
|
1607
|
-
};
|
|
1608
|
-
const fileFieldStyle = {
|
|
1609
|
-
width: "100%",
|
|
1610
|
-
boxSizing: "border-box",
|
|
1611
|
-
height: controlMetrics.height,
|
|
1612
|
-
display: "flex",
|
|
1613
|
-
alignItems: "center",
|
|
1614
|
-
gap: 0,
|
|
1615
|
-
overflow: "hidden",
|
|
1616
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
1617
|
-
border: "none",
|
|
1618
|
-
backgroundColor: theme.colors.surface,
|
|
1619
|
-
color: theme.colors.text,
|
|
1620
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
1621
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
1622
|
-
padding: 0,
|
|
1623
|
-
outline: "none",
|
|
1624
|
-
boxShadow: adornedFieldShadow,
|
|
1625
|
-
transition: "box-shadow 160ms ease, background-color 160ms ease",
|
|
1626
|
-
textAlign: "left",
|
|
1627
|
-
...style
|
|
1628
|
-
};
|
|
1629
|
-
const fileSelectionStyle = {
|
|
1630
|
-
flex: 1,
|
|
1631
|
-
minWidth: 0,
|
|
1632
|
-
height: "100%",
|
|
1633
|
-
display: "flex",
|
|
1634
|
-
alignItems: "center",
|
|
1635
|
-
padding: 0,
|
|
1636
|
-
border: "none",
|
|
1637
|
-
backgroundColor: "transparent",
|
|
1638
|
-
textAlign: "left",
|
|
1639
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
1640
|
-
appearance: "none"
|
|
1641
|
-
};
|
|
1642
|
-
const fileSelectionTextStyle = {
|
|
1643
|
-
flex: 1,
|
|
1644
|
-
display: "flex",
|
|
1645
|
-
alignItems: "center",
|
|
1646
|
-
height: "100%",
|
|
1647
|
-
minWidth: 0,
|
|
1648
|
-
overflow: "hidden",
|
|
1649
|
-
textOverflow: "ellipsis",
|
|
1650
|
-
whiteSpace: "nowrap",
|
|
1651
|
-
color: selectedFileNames.length === 0 ? inputPlaceholderColor : theme.colors.text,
|
|
1652
|
-
fontSize: controlMetrics.fontSize,
|
|
1653
|
-
lineHeight: controlMetrics.lineHeight,
|
|
1654
|
-
padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px`
|
|
1655
|
-
};
|
|
1656
|
-
const emailFieldStyle = {
|
|
1657
|
-
width: "100%",
|
|
1658
|
-
boxSizing: "border-box",
|
|
1659
|
-
height: controlMetrics.height,
|
|
1660
|
-
display: "flex",
|
|
1661
|
-
alignItems: "center",
|
|
1662
|
-
gap: 0,
|
|
1663
|
-
overflow: "hidden",
|
|
1664
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
1665
|
-
border: "none",
|
|
1666
|
-
backgroundColor: theme.colors.surface,
|
|
1667
|
-
color: theme.colors.text,
|
|
1668
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
1669
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
1670
|
-
padding: 0,
|
|
1671
|
-
outline: "none",
|
|
1672
|
-
boxShadow: adornedFieldShadow,
|
|
1673
|
-
transition: "box-shadow 160ms ease, background-color 160ms ease",
|
|
1674
|
-
textAlign: "left",
|
|
1675
|
-
...style
|
|
1676
|
-
};
|
|
1677
|
-
const emailAdornmentStyle = {
|
|
1678
|
-
flexShrink: 0,
|
|
1679
|
-
display: "inline-flex",
|
|
1680
|
-
alignItems: "center",
|
|
1681
|
-
justifyContent: "center",
|
|
1682
|
-
alignSelf: "stretch",
|
|
1683
|
-
boxSizing: "border-box",
|
|
1684
|
-
width: emailAdornmentWidth,
|
|
1685
|
-
backgroundColor: "transparent",
|
|
1686
|
-
color: inputBorderColor
|
|
1687
|
-
};
|
|
1688
|
-
const emailInputStyle = {
|
|
1689
|
-
flex: 1,
|
|
1690
|
-
minWidth: 0,
|
|
1691
|
-
height: "100%",
|
|
1692
|
-
boxSizing: "border-box",
|
|
1693
|
-
border: "none",
|
|
1694
|
-
backgroundColor: "transparent",
|
|
1695
|
-
color: theme.colors.text,
|
|
1696
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
1697
|
-
padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px`,
|
|
1698
|
-
outline: "none",
|
|
1699
|
-
fontSize: controlMetrics.fontSize,
|
|
1700
|
-
lineHeight: controlMetrics.lineHeight
|
|
1701
|
-
};
|
|
1702
|
-
const passwordFieldStyle = {
|
|
1703
|
-
...emailFieldStyle
|
|
1704
|
-
};
|
|
1705
|
-
const passwordToggleStyle = {
|
|
1706
|
-
border: "none",
|
|
1707
|
-
...emailAdornmentStyle,
|
|
1708
|
-
width: passwordAdornmentWidth,
|
|
1709
|
-
padding: 0,
|
|
1710
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
1711
|
-
appearance: "none"
|
|
1712
|
-
};
|
|
1713
|
-
const passwordInputStyle = {
|
|
1714
|
-
...emailInputStyle
|
|
1715
|
-
};
|
|
1298
|
+
const fieldBorderColor = error ? "var(--theme-negative)" : "var(--theme-textLight)";
|
|
1299
|
+
const fieldBaseClassName = cx(
|
|
1300
|
+
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
1301
|
+
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
1302
|
+
"duration-150 placeholder:text-[var(--ui-kit-placeholder)]",
|
|
1303
|
+
FIELD_HEIGHT_CLASSNAMES[controlSize],
|
|
1304
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1305
|
+
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1306
|
+
disabled ? "cursor-not-allowed opacity-70" : "cursor-text"
|
|
1307
|
+
);
|
|
1308
|
+
const adornedFieldClassName = cx(
|
|
1309
|
+
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
1310
|
+
"bg-[var(--theme-surface)] text-[var(--theme-text)] text-left",
|
|
1311
|
+
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
1312
|
+
FIELD_HEIGHT_CLASSNAMES[controlSize],
|
|
1313
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1314
|
+
disabled ? "opacity-70" : null
|
|
1315
|
+
);
|
|
1316
|
+
const adornedFieldBoxShadow = getInsetBorderShadow(fieldBorderColor);
|
|
1317
|
+
const adornedInputClassName = cx(
|
|
1318
|
+
"h-full min-w-0 flex-1 border-0 bg-transparent text-[var(--theme-text)] outline-none",
|
|
1319
|
+
"placeholder:text-[var(--ui-kit-placeholder)]",
|
|
1320
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1321
|
+
disabled ? "cursor-not-allowed" : "cursor-text"
|
|
1322
|
+
);
|
|
1323
|
+
const adornmentColorClassName = error ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]";
|
|
1716
1324
|
const openFilePicker = () => {
|
|
1717
1325
|
var _a;
|
|
1718
1326
|
if (disabled) {
|
|
@@ -1743,82 +1351,201 @@ function Input({
|
|
|
1743
1351
|
setSelectedFileNames(Array.from((_a = event.target.files) != null ? _a : [], (file) => file.name));
|
|
1744
1352
|
onChange == null ? void 0 : onChange(event);
|
|
1745
1353
|
},
|
|
1746
|
-
|
|
1354
|
+
className: "hidden"
|
|
1747
1355
|
}
|
|
1748
1356
|
),
|
|
1749
|
-
/* @__PURE__ */ jsxs7(
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
disabled,
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
"
|
|
1772
|
-
|
|
1773
|
-
d: "M7.25 6.25V5.25A1.5 1.5 0 0 1 8.75 3.75h2.5a1.5 1.5 0 0 1 1.5 1.5v1",
|
|
1774
|
-
stroke: "currentColor",
|
|
1775
|
-
strokeWidth: "1.6",
|
|
1776
|
-
strokeLinecap: "round",
|
|
1777
|
-
strokeLinejoin: "round"
|
|
1778
|
-
}
|
|
1779
|
-
),
|
|
1780
|
-
/* @__PURE__ */ jsx6(
|
|
1781
|
-
"path",
|
|
1782
|
-
{
|
|
1783
|
-
d: "M7.75 8.25v5.5",
|
|
1784
|
-
stroke: "currentColor",
|
|
1785
|
-
strokeWidth: "1.6",
|
|
1786
|
-
strokeLinecap: "round"
|
|
1787
|
-
}
|
|
1788
|
-
),
|
|
1789
|
-
/* @__PURE__ */ jsx6(
|
|
1790
|
-
"path",
|
|
1791
|
-
{
|
|
1792
|
-
d: "M10 8.25v5.5",
|
|
1793
|
-
stroke: "currentColor",
|
|
1794
|
-
strokeWidth: "1.6",
|
|
1795
|
-
strokeLinecap: "round"
|
|
1796
|
-
}
|
|
1357
|
+
/* @__PURE__ */ jsxs7(
|
|
1358
|
+
"div",
|
|
1359
|
+
{
|
|
1360
|
+
className: cx(
|
|
1361
|
+
adornedFieldClassName,
|
|
1362
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1363
|
+
className
|
|
1364
|
+
),
|
|
1365
|
+
style: { boxShadow: adornedFieldBoxShadow, ...style },
|
|
1366
|
+
children: [
|
|
1367
|
+
/* @__PURE__ */ jsxs7(
|
|
1368
|
+
"button",
|
|
1369
|
+
{
|
|
1370
|
+
type: "button",
|
|
1371
|
+
disabled,
|
|
1372
|
+
"aria-controls": inputId,
|
|
1373
|
+
"aria-label": hasSelectedFiles ? rest.multiple ? "Remove selected files" : "Remove selected file" : rest.multiple ? "Select files" : "Select file",
|
|
1374
|
+
onClick: hasSelectedFiles ? clearSelectedFiles : openFilePicker,
|
|
1375
|
+
className: cx(
|
|
1376
|
+
"inline-flex shrink-0 self-stretch whitespace-nowrap border-0 bg-transparent",
|
|
1377
|
+
"items-center text-[var(--theme-text)] appearance-none",
|
|
1378
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1379
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1380
|
+
showUploadLabel ? "justify-start font-bold" : "justify-center"
|
|
1797
1381
|
),
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1382
|
+
style: {
|
|
1383
|
+
gap: showUploadLabel ? leadingContentGap : 0,
|
|
1384
|
+
width: showUploadLabel ? void 0 : fileTriggerWidth,
|
|
1385
|
+
padding: showUploadLabel ? `0 ${controlMetrics.buttonPaddingX}px 0 ${Math.max(8, Math.round(controlMetrics.paddingX / 2))}px` : 0
|
|
1386
|
+
},
|
|
1387
|
+
children: [
|
|
1388
|
+
/* @__PURE__ */ jsx6(
|
|
1389
|
+
"span",
|
|
1390
|
+
{
|
|
1391
|
+
className: cx(
|
|
1392
|
+
"inline-flex shrink-0 items-center justify-center",
|
|
1393
|
+
adornmentColorClassName
|
|
1394
|
+
),
|
|
1395
|
+
"aria-hidden": "true",
|
|
1396
|
+
children: /* @__PURE__ */ jsx6("svg", { width: fileIconSize, height: fileIconSize, viewBox: "0 0 20 20", fill: "none", children: hasSelectedFiles ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1397
|
+
/* @__PURE__ */ jsx6(
|
|
1398
|
+
"path",
|
|
1399
|
+
{
|
|
1400
|
+
d: "M5.5 6.25h9",
|
|
1401
|
+
stroke: "currentColor",
|
|
1402
|
+
strokeWidth: "1.6",
|
|
1403
|
+
strokeLinecap: "round"
|
|
1404
|
+
}
|
|
1405
|
+
),
|
|
1406
|
+
/* @__PURE__ */ jsx6(
|
|
1407
|
+
"path",
|
|
1408
|
+
{
|
|
1409
|
+
d: "M7.25 6.25V5.25A1.5 1.5 0 0 1 8.75 3.75h2.5a1.5 1.5 0 0 1 1.5 1.5v1",
|
|
1410
|
+
stroke: "currentColor",
|
|
1411
|
+
strokeWidth: "1.6",
|
|
1412
|
+
strokeLinecap: "round",
|
|
1413
|
+
strokeLinejoin: "round"
|
|
1414
|
+
}
|
|
1415
|
+
),
|
|
1416
|
+
/* @__PURE__ */ jsx6(
|
|
1417
|
+
"path",
|
|
1418
|
+
{
|
|
1419
|
+
d: "M7.75 8.25v5.5",
|
|
1420
|
+
stroke: "currentColor",
|
|
1421
|
+
strokeWidth: "1.6",
|
|
1422
|
+
strokeLinecap: "round"
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ jsx6(
|
|
1426
|
+
"path",
|
|
1427
|
+
{
|
|
1428
|
+
d: "M10 8.25v5.5",
|
|
1429
|
+
stroke: "currentColor",
|
|
1430
|
+
strokeWidth: "1.6",
|
|
1431
|
+
strokeLinecap: "round"
|
|
1432
|
+
}
|
|
1433
|
+
),
|
|
1434
|
+
/* @__PURE__ */ jsx6(
|
|
1435
|
+
"path",
|
|
1436
|
+
{
|
|
1437
|
+
d: "M12.25 8.25v5.5",
|
|
1438
|
+
stroke: "currentColor",
|
|
1439
|
+
strokeWidth: "1.6",
|
|
1440
|
+
strokeLinecap: "round"
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
/* @__PURE__ */ jsx6(
|
|
1444
|
+
"path",
|
|
1445
|
+
{
|
|
1446
|
+
d: "M6.75 6.25l.5 8a1.5 1.5 0 0 0 1.497 1.406h2.506A1.5 1.5 0 0 0 12.75 14.25l.5-8",
|
|
1447
|
+
stroke: "currentColor",
|
|
1448
|
+
strokeWidth: "1.6",
|
|
1449
|
+
strokeLinecap: "round",
|
|
1450
|
+
strokeLinejoin: "round"
|
|
1451
|
+
}
|
|
1452
|
+
)
|
|
1453
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1454
|
+
/* @__PURE__ */ jsx6(
|
|
1455
|
+
"path",
|
|
1456
|
+
{
|
|
1457
|
+
d: "M6.25 2.5h5.652l4.348 4.348V15A2.5 2.5 0 0 1 13.75 17.5h-7.5A2.5 2.5 0 0 1 3.75 15V5A2.5 2.5 0 0 1 6.25 2.5Z",
|
|
1458
|
+
stroke: "currentColor",
|
|
1459
|
+
strokeWidth: "1.6",
|
|
1460
|
+
strokeLinecap: "round",
|
|
1461
|
+
strokeLinejoin: "round"
|
|
1462
|
+
}
|
|
1463
|
+
),
|
|
1464
|
+
/* @__PURE__ */ jsx6(
|
|
1465
|
+
"path",
|
|
1466
|
+
{
|
|
1467
|
+
d: "M11.875 2.75V6.25H15.375",
|
|
1468
|
+
stroke: "currentColor",
|
|
1469
|
+
strokeWidth: "1.6",
|
|
1470
|
+
strokeLinecap: "round",
|
|
1471
|
+
strokeLinejoin: "round"
|
|
1472
|
+
}
|
|
1473
|
+
),
|
|
1474
|
+
/* @__PURE__ */ jsx6(
|
|
1475
|
+
"path",
|
|
1476
|
+
{
|
|
1477
|
+
d: "M7.5 10h5",
|
|
1478
|
+
stroke: "currentColor",
|
|
1479
|
+
strokeWidth: "1.6",
|
|
1480
|
+
strokeLinecap: "round"
|
|
1481
|
+
}
|
|
1482
|
+
),
|
|
1483
|
+
/* @__PURE__ */ jsx6(
|
|
1484
|
+
"path",
|
|
1485
|
+
{
|
|
1486
|
+
d: "M7.5 13h5",
|
|
1487
|
+
stroke: "currentColor",
|
|
1488
|
+
strokeWidth: "1.6",
|
|
1489
|
+
strokeLinecap: "round"
|
|
1490
|
+
}
|
|
1491
|
+
)
|
|
1492
|
+
] }) })
|
|
1493
|
+
}
|
|
1494
|
+
),
|
|
1495
|
+
showUploadLabel ? fileButtonLabel : null
|
|
1496
|
+
]
|
|
1497
|
+
}
|
|
1498
|
+
),
|
|
1499
|
+
/* @__PURE__ */ jsx6(
|
|
1500
|
+
"button",
|
|
1501
|
+
{
|
|
1502
|
+
type: "button",
|
|
1503
|
+
disabled,
|
|
1504
|
+
"aria-controls": inputId,
|
|
1505
|
+
"aria-label": rest.multiple ? "Select files" : "Select file",
|
|
1506
|
+
onClick: openFilePicker,
|
|
1507
|
+
className: cx(
|
|
1508
|
+
"flex h-full min-w-0 flex-1 items-center border-0 bg-transparent p-0",
|
|
1509
|
+
"text-left appearance-none",
|
|
1510
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1806
1511
|
),
|
|
1807
|
-
/* @__PURE__ */ jsx6(
|
|
1808
|
-
"
|
|
1512
|
+
children: fileSelectionText ? /* @__PURE__ */ jsx6(
|
|
1513
|
+
"span",
|
|
1809
1514
|
{
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1515
|
+
className: cx(
|
|
1516
|
+
"flex h-full min-w-0 flex-1 items-center overflow-hidden text-ellipsis whitespace-nowrap",
|
|
1517
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1518
|
+
hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--ui-kit-placeholder)]"
|
|
1519
|
+
),
|
|
1520
|
+
style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` },
|
|
1521
|
+
children: fileSelectionText
|
|
1815
1522
|
}
|
|
1816
|
-
)
|
|
1817
|
-
|
|
1523
|
+
) : null
|
|
1524
|
+
}
|
|
1525
|
+
)
|
|
1526
|
+
]
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
] }) : isEmailField ? /* @__PURE__ */ jsxs7(
|
|
1530
|
+
"div",
|
|
1531
|
+
{
|
|
1532
|
+
className: cx(adornedFieldClassName, className),
|
|
1533
|
+
style: { boxShadow: adornedFieldBoxShadow, ...style },
|
|
1534
|
+
children: [
|
|
1535
|
+
/* @__PURE__ */ jsx6(
|
|
1536
|
+
"span",
|
|
1537
|
+
{
|
|
1538
|
+
className: cx(
|
|
1539
|
+
"inline-flex shrink-0 self-stretch items-center justify-center bg-transparent",
|
|
1540
|
+
adornmentColorClassName
|
|
1541
|
+
),
|
|
1542
|
+
style: { width: emailAdornmentWidth },
|
|
1543
|
+
"aria-hidden": "true",
|
|
1544
|
+
children: /* @__PURE__ */ jsxs7("svg", { width: fileIconSize, height: fileIconSize, viewBox: "0 0 20 20", fill: "none", children: [
|
|
1818
1545
|
/* @__PURE__ */ jsx6(
|
|
1819
1546
|
"path",
|
|
1820
1547
|
{
|
|
1821
|
-
d: "
|
|
1548
|
+
d: "M3.75 6.25A1.875 1.875 0 0 1 5.625 4.375h8.75A1.875 1.875 0 0 1 16.25 6.25v7.5a1.875 1.875 0 0 1-1.875 1.875h-8.75A1.875 1.875 0 0 1 3.75 13.75v-7.5Z",
|
|
1822
1549
|
stroke: "currentColor",
|
|
1823
1550
|
strokeWidth: "1.6",
|
|
1824
1551
|
strokeLinecap: "round",
|
|
@@ -1828,165 +1555,160 @@ function Input({
|
|
|
1828
1555
|
/* @__PURE__ */ jsx6(
|
|
1829
1556
|
"path",
|
|
1830
1557
|
{
|
|
1831
|
-
d: "
|
|
1558
|
+
d: "M4.375 6.25 10 10.625l5.625-4.375",
|
|
1832
1559
|
stroke: "currentColor",
|
|
1833
1560
|
strokeWidth: "1.6",
|
|
1834
1561
|
strokeLinecap: "round",
|
|
1835
1562
|
strokeLinejoin: "round"
|
|
1836
1563
|
}
|
|
1837
|
-
),
|
|
1838
|
-
/* @__PURE__ */ jsx6(
|
|
1839
|
-
"path",
|
|
1840
|
-
{
|
|
1841
|
-
d: "M7.5 10h5",
|
|
1842
|
-
stroke: "currentColor",
|
|
1843
|
-
strokeWidth: "1.6",
|
|
1844
|
-
strokeLinecap: "round"
|
|
1845
|
-
}
|
|
1846
|
-
),
|
|
1847
|
-
/* @__PURE__ */ jsx6(
|
|
1848
|
-
"path",
|
|
1849
|
-
{
|
|
1850
|
-
d: "M7.5 13h5",
|
|
1851
|
-
stroke: "currentColor",
|
|
1852
|
-
strokeWidth: "1.6",
|
|
1853
|
-
strokeLinecap: "round"
|
|
1854
|
-
}
|
|
1855
1564
|
)
|
|
1856
|
-
] })
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
/* @__PURE__ */ jsx6(
|
|
1862
|
-
"button",
|
|
1863
|
-
{
|
|
1864
|
-
type: "button",
|
|
1865
|
-
disabled,
|
|
1866
|
-
"aria-controls": inputId,
|
|
1867
|
-
"aria-label": rest.multiple ? "Select files" : "Select file",
|
|
1868
|
-
onClick: openFilePicker,
|
|
1869
|
-
style: fileSelectionStyle,
|
|
1870
|
-
children: fileSelectionText ? /* @__PURE__ */ jsx6("span", { style: fileSelectionTextStyle, children: fileSelectionText }) : null
|
|
1871
|
-
}
|
|
1872
|
-
)
|
|
1873
|
-
] })
|
|
1874
|
-
] }) : isEmailField ? /* @__PURE__ */ jsxs7("div", { style: emailFieldStyle, children: [
|
|
1875
|
-
/* @__PURE__ */ jsx6("span", { style: emailAdornmentStyle, "aria-hidden": "true", children: /* @__PURE__ */ jsxs7("svg", { width: fileIconSize, height: fileIconSize, viewBox: "0 0 20 20", fill: "none", children: [
|
|
1876
|
-
/* @__PURE__ */ jsx6(
|
|
1877
|
-
"path",
|
|
1878
|
-
{
|
|
1879
|
-
d: "M3.75 6.25A1.875 1.875 0 0 1 5.625 4.375h8.75A1.875 1.875 0 0 1 16.25 6.25v7.5a1.875 1.875 0 0 1-1.875 1.875h-8.75A1.875 1.875 0 0 1 3.75 13.75v-7.5Z",
|
|
1880
|
-
stroke: "currentColor",
|
|
1881
|
-
strokeWidth: "1.6",
|
|
1882
|
-
strokeLinecap: "round",
|
|
1883
|
-
strokeLinejoin: "round"
|
|
1884
|
-
}
|
|
1885
|
-
),
|
|
1886
|
-
/* @__PURE__ */ jsx6(
|
|
1887
|
-
"path",
|
|
1888
|
-
{
|
|
1889
|
-
d: "M4.375 6.25 10 10.625l5.625-4.375",
|
|
1890
|
-
stroke: "currentColor",
|
|
1891
|
-
strokeWidth: "1.6",
|
|
1892
|
-
strokeLinecap: "round",
|
|
1893
|
-
strokeLinejoin: "round"
|
|
1894
|
-
}
|
|
1895
|
-
)
|
|
1896
|
-
] }) }),
|
|
1897
|
-
/* @__PURE__ */ jsx6("input", { ...rest, id: inputId, placeholder, type: resolvedType, disabled, onChange, style: emailInputStyle })
|
|
1898
|
-
] }) : canTogglePasswordVisibility ? /* @__PURE__ */ jsxs7("div", { style: passwordFieldStyle, children: [
|
|
1899
|
-
/* @__PURE__ */ jsx6(
|
|
1900
|
-
"button",
|
|
1901
|
-
{
|
|
1902
|
-
type: "button",
|
|
1903
|
-
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
1904
|
-
"aria-pressed": isPasswordVisible,
|
|
1905
|
-
disabled,
|
|
1906
|
-
onMouseDown: (event) => {
|
|
1907
|
-
event.preventDefault();
|
|
1908
|
-
},
|
|
1909
|
-
onClick: () => {
|
|
1910
|
-
setIsPasswordVisible((currentValue) => !currentValue);
|
|
1911
|
-
},
|
|
1912
|
-
style: passwordToggleStyle,
|
|
1913
|
-
children: isPasswordVisible ? /* @__PURE__ */ jsxs7(
|
|
1914
|
-
"svg",
|
|
1565
|
+
] })
|
|
1566
|
+
}
|
|
1567
|
+
),
|
|
1568
|
+
/* @__PURE__ */ jsx6(
|
|
1569
|
+
"input",
|
|
1915
1570
|
{
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
{
|
|
1925
|
-
d: "M6.75 8V6.75A3.25 3.25 0 0 1 12.262 4.415",
|
|
1926
|
-
stroke: "currentColor",
|
|
1927
|
-
strokeWidth: "1.8",
|
|
1928
|
-
strokeLinecap: "round",
|
|
1929
|
-
strokeLinejoin: "round"
|
|
1930
|
-
}
|
|
1931
|
-
),
|
|
1932
|
-
/* @__PURE__ */ jsx6(
|
|
1933
|
-
"path",
|
|
1934
|
-
{
|
|
1935
|
-
d: "M6 8.25h8a1.75 1.75 0 0 1 1.75 1.75V14A1.75 1.75 0 0 1 14 15.75H6A1.75 1.75 0 0 1 4.25 14V10A1.75 1.75 0 0 1 6 8.25Z",
|
|
1936
|
-
stroke: "currentColor",
|
|
1937
|
-
strokeWidth: "1.8",
|
|
1938
|
-
strokeLinecap: "round",
|
|
1939
|
-
strokeLinejoin: "round"
|
|
1940
|
-
}
|
|
1941
|
-
),
|
|
1942
|
-
/* @__PURE__ */ jsx6(
|
|
1943
|
-
"path",
|
|
1944
|
-
{
|
|
1945
|
-
d: "M10 11.25v1.5",
|
|
1946
|
-
stroke: "currentColor",
|
|
1947
|
-
strokeWidth: "1.8",
|
|
1948
|
-
strokeLinecap: "round"
|
|
1949
|
-
}
|
|
1950
|
-
)
|
|
1951
|
-
]
|
|
1571
|
+
...rest,
|
|
1572
|
+
id: inputId,
|
|
1573
|
+
placeholder,
|
|
1574
|
+
type: resolvedType,
|
|
1575
|
+
disabled,
|
|
1576
|
+
onChange,
|
|
1577
|
+
className: cx(adornedInputClassName, className),
|
|
1578
|
+
style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` }
|
|
1952
1579
|
}
|
|
1953
|
-
)
|
|
1954
|
-
|
|
1580
|
+
)
|
|
1581
|
+
]
|
|
1582
|
+
}
|
|
1583
|
+
) : canTogglePasswordVisibility ? /* @__PURE__ */ jsxs7(
|
|
1584
|
+
"div",
|
|
1585
|
+
{
|
|
1586
|
+
className: cx(adornedFieldClassName, className),
|
|
1587
|
+
style: { boxShadow: adornedFieldBoxShadow, ...style },
|
|
1588
|
+
children: [
|
|
1589
|
+
/* @__PURE__ */ jsx6(
|
|
1590
|
+
"button",
|
|
1955
1591
|
{
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1592
|
+
type: "button",
|
|
1593
|
+
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
1594
|
+
"aria-pressed": isPasswordVisible,
|
|
1595
|
+
disabled,
|
|
1596
|
+
onMouseDown: (event) => {
|
|
1597
|
+
event.preventDefault();
|
|
1598
|
+
},
|
|
1599
|
+
onClick: () => {
|
|
1600
|
+
setIsPasswordVisible((currentValue) => !currentValue);
|
|
1601
|
+
},
|
|
1602
|
+
className: cx(
|
|
1603
|
+
"inline-flex shrink-0 self-stretch items-center justify-center border-0",
|
|
1604
|
+
"bg-transparent p-0 appearance-none",
|
|
1605
|
+
adornmentColorClassName,
|
|
1606
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1607
|
+
),
|
|
1608
|
+
style: { width: passwordAdornmentWidth },
|
|
1609
|
+
children: isPasswordVisible ? /* @__PURE__ */ jsxs7(
|
|
1610
|
+
"svg",
|
|
1611
|
+
{
|
|
1612
|
+
width: passwordLockIconSize,
|
|
1613
|
+
height: passwordLockIconSize,
|
|
1614
|
+
viewBox: "0 0 20 20",
|
|
1615
|
+
fill: "none",
|
|
1616
|
+
"aria-hidden": "true",
|
|
1617
|
+
children: [
|
|
1618
|
+
/* @__PURE__ */ jsx6(
|
|
1619
|
+
"path",
|
|
1620
|
+
{
|
|
1621
|
+
d: "M6.75 8V6.75A3.25 3.25 0 0 1 12.262 4.415",
|
|
1622
|
+
stroke: "currentColor",
|
|
1623
|
+
strokeWidth: "1.8",
|
|
1624
|
+
strokeLinecap: "round",
|
|
1625
|
+
strokeLinejoin: "round"
|
|
1626
|
+
}
|
|
1627
|
+
),
|
|
1628
|
+
/* @__PURE__ */ jsx6(
|
|
1629
|
+
"path",
|
|
1630
|
+
{
|
|
1631
|
+
d: "M6 8.25h8a1.75 1.75 0 0 1 1.75 1.75V14A1.75 1.75 0 0 1 14 15.75H6A1.75 1.75 0 0 1 4.25 14V10A1.75 1.75 0 0 1 6 8.25Z",
|
|
1632
|
+
stroke: "currentColor",
|
|
1633
|
+
strokeWidth: "1.8",
|
|
1634
|
+
strokeLinecap: "round",
|
|
1635
|
+
strokeLinejoin: "round"
|
|
1636
|
+
}
|
|
1637
|
+
),
|
|
1638
|
+
/* @__PURE__ */ jsx6(
|
|
1639
|
+
"path",
|
|
1640
|
+
{
|
|
1641
|
+
d: "M10 11.25v1.5",
|
|
1642
|
+
stroke: "currentColor",
|
|
1643
|
+
strokeWidth: "1.8",
|
|
1644
|
+
strokeLinecap: "round"
|
|
1645
|
+
}
|
|
1646
|
+
)
|
|
1647
|
+
]
|
|
1648
|
+
}
|
|
1649
|
+
) : /* @__PURE__ */ jsxs7(
|
|
1650
|
+
"svg",
|
|
1651
|
+
{
|
|
1652
|
+
width: passwordLockIconSize,
|
|
1653
|
+
height: passwordLockIconSize,
|
|
1654
|
+
viewBox: "0 0 20 20",
|
|
1655
|
+
fill: "none",
|
|
1656
|
+
"aria-hidden": "true",
|
|
1657
|
+
children: [
|
|
1658
|
+
/* @__PURE__ */ jsx6(
|
|
1659
|
+
"path",
|
|
1660
|
+
{
|
|
1661
|
+
d: "M6.75 8V6.75A3.25 3.25 0 1 1 13.25 6.75V8",
|
|
1662
|
+
stroke: "currentColor",
|
|
1663
|
+
strokeWidth: "1.8",
|
|
1664
|
+
strokeLinecap: "round",
|
|
1665
|
+
strokeLinejoin: "round"
|
|
1666
|
+
}
|
|
1667
|
+
),
|
|
1668
|
+
/* @__PURE__ */ jsx6(
|
|
1669
|
+
"path",
|
|
1670
|
+
{
|
|
1671
|
+
d: "M6 8.25h8a1.75 1.75 0 0 1 1.75 1.75V14A1.75 1.75 0 0 1 14 15.75H6A1.75 1.75 0 0 1 4.25 14V10A1.75 1.75 0 0 1 6 8.25Z",
|
|
1672
|
+
stroke: "currentColor",
|
|
1673
|
+
strokeWidth: "1.8",
|
|
1674
|
+
strokeLinecap: "round",
|
|
1675
|
+
strokeLinejoin: "round"
|
|
1676
|
+
}
|
|
1677
|
+
),
|
|
1678
|
+
/* @__PURE__ */ jsx6("path", { d: "M10 11.25v1.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
)
|
|
1682
|
+
}
|
|
1683
|
+
),
|
|
1684
|
+
/* @__PURE__ */ jsx6(
|
|
1685
|
+
"input",
|
|
1686
|
+
{
|
|
1687
|
+
...rest,
|
|
1688
|
+
id: inputId,
|
|
1689
|
+
placeholder,
|
|
1690
|
+
type: resolvedType,
|
|
1691
|
+
disabled,
|
|
1692
|
+
onChange,
|
|
1693
|
+
className: cx(adornedInputClassName, className),
|
|
1694
|
+
style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` }
|
|
1984
1695
|
}
|
|
1985
1696
|
)
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1697
|
+
]
|
|
1698
|
+
}
|
|
1699
|
+
) : /* @__PURE__ */ jsx6(
|
|
1700
|
+
"input",
|
|
1701
|
+
{
|
|
1702
|
+
...rest,
|
|
1703
|
+
id: inputId,
|
|
1704
|
+
placeholder,
|
|
1705
|
+
type: resolvedType,
|
|
1706
|
+
disabled,
|
|
1707
|
+
onChange,
|
|
1708
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[controlSize], className),
|
|
1709
|
+
style: { boxShadow: "var(--ui-kit-component-shadow)", ...style }
|
|
1710
|
+
}
|
|
1711
|
+
);
|
|
1990
1712
|
return /* @__PURE__ */ jsx6(
|
|
1991
1713
|
ControlFrame,
|
|
1992
1714
|
{
|
|
@@ -2050,20 +1772,35 @@ var ACCESSORY_METRICS_BY_SIZE = {
|
|
|
2050
1772
|
contentGap: 8
|
|
2051
1773
|
},
|
|
2052
1774
|
md: {
|
|
1775
|
+
buttonSize: 19,
|
|
1776
|
+
iconSize: 15,
|
|
1777
|
+
rightOffset: 9,
|
|
1778
|
+
clusterGap: 7,
|
|
1779
|
+
contentGap: 9
|
|
1780
|
+
},
|
|
1781
|
+
lg: {
|
|
2053
1782
|
buttonSize: 20,
|
|
2054
1783
|
iconSize: 16,
|
|
2055
1784
|
rightOffset: 10,
|
|
2056
1785
|
clusterGap: 8,
|
|
2057
1786
|
contentGap: 10
|
|
2058
|
-
},
|
|
2059
|
-
lg: {
|
|
2060
|
-
buttonSize: 22,
|
|
2061
|
-
iconSize: 18,
|
|
2062
|
-
rightOffset: 12,
|
|
2063
|
-
clusterGap: 8,
|
|
2064
|
-
contentGap: 12
|
|
2065
1787
|
}
|
|
2066
1788
|
};
|
|
1789
|
+
var FIELD_HEIGHT_CLASSNAMES2 = {
|
|
1790
|
+
sm: "h-[30px]",
|
|
1791
|
+
md: "h-[34px]",
|
|
1792
|
+
lg: "h-[38px]"
|
|
1793
|
+
};
|
|
1794
|
+
var FIELD_TEXT_CLASSNAMES2 = {
|
|
1795
|
+
sm: "text-[13px] leading-4",
|
|
1796
|
+
md: "text-sm leading-[18px]",
|
|
1797
|
+
lg: "text-[15px] leading-[18px]"
|
|
1798
|
+
};
|
|
1799
|
+
var FIELD_PADDING_X_CLASSNAMES2 = {
|
|
1800
|
+
sm: "px-3",
|
|
1801
|
+
md: "px-[14px]",
|
|
1802
|
+
lg: "px-4"
|
|
1803
|
+
};
|
|
2067
1804
|
function padNumber(value, length = 2) {
|
|
2068
1805
|
return String(value).padStart(length, "0");
|
|
2069
1806
|
}
|
|
@@ -2247,13 +1984,13 @@ function DatePicker({
|
|
|
2247
1984
|
...rest
|
|
2248
1985
|
}) {
|
|
2249
1986
|
var _a;
|
|
2250
|
-
|
|
1987
|
+
useUiKitTheme();
|
|
2251
1988
|
const controlMetrics = getControlMetrics(controlSize);
|
|
2252
1989
|
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[controlSize];
|
|
2253
1990
|
const generatedIdRef = useRef3();
|
|
2254
1991
|
const visibleInputRef = useRef3(null);
|
|
2255
1992
|
const nativeInputRef = useRef3(null);
|
|
2256
|
-
const [internalError, setInternalError] =
|
|
1993
|
+
const [internalError, setInternalError] = useState4();
|
|
2257
1994
|
const resolvedFormat = (format == null ? void 0 : format.trim()) ? format : DEFAULT_FORMAT_BY_MODE[mode];
|
|
2258
1995
|
const isControlled = value !== void 0;
|
|
2259
1996
|
const nativePickerType = mode === "datetime" ? "datetime-local" : "date";
|
|
@@ -2265,19 +2002,19 @@ function DatePicker({
|
|
|
2265
2002
|
const parsedDefaultValue = parseDateValue(defaultValue, mode, resolvedFormat);
|
|
2266
2003
|
return parsedDefaultValue ? toLocalInputValue(parsedDefaultValue, mode) : null;
|
|
2267
2004
|
}, [defaultValue, mode, resolvedFormat]);
|
|
2268
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
2005
|
+
const [uncontrolledValue, setUncontrolledValue] = useState4(normalizedDefaultValue);
|
|
2269
2006
|
const committedDate = useMemo4(() => {
|
|
2270
2007
|
const sourceValue = isControlled ? value : uncontrolledValue;
|
|
2271
2008
|
return parseDateValue(sourceValue, mode, resolvedFormat);
|
|
2272
2009
|
}, [isControlled, mode, resolvedFormat, uncontrolledValue, value]);
|
|
2273
2010
|
const committedValue = committedDate ? toLocalInputValue(committedDate, mode) : null;
|
|
2274
2011
|
const committedDisplayValue = committedDate ? formatDateValue(committedDate, resolvedFormat) : "";
|
|
2275
|
-
const [draftValue, setDraftValue] =
|
|
2276
|
-
|
|
2012
|
+
const [draftValue, setDraftValue] = useState4(committedDisplayValue);
|
|
2013
|
+
useEffect5(() => {
|
|
2277
2014
|
setDraftValue(committedDisplayValue);
|
|
2278
2015
|
setInternalError(void 0);
|
|
2279
2016
|
}, [committedDisplayValue]);
|
|
2280
|
-
|
|
2017
|
+
useEffect5(() => {
|
|
2281
2018
|
if (!isControlled) {
|
|
2282
2019
|
setUncontrolledValue((currentValue) => {
|
|
2283
2020
|
if (currentValue == null) {
|
|
@@ -2303,7 +2040,6 @@ function DatePicker({
|
|
|
2303
2040
|
const derivedError = hasConfigurationConflict ? "Current date rules do not allow any selection." : internalError;
|
|
2304
2041
|
const resolvedError = hasExternalError ? error : derivedError;
|
|
2305
2042
|
const hasAnyValue = draftValue.trim().length > 0 || Boolean(committedValue);
|
|
2306
|
-
const inputBorderColor = resolvedError ? theme.colors.negative : theme.colors.textLight;
|
|
2307
2043
|
const showPickerAdornment = showPickerButton;
|
|
2308
2044
|
const canOpenPicker = !disabled && !readOnly && !hasConfigurationConflict;
|
|
2309
2045
|
const canClear = clearable && !disabled && !readOnly && !required && hasAnyValue;
|
|
@@ -2314,6 +2050,42 @@ function DatePicker({
|
|
|
2314
2050
|
0,
|
|
2315
2051
|
accessoryMetrics.rightOffset + trailingButtonCount * accessoryMetrics.buttonSize + (trailingButtonCount - 1) * accessoryMetrics.clusterGap + accessoryMetrics.contentGap - controlMetrics.paddingX
|
|
2316
2052
|
) : 0;
|
|
2053
|
+
const fieldBorderColor = resolvedError ? "var(--theme-negative)" : "var(--theme-textLight)";
|
|
2054
|
+
const fieldBaseClassName = cx(
|
|
2055
|
+
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
2056
|
+
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2057
|
+
"duration-150 placeholder:text-[var(--ui-kit-placeholder)]",
|
|
2058
|
+
FIELD_HEIGHT_CLASSNAMES2[controlSize],
|
|
2059
|
+
FIELD_TEXT_CLASSNAMES2[controlSize],
|
|
2060
|
+
resolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
2061
|
+
disabled ? "cursor-not-allowed opacity-70" : readOnly ? "cursor-default" : "cursor-text"
|
|
2062
|
+
);
|
|
2063
|
+
const integratedFieldClassName = cx(
|
|
2064
|
+
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
2065
|
+
"bg-[var(--theme-surface)] text-[var(--theme-text)]",
|
|
2066
|
+
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
2067
|
+
FIELD_HEIGHT_CLASSNAMES2[controlSize],
|
|
2068
|
+
FIELD_TEXT_CLASSNAMES2[controlSize],
|
|
2069
|
+
disabled ? "cursor-not-allowed opacity-70" : readOnly ? "cursor-default" : "cursor-text"
|
|
2070
|
+
);
|
|
2071
|
+
const integratedFieldBoxShadow = getInsetBorderShadow(fieldBorderColor, resolvedError ? { outerShadow: "0 0 0 3px var(--ui-kit-negative-soft)" } : void 0);
|
|
2072
|
+
const integratedInputClassName = cx(
|
|
2073
|
+
"h-full w-full box-border border-0 bg-transparent text-[var(--theme-text)]",
|
|
2074
|
+
"outline-none placeholder:text-[var(--ui-kit-placeholder)]",
|
|
2075
|
+
FIELD_TEXT_CLASSNAMES2[controlSize],
|
|
2076
|
+
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2077
|
+
);
|
|
2078
|
+
const pickerAdornmentClassName = cx(
|
|
2079
|
+
"inline-flex shrink-0 self-stretch items-center justify-center border-0",
|
|
2080
|
+
"bg-transparent p-0 appearance-none",
|
|
2081
|
+
resolvedError ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]",
|
|
2082
|
+
disabled || readOnly || hasConfigurationConflict ? "cursor-not-allowed" : "cursor-pointer"
|
|
2083
|
+
);
|
|
2084
|
+
const accessoryButtonClassName = cx(
|
|
2085
|
+
"m-0 inline-flex shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 leading-none",
|
|
2086
|
+
"text-[var(--theme-textLight)]",
|
|
2087
|
+
disabled ? "cursor-not-allowed opacity-70" : readOnly ? "cursor-not-allowed" : "cursor-pointer"
|
|
2088
|
+
);
|
|
2317
2089
|
const getValidationMessage = (parsedDate) => {
|
|
2318
2090
|
if (parsedMinDate && parsedDate.getTime() < parsedMinDate.getTime()) {
|
|
2319
2091
|
return `Choose a value on or after ${formatDateValue(parsedMinDate, resolvedFormat)}.`;
|
|
@@ -2410,98 +2182,10 @@ function DatePicker({
|
|
|
2410
2182
|
(_b = visibleInputRef.current) == null ? void 0 : _b.focus();
|
|
2411
2183
|
}
|
|
2412
2184
|
};
|
|
2413
|
-
const inputStyle = {
|
|
2414
|
-
width: "100%",
|
|
2415
|
-
boxSizing: "border-box",
|
|
2416
|
-
height: controlMetrics.height,
|
|
2417
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
2418
|
-
border: `1px solid ${inputBorderColor}`,
|
|
2419
|
-
backgroundColor: theme.colors.surface,
|
|
2420
|
-
color: theme.colors.text,
|
|
2421
|
-
cursor: disabled ? "not-allowed" : readOnly ? "default" : "text",
|
|
2422
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
2423
|
-
padding: getTextInputPadding(controlSize, { trailingInset }),
|
|
2424
|
-
outline: "none",
|
|
2425
|
-
fontSize: controlMetrics.fontSize,
|
|
2426
|
-
lineHeight: controlMetrics.lineHeight,
|
|
2427
|
-
boxShadow: resolvedError ? `0 0 0 3px ${withAlpha(theme.colors.negative, 0.12)}, ${getComponentShadow(theme)}` : `${getComponentShadow(theme)}, 0 0 0 0 ${focusRing}`,
|
|
2428
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
2429
|
-
...style
|
|
2430
|
-
};
|
|
2431
|
-
const integratedFieldStyle = {
|
|
2432
|
-
width: "100%",
|
|
2433
|
-
boxSizing: "border-box",
|
|
2434
|
-
height: controlMetrics.height,
|
|
2435
|
-
display: "flex",
|
|
2436
|
-
alignItems: "center",
|
|
2437
|
-
gap: 0,
|
|
2438
|
-
overflow: "hidden",
|
|
2439
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
2440
|
-
border: `1px solid ${inputBorderColor}`,
|
|
2441
|
-
backgroundColor: theme.colors.surface,
|
|
2442
|
-
color: theme.colors.text,
|
|
2443
|
-
cursor: disabled ? "not-allowed" : readOnly ? "default" : "text",
|
|
2444
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
2445
|
-
padding: 0,
|
|
2446
|
-
outline: "none",
|
|
2447
|
-
boxShadow: resolvedError ? `0 0 0 3px ${withAlpha(theme.colors.negative, 0.12)}, ${getComponentShadow(theme)}` : `${getComponentShadow(theme)}, 0 0 0 0 ${focusRing}`,
|
|
2448
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
2449
|
-
...style
|
|
2450
|
-
};
|
|
2451
|
-
const pickerSegmentStyle = {
|
|
2452
|
-
flexShrink: 0,
|
|
2453
|
-
display: "inline-flex",
|
|
2454
|
-
alignItems: "center",
|
|
2455
|
-
justifyContent: "center",
|
|
2456
|
-
alignSelf: "stretch",
|
|
2457
|
-
boxSizing: "border-box",
|
|
2458
|
-
width: pickerAdornmentWidth,
|
|
2459
|
-
border: "none",
|
|
2460
|
-
backgroundColor: "transparent",
|
|
2461
|
-
color: inputBorderColor,
|
|
2462
|
-
cursor: disabled || readOnly || hasConfigurationConflict ? "not-allowed" : "pointer",
|
|
2463
|
-
padding: 0,
|
|
2464
|
-
appearance: "none"
|
|
2465
|
-
};
|
|
2466
|
-
const integratedInputWrapStyle = {
|
|
2467
|
-
position: "relative",
|
|
2468
|
-
flex: 1,
|
|
2469
|
-
minWidth: 0,
|
|
2470
|
-
height: "100%"
|
|
2471
|
-
};
|
|
2472
|
-
const integratedTextInputStyle = {
|
|
2473
|
-
width: "100%",
|
|
2474
|
-
height: "100%",
|
|
2475
|
-
boxSizing: "border-box",
|
|
2476
|
-
border: "none",
|
|
2477
|
-
backgroundColor: "transparent",
|
|
2478
|
-
color: theme.colors.text,
|
|
2479
|
-
cursor: disabled ? "not-allowed" : readOnly ? "default" : "text",
|
|
2480
|
-
padding: `${controlMetrics.paddingY}px ${controlMetrics.paddingX + trailingInset}px ${controlMetrics.paddingY}px ${leadingContentGap}px`,
|
|
2481
|
-
outline: "none",
|
|
2482
|
-
fontSize: controlMetrics.fontSize,
|
|
2483
|
-
lineHeight: controlMetrics.lineHeight
|
|
2484
|
-
};
|
|
2485
|
-
const accessoryButtonStyle = {
|
|
2486
|
-
width: accessoryMetrics.buttonSize,
|
|
2487
|
-
height: accessoryMetrics.buttonSize,
|
|
2488
|
-
border: "none",
|
|
2489
|
-
padding: 0,
|
|
2490
|
-
margin: 0,
|
|
2491
|
-
display: "inline-flex",
|
|
2492
|
-
alignItems: "center",
|
|
2493
|
-
justifyContent: "center",
|
|
2494
|
-
borderRadius: 999,
|
|
2495
|
-
backgroundColor: "transparent",
|
|
2496
|
-
color: theme.colors.textLight,
|
|
2497
|
-
cursor: disabled || readOnly ? "not-allowed" : "pointer",
|
|
2498
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1
|
|
2499
|
-
};
|
|
2500
2185
|
const visibleInputProps = {
|
|
2501
2186
|
...rest,
|
|
2502
2187
|
ref: visibleInputRef,
|
|
2503
2188
|
id: resolvedId,
|
|
2504
|
-
className,
|
|
2505
2189
|
type: "text",
|
|
2506
2190
|
value: draftValue,
|
|
2507
2191
|
disabled,
|
|
@@ -2563,33 +2247,14 @@ function DatePicker({
|
|
|
2563
2247
|
onChange: (event) => {
|
|
2564
2248
|
commitValue(event.target.value || null, "picker");
|
|
2565
2249
|
},
|
|
2566
|
-
|
|
2567
|
-
position: "absolute",
|
|
2568
|
-
width: 1,
|
|
2569
|
-
height: 1,
|
|
2570
|
-
padding: 0,
|
|
2571
|
-
margin: -1,
|
|
2572
|
-
overflow: "hidden",
|
|
2573
|
-
clip: "rect(0, 0, 0, 0)",
|
|
2574
|
-
whiteSpace: "nowrap",
|
|
2575
|
-
border: 0,
|
|
2576
|
-
opacity: 0,
|
|
2577
|
-
pointerEvents: "none"
|
|
2578
|
-
}
|
|
2250
|
+
className: "ui-kit-sr-only pointer-events-none opacity-0"
|
|
2579
2251
|
}
|
|
2580
2252
|
);
|
|
2581
2253
|
const clearButtonCluster = canClear ? /* @__PURE__ */ jsx7(
|
|
2582
2254
|
"div",
|
|
2583
2255
|
{
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
top: "50%",
|
|
2587
|
-
right: accessoryMetrics.rightOffset,
|
|
2588
|
-
transform: "translateY(-50%)",
|
|
2589
|
-
display: "inline-flex",
|
|
2590
|
-
alignItems: "center",
|
|
2591
|
-
gap: accessoryMetrics.clusterGap
|
|
2592
|
-
},
|
|
2256
|
+
className: "absolute inset-y-0 inline-flex items-center",
|
|
2257
|
+
style: { right: accessoryMetrics.rightOffset, gap: accessoryMetrics.clusterGap },
|
|
2593
2258
|
children: /* @__PURE__ */ jsx7(
|
|
2594
2259
|
"button",
|
|
2595
2260
|
{
|
|
@@ -2604,34 +2269,66 @@ function DatePicker({
|
|
|
2604
2269
|
commitValue(null, "clear");
|
|
2605
2270
|
(_a2 = visibleInputRef.current) == null ? void 0 : _a2.focus();
|
|
2606
2271
|
},
|
|
2607
|
-
|
|
2272
|
+
className: accessoryButtonClassName,
|
|
2273
|
+
style: { width: accessoryMetrics.buttonSize, height: accessoryMetrics.buttonSize },
|
|
2608
2274
|
children: /* @__PURE__ */ jsx7(ClearIcon, { size: accessoryMetrics.iconSize })
|
|
2609
2275
|
}
|
|
2610
2276
|
)
|
|
2611
2277
|
}
|
|
2612
2278
|
) : null;
|
|
2613
|
-
const input = showPickerAdornment ? /* @__PURE__ */ jsxs8(
|
|
2279
|
+
const input = showPickerAdornment ? /* @__PURE__ */ jsxs8(
|
|
2280
|
+
"div",
|
|
2281
|
+
{
|
|
2282
|
+
className: cx(integratedFieldClassName, className),
|
|
2283
|
+
style: {
|
|
2284
|
+
boxShadow: integratedFieldBoxShadow,
|
|
2285
|
+
...style
|
|
2286
|
+
},
|
|
2287
|
+
children: [
|
|
2288
|
+
/* @__PURE__ */ jsx7(
|
|
2289
|
+
"button",
|
|
2290
|
+
{
|
|
2291
|
+
type: "button",
|
|
2292
|
+
"aria-label": pickerButtonLabel != null ? pickerButtonLabel : mode === "datetime" ? "Open date and time picker" : "Open date picker",
|
|
2293
|
+
disabled: !canOpenPicker,
|
|
2294
|
+
onMouseDown: (event) => {
|
|
2295
|
+
event.preventDefault();
|
|
2296
|
+
},
|
|
2297
|
+
onClick: openNativePicker,
|
|
2298
|
+
className: pickerAdornmentClassName,
|
|
2299
|
+
style: { width: pickerAdornmentWidth },
|
|
2300
|
+
children: /* @__PURE__ */ jsx7(CalendarIcon, { size: accessoryMetrics.iconSize })
|
|
2301
|
+
}
|
|
2302
|
+
),
|
|
2303
|
+
/* @__PURE__ */ jsxs8("div", { className: "relative h-full min-w-0 flex-1", children: [
|
|
2304
|
+
/* @__PURE__ */ jsx7(
|
|
2305
|
+
"input",
|
|
2306
|
+
{
|
|
2307
|
+
...visibleInputProps,
|
|
2308
|
+
className: cx(integratedInputClassName, className),
|
|
2309
|
+
style: {
|
|
2310
|
+
padding: `${controlMetrics.paddingY}px ${controlMetrics.paddingX + trailingInset}px ${controlMetrics.paddingY}px ${leadingContentGap}px`
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
),
|
|
2314
|
+
nativePickerInput,
|
|
2315
|
+
clearButtonCluster
|
|
2316
|
+
] })
|
|
2317
|
+
]
|
|
2318
|
+
}
|
|
2319
|
+
) : /* @__PURE__ */ jsxs8("div", { className: "relative w-full", children: [
|
|
2614
2320
|
/* @__PURE__ */ jsx7(
|
|
2615
|
-
"
|
|
2321
|
+
"input",
|
|
2616
2322
|
{
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
style: pickerSegmentStyle,
|
|
2625
|
-
children: /* @__PURE__ */ jsx7(CalendarIcon, { size: accessoryMetrics.iconSize })
|
|
2323
|
+
...visibleInputProps,
|
|
2324
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[controlSize], className),
|
|
2325
|
+
style: {
|
|
2326
|
+
paddingRight: controlMetrics.paddingX + trailingInset,
|
|
2327
|
+
boxShadow: resolvedError ? "0 0 0 3px var(--ui-kit-negative-soft), var(--ui-kit-component-shadow)" : "var(--ui-kit-component-shadow)",
|
|
2328
|
+
...style
|
|
2329
|
+
}
|
|
2626
2330
|
}
|
|
2627
2331
|
),
|
|
2628
|
-
/* @__PURE__ */ jsxs8("div", { style: integratedInputWrapStyle, children: [
|
|
2629
|
-
/* @__PURE__ */ jsx7("input", { ...visibleInputProps, style: integratedTextInputStyle }),
|
|
2630
|
-
nativePickerInput,
|
|
2631
|
-
clearButtonCluster
|
|
2632
|
-
] })
|
|
2633
|
-
] }) : /* @__PURE__ */ jsxs8("div", { style: { position: "relative", width: "100%" }, children: [
|
|
2634
|
-
/* @__PURE__ */ jsx7("input", { ...visibleInputProps, style: inputStyle }),
|
|
2635
2332
|
nativePickerInput,
|
|
2636
2333
|
clearButtonCluster
|
|
2637
2334
|
] });
|
|
@@ -2654,28 +2351,40 @@ function Separator({
|
|
|
2654
2351
|
orientation = "vertical",
|
|
2655
2352
|
color,
|
|
2656
2353
|
size = "100%",
|
|
2354
|
+
className,
|
|
2657
2355
|
style,
|
|
2658
2356
|
...rest
|
|
2659
2357
|
}) {
|
|
2660
|
-
|
|
2358
|
+
useUiKitTheme();
|
|
2661
2359
|
const usesVerticalStretch = orientation === "vertical" && size === "100%";
|
|
2662
2360
|
const separatorStyle = {
|
|
2663
|
-
|
|
2664
|
-
alignSelf: "stretch",
|
|
2665
|
-
backgroundColor: color != null ? color : theme.colors.text,
|
|
2361
|
+
backgroundColor: color,
|
|
2666
2362
|
width: orientation === "vertical" ? 1 : size,
|
|
2667
2363
|
height: orientation === "vertical" ? usesVerticalStretch ? "auto" : size : 1,
|
|
2668
2364
|
...style
|
|
2669
2365
|
};
|
|
2670
|
-
return /* @__PURE__ */ jsx8(
|
|
2366
|
+
return /* @__PURE__ */ jsx8(
|
|
2367
|
+
"div",
|
|
2368
|
+
{
|
|
2369
|
+
...rest,
|
|
2370
|
+
role: "separator",
|
|
2371
|
+
"aria-orientation": orientation,
|
|
2372
|
+
className: cx(
|
|
2373
|
+
"shrink-0 self-stretch bg-[var(--theme-text)]",
|
|
2374
|
+
className
|
|
2375
|
+
),
|
|
2376
|
+
style: separatorStyle
|
|
2377
|
+
}
|
|
2378
|
+
);
|
|
2671
2379
|
}
|
|
2672
2380
|
|
|
2673
2381
|
// src/componentsBase/select/SelectBase.tsx
|
|
2674
2382
|
import {
|
|
2675
|
-
useEffect as
|
|
2383
|
+
useEffect as useEffect6,
|
|
2676
2384
|
useId as useId3,
|
|
2385
|
+
useMemo as useMemo5,
|
|
2677
2386
|
useRef as useRef4,
|
|
2678
|
-
useState as
|
|
2387
|
+
useState as useState5
|
|
2679
2388
|
} from "react";
|
|
2680
2389
|
|
|
2681
2390
|
// src/componentsBase/select/utils.ts
|
|
@@ -2728,10 +2437,20 @@ function filterSelectGroups(groups, query) {
|
|
|
2728
2437
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2729
2438
|
var MENU_OFFSET = 8;
|
|
2730
2439
|
var MENU_MAX_HEIGHT = 280;
|
|
2731
|
-
var
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2440
|
+
var FIELD_HEIGHT_CLASSNAMES3 = {
|
|
2441
|
+
sm: "h-[30px]",
|
|
2442
|
+
md: "h-[34px]",
|
|
2443
|
+
lg: "h-[38px]"
|
|
2444
|
+
};
|
|
2445
|
+
var FIELD_TEXT_CLASSNAMES3 = {
|
|
2446
|
+
sm: "text-[13px] leading-4",
|
|
2447
|
+
md: "text-sm leading-[18px]",
|
|
2448
|
+
lg: "text-[15px] leading-[18px]"
|
|
2449
|
+
};
|
|
2450
|
+
var OPTION_PADDING_CLASSNAMES = {
|
|
2451
|
+
sm: "px-[11px] py-2",
|
|
2452
|
+
md: "px-3 py-[9px]",
|
|
2453
|
+
lg: "px-[13px] py-[10px]"
|
|
2735
2454
|
};
|
|
2736
2455
|
function SelectBase({
|
|
2737
2456
|
label,
|
|
@@ -2771,7 +2490,7 @@ function SelectBase({
|
|
|
2771
2490
|
...rest
|
|
2772
2491
|
}) {
|
|
2773
2492
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2774
|
-
const { theme, mutedText
|
|
2493
|
+
const { theme, mutedText } = useUiKitTheme();
|
|
2775
2494
|
const componentShadow = getComponentShadow(theme);
|
|
2776
2495
|
const generatedId = useId3().replace(/:/g, "");
|
|
2777
2496
|
const resolvedId = id != null ? id : `ss-select-${generatedId}`;
|
|
@@ -2781,12 +2500,12 @@ function SelectBase({
|
|
|
2781
2500
|
const enabledOptions = flatOptions.filter((option) => !option.disabled);
|
|
2782
2501
|
const isControlled = value !== void 0;
|
|
2783
2502
|
const fallbackValues = defaultValue !== void 0 ? normalizeSelectValues(defaultValue) : isMultiSelect ? [] : placeholder != null ? [] : ((_a = enabledOptions[0]) == null ? void 0 : _a.value) ? [enabledOptions[0].value] : [];
|
|
2784
|
-
const [uncontrolledValues, setUncontrolledValues] =
|
|
2785
|
-
const [isOpen, setIsOpen] =
|
|
2786
|
-
const [uncontrolledSearchQuery, setUncontrolledSearchQuery] =
|
|
2787
|
-
const [menuPlacement, setMenuPlacement] =
|
|
2788
|
-
const [isPlacementResolved, setIsPlacementResolved] =
|
|
2789
|
-
const [highlightedValue, setHighlightedValue] =
|
|
2503
|
+
const [uncontrolledValues, setUncontrolledValues] = useState5(fallbackValues);
|
|
2504
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
2505
|
+
const [uncontrolledSearchQuery, setUncontrolledSearchQuery] = useState5("");
|
|
2506
|
+
const [menuPlacement, setMenuPlacement] = useState5("bottom");
|
|
2507
|
+
const [isPlacementResolved, setIsPlacementResolved] = useState5(false);
|
|
2508
|
+
const [highlightedValue, setHighlightedValue] = useState5((_d = (_c = fallbackValues[0]) != null ? _c : (_b = enabledOptions[0]) == null ? void 0 : _b.value) != null ? _d : "");
|
|
2790
2509
|
const shellRef = useRef4(null);
|
|
2791
2510
|
const buttonRef = useRef4(null);
|
|
2792
2511
|
const menuRef = useRef4(null);
|
|
@@ -2818,13 +2537,49 @@ function SelectBase({
|
|
|
2818
2537
|
const scrollbarThumbColor = withAlpha(theme.colors.text, 0.22);
|
|
2819
2538
|
const scrollbarThumbHoverColor = withAlpha(theme.colors.text, 0.32);
|
|
2820
2539
|
const highlightedOption = (_i = visibleOptions.find((option) => option.value === highlightedValue)) != null ? _i : null;
|
|
2821
|
-
const optionHoverBackground =
|
|
2822
|
-
const optionSelectedBackground =
|
|
2540
|
+
const optionHoverBackground = theme.colors.primary;
|
|
2541
|
+
const optionSelectedBackground = theme.colors.primary;
|
|
2823
2542
|
const canOpenMenu = allowOpenWithoutOptions || flatOptions.length > 0;
|
|
2824
2543
|
const buttonPassthroughProps = Object.fromEntries(
|
|
2825
2544
|
Object.entries(rest).filter(([key]) => key.startsWith("aria-") || key.startsWith("data-"))
|
|
2826
2545
|
);
|
|
2827
|
-
|
|
2546
|
+
const selectVariables = useMemo5(() => ({
|
|
2547
|
+
"--ui-kit-select-placeholder": placeholderTextColor,
|
|
2548
|
+
"--ui-kit-select-muted": mutedText,
|
|
2549
|
+
"--ui-kit-select-indicator-disabled": withAlpha(theme.colors.text, 0.42),
|
|
2550
|
+
"--ui-kit-select-surface-raised": theme.colors.surface,
|
|
2551
|
+
"--ui-kit-select-scrollbar-thumb": scrollbarThumbColor,
|
|
2552
|
+
"--ui-kit-select-scrollbar-thumb-hover": scrollbarThumbHoverColor,
|
|
2553
|
+
"--ui-kit-select-divider": withAlpha(theme.colors.text, 0.08),
|
|
2554
|
+
"--ui-kit-select-option-hover-bg": optionHoverBackground,
|
|
2555
|
+
"--ui-kit-select-option-selected-bg": optionSelectedBackground,
|
|
2556
|
+
"--ui-kit-select-option-disabled": withAlpha(theme.colors.text, 0.38),
|
|
2557
|
+
"--ui-kit-select-control-shadow": componentShadow
|
|
2558
|
+
}), [
|
|
2559
|
+
componentShadow,
|
|
2560
|
+
mutedText,
|
|
2561
|
+
optionHoverBackground,
|
|
2562
|
+
optionSelectedBackground,
|
|
2563
|
+
placeholderTextColor,
|
|
2564
|
+
scrollbarThumbColor,
|
|
2565
|
+
scrollbarThumbHoverColor,
|
|
2566
|
+
theme.colors.surface,
|
|
2567
|
+
theme.colors.text
|
|
2568
|
+
]);
|
|
2569
|
+
const triggerBorderColor = error ? "var(--theme-negative)" : "var(--theme-textLight)";
|
|
2570
|
+
const triggerBoxShadow = getInsetBorderShadow(triggerBorderColor, {
|
|
2571
|
+
componentShadow: "var(--ui-kit-select-control-shadow)"
|
|
2572
|
+
});
|
|
2573
|
+
const triggerClassName = cx(
|
|
2574
|
+
"m-0 box-border flex w-full min-w-0 items-center justify-between gap-3 rounded-2xl border-0 appearance-none",
|
|
2575
|
+
"bg-[var(--theme-surface)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2576
|
+
"duration-150 text-left",
|
|
2577
|
+
FIELD_HEIGHT_CLASSNAMES3[controlSize],
|
|
2578
|
+
FIELD_TEXT_CLASSNAMES3[controlSize],
|
|
2579
|
+
hasSelection ? "text-[var(--theme-text)]" : "text-[var(--ui-kit-select-placeholder)]",
|
|
2580
|
+
disabled ? "cursor-not-allowed opacity-70" : "cursor-pointer"
|
|
2581
|
+
);
|
|
2582
|
+
useEffect6(() => {
|
|
2828
2583
|
var _a2, _b2, _c2, _d2;
|
|
2829
2584
|
if (isControlled || preserveUnknownValues) {
|
|
2830
2585
|
return;
|
|
@@ -2841,7 +2596,7 @@ function SelectBase({
|
|
|
2841
2596
|
setUncontrolledValues(nextValues);
|
|
2842
2597
|
setHighlightedValue((_d2 = (_c2 = nextValues[0]) != null ? _c2 : (_b2 = enabledOptions[0]) == null ? void 0 : _b2.value) != null ? _d2 : "");
|
|
2843
2598
|
}, [defaultValue, enabledOptions, flatOptions, isControlled, isMultiSelect, preserveUnknownValues, uncontrolledValues]);
|
|
2844
|
-
|
|
2599
|
+
useEffect6(() => {
|
|
2845
2600
|
var _a2, _b2, _c2;
|
|
2846
2601
|
if (!isOpen) {
|
|
2847
2602
|
highlightSyncKeyRef.current = "";
|
|
@@ -2857,14 +2612,14 @@ function SelectBase({
|
|
|
2857
2612
|
const nextHighlightedValue = (_c2 = (_b2 = [...selectedValues].reverse().find((currentValue) => visibleEnabledValues.includes(currentValue))) != null ? _b2 : (_a2 = visibleEnabledOptions[0]) == null ? void 0 : _a2.value) != null ? _c2 : "";
|
|
2858
2613
|
setHighlightedValue(nextHighlightedValue);
|
|
2859
2614
|
}, [isOpen, selectedValuesKey, visibleEnabledValuesKey, selectedValues, visibleEnabledOptions, visibleEnabledValues]);
|
|
2860
|
-
|
|
2615
|
+
useEffect6(() => {
|
|
2861
2616
|
var _a2;
|
|
2862
2617
|
if (!isOpen || !hasFilter) {
|
|
2863
2618
|
return;
|
|
2864
2619
|
}
|
|
2865
2620
|
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
2866
2621
|
}, [hasFilter, isOpen]);
|
|
2867
|
-
|
|
2622
|
+
useEffect6(() => {
|
|
2868
2623
|
if (!isOpen) {
|
|
2869
2624
|
return;
|
|
2870
2625
|
}
|
|
@@ -2889,7 +2644,7 @@ function SelectBase({
|
|
|
2889
2644
|
window.cancelAnimationFrame(frameId);
|
|
2890
2645
|
};
|
|
2891
2646
|
}, [isOpen, visibleOptions.length]);
|
|
2892
|
-
|
|
2647
|
+
useEffect6(() => {
|
|
2893
2648
|
if (isOpen || !clearSearchOnClose || currentSearchQuery === "") {
|
|
2894
2649
|
return;
|
|
2895
2650
|
}
|
|
@@ -2898,7 +2653,7 @@ function SelectBase({
|
|
|
2898
2653
|
}
|
|
2899
2654
|
onSearchQueryChange == null ? void 0 : onSearchQueryChange("");
|
|
2900
2655
|
}, [clearSearchOnClose, currentSearchQuery, isOpen, onSearchQueryChange, searchQuery]);
|
|
2901
|
-
|
|
2656
|
+
useEffect6(() => {
|
|
2902
2657
|
if (!isOpen) {
|
|
2903
2658
|
return;
|
|
2904
2659
|
}
|
|
@@ -2914,7 +2669,7 @@ function SelectBase({
|
|
|
2914
2669
|
document.removeEventListener("pointerdown", handlePointerDown);
|
|
2915
2670
|
};
|
|
2916
2671
|
}, [isOpen]);
|
|
2917
|
-
|
|
2672
|
+
useEffect6(() => {
|
|
2918
2673
|
var _a2;
|
|
2919
2674
|
if (isControlled) {
|
|
2920
2675
|
return;
|
|
@@ -3029,20 +2784,10 @@ function SelectBase({
|
|
|
3029
2784
|
event.stopPropagation();
|
|
3030
2785
|
toggleVisibleSelection(!hasAllVisibleSelected);
|
|
3031
2786
|
},
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
margin: 0,
|
|
3037
|
-
display: "inline-flex",
|
|
3038
|
-
alignItems: "center",
|
|
3039
|
-
justifyContent: "center",
|
|
3040
|
-
flexShrink: 0,
|
|
3041
|
-
border: "none",
|
|
3042
|
-
background: "transparent",
|
|
3043
|
-
cursor: canToggleVisibleSelection ? "pointer" : "not-allowed",
|
|
3044
|
-
opacity: canToggleVisibleSelection ? 1 : 0.45
|
|
3045
|
-
},
|
|
2787
|
+
className: cx(
|
|
2788
|
+
"m-0 inline-flex h-5 w-5 shrink-0 items-center justify-center border-0 bg-transparent p-0",
|
|
2789
|
+
canToggleVisibleSelection ? "cursor-pointer opacity-100" : "cursor-not-allowed opacity-45"
|
|
2790
|
+
),
|
|
3046
2791
|
children: /* @__PURE__ */ jsx9(
|
|
3047
2792
|
CheckboxIndicator,
|
|
3048
2793
|
{
|
|
@@ -3196,7 +2941,7 @@ function SelectBase({
|
|
|
3196
2941
|
htmlFor: resolvedId,
|
|
3197
2942
|
required: rest.required,
|
|
3198
2943
|
useLabelWrapper: false,
|
|
3199
|
-
children: /* @__PURE__ */ jsxs9("div", { ref: shellRef,
|
|
2944
|
+
children: /* @__PURE__ */ jsxs9("div", { ref: shellRef, className: "relative w-full", style: selectVariables, children: [
|
|
3200
2945
|
/* @__PURE__ */ jsxs9(
|
|
3201
2946
|
"button",
|
|
3202
2947
|
{
|
|
@@ -3204,7 +2949,7 @@ function SelectBase({
|
|
|
3204
2949
|
id: resolvedId,
|
|
3205
2950
|
ref: buttonRef,
|
|
3206
2951
|
type: "button",
|
|
3207
|
-
className,
|
|
2952
|
+
className: cx(triggerClassName, className),
|
|
3208
2953
|
title: rest.title,
|
|
3209
2954
|
disabled: disabled || !canOpenMenu,
|
|
3210
2955
|
autoFocus,
|
|
@@ -3220,42 +2965,15 @@ function SelectBase({
|
|
|
3220
2965
|
onBlur: handleTriggerBlur,
|
|
3221
2966
|
onKeyDown: handleTriggerKeyDown,
|
|
3222
2967
|
style: {
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
height: controlMetrics.height,
|
|
3226
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
3227
|
-
border: `1px solid ${error ? theme.colors.negative : theme.colors.textLight}`,
|
|
3228
|
-
backgroundColor: theme.colors.surface,
|
|
3229
|
-
color: hasSelection ? theme.colors.text : placeholderTextColor,
|
|
3230
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
3231
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
3232
|
-
padding: getSelectControlPadding(controlSize),
|
|
3233
|
-
outline: "none",
|
|
3234
|
-
boxShadow: componentShadow,
|
|
3235
|
-
font: "inherit",
|
|
3236
|
-
fontSize: controlMetrics.fontSize,
|
|
3237
|
-
lineHeight: controlMetrics.lineHeight,
|
|
3238
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
3239
|
-
display: "flex",
|
|
3240
|
-
alignItems: "center",
|
|
3241
|
-
justifyContent: "space-between",
|
|
3242
|
-
gap: 12,
|
|
3243
|
-
minWidth: 0,
|
|
3244
|
-
textAlign: "left",
|
|
2968
|
+
padding: `${controlMetrics.paddingY}px ${controlMetrics.selectPaddingRight}px ${controlMetrics.paddingY}px ${controlMetrics.paddingX}px`,
|
|
2969
|
+
boxShadow: triggerBoxShadow,
|
|
3245
2970
|
...style
|
|
3246
2971
|
},
|
|
3247
2972
|
children: [
|
|
3248
2973
|
/* @__PURE__ */ jsx9(
|
|
3249
2974
|
"span",
|
|
3250
2975
|
{
|
|
3251
|
-
|
|
3252
|
-
display: "block",
|
|
3253
|
-
flex: "1 1 auto",
|
|
3254
|
-
minWidth: 0,
|
|
3255
|
-
overflow: "hidden",
|
|
3256
|
-
textOverflow: "ellipsis",
|
|
3257
|
-
whiteSpace: "nowrap"
|
|
3258
|
-
},
|
|
2976
|
+
className: "block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3259
2977
|
children: displayContent
|
|
3260
2978
|
}
|
|
3261
2979
|
),
|
|
@@ -3263,18 +2981,14 @@ function SelectBase({
|
|
|
3263
2981
|
"span",
|
|
3264
2982
|
{
|
|
3265
2983
|
"aria-hidden": "true",
|
|
2984
|
+
className: cx(
|
|
2985
|
+
"pointer-events-none absolute top-1/2 flex -translate-y-1/2 items-center justify-center",
|
|
2986
|
+
"transition-[transform,color] duration-150",
|
|
2987
|
+
disabled ? "text-[var(--ui-kit-select-indicator-disabled)]" : "text-[var(--ui-kit-select-muted)]"
|
|
2988
|
+
),
|
|
3266
2989
|
style: {
|
|
3267
|
-
position: "absolute",
|
|
3268
2990
|
right: indicatorOffset,
|
|
3269
|
-
|
|
3270
|
-
transform: `translateY(-50%) rotate(${isOpen ? 180 : 0}deg)`,
|
|
3271
|
-
transformOrigin: "center",
|
|
3272
|
-
color: disabled ? withAlpha(theme.colors.text, 0.42) : mutedText,
|
|
3273
|
-
display: "flex",
|
|
3274
|
-
alignItems: "center",
|
|
3275
|
-
justifyContent: "center",
|
|
3276
|
-
pointerEvents: "none",
|
|
3277
|
-
transition: "transform 160ms ease, color 160ms ease"
|
|
2991
|
+
transform: `translateY(-50%) rotate(${isOpen ? 180 : 0}deg)`
|
|
3278
2992
|
},
|
|
3279
2993
|
children: /* @__PURE__ */ jsx9("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx9(
|
|
3280
2994
|
"path",
|
|
@@ -3304,17 +3018,7 @@ function SelectBase({
|
|
|
3304
3018
|
onChange: handleHiddenSelectChange,
|
|
3305
3019
|
tabIndex: -1,
|
|
3306
3020
|
"aria-hidden": "true",
|
|
3307
|
-
|
|
3308
|
-
position: "absolute",
|
|
3309
|
-
width: 1,
|
|
3310
|
-
height: 1,
|
|
3311
|
-
padding: 0,
|
|
3312
|
-
margin: 0,
|
|
3313
|
-
border: 0,
|
|
3314
|
-
opacity: 0,
|
|
3315
|
-
pointerEvents: "none",
|
|
3316
|
-
clipPath: "inset(50%)"
|
|
3317
|
-
},
|
|
3021
|
+
className: "ui-kit-sr-only pointer-events-none opacity-0",
|
|
3318
3022
|
children: nativeOptions
|
|
3319
3023
|
}
|
|
3320
3024
|
),
|
|
@@ -3322,7 +3026,7 @@ function SelectBase({
|
|
|
3322
3026
|
/* @__PURE__ */ jsx9("style", { children: `
|
|
3323
3027
|
#${listboxId} {
|
|
3324
3028
|
scrollbar-width: thin;
|
|
3325
|
-
scrollbar-color:
|
|
3029
|
+
scrollbar-color: var(--ui-kit-select-scrollbar-thumb) transparent;
|
|
3326
3030
|
}
|
|
3327
3031
|
|
|
3328
3032
|
#${listboxId}::-webkit-scrollbar {
|
|
@@ -3334,19 +3038,19 @@ function SelectBase({
|
|
|
3334
3038
|
}
|
|
3335
3039
|
|
|
3336
3040
|
#${listboxId}::-webkit-scrollbar-thumb {
|
|
3337
|
-
background:
|
|
3041
|
+
background: var(--ui-kit-select-scrollbar-thumb);
|
|
3338
3042
|
border-radius: 999px;
|
|
3339
3043
|
border: 2px solid transparent;
|
|
3340
3044
|
background-clip: padding-box;
|
|
3341
3045
|
}
|
|
3342
3046
|
|
|
3343
3047
|
#${listboxId}::-webkit-scrollbar-thumb:hover {
|
|
3344
|
-
background:
|
|
3048
|
+
background: var(--ui-kit-select-scrollbar-thumb-hover);
|
|
3345
3049
|
background-clip: padding-box;
|
|
3346
3050
|
}
|
|
3347
3051
|
|
|
3348
3052
|
#${searchInputId}::placeholder {
|
|
3349
|
-
color:
|
|
3053
|
+
color: var(--ui-kit-select-placeholder);
|
|
3350
3054
|
opacity: 1;
|
|
3351
3055
|
}
|
|
3352
3056
|
` }),
|
|
@@ -3354,40 +3058,21 @@ function SelectBase({
|
|
|
3354
3058
|
"div",
|
|
3355
3059
|
{
|
|
3356
3060
|
ref: menuRef,
|
|
3061
|
+
className: "absolute left-0 right-0 z-30 flex max-h-[280px] flex-col gap-1 overflow-hidden rounded-[20px] border p-2",
|
|
3357
3062
|
style: {
|
|
3358
|
-
position: "absolute",
|
|
3359
3063
|
top: menuPlacement === "bottom" ? `calc(100% + ${MENU_OFFSET}px)` : "auto",
|
|
3360
3064
|
bottom: menuPlacement === "top" ? `calc(100% + ${MENU_OFFSET}px)` : "auto",
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
overflow: "hidden",
|
|
3366
|
-
boxSizing: "border-box",
|
|
3367
|
-
borderRadius: 20,
|
|
3368
|
-
border: `1px solid ${theme.colors.textLight}`,
|
|
3369
|
-
backgroundColor: surfaceRaised,
|
|
3370
|
-
padding: 8,
|
|
3371
|
-
boxShadow: componentShadow,
|
|
3372
|
-
backdropFilter: "blur(6px)",
|
|
3373
|
-
visibility: isPlacementResolved ? "visible" : "hidden",
|
|
3374
|
-
display: "flex",
|
|
3375
|
-
flexDirection: "column",
|
|
3376
|
-
gap: 4
|
|
3065
|
+
borderColor: "var(--theme-textLight)",
|
|
3066
|
+
backgroundColor: "var(--ui-kit-select-surface-raised)",
|
|
3067
|
+
boxShadow: "var(--ui-kit-select-control-shadow)",
|
|
3068
|
+
visibility: isPlacementResolved ? "visible" : "hidden"
|
|
3377
3069
|
},
|
|
3378
3070
|
children: [
|
|
3379
3071
|
hasFilter ? /* @__PURE__ */ jsxs9(
|
|
3380
3072
|
"div",
|
|
3381
3073
|
{
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
alignItems: "center",
|
|
3385
|
-
justifyContent: "flex-start",
|
|
3386
|
-
gap: 8,
|
|
3387
|
-
padding: "4px 4px 10px",
|
|
3388
|
-
borderBottom: `1px solid ${withAlpha(theme.colors.text, 0.08)}`,
|
|
3389
|
-
flexShrink: 0
|
|
3390
|
-
},
|
|
3074
|
+
className: "flex shrink-0 items-center justify-start gap-2 border-b px-1 pb-[10px] pt-1",
|
|
3075
|
+
style: { borderColor: "var(--ui-kit-select-divider)" },
|
|
3391
3076
|
children: [
|
|
3392
3077
|
bulkToggleControl,
|
|
3393
3078
|
/* @__PURE__ */ jsx9(
|
|
@@ -3410,20 +3095,10 @@ function SelectBase({
|
|
|
3410
3095
|
},
|
|
3411
3096
|
placeholder: searchPlaceholder,
|
|
3412
3097
|
"aria-label": searchPlaceholder,
|
|
3098
|
+
className: "w-full flex-1 rounded-[11px] border bg-[var(--theme-surface)] px-[11px] py-[7px] text-[11px] leading-[1.4] text-[var(--theme-text)] outline-none",
|
|
3413
3099
|
style: {
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
border: `1px solid ${theme.colors.textLight}`,
|
|
3417
|
-
backgroundColor: theme.colors.surface,
|
|
3418
|
-
padding: "7px 11px",
|
|
3419
|
-
borderRadius: 11,
|
|
3420
|
-
font: "inherit",
|
|
3421
|
-
fontSize: 11,
|
|
3422
|
-
lineHeight: 1.4,
|
|
3423
|
-
color: theme.colors.text,
|
|
3424
|
-
outline: "none",
|
|
3425
|
-
boxSizing: "border-box",
|
|
3426
|
-
boxShadow: componentShadow
|
|
3100
|
+
borderColor: "var(--theme-textLight)",
|
|
3101
|
+
boxShadow: "var(--ui-kit-select-control-shadow)"
|
|
3427
3102
|
}
|
|
3428
3103
|
}
|
|
3429
3104
|
)
|
|
@@ -3432,14 +3107,8 @@ function SelectBase({
|
|
|
3432
3107
|
) : isMultiSelect ? /* @__PURE__ */ jsx9(
|
|
3433
3108
|
"div",
|
|
3434
3109
|
{
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
alignItems: "center",
|
|
3438
|
-
justifyContent: "flex-start",
|
|
3439
|
-
padding: "4px 4px 10px",
|
|
3440
|
-
borderBottom: `1px solid ${withAlpha(theme.colors.text, 0.08)}`,
|
|
3441
|
-
flexShrink: 0
|
|
3442
|
-
},
|
|
3110
|
+
className: "flex shrink-0 items-center justify-start border-b px-1 pb-[10px] pt-1",
|
|
3111
|
+
style: { borderColor: "var(--ui-kit-select-divider)" },
|
|
3443
3112
|
children: bulkToggleControl
|
|
3444
3113
|
}
|
|
3445
3114
|
) : null,
|
|
@@ -3451,44 +3120,22 @@ function SelectBase({
|
|
|
3451
3120
|
"aria-labelledby": resolvedId,
|
|
3452
3121
|
"aria-multiselectable": isMultiSelect || void 0,
|
|
3453
3122
|
onScroll: onListboxScroll,
|
|
3454
|
-
|
|
3455
|
-
overflowY: "auto",
|
|
3456
|
-
overflowX: "hidden",
|
|
3457
|
-
minHeight: 0,
|
|
3458
|
-
flex: "1 1 auto"
|
|
3459
|
-
},
|
|
3123
|
+
className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden",
|
|
3460
3124
|
children: visibleGroups.length === 0 ? /* @__PURE__ */ jsx9(
|
|
3461
3125
|
"div",
|
|
3462
3126
|
{
|
|
3463
|
-
|
|
3464
|
-
padding: "14px 12px",
|
|
3465
|
-
color: mutedText,
|
|
3466
|
-
fontSize: 13,
|
|
3467
|
-
textAlign: "center"
|
|
3468
|
-
},
|
|
3127
|
+
className: "px-3 py-[14px] text-center text-[13px] text-[var(--ui-kit-select-muted)]",
|
|
3469
3128
|
children: emptyState
|
|
3470
3129
|
}
|
|
3471
3130
|
) : visibleGroups.map((group) => /* @__PURE__ */ jsxs9(
|
|
3472
3131
|
"div",
|
|
3473
3132
|
{
|
|
3474
|
-
|
|
3475
|
-
display: "flex",
|
|
3476
|
-
flexDirection: "column",
|
|
3477
|
-
gap: 4,
|
|
3478
|
-
marginTop: group.label ? 4 : 0
|
|
3479
|
-
},
|
|
3133
|
+
className: cx("flex flex-col gap-1", group.label ? "mt-1" : "mt-0"),
|
|
3480
3134
|
children: [
|
|
3481
3135
|
group.label ? /* @__PURE__ */ jsx9(
|
|
3482
3136
|
"span",
|
|
3483
3137
|
{
|
|
3484
|
-
|
|
3485
|
-
padding: "6px 8px 2px",
|
|
3486
|
-
color: mutedText,
|
|
3487
|
-
fontSize: 11,
|
|
3488
|
-
fontWeight: 800,
|
|
3489
|
-
letterSpacing: "0.08em",
|
|
3490
|
-
textTransform: "uppercase"
|
|
3491
|
-
},
|
|
3138
|
+
className: "px-2 pb-0.5 pt-1.5 text-[11px] font-extrabold uppercase tracking-[0.08em] text-[var(--ui-kit-select-muted)]",
|
|
3492
3139
|
children: group.label
|
|
3493
3140
|
}
|
|
3494
3141
|
) : null,
|
|
@@ -3520,33 +3167,22 @@ function SelectBase({
|
|
|
3520
3167
|
commitSelection(option.value);
|
|
3521
3168
|
}
|
|
3522
3169
|
},
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
color: option.disabled ? withAlpha(theme.colors.text, 0.38) : isActive ? theme.colors.onPrimary : theme.colors.text,
|
|
3535
|
-
backgroundColor: isSelected ? optionSelectedBackground : isHighlighted ? optionHoverBackground : "transparent",
|
|
3536
|
-
fontWeight: isSelected ? 700 : 400,
|
|
3537
|
-
transition: "background-color 140ms ease, color 140ms ease"
|
|
3538
|
-
},
|
|
3170
|
+
className: cx(
|
|
3171
|
+
"flex w-full min-w-0 items-center justify-between gap-3 rounded-xl box-border",
|
|
3172
|
+
"transition-[background-color,color] duration-150",
|
|
3173
|
+
OPTION_PADDING_CLASSNAMES[controlSize],
|
|
3174
|
+
option.disabled ? "cursor-not-allowed text-[var(--ui-kit-select-option-disabled)]" : "cursor-pointer",
|
|
3175
|
+
!option.disabled && isActive ? "text-[var(--theme-onPrimary)]" : null,
|
|
3176
|
+
!option.disabled && !isActive ? "text-[var(--theme-text)]" : null,
|
|
3177
|
+
isSelected ? "bg-[var(--ui-kit-select-option-selected-bg)] font-bold" : null,
|
|
3178
|
+
!isSelected && isHighlighted ? "bg-[var(--ui-kit-select-option-hover-bg)]" : null,
|
|
3179
|
+
!isSelected && !isHighlighted ? "bg-[var(--theme-surface)] font-normal" : null
|
|
3180
|
+
),
|
|
3539
3181
|
children: [
|
|
3540
3182
|
/* @__PURE__ */ jsxs9(
|
|
3541
3183
|
"span",
|
|
3542
3184
|
{
|
|
3543
|
-
|
|
3544
|
-
display: "flex",
|
|
3545
|
-
alignItems: "center",
|
|
3546
|
-
gap: 10,
|
|
3547
|
-
flex: "1 1 auto",
|
|
3548
|
-
minWidth: 0
|
|
3549
|
-
},
|
|
3185
|
+
className: "flex min-w-0 flex-1 items-center gap-2.5",
|
|
3550
3186
|
children: [
|
|
3551
3187
|
isMultiSelect ? /* @__PURE__ */ jsx9(
|
|
3552
3188
|
CheckboxIndicator,
|
|
@@ -3554,23 +3190,16 @@ function SelectBase({
|
|
|
3554
3190
|
checked: isSelected,
|
|
3555
3191
|
disabled: option.disabled,
|
|
3556
3192
|
size: 16,
|
|
3557
|
-
checkedColor: isActive ? theme
|
|
3558
|
-
iconColor: isActive ? theme
|
|
3559
|
-
uncheckedBorderColor: isActive ? theme
|
|
3193
|
+
checkedColor: isActive ? "var(--theme-onPrimary)" : "var(--theme-primary)",
|
|
3194
|
+
iconColor: isActive ? "var(--theme-primary)" : "var(--theme-onPrimary)",
|
|
3195
|
+
uncheckedBorderColor: isActive ? "var(--theme-onPrimary)" : withAlpha(theme.colors.text, 0.26),
|
|
3560
3196
|
uncheckedBackgroundColor: "transparent"
|
|
3561
3197
|
}
|
|
3562
3198
|
) : null,
|
|
3563
3199
|
/* @__PURE__ */ jsx9(
|
|
3564
3200
|
"span",
|
|
3565
3201
|
{
|
|
3566
|
-
|
|
3567
|
-
display: "block",
|
|
3568
|
-
flex: "1 1 auto",
|
|
3569
|
-
minWidth: 0,
|
|
3570
|
-
overflow: "hidden",
|
|
3571
|
-
textOverflow: "ellipsis",
|
|
3572
|
-
whiteSpace: "nowrap"
|
|
3573
|
-
},
|
|
3202
|
+
className: "block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3574
3203
|
children: option.label
|
|
3575
3204
|
}
|
|
3576
3205
|
)
|
|
@@ -3581,13 +3210,7 @@ function SelectBase({
|
|
|
3581
3210
|
"span",
|
|
3582
3211
|
{
|
|
3583
3212
|
"aria-hidden": "true",
|
|
3584
|
-
|
|
3585
|
-
display: "flex",
|
|
3586
|
-
alignItems: "center",
|
|
3587
|
-
justifyContent: "center",
|
|
3588
|
-
color: theme.colors.primary,
|
|
3589
|
-
flexShrink: 0
|
|
3590
|
-
},
|
|
3213
|
+
className: "flex shrink-0 items-center justify-center text-[var(--theme-primary)]",
|
|
3591
3214
|
children: /* @__PURE__ */ jsx9("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx9(
|
|
3592
3215
|
"path",
|
|
3593
3216
|
{
|
|
@@ -3614,11 +3237,8 @@ function SelectBase({
|
|
|
3614
3237
|
menuFooter ? /* @__PURE__ */ jsx9(
|
|
3615
3238
|
"div",
|
|
3616
3239
|
{
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
borderTop: `1px solid ${withAlpha(theme.colors.text, 0.08)}`,
|
|
3620
|
-
flexShrink: 0
|
|
3621
|
-
},
|
|
3240
|
+
className: "shrink-0 border-t px-2 pb-1 pt-2.5",
|
|
3241
|
+
style: { borderColor: "var(--ui-kit-select-divider)" },
|
|
3622
3242
|
children: menuFooter
|
|
3623
3243
|
}
|
|
3624
3244
|
) : null
|
|
@@ -3708,7 +3328,7 @@ function Select({ children, ...props }) {
|
|
|
3708
3328
|
}
|
|
3709
3329
|
|
|
3710
3330
|
// src/components/SelectAsync.tsx
|
|
3711
|
-
import { useEffect as
|
|
3331
|
+
import { useEffect as useEffect7, useMemo as useMemo6, useRef as useRef5, useState as useState6 } from "react";
|
|
3712
3332
|
|
|
3713
3333
|
// src/componentsBase/select/objectOptionsAdapter.tsx
|
|
3714
3334
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
@@ -3811,19 +3431,19 @@ function SelectAsync({
|
|
|
3811
3431
|
...props
|
|
3812
3432
|
}) {
|
|
3813
3433
|
var _a;
|
|
3814
|
-
|
|
3434
|
+
useUiKitTheme();
|
|
3815
3435
|
const isMultiSelect = Boolean(isMulti);
|
|
3816
3436
|
const isControlled = value !== void 0;
|
|
3817
|
-
const [internalSelectedOptions, setInternalSelectedOptions] =
|
|
3437
|
+
const [internalSelectedOptions, setInternalSelectedOptions] = useState6(() => {
|
|
3818
3438
|
return normalizeAsyncValue(defaultValue, isMultiSelect);
|
|
3819
3439
|
});
|
|
3820
|
-
const [remoteOptions, setRemoteOptions] =
|
|
3821
|
-
const [searchQuery, setSearchQuery] =
|
|
3822
|
-
const [nextPage, setNextPage] =
|
|
3823
|
-
const [hasMore, setHasMore] =
|
|
3824
|
-
const [isInitialLoading, setIsInitialLoading] =
|
|
3825
|
-
const [isLoadingMore, setIsLoadingMore] =
|
|
3826
|
-
const [loadError, setLoadError] =
|
|
3440
|
+
const [remoteOptions, setRemoteOptions] = useState6(defaultOptions);
|
|
3441
|
+
const [searchQuery, setSearchQuery] = useState6("");
|
|
3442
|
+
const [nextPage, setNextPage] = useState6(1);
|
|
3443
|
+
const [hasMore, setHasMore] = useState6(true);
|
|
3444
|
+
const [isInitialLoading, setIsInitialLoading] = useState6(false);
|
|
3445
|
+
const [isLoadingMore, setIsLoadingMore] = useState6(false);
|
|
3446
|
+
const [loadError, setLoadError] = useState6(null);
|
|
3827
3447
|
const selectedOptions = isControlled ? normalizeAsyncValue(value, isMultiSelect) : internalSelectedOptions;
|
|
3828
3448
|
const optionLookupRef = useRef5(/* @__PURE__ */ new Map());
|
|
3829
3449
|
const loadOptionsRef = useRef5(loadOptions);
|
|
@@ -3833,7 +3453,7 @@ function SelectAsync({
|
|
|
3833
3453
|
const activeControllerRef = useRef5(null);
|
|
3834
3454
|
loadOptionsRef.current = loadOptions;
|
|
3835
3455
|
remoteOptionsRef.current = remoteOptions;
|
|
3836
|
-
const mergedOptions =
|
|
3456
|
+
const mergedOptions = useMemo6(() => {
|
|
3837
3457
|
const baseOptions = dedupeSelectObjectOptions([
|
|
3838
3458
|
...fixedOptions,
|
|
3839
3459
|
...remoteOptions
|
|
@@ -3844,20 +3464,20 @@ function SelectAsync({
|
|
|
3844
3464
|
});
|
|
3845
3465
|
return [...baseOptions, ...missingSelectedOptions];
|
|
3846
3466
|
}, [fixedOptions, remoteOptions, selectedOptions]);
|
|
3847
|
-
|
|
3467
|
+
useEffect7(() => {
|
|
3848
3468
|
const nextLookup = /* @__PURE__ */ new Map();
|
|
3849
3469
|
mergedOptions.forEach((option) => {
|
|
3850
3470
|
nextLookup.set(getSelectObjectOptionKey(option), option);
|
|
3851
3471
|
});
|
|
3852
3472
|
optionLookupRef.current = nextLookup;
|
|
3853
3473
|
}, [mergedOptions]);
|
|
3854
|
-
|
|
3474
|
+
useEffect7(() => {
|
|
3855
3475
|
if (isControlled) {
|
|
3856
3476
|
return;
|
|
3857
3477
|
}
|
|
3858
3478
|
setInternalSelectedOptions(normalizeAsyncValue(defaultValue, isMultiSelect));
|
|
3859
3479
|
}, [defaultValue, isControlled, isMultiSelect]);
|
|
3860
|
-
|
|
3480
|
+
useEffect7(() => {
|
|
3861
3481
|
if (areUnknownArraysEqual(cacheUniqsRef.current, cacheUniqs)) {
|
|
3862
3482
|
return;
|
|
3863
3483
|
}
|
|
@@ -3868,7 +3488,7 @@ function SelectAsync({
|
|
|
3868
3488
|
setHasMore(true);
|
|
3869
3489
|
setLoadError(null);
|
|
3870
3490
|
}, [cacheUniqs, defaultOptions]);
|
|
3871
|
-
|
|
3491
|
+
useEffect7(() => {
|
|
3872
3492
|
const timeoutId = window.setTimeout(() => {
|
|
3873
3493
|
var _a2;
|
|
3874
3494
|
requestVersionRef.current += 1;
|
|
@@ -3909,7 +3529,7 @@ function SelectAsync({
|
|
|
3909
3529
|
window.clearTimeout(timeoutId);
|
|
3910
3530
|
};
|
|
3911
3531
|
}, [loadErrorMessage, searchDebounceMs, searchQuery, ...cacheUniqs]);
|
|
3912
|
-
|
|
3532
|
+
useEffect7(() => {
|
|
3913
3533
|
return () => {
|
|
3914
3534
|
var _a2;
|
|
3915
3535
|
(_a2 = activeControllerRef.current) == null ? void 0 : _a2.abort();
|
|
@@ -3970,28 +3590,15 @@ function SelectAsync({
|
|
|
3970
3590
|
"div",
|
|
3971
3591
|
{
|
|
3972
3592
|
"aria-live": "polite",
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
alignItems: "center",
|
|
3976
|
-
justifyContent: hasMore ? "space-between" : "center",
|
|
3977
|
-
gap: 12,
|
|
3978
|
-
color: mutedText,
|
|
3979
|
-
fontSize: 12,
|
|
3980
|
-
lineHeight: 1.4
|
|
3981
|
-
},
|
|
3593
|
+
className: "flex items-center gap-3 text-xs leading-[1.4] text-[var(--ui-kit-muted-text)]",
|
|
3594
|
+
style: { justifyContent: hasMore ? "space-between" : "center" },
|
|
3982
3595
|
children: [
|
|
3983
3596
|
/* @__PURE__ */ jsx12("span", { children: isLoadingMore ? loadingMoreMessage : hasMore ? loadMoreHintMessage : null }),
|
|
3984
3597
|
isLoadingMore ? /* @__PURE__ */ jsx12(
|
|
3985
3598
|
"span",
|
|
3986
3599
|
{
|
|
3987
3600
|
"aria-hidden": "true",
|
|
3988
|
-
|
|
3989
|
-
width: 8,
|
|
3990
|
-
height: 8,
|
|
3991
|
-
borderRadius: 999,
|
|
3992
|
-
backgroundColor: withAlpha(theme.colors.primary, 0.8),
|
|
3993
|
-
flexShrink: 0
|
|
3994
|
-
}
|
|
3601
|
+
className: "h-2 w-2 shrink-0 rounded-full bg-[var(--theme-primary)] opacity-80"
|
|
3995
3602
|
}
|
|
3996
3603
|
) : null
|
|
3997
3604
|
]
|
|
@@ -4025,10 +3632,10 @@ function SelectAsync({
|
|
|
4025
3632
|
}
|
|
4026
3633
|
|
|
4027
3634
|
// src/components/Table.tsx
|
|
4028
|
-
import { useEffect as
|
|
3635
|
+
import { useEffect as useEffect9, useMemo as useMemo7, useState as useState8 } from "react";
|
|
4029
3636
|
|
|
4030
3637
|
// src/componentsBase/table/TableBase.tsx
|
|
4031
|
-
import { useEffect as
|
|
3638
|
+
import { useEffect as useEffect8, useId as useId4, useRef as useRef6, useState as useState7 } from "react";
|
|
4032
3639
|
|
|
4033
3640
|
// src/componentsBase/table/utils.ts
|
|
4034
3641
|
import { isValidElement as isValidElement3 } from "react";
|
|
@@ -4480,9 +4087,9 @@ function DoubleChevronIcon({ direction }) {
|
|
|
4480
4087
|
] });
|
|
4481
4088
|
}
|
|
4482
4089
|
function OverflowMenu({ label, children, buttonStyle, menuStyle }) {
|
|
4483
|
-
const [isOpen, setIsOpen] =
|
|
4090
|
+
const [isOpen, setIsOpen] = useState7(false);
|
|
4484
4091
|
const containerRef = useRef6(null);
|
|
4485
|
-
|
|
4092
|
+
useEffect8(() => {
|
|
4486
4093
|
if (!isOpen) {
|
|
4487
4094
|
return;
|
|
4488
4095
|
}
|
|
@@ -4552,8 +4159,8 @@ function TableBase({
|
|
|
4552
4159
|
const componentShadow = getComponentShadow(theme);
|
|
4553
4160
|
const scrollRegionId = useId4().replace(/:/g, "");
|
|
4554
4161
|
const containerRef = useRef6(null);
|
|
4555
|
-
const [containerWidth, setContainerWidth] =
|
|
4556
|
-
const [isSettingsModalOpen, setIsSettingsModalOpen] =
|
|
4162
|
+
const [containerWidth, setContainerWidth] = useState7(null);
|
|
4163
|
+
const [isSettingsModalOpen, setIsSettingsModalOpen] = useState7(false);
|
|
4557
4164
|
const resolvedLabels = mergeTableLabels({
|
|
4558
4165
|
...labels != null ? labels : {},
|
|
4559
4166
|
...translations != null ? translations : {}
|
|
@@ -4595,7 +4202,7 @@ function TableBase({
|
|
|
4595
4202
|
boxShadow: stickyActionsColumnShadow,
|
|
4596
4203
|
borderLeft: `1px solid ${borderSoft}`
|
|
4597
4204
|
});
|
|
4598
|
-
|
|
4205
|
+
useEffect8(() => {
|
|
4599
4206
|
const element = containerRef.current;
|
|
4600
4207
|
if (!element) {
|
|
4601
4208
|
return;
|
|
@@ -4810,31 +4417,19 @@ function TableBase({
|
|
|
4810
4417
|
"div",
|
|
4811
4418
|
{
|
|
4812
4419
|
ref: containerRef,
|
|
4813
|
-
className
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
flexDirection: "column",
|
|
4820
|
-
gap: 16,
|
|
4821
|
-
padding: 18,
|
|
4822
|
-
boxSizing: "border-box",
|
|
4823
|
-
borderRadius: 24,
|
|
4824
|
-
backgroundColor: surfaceRaised,
|
|
4825
|
-
color: theme.colors.text,
|
|
4826
|
-
...style
|
|
4827
|
-
},
|
|
4420
|
+
className: cx(
|
|
4421
|
+
"flex w-full max-w-full min-w-0 flex-col gap-4 rounded-[24px]",
|
|
4422
|
+
"box-border bg-[var(--ui-kit-surface-raised)] p-[18px] text-[var(--theme-text)]",
|
|
4423
|
+
className
|
|
4424
|
+
),
|
|
4425
|
+
style,
|
|
4828
4426
|
children: [
|
|
4829
|
-
shouldRenderToolbar ? /* @__PURE__ */ jsxs11("div", {
|
|
4427
|
+
shouldRenderToolbar ? /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 flex-wrap items-center justify-between gap-3", children: [
|
|
4830
4428
|
shouldRenderToolbarPrimaryGroup ? /* @__PURE__ */ jsxs11(
|
|
4831
4429
|
"div",
|
|
4832
4430
|
{
|
|
4431
|
+
className: "flex min-w-0 items-center gap-2.5",
|
|
4833
4432
|
style: {
|
|
4834
|
-
display: "flex",
|
|
4835
|
-
alignItems: "center",
|
|
4836
|
-
gap: 10,
|
|
4837
|
-
minWidth: 0,
|
|
4838
4433
|
flex: shouldShowSearch ? "1 1 260px" : "0 0 auto",
|
|
4839
4434
|
marginLeft: shouldShowSearch ? void 0 : "auto"
|
|
4840
4435
|
},
|
|
@@ -4847,11 +4442,12 @@ function TableBase({
|
|
|
4847
4442
|
"aria-label": resolvedLabels.searchPlaceholder,
|
|
4848
4443
|
placeholder: resolvedLabels.searchPlaceholder,
|
|
4849
4444
|
onChange: (event) => onSearchChange(event.currentTarget.value),
|
|
4445
|
+
className: "h-[42px] min-w-0 flex-1 rounded-[14px] border bg-[var(--theme-surface)] px-[10px] text-sm leading-[1.4] text-[var(--theme-text)] outline-none",
|
|
4850
4446
|
style: {
|
|
4851
|
-
...toolbarControlStyle,
|
|
4852
4447
|
flex: "1 1 260px",
|
|
4853
4448
|
maxWidth: 360,
|
|
4854
|
-
|
|
4449
|
+
borderColor: "var(--ui-kit-border-soft)",
|
|
4450
|
+
boxShadow: "var(--ui-kit-component-shadow)"
|
|
4855
4451
|
}
|
|
4856
4452
|
}
|
|
4857
4453
|
) : null,
|
|
@@ -4872,19 +4468,12 @@ function TableBase({
|
|
|
4872
4468
|
shouldShowToolbarStatus ? /* @__PURE__ */ jsxs11(
|
|
4873
4469
|
"div",
|
|
4874
4470
|
{
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
flexWrap: "wrap",
|
|
4878
|
-
alignItems: "center",
|
|
4879
|
-
justifyContent: "flex-end",
|
|
4880
|
-
gap: 10,
|
|
4881
|
-
minWidth: 0,
|
|
4882
|
-
marginLeft: shouldRenderToolbarPrimaryGroup ? "auto" : void 0
|
|
4883
|
-
},
|
|
4471
|
+
className: "flex min-w-0 flex-wrap items-center justify-end gap-2.5",
|
|
4472
|
+
style: { marginLeft: shouldRenderToolbarPrimaryGroup ? "auto" : void 0 },
|
|
4884
4473
|
children: [
|
|
4885
|
-
loading ? /* @__PURE__ */ jsx13("span", {
|
|
4886
|
-
!loading && error && hasRows ? /* @__PURE__ */ jsxs11("div", {
|
|
4887
|
-
/* @__PURE__ */ jsx13("span", {
|
|
4474
|
+
loading ? /* @__PURE__ */ jsx13("span", { className: "text-[13px] font-semibold text-[var(--ui-kit-muted-text)]", children: resolvedLabels.loadingMessage }) : null,
|
|
4475
|
+
!loading && error && hasRows ? /* @__PURE__ */ jsxs11("div", { className: "inline-flex items-center gap-2.5", children: [
|
|
4476
|
+
/* @__PURE__ */ jsx13("span", { className: "text-[13px] font-semibold text-[var(--theme-negative)]", children: resolvedLabels.errorMessage }),
|
|
4888
4477
|
onRetry ? /* @__PURE__ */ jsx13(Button, { size: "sm", variant: "ghost", onClick: onRetry, children: resolvedLabels.retryLabel }) : null
|
|
4889
4478
|
] }) : null
|
|
4890
4479
|
]
|
|
@@ -4892,7 +4481,7 @@ function TableBase({
|
|
|
4892
4481
|
) : null
|
|
4893
4482
|
] }) : null,
|
|
4894
4483
|
!hasRows && (!loading || error) ? renderEmptyState() : null,
|
|
4895
|
-
hasRows ? isCollapsed ? /* @__PURE__ */ jsx13("div", { role: "list", "aria-label": ariaLabel,
|
|
4484
|
+
hasRows ? isCollapsed ? /* @__PURE__ */ jsx13("div", { role: "list", "aria-label": ariaLabel, className: "flex flex-col gap-3.5", children: items.map((item, rowIndex) => {
|
|
4896
4485
|
const rowActions = renderActions(item, rowIndex);
|
|
4897
4486
|
const rowBackgroundColor = rowIndex % 2 === 0 ? theme.colors.surface : surfaceMuted;
|
|
4898
4487
|
return /* @__PURE__ */ jsxs11(
|
|
@@ -5038,18 +4627,12 @@ function TableBase({
|
|
|
5038
4627
|
id: scrollRegionId,
|
|
5039
4628
|
role: "region",
|
|
5040
4629
|
"aria-label": ariaLabel,
|
|
4630
|
+
className: "w-full max-w-full min-w-0 overflow-x-auto overflow-y-hidden rounded-[20px] border bg-[var(--theme-surface)]",
|
|
5041
4631
|
style: {
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
minWidth: 0,
|
|
5045
|
-
overflowX: "auto",
|
|
5046
|
-
overflowY: "hidden",
|
|
5047
|
-
borderRadius: 20,
|
|
5048
|
-
border: `1px solid ${borderSoft}`,
|
|
5049
|
-
backgroundColor: theme.colors.surface,
|
|
5050
|
-
boxShadow: componentShadow
|
|
4632
|
+
borderColor: "var(--ui-kit-border-soft)",
|
|
4633
|
+
boxShadow: "var(--ui-kit-component-shadow)"
|
|
5051
4634
|
},
|
|
5052
|
-
children: /* @__PURE__ */ jsxs11("table", {
|
|
4635
|
+
children: /* @__PURE__ */ jsxs11("table", { className: "min-w-full max-w-none border-separate border-spacing-0", style: { width: "max-content" }, children: [
|
|
5053
4636
|
/* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsxs11("tr", { children: [
|
|
5054
4637
|
desktopColumns.map((column, columnIndex) => {
|
|
5055
4638
|
var _a, _b;
|
|
@@ -5135,17 +4718,10 @@ function TableBase({
|
|
|
5135
4718
|
hasRows && shouldRenderFooter ? /* @__PURE__ */ jsxs11(
|
|
5136
4719
|
"div",
|
|
5137
4720
|
{
|
|
5138
|
-
|
|
5139
|
-
display: "flex",
|
|
5140
|
-
flexWrap: "wrap",
|
|
5141
|
-
alignItems: "center",
|
|
5142
|
-
justifyContent: "space-between",
|
|
5143
|
-
gap: 12,
|
|
5144
|
-
paddingTop: 4
|
|
5145
|
-
},
|
|
4721
|
+
className: "flex flex-wrap items-center justify-between gap-3 pt-1",
|
|
5146
4722
|
children: [
|
|
5147
|
-
shouldShowPaginationControls ? /* @__PURE__ */ jsxs11("div", {
|
|
5148
|
-
/* @__PURE__ */ jsx13("span", {
|
|
4723
|
+
shouldShowPaginationControls ? /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4724
|
+
/* @__PURE__ */ jsx13("span", { className: "mr-1 text-[13px] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.pageLabel(normalizedPage, totalPages) }),
|
|
5149
4725
|
/* @__PURE__ */ jsx13(
|
|
5150
4726
|
"button",
|
|
5151
4727
|
{
|
|
@@ -5191,22 +4767,29 @@ function TableBase({
|
|
|
5191
4767
|
}
|
|
5192
4768
|
)
|
|
5193
4769
|
] }) : null,
|
|
5194
|
-
/* @__PURE__ */ jsx13(
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
"
|
|
5198
|
-
{
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
4770
|
+
/* @__PURE__ */ jsx13(
|
|
4771
|
+
"div",
|
|
4772
|
+
{
|
|
4773
|
+
className: "flex items-center gap-2.5 text-[13px] text-[var(--ui-kit-muted-text)]",
|
|
4774
|
+
style: { marginLeft: shouldShowRowsPerPageControl ? "auto" : void 0 },
|
|
4775
|
+
children: shouldShowRowsPerPageControl ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
4776
|
+
/* @__PURE__ */ jsx13("span", { children: resolvedLabels.rowsPerPageLabel }),
|
|
4777
|
+
/* @__PURE__ */ jsx13(
|
|
4778
|
+
"select",
|
|
4779
|
+
{
|
|
4780
|
+
value: pageSize,
|
|
4781
|
+
onChange: (event) => onInternalPageSizeChange(Number(event.currentTarget.value)),
|
|
4782
|
+
className: "h-[34px] rounded-[14px] border bg-[var(--theme-surface)] px-3 text-sm leading-[1.4] text-[var(--theme-text)] outline-none",
|
|
4783
|
+
style: {
|
|
4784
|
+
borderColor: "var(--ui-kit-border-soft)",
|
|
4785
|
+
boxShadow: "var(--ui-kit-component-shadow)"
|
|
4786
|
+
},
|
|
4787
|
+
children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx13("option", { value: option, children: option }, option))
|
|
4788
|
+
}
|
|
4789
|
+
)
|
|
4790
|
+
] }) : null
|
|
4791
|
+
}
|
|
4792
|
+
)
|
|
5210
4793
|
]
|
|
5211
4794
|
}
|
|
5212
4795
|
) : null,
|
|
@@ -5219,31 +4802,31 @@ function TableBase({
|
|
|
5219
4802
|
maxWidth: 560,
|
|
5220
4803
|
bodyStyle: { display: "grid", gap: 0 },
|
|
5221
4804
|
children: [
|
|
5222
|
-
/* @__PURE__ */ jsxs11("section", {
|
|
5223
|
-
/* @__PURE__ */ jsx13("strong", {
|
|
5224
|
-
/* @__PURE__ */ jsxs11("div", {
|
|
4805
|
+
/* @__PURE__ */ jsxs11("section", { className: "grid gap-3", children: [
|
|
4806
|
+
/* @__PURE__ */ jsx13("strong", { className: "text-sm text-[var(--theme-text)]", children: resolvedLabels.tableInfoSectionTitle }),
|
|
4807
|
+
/* @__PURE__ */ jsxs11("div", { className: "grid gap-2.5 [grid-template-columns:repeat(auto-fit,minmax(120px,1fr))]", children: [
|
|
5225
4808
|
/* @__PURE__ */ jsxs11("div", { style: infoCardStyle, children: [
|
|
5226
|
-
/* @__PURE__ */ jsx13("span", {
|
|
5227
|
-
/* @__PURE__ */ jsx13("strong", {
|
|
4809
|
+
/* @__PURE__ */ jsx13("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.totalPagesInfoLabel }),
|
|
4810
|
+
/* @__PURE__ */ jsx13("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: totalPages })
|
|
5228
4811
|
] }),
|
|
5229
4812
|
/* @__PURE__ */ jsxs11("div", { style: infoCardStyle, children: [
|
|
5230
|
-
/* @__PURE__ */ jsx13("span", {
|
|
5231
|
-
/* @__PURE__ */ jsx13("strong", {
|
|
4813
|
+
/* @__PURE__ */ jsx13("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.totalItemsInfoLabel }),
|
|
4814
|
+
/* @__PURE__ */ jsx13("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: totalItemCount })
|
|
5232
4815
|
] }),
|
|
5233
4816
|
/* @__PURE__ */ jsxs11("div", { style: infoCardStyle, children: [
|
|
5234
|
-
/* @__PURE__ */ jsx13("span", {
|
|
5235
|
-
/* @__PURE__ */ jsx13("strong", {
|
|
4817
|
+
/* @__PURE__ */ jsx13("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.currentPageInfoLabel }),
|
|
4818
|
+
/* @__PURE__ */ jsx13("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: normalizedPage })
|
|
5236
4819
|
] }),
|
|
5237
4820
|
/* @__PURE__ */ jsxs11("div", { style: infoCardStyle, children: [
|
|
5238
|
-
/* @__PURE__ */ jsx13("span", {
|
|
5239
|
-
/* @__PURE__ */ jsx13("strong", {
|
|
4821
|
+
/* @__PURE__ */ jsx13("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.currentPageItemsInfoLabel }),
|
|
4822
|
+
/* @__PURE__ */ jsx13("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: currentPageItemCount })
|
|
5240
4823
|
] })
|
|
5241
4824
|
] })
|
|
5242
4825
|
] }),
|
|
5243
|
-
/* @__PURE__ */ jsx13("div", {
|
|
5244
|
-
/* @__PURE__ */ jsxs11("section", {
|
|
5245
|
-
/* @__PURE__ */ jsx13("strong", {
|
|
5246
|
-
/* @__PURE__ */ jsxs11("div", {
|
|
4826
|
+
/* @__PURE__ */ jsx13("div", { className: "py-[18px]", children: /* @__PURE__ */ jsx13(Separator, { orientation: "horizontal", color: borderSoft }) }),
|
|
4827
|
+
/* @__PURE__ */ jsxs11("section", { className: "grid gap-3", children: [
|
|
4828
|
+
/* @__PURE__ */ jsx13("strong", { className: "text-sm text-[var(--theme-text)]", children: resolvedLabels.downloadSectionTitle }),
|
|
4829
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-2.5", children: [
|
|
5247
4830
|
/* @__PURE__ */ jsx13(Button, { size: "sm", variant: "outline", onClick: handleDownloadCsv, disabled: !hasRows, children: resolvedLabels.downloadCsvLabel }),
|
|
5248
4831
|
/* @__PURE__ */ jsx13(Button, { size: "sm", variant: "outline", onClick: handleDownloadXls, disabled: !hasRows, children: resolvedLabels.downloadXlsLabel }),
|
|
5249
4832
|
/* @__PURE__ */ jsx13(Button, { size: "sm", variant: "outline", onClick: handleDownloadPdf, disabled: !hasRows, children: resolvedLabels.downloadPdfLabel })
|
|
@@ -5274,13 +4857,13 @@ function Table({
|
|
|
5274
4857
|
...props
|
|
5275
4858
|
}) {
|
|
5276
4859
|
var _a;
|
|
5277
|
-
const initialPageSizeOptions =
|
|
4860
|
+
const initialPageSizeOptions = useMemo7(() => {
|
|
5278
4861
|
return sanitizePageSizeOptions(pageSizeOptions, defaultPageSize);
|
|
5279
4862
|
}, [defaultPageSize, pageSizeOptions]);
|
|
5280
|
-
const [searchValue, setSearchValue] =
|
|
5281
|
-
const [page, setPage] =
|
|
5282
|
-
const [pageSize, setPageSize] =
|
|
5283
|
-
|
|
4863
|
+
const [searchValue, setSearchValue] = useState8(defaultSearchValue);
|
|
4864
|
+
const [page, setPage] = useState8(Math.max(1, Math.floor(defaultPage)));
|
|
4865
|
+
const [pageSize, setPageSize] = useState8((_a = initialPageSizeOptions[0]) != null ? _a : DEFAULT_PAGE_SIZE);
|
|
4866
|
+
useEffect9(() => {
|
|
5284
4867
|
var _a2;
|
|
5285
4868
|
if (initialPageSizeOptions.includes(pageSize)) {
|
|
5286
4869
|
return;
|
|
@@ -5288,7 +4871,7 @@ function Table({
|
|
|
5288
4871
|
const nextPageSize = (_a2 = initialPageSizeOptions[0]) != null ? _a2 : DEFAULT_PAGE_SIZE;
|
|
5289
4872
|
setPageSize(nextPageSize);
|
|
5290
4873
|
}, [initialPageSizeOptions, pageSize]);
|
|
5291
|
-
const filteredItems =
|
|
4874
|
+
const filteredItems = useMemo7(() => {
|
|
5292
4875
|
if (!searchable) {
|
|
5293
4876
|
return items;
|
|
5294
4877
|
}
|
|
@@ -5306,14 +4889,14 @@ function Table({
|
|
|
5306
4889
|
const totalItems = filteredItems.length;
|
|
5307
4890
|
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
5308
4891
|
const normalizedPage = clampPage(page, totalPages);
|
|
5309
|
-
|
|
4892
|
+
useEffect9(() => {
|
|
5310
4893
|
if (normalizedPage === page) {
|
|
5311
4894
|
return;
|
|
5312
4895
|
}
|
|
5313
4896
|
setPage(normalizedPage);
|
|
5314
4897
|
onPageChange == null ? void 0 : onPageChange(normalizedPage);
|
|
5315
4898
|
}, [normalizedPage, onPageChange, page]);
|
|
5316
|
-
const pageItems =
|
|
4899
|
+
const pageItems = useMemo7(() => {
|
|
5317
4900
|
const startIndex = (normalizedPage - 1) * pageSize;
|
|
5318
4901
|
return filteredItems.slice(startIndex, startIndex + pageSize);
|
|
5319
4902
|
}, [filteredItems, normalizedPage, pageSize]);
|
|
@@ -5353,7 +4936,7 @@ function Table({
|
|
|
5353
4936
|
}
|
|
5354
4937
|
|
|
5355
4938
|
// src/components/TableAsync.tsx
|
|
5356
|
-
import { useEffect as
|
|
4939
|
+
import { useEffect as useEffect10, useMemo as useMemo8, useRef as useRef7, useState as useState9 } from "react";
|
|
5357
4940
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
5358
4941
|
var areUnknownArraysEqual2 = (left, right) => {
|
|
5359
4942
|
if (left.length !== right.length) {
|
|
@@ -5379,25 +4962,25 @@ function TableAsync({
|
|
|
5379
4962
|
...props
|
|
5380
4963
|
}) {
|
|
5381
4964
|
var _a;
|
|
5382
|
-
const initialPageSizeOptions =
|
|
4965
|
+
const initialPageSizeOptions = useMemo8(() => {
|
|
5383
4966
|
return sanitizePageSizeOptions(pageSizeOptions, defaultPageSize);
|
|
5384
4967
|
}, [defaultPageSize, pageSizeOptions]);
|
|
5385
|
-
const [searchValue, setSearchValue] =
|
|
5386
|
-
const [debouncedSearchValue, setDebouncedSearchValue] =
|
|
5387
|
-
const [page, setPage] =
|
|
5388
|
-
const [pageSize, setPageSize] =
|
|
5389
|
-
const [items, setItems] =
|
|
5390
|
-
const [totalPages, setTotalPages] =
|
|
5391
|
-
const [totalItems, setTotalItems] =
|
|
5392
|
-
const [loading, setLoading] =
|
|
5393
|
-
const [error, setError] =
|
|
5394
|
-
const [reloadKey, setReloadKey] =
|
|
4968
|
+
const [searchValue, setSearchValue] = useState9(defaultSearchValue);
|
|
4969
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = useState9(defaultSearchValue);
|
|
4970
|
+
const [page, setPage] = useState9(Math.max(1, Math.floor(defaultPage)));
|
|
4971
|
+
const [pageSize, setPageSize] = useState9((_a = initialPageSizeOptions[0]) != null ? _a : DEFAULT_PAGE_SIZE);
|
|
4972
|
+
const [items, setItems] = useState9([]);
|
|
4973
|
+
const [totalPages, setTotalPages] = useState9(1);
|
|
4974
|
+
const [totalItems, setTotalItems] = useState9(void 0);
|
|
4975
|
+
const [loading, setLoading] = useState9(false);
|
|
4976
|
+
const [error, setError] = useState9(null);
|
|
4977
|
+
const [reloadKey, setReloadKey] = useState9(0);
|
|
5395
4978
|
const loadItemsRef = useRef7(loadItems);
|
|
5396
4979
|
const cacheUniqsRef = useRef7(cacheUniqs);
|
|
5397
4980
|
const activeControllerRef = useRef7(null);
|
|
5398
4981
|
const requestVersionRef = useRef7(0);
|
|
5399
4982
|
loadItemsRef.current = loadItems;
|
|
5400
|
-
|
|
4983
|
+
useEffect10(() => {
|
|
5401
4984
|
var _a2;
|
|
5402
4985
|
if (initialPageSizeOptions.includes(pageSize)) {
|
|
5403
4986
|
return;
|
|
@@ -5405,7 +4988,7 @@ function TableAsync({
|
|
|
5405
4988
|
const nextPageSize = (_a2 = initialPageSizeOptions[0]) != null ? _a2 : DEFAULT_PAGE_SIZE;
|
|
5406
4989
|
setPageSize(nextPageSize);
|
|
5407
4990
|
}, [initialPageSizeOptions, pageSize]);
|
|
5408
|
-
|
|
4991
|
+
useEffect10(() => {
|
|
5409
4992
|
const timeoutId = window.setTimeout(() => {
|
|
5410
4993
|
setDebouncedSearchValue(searchValue);
|
|
5411
4994
|
}, searchDebounceMs);
|
|
@@ -5413,7 +4996,7 @@ function TableAsync({
|
|
|
5413
4996
|
window.clearTimeout(timeoutId);
|
|
5414
4997
|
};
|
|
5415
4998
|
}, [searchDebounceMs, searchValue]);
|
|
5416
|
-
|
|
4999
|
+
useEffect10(() => {
|
|
5417
5000
|
if (areUnknownArraysEqual2(cacheUniqsRef.current, cacheUniqs)) {
|
|
5418
5001
|
return;
|
|
5419
5002
|
}
|
|
@@ -5421,7 +5004,7 @@ function TableAsync({
|
|
|
5421
5004
|
setPage(1);
|
|
5422
5005
|
setReloadKey((currentValue) => currentValue + 1);
|
|
5423
5006
|
}, [cacheUniqs]);
|
|
5424
|
-
|
|
5007
|
+
useEffect10(() => {
|
|
5425
5008
|
var _a2;
|
|
5426
5009
|
requestVersionRef.current += 1;
|
|
5427
5010
|
const currentRequestVersion = requestVersionRef.current;
|
|
@@ -5459,14 +5042,14 @@ function TableAsync({
|
|
|
5459
5042
|
setLoading(false);
|
|
5460
5043
|
});
|
|
5461
5044
|
}, [debouncedSearchValue, keepPreviousData, page, pageSize, reloadKey, searchable, ...cacheUniqs]);
|
|
5462
|
-
|
|
5045
|
+
useEffect10(() => {
|
|
5463
5046
|
return () => {
|
|
5464
5047
|
var _a2;
|
|
5465
5048
|
(_a2 = activeControllerRef.current) == null ? void 0 : _a2.abort();
|
|
5466
5049
|
};
|
|
5467
5050
|
}, []);
|
|
5468
5051
|
const normalizedPage = clampPage(page, totalPages);
|
|
5469
|
-
|
|
5052
|
+
useEffect10(() => {
|
|
5470
5053
|
if (normalizedPage === page) {
|
|
5471
5054
|
return;
|
|
5472
5055
|
}
|
|
@@ -5513,10 +5096,10 @@ function TableAsync({
|
|
|
5513
5096
|
|
|
5514
5097
|
// src/components/Textarea.tsx
|
|
5515
5098
|
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5516
|
-
var
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5099
|
+
var TEXTAREA_SIZE_CLASSNAMES = {
|
|
5100
|
+
sm: "px-3 py-[10px] text-[13px] leading-4",
|
|
5101
|
+
md: "px-[14px] py-[11px] text-sm leading-[18px]",
|
|
5102
|
+
lg: "px-4 py-3 text-[15px] leading-[18px]"
|
|
5520
5103
|
};
|
|
5521
5104
|
function Textarea({
|
|
5522
5105
|
label,
|
|
@@ -5529,25 +5112,27 @@ function Textarea({
|
|
|
5529
5112
|
rows = 5,
|
|
5530
5113
|
...rest
|
|
5531
5114
|
}) {
|
|
5532
|
-
|
|
5533
|
-
const
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5115
|
+
useUiKitTheme();
|
|
5116
|
+
const textarea = /* @__PURE__ */ jsx16(
|
|
5117
|
+
"textarea",
|
|
5118
|
+
{
|
|
5119
|
+
...rest,
|
|
5120
|
+
id,
|
|
5121
|
+
disabled,
|
|
5122
|
+
rows,
|
|
5123
|
+
className: cx(
|
|
5124
|
+
"w-full min-w-0 box-border resize-y rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
5125
|
+
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
5126
|
+
"duration-150 disabled:cursor-not-allowed disabled:opacity-70",
|
|
5127
|
+
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
5128
|
+
TEXTAREA_SIZE_CLASSNAMES[controlSize]
|
|
5129
|
+
),
|
|
5130
|
+
style: {
|
|
5131
|
+
boxShadow: error ? "0 0 0 3px var(--ui-kit-negative-soft), var(--ui-kit-component-shadow)" : "var(--ui-kit-component-shadow)",
|
|
5132
|
+
...style
|
|
5133
|
+
}
|
|
5134
|
+
}
|
|
5135
|
+
);
|
|
5551
5136
|
return /* @__PURE__ */ jsx16(ControlFrame, { label, hint, error, htmlFor: id, required: rest.required, children: textarea });
|
|
5552
5137
|
}
|
|
5553
5138
|
export {
|