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.cjs
CHANGED
|
@@ -39,12 +39,14 @@ __export(src_exports, {
|
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(src_exports);
|
|
41
41
|
|
|
42
|
-
// src/components/Button.tsx
|
|
43
|
-
var import_react2 = require("react");
|
|
44
|
-
|
|
45
42
|
// src/foundation/async.ts
|
|
46
43
|
var DEFAULT_ASYNC_SEARCH_DEBOUNCE_MS = 1500;
|
|
47
44
|
|
|
45
|
+
// src/foundation/className.ts
|
|
46
|
+
var cx = (...values) => {
|
|
47
|
+
return values.filter(Boolean).join(" ");
|
|
48
|
+
};
|
|
49
|
+
|
|
48
50
|
// src/foundation/color.ts
|
|
49
51
|
function withAlpha(hex, alpha) {
|
|
50
52
|
const normalized = hex.replace("#", "").trim();
|
|
@@ -72,52 +74,28 @@ var CONTROL_METRICS_BY_SIZE = {
|
|
|
72
74
|
selectIndicatorOffset: 12
|
|
73
75
|
},
|
|
74
76
|
md: {
|
|
75
|
-
height:
|
|
77
|
+
height: 34,
|
|
76
78
|
fontSize: 14,
|
|
77
79
|
lineHeight: "18px",
|
|
78
|
-
paddingX:
|
|
79
|
-
paddingY:
|
|
80
|
-
buttonPaddingX:
|
|
81
|
-
selectPaddingRight:
|
|
82
|
-
selectIndicatorOffset:
|
|
80
|
+
paddingX: 14,
|
|
81
|
+
paddingY: 7,
|
|
82
|
+
buttonPaddingX: 16,
|
|
83
|
+
selectPaddingRight: 42,
|
|
84
|
+
selectIndicatorOffset: 14
|
|
83
85
|
},
|
|
84
86
|
lg: {
|
|
85
|
-
height:
|
|
87
|
+
height: 38,
|
|
86
88
|
fontSize: 15,
|
|
87
89
|
lineHeight: "18px",
|
|
88
|
-
paddingX:
|
|
89
|
-
paddingY:
|
|
90
|
-
buttonPaddingX:
|
|
91
|
-
selectPaddingRight:
|
|
92
|
-
selectIndicatorOffset:
|
|
90
|
+
paddingX: 16,
|
|
91
|
+
paddingY: 9,
|
|
92
|
+
buttonPaddingX: 18,
|
|
93
|
+
selectPaddingRight: 46,
|
|
94
|
+
selectIndicatorOffset: 16
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
97
|
var getControlMetrics = (size) => CONTROL_METRICS_BY_SIZE[size];
|
|
96
|
-
var getTextInputPadding = (size, options = {}) => {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
const metrics = getControlMetrics(size);
|
|
99
|
-
const leadingInset = (_a = options.leadingInset) != null ? _a : 0;
|
|
100
|
-
const trailingInset = (_b = options.trailingInset) != null ? _b : 0;
|
|
101
|
-
return `${metrics.paddingY}px ${metrics.paddingX + trailingInset}px ${metrics.paddingY}px ${metrics.paddingX + leadingInset}px`;
|
|
102
|
-
};
|
|
103
|
-
var getSelectControlPadding = (size) => {
|
|
104
|
-
const metrics = getControlMetrics(size);
|
|
105
|
-
return `${metrics.paddingY}px ${metrics.selectPaddingRight}px ${metrics.paddingY}px ${metrics.paddingX}px`;
|
|
106
|
-
};
|
|
107
98
|
var getSelectIndicatorOffset = (size) => getControlMetrics(size).selectIndicatorOffset;
|
|
108
|
-
var getButtonSizeStyles = (size) => {
|
|
109
|
-
const metrics = getControlMetrics(size);
|
|
110
|
-
return {
|
|
111
|
-
boxSizing: "border-box",
|
|
112
|
-
height: metrics.height,
|
|
113
|
-
padding: `0 ${metrics.buttonPaddingX}px`,
|
|
114
|
-
fontSize: metrics.fontSize,
|
|
115
|
-
lineHeight: metrics.lineHeight
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
// src/foundation/motion.ts
|
|
120
|
-
var FIELD_SURFACE_TRANSITION = "border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease";
|
|
121
99
|
|
|
122
100
|
// src/foundation/shadow.ts
|
|
123
101
|
var LIGHT_SHADOW = "#B8B8B8";
|
|
@@ -129,6 +107,18 @@ function getComponentShadow(theme) {
|
|
|
129
107
|
const shadowColor = (_a = colors.shadow) != null ? _a : fallbackShadow;
|
|
130
108
|
return `${shadowColor} 0px 4px 5px`;
|
|
131
109
|
}
|
|
110
|
+
function getInsetBorderShadow(borderColor, options = {}) {
|
|
111
|
+
const {
|
|
112
|
+
outerShadow,
|
|
113
|
+
componentShadow = "var(--ui-kit-component-shadow)",
|
|
114
|
+
insetWidth = 1
|
|
115
|
+
} = options;
|
|
116
|
+
return [
|
|
117
|
+
outerShadow,
|
|
118
|
+
`inset 0 0 0 ${insetWidth}px ${borderColor}`,
|
|
119
|
+
componentShadow
|
|
120
|
+
].filter(Boolean).join(", ");
|
|
121
|
+
}
|
|
132
122
|
|
|
133
123
|
// src/foundation/shape.ts
|
|
134
124
|
var STANDARD_COMPONENT_BORDER_RADIUS = 16;
|
|
@@ -188,6 +178,47 @@ var assertThemeColorSchema = (theme) => {
|
|
|
188
178
|
};
|
|
189
179
|
assertThemeColorSchema(import_smartsell_theme.lightTheme);
|
|
190
180
|
assertThemeColorSchema(import_smartsell_theme.darkTheme);
|
|
181
|
+
var ROOT_THEME_VARIABLES = [
|
|
182
|
+
["--theme-primary", "primary"],
|
|
183
|
+
["--theme-primaryLight", "primaryLight"],
|
|
184
|
+
["--theme-primaryDark", "primaryDark"],
|
|
185
|
+
["--theme-shadow", "shadow"],
|
|
186
|
+
["--theme-secondary", "secondary"],
|
|
187
|
+
["--theme-background", "background"],
|
|
188
|
+
["--theme-surface", "surface"],
|
|
189
|
+
["--theme-text", "text"],
|
|
190
|
+
["--theme-textLight", "textLight"],
|
|
191
|
+
["--theme-positive", "positive"],
|
|
192
|
+
["--theme-negative", "negative"],
|
|
193
|
+
["--theme-warning", "warning"],
|
|
194
|
+
["--theme-info", "info"],
|
|
195
|
+
["--theme-onPrimary", "onPrimary"],
|
|
196
|
+
["--theme-onSecondary", "onSecondary"]
|
|
197
|
+
];
|
|
198
|
+
var syncUiKitThemeVariables = (tokens) => {
|
|
199
|
+
if (typeof document === "undefined") {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const rootStyle = document.documentElement.style;
|
|
203
|
+
ROOT_THEME_VARIABLES.forEach(([variableName, colorName]) => {
|
|
204
|
+
rootStyle.setProperty(variableName, tokens.theme.colors[colorName]);
|
|
205
|
+
});
|
|
206
|
+
rootStyle.setProperty("--ui-kit-border-soft", tokens.borderSoft);
|
|
207
|
+
rootStyle.setProperty("--ui-kit-border-strong", tokens.borderStrong);
|
|
208
|
+
rootStyle.setProperty("--ui-kit-surface-muted", tokens.surfaceMuted);
|
|
209
|
+
rootStyle.setProperty("--ui-kit-surface-raised", tokens.surfaceRaised);
|
|
210
|
+
rootStyle.setProperty("--ui-kit-overlay", tokens.overlay);
|
|
211
|
+
rootStyle.setProperty("--ui-kit-focus-ring", tokens.focusRing);
|
|
212
|
+
rootStyle.setProperty("--ui-kit-muted-text", tokens.mutedText);
|
|
213
|
+
rootStyle.setProperty("--ui-kit-component-shadow", getComponentShadow(tokens.theme));
|
|
214
|
+
rootStyle.setProperty("--ui-kit-card-bg", withAlpha(tokens.theme.colors.background, 0.7));
|
|
215
|
+
rootStyle.setProperty("--ui-kit-card-border", withAlpha(tokens.theme.colors.text, 0.5));
|
|
216
|
+
rootStyle.setProperty("--ui-kit-button-outline-hover", withAlpha(tokens.theme.colors.text, 0.08));
|
|
217
|
+
rootStyle.setProperty("--ui-kit-button-outline-active", withAlpha(tokens.theme.colors.text, 0.14));
|
|
218
|
+
rootStyle.setProperty("--ui-kit-button-ghost-border", withAlpha(tokens.theme.colors.primary, 0.5));
|
|
219
|
+
rootStyle.setProperty("--ui-kit-placeholder", withAlpha(tokens.theme.colors.text, 0.5));
|
|
220
|
+
rootStyle.setProperty("--ui-kit-negative-soft", withAlpha(tokens.theme.colors.negative, 0.12));
|
|
221
|
+
};
|
|
191
222
|
function normalizeUiKitTheme(theme) {
|
|
192
223
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
193
224
|
const colors = theme.colors;
|
|
@@ -235,11 +266,61 @@ function createUiKitThemeTokens(themeSource) {
|
|
|
235
266
|
}
|
|
236
267
|
function useUiKitTheme() {
|
|
237
268
|
const activeTheme = (0, import_smartsell_theme.useThemeValue)();
|
|
238
|
-
|
|
269
|
+
const tokens = (0, import_react.useMemo)(() => createUiKitThemeTokens(activeTheme), [activeTheme]);
|
|
270
|
+
(0, import_react.useEffect)(() => {
|
|
271
|
+
syncUiKitThemeVariables(tokens);
|
|
272
|
+
}, [tokens]);
|
|
273
|
+
return tokens;
|
|
239
274
|
}
|
|
240
275
|
|
|
241
276
|
// src/components/Button.tsx
|
|
242
277
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
278
|
+
var BUTTON_SIZE_CLASSNAMES = {
|
|
279
|
+
sm: "h-[30px] px-[14px] text-[13px] leading-4",
|
|
280
|
+
md: "h-[34px] px-4 text-sm leading-[18px]",
|
|
281
|
+
lg: "h-[38px] px-[18px] text-[15px] leading-[18px]"
|
|
282
|
+
};
|
|
283
|
+
var BUTTON_VARIANT_CLASSNAMES = {
|
|
284
|
+
solid: [
|
|
285
|
+
"border-[var(--theme-primary)]",
|
|
286
|
+
"bg-[var(--theme-primary)]",
|
|
287
|
+
"text-[var(--theme-onPrimary)]",
|
|
288
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
289
|
+
"hover:border-[var(--theme-primaryDark)]",
|
|
290
|
+
"hover:bg-[var(--theme-primaryDark)]",
|
|
291
|
+
"hover:-translate-y-[0.5px]",
|
|
292
|
+
"active:translate-y-px",
|
|
293
|
+
"active:scale-[0.985]"
|
|
294
|
+
].join(" "),
|
|
295
|
+
outline: [
|
|
296
|
+
"border-[var(--theme-textLight)]",
|
|
297
|
+
"bg-transparent",
|
|
298
|
+
"text-[var(--theme-text)]",
|
|
299
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
300
|
+
"hover:-translate-y-[0.5px]",
|
|
301
|
+
"hover:bg-[var(--ui-kit-button-outline-hover)]",
|
|
302
|
+
"active:translate-y-px",
|
|
303
|
+
"active:scale-[0.985]",
|
|
304
|
+
"active:bg-[var(--ui-kit-button-outline-active)]"
|
|
305
|
+
].join(" "),
|
|
306
|
+
ghost: [
|
|
307
|
+
"border-transparent",
|
|
308
|
+
"bg-transparent",
|
|
309
|
+
"text-[var(--theme-text)]",
|
|
310
|
+
"shadow-none",
|
|
311
|
+
"hover:-translate-y-[0.5px]",
|
|
312
|
+
"hover:border-[var(--ui-kit-button-ghost-border)]",
|
|
313
|
+
"hover:bg-[var(--theme-primary)]",
|
|
314
|
+
"hover:text-[var(--theme-onPrimary)]",
|
|
315
|
+
"hover:shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
316
|
+
"active:translate-y-px",
|
|
317
|
+
"active:scale-[0.985]",
|
|
318
|
+
"active:border-[var(--ui-kit-button-ghost-border)]",
|
|
319
|
+
"active:bg-[var(--theme-primary)]",
|
|
320
|
+
"active:text-[var(--theme-onPrimary)]",
|
|
321
|
+
"active:shadow-[0px_4px_5px_var(--theme-shadow)]"
|
|
322
|
+
].join(" ")
|
|
323
|
+
};
|
|
243
324
|
function Button({
|
|
244
325
|
variant = "solid",
|
|
245
326
|
size = "sm",
|
|
@@ -247,137 +328,27 @@ function Button({
|
|
|
247
328
|
trailingIcon,
|
|
248
329
|
children,
|
|
249
330
|
disabled,
|
|
250
|
-
|
|
331
|
+
className,
|
|
251
332
|
type = "button",
|
|
252
|
-
onMouseEnter,
|
|
253
|
-
onMouseLeave,
|
|
254
|
-
onMouseDown,
|
|
255
|
-
onMouseUp,
|
|
256
|
-
onBlur,
|
|
257
|
-
onKeyDown,
|
|
258
|
-
onKeyUp,
|
|
259
|
-
onTouchStart,
|
|
260
|
-
onTouchEnd,
|
|
261
|
-
onTouchCancel,
|
|
262
333
|
...rest
|
|
263
334
|
}) {
|
|
264
|
-
var _a, _b;
|
|
265
|
-
const { theme } = useUiKitTheme();
|
|
266
|
-
const [isHovered, setIsHovered] = (0, import_react2.useState)(false);
|
|
267
|
-
const [isPressed, setIsPressed] = (0, import_react2.useState)(false);
|
|
268
|
-
const buttonShadow = getComponentShadow(theme);
|
|
269
|
-
const variantStyles = {
|
|
270
|
-
solid: {
|
|
271
|
-
backgroundColor: theme.colors.primary,
|
|
272
|
-
borderColor: theme.colors.primary,
|
|
273
|
-
color: theme.colors.onPrimary
|
|
274
|
-
},
|
|
275
|
-
outline: {
|
|
276
|
-
backgroundColor: "transparent",
|
|
277
|
-
borderColor: theme.colors.textLight,
|
|
278
|
-
color: theme.colors.text
|
|
279
|
-
},
|
|
280
|
-
ghost: {
|
|
281
|
-
backgroundColor: "transparent",
|
|
282
|
-
borderColor: "transparent"
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
const interactiveColor = variant === "solid" ? theme.colors.primary : theme.colors.text;
|
|
286
|
-
const isInteractive = !disabled;
|
|
287
|
-
const buttonTransform = isPressed ? "translateY(1px) scale(0.985)" : isHovered ? "translateY(-0.5px)" : "translateY(0)";
|
|
288
|
-
const interactionStyles = {
|
|
289
|
-
solid: {
|
|
290
|
-
transform: buttonTransform,
|
|
291
|
-
filter: void 0
|
|
292
|
-
},
|
|
293
|
-
outline: {
|
|
294
|
-
transform: buttonTransform,
|
|
295
|
-
backgroundColor: isPressed ? withAlpha(interactiveColor, 0.14) : isHovered ? withAlpha(interactiveColor, 0.08) : "transparent"
|
|
296
|
-
},
|
|
297
|
-
ghost: {
|
|
298
|
-
transform: buttonTransform,
|
|
299
|
-
backgroundColor: isPressed || isHovered ? theme.colors.primary : "transparent",
|
|
300
|
-
borderColor: isPressed || isHovered ? withAlpha(theme.colors.primary, 0.5) : "transparent",
|
|
301
|
-
color: isPressed || isHovered ? theme.colors.onPrimary : theme.colors.text
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
335
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
305
336
|
"button",
|
|
306
337
|
{
|
|
307
338
|
...rest,
|
|
308
339
|
type,
|
|
309
340
|
disabled,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
onMouseDown: (event) => {
|
|
322
|
-
if (isInteractive) {
|
|
323
|
-
setIsPressed(true);
|
|
324
|
-
}
|
|
325
|
-
onMouseDown == null ? void 0 : onMouseDown(event);
|
|
326
|
-
},
|
|
327
|
-
onMouseUp: (event) => {
|
|
328
|
-
setIsPressed(false);
|
|
329
|
-
onMouseUp == null ? void 0 : onMouseUp(event);
|
|
330
|
-
},
|
|
331
|
-
onBlur: (event) => {
|
|
332
|
-
setIsHovered(false);
|
|
333
|
-
setIsPressed(false);
|
|
334
|
-
onBlur == null ? void 0 : onBlur(event);
|
|
335
|
-
},
|
|
336
|
-
onKeyDown: (event) => {
|
|
337
|
-
if (isInteractive && (event.key === " " || event.key === "Enter")) {
|
|
338
|
-
setIsPressed(true);
|
|
339
|
-
}
|
|
340
|
-
onKeyDown == null ? void 0 : onKeyDown(event);
|
|
341
|
-
},
|
|
342
|
-
onKeyUp: (event) => {
|
|
343
|
-
setIsPressed(false);
|
|
344
|
-
onKeyUp == null ? void 0 : onKeyUp(event);
|
|
345
|
-
},
|
|
346
|
-
onTouchStart: (event) => {
|
|
347
|
-
if (isInteractive) {
|
|
348
|
-
setIsPressed(true);
|
|
349
|
-
}
|
|
350
|
-
onTouchStart == null ? void 0 : onTouchStart(event);
|
|
351
|
-
},
|
|
352
|
-
onTouchEnd: (event) => {
|
|
353
|
-
setIsPressed(false);
|
|
354
|
-
onTouchEnd == null ? void 0 : onTouchEnd(event);
|
|
355
|
-
},
|
|
356
|
-
onTouchCancel: (event) => {
|
|
357
|
-
setIsPressed(false);
|
|
358
|
-
onTouchCancel == null ? void 0 : onTouchCancel(event);
|
|
359
|
-
},
|
|
360
|
-
style: {
|
|
361
|
-
display: "inline-flex",
|
|
362
|
-
alignItems: "center",
|
|
363
|
-
justifyContent: "center",
|
|
364
|
-
gap: 10,
|
|
365
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
366
|
-
borderStyle: "solid",
|
|
367
|
-
borderWidth: 1,
|
|
368
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
369
|
-
fontWeight: 700,
|
|
370
|
-
letterSpacing: "0.01em",
|
|
371
|
-
opacity: disabled ? DISABLED_COMPONENT_OPACITY : 1,
|
|
372
|
-
boxShadow: variant === "ghost" && !isHovered ? "none" : buttonShadow,
|
|
373
|
-
transitionDuration: "0.3s",
|
|
374
|
-
width: (_a = style == null ? void 0 : style.width) != null ? _a : "fit-content",
|
|
375
|
-
maxWidth: (_b = style == null ? void 0 : style.maxWidth) != null ? _b : "fit-content",
|
|
376
|
-
...getButtonSizeStyles(size),
|
|
377
|
-
...variantStyles[variant],
|
|
378
|
-
...isInteractive ? interactionStyles[variant] : void 0,
|
|
379
|
-
...style
|
|
380
|
-
},
|
|
341
|
+
className: cx(
|
|
342
|
+
"box-border inline-flex w-fit max-w-fit items-center justify-center gap-2.5",
|
|
343
|
+
"rounded-2xl border border-solid font-bold tracking-[0.01em]",
|
|
344
|
+
"cursor-pointer transition-all duration-300",
|
|
345
|
+
`disabled:opacity-[${DISABLED_COMPONENT_OPACITY}]`,
|
|
346
|
+
"disabled:cursor-not-allowed",
|
|
347
|
+
"disabled:translate-y-0 disabled:scale-100",
|
|
348
|
+
BUTTON_SIZE_CLASSNAMES[size],
|
|
349
|
+
BUTTON_VARIANT_CLASSNAMES[variant],
|
|
350
|
+
className
|
|
351
|
+
),
|
|
381
352
|
children: [
|
|
382
353
|
leadingIcon,
|
|
383
354
|
children,
|
|
@@ -395,67 +366,30 @@ function Card({
|
|
|
395
366
|
title,
|
|
396
367
|
action,
|
|
397
368
|
padded = true,
|
|
398
|
-
|
|
369
|
+
className,
|
|
399
370
|
...rest
|
|
400
371
|
}) {
|
|
401
|
-
|
|
402
|
-
const componentShadow = getComponentShadow(theme);
|
|
372
|
+
useUiKitTheme();
|
|
403
373
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
404
374
|
"div",
|
|
405
375
|
{
|
|
406
376
|
...rest,
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
background:
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
},
|
|
377
|
+
className: cx(
|
|
378
|
+
"rounded-[28px] border text-[var(--theme-text)]",
|
|
379
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
380
|
+
"[background:var(--ui-kit-card-bg)]",
|
|
381
|
+
"[border-color:var(--ui-kit-card-border)]",
|
|
382
|
+
padded && "p-6",
|
|
383
|
+
className
|
|
384
|
+
),
|
|
416
385
|
children: [
|
|
417
|
-
(eyebrow || title || action) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
418
|
-
"div",
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
gap: 16,
|
|
425
|
-
marginBottom: 18
|
|
426
|
-
},
|
|
427
|
-
children: [
|
|
428
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 6 }, children: [
|
|
429
|
-
eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
430
|
-
"span",
|
|
431
|
-
{
|
|
432
|
-
style: {
|
|
433
|
-
color: theme.colors.textLight,
|
|
434
|
-
fontSize: 12,
|
|
435
|
-
fontWeight: 800,
|
|
436
|
-
letterSpacing: "0.16em",
|
|
437
|
-
textTransform: "uppercase"
|
|
438
|
-
},
|
|
439
|
-
children: eyebrow
|
|
440
|
-
}
|
|
441
|
-
) : null,
|
|
442
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
443
|
-
"div",
|
|
444
|
-
{
|
|
445
|
-
style: {
|
|
446
|
-
color: theme.colors.text,
|
|
447
|
-
fontSize: 24,
|
|
448
|
-
fontWeight: 700,
|
|
449
|
-
lineHeight: 1.2
|
|
450
|
-
},
|
|
451
|
-
children: title
|
|
452
|
-
}
|
|
453
|
-
) : null
|
|
454
|
-
] }),
|
|
455
|
-
action ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { color: theme.colors.text }, children: action }) : null
|
|
456
|
-
]
|
|
457
|
-
}
|
|
458
|
-
),
|
|
386
|
+
(eyebrow || title || action) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "mb-[18px] flex items-start justify-between gap-4", children: [
|
|
387
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
388
|
+
eyebrow ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-xs font-extrabold uppercase tracking-[0.16em] text-[var(--theme-textLight)]", children: eyebrow }) : null,
|
|
389
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-2xl font-bold leading-[1.2] text-[var(--theme-text)]", children: title }) : null
|
|
390
|
+
] }),
|
|
391
|
+
action ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-[var(--theme-text)]", children: action }) : null
|
|
392
|
+
] }),
|
|
459
393
|
children
|
|
460
394
|
]
|
|
461
395
|
}
|
|
@@ -469,29 +403,25 @@ function CardSmall({
|
|
|
469
403
|
value,
|
|
470
404
|
icon,
|
|
471
405
|
color,
|
|
406
|
+
className,
|
|
472
407
|
style,
|
|
473
408
|
...rest
|
|
474
409
|
}) {
|
|
475
|
-
const { theme
|
|
410
|
+
const { theme } = useUiKitTheme();
|
|
476
411
|
const accentColor = color != null ? color : theme.colors.primary;
|
|
477
|
-
const componentShadow = getComponentShadow(theme);
|
|
478
412
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
479
413
|
"div",
|
|
480
414
|
{
|
|
481
415
|
...rest,
|
|
416
|
+
className: cx(
|
|
417
|
+
"relative flex min-h-20 items-center gap-4 overflow-hidden",
|
|
418
|
+
"rounded-2xl border border-solid border-[var(--ui-kit-accent)]",
|
|
419
|
+
"bg-[var(--ui-kit-surface-raised)] pl-6 pr-6 text-[var(--theme-text)]",
|
|
420
|
+
"shadow-[0px_4px_5px_var(--theme-shadow)]",
|
|
421
|
+
className
|
|
422
|
+
),
|
|
482
423
|
style: {
|
|
483
|
-
|
|
484
|
-
display: "flex",
|
|
485
|
-
alignItems: "center",
|
|
486
|
-
gap: 16,
|
|
487
|
-
minHeight: 80,
|
|
488
|
-
padding: "0px 0px 0px 24px",
|
|
489
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
490
|
-
overflow: "hidden",
|
|
491
|
-
border: `1px solid ${theme.colors.textLight}`,
|
|
492
|
-
backgroundColor: surfaceRaised,
|
|
493
|
-
boxShadow: componentShadow,
|
|
494
|
-
color: theme.colors.text,
|
|
424
|
+
"--ui-kit-accent": accentColor,
|
|
495
425
|
...style
|
|
496
426
|
},
|
|
497
427
|
children: [
|
|
@@ -499,66 +429,24 @@ function CardSmall({
|
|
|
499
429
|
"div",
|
|
500
430
|
{
|
|
501
431
|
"aria-hidden": "true",
|
|
502
|
-
|
|
503
|
-
position: "absolute",
|
|
504
|
-
left: 0,
|
|
505
|
-
top: 0,
|
|
506
|
-
bottom: 0,
|
|
507
|
-
width: 25,
|
|
508
|
-
backgroundColor: accentColor
|
|
509
|
-
}
|
|
432
|
+
className: "absolute inset-y-0 left-0 w-[25px] bg-[var(--ui-kit-accent)]"
|
|
510
433
|
}
|
|
511
434
|
),
|
|
512
435
|
icon ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
513
436
|
"div",
|
|
514
437
|
{
|
|
515
438
|
"aria-hidden": "true",
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
color: accentColor,
|
|
522
|
-
display: "inline-flex",
|
|
523
|
-
alignItems: "center",
|
|
524
|
-
justifyContent: "center",
|
|
525
|
-
flexShrink: 0,
|
|
526
|
-
marginLeft: 16
|
|
527
|
-
},
|
|
439
|
+
className: cx(
|
|
440
|
+
"ml-4 inline-flex h-[52px] w-[52px] shrink-0 items-center justify-center",
|
|
441
|
+
"rounded-xl bg-[color-mix(in_srgb,var(--ui-kit-accent)_24%,transparent)]",
|
|
442
|
+
"text-[var(--ui-kit-accent)]"
|
|
443
|
+
),
|
|
528
444
|
children: icon
|
|
529
445
|
}
|
|
530
446
|
) : null,
|
|
531
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", {
|
|
532
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
533
|
-
|
|
534
|
-
{
|
|
535
|
-
style: {
|
|
536
|
-
color: theme.colors.text,
|
|
537
|
-
fontSize: 14,
|
|
538
|
-
fontWeight: 700,
|
|
539
|
-
lineHeight: 1.25,
|
|
540
|
-
overflow: "hidden",
|
|
541
|
-
textOverflow: "ellipsis",
|
|
542
|
-
whiteSpace: "nowrap"
|
|
543
|
-
},
|
|
544
|
-
children: title
|
|
545
|
-
}
|
|
546
|
-
) : null,
|
|
547
|
-
value ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
548
|
-
"div",
|
|
549
|
-
{
|
|
550
|
-
style: {
|
|
551
|
-
color: theme.colors.text,
|
|
552
|
-
fontSize: 18,
|
|
553
|
-
fontWeight: 800,
|
|
554
|
-
lineHeight: 1.15,
|
|
555
|
-
overflow: "hidden",
|
|
556
|
-
textOverflow: "ellipsis",
|
|
557
|
-
whiteSpace: "nowrap"
|
|
558
|
-
},
|
|
559
|
-
children: value
|
|
560
|
-
}
|
|
561
|
-
) : null
|
|
447
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex min-w-0 flex-col gap-1.5", children: [
|
|
448
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "truncate text-sm font-bold leading-[1.25] text-[var(--theme-text)]", children: title }) : null,
|
|
449
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "truncate text-[18px] font-extrabold leading-[1.15] text-[var(--theme-text)]", children: value }) : null
|
|
562
450
|
] })
|
|
563
451
|
]
|
|
564
452
|
}
|
|
@@ -566,12 +454,17 @@ function CardSmall({
|
|
|
566
454
|
}
|
|
567
455
|
|
|
568
456
|
// src/components/Checkbox.tsx
|
|
569
|
-
var
|
|
457
|
+
var import_react2 = require("react");
|
|
570
458
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
571
459
|
var CHECKBOX_SIZE_BY_CONTROL_SIZE = {
|
|
572
|
-
sm:
|
|
573
|
-
md:
|
|
574
|
-
lg:
|
|
460
|
+
sm: 14,
|
|
461
|
+
md: 16,
|
|
462
|
+
lg: 20
|
|
463
|
+
};
|
|
464
|
+
var CHECKBOX_LABEL_CLASSNAMES = {
|
|
465
|
+
sm: "text-[13px] leading-4",
|
|
466
|
+
md: "text-sm leading-[18px]",
|
|
467
|
+
lg: "text-[15px] leading-[18px]"
|
|
575
468
|
};
|
|
576
469
|
var getCheckboxSize = (controlSize) => CHECKBOX_SIZE_BY_CONTROL_SIZE[controlSize];
|
|
577
470
|
var hasNodeContent = (value) => {
|
|
@@ -660,19 +553,18 @@ function Checkbox({
|
|
|
660
553
|
...rest
|
|
661
554
|
}) {
|
|
662
555
|
const { theme, mutedText } = useUiKitTheme();
|
|
663
|
-
const controlMetrics = getControlMetrics(controlSize);
|
|
664
556
|
const indicatorSize = getCheckboxSize(controlSize);
|
|
665
557
|
const hasLabel = hasNodeContent(label);
|
|
666
558
|
const hasHint = hasNodeContent(hint);
|
|
667
559
|
const hasError = hasNodeContent(error);
|
|
668
560
|
const hasSecondaryContent = hasLabel && hasHint;
|
|
669
|
-
const resolvedId = id != null ? id : `ss-checkbox-${(0,
|
|
670
|
-
const inputRef = (0,
|
|
671
|
-
const [isFocused, setIsFocused] = (0,
|
|
672
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
561
|
+
const resolvedId = id != null ? id : `ss-checkbox-${(0, import_react2.useId)().replace(/:/g, "")}`;
|
|
562
|
+
const inputRef = (0, import_react2.useRef)(null);
|
|
563
|
+
const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
|
|
564
|
+
const [internalChecked, setInternalChecked] = (0, import_react2.useState)(Boolean(defaultChecked));
|
|
673
565
|
const isControlled = checked !== void 0;
|
|
674
566
|
const resolvedChecked = isControlled ? Boolean(checked) : internalChecked;
|
|
675
|
-
(0,
|
|
567
|
+
(0, import_react2.useEffect)(() => {
|
|
676
568
|
if (!inputRef.current) {
|
|
677
569
|
return;
|
|
678
570
|
}
|
|
@@ -681,43 +573,28 @@ function Checkbox({
|
|
|
681
573
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
682
574
|
"div",
|
|
683
575
|
{
|
|
684
|
-
className,
|
|
685
|
-
style
|
|
686
|
-
width: "100%",
|
|
687
|
-
display: "flex",
|
|
688
|
-
flexDirection: "column",
|
|
689
|
-
gap: 6,
|
|
690
|
-
...style
|
|
691
|
-
},
|
|
576
|
+
className: cx("flex w-full flex-col gap-1.5", className),
|
|
577
|
+
style,
|
|
692
578
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
693
579
|
"label",
|
|
694
580
|
{
|
|
695
581
|
htmlFor: resolvedId,
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
703
|
-
userSelect: "none"
|
|
704
|
-
},
|
|
582
|
+
className: cx(
|
|
583
|
+
"inline-flex select-none gap-2.5",
|
|
584
|
+
hasSecondaryContent ? "items-start" : "items-center",
|
|
585
|
+
hasLabel || hasHint || hasError ? "w-full" : "w-auto",
|
|
586
|
+
disabled ? "cursor-not-allowed opacity-70" : "cursor-pointer"
|
|
587
|
+
),
|
|
705
588
|
children: [
|
|
706
589
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
707
590
|
"span",
|
|
708
591
|
{
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
padding: 2,
|
|
716
|
-
marginTop: hasSecondaryContent ? 1 : 0,
|
|
717
|
-
borderRadius: 999,
|
|
718
|
-
boxShadow: isFocused ? `0 0 0 3px ${withAlpha(theme.colors.primary, 0.16)}` : "none",
|
|
719
|
-
transition: "box-shadow 140ms ease"
|
|
720
|
-
},
|
|
592
|
+
className: cx(
|
|
593
|
+
"relative inline-flex shrink-0 items-center justify-center rounded-full p-0.5",
|
|
594
|
+
hasSecondaryContent ? "mt-px" : "mt-0",
|
|
595
|
+
"transition-shadow duration-150",
|
|
596
|
+
isFocused ? "shadow-[0_0_0_3px_var(--ui-kit-focus-ring)]" : "shadow-none"
|
|
597
|
+
),
|
|
721
598
|
children: [
|
|
722
599
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
723
600
|
"input",
|
|
@@ -743,15 +620,10 @@ function Checkbox({
|
|
|
743
620
|
setIsFocused(false);
|
|
744
621
|
onBlur == null ? void 0 : onBlur(event);
|
|
745
622
|
},
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
height: "100%",
|
|
751
|
-
margin: 0,
|
|
752
|
-
opacity: 0,
|
|
753
|
-
cursor: disabled ? "not-allowed" : "pointer"
|
|
754
|
-
}
|
|
623
|
+
className: cx(
|
|
624
|
+
"absolute inset-0 m-0 h-full w-full opacity-0",
|
|
625
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
626
|
+
)
|
|
755
627
|
}
|
|
756
628
|
),
|
|
757
629
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -773,52 +645,17 @@ function Checkbox({
|
|
|
773
645
|
hasLabel || hasHint || hasError ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
774
646
|
"span",
|
|
775
647
|
{
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
justifyContent: hasSecondaryContent ? "flex-start" : "center",
|
|
781
|
-
minWidth: 0
|
|
782
|
-
},
|
|
648
|
+
className: cx(
|
|
649
|
+
"flex min-w-0 flex-col gap-1",
|
|
650
|
+
hasSecondaryContent ? "justify-start" : "justify-center"
|
|
651
|
+
),
|
|
783
652
|
children: [
|
|
784
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
785
|
-
|
|
786
|
-
{
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
lineHeight: controlMetrics.lineHeight,
|
|
791
|
-
fontWeight: 600
|
|
792
|
-
},
|
|
793
|
-
children: [
|
|
794
|
-
label,
|
|
795
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { style: { color: theme.colors.negative, marginLeft: 4 }, children: "*" }) : null
|
|
796
|
-
]
|
|
797
|
-
}
|
|
798
|
-
) : null,
|
|
799
|
-
hint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
800
|
-
"span",
|
|
801
|
-
{
|
|
802
|
-
style: {
|
|
803
|
-
color: mutedText,
|
|
804
|
-
fontSize: 13,
|
|
805
|
-
lineHeight: 1.45
|
|
806
|
-
},
|
|
807
|
-
children: hint
|
|
808
|
-
}
|
|
809
|
-
) : null,
|
|
810
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
811
|
-
"span",
|
|
812
|
-
{
|
|
813
|
-
style: {
|
|
814
|
-
color: theme.colors.negative,
|
|
815
|
-
fontSize: 13,
|
|
816
|
-
lineHeight: 1.45,
|
|
817
|
-
fontWeight: 600
|
|
818
|
-
},
|
|
819
|
-
children: error
|
|
820
|
-
}
|
|
821
|
-
) : null
|
|
653
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: cx("font-semibold text-[var(--theme-text)]", CHECKBOX_LABEL_CLASSNAMES[controlSize]), children: [
|
|
654
|
+
label,
|
|
655
|
+
required ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
656
|
+
] }) : null,
|
|
657
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-[13px] leading-[1.45] text-[var(--ui-kit-muted-text)]", children: hint }) : null,
|
|
658
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-[13px] font-semibold leading-[1.45] text-[var(--theme-negative)]", children: error }) : null
|
|
822
659
|
]
|
|
823
660
|
}
|
|
824
661
|
) : null
|
|
@@ -830,22 +667,11 @@ function Checkbox({
|
|
|
830
667
|
}
|
|
831
668
|
|
|
832
669
|
// src/components/ComposableModal.tsx
|
|
833
|
-
var
|
|
670
|
+
var import_react4 = require("react");
|
|
834
671
|
|
|
835
672
|
// src/components/Modal.tsx
|
|
836
|
-
var
|
|
673
|
+
var import_react3 = require("react");
|
|
837
674
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
838
|
-
var srOnlyStyle = {
|
|
839
|
-
position: "absolute",
|
|
840
|
-
width: 1,
|
|
841
|
-
height: 1,
|
|
842
|
-
padding: 0,
|
|
843
|
-
margin: -1,
|
|
844
|
-
overflow: "hidden",
|
|
845
|
-
clip: "rect(0, 0, 0, 0)",
|
|
846
|
-
whiteSpace: "nowrap",
|
|
847
|
-
border: 0
|
|
848
|
-
};
|
|
849
675
|
var isUiKitThemeTokens = (theme) => {
|
|
850
676
|
return Boolean(theme && typeof theme === "object" && "theme" in theme);
|
|
851
677
|
};
|
|
@@ -896,7 +722,6 @@ function ModalActionButton({
|
|
|
896
722
|
theme
|
|
897
723
|
}) {
|
|
898
724
|
var _a, _b;
|
|
899
|
-
const { colors } = theme;
|
|
900
725
|
const {
|
|
901
726
|
label,
|
|
902
727
|
onClick,
|
|
@@ -904,54 +729,24 @@ function ModalActionButton({
|
|
|
904
729
|
disabled = false,
|
|
905
730
|
style
|
|
906
731
|
} = action;
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
margin: 0,
|
|
920
|
-
textAlign: "center",
|
|
921
|
-
transition: "0.5s",
|
|
922
|
-
opacity: disabled ? DISABLED_COMPONENT_OPACITY : 1,
|
|
923
|
-
filter: disabled ? "saturate(0)" : void 0
|
|
924
|
-
};
|
|
925
|
-
if (appearance === "text") {
|
|
926
|
-
buttonStyle.background = "none";
|
|
927
|
-
buttonStyle.border = "1px solid transparent";
|
|
928
|
-
buttonStyle.color = colors.primary;
|
|
929
|
-
buttonStyle.boxShadow = "none";
|
|
930
|
-
} else if (appearance === "link") {
|
|
931
|
-
buttonStyle.background = "none";
|
|
932
|
-
buttonStyle.border = "none";
|
|
933
|
-
buttonStyle.color = colors.primary;
|
|
934
|
-
buttonStyle.boxShadow = "none";
|
|
935
|
-
} else if (appearance === "outlined") {
|
|
936
|
-
buttonStyle.background = "none";
|
|
937
|
-
buttonStyle.border = `2px solid ${colors.primary}`;
|
|
938
|
-
buttonStyle.color = colors.primary;
|
|
939
|
-
buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.text, 0.08)}`;
|
|
940
|
-
} else {
|
|
941
|
-
buttonStyle.background = colors.primary;
|
|
942
|
-
buttonStyle.border = "1px solid transparent";
|
|
943
|
-
buttonStyle.color = colors.onPrimary;
|
|
944
|
-
buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.primary, 0.22)}`;
|
|
945
|
-
}
|
|
732
|
+
const buttonClassName = cx(
|
|
733
|
+
"flex w-full items-center justify-center rounded-[0.4rem] box-border",
|
|
734
|
+
"m-0 text-center font-bold leading-[1.2]",
|
|
735
|
+
appearance === "link" ? "p-0 text-[1.05rem]" : "px-[1.15rem] py-[0.9rem] text-[1.05rem]",
|
|
736
|
+
disabled ? "cursor-not-allowed saturate-0" : "cursor-pointer",
|
|
737
|
+
appearance === "text" && "border border-transparent bg-transparent text-[var(--ui-kit-modal-primary)] shadow-none",
|
|
738
|
+
appearance === "link" && "border-0 bg-transparent text-[var(--ui-kit-modal-primary)] shadow-none",
|
|
739
|
+
appearance === "outlined" && "border-2 border-[var(--ui-kit-modal-primary)] bg-transparent",
|
|
740
|
+
appearance === "outlined" && "text-[var(--ui-kit-modal-primary)] shadow-[var(--ui-kit-modal-button-shadow-outlined)]",
|
|
741
|
+
appearance === "contained" && "border border-transparent bg-[var(--ui-kit-modal-primary)]",
|
|
742
|
+
appearance === "contained" && "text-[var(--ui-kit-modal-on-primary)] shadow-[var(--ui-kit-modal-button-shadow-contained)]"
|
|
743
|
+
);
|
|
946
744
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
947
745
|
"div",
|
|
948
746
|
{
|
|
747
|
+
className: "m-0 flex items-center justify-center",
|
|
949
748
|
style: {
|
|
950
749
|
width: (_a = style == null ? void 0 : style.width) != null ? _a : (style == null ? void 0 : style.maxWidth) ? "100%" : "max-content",
|
|
951
|
-
display: "flex",
|
|
952
|
-
alignItems: "center",
|
|
953
|
-
justifyContent: "center",
|
|
954
|
-
margin: 0,
|
|
955
750
|
marginBottom: (_b = style == null ? void 0 : style.marginBottom) != null ? _b : 0,
|
|
956
751
|
...style
|
|
957
752
|
},
|
|
@@ -961,7 +756,8 @@ function ModalActionButton({
|
|
|
961
756
|
type: "button",
|
|
962
757
|
onClick: disabled ? void 0 : onClick,
|
|
963
758
|
disabled,
|
|
964
|
-
|
|
759
|
+
className: buttonClassName,
|
|
760
|
+
style: { opacity: disabled ? DISABLED_COMPONENT_OPACITY : 1 },
|
|
965
761
|
children: label
|
|
966
762
|
}
|
|
967
763
|
)
|
|
@@ -976,19 +772,13 @@ function ModalBusyIndicator({
|
|
|
976
772
|
{
|
|
977
773
|
"aria-live": "polite",
|
|
978
774
|
role: "status",
|
|
775
|
+
className: "relative inline-flex h-14 w-14 items-center justify-center rounded-full",
|
|
979
776
|
style: {
|
|
980
|
-
position: "relative",
|
|
981
|
-
display: "inline-flex",
|
|
982
|
-
alignItems: "center",
|
|
983
|
-
justifyContent: "center",
|
|
984
|
-
width: 56,
|
|
985
|
-
height: 56,
|
|
986
|
-
borderRadius: 999,
|
|
987
777
|
backgroundColor: withAlpha(theme.colors.surface, 0.88),
|
|
988
778
|
boxShadow: `0 18px 36px ${withAlpha(theme.colors.text, 0.08)}`
|
|
989
779
|
},
|
|
990
780
|
children: [
|
|
991
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", {
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "ui-kit-sr-only", children: "Loading" }),
|
|
992
782
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { "aria-hidden": "true", width: "32", height: "32", viewBox: "0 0 40 40", fill: "none", children: [
|
|
993
783
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
994
784
|
"circle",
|
|
@@ -1025,6 +815,33 @@ function ModalBusyIndicator({
|
|
|
1025
815
|
}
|
|
1026
816
|
);
|
|
1027
817
|
}
|
|
818
|
+
function MaximizeIcon() {
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { "aria-hidden": "true", width: "15", height: "15", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: "4.25", y: "4.25", width: "11.5", height: "11.5", rx: "2.2", stroke: "currentColor", strokeWidth: "1.7" }) });
|
|
820
|
+
}
|
|
821
|
+
function MinimizeIcon() {
|
|
822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { "aria-hidden": "true", width: "15", height: "15", viewBox: "0 0 20 20", fill: "none", children: [
|
|
823
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
824
|
+
"path",
|
|
825
|
+
{
|
|
826
|
+
d: "M6.25 4.75H13a2.25 2.25 0 0 1 2.25 2.25v6.75",
|
|
827
|
+
stroke: "currentColor",
|
|
828
|
+
strokeWidth: "1.7",
|
|
829
|
+
strokeLinecap: "round",
|
|
830
|
+
strokeLinejoin: "round"
|
|
831
|
+
}
|
|
832
|
+
),
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
834
|
+
"path",
|
|
835
|
+
{
|
|
836
|
+
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",
|
|
837
|
+
stroke: "currentColor",
|
|
838
|
+
strokeWidth: "1.7",
|
|
839
|
+
strokeLinecap: "round",
|
|
840
|
+
strokeLinejoin: "round"
|
|
841
|
+
}
|
|
842
|
+
)
|
|
843
|
+
] });
|
|
844
|
+
}
|
|
1028
845
|
function UnifiedModal({
|
|
1029
846
|
isOpen,
|
|
1030
847
|
onClose,
|
|
@@ -1050,15 +867,30 @@ function UnifiedModal({
|
|
|
1050
867
|
}) {
|
|
1051
868
|
var _a, _b;
|
|
1052
869
|
const inheritedTheme = useUiKitTheme();
|
|
1053
|
-
const modalTheme = (0,
|
|
1054
|
-
const modalShadow = (0,
|
|
870
|
+
const modalTheme = (0, import_react3.useMemo)(() => resolveTheme(inheritedTheme, theme), [inheritedTheme, theme]);
|
|
871
|
+
const modalShadow = (0, import_react3.useMemo)(() => {
|
|
1055
872
|
return `0 34px 80px ${withAlpha(modalTheme.theme.colors.shadow, 0.28)}`;
|
|
1056
873
|
}, [modalTheme.theme.colors.shadow]);
|
|
1057
|
-
const controlShadow = (0,
|
|
1058
|
-
const
|
|
1059
|
-
|
|
874
|
+
const controlShadow = (0, import_react3.useMemo)(() => getComponentShadow(modalTheme.theme), [modalTheme.theme]);
|
|
875
|
+
const modalVariables = (0, import_react3.useMemo)(() => ({
|
|
876
|
+
"--ui-kit-modal-overlay": modalTheme.overlay,
|
|
877
|
+
"--ui-kit-modal-surface": modalTheme.colors.surface,
|
|
878
|
+
"--ui-kit-modal-surface-raised": modalTheme.surfaceRaised,
|
|
879
|
+
"--ui-kit-modal-text": modalTheme.colors.text,
|
|
880
|
+
"--ui-kit-modal-border-soft": modalTheme.borderSoft,
|
|
881
|
+
"--ui-kit-modal-divider": withAlpha(modalTheme.colors.text, 0.06),
|
|
882
|
+
"--ui-kit-modal-primary": modalTheme.colors.primary,
|
|
883
|
+
"--ui-kit-modal-on-primary": modalTheme.colors.onPrimary,
|
|
884
|
+
"--ui-kit-modal-shadow": modalShadow,
|
|
885
|
+
"--ui-kit-modal-control-shadow": controlShadow,
|
|
886
|
+
"--ui-kit-modal-busy-overlay": withAlpha(modalTheme.colors.surface, 0.58),
|
|
887
|
+
"--ui-kit-modal-button-shadow-outlined": `0 14px 28px ${withAlpha(modalTheme.colors.text, 0.08)}`,
|
|
888
|
+
"--ui-kit-modal-button-shadow-contained": `0 14px 28px ${withAlpha(modalTheme.colors.primary, 0.22)}`
|
|
889
|
+
}), [controlShadow, modalShadow, modalTheme]);
|
|
890
|
+
const [isMaximized, setIsMaximized] = (0, import_react3.useState)(maximized != null ? maximized : false);
|
|
891
|
+
const titleId = (0, import_react3.useMemo)(() => createTitleId(title), [title]);
|
|
1060
892
|
const shouldDisableDismiss = disableDismiss || isBusy;
|
|
1061
|
-
(0,
|
|
893
|
+
(0, import_react3.useEffect)(() => {
|
|
1062
894
|
if (typeof maximized === "boolean") {
|
|
1063
895
|
setIsMaximized(maximized);
|
|
1064
896
|
return;
|
|
@@ -1067,7 +899,7 @@ function UnifiedModal({
|
|
|
1067
899
|
setIsMaximized(true);
|
|
1068
900
|
}
|
|
1069
901
|
}, [maximized]);
|
|
1070
|
-
(0,
|
|
902
|
+
(0, import_react3.useEffect)(() => {
|
|
1071
903
|
if (!isOpen || typeof window === "undefined" || typeof document === "undefined") {
|
|
1072
904
|
return;
|
|
1073
905
|
}
|
|
@@ -1091,13 +923,7 @@ function UnifiedModal({
|
|
|
1091
923
|
"h2",
|
|
1092
924
|
{
|
|
1093
925
|
id: titleId,
|
|
1094
|
-
|
|
1095
|
-
margin: 0,
|
|
1096
|
-
color: modalTheme.colors.text,
|
|
1097
|
-
fontSize: 24,
|
|
1098
|
-
fontWeight: 800,
|
|
1099
|
-
lineHeight: 1.1
|
|
1100
|
-
},
|
|
926
|
+
className: "m-0 text-2xl font-extrabold leading-[1.1] text-[var(--ui-kit-modal-text)]",
|
|
1101
927
|
children: title
|
|
1102
928
|
}
|
|
1103
929
|
) : null;
|
|
@@ -1162,62 +988,49 @@ function UnifiedModal({
|
|
|
1162
988
|
onClose();
|
|
1163
989
|
}
|
|
1164
990
|
},
|
|
991
|
+
className: "fixed inset-0 z-[70] flex items-center justify-center backdrop-blur-[8px]",
|
|
1165
992
|
style: {
|
|
1166
|
-
|
|
1167
|
-
inset: 0,
|
|
1168
|
-
zIndex: 70,
|
|
1169
|
-
display: "flex",
|
|
1170
|
-
alignItems: "center",
|
|
1171
|
-
justifyContent: "center",
|
|
993
|
+
...modalVariables,
|
|
1172
994
|
padding: isMaximized ? 0 : 16,
|
|
1173
|
-
backgroundColor:
|
|
1174
|
-
backdropFilter: "blur(8px)"
|
|
995
|
+
backgroundColor: "var(--ui-kit-modal-overlay)"
|
|
1175
996
|
},
|
|
1176
997
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1177
998
|
"div",
|
|
1178
999
|
{
|
|
1000
|
+
className: cx(
|
|
1001
|
+
"relative flex flex-col overflow-hidden border",
|
|
1002
|
+
"bg-[linear-gradient(180deg,var(--ui-kit-modal-surface-raised),var(--ui-kit-modal-surface))]",
|
|
1003
|
+
"text-[var(--ui-kit-modal-text)]",
|
|
1004
|
+
isMaximized ? "rounded-none" : "rounded-[30px]"
|
|
1005
|
+
),
|
|
1179
1006
|
style: {
|
|
1180
|
-
position: "relative",
|
|
1181
|
-
display: "flex",
|
|
1182
|
-
flexDirection: "column",
|
|
1183
1007
|
width: isMaximized ? "100vw" : "min(100%, 100%)",
|
|
1184
1008
|
maxWidth: isMaximized ? "100vw" : normalizeWidth(maxWidth),
|
|
1185
1009
|
height: isMaximized ? "100vh" : void 0,
|
|
1186
1010
|
maxHeight: isMaximized ? "100vh" : "calc(100vh - 32px)",
|
|
1187
1011
|
minWidth: isMaximized ? "100vw" : 300,
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,
|
|
1191
|
-
boxShadow: modalShadow,
|
|
1192
|
-
color: modalTheme.colors.text,
|
|
1193
|
-
overflow: "hidden",
|
|
1012
|
+
borderColor: "var(--ui-kit-modal-border-soft)",
|
|
1013
|
+
boxShadow: "var(--ui-kit-modal-shadow)",
|
|
1194
1014
|
...contentStyle
|
|
1195
1015
|
},
|
|
1196
1016
|
children: [
|
|
1197
1017
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1198
1018
|
"div",
|
|
1199
1019
|
{
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
alignItems: "flex-start",
|
|
1203
|
-
justifyContent: "space-between",
|
|
1204
|
-
gap: 12,
|
|
1205
|
-
padding: "18px 20px 12px",
|
|
1206
|
-
borderBottom: `1px solid ${withAlpha(modalTheme.colors.text, 0.06)}`
|
|
1207
|
-
},
|
|
1020
|
+
className: "flex items-start justify-between gap-3 border-b px-5 pb-3 pt-[18px]",
|
|
1021
|
+
style: { borderColor: "var(--ui-kit-modal-divider)" },
|
|
1208
1022
|
children: [
|
|
1209
1023
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1210
1024
|
"div",
|
|
1211
1025
|
{
|
|
1212
|
-
|
|
1213
|
-
flex
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
},
|
|
1026
|
+
className: cx(
|
|
1027
|
+
"flex-1 transition-opacity duration-150",
|
|
1028
|
+
isBusy ? "opacity-[0.38]" : "opacity-100"
|
|
1029
|
+
),
|
|
1217
1030
|
children: resolvedHeader
|
|
1218
1031
|
}
|
|
1219
1032
|
),
|
|
1220
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", {
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1221
1034
|
!hideExpandButton ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1222
1035
|
"button",
|
|
1223
1036
|
{
|
|
@@ -1225,19 +1038,9 @@ function UnifiedModal({
|
|
|
1225
1038
|
title: isMaximized ? "Minimize" : "Maximize",
|
|
1226
1039
|
type: "button",
|
|
1227
1040
|
onClick: () => setIsMaximized((current) => !current),
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
borderRadius: 999,
|
|
1232
|
-
border: `1px solid ${modalTheme.borderSoft}`,
|
|
1233
|
-
backgroundColor: "transparent",
|
|
1234
|
-
color: modalTheme.colors.text,
|
|
1235
|
-
cursor: "pointer",
|
|
1236
|
-
fontSize: 18,
|
|
1237
|
-
fontWeight: 700,
|
|
1238
|
-
boxShadow: controlShadow
|
|
1239
|
-
},
|
|
1240
|
-
children: isMaximized ? "\u25A2" : "\u25A1"
|
|
1041
|
+
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)]",
|
|
1042
|
+
style: { borderColor: "var(--ui-kit-modal-border-soft)" },
|
|
1043
|
+
children: isMaximized ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MinimizeIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MaximizeIcon, {})
|
|
1241
1044
|
}
|
|
1242
1045
|
) : null,
|
|
1243
1046
|
!hideCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -1246,18 +1049,15 @@ function UnifiedModal({
|
|
|
1246
1049
|
"aria-label": "Close modal",
|
|
1247
1050
|
type: "button",
|
|
1248
1051
|
onClick: shouldDisableDismiss ? void 0 : onClose,
|
|
1052
|
+
className: cx(
|
|
1053
|
+
"flex h-[30px] w-[30px] items-center justify-center rounded-full border",
|
|
1054
|
+
"bg-transparent text-[20px] font-bold text-[var(--ui-kit-modal-text)]",
|
|
1055
|
+
"shadow-[var(--ui-kit-modal-control-shadow)]",
|
|
1056
|
+
shouldDisableDismiss ? "cursor-not-allowed" : "cursor-pointer"
|
|
1057
|
+
),
|
|
1249
1058
|
style: {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
borderRadius: 999,
|
|
1253
|
-
border: `1px solid ${modalTheme.borderSoft}`,
|
|
1254
|
-
backgroundColor: "transparent",
|
|
1255
|
-
color: modalTheme.colors.text,
|
|
1256
|
-
cursor: shouldDisableDismiss ? "not-allowed" : "pointer",
|
|
1257
|
-
fontSize: 20,
|
|
1258
|
-
fontWeight: 700,
|
|
1259
|
-
opacity: shouldDisableDismiss ? DISABLED_COMPONENT_OPACITY : 1,
|
|
1260
|
-
boxShadow: controlShadow
|
|
1059
|
+
borderColor: "var(--ui-kit-modal-border-soft)",
|
|
1060
|
+
opacity: shouldDisableDismiss ? DISABLED_COMPONENT_OPACITY : 1
|
|
1261
1061
|
},
|
|
1262
1062
|
children: "\xD7"
|
|
1263
1063
|
}
|
|
@@ -1269,39 +1069,23 @@ function UnifiedModal({
|
|
|
1269
1069
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1270
1070
|
"div",
|
|
1271
1071
|
{
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
minHeight: 0,
|
|
1275
|
-
position: "relative",
|
|
1276
|
-
overflow: "auto",
|
|
1277
|
-
padding: 24,
|
|
1278
|
-
...bodyStyle
|
|
1279
|
-
},
|
|
1072
|
+
className: "relative min-h-0 flex-1 overflow-auto p-6",
|
|
1073
|
+
style: bodyStyle,
|
|
1280
1074
|
children: [
|
|
1281
1075
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1282
1076
|
"div",
|
|
1283
1077
|
{
|
|
1284
|
-
|
|
1285
|
-
opacity
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
transition: "opacity 180ms ease, filter 180ms ease"
|
|
1289
|
-
},
|
|
1078
|
+
className: cx(
|
|
1079
|
+
"transition-[opacity,filter] duration-150",
|
|
1080
|
+
isBusy ? "pointer-events-none opacity-[0.38] saturate-[0.8]" : "pointer-events-auto opacity-100 saturate-100"
|
|
1081
|
+
),
|
|
1290
1082
|
children
|
|
1291
1083
|
}
|
|
1292
1084
|
),
|
|
1293
1085
|
isBusy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1294
1086
|
"div",
|
|
1295
1087
|
{
|
|
1296
|
-
|
|
1297
|
-
position: "absolute",
|
|
1298
|
-
inset: 0,
|
|
1299
|
-
display: "flex",
|
|
1300
|
-
alignItems: "center",
|
|
1301
|
-
justifyContent: "center",
|
|
1302
|
-
backgroundColor: withAlpha(modalTheme.colors.surface, 0.58),
|
|
1303
|
-
backdropFilter: "blur(2px)"
|
|
1304
|
-
},
|
|
1088
|
+
className: "absolute inset-0 flex items-center justify-center bg-[var(--ui-kit-modal-busy-overlay)] backdrop-blur-[2px]",
|
|
1305
1089
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ModalBusyIndicator, { theme: modalTheme })
|
|
1306
1090
|
}
|
|
1307
1091
|
) : null
|
|
@@ -1311,13 +1095,8 @@ function UnifiedModal({
|
|
|
1311
1095
|
shouldRenderFooter ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1312
1096
|
"div",
|
|
1313
1097
|
{
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
justifyContent: "flex-end",
|
|
1317
|
-
gap: 10,
|
|
1318
|
-
padding: "12px 20px 16px",
|
|
1319
|
-
borderTop: `1px solid ${withAlpha(modalTheme.colors.text, 0.06)}`
|
|
1320
|
-
},
|
|
1098
|
+
className: "flex justify-end gap-2.5 border-t px-5 pb-4 pt-3",
|
|
1099
|
+
style: { borderColor: "var(--ui-kit-modal-divider)" },
|
|
1321
1100
|
children: footerContent
|
|
1322
1101
|
}
|
|
1323
1102
|
) : null
|
|
@@ -1360,7 +1139,7 @@ function ComposableModal({
|
|
|
1360
1139
|
children
|
|
1361
1140
|
}) {
|
|
1362
1141
|
const slotIds = createModalSlotIds(slotBaseId);
|
|
1363
|
-
const context = (0,
|
|
1142
|
+
const context = (0, import_react4.useMemo)(
|
|
1364
1143
|
() => ({
|
|
1365
1144
|
title,
|
|
1366
1145
|
payload,
|
|
@@ -1380,12 +1159,7 @@ function ComposableModal({
|
|
|
1380
1159
|
const defaultHeader = headerFallback != null ? headerFallback : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1381
1160
|
"h2",
|
|
1382
1161
|
{
|
|
1383
|
-
|
|
1384
|
-
margin: 0,
|
|
1385
|
-
fontSize: 30,
|
|
1386
|
-
fontWeight: 800,
|
|
1387
|
-
lineHeight: 1.1
|
|
1388
|
-
},
|
|
1162
|
+
className: "m-0 text-[24px] font-extrabold leading-[1.1]",
|
|
1389
1163
|
children: title
|
|
1390
1164
|
}
|
|
1391
1165
|
);
|
|
@@ -1422,10 +1196,10 @@ function ComposableModal({
|
|
|
1422
1196
|
}
|
|
1423
1197
|
|
|
1424
1198
|
// src/components/DatePicker.tsx
|
|
1425
|
-
var
|
|
1199
|
+
var import_react6 = require("react");
|
|
1426
1200
|
|
|
1427
1201
|
// src/components/Input.tsx
|
|
1428
|
-
var
|
|
1202
|
+
var import_react5 = require("react");
|
|
1429
1203
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1430
1204
|
var PASSWORD_TOGGLE_METRICS_BY_SIZE = {
|
|
1431
1205
|
sm: {
|
|
@@ -1435,18 +1209,33 @@ var PASSWORD_TOGGLE_METRICS_BY_SIZE = {
|
|
|
1435
1209
|
iconSize: 14
|
|
1436
1210
|
},
|
|
1437
1211
|
md: {
|
|
1212
|
+
buttonSize: 19,
|
|
1213
|
+
leftOffset: 9,
|
|
1214
|
+
contentGap: 9,
|
|
1215
|
+
iconSize: 15
|
|
1216
|
+
},
|
|
1217
|
+
lg: {
|
|
1438
1218
|
buttonSize: 20,
|
|
1439
1219
|
leftOffset: 10,
|
|
1440
1220
|
contentGap: 10,
|
|
1441
1221
|
iconSize: 16
|
|
1442
|
-
},
|
|
1443
|
-
lg: {
|
|
1444
|
-
buttonSize: 22,
|
|
1445
|
-
leftOffset: 12,
|
|
1446
|
-
contentGap: 12,
|
|
1447
|
-
iconSize: 18
|
|
1448
1222
|
}
|
|
1449
1223
|
};
|
|
1224
|
+
var FIELD_HEIGHT_CLASSNAMES = {
|
|
1225
|
+
sm: "h-[30px]",
|
|
1226
|
+
md: "h-[34px]",
|
|
1227
|
+
lg: "h-[38px]"
|
|
1228
|
+
};
|
|
1229
|
+
var FIELD_TEXT_CLASSNAMES = {
|
|
1230
|
+
sm: "text-[13px] leading-4",
|
|
1231
|
+
md: "text-sm leading-[18px]",
|
|
1232
|
+
lg: "text-[15px] leading-[18px]"
|
|
1233
|
+
};
|
|
1234
|
+
var FIELD_PADDING_X_CLASSNAMES = {
|
|
1235
|
+
sm: "px-3",
|
|
1236
|
+
md: "px-[14px]",
|
|
1237
|
+
lg: "px-4"
|
|
1238
|
+
};
|
|
1450
1239
|
var getPasswordToggleMetrics = (size) => PASSWORD_TOGGLE_METRICS_BY_SIZE[size];
|
|
1451
1240
|
function ControlFrame({
|
|
1452
1241
|
label,
|
|
@@ -1458,88 +1247,40 @@ function ControlFrame({
|
|
|
1458
1247
|
children,
|
|
1459
1248
|
style
|
|
1460
1249
|
}) {
|
|
1461
|
-
|
|
1250
|
+
useUiKitTheme();
|
|
1462
1251
|
if (!label && !hint && !error) {
|
|
1463
1252
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children });
|
|
1464
1253
|
}
|
|
1465
|
-
const labelStyle = {
|
|
1466
|
-
color: theme.colors.text,
|
|
1467
|
-
fontSize: 14,
|
|
1468
|
-
fontWeight: 700,
|
|
1469
|
-
letterSpacing: "0.01em"
|
|
1470
|
-
};
|
|
1471
|
-
const wrapperStyle = {
|
|
1472
|
-
display: "flex",
|
|
1473
|
-
flexDirection: "column",
|
|
1474
|
-
gap: 8,
|
|
1475
|
-
width: "100%",
|
|
1476
|
-
...style
|
|
1477
|
-
};
|
|
1478
1254
|
if (!useLabelWrapper) {
|
|
1479
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", {
|
|
1480
|
-
label || hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", {
|
|
1481
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1482
|
-
label,
|
|
1483
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: theme.colors.negative, marginLeft: 4 }, children: "*" }) : null
|
|
1484
|
-
] }) : null,
|
|
1485
|
-
hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1486
|
-
"span",
|
|
1255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full flex-col gap-2", style, children: [
|
|
1256
|
+
label || hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1257
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1258
|
+
"label",
|
|
1487
1259
|
{
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1260
|
+
htmlFor,
|
|
1261
|
+
className: "text-sm font-bold tracking-[0.01em] text-[var(--theme-text)]",
|
|
1262
|
+
children: [
|
|
1263
|
+
label,
|
|
1264
|
+
required ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
1265
|
+
]
|
|
1494
1266
|
}
|
|
1495
|
-
) : null
|
|
1267
|
+
) : null,
|
|
1268
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-[13px] leading-[1.45] text-[var(--ui-kit-muted-text)]", children: hint }) : null
|
|
1496
1269
|
] }) : null,
|
|
1497
1270
|
children,
|
|
1498
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1499
|
-
"span",
|
|
1500
|
-
{
|
|
1501
|
-
style: {
|
|
1502
|
-
color: theme.colors.negative,
|
|
1503
|
-
fontSize: 13,
|
|
1504
|
-
fontWeight: 600,
|
|
1505
|
-
lineHeight: 1.45
|
|
1506
|
-
},
|
|
1507
|
-
children: error
|
|
1508
|
-
}
|
|
1509
|
-
) : null
|
|
1271
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-[13px] font-semibold leading-[1.45] text-[var(--theme-negative)]", children: error }) : null
|
|
1510
1272
|
] });
|
|
1511
1273
|
}
|
|
1512
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { htmlFor,
|
|
1513
|
-
label || hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", {
|
|
1514
|
-
label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", {
|
|
1274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { htmlFor, className: "flex w-full flex-col gap-2", style, children: [
|
|
1275
|
+
label || hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1276
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "text-sm font-bold tracking-[0.01em] text-[var(--theme-text)]", children: [
|
|
1515
1277
|
label,
|
|
1516
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", {
|
|
1278
|
+
required ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ml-1 text-[var(--theme-negative)]", children: "*" }) : null
|
|
1517
1279
|
] }) : null,
|
|
1518
|
-
hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1519
|
-
"span",
|
|
1520
|
-
{
|
|
1521
|
-
style: {
|
|
1522
|
-
color: mutedText,
|
|
1523
|
-
fontSize: 13,
|
|
1524
|
-
lineHeight: 1.45
|
|
1525
|
-
},
|
|
1526
|
-
children: hint
|
|
1527
|
-
}
|
|
1528
|
-
) : null
|
|
1280
|
+
hint ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-[13px] leading-[1.45] text-[var(--ui-kit-muted-text)]", children: hint }) : null
|
|
1529
1281
|
] }) : null,
|
|
1530
1282
|
children,
|
|
1531
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1532
|
-
"span",
|
|
1533
|
-
{
|
|
1534
|
-
style: {
|
|
1535
|
-
color: theme.colors.negative,
|
|
1536
|
-
fontSize: 13,
|
|
1537
|
-
fontWeight: 600,
|
|
1538
|
-
lineHeight: 1.45
|
|
1539
|
-
},
|
|
1540
|
-
children: error
|
|
1541
|
-
}
|
|
1542
|
-
) : null
|
|
1283
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-[13px] font-semibold leading-[1.45] text-[var(--theme-negative)]", children: error }) : null
|
|
1543
1284
|
] });
|
|
1544
1285
|
}
|
|
1545
1286
|
function Input({
|
|
@@ -1547,6 +1288,7 @@ function Input({
|
|
|
1547
1288
|
hint,
|
|
1548
1289
|
error,
|
|
1549
1290
|
controlSize = "sm",
|
|
1291
|
+
className,
|
|
1550
1292
|
showPasswordToggle = true,
|
|
1551
1293
|
fileButtonLabel,
|
|
1552
1294
|
id,
|
|
@@ -1557,49 +1299,27 @@ function Input({
|
|
|
1557
1299
|
type = "text",
|
|
1558
1300
|
...rest
|
|
1559
1301
|
}) {
|
|
1560
|
-
|
|
1302
|
+
useUiKitTheme();
|
|
1561
1303
|
const controlMetrics = getControlMetrics(controlSize);
|
|
1562
|
-
const componentShadow = getComponentShadow(theme);
|
|
1563
1304
|
const passwordToggleMetrics = getPasswordToggleMetrics(controlSize);
|
|
1564
|
-
const generatedId = (0,
|
|
1305
|
+
const generatedId = (0, import_react5.useId)();
|
|
1565
1306
|
const inputId = id != null ? id : generatedId;
|
|
1566
|
-
const fileInputRef = (0,
|
|
1567
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
1568
|
-
const [selectedFileNames, setSelectedFileNames] = (0,
|
|
1307
|
+
const fileInputRef = (0, import_react5.useRef)(null);
|
|
1308
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react5.useState)(false);
|
|
1309
|
+
const [selectedFileNames, setSelectedFileNames] = (0, import_react5.useState)([]);
|
|
1569
1310
|
const isPasswordField = type === "password";
|
|
1570
1311
|
const isEmailField = type === "email";
|
|
1571
1312
|
const isFileField = type === "file";
|
|
1572
1313
|
const canTogglePasswordVisibility = isPasswordField && showPasswordToggle;
|
|
1573
1314
|
const resolvedType = canTogglePasswordVisibility ? isPasswordVisible ? "text" : "password" : type;
|
|
1574
|
-
(0,
|
|
1315
|
+
(0, import_react5.useEffect)(() => {
|
|
1575
1316
|
if (!isFileField) {
|
|
1576
1317
|
setSelectedFileNames([]);
|
|
1577
1318
|
}
|
|
1578
1319
|
}, [isFileField]);
|
|
1579
|
-
const inputBorderColor = error ? theme.colors.negative : theme.colors.textLight;
|
|
1580
|
-
const adornedFieldShadow = `0 0 0 1px ${inputBorderColor}, ${componentShadow}`;
|
|
1581
|
-
const inputStyle = {
|
|
1582
|
-
width: "100%",
|
|
1583
|
-
boxSizing: "border-box",
|
|
1584
|
-
height: controlMetrics.height,
|
|
1585
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
1586
|
-
border: `1px solid ${inputBorderColor}`,
|
|
1587
|
-
backgroundColor: theme.colors.surface,
|
|
1588
|
-
color: theme.colors.text,
|
|
1589
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
1590
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
1591
|
-
padding: getTextInputPadding(controlSize),
|
|
1592
|
-
outline: "none",
|
|
1593
|
-
boxShadow: componentShadow,
|
|
1594
|
-
fontSize: controlMetrics.fontSize,
|
|
1595
|
-
lineHeight: controlMetrics.lineHeight,
|
|
1596
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
1597
|
-
...style
|
|
1598
|
-
};
|
|
1599
1320
|
const hasFileButtonLabel = typeof fileButtonLabel === "string" ? fileButtonLabel.trim().length > 0 : fileButtonLabel != null;
|
|
1600
1321
|
const hasSelectedFiles = selectedFileNames.length > 0;
|
|
1601
1322
|
const showUploadLabel = hasFileButtonLabel && !hasSelectedFiles;
|
|
1602
|
-
const inputPlaceholderColor = withAlpha(theme.colors.text, 0.5);
|
|
1603
1323
|
const passwordLockIconSize = passwordToggleMetrics.iconSize + 2;
|
|
1604
1324
|
const leadingContentGap = Math.max(0, Math.round(controlMetrics.paddingX / 3));
|
|
1605
1325
|
const fileSelectionText = selectedFileNames.length === 0 ? placeholder != null ? placeholder : "" : selectedFileNames.length === 1 ? selectedFileNames[0] : `${selectedFileNames.length} files selected`;
|
|
@@ -1607,144 +1327,32 @@ function Input({
|
|
|
1607
1327
|
const fileTriggerWidth = controlMetrics.paddingX + fileIconSize;
|
|
1608
1328
|
const emailAdornmentWidth = controlMetrics.paddingX + fileIconSize;
|
|
1609
1329
|
const passwordAdornmentWidth = controlMetrics.paddingX + passwordLockIconSize;
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
border
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
alignItems: "center",
|
|
1637
|
-
justifyContent: "center",
|
|
1638
|
-
color: inputBorderColor
|
|
1639
|
-
};
|
|
1640
|
-
const fileFieldStyle = {
|
|
1641
|
-
width: "100%",
|
|
1642
|
-
boxSizing: "border-box",
|
|
1643
|
-
height: controlMetrics.height,
|
|
1644
|
-
display: "flex",
|
|
1645
|
-
alignItems: "center",
|
|
1646
|
-
gap: 0,
|
|
1647
|
-
overflow: "hidden",
|
|
1648
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
1649
|
-
border: "none",
|
|
1650
|
-
backgroundColor: theme.colors.surface,
|
|
1651
|
-
color: theme.colors.text,
|
|
1652
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
1653
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
1654
|
-
padding: 0,
|
|
1655
|
-
outline: "none",
|
|
1656
|
-
boxShadow: adornedFieldShadow,
|
|
1657
|
-
transition: "box-shadow 160ms ease, background-color 160ms ease",
|
|
1658
|
-
textAlign: "left",
|
|
1659
|
-
...style
|
|
1660
|
-
};
|
|
1661
|
-
const fileSelectionStyle = {
|
|
1662
|
-
flex: 1,
|
|
1663
|
-
minWidth: 0,
|
|
1664
|
-
height: "100%",
|
|
1665
|
-
display: "flex",
|
|
1666
|
-
alignItems: "center",
|
|
1667
|
-
padding: 0,
|
|
1668
|
-
border: "none",
|
|
1669
|
-
backgroundColor: "transparent",
|
|
1670
|
-
textAlign: "left",
|
|
1671
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
1672
|
-
appearance: "none"
|
|
1673
|
-
};
|
|
1674
|
-
const fileSelectionTextStyle = {
|
|
1675
|
-
flex: 1,
|
|
1676
|
-
display: "flex",
|
|
1677
|
-
alignItems: "center",
|
|
1678
|
-
height: "100%",
|
|
1679
|
-
minWidth: 0,
|
|
1680
|
-
overflow: "hidden",
|
|
1681
|
-
textOverflow: "ellipsis",
|
|
1682
|
-
whiteSpace: "nowrap",
|
|
1683
|
-
color: selectedFileNames.length === 0 ? inputPlaceholderColor : theme.colors.text,
|
|
1684
|
-
fontSize: controlMetrics.fontSize,
|
|
1685
|
-
lineHeight: controlMetrics.lineHeight,
|
|
1686
|
-
padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px`
|
|
1687
|
-
};
|
|
1688
|
-
const emailFieldStyle = {
|
|
1689
|
-
width: "100%",
|
|
1690
|
-
boxSizing: "border-box",
|
|
1691
|
-
height: controlMetrics.height,
|
|
1692
|
-
display: "flex",
|
|
1693
|
-
alignItems: "center",
|
|
1694
|
-
gap: 0,
|
|
1695
|
-
overflow: "hidden",
|
|
1696
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
1697
|
-
border: "none",
|
|
1698
|
-
backgroundColor: theme.colors.surface,
|
|
1699
|
-
color: theme.colors.text,
|
|
1700
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
1701
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
1702
|
-
padding: 0,
|
|
1703
|
-
outline: "none",
|
|
1704
|
-
boxShadow: adornedFieldShadow,
|
|
1705
|
-
transition: "box-shadow 160ms ease, background-color 160ms ease",
|
|
1706
|
-
textAlign: "left",
|
|
1707
|
-
...style
|
|
1708
|
-
};
|
|
1709
|
-
const emailAdornmentStyle = {
|
|
1710
|
-
flexShrink: 0,
|
|
1711
|
-
display: "inline-flex",
|
|
1712
|
-
alignItems: "center",
|
|
1713
|
-
justifyContent: "center",
|
|
1714
|
-
alignSelf: "stretch",
|
|
1715
|
-
boxSizing: "border-box",
|
|
1716
|
-
width: emailAdornmentWidth,
|
|
1717
|
-
backgroundColor: "transparent",
|
|
1718
|
-
color: inputBorderColor
|
|
1719
|
-
};
|
|
1720
|
-
const emailInputStyle = {
|
|
1721
|
-
flex: 1,
|
|
1722
|
-
minWidth: 0,
|
|
1723
|
-
height: "100%",
|
|
1724
|
-
boxSizing: "border-box",
|
|
1725
|
-
border: "none",
|
|
1726
|
-
backgroundColor: "transparent",
|
|
1727
|
-
color: theme.colors.text,
|
|
1728
|
-
cursor: disabled ? "not-allowed" : "text",
|
|
1729
|
-
padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px`,
|
|
1730
|
-
outline: "none",
|
|
1731
|
-
fontSize: controlMetrics.fontSize,
|
|
1732
|
-
lineHeight: controlMetrics.lineHeight
|
|
1733
|
-
};
|
|
1734
|
-
const passwordFieldStyle = {
|
|
1735
|
-
...emailFieldStyle
|
|
1736
|
-
};
|
|
1737
|
-
const passwordToggleStyle = {
|
|
1738
|
-
border: "none",
|
|
1739
|
-
...emailAdornmentStyle,
|
|
1740
|
-
width: passwordAdornmentWidth,
|
|
1741
|
-
padding: 0,
|
|
1742
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
1743
|
-
appearance: "none"
|
|
1744
|
-
};
|
|
1745
|
-
const passwordInputStyle = {
|
|
1746
|
-
...emailInputStyle
|
|
1747
|
-
};
|
|
1330
|
+
const fieldBorderColor = error ? "var(--theme-negative)" : "var(--theme-textLight)";
|
|
1331
|
+
const fieldBaseClassName = cx(
|
|
1332
|
+
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
1333
|
+
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
1334
|
+
"duration-150 placeholder:text-[var(--ui-kit-placeholder)]",
|
|
1335
|
+
FIELD_HEIGHT_CLASSNAMES[controlSize],
|
|
1336
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1337
|
+
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
1338
|
+
disabled ? "cursor-not-allowed opacity-70" : "cursor-text"
|
|
1339
|
+
);
|
|
1340
|
+
const adornedFieldClassName = cx(
|
|
1341
|
+
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
1342
|
+
"bg-[var(--theme-surface)] text-[var(--theme-text)] text-left",
|
|
1343
|
+
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
1344
|
+
FIELD_HEIGHT_CLASSNAMES[controlSize],
|
|
1345
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1346
|
+
disabled ? "opacity-70" : null
|
|
1347
|
+
);
|
|
1348
|
+
const adornedFieldBoxShadow = getInsetBorderShadow(fieldBorderColor);
|
|
1349
|
+
const adornedInputClassName = cx(
|
|
1350
|
+
"h-full min-w-0 flex-1 border-0 bg-transparent text-[var(--theme-text)] outline-none",
|
|
1351
|
+
"placeholder:text-[var(--ui-kit-placeholder)]",
|
|
1352
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1353
|
+
disabled ? "cursor-not-allowed" : "cursor-text"
|
|
1354
|
+
);
|
|
1355
|
+
const adornmentColorClassName = error ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]";
|
|
1748
1356
|
const openFilePicker = () => {
|
|
1749
1357
|
var _a;
|
|
1750
1358
|
if (disabled) {
|
|
@@ -1775,82 +1383,201 @@ function Input({
|
|
|
1775
1383
|
setSelectedFileNames(Array.from((_a = event.target.files) != null ? _a : [], (file) => file.name));
|
|
1776
1384
|
onChange == null ? void 0 : onChange(event);
|
|
1777
1385
|
},
|
|
1778
|
-
|
|
1386
|
+
className: "hidden"
|
|
1779
1387
|
}
|
|
1780
1388
|
),
|
|
1781
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
disabled,
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
"
|
|
1804
|
-
|
|
1805
|
-
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",
|
|
1806
|
-
stroke: "currentColor",
|
|
1807
|
-
strokeWidth: "1.6",
|
|
1808
|
-
strokeLinecap: "round",
|
|
1809
|
-
strokeLinejoin: "round"
|
|
1810
|
-
}
|
|
1811
|
-
),
|
|
1812
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1813
|
-
"path",
|
|
1814
|
-
{
|
|
1815
|
-
d: "M7.75 8.25v5.5",
|
|
1816
|
-
stroke: "currentColor",
|
|
1817
|
-
strokeWidth: "1.6",
|
|
1818
|
-
strokeLinecap: "round"
|
|
1819
|
-
}
|
|
1820
|
-
),
|
|
1821
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1822
|
-
"path",
|
|
1823
|
-
{
|
|
1824
|
-
d: "M10 8.25v5.5",
|
|
1825
|
-
stroke: "currentColor",
|
|
1826
|
-
strokeWidth: "1.6",
|
|
1827
|
-
strokeLinecap: "round"
|
|
1828
|
-
}
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1390
|
+
"div",
|
|
1391
|
+
{
|
|
1392
|
+
className: cx(
|
|
1393
|
+
adornedFieldClassName,
|
|
1394
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1395
|
+
className
|
|
1396
|
+
),
|
|
1397
|
+
style: { boxShadow: adornedFieldBoxShadow, ...style },
|
|
1398
|
+
children: [
|
|
1399
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1400
|
+
"button",
|
|
1401
|
+
{
|
|
1402
|
+
type: "button",
|
|
1403
|
+
disabled,
|
|
1404
|
+
"aria-controls": inputId,
|
|
1405
|
+
"aria-label": hasSelectedFiles ? rest.multiple ? "Remove selected files" : "Remove selected file" : rest.multiple ? "Select files" : "Select file",
|
|
1406
|
+
onClick: hasSelectedFiles ? clearSelectedFiles : openFilePicker,
|
|
1407
|
+
className: cx(
|
|
1408
|
+
"inline-flex shrink-0 self-stretch whitespace-nowrap border-0 bg-transparent",
|
|
1409
|
+
"items-center text-[var(--theme-text)] appearance-none",
|
|
1410
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1411
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer",
|
|
1412
|
+
showUploadLabel ? "justify-start font-bold" : "justify-center"
|
|
1829
1413
|
),
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1414
|
+
style: {
|
|
1415
|
+
gap: showUploadLabel ? leadingContentGap : 0,
|
|
1416
|
+
width: showUploadLabel ? void 0 : fileTriggerWidth,
|
|
1417
|
+
padding: showUploadLabel ? `0 ${controlMetrics.buttonPaddingX}px 0 ${Math.max(8, Math.round(controlMetrics.paddingX / 2))}px` : 0
|
|
1418
|
+
},
|
|
1419
|
+
children: [
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1421
|
+
"span",
|
|
1422
|
+
{
|
|
1423
|
+
className: cx(
|
|
1424
|
+
"inline-flex shrink-0 items-center justify-center",
|
|
1425
|
+
adornmentColorClassName
|
|
1426
|
+
),
|
|
1427
|
+
"aria-hidden": "true",
|
|
1428
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: fileIconSize, height: fileIconSize, viewBox: "0 0 20 20", fill: "none", children: hasSelectedFiles ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1430
|
+
"path",
|
|
1431
|
+
{
|
|
1432
|
+
d: "M5.5 6.25h9",
|
|
1433
|
+
stroke: "currentColor",
|
|
1434
|
+
strokeWidth: "1.6",
|
|
1435
|
+
strokeLinecap: "round"
|
|
1436
|
+
}
|
|
1437
|
+
),
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1439
|
+
"path",
|
|
1440
|
+
{
|
|
1441
|
+
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",
|
|
1442
|
+
stroke: "currentColor",
|
|
1443
|
+
strokeWidth: "1.6",
|
|
1444
|
+
strokeLinecap: "round",
|
|
1445
|
+
strokeLinejoin: "round"
|
|
1446
|
+
}
|
|
1447
|
+
),
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1449
|
+
"path",
|
|
1450
|
+
{
|
|
1451
|
+
d: "M7.75 8.25v5.5",
|
|
1452
|
+
stroke: "currentColor",
|
|
1453
|
+
strokeWidth: "1.6",
|
|
1454
|
+
strokeLinecap: "round"
|
|
1455
|
+
}
|
|
1456
|
+
),
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1458
|
+
"path",
|
|
1459
|
+
{
|
|
1460
|
+
d: "M10 8.25v5.5",
|
|
1461
|
+
stroke: "currentColor",
|
|
1462
|
+
strokeWidth: "1.6",
|
|
1463
|
+
strokeLinecap: "round"
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1467
|
+
"path",
|
|
1468
|
+
{
|
|
1469
|
+
d: "M12.25 8.25v5.5",
|
|
1470
|
+
stroke: "currentColor",
|
|
1471
|
+
strokeWidth: "1.6",
|
|
1472
|
+
strokeLinecap: "round"
|
|
1473
|
+
}
|
|
1474
|
+
),
|
|
1475
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1476
|
+
"path",
|
|
1477
|
+
{
|
|
1478
|
+
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",
|
|
1479
|
+
stroke: "currentColor",
|
|
1480
|
+
strokeWidth: "1.6",
|
|
1481
|
+
strokeLinecap: "round",
|
|
1482
|
+
strokeLinejoin: "round"
|
|
1483
|
+
}
|
|
1484
|
+
)
|
|
1485
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1487
|
+
"path",
|
|
1488
|
+
{
|
|
1489
|
+
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",
|
|
1490
|
+
stroke: "currentColor",
|
|
1491
|
+
strokeWidth: "1.6",
|
|
1492
|
+
strokeLinecap: "round",
|
|
1493
|
+
strokeLinejoin: "round"
|
|
1494
|
+
}
|
|
1495
|
+
),
|
|
1496
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1497
|
+
"path",
|
|
1498
|
+
{
|
|
1499
|
+
d: "M11.875 2.75V6.25H15.375",
|
|
1500
|
+
stroke: "currentColor",
|
|
1501
|
+
strokeWidth: "1.6",
|
|
1502
|
+
strokeLinecap: "round",
|
|
1503
|
+
strokeLinejoin: "round"
|
|
1504
|
+
}
|
|
1505
|
+
),
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1507
|
+
"path",
|
|
1508
|
+
{
|
|
1509
|
+
d: "M7.5 10h5",
|
|
1510
|
+
stroke: "currentColor",
|
|
1511
|
+
strokeWidth: "1.6",
|
|
1512
|
+
strokeLinecap: "round"
|
|
1513
|
+
}
|
|
1514
|
+
),
|
|
1515
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1516
|
+
"path",
|
|
1517
|
+
{
|
|
1518
|
+
d: "M7.5 13h5",
|
|
1519
|
+
stroke: "currentColor",
|
|
1520
|
+
strokeWidth: "1.6",
|
|
1521
|
+
strokeLinecap: "round"
|
|
1522
|
+
}
|
|
1523
|
+
)
|
|
1524
|
+
] }) })
|
|
1525
|
+
}
|
|
1526
|
+
),
|
|
1527
|
+
showUploadLabel ? fileButtonLabel : null
|
|
1528
|
+
]
|
|
1529
|
+
}
|
|
1530
|
+
),
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1532
|
+
"button",
|
|
1533
|
+
{
|
|
1534
|
+
type: "button",
|
|
1535
|
+
disabled,
|
|
1536
|
+
"aria-controls": inputId,
|
|
1537
|
+
"aria-label": rest.multiple ? "Select files" : "Select file",
|
|
1538
|
+
onClick: openFilePicker,
|
|
1539
|
+
className: cx(
|
|
1540
|
+
"flex h-full min-w-0 flex-1 items-center border-0 bg-transparent p-0",
|
|
1541
|
+
"text-left appearance-none",
|
|
1542
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1838
1543
|
),
|
|
1839
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1840
|
-
"
|
|
1544
|
+
children: fileSelectionText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1545
|
+
"span",
|
|
1841
1546
|
{
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1547
|
+
className: cx(
|
|
1548
|
+
"flex h-full min-w-0 flex-1 items-center overflow-hidden text-ellipsis whitespace-nowrap",
|
|
1549
|
+
FIELD_TEXT_CLASSNAMES[controlSize],
|
|
1550
|
+
hasSelectedFiles ? "text-[var(--theme-text)]" : "text-[var(--ui-kit-placeholder)]"
|
|
1551
|
+
),
|
|
1552
|
+
style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` },
|
|
1553
|
+
children: fileSelectionText
|
|
1847
1554
|
}
|
|
1848
|
-
)
|
|
1849
|
-
|
|
1555
|
+
) : null
|
|
1556
|
+
}
|
|
1557
|
+
)
|
|
1558
|
+
]
|
|
1559
|
+
}
|
|
1560
|
+
)
|
|
1561
|
+
] }) : isEmailField ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1562
|
+
"div",
|
|
1563
|
+
{
|
|
1564
|
+
className: cx(adornedFieldClassName, className),
|
|
1565
|
+
style: { boxShadow: adornedFieldBoxShadow, ...style },
|
|
1566
|
+
children: [
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1568
|
+
"span",
|
|
1569
|
+
{
|
|
1570
|
+
className: cx(
|
|
1571
|
+
"inline-flex shrink-0 self-stretch items-center justify-center bg-transparent",
|
|
1572
|
+
adornmentColorClassName
|
|
1573
|
+
),
|
|
1574
|
+
style: { width: emailAdornmentWidth },
|
|
1575
|
+
"aria-hidden": "true",
|
|
1576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: fileIconSize, height: fileIconSize, viewBox: "0 0 20 20", fill: "none", children: [
|
|
1850
1577
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1851
1578
|
"path",
|
|
1852
1579
|
{
|
|
1853
|
-
d: "
|
|
1580
|
+
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",
|
|
1854
1581
|
stroke: "currentColor",
|
|
1855
1582
|
strokeWidth: "1.6",
|
|
1856
1583
|
strokeLinecap: "round",
|
|
@@ -1860,165 +1587,160 @@ function Input({
|
|
|
1860
1587
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1861
1588
|
"path",
|
|
1862
1589
|
{
|
|
1863
|
-
d: "
|
|
1590
|
+
d: "M4.375 6.25 10 10.625l5.625-4.375",
|
|
1864
1591
|
stroke: "currentColor",
|
|
1865
1592
|
strokeWidth: "1.6",
|
|
1866
1593
|
strokeLinecap: "round",
|
|
1867
1594
|
strokeLinejoin: "round"
|
|
1868
1595
|
}
|
|
1869
|
-
),
|
|
1870
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1871
|
-
"path",
|
|
1872
|
-
{
|
|
1873
|
-
d: "M7.5 10h5",
|
|
1874
|
-
stroke: "currentColor",
|
|
1875
|
-
strokeWidth: "1.6",
|
|
1876
|
-
strokeLinecap: "round"
|
|
1877
|
-
}
|
|
1878
|
-
),
|
|
1879
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1880
|
-
"path",
|
|
1881
|
-
{
|
|
1882
|
-
d: "M7.5 13h5",
|
|
1883
|
-
stroke: "currentColor",
|
|
1884
|
-
strokeWidth: "1.6",
|
|
1885
|
-
strokeLinecap: "round"
|
|
1886
|
-
}
|
|
1887
1596
|
)
|
|
1888
|
-
] })
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1894
|
-
"button",
|
|
1895
|
-
{
|
|
1896
|
-
type: "button",
|
|
1897
|
-
disabled,
|
|
1898
|
-
"aria-controls": inputId,
|
|
1899
|
-
"aria-label": rest.multiple ? "Select files" : "Select file",
|
|
1900
|
-
onClick: openFilePicker,
|
|
1901
|
-
style: fileSelectionStyle,
|
|
1902
|
-
children: fileSelectionText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: fileSelectionTextStyle, children: fileSelectionText }) : null
|
|
1903
|
-
}
|
|
1904
|
-
)
|
|
1905
|
-
] })
|
|
1906
|
-
] }) : isEmailField ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: emailFieldStyle, children: [
|
|
1907
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: emailAdornmentStyle, "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { width: fileIconSize, height: fileIconSize, viewBox: "0 0 20 20", fill: "none", children: [
|
|
1908
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1909
|
-
"path",
|
|
1910
|
-
{
|
|
1911
|
-
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",
|
|
1912
|
-
stroke: "currentColor",
|
|
1913
|
-
strokeWidth: "1.6",
|
|
1914
|
-
strokeLinecap: "round",
|
|
1915
|
-
strokeLinejoin: "round"
|
|
1916
|
-
}
|
|
1917
|
-
),
|
|
1918
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1919
|
-
"path",
|
|
1920
|
-
{
|
|
1921
|
-
d: "M4.375 6.25 10 10.625l5.625-4.375",
|
|
1922
|
-
stroke: "currentColor",
|
|
1923
|
-
strokeWidth: "1.6",
|
|
1924
|
-
strokeLinecap: "round",
|
|
1925
|
-
strokeLinejoin: "round"
|
|
1926
|
-
}
|
|
1927
|
-
)
|
|
1928
|
-
] }) }),
|
|
1929
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("input", { ...rest, id: inputId, placeholder, type: resolvedType, disabled, onChange, style: emailInputStyle })
|
|
1930
|
-
] }) : canTogglePasswordVisibility ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { style: passwordFieldStyle, children: [
|
|
1931
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1932
|
-
"button",
|
|
1933
|
-
{
|
|
1934
|
-
type: "button",
|
|
1935
|
-
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
1936
|
-
"aria-pressed": isPasswordVisible,
|
|
1937
|
-
disabled,
|
|
1938
|
-
onMouseDown: (event) => {
|
|
1939
|
-
event.preventDefault();
|
|
1940
|
-
},
|
|
1941
|
-
onClick: () => {
|
|
1942
|
-
setIsPasswordVisible((currentValue) => !currentValue);
|
|
1943
|
-
},
|
|
1944
|
-
style: passwordToggleStyle,
|
|
1945
|
-
children: isPasswordVisible ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1946
|
-
"svg",
|
|
1597
|
+
] })
|
|
1598
|
+
}
|
|
1599
|
+
),
|
|
1600
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1601
|
+
"input",
|
|
1947
1602
|
{
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
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
|
-
|
|
1603
|
+
...rest,
|
|
1604
|
+
id: inputId,
|
|
1605
|
+
placeholder,
|
|
1606
|
+
type: resolvedType,
|
|
1607
|
+
disabled,
|
|
1608
|
+
onChange,
|
|
1609
|
+
className: cx(adornedInputClassName, className),
|
|
1610
|
+
style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` }
|
|
1611
|
+
}
|
|
1612
|
+
)
|
|
1613
|
+
]
|
|
1614
|
+
}
|
|
1615
|
+
) : canTogglePasswordVisibility ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1616
|
+
"div",
|
|
1617
|
+
{
|
|
1618
|
+
className: cx(adornedFieldClassName, className),
|
|
1619
|
+
style: { boxShadow: adornedFieldBoxShadow, ...style },
|
|
1620
|
+
children: [
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1622
|
+
"button",
|
|
1623
|
+
{
|
|
1624
|
+
type: "button",
|
|
1625
|
+
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
1626
|
+
"aria-pressed": isPasswordVisible,
|
|
1627
|
+
disabled,
|
|
1628
|
+
onMouseDown: (event) => {
|
|
1629
|
+
event.preventDefault();
|
|
1630
|
+
},
|
|
1631
|
+
onClick: () => {
|
|
1632
|
+
setIsPasswordVisible((currentValue) => !currentValue);
|
|
1633
|
+
},
|
|
1634
|
+
className: cx(
|
|
1635
|
+
"inline-flex shrink-0 self-stretch items-center justify-center border-0",
|
|
1636
|
+
"bg-transparent p-0 appearance-none",
|
|
1637
|
+
adornmentColorClassName,
|
|
1638
|
+
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1639
|
+
),
|
|
1640
|
+
style: { width: passwordAdornmentWidth },
|
|
1641
|
+
children: isPasswordVisible ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1642
|
+
"svg",
|
|
1643
|
+
{
|
|
1644
|
+
width: passwordLockIconSize,
|
|
1645
|
+
height: passwordLockIconSize,
|
|
1646
|
+
viewBox: "0 0 20 20",
|
|
1647
|
+
fill: "none",
|
|
1648
|
+
"aria-hidden": "true",
|
|
1649
|
+
children: [
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1651
|
+
"path",
|
|
1652
|
+
{
|
|
1653
|
+
d: "M6.75 8V6.75A3.25 3.25 0 0 1 12.262 4.415",
|
|
1654
|
+
stroke: "currentColor",
|
|
1655
|
+
strokeWidth: "1.8",
|
|
1656
|
+
strokeLinecap: "round",
|
|
1657
|
+
strokeLinejoin: "round"
|
|
1658
|
+
}
|
|
1659
|
+
),
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1661
|
+
"path",
|
|
1662
|
+
{
|
|
1663
|
+
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",
|
|
1664
|
+
stroke: "currentColor",
|
|
1665
|
+
strokeWidth: "1.8",
|
|
1666
|
+
strokeLinecap: "round",
|
|
1667
|
+
strokeLinejoin: "round"
|
|
1668
|
+
}
|
|
1669
|
+
),
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1671
|
+
"path",
|
|
1672
|
+
{
|
|
1673
|
+
d: "M10 11.25v1.5",
|
|
1674
|
+
stroke: "currentColor",
|
|
1675
|
+
strokeWidth: "1.8",
|
|
1676
|
+
strokeLinecap: "round"
|
|
1677
|
+
}
|
|
1678
|
+
)
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1682
|
+
"svg",
|
|
1683
|
+
{
|
|
1684
|
+
width: passwordLockIconSize,
|
|
1685
|
+
height: passwordLockIconSize,
|
|
1686
|
+
viewBox: "0 0 20 20",
|
|
1687
|
+
fill: "none",
|
|
1688
|
+
"aria-hidden": "true",
|
|
1689
|
+
children: [
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1691
|
+
"path",
|
|
1692
|
+
{
|
|
1693
|
+
d: "M6.75 8V6.75A3.25 3.25 0 1 1 13.25 6.75V8",
|
|
1694
|
+
stroke: "currentColor",
|
|
1695
|
+
strokeWidth: "1.8",
|
|
1696
|
+
strokeLinecap: "round",
|
|
1697
|
+
strokeLinejoin: "round"
|
|
1698
|
+
}
|
|
1699
|
+
),
|
|
1700
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1701
|
+
"path",
|
|
1702
|
+
{
|
|
1703
|
+
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",
|
|
1704
|
+
stroke: "currentColor",
|
|
1705
|
+
strokeWidth: "1.8",
|
|
1706
|
+
strokeLinecap: "round",
|
|
1707
|
+
strokeLinejoin: "round"
|
|
1708
|
+
}
|
|
1709
|
+
),
|
|
1710
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M10 11.25v1.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
1711
|
+
]
|
|
1712
|
+
}
|
|
1713
|
+
)
|
|
1984
1714
|
}
|
|
1985
|
-
)
|
|
1986
|
-
|
|
1715
|
+
),
|
|
1716
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1717
|
+
"input",
|
|
1987
1718
|
{
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
{
|
|
1997
|
-
d: "M6.75 8V6.75A3.25 3.25 0 1 1 13.25 6.75V8",
|
|
1998
|
-
stroke: "currentColor",
|
|
1999
|
-
strokeWidth: "1.8",
|
|
2000
|
-
strokeLinecap: "round",
|
|
2001
|
-
strokeLinejoin: "round"
|
|
2002
|
-
}
|
|
2003
|
-
),
|
|
2004
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2005
|
-
"path",
|
|
2006
|
-
{
|
|
2007
|
-
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",
|
|
2008
|
-
stroke: "currentColor",
|
|
2009
|
-
strokeWidth: "1.8",
|
|
2010
|
-
strokeLinecap: "round",
|
|
2011
|
-
strokeLinejoin: "round"
|
|
2012
|
-
}
|
|
2013
|
-
),
|
|
2014
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M10 11.25v1.5", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round" })
|
|
2015
|
-
]
|
|
1719
|
+
...rest,
|
|
1720
|
+
id: inputId,
|
|
1721
|
+
placeholder,
|
|
1722
|
+
type: resolvedType,
|
|
1723
|
+
disabled,
|
|
1724
|
+
onChange,
|
|
1725
|
+
className: cx(adornedInputClassName, className),
|
|
1726
|
+
style: { padding: `0 ${controlMetrics.paddingX}px 0 ${leadingContentGap}px` }
|
|
2016
1727
|
}
|
|
2017
1728
|
)
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
1729
|
+
]
|
|
1730
|
+
}
|
|
1731
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1732
|
+
"input",
|
|
1733
|
+
{
|
|
1734
|
+
...rest,
|
|
1735
|
+
id: inputId,
|
|
1736
|
+
placeholder,
|
|
1737
|
+
type: resolvedType,
|
|
1738
|
+
disabled,
|
|
1739
|
+
onChange,
|
|
1740
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES[controlSize], className),
|
|
1741
|
+
style: { boxShadow: "var(--ui-kit-component-shadow)", ...style }
|
|
1742
|
+
}
|
|
1743
|
+
);
|
|
2022
1744
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2023
1745
|
ControlFrame,
|
|
2024
1746
|
{
|
|
@@ -2082,20 +1804,35 @@ var ACCESSORY_METRICS_BY_SIZE = {
|
|
|
2082
1804
|
contentGap: 8
|
|
2083
1805
|
},
|
|
2084
1806
|
md: {
|
|
1807
|
+
buttonSize: 19,
|
|
1808
|
+
iconSize: 15,
|
|
1809
|
+
rightOffset: 9,
|
|
1810
|
+
clusterGap: 7,
|
|
1811
|
+
contentGap: 9
|
|
1812
|
+
},
|
|
1813
|
+
lg: {
|
|
2085
1814
|
buttonSize: 20,
|
|
2086
1815
|
iconSize: 16,
|
|
2087
1816
|
rightOffset: 10,
|
|
2088
1817
|
clusterGap: 8,
|
|
2089
1818
|
contentGap: 10
|
|
2090
|
-
},
|
|
2091
|
-
lg: {
|
|
2092
|
-
buttonSize: 22,
|
|
2093
|
-
iconSize: 18,
|
|
2094
|
-
rightOffset: 12,
|
|
2095
|
-
clusterGap: 8,
|
|
2096
|
-
contentGap: 12
|
|
2097
1819
|
}
|
|
2098
1820
|
};
|
|
1821
|
+
var FIELD_HEIGHT_CLASSNAMES2 = {
|
|
1822
|
+
sm: "h-[30px]",
|
|
1823
|
+
md: "h-[34px]",
|
|
1824
|
+
lg: "h-[38px]"
|
|
1825
|
+
};
|
|
1826
|
+
var FIELD_TEXT_CLASSNAMES2 = {
|
|
1827
|
+
sm: "text-[13px] leading-4",
|
|
1828
|
+
md: "text-sm leading-[18px]",
|
|
1829
|
+
lg: "text-[15px] leading-[18px]"
|
|
1830
|
+
};
|
|
1831
|
+
var FIELD_PADDING_X_CLASSNAMES2 = {
|
|
1832
|
+
sm: "px-3",
|
|
1833
|
+
md: "px-[14px]",
|
|
1834
|
+
lg: "px-4"
|
|
1835
|
+
};
|
|
2099
1836
|
function padNumber(value, length = 2) {
|
|
2100
1837
|
return String(value).padStart(length, "0");
|
|
2101
1838
|
}
|
|
@@ -2279,13 +2016,13 @@ function DatePicker({
|
|
|
2279
2016
|
...rest
|
|
2280
2017
|
}) {
|
|
2281
2018
|
var _a;
|
|
2282
|
-
|
|
2019
|
+
useUiKitTheme();
|
|
2283
2020
|
const controlMetrics = getControlMetrics(controlSize);
|
|
2284
2021
|
const accessoryMetrics = ACCESSORY_METRICS_BY_SIZE[controlSize];
|
|
2285
|
-
const generatedIdRef = (0,
|
|
2286
|
-
const visibleInputRef = (0,
|
|
2287
|
-
const nativeInputRef = (0,
|
|
2288
|
-
const [internalError, setInternalError] = (0,
|
|
2022
|
+
const generatedIdRef = (0, import_react6.useRef)();
|
|
2023
|
+
const visibleInputRef = (0, import_react6.useRef)(null);
|
|
2024
|
+
const nativeInputRef = (0, import_react6.useRef)(null);
|
|
2025
|
+
const [internalError, setInternalError] = (0, import_react6.useState)();
|
|
2289
2026
|
const resolvedFormat = (format == null ? void 0 : format.trim()) ? format : DEFAULT_FORMAT_BY_MODE[mode];
|
|
2290
2027
|
const isControlled = value !== void 0;
|
|
2291
2028
|
const nativePickerType = mode === "datetime" ? "datetime-local" : "date";
|
|
@@ -2293,23 +2030,23 @@ function DatePicker({
|
|
|
2293
2030
|
generatedIdRef.current = `ss-date-picker-${Math.random().toString(36).slice(2, 10)}`;
|
|
2294
2031
|
}
|
|
2295
2032
|
const resolvedId = id != null ? id : generatedIdRef.current;
|
|
2296
|
-
const normalizedDefaultValue = (0,
|
|
2033
|
+
const normalizedDefaultValue = (0, import_react6.useMemo)(() => {
|
|
2297
2034
|
const parsedDefaultValue = parseDateValue(defaultValue, mode, resolvedFormat);
|
|
2298
2035
|
return parsedDefaultValue ? toLocalInputValue(parsedDefaultValue, mode) : null;
|
|
2299
2036
|
}, [defaultValue, mode, resolvedFormat]);
|
|
2300
|
-
const [uncontrolledValue, setUncontrolledValue] = (0,
|
|
2301
|
-
const committedDate = (0,
|
|
2037
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react6.useState)(normalizedDefaultValue);
|
|
2038
|
+
const committedDate = (0, import_react6.useMemo)(() => {
|
|
2302
2039
|
const sourceValue = isControlled ? value : uncontrolledValue;
|
|
2303
2040
|
return parseDateValue(sourceValue, mode, resolvedFormat);
|
|
2304
2041
|
}, [isControlled, mode, resolvedFormat, uncontrolledValue, value]);
|
|
2305
2042
|
const committedValue = committedDate ? toLocalInputValue(committedDate, mode) : null;
|
|
2306
2043
|
const committedDisplayValue = committedDate ? formatDateValue(committedDate, resolvedFormat) : "";
|
|
2307
|
-
const [draftValue, setDraftValue] = (0,
|
|
2308
|
-
(0,
|
|
2044
|
+
const [draftValue, setDraftValue] = (0, import_react6.useState)(committedDisplayValue);
|
|
2045
|
+
(0, import_react6.useEffect)(() => {
|
|
2309
2046
|
setDraftValue(committedDisplayValue);
|
|
2310
2047
|
setInternalError(void 0);
|
|
2311
2048
|
}, [committedDisplayValue]);
|
|
2312
|
-
(0,
|
|
2049
|
+
(0, import_react6.useEffect)(() => {
|
|
2313
2050
|
if (!isControlled) {
|
|
2314
2051
|
setUncontrolledValue((currentValue) => {
|
|
2315
2052
|
if (currentValue == null) {
|
|
@@ -2320,12 +2057,12 @@ function DatePicker({
|
|
|
2320
2057
|
});
|
|
2321
2058
|
}
|
|
2322
2059
|
}, [isControlled, mode, resolvedFormat]);
|
|
2323
|
-
const parsedMinDate = (0,
|
|
2060
|
+
const parsedMinDate = (0, import_react6.useMemo)(() => {
|
|
2324
2061
|
const explicitMinDate = parseDateValue(minDate, mode, resolvedFormat);
|
|
2325
2062
|
const guardedMinDate = allowPastDates ? null : normalizeDatePrecision(/* @__PURE__ */ new Date(), mode);
|
|
2326
2063
|
return getLaterDate(explicitMinDate, guardedMinDate);
|
|
2327
2064
|
}, [allowPastDates, minDate, mode, resolvedFormat]);
|
|
2328
|
-
const parsedMaxDate = (0,
|
|
2065
|
+
const parsedMaxDate = (0, import_react6.useMemo)(() => {
|
|
2329
2066
|
const explicitMaxDate = parseDateValue(maxDate, mode, resolvedFormat);
|
|
2330
2067
|
const guardedMaxDate = allowFutureDates ? null : normalizeDatePrecision(/* @__PURE__ */ new Date(), mode);
|
|
2331
2068
|
return getEarlierDate(explicitMaxDate, guardedMaxDate);
|
|
@@ -2335,7 +2072,6 @@ function DatePicker({
|
|
|
2335
2072
|
const derivedError = hasConfigurationConflict ? "Current date rules do not allow any selection." : internalError;
|
|
2336
2073
|
const resolvedError = hasExternalError ? error : derivedError;
|
|
2337
2074
|
const hasAnyValue = draftValue.trim().length > 0 || Boolean(committedValue);
|
|
2338
|
-
const inputBorderColor = resolvedError ? theme.colors.negative : theme.colors.textLight;
|
|
2339
2075
|
const showPickerAdornment = showPickerButton;
|
|
2340
2076
|
const canOpenPicker = !disabled && !readOnly && !hasConfigurationConflict;
|
|
2341
2077
|
const canClear = clearable && !disabled && !readOnly && !required && hasAnyValue;
|
|
@@ -2346,6 +2082,42 @@ function DatePicker({
|
|
|
2346
2082
|
0,
|
|
2347
2083
|
accessoryMetrics.rightOffset + trailingButtonCount * accessoryMetrics.buttonSize + (trailingButtonCount - 1) * accessoryMetrics.clusterGap + accessoryMetrics.contentGap - controlMetrics.paddingX
|
|
2348
2084
|
) : 0;
|
|
2085
|
+
const fieldBorderColor = resolvedError ? "var(--theme-negative)" : "var(--theme-textLight)";
|
|
2086
|
+
const fieldBaseClassName = cx(
|
|
2087
|
+
"w-full box-border rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
2088
|
+
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2089
|
+
"duration-150 placeholder:text-[var(--ui-kit-placeholder)]",
|
|
2090
|
+
FIELD_HEIGHT_CLASSNAMES2[controlSize],
|
|
2091
|
+
FIELD_TEXT_CLASSNAMES2[controlSize],
|
|
2092
|
+
resolvedError ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
2093
|
+
disabled ? "cursor-not-allowed opacity-70" : readOnly ? "cursor-default" : "cursor-text"
|
|
2094
|
+
);
|
|
2095
|
+
const integratedFieldClassName = cx(
|
|
2096
|
+
"box-border flex w-full items-center gap-0 overflow-hidden rounded-2xl",
|
|
2097
|
+
"bg-[var(--theme-surface)] text-[var(--theme-text)]",
|
|
2098
|
+
"transition-[border-color,box-shadow,background-color] duration-150",
|
|
2099
|
+
FIELD_HEIGHT_CLASSNAMES2[controlSize],
|
|
2100
|
+
FIELD_TEXT_CLASSNAMES2[controlSize],
|
|
2101
|
+
disabled ? "cursor-not-allowed opacity-70" : readOnly ? "cursor-default" : "cursor-text"
|
|
2102
|
+
);
|
|
2103
|
+
const integratedFieldBoxShadow = getInsetBorderShadow(fieldBorderColor, resolvedError ? { outerShadow: "0 0 0 3px var(--ui-kit-negative-soft)" } : void 0);
|
|
2104
|
+
const integratedInputClassName = cx(
|
|
2105
|
+
"h-full w-full box-border border-0 bg-transparent text-[var(--theme-text)]",
|
|
2106
|
+
"outline-none placeholder:text-[var(--ui-kit-placeholder)]",
|
|
2107
|
+
FIELD_TEXT_CLASSNAMES2[controlSize],
|
|
2108
|
+
disabled ? "cursor-not-allowed" : readOnly ? "cursor-default" : "cursor-text"
|
|
2109
|
+
);
|
|
2110
|
+
const pickerAdornmentClassName = cx(
|
|
2111
|
+
"inline-flex shrink-0 self-stretch items-center justify-center border-0",
|
|
2112
|
+
"bg-transparent p-0 appearance-none",
|
|
2113
|
+
resolvedError ? "text-[var(--theme-negative)]" : "text-[var(--theme-textLight)]",
|
|
2114
|
+
disabled || readOnly || hasConfigurationConflict ? "cursor-not-allowed" : "cursor-pointer"
|
|
2115
|
+
);
|
|
2116
|
+
const accessoryButtonClassName = cx(
|
|
2117
|
+
"m-0 inline-flex shrink-0 items-center justify-center rounded-full border-0 bg-transparent p-0 leading-none",
|
|
2118
|
+
"text-[var(--theme-textLight)]",
|
|
2119
|
+
disabled ? "cursor-not-allowed opacity-70" : readOnly ? "cursor-not-allowed" : "cursor-pointer"
|
|
2120
|
+
);
|
|
2349
2121
|
const getValidationMessage = (parsedDate) => {
|
|
2350
2122
|
if (parsedMinDate && parsedDate.getTime() < parsedMinDate.getTime()) {
|
|
2351
2123
|
return `Choose a value on or after ${formatDateValue(parsedMinDate, resolvedFormat)}.`;
|
|
@@ -2442,98 +2214,10 @@ function DatePicker({
|
|
|
2442
2214
|
(_b = visibleInputRef.current) == null ? void 0 : _b.focus();
|
|
2443
2215
|
}
|
|
2444
2216
|
};
|
|
2445
|
-
const inputStyle = {
|
|
2446
|
-
width: "100%",
|
|
2447
|
-
boxSizing: "border-box",
|
|
2448
|
-
height: controlMetrics.height,
|
|
2449
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
2450
|
-
border: `1px solid ${inputBorderColor}`,
|
|
2451
|
-
backgroundColor: theme.colors.surface,
|
|
2452
|
-
color: theme.colors.text,
|
|
2453
|
-
cursor: disabled ? "not-allowed" : readOnly ? "default" : "text",
|
|
2454
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
2455
|
-
padding: getTextInputPadding(controlSize, { trailingInset }),
|
|
2456
|
-
outline: "none",
|
|
2457
|
-
fontSize: controlMetrics.fontSize,
|
|
2458
|
-
lineHeight: controlMetrics.lineHeight,
|
|
2459
|
-
boxShadow: resolvedError ? `0 0 0 3px ${withAlpha(theme.colors.negative, 0.12)}, ${getComponentShadow(theme)}` : `${getComponentShadow(theme)}, 0 0 0 0 ${focusRing}`,
|
|
2460
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
2461
|
-
...style
|
|
2462
|
-
};
|
|
2463
|
-
const integratedFieldStyle = {
|
|
2464
|
-
width: "100%",
|
|
2465
|
-
boxSizing: "border-box",
|
|
2466
|
-
height: controlMetrics.height,
|
|
2467
|
-
display: "flex",
|
|
2468
|
-
alignItems: "center",
|
|
2469
|
-
gap: 0,
|
|
2470
|
-
overflow: "hidden",
|
|
2471
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
2472
|
-
border: `1px solid ${inputBorderColor}`,
|
|
2473
|
-
backgroundColor: theme.colors.surface,
|
|
2474
|
-
color: theme.colors.text,
|
|
2475
|
-
cursor: disabled ? "not-allowed" : readOnly ? "default" : "text",
|
|
2476
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
2477
|
-
padding: 0,
|
|
2478
|
-
outline: "none",
|
|
2479
|
-
boxShadow: resolvedError ? `0 0 0 3px ${withAlpha(theme.colors.negative, 0.12)}, ${getComponentShadow(theme)}` : `${getComponentShadow(theme)}, 0 0 0 0 ${focusRing}`,
|
|
2480
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
2481
|
-
...style
|
|
2482
|
-
};
|
|
2483
|
-
const pickerSegmentStyle = {
|
|
2484
|
-
flexShrink: 0,
|
|
2485
|
-
display: "inline-flex",
|
|
2486
|
-
alignItems: "center",
|
|
2487
|
-
justifyContent: "center",
|
|
2488
|
-
alignSelf: "stretch",
|
|
2489
|
-
boxSizing: "border-box",
|
|
2490
|
-
width: pickerAdornmentWidth,
|
|
2491
|
-
border: "none",
|
|
2492
|
-
backgroundColor: "transparent",
|
|
2493
|
-
color: inputBorderColor,
|
|
2494
|
-
cursor: disabled || readOnly || hasConfigurationConflict ? "not-allowed" : "pointer",
|
|
2495
|
-
padding: 0,
|
|
2496
|
-
appearance: "none"
|
|
2497
|
-
};
|
|
2498
|
-
const integratedInputWrapStyle = {
|
|
2499
|
-
position: "relative",
|
|
2500
|
-
flex: 1,
|
|
2501
|
-
minWidth: 0,
|
|
2502
|
-
height: "100%"
|
|
2503
|
-
};
|
|
2504
|
-
const integratedTextInputStyle = {
|
|
2505
|
-
width: "100%",
|
|
2506
|
-
height: "100%",
|
|
2507
|
-
boxSizing: "border-box",
|
|
2508
|
-
border: "none",
|
|
2509
|
-
backgroundColor: "transparent",
|
|
2510
|
-
color: theme.colors.text,
|
|
2511
|
-
cursor: disabled ? "not-allowed" : readOnly ? "default" : "text",
|
|
2512
|
-
padding: `${controlMetrics.paddingY}px ${controlMetrics.paddingX + trailingInset}px ${controlMetrics.paddingY}px ${leadingContentGap}px`,
|
|
2513
|
-
outline: "none",
|
|
2514
|
-
fontSize: controlMetrics.fontSize,
|
|
2515
|
-
lineHeight: controlMetrics.lineHeight
|
|
2516
|
-
};
|
|
2517
|
-
const accessoryButtonStyle = {
|
|
2518
|
-
width: accessoryMetrics.buttonSize,
|
|
2519
|
-
height: accessoryMetrics.buttonSize,
|
|
2520
|
-
border: "none",
|
|
2521
|
-
padding: 0,
|
|
2522
|
-
margin: 0,
|
|
2523
|
-
display: "inline-flex",
|
|
2524
|
-
alignItems: "center",
|
|
2525
|
-
justifyContent: "center",
|
|
2526
|
-
borderRadius: 999,
|
|
2527
|
-
backgroundColor: "transparent",
|
|
2528
|
-
color: theme.colors.textLight,
|
|
2529
|
-
cursor: disabled || readOnly ? "not-allowed" : "pointer",
|
|
2530
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1
|
|
2531
|
-
};
|
|
2532
2217
|
const visibleInputProps = {
|
|
2533
2218
|
...rest,
|
|
2534
2219
|
ref: visibleInputRef,
|
|
2535
2220
|
id: resolvedId,
|
|
2536
|
-
className,
|
|
2537
2221
|
type: "text",
|
|
2538
2222
|
value: draftValue,
|
|
2539
2223
|
disabled,
|
|
@@ -2595,33 +2279,14 @@ function DatePicker({
|
|
|
2595
2279
|
onChange: (event) => {
|
|
2596
2280
|
commitValue(event.target.value || null, "picker");
|
|
2597
2281
|
},
|
|
2598
|
-
|
|
2599
|
-
position: "absolute",
|
|
2600
|
-
width: 1,
|
|
2601
|
-
height: 1,
|
|
2602
|
-
padding: 0,
|
|
2603
|
-
margin: -1,
|
|
2604
|
-
overflow: "hidden",
|
|
2605
|
-
clip: "rect(0, 0, 0, 0)",
|
|
2606
|
-
whiteSpace: "nowrap",
|
|
2607
|
-
border: 0,
|
|
2608
|
-
opacity: 0,
|
|
2609
|
-
pointerEvents: "none"
|
|
2610
|
-
}
|
|
2282
|
+
className: "ui-kit-sr-only pointer-events-none opacity-0"
|
|
2611
2283
|
}
|
|
2612
2284
|
);
|
|
2613
2285
|
const clearButtonCluster = canClear ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2614
2286
|
"div",
|
|
2615
2287
|
{
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
top: "50%",
|
|
2619
|
-
right: accessoryMetrics.rightOffset,
|
|
2620
|
-
transform: "translateY(-50%)",
|
|
2621
|
-
display: "inline-flex",
|
|
2622
|
-
alignItems: "center",
|
|
2623
|
-
gap: accessoryMetrics.clusterGap
|
|
2624
|
-
},
|
|
2288
|
+
className: "absolute inset-y-0 inline-flex items-center",
|
|
2289
|
+
style: { right: accessoryMetrics.rightOffset, gap: accessoryMetrics.clusterGap },
|
|
2625
2290
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2626
2291
|
"button",
|
|
2627
2292
|
{
|
|
@@ -2636,34 +2301,66 @@ function DatePicker({
|
|
|
2636
2301
|
commitValue(null, "clear");
|
|
2637
2302
|
(_a2 = visibleInputRef.current) == null ? void 0 : _a2.focus();
|
|
2638
2303
|
},
|
|
2639
|
-
|
|
2304
|
+
className: accessoryButtonClassName,
|
|
2305
|
+
style: { width: accessoryMetrics.buttonSize, height: accessoryMetrics.buttonSize },
|
|
2640
2306
|
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ClearIcon, { size: accessoryMetrics.iconSize })
|
|
2641
2307
|
}
|
|
2642
2308
|
)
|
|
2643
2309
|
}
|
|
2644
2310
|
) : null;
|
|
2645
|
-
const input = showPickerAdornment ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2311
|
+
const input = showPickerAdornment ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
2312
|
+
"div",
|
|
2313
|
+
{
|
|
2314
|
+
className: cx(integratedFieldClassName, className),
|
|
2315
|
+
style: {
|
|
2316
|
+
boxShadow: integratedFieldBoxShadow,
|
|
2317
|
+
...style
|
|
2318
|
+
},
|
|
2319
|
+
children: [
|
|
2320
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2321
|
+
"button",
|
|
2322
|
+
{
|
|
2323
|
+
type: "button",
|
|
2324
|
+
"aria-label": pickerButtonLabel != null ? pickerButtonLabel : mode === "datetime" ? "Open date and time picker" : "Open date picker",
|
|
2325
|
+
disabled: !canOpenPicker,
|
|
2326
|
+
onMouseDown: (event) => {
|
|
2327
|
+
event.preventDefault();
|
|
2328
|
+
},
|
|
2329
|
+
onClick: openNativePicker,
|
|
2330
|
+
className: pickerAdornmentClassName,
|
|
2331
|
+
style: { width: pickerAdornmentWidth },
|
|
2332
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarIcon, { size: accessoryMetrics.iconSize })
|
|
2333
|
+
}
|
|
2334
|
+
),
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative h-full min-w-0 flex-1", children: [
|
|
2336
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2337
|
+
"input",
|
|
2338
|
+
{
|
|
2339
|
+
...visibleInputProps,
|
|
2340
|
+
className: cx(integratedInputClassName, className),
|
|
2341
|
+
style: {
|
|
2342
|
+
padding: `${controlMetrics.paddingY}px ${controlMetrics.paddingX + trailingInset}px ${controlMetrics.paddingY}px ${leadingContentGap}px`
|
|
2343
|
+
}
|
|
2344
|
+
}
|
|
2345
|
+
),
|
|
2346
|
+
nativePickerInput,
|
|
2347
|
+
clearButtonCluster
|
|
2348
|
+
] })
|
|
2349
|
+
]
|
|
2350
|
+
}
|
|
2351
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative w-full", children: [
|
|
2646
2352
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2647
|
-
"
|
|
2353
|
+
"input",
|
|
2648
2354
|
{
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
style: pickerSegmentStyle,
|
|
2657
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CalendarIcon, { size: accessoryMetrics.iconSize })
|
|
2355
|
+
...visibleInputProps,
|
|
2356
|
+
className: cx(fieldBaseClassName, FIELD_PADDING_X_CLASSNAMES2[controlSize], className),
|
|
2357
|
+
style: {
|
|
2358
|
+
paddingRight: controlMetrics.paddingX + trailingInset,
|
|
2359
|
+
boxShadow: resolvedError ? "0 0 0 3px var(--ui-kit-negative-soft), var(--ui-kit-component-shadow)" : "var(--ui-kit-component-shadow)",
|
|
2360
|
+
...style
|
|
2361
|
+
}
|
|
2658
2362
|
}
|
|
2659
2363
|
),
|
|
2660
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: integratedInputWrapStyle, children: [
|
|
2661
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { ...visibleInputProps, style: integratedTextInputStyle }),
|
|
2662
|
-
nativePickerInput,
|
|
2663
|
-
clearButtonCluster
|
|
2664
|
-
] })
|
|
2665
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { position: "relative", width: "100%" }, children: [
|
|
2666
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("input", { ...visibleInputProps, style: inputStyle }),
|
|
2667
2364
|
nativePickerInput,
|
|
2668
2365
|
clearButtonCluster
|
|
2669
2366
|
] });
|
|
@@ -2686,27 +2383,38 @@ function Separator({
|
|
|
2686
2383
|
orientation = "vertical",
|
|
2687
2384
|
color,
|
|
2688
2385
|
size = "100%",
|
|
2386
|
+
className,
|
|
2689
2387
|
style,
|
|
2690
2388
|
...rest
|
|
2691
2389
|
}) {
|
|
2692
|
-
|
|
2390
|
+
useUiKitTheme();
|
|
2693
2391
|
const usesVerticalStretch = orientation === "vertical" && size === "100%";
|
|
2694
2392
|
const separatorStyle = {
|
|
2695
|
-
|
|
2696
|
-
alignSelf: "stretch",
|
|
2697
|
-
backgroundColor: color != null ? color : theme.colors.text,
|
|
2393
|
+
backgroundColor: color,
|
|
2698
2394
|
width: orientation === "vertical" ? 1 : size,
|
|
2699
2395
|
height: orientation === "vertical" ? usesVerticalStretch ? "auto" : size : 1,
|
|
2700
2396
|
...style
|
|
2701
2397
|
};
|
|
2702
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2399
|
+
"div",
|
|
2400
|
+
{
|
|
2401
|
+
...rest,
|
|
2402
|
+
role: "separator",
|
|
2403
|
+
"aria-orientation": orientation,
|
|
2404
|
+
className: cx(
|
|
2405
|
+
"shrink-0 self-stretch bg-[var(--theme-text)]",
|
|
2406
|
+
className
|
|
2407
|
+
),
|
|
2408
|
+
style: separatorStyle
|
|
2409
|
+
}
|
|
2410
|
+
);
|
|
2703
2411
|
}
|
|
2704
2412
|
|
|
2705
2413
|
// src/componentsBase/select/SelectBase.tsx
|
|
2706
|
-
var
|
|
2414
|
+
var import_react8 = require("react");
|
|
2707
2415
|
|
|
2708
2416
|
// src/componentsBase/select/utils.ts
|
|
2709
|
-
var
|
|
2417
|
+
var import_react7 = require("react");
|
|
2710
2418
|
function getTextContent(node) {
|
|
2711
2419
|
if (node == null || typeof node === "boolean") {
|
|
2712
2420
|
return "";
|
|
@@ -2717,7 +2425,7 @@ function getTextContent(node) {
|
|
|
2717
2425
|
if (Array.isArray(node)) {
|
|
2718
2426
|
return node.map(getTextContent).join("");
|
|
2719
2427
|
}
|
|
2720
|
-
if ((0,
|
|
2428
|
+
if ((0, import_react7.isValidElement)(node)) {
|
|
2721
2429
|
return getTextContent(node.props.children);
|
|
2722
2430
|
}
|
|
2723
2431
|
return "";
|
|
@@ -2755,10 +2463,20 @@ function filterSelectGroups(groups, query) {
|
|
|
2755
2463
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2756
2464
|
var MENU_OFFSET = 8;
|
|
2757
2465
|
var MENU_MAX_HEIGHT = 280;
|
|
2758
|
-
var
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2466
|
+
var FIELD_HEIGHT_CLASSNAMES3 = {
|
|
2467
|
+
sm: "h-[30px]",
|
|
2468
|
+
md: "h-[34px]",
|
|
2469
|
+
lg: "h-[38px]"
|
|
2470
|
+
};
|
|
2471
|
+
var FIELD_TEXT_CLASSNAMES3 = {
|
|
2472
|
+
sm: "text-[13px] leading-4",
|
|
2473
|
+
md: "text-sm leading-[18px]",
|
|
2474
|
+
lg: "text-[15px] leading-[18px]"
|
|
2475
|
+
};
|
|
2476
|
+
var OPTION_PADDING_CLASSNAMES = {
|
|
2477
|
+
sm: "px-[11px] py-2",
|
|
2478
|
+
md: "px-3 py-[9px]",
|
|
2479
|
+
lg: "px-[13px] py-[10px]"
|
|
2762
2480
|
};
|
|
2763
2481
|
function SelectBase({
|
|
2764
2482
|
label,
|
|
@@ -2798,9 +2516,9 @@ function SelectBase({
|
|
|
2798
2516
|
...rest
|
|
2799
2517
|
}) {
|
|
2800
2518
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2801
|
-
const { theme, mutedText
|
|
2519
|
+
const { theme, mutedText } = useUiKitTheme();
|
|
2802
2520
|
const componentShadow = getComponentShadow(theme);
|
|
2803
|
-
const generatedId = (0,
|
|
2521
|
+
const generatedId = (0, import_react8.useId)().replace(/:/g, "");
|
|
2804
2522
|
const resolvedId = id != null ? id : `ss-select-${generatedId}`;
|
|
2805
2523
|
const isMultiSelect = Boolean(isMulti || multiple);
|
|
2806
2524
|
const hasFilter = Boolean(isFilterable);
|
|
@@ -2808,18 +2526,18 @@ function SelectBase({
|
|
|
2808
2526
|
const enabledOptions = flatOptions.filter((option) => !option.disabled);
|
|
2809
2527
|
const isControlled = value !== void 0;
|
|
2810
2528
|
const fallbackValues = defaultValue !== void 0 ? normalizeSelectValues(defaultValue) : isMultiSelect ? [] : placeholder != null ? [] : ((_a = enabledOptions[0]) == null ? void 0 : _a.value) ? [enabledOptions[0].value] : [];
|
|
2811
|
-
const [uncontrolledValues, setUncontrolledValues] = (0,
|
|
2812
|
-
const [isOpen, setIsOpen] = (0,
|
|
2813
|
-
const [uncontrolledSearchQuery, setUncontrolledSearchQuery] = (0,
|
|
2814
|
-
const [menuPlacement, setMenuPlacement] = (0,
|
|
2815
|
-
const [isPlacementResolved, setIsPlacementResolved] = (0,
|
|
2816
|
-
const [highlightedValue, setHighlightedValue] = (0,
|
|
2817
|
-
const shellRef = (0,
|
|
2818
|
-
const buttonRef = (0,
|
|
2819
|
-
const menuRef = (0,
|
|
2820
|
-
const searchInputRef = (0,
|
|
2821
|
-
const hiddenSelectRef = (0,
|
|
2822
|
-
const highlightSyncKeyRef = (0,
|
|
2529
|
+
const [uncontrolledValues, setUncontrolledValues] = (0, import_react8.useState)(fallbackValues);
|
|
2530
|
+
const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
|
|
2531
|
+
const [uncontrolledSearchQuery, setUncontrolledSearchQuery] = (0, import_react8.useState)("");
|
|
2532
|
+
const [menuPlacement, setMenuPlacement] = (0, import_react8.useState)("bottom");
|
|
2533
|
+
const [isPlacementResolved, setIsPlacementResolved] = (0, import_react8.useState)(false);
|
|
2534
|
+
const [highlightedValue, setHighlightedValue] = (0, import_react8.useState)((_d = (_c = fallbackValues[0]) != null ? _c : (_b = enabledOptions[0]) == null ? void 0 : _b.value) != null ? _d : "");
|
|
2535
|
+
const shellRef = (0, import_react8.useRef)(null);
|
|
2536
|
+
const buttonRef = (0, import_react8.useRef)(null);
|
|
2537
|
+
const menuRef = (0, import_react8.useRef)(null);
|
|
2538
|
+
const searchInputRef = (0, import_react8.useRef)(null);
|
|
2539
|
+
const hiddenSelectRef = (0, import_react8.useRef)(null);
|
|
2540
|
+
const highlightSyncKeyRef = (0, import_react8.useRef)("");
|
|
2823
2541
|
const currentSearchQuery = searchQuery !== void 0 ? searchQuery : uncontrolledSearchQuery;
|
|
2824
2542
|
const selectedValues = isControlled ? normalizeSelectValues(value) : uncontrolledValues;
|
|
2825
2543
|
const selectedValue = (_e = selectedValues[0]) != null ? _e : "";
|
|
@@ -2845,13 +2563,49 @@ function SelectBase({
|
|
|
2845
2563
|
const scrollbarThumbColor = withAlpha(theme.colors.text, 0.22);
|
|
2846
2564
|
const scrollbarThumbHoverColor = withAlpha(theme.colors.text, 0.32);
|
|
2847
2565
|
const highlightedOption = (_i = visibleOptions.find((option) => option.value === highlightedValue)) != null ? _i : null;
|
|
2848
|
-
const optionHoverBackground =
|
|
2849
|
-
const optionSelectedBackground =
|
|
2566
|
+
const optionHoverBackground = theme.colors.primary;
|
|
2567
|
+
const optionSelectedBackground = theme.colors.primary;
|
|
2850
2568
|
const canOpenMenu = allowOpenWithoutOptions || flatOptions.length > 0;
|
|
2851
2569
|
const buttonPassthroughProps = Object.fromEntries(
|
|
2852
2570
|
Object.entries(rest).filter(([key]) => key.startsWith("aria-") || key.startsWith("data-"))
|
|
2853
2571
|
);
|
|
2854
|
-
(0,
|
|
2572
|
+
const selectVariables = (0, import_react8.useMemo)(() => ({
|
|
2573
|
+
"--ui-kit-select-placeholder": placeholderTextColor,
|
|
2574
|
+
"--ui-kit-select-muted": mutedText,
|
|
2575
|
+
"--ui-kit-select-indicator-disabled": withAlpha(theme.colors.text, 0.42),
|
|
2576
|
+
"--ui-kit-select-surface-raised": theme.colors.surface,
|
|
2577
|
+
"--ui-kit-select-scrollbar-thumb": scrollbarThumbColor,
|
|
2578
|
+
"--ui-kit-select-scrollbar-thumb-hover": scrollbarThumbHoverColor,
|
|
2579
|
+
"--ui-kit-select-divider": withAlpha(theme.colors.text, 0.08),
|
|
2580
|
+
"--ui-kit-select-option-hover-bg": optionHoverBackground,
|
|
2581
|
+
"--ui-kit-select-option-selected-bg": optionSelectedBackground,
|
|
2582
|
+
"--ui-kit-select-option-disabled": withAlpha(theme.colors.text, 0.38),
|
|
2583
|
+
"--ui-kit-select-control-shadow": componentShadow
|
|
2584
|
+
}), [
|
|
2585
|
+
componentShadow,
|
|
2586
|
+
mutedText,
|
|
2587
|
+
optionHoverBackground,
|
|
2588
|
+
optionSelectedBackground,
|
|
2589
|
+
placeholderTextColor,
|
|
2590
|
+
scrollbarThumbColor,
|
|
2591
|
+
scrollbarThumbHoverColor,
|
|
2592
|
+
theme.colors.surface,
|
|
2593
|
+
theme.colors.text
|
|
2594
|
+
]);
|
|
2595
|
+
const triggerBorderColor = error ? "var(--theme-negative)" : "var(--theme-textLight)";
|
|
2596
|
+
const triggerBoxShadow = getInsetBorderShadow(triggerBorderColor, {
|
|
2597
|
+
componentShadow: "var(--ui-kit-select-control-shadow)"
|
|
2598
|
+
});
|
|
2599
|
+
const triggerClassName = cx(
|
|
2600
|
+
"m-0 box-border flex w-full min-w-0 items-center justify-between gap-3 rounded-2xl border-0 appearance-none",
|
|
2601
|
+
"bg-[var(--theme-surface)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
2602
|
+
"duration-150 text-left",
|
|
2603
|
+
FIELD_HEIGHT_CLASSNAMES3[controlSize],
|
|
2604
|
+
FIELD_TEXT_CLASSNAMES3[controlSize],
|
|
2605
|
+
hasSelection ? "text-[var(--theme-text)]" : "text-[var(--ui-kit-select-placeholder)]",
|
|
2606
|
+
disabled ? "cursor-not-allowed opacity-70" : "cursor-pointer"
|
|
2607
|
+
);
|
|
2608
|
+
(0, import_react8.useEffect)(() => {
|
|
2855
2609
|
var _a2, _b2, _c2, _d2;
|
|
2856
2610
|
if (isControlled || preserveUnknownValues) {
|
|
2857
2611
|
return;
|
|
@@ -2868,7 +2622,7 @@ function SelectBase({
|
|
|
2868
2622
|
setUncontrolledValues(nextValues);
|
|
2869
2623
|
setHighlightedValue((_d2 = (_c2 = nextValues[0]) != null ? _c2 : (_b2 = enabledOptions[0]) == null ? void 0 : _b2.value) != null ? _d2 : "");
|
|
2870
2624
|
}, [defaultValue, enabledOptions, flatOptions, isControlled, isMultiSelect, preserveUnknownValues, uncontrolledValues]);
|
|
2871
|
-
(0,
|
|
2625
|
+
(0, import_react8.useEffect)(() => {
|
|
2872
2626
|
var _a2, _b2, _c2;
|
|
2873
2627
|
if (!isOpen) {
|
|
2874
2628
|
highlightSyncKeyRef.current = "";
|
|
@@ -2884,14 +2638,14 @@ function SelectBase({
|
|
|
2884
2638
|
const nextHighlightedValue = (_c2 = (_b2 = [...selectedValues].reverse().find((currentValue) => visibleEnabledValues.includes(currentValue))) != null ? _b2 : (_a2 = visibleEnabledOptions[0]) == null ? void 0 : _a2.value) != null ? _c2 : "";
|
|
2885
2639
|
setHighlightedValue(nextHighlightedValue);
|
|
2886
2640
|
}, [isOpen, selectedValuesKey, visibleEnabledValuesKey, selectedValues, visibleEnabledOptions, visibleEnabledValues]);
|
|
2887
|
-
(0,
|
|
2641
|
+
(0, import_react8.useEffect)(() => {
|
|
2888
2642
|
var _a2;
|
|
2889
2643
|
if (!isOpen || !hasFilter) {
|
|
2890
2644
|
return;
|
|
2891
2645
|
}
|
|
2892
2646
|
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
2893
2647
|
}, [hasFilter, isOpen]);
|
|
2894
|
-
(0,
|
|
2648
|
+
(0, import_react8.useEffect)(() => {
|
|
2895
2649
|
if (!isOpen) {
|
|
2896
2650
|
return;
|
|
2897
2651
|
}
|
|
@@ -2916,7 +2670,7 @@ function SelectBase({
|
|
|
2916
2670
|
window.cancelAnimationFrame(frameId);
|
|
2917
2671
|
};
|
|
2918
2672
|
}, [isOpen, visibleOptions.length]);
|
|
2919
|
-
(0,
|
|
2673
|
+
(0, import_react8.useEffect)(() => {
|
|
2920
2674
|
if (isOpen || !clearSearchOnClose || currentSearchQuery === "") {
|
|
2921
2675
|
return;
|
|
2922
2676
|
}
|
|
@@ -2925,7 +2679,7 @@ function SelectBase({
|
|
|
2925
2679
|
}
|
|
2926
2680
|
onSearchQueryChange == null ? void 0 : onSearchQueryChange("");
|
|
2927
2681
|
}, [clearSearchOnClose, currentSearchQuery, isOpen, onSearchQueryChange, searchQuery]);
|
|
2928
|
-
(0,
|
|
2682
|
+
(0, import_react8.useEffect)(() => {
|
|
2929
2683
|
if (!isOpen) {
|
|
2930
2684
|
return;
|
|
2931
2685
|
}
|
|
@@ -2941,7 +2695,7 @@ function SelectBase({
|
|
|
2941
2695
|
document.removeEventListener("pointerdown", handlePointerDown);
|
|
2942
2696
|
};
|
|
2943
2697
|
}, [isOpen]);
|
|
2944
|
-
(0,
|
|
2698
|
+
(0, import_react8.useEffect)(() => {
|
|
2945
2699
|
var _a2;
|
|
2946
2700
|
if (isControlled) {
|
|
2947
2701
|
return;
|
|
@@ -3056,20 +2810,10 @@ function SelectBase({
|
|
|
3056
2810
|
event.stopPropagation();
|
|
3057
2811
|
toggleVisibleSelection(!hasAllVisibleSelected);
|
|
3058
2812
|
},
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
margin: 0,
|
|
3064
|
-
display: "inline-flex",
|
|
3065
|
-
alignItems: "center",
|
|
3066
|
-
justifyContent: "center",
|
|
3067
|
-
flexShrink: 0,
|
|
3068
|
-
border: "none",
|
|
3069
|
-
background: "transparent",
|
|
3070
|
-
cursor: canToggleVisibleSelection ? "pointer" : "not-allowed",
|
|
3071
|
-
opacity: canToggleVisibleSelection ? 1 : 0.45
|
|
3072
|
-
},
|
|
2813
|
+
className: cx(
|
|
2814
|
+
"m-0 inline-flex h-5 w-5 shrink-0 items-center justify-center border-0 bg-transparent p-0",
|
|
2815
|
+
canToggleVisibleSelection ? "cursor-pointer opacity-100" : "cursor-not-allowed opacity-45"
|
|
2816
|
+
),
|
|
3073
2817
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3074
2818
|
CheckboxIndicator,
|
|
3075
2819
|
{
|
|
@@ -3223,7 +2967,7 @@ function SelectBase({
|
|
|
3223
2967
|
htmlFor: resolvedId,
|
|
3224
2968
|
required: rest.required,
|
|
3225
2969
|
useLabelWrapper: false,
|
|
3226
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: shellRef,
|
|
2970
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref: shellRef, className: "relative w-full", style: selectVariables, children: [
|
|
3227
2971
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3228
2972
|
"button",
|
|
3229
2973
|
{
|
|
@@ -3231,7 +2975,7 @@ function SelectBase({
|
|
|
3231
2975
|
id: resolvedId,
|
|
3232
2976
|
ref: buttonRef,
|
|
3233
2977
|
type: "button",
|
|
3234
|
-
className,
|
|
2978
|
+
className: cx(triggerClassName, className),
|
|
3235
2979
|
title: rest.title,
|
|
3236
2980
|
disabled: disabled || !canOpenMenu,
|
|
3237
2981
|
autoFocus,
|
|
@@ -3247,42 +2991,15 @@ function SelectBase({
|
|
|
3247
2991
|
onBlur: handleTriggerBlur,
|
|
3248
2992
|
onKeyDown: handleTriggerKeyDown,
|
|
3249
2993
|
style: {
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
height: controlMetrics.height,
|
|
3253
|
-
borderRadius: STANDARD_COMPONENT_BORDER_RADIUS,
|
|
3254
|
-
border: `1px solid ${error ? theme.colors.negative : theme.colors.textLight}`,
|
|
3255
|
-
backgroundColor: theme.colors.surface,
|
|
3256
|
-
color: hasSelection ? theme.colors.text : placeholderTextColor,
|
|
3257
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
3258
|
-
opacity: disabled ? DISABLED_FIELD_OPACITY : 1,
|
|
3259
|
-
padding: getSelectControlPadding(controlSize),
|
|
3260
|
-
outline: "none",
|
|
3261
|
-
boxShadow: componentShadow,
|
|
3262
|
-
font: "inherit",
|
|
3263
|
-
fontSize: controlMetrics.fontSize,
|
|
3264
|
-
lineHeight: controlMetrics.lineHeight,
|
|
3265
|
-
transition: FIELD_SURFACE_TRANSITION,
|
|
3266
|
-
display: "flex",
|
|
3267
|
-
alignItems: "center",
|
|
3268
|
-
justifyContent: "space-between",
|
|
3269
|
-
gap: 12,
|
|
3270
|
-
minWidth: 0,
|
|
3271
|
-
textAlign: "left",
|
|
2994
|
+
padding: `${controlMetrics.paddingY}px ${controlMetrics.selectPaddingRight}px ${controlMetrics.paddingY}px ${controlMetrics.paddingX}px`,
|
|
2995
|
+
boxShadow: triggerBoxShadow,
|
|
3272
2996
|
...style
|
|
3273
2997
|
},
|
|
3274
2998
|
children: [
|
|
3275
2999
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3276
3000
|
"span",
|
|
3277
3001
|
{
|
|
3278
|
-
|
|
3279
|
-
display: "block",
|
|
3280
|
-
flex: "1 1 auto",
|
|
3281
|
-
minWidth: 0,
|
|
3282
|
-
overflow: "hidden",
|
|
3283
|
-
textOverflow: "ellipsis",
|
|
3284
|
-
whiteSpace: "nowrap"
|
|
3285
|
-
},
|
|
3002
|
+
className: "block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3286
3003
|
children: displayContent
|
|
3287
3004
|
}
|
|
3288
3005
|
),
|
|
@@ -3290,18 +3007,14 @@ function SelectBase({
|
|
|
3290
3007
|
"span",
|
|
3291
3008
|
{
|
|
3292
3009
|
"aria-hidden": "true",
|
|
3010
|
+
className: cx(
|
|
3011
|
+
"pointer-events-none absolute top-1/2 flex -translate-y-1/2 items-center justify-center",
|
|
3012
|
+
"transition-[transform,color] duration-150",
|
|
3013
|
+
disabled ? "text-[var(--ui-kit-select-indicator-disabled)]" : "text-[var(--ui-kit-select-muted)]"
|
|
3014
|
+
),
|
|
3293
3015
|
style: {
|
|
3294
|
-
position: "absolute",
|
|
3295
3016
|
right: indicatorOffset,
|
|
3296
|
-
|
|
3297
|
-
transform: `translateY(-50%) rotate(${isOpen ? 180 : 0}deg)`,
|
|
3298
|
-
transformOrigin: "center",
|
|
3299
|
-
color: disabled ? withAlpha(theme.colors.text, 0.42) : mutedText,
|
|
3300
|
-
display: "flex",
|
|
3301
|
-
alignItems: "center",
|
|
3302
|
-
justifyContent: "center",
|
|
3303
|
-
pointerEvents: "none",
|
|
3304
|
-
transition: "transform 160ms ease, color 160ms ease"
|
|
3017
|
+
transform: `translateY(-50%) rotate(${isOpen ? 180 : 0}deg)`
|
|
3305
3018
|
},
|
|
3306
3019
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3307
3020
|
"path",
|
|
@@ -3331,17 +3044,7 @@ function SelectBase({
|
|
|
3331
3044
|
onChange: handleHiddenSelectChange,
|
|
3332
3045
|
tabIndex: -1,
|
|
3333
3046
|
"aria-hidden": "true",
|
|
3334
|
-
|
|
3335
|
-
position: "absolute",
|
|
3336
|
-
width: 1,
|
|
3337
|
-
height: 1,
|
|
3338
|
-
padding: 0,
|
|
3339
|
-
margin: 0,
|
|
3340
|
-
border: 0,
|
|
3341
|
-
opacity: 0,
|
|
3342
|
-
pointerEvents: "none",
|
|
3343
|
-
clipPath: "inset(50%)"
|
|
3344
|
-
},
|
|
3047
|
+
className: "ui-kit-sr-only pointer-events-none opacity-0",
|
|
3345
3048
|
children: nativeOptions
|
|
3346
3049
|
}
|
|
3347
3050
|
),
|
|
@@ -3349,7 +3052,7 @@ function SelectBase({
|
|
|
3349
3052
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("style", { children: `
|
|
3350
3053
|
#${listboxId} {
|
|
3351
3054
|
scrollbar-width: thin;
|
|
3352
|
-
scrollbar-color:
|
|
3055
|
+
scrollbar-color: var(--ui-kit-select-scrollbar-thumb) transparent;
|
|
3353
3056
|
}
|
|
3354
3057
|
|
|
3355
3058
|
#${listboxId}::-webkit-scrollbar {
|
|
@@ -3361,19 +3064,19 @@ function SelectBase({
|
|
|
3361
3064
|
}
|
|
3362
3065
|
|
|
3363
3066
|
#${listboxId}::-webkit-scrollbar-thumb {
|
|
3364
|
-
background:
|
|
3067
|
+
background: var(--ui-kit-select-scrollbar-thumb);
|
|
3365
3068
|
border-radius: 999px;
|
|
3366
3069
|
border: 2px solid transparent;
|
|
3367
3070
|
background-clip: padding-box;
|
|
3368
3071
|
}
|
|
3369
3072
|
|
|
3370
3073
|
#${listboxId}::-webkit-scrollbar-thumb:hover {
|
|
3371
|
-
background:
|
|
3074
|
+
background: var(--ui-kit-select-scrollbar-thumb-hover);
|
|
3372
3075
|
background-clip: padding-box;
|
|
3373
3076
|
}
|
|
3374
3077
|
|
|
3375
3078
|
#${searchInputId}::placeholder {
|
|
3376
|
-
color:
|
|
3079
|
+
color: var(--ui-kit-select-placeholder);
|
|
3377
3080
|
opacity: 1;
|
|
3378
3081
|
}
|
|
3379
3082
|
` }),
|
|
@@ -3381,40 +3084,21 @@ function SelectBase({
|
|
|
3381
3084
|
"div",
|
|
3382
3085
|
{
|
|
3383
3086
|
ref: menuRef,
|
|
3087
|
+
className: "absolute left-0 right-0 z-30 flex max-h-[280px] flex-col gap-1 overflow-hidden rounded-[20px] border p-2",
|
|
3384
3088
|
style: {
|
|
3385
|
-
position: "absolute",
|
|
3386
3089
|
top: menuPlacement === "bottom" ? `calc(100% + ${MENU_OFFSET}px)` : "auto",
|
|
3387
3090
|
bottom: menuPlacement === "top" ? `calc(100% + ${MENU_OFFSET}px)` : "auto",
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
overflow: "hidden",
|
|
3393
|
-
boxSizing: "border-box",
|
|
3394
|
-
borderRadius: 20,
|
|
3395
|
-
border: `1px solid ${theme.colors.textLight}`,
|
|
3396
|
-
backgroundColor: surfaceRaised,
|
|
3397
|
-
padding: 8,
|
|
3398
|
-
boxShadow: componentShadow,
|
|
3399
|
-
backdropFilter: "blur(6px)",
|
|
3400
|
-
visibility: isPlacementResolved ? "visible" : "hidden",
|
|
3401
|
-
display: "flex",
|
|
3402
|
-
flexDirection: "column",
|
|
3403
|
-
gap: 4
|
|
3091
|
+
borderColor: "var(--theme-textLight)",
|
|
3092
|
+
backgroundColor: "var(--ui-kit-select-surface-raised)",
|
|
3093
|
+
boxShadow: "var(--ui-kit-select-control-shadow)",
|
|
3094
|
+
visibility: isPlacementResolved ? "visible" : "hidden"
|
|
3404
3095
|
},
|
|
3405
3096
|
children: [
|
|
3406
3097
|
hasFilter ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3407
3098
|
"div",
|
|
3408
3099
|
{
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
alignItems: "center",
|
|
3412
|
-
justifyContent: "flex-start",
|
|
3413
|
-
gap: 8,
|
|
3414
|
-
padding: "4px 4px 10px",
|
|
3415
|
-
borderBottom: `1px solid ${withAlpha(theme.colors.text, 0.08)}`,
|
|
3416
|
-
flexShrink: 0
|
|
3417
|
-
},
|
|
3100
|
+
className: "flex shrink-0 items-center justify-start gap-2 border-b px-1 pb-[10px] pt-1",
|
|
3101
|
+
style: { borderColor: "var(--ui-kit-select-divider)" },
|
|
3418
3102
|
children: [
|
|
3419
3103
|
bulkToggleControl,
|
|
3420
3104
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
@@ -3437,20 +3121,10 @@ function SelectBase({
|
|
|
3437
3121
|
},
|
|
3438
3122
|
placeholder: searchPlaceholder,
|
|
3439
3123
|
"aria-label": searchPlaceholder,
|
|
3124
|
+
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",
|
|
3440
3125
|
style: {
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
border: `1px solid ${theme.colors.textLight}`,
|
|
3444
|
-
backgroundColor: theme.colors.surface,
|
|
3445
|
-
padding: "7px 11px",
|
|
3446
|
-
borderRadius: 11,
|
|
3447
|
-
font: "inherit",
|
|
3448
|
-
fontSize: 11,
|
|
3449
|
-
lineHeight: 1.4,
|
|
3450
|
-
color: theme.colors.text,
|
|
3451
|
-
outline: "none",
|
|
3452
|
-
boxSizing: "border-box",
|
|
3453
|
-
boxShadow: componentShadow
|
|
3126
|
+
borderColor: "var(--theme-textLight)",
|
|
3127
|
+
boxShadow: "var(--ui-kit-select-control-shadow)"
|
|
3454
3128
|
}
|
|
3455
3129
|
}
|
|
3456
3130
|
)
|
|
@@ -3459,14 +3133,8 @@ function SelectBase({
|
|
|
3459
3133
|
) : isMultiSelect ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3460
3134
|
"div",
|
|
3461
3135
|
{
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
alignItems: "center",
|
|
3465
|
-
justifyContent: "flex-start",
|
|
3466
|
-
padding: "4px 4px 10px",
|
|
3467
|
-
borderBottom: `1px solid ${withAlpha(theme.colors.text, 0.08)}`,
|
|
3468
|
-
flexShrink: 0
|
|
3469
|
-
},
|
|
3136
|
+
className: "flex shrink-0 items-center justify-start border-b px-1 pb-[10px] pt-1",
|
|
3137
|
+
style: { borderColor: "var(--ui-kit-select-divider)" },
|
|
3470
3138
|
children: bulkToggleControl
|
|
3471
3139
|
}
|
|
3472
3140
|
) : null,
|
|
@@ -3478,44 +3146,22 @@ function SelectBase({
|
|
|
3478
3146
|
"aria-labelledby": resolvedId,
|
|
3479
3147
|
"aria-multiselectable": isMultiSelect || void 0,
|
|
3480
3148
|
onScroll: onListboxScroll,
|
|
3481
|
-
|
|
3482
|
-
overflowY: "auto",
|
|
3483
|
-
overflowX: "hidden",
|
|
3484
|
-
minHeight: 0,
|
|
3485
|
-
flex: "1 1 auto"
|
|
3486
|
-
},
|
|
3149
|
+
className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden",
|
|
3487
3150
|
children: visibleGroups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3488
3151
|
"div",
|
|
3489
3152
|
{
|
|
3490
|
-
|
|
3491
|
-
padding: "14px 12px",
|
|
3492
|
-
color: mutedText,
|
|
3493
|
-
fontSize: 13,
|
|
3494
|
-
textAlign: "center"
|
|
3495
|
-
},
|
|
3153
|
+
className: "px-3 py-[14px] text-center text-[13px] text-[var(--ui-kit-select-muted)]",
|
|
3496
3154
|
children: emptyState
|
|
3497
3155
|
}
|
|
3498
3156
|
) : visibleGroups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3499
3157
|
"div",
|
|
3500
3158
|
{
|
|
3501
|
-
|
|
3502
|
-
display: "flex",
|
|
3503
|
-
flexDirection: "column",
|
|
3504
|
-
gap: 4,
|
|
3505
|
-
marginTop: group.label ? 4 : 0
|
|
3506
|
-
},
|
|
3159
|
+
className: cx("flex flex-col gap-1", group.label ? "mt-1" : "mt-0"),
|
|
3507
3160
|
children: [
|
|
3508
3161
|
group.label ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3509
3162
|
"span",
|
|
3510
3163
|
{
|
|
3511
|
-
|
|
3512
|
-
padding: "6px 8px 2px",
|
|
3513
|
-
color: mutedText,
|
|
3514
|
-
fontSize: 11,
|
|
3515
|
-
fontWeight: 800,
|
|
3516
|
-
letterSpacing: "0.08em",
|
|
3517
|
-
textTransform: "uppercase"
|
|
3518
|
-
},
|
|
3164
|
+
className: "px-2 pb-0.5 pt-1.5 text-[11px] font-extrabold uppercase tracking-[0.08em] text-[var(--ui-kit-select-muted)]",
|
|
3519
3165
|
children: group.label
|
|
3520
3166
|
}
|
|
3521
3167
|
) : null,
|
|
@@ -3547,33 +3193,22 @@ function SelectBase({
|
|
|
3547
3193
|
commitSelection(option.value);
|
|
3548
3194
|
}
|
|
3549
3195
|
},
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
color: option.disabled ? withAlpha(theme.colors.text, 0.38) : isActive ? theme.colors.onPrimary : theme.colors.text,
|
|
3562
|
-
backgroundColor: isSelected ? optionSelectedBackground : isHighlighted ? optionHoverBackground : "transparent",
|
|
3563
|
-
fontWeight: isSelected ? 700 : 400,
|
|
3564
|
-
transition: "background-color 140ms ease, color 140ms ease"
|
|
3565
|
-
},
|
|
3196
|
+
className: cx(
|
|
3197
|
+
"flex w-full min-w-0 items-center justify-between gap-3 rounded-xl box-border",
|
|
3198
|
+
"transition-[background-color,color] duration-150",
|
|
3199
|
+
OPTION_PADDING_CLASSNAMES[controlSize],
|
|
3200
|
+
option.disabled ? "cursor-not-allowed text-[var(--ui-kit-select-option-disabled)]" : "cursor-pointer",
|
|
3201
|
+
!option.disabled && isActive ? "text-[var(--theme-onPrimary)]" : null,
|
|
3202
|
+
!option.disabled && !isActive ? "text-[var(--theme-text)]" : null,
|
|
3203
|
+
isSelected ? "bg-[var(--ui-kit-select-option-selected-bg)] font-bold" : null,
|
|
3204
|
+
!isSelected && isHighlighted ? "bg-[var(--ui-kit-select-option-hover-bg)]" : null,
|
|
3205
|
+
!isSelected && !isHighlighted ? "bg-[var(--theme-surface)] font-normal" : null
|
|
3206
|
+
),
|
|
3566
3207
|
children: [
|
|
3567
3208
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
3568
3209
|
"span",
|
|
3569
3210
|
{
|
|
3570
|
-
|
|
3571
|
-
display: "flex",
|
|
3572
|
-
alignItems: "center",
|
|
3573
|
-
gap: 10,
|
|
3574
|
-
flex: "1 1 auto",
|
|
3575
|
-
minWidth: 0
|
|
3576
|
-
},
|
|
3211
|
+
className: "flex min-w-0 flex-1 items-center gap-2.5",
|
|
3577
3212
|
children: [
|
|
3578
3213
|
isMultiSelect ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3579
3214
|
CheckboxIndicator,
|
|
@@ -3581,23 +3216,16 @@ function SelectBase({
|
|
|
3581
3216
|
checked: isSelected,
|
|
3582
3217
|
disabled: option.disabled,
|
|
3583
3218
|
size: 16,
|
|
3584
|
-
checkedColor: isActive ? theme
|
|
3585
|
-
iconColor: isActive ? theme
|
|
3586
|
-
uncheckedBorderColor: isActive ? theme
|
|
3219
|
+
checkedColor: isActive ? "var(--theme-onPrimary)" : "var(--theme-primary)",
|
|
3220
|
+
iconColor: isActive ? "var(--theme-primary)" : "var(--theme-onPrimary)",
|
|
3221
|
+
uncheckedBorderColor: isActive ? "var(--theme-onPrimary)" : withAlpha(theme.colors.text, 0.26),
|
|
3587
3222
|
uncheckedBackgroundColor: "transparent"
|
|
3588
3223
|
}
|
|
3589
3224
|
) : null,
|
|
3590
3225
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3591
3226
|
"span",
|
|
3592
3227
|
{
|
|
3593
|
-
|
|
3594
|
-
display: "block",
|
|
3595
|
-
flex: "1 1 auto",
|
|
3596
|
-
minWidth: 0,
|
|
3597
|
-
overflow: "hidden",
|
|
3598
|
-
textOverflow: "ellipsis",
|
|
3599
|
-
whiteSpace: "nowrap"
|
|
3600
|
-
},
|
|
3228
|
+
className: "block min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap",
|
|
3601
3229
|
children: option.label
|
|
3602
3230
|
}
|
|
3603
3231
|
)
|
|
@@ -3608,13 +3236,7 @@ function SelectBase({
|
|
|
3608
3236
|
"span",
|
|
3609
3237
|
{
|
|
3610
3238
|
"aria-hidden": "true",
|
|
3611
|
-
|
|
3612
|
-
display: "flex",
|
|
3613
|
-
alignItems: "center",
|
|
3614
|
-
justifyContent: "center",
|
|
3615
|
-
color: theme.colors.primary,
|
|
3616
|
-
flexShrink: 0
|
|
3617
|
-
},
|
|
3239
|
+
className: "flex shrink-0 items-center justify-center text-[var(--theme-primary)]",
|
|
3618
3240
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3619
3241
|
"path",
|
|
3620
3242
|
{
|
|
@@ -3641,11 +3263,8 @@ function SelectBase({
|
|
|
3641
3263
|
menuFooter ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3642
3264
|
"div",
|
|
3643
3265
|
{
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
borderTop: `1px solid ${withAlpha(theme.colors.text, 0.08)}`,
|
|
3647
|
-
flexShrink: 0
|
|
3648
|
-
},
|
|
3266
|
+
className: "shrink-0 border-t px-2 pb-1 pt-2.5",
|
|
3267
|
+
style: { borderColor: "var(--ui-kit-select-divider)" },
|
|
3649
3268
|
children: menuFooter
|
|
3650
3269
|
}
|
|
3651
3270
|
) : null
|
|
@@ -3659,7 +3278,7 @@ function SelectBase({
|
|
|
3659
3278
|
}
|
|
3660
3279
|
|
|
3661
3280
|
// src/componentsBase/select/childrenAdapter.ts
|
|
3662
|
-
var
|
|
3281
|
+
var import_react9 = require("react");
|
|
3663
3282
|
function buildOption(keyPrefix, index, props, groupDisabled = false) {
|
|
3664
3283
|
var _a;
|
|
3665
3284
|
const rawValue = props.value !== void 0 ? props.value : getTextContent(props.children).trim();
|
|
@@ -3686,8 +3305,8 @@ function parseSelectChildren(children) {
|
|
|
3686
3305
|
});
|
|
3687
3306
|
standaloneOptions.length = 0;
|
|
3688
3307
|
};
|
|
3689
|
-
|
|
3690
|
-
if (!(0,
|
|
3308
|
+
import_react9.Children.forEach(children, (child) => {
|
|
3309
|
+
if (!(0, import_react9.isValidElement)(child)) {
|
|
3691
3310
|
return;
|
|
3692
3311
|
}
|
|
3693
3312
|
if (child.type === "option") {
|
|
@@ -3701,8 +3320,8 @@ function parseSelectChildren(children) {
|
|
|
3701
3320
|
flushStandaloneOptions();
|
|
3702
3321
|
const groupOptions = [];
|
|
3703
3322
|
let groupOptionIndex = 0;
|
|
3704
|
-
|
|
3705
|
-
if (!(0,
|
|
3323
|
+
import_react9.Children.forEach(child.props.children, (optionChild) => {
|
|
3324
|
+
if (!(0, import_react9.isValidElement)(optionChild) || optionChild.type !== "option") {
|
|
3706
3325
|
return;
|
|
3707
3326
|
}
|
|
3708
3327
|
groupOptions.push(
|
|
@@ -3735,7 +3354,7 @@ function Select({ children, ...props }) {
|
|
|
3735
3354
|
}
|
|
3736
3355
|
|
|
3737
3356
|
// src/components/SelectAsync.tsx
|
|
3738
|
-
var
|
|
3357
|
+
var import_react10 = require("react");
|
|
3739
3358
|
|
|
3740
3359
|
// src/componentsBase/select/objectOptionsAdapter.tsx
|
|
3741
3360
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -3838,29 +3457,29 @@ function SelectAsync({
|
|
|
3838
3457
|
...props
|
|
3839
3458
|
}) {
|
|
3840
3459
|
var _a;
|
|
3841
|
-
|
|
3460
|
+
useUiKitTheme();
|
|
3842
3461
|
const isMultiSelect = Boolean(isMulti);
|
|
3843
3462
|
const isControlled = value !== void 0;
|
|
3844
|
-
const [internalSelectedOptions, setInternalSelectedOptions] = (0,
|
|
3463
|
+
const [internalSelectedOptions, setInternalSelectedOptions] = (0, import_react10.useState)(() => {
|
|
3845
3464
|
return normalizeAsyncValue(defaultValue, isMultiSelect);
|
|
3846
3465
|
});
|
|
3847
|
-
const [remoteOptions, setRemoteOptions] = (0,
|
|
3848
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
3849
|
-
const [nextPage, setNextPage] = (0,
|
|
3850
|
-
const [hasMore, setHasMore] = (0,
|
|
3851
|
-
const [isInitialLoading, setIsInitialLoading] = (0,
|
|
3852
|
-
const [isLoadingMore, setIsLoadingMore] = (0,
|
|
3853
|
-
const [loadError, setLoadError] = (0,
|
|
3466
|
+
const [remoteOptions, setRemoteOptions] = (0, import_react10.useState)(defaultOptions);
|
|
3467
|
+
const [searchQuery, setSearchQuery] = (0, import_react10.useState)("");
|
|
3468
|
+
const [nextPage, setNextPage] = (0, import_react10.useState)(1);
|
|
3469
|
+
const [hasMore, setHasMore] = (0, import_react10.useState)(true);
|
|
3470
|
+
const [isInitialLoading, setIsInitialLoading] = (0, import_react10.useState)(false);
|
|
3471
|
+
const [isLoadingMore, setIsLoadingMore] = (0, import_react10.useState)(false);
|
|
3472
|
+
const [loadError, setLoadError] = (0, import_react10.useState)(null);
|
|
3854
3473
|
const selectedOptions = isControlled ? normalizeAsyncValue(value, isMultiSelect) : internalSelectedOptions;
|
|
3855
|
-
const optionLookupRef = (0,
|
|
3856
|
-
const loadOptionsRef = (0,
|
|
3857
|
-
const remoteOptionsRef = (0,
|
|
3858
|
-
const cacheUniqsRef = (0,
|
|
3859
|
-
const requestVersionRef = (0,
|
|
3860
|
-
const activeControllerRef = (0,
|
|
3474
|
+
const optionLookupRef = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
|
|
3475
|
+
const loadOptionsRef = (0, import_react10.useRef)(loadOptions);
|
|
3476
|
+
const remoteOptionsRef = (0, import_react10.useRef)(remoteOptions);
|
|
3477
|
+
const cacheUniqsRef = (0, import_react10.useRef)(cacheUniqs);
|
|
3478
|
+
const requestVersionRef = (0, import_react10.useRef)(0);
|
|
3479
|
+
const activeControllerRef = (0, import_react10.useRef)(null);
|
|
3861
3480
|
loadOptionsRef.current = loadOptions;
|
|
3862
3481
|
remoteOptionsRef.current = remoteOptions;
|
|
3863
|
-
const mergedOptions = (0,
|
|
3482
|
+
const mergedOptions = (0, import_react10.useMemo)(() => {
|
|
3864
3483
|
const baseOptions = dedupeSelectObjectOptions([
|
|
3865
3484
|
...fixedOptions,
|
|
3866
3485
|
...remoteOptions
|
|
@@ -3871,20 +3490,20 @@ function SelectAsync({
|
|
|
3871
3490
|
});
|
|
3872
3491
|
return [...baseOptions, ...missingSelectedOptions];
|
|
3873
3492
|
}, [fixedOptions, remoteOptions, selectedOptions]);
|
|
3874
|
-
(0,
|
|
3493
|
+
(0, import_react10.useEffect)(() => {
|
|
3875
3494
|
const nextLookup = /* @__PURE__ */ new Map();
|
|
3876
3495
|
mergedOptions.forEach((option) => {
|
|
3877
3496
|
nextLookup.set(getSelectObjectOptionKey(option), option);
|
|
3878
3497
|
});
|
|
3879
3498
|
optionLookupRef.current = nextLookup;
|
|
3880
3499
|
}, [mergedOptions]);
|
|
3881
|
-
(0,
|
|
3500
|
+
(0, import_react10.useEffect)(() => {
|
|
3882
3501
|
if (isControlled) {
|
|
3883
3502
|
return;
|
|
3884
3503
|
}
|
|
3885
3504
|
setInternalSelectedOptions(normalizeAsyncValue(defaultValue, isMultiSelect));
|
|
3886
3505
|
}, [defaultValue, isControlled, isMultiSelect]);
|
|
3887
|
-
(0,
|
|
3506
|
+
(0, import_react10.useEffect)(() => {
|
|
3888
3507
|
if (areUnknownArraysEqual(cacheUniqsRef.current, cacheUniqs)) {
|
|
3889
3508
|
return;
|
|
3890
3509
|
}
|
|
@@ -3895,7 +3514,7 @@ function SelectAsync({
|
|
|
3895
3514
|
setHasMore(true);
|
|
3896
3515
|
setLoadError(null);
|
|
3897
3516
|
}, [cacheUniqs, defaultOptions]);
|
|
3898
|
-
(0,
|
|
3517
|
+
(0, import_react10.useEffect)(() => {
|
|
3899
3518
|
const timeoutId = window.setTimeout(() => {
|
|
3900
3519
|
var _a2;
|
|
3901
3520
|
requestVersionRef.current += 1;
|
|
@@ -3936,7 +3555,7 @@ function SelectAsync({
|
|
|
3936
3555
|
window.clearTimeout(timeoutId);
|
|
3937
3556
|
};
|
|
3938
3557
|
}, [loadErrorMessage, searchDebounceMs, searchQuery, ...cacheUniqs]);
|
|
3939
|
-
(0,
|
|
3558
|
+
(0, import_react10.useEffect)(() => {
|
|
3940
3559
|
return () => {
|
|
3941
3560
|
var _a2;
|
|
3942
3561
|
(_a2 = activeControllerRef.current) == null ? void 0 : _a2.abort();
|
|
@@ -3997,28 +3616,15 @@ function SelectAsync({
|
|
|
3997
3616
|
"div",
|
|
3998
3617
|
{
|
|
3999
3618
|
"aria-live": "polite",
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
alignItems: "center",
|
|
4003
|
-
justifyContent: hasMore ? "space-between" : "center",
|
|
4004
|
-
gap: 12,
|
|
4005
|
-
color: mutedText,
|
|
4006
|
-
fontSize: 12,
|
|
4007
|
-
lineHeight: 1.4
|
|
4008
|
-
},
|
|
3619
|
+
className: "flex items-center gap-3 text-xs leading-[1.4] text-[var(--ui-kit-muted-text)]",
|
|
3620
|
+
style: { justifyContent: hasMore ? "space-between" : "center" },
|
|
4009
3621
|
children: [
|
|
4010
3622
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: isLoadingMore ? loadingMoreMessage : hasMore ? loadMoreHintMessage : null }),
|
|
4011
3623
|
isLoadingMore ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
4012
3624
|
"span",
|
|
4013
3625
|
{
|
|
4014
3626
|
"aria-hidden": "true",
|
|
4015
|
-
|
|
4016
|
-
width: 8,
|
|
4017
|
-
height: 8,
|
|
4018
|
-
borderRadius: 999,
|
|
4019
|
-
backgroundColor: withAlpha(theme.colors.primary, 0.8),
|
|
4020
|
-
flexShrink: 0
|
|
4021
|
-
}
|
|
3627
|
+
className: "h-2 w-2 shrink-0 rounded-full bg-[var(--theme-primary)] opacity-80"
|
|
4022
3628
|
}
|
|
4023
3629
|
) : null
|
|
4024
3630
|
]
|
|
@@ -4052,13 +3658,13 @@ function SelectAsync({
|
|
|
4052
3658
|
}
|
|
4053
3659
|
|
|
4054
3660
|
// src/components/Table.tsx
|
|
4055
|
-
var
|
|
3661
|
+
var import_react13 = require("react");
|
|
4056
3662
|
|
|
4057
3663
|
// src/componentsBase/table/TableBase.tsx
|
|
4058
|
-
var
|
|
3664
|
+
var import_react12 = require("react");
|
|
4059
3665
|
|
|
4060
3666
|
// src/componentsBase/table/utils.ts
|
|
4061
|
-
var
|
|
3667
|
+
var import_react11 = require("react");
|
|
4062
3668
|
var DEFAULT_COLLAPSE_BELOW = 420;
|
|
4063
3669
|
var DEFAULT_MAX_INLINE_ACTIONS = 2;
|
|
4064
3670
|
var DEFAULT_PAGE_SIZE = 10;
|
|
@@ -4101,7 +3707,7 @@ var getNodeText = (node) => {
|
|
|
4101
3707
|
if (Array.isArray(node)) {
|
|
4102
3708
|
return node.map((entry) => getNodeText(entry)).join(" ");
|
|
4103
3709
|
}
|
|
4104
|
-
if ((0,
|
|
3710
|
+
if ((0, import_react11.isValidElement)(node)) {
|
|
4105
3711
|
const element = node;
|
|
4106
3712
|
return getNodeText(element.props.children);
|
|
4107
3713
|
}
|
|
@@ -4117,7 +3723,7 @@ var normalizeTableText = (value) => {
|
|
|
4117
3723
|
if (Array.isArray(value)) {
|
|
4118
3724
|
return value.map((entry) => normalizeTableText(entry)).join(" ");
|
|
4119
3725
|
}
|
|
4120
|
-
if ((0,
|
|
3726
|
+
if ((0, import_react11.isValidElement)(value)) {
|
|
4121
3727
|
return getNodeText(value);
|
|
4122
3728
|
}
|
|
4123
3729
|
return "";
|
|
@@ -4507,9 +4113,9 @@ function DoubleChevronIcon({ direction }) {
|
|
|
4507
4113
|
] });
|
|
4508
4114
|
}
|
|
4509
4115
|
function OverflowMenu({ label, children, buttonStyle, menuStyle }) {
|
|
4510
|
-
const [isOpen, setIsOpen] = (0,
|
|
4511
|
-
const containerRef = (0,
|
|
4512
|
-
(0,
|
|
4116
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
4117
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
4118
|
+
(0, import_react12.useEffect)(() => {
|
|
4513
4119
|
if (!isOpen) {
|
|
4514
4120
|
return;
|
|
4515
4121
|
}
|
|
@@ -4577,10 +4183,10 @@ function TableBase({
|
|
|
4577
4183
|
const uiKitTheme = useUiKitTheme();
|
|
4578
4184
|
const { theme, borderSoft, borderStrong, focusRing, mutedText, surfaceMuted, surfaceRaised } = uiKitTheme;
|
|
4579
4185
|
const componentShadow = getComponentShadow(theme);
|
|
4580
|
-
const scrollRegionId = (0,
|
|
4581
|
-
const containerRef = (0,
|
|
4582
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
4583
|
-
const [isSettingsModalOpen, setIsSettingsModalOpen] = (0,
|
|
4186
|
+
const scrollRegionId = (0, import_react12.useId)().replace(/:/g, "");
|
|
4187
|
+
const containerRef = (0, import_react12.useRef)(null);
|
|
4188
|
+
const [containerWidth, setContainerWidth] = (0, import_react12.useState)(null);
|
|
4189
|
+
const [isSettingsModalOpen, setIsSettingsModalOpen] = (0, import_react12.useState)(false);
|
|
4584
4190
|
const resolvedLabels = mergeTableLabels({
|
|
4585
4191
|
...labels != null ? labels : {},
|
|
4586
4192
|
...translations != null ? translations : {}
|
|
@@ -4622,7 +4228,7 @@ function TableBase({
|
|
|
4622
4228
|
boxShadow: stickyActionsColumnShadow,
|
|
4623
4229
|
borderLeft: `1px solid ${borderSoft}`
|
|
4624
4230
|
});
|
|
4625
|
-
(0,
|
|
4231
|
+
(0, import_react12.useEffect)(() => {
|
|
4626
4232
|
const element = containerRef.current;
|
|
4627
4233
|
if (!element) {
|
|
4628
4234
|
return;
|
|
@@ -4837,31 +4443,19 @@ function TableBase({
|
|
|
4837
4443
|
"div",
|
|
4838
4444
|
{
|
|
4839
4445
|
ref: containerRef,
|
|
4840
|
-
className
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
flexDirection: "column",
|
|
4847
|
-
gap: 16,
|
|
4848
|
-
padding: 18,
|
|
4849
|
-
boxSizing: "border-box",
|
|
4850
|
-
borderRadius: 24,
|
|
4851
|
-
backgroundColor: surfaceRaised,
|
|
4852
|
-
color: theme.colors.text,
|
|
4853
|
-
...style
|
|
4854
|
-
},
|
|
4446
|
+
className: cx(
|
|
4447
|
+
"flex w-full max-w-full min-w-0 flex-col gap-4 rounded-[24px]",
|
|
4448
|
+
"box-border bg-[var(--ui-kit-surface-raised)] p-[18px] text-[var(--theme-text)]",
|
|
4449
|
+
className
|
|
4450
|
+
),
|
|
4451
|
+
style,
|
|
4855
4452
|
children: [
|
|
4856
|
-
shouldRenderToolbar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", {
|
|
4453
|
+
shouldRenderToolbar ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center justify-between gap-3", children: [
|
|
4857
4454
|
shouldRenderToolbarPrimaryGroup ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4858
4455
|
"div",
|
|
4859
4456
|
{
|
|
4457
|
+
className: "flex min-w-0 items-center gap-2.5",
|
|
4860
4458
|
style: {
|
|
4861
|
-
display: "flex",
|
|
4862
|
-
alignItems: "center",
|
|
4863
|
-
gap: 10,
|
|
4864
|
-
minWidth: 0,
|
|
4865
4459
|
flex: shouldShowSearch ? "1 1 260px" : "0 0 auto",
|
|
4866
4460
|
marginLeft: shouldShowSearch ? void 0 : "auto"
|
|
4867
4461
|
},
|
|
@@ -4874,11 +4468,12 @@ function TableBase({
|
|
|
4874
4468
|
"aria-label": resolvedLabels.searchPlaceholder,
|
|
4875
4469
|
placeholder: resolvedLabels.searchPlaceholder,
|
|
4876
4470
|
onChange: (event) => onSearchChange(event.currentTarget.value),
|
|
4471
|
+
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",
|
|
4877
4472
|
style: {
|
|
4878
|
-
...toolbarControlStyle,
|
|
4879
4473
|
flex: "1 1 260px",
|
|
4880
4474
|
maxWidth: 360,
|
|
4881
|
-
|
|
4475
|
+
borderColor: "var(--ui-kit-border-soft)",
|
|
4476
|
+
boxShadow: "var(--ui-kit-component-shadow)"
|
|
4882
4477
|
}
|
|
4883
4478
|
}
|
|
4884
4479
|
) : null,
|
|
@@ -4899,19 +4494,12 @@ function TableBase({
|
|
|
4899
4494
|
shouldShowToolbarStatus ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
4900
4495
|
"div",
|
|
4901
4496
|
{
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
flexWrap: "wrap",
|
|
4905
|
-
alignItems: "center",
|
|
4906
|
-
justifyContent: "flex-end",
|
|
4907
|
-
gap: 10,
|
|
4908
|
-
minWidth: 0,
|
|
4909
|
-
marginLeft: shouldRenderToolbarPrimaryGroup ? "auto" : void 0
|
|
4910
|
-
},
|
|
4497
|
+
className: "flex min-w-0 flex-wrap items-center justify-end gap-2.5",
|
|
4498
|
+
style: { marginLeft: shouldRenderToolbarPrimaryGroup ? "auto" : void 0 },
|
|
4911
4499
|
children: [
|
|
4912
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
4913
|
-
!loading && error && hasRows ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", {
|
|
4914
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
4500
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[13px] font-semibold text-[var(--ui-kit-muted-text)]", children: resolvedLabels.loadingMessage }) : null,
|
|
4501
|
+
!loading && error && hasRows ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "inline-flex items-center gap-2.5", children: [
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[13px] font-semibold text-[var(--theme-negative)]", children: resolvedLabels.errorMessage }),
|
|
4915
4503
|
onRetry ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { size: "sm", variant: "ghost", onClick: onRetry, children: resolvedLabels.retryLabel }) : null
|
|
4916
4504
|
] }) : null
|
|
4917
4505
|
]
|
|
@@ -4919,7 +4507,7 @@ function TableBase({
|
|
|
4919
4507
|
) : null
|
|
4920
4508
|
] }) : null,
|
|
4921
4509
|
!hasRows && (!loading || error) ? renderEmptyState() : null,
|
|
4922
|
-
hasRows ? isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "list", "aria-label": ariaLabel,
|
|
4510
|
+
hasRows ? isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { role: "list", "aria-label": ariaLabel, className: "flex flex-col gap-3.5", children: items.map((item, rowIndex) => {
|
|
4923
4511
|
const rowActions = renderActions(item, rowIndex);
|
|
4924
4512
|
const rowBackgroundColor = rowIndex % 2 === 0 ? theme.colors.surface : surfaceMuted;
|
|
4925
4513
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
@@ -5065,18 +4653,12 @@ function TableBase({
|
|
|
5065
4653
|
id: scrollRegionId,
|
|
5066
4654
|
role: "region",
|
|
5067
4655
|
"aria-label": ariaLabel,
|
|
4656
|
+
className: "w-full max-w-full min-w-0 overflow-x-auto overflow-y-hidden rounded-[20px] border bg-[var(--theme-surface)]",
|
|
5068
4657
|
style: {
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
minWidth: 0,
|
|
5072
|
-
overflowX: "auto",
|
|
5073
|
-
overflowY: "hidden",
|
|
5074
|
-
borderRadius: 20,
|
|
5075
|
-
border: `1px solid ${borderSoft}`,
|
|
5076
|
-
backgroundColor: theme.colors.surface,
|
|
5077
|
-
boxShadow: componentShadow
|
|
4658
|
+
borderColor: "var(--ui-kit-border-soft)",
|
|
4659
|
+
boxShadow: "var(--ui-kit-component-shadow)"
|
|
5078
4660
|
},
|
|
5079
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", {
|
|
4661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("table", { className: "min-w-full max-w-none border-separate border-spacing-0", style: { width: "max-content" }, children: [
|
|
5080
4662
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("tr", { children: [
|
|
5081
4663
|
desktopColumns.map((column, columnIndex) => {
|
|
5082
4664
|
var _a, _b;
|
|
@@ -5162,17 +4744,10 @@ function TableBase({
|
|
|
5162
4744
|
hasRows && shouldRenderFooter ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
5163
4745
|
"div",
|
|
5164
4746
|
{
|
|
5165
|
-
|
|
5166
|
-
display: "flex",
|
|
5167
|
-
flexWrap: "wrap",
|
|
5168
|
-
alignItems: "center",
|
|
5169
|
-
justifyContent: "space-between",
|
|
5170
|
-
gap: 12,
|
|
5171
|
-
paddingTop: 4
|
|
5172
|
-
},
|
|
4747
|
+
className: "flex flex-wrap items-center justify-between gap-3 pt-1",
|
|
5173
4748
|
children: [
|
|
5174
|
-
shouldShowPaginationControls ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", {
|
|
5175
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
4749
|
+
shouldShowPaginationControls ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4750
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "mr-1 text-[13px] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.pageLabel(normalizedPage, totalPages) }),
|
|
5176
4751
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5177
4752
|
"button",
|
|
5178
4753
|
{
|
|
@@ -5218,22 +4793,29 @@ function TableBase({
|
|
|
5218
4793
|
}
|
|
5219
4794
|
)
|
|
5220
4795
|
] }) : null,
|
|
5221
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
"
|
|
5225
|
-
{
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
4796
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4797
|
+
"div",
|
|
4798
|
+
{
|
|
4799
|
+
className: "flex items-center gap-2.5 text-[13px] text-[var(--ui-kit-muted-text)]",
|
|
4800
|
+
style: { marginLeft: shouldShowRowsPerPageControl ? "auto" : void 0 },
|
|
4801
|
+
children: shouldShowRowsPerPageControl ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: resolvedLabels.rowsPerPageLabel }),
|
|
4803
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4804
|
+
"select",
|
|
4805
|
+
{
|
|
4806
|
+
value: pageSize,
|
|
4807
|
+
onChange: (event) => onInternalPageSizeChange(Number(event.currentTarget.value)),
|
|
4808
|
+
className: "h-[34px] rounded-[14px] border bg-[var(--theme-surface)] px-3 text-sm leading-[1.4] text-[var(--theme-text)] outline-none",
|
|
4809
|
+
style: {
|
|
4810
|
+
borderColor: "var(--ui-kit-border-soft)",
|
|
4811
|
+
boxShadow: "var(--ui-kit-component-shadow)"
|
|
4812
|
+
},
|
|
4813
|
+
children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: option, children: option }, option))
|
|
4814
|
+
}
|
|
4815
|
+
)
|
|
4816
|
+
] }) : null
|
|
4817
|
+
}
|
|
4818
|
+
)
|
|
5237
4819
|
]
|
|
5238
4820
|
}
|
|
5239
4821
|
) : null,
|
|
@@ -5246,31 +4828,31 @@ function TableBase({
|
|
|
5246
4828
|
maxWidth: 560,
|
|
5247
4829
|
bodyStyle: { display: "grid", gap: 0 },
|
|
5248
4830
|
children: [
|
|
5249
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", {
|
|
5250
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", {
|
|
5251
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", {
|
|
4831
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "grid gap-3", children: [
|
|
4832
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "text-sm text-[var(--theme-text)]", children: resolvedLabels.tableInfoSectionTitle }),
|
|
4833
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "grid gap-2.5 [grid-template-columns:repeat(auto-fit,minmax(120px,1fr))]", children: [
|
|
5252
4834
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: infoCardStyle, children: [
|
|
5253
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
5254
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", {
|
|
4835
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.totalPagesInfoLabel }),
|
|
4836
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: totalPages })
|
|
5255
4837
|
] }),
|
|
5256
4838
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: infoCardStyle, children: [
|
|
5257
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
5258
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", {
|
|
4839
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.totalItemsInfoLabel }),
|
|
4840
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: totalItemCount })
|
|
5259
4841
|
] }),
|
|
5260
4842
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: infoCardStyle, children: [
|
|
5261
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
5262
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", {
|
|
4843
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.currentPageInfoLabel }),
|
|
4844
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: normalizedPage })
|
|
5263
4845
|
] }),
|
|
5264
4846
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { style: infoCardStyle, children: [
|
|
5265
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", {
|
|
5266
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", {
|
|
4847
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "text-[10px] font-bold uppercase tracking-[0.06em] text-[var(--ui-kit-muted-text)]", children: resolvedLabels.currentPageItemsInfoLabel }),
|
|
4848
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "text-[18px] leading-[1.1] text-[var(--theme-text)]", children: currentPageItemCount })
|
|
5267
4849
|
] })
|
|
5268
4850
|
] })
|
|
5269
4851
|
] }),
|
|
5270
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {
|
|
5271
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", {
|
|
5272
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", {
|
|
5273
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", {
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "py-[18px]", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Separator, { orientation: "horizontal", color: borderSoft }) }),
|
|
4853
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "grid gap-3", children: [
|
|
4854
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { className: "text-sm text-[var(--theme-text)]", children: resolvedLabels.downloadSectionTitle }),
|
|
4855
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-wrap gap-2.5", children: [
|
|
5274
4856
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { size: "sm", variant: "outline", onClick: handleDownloadCsv, disabled: !hasRows, children: resolvedLabels.downloadCsvLabel }),
|
|
5275
4857
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { size: "sm", variant: "outline", onClick: handleDownloadXls, disabled: !hasRows, children: resolvedLabels.downloadXlsLabel }),
|
|
5276
4858
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { size: "sm", variant: "outline", onClick: handleDownloadPdf, disabled: !hasRows, children: resolvedLabels.downloadPdfLabel })
|
|
@@ -5301,13 +4883,13 @@ function Table({
|
|
|
5301
4883
|
...props
|
|
5302
4884
|
}) {
|
|
5303
4885
|
var _a;
|
|
5304
|
-
const initialPageSizeOptions = (0,
|
|
4886
|
+
const initialPageSizeOptions = (0, import_react13.useMemo)(() => {
|
|
5305
4887
|
return sanitizePageSizeOptions(pageSizeOptions, defaultPageSize);
|
|
5306
4888
|
}, [defaultPageSize, pageSizeOptions]);
|
|
5307
|
-
const [searchValue, setSearchValue] = (0,
|
|
5308
|
-
const [page, setPage] = (0,
|
|
5309
|
-
const [pageSize, setPageSize] = (0,
|
|
5310
|
-
(0,
|
|
4889
|
+
const [searchValue, setSearchValue] = (0, import_react13.useState)(defaultSearchValue);
|
|
4890
|
+
const [page, setPage] = (0, import_react13.useState)(Math.max(1, Math.floor(defaultPage)));
|
|
4891
|
+
const [pageSize, setPageSize] = (0, import_react13.useState)((_a = initialPageSizeOptions[0]) != null ? _a : DEFAULT_PAGE_SIZE);
|
|
4892
|
+
(0, import_react13.useEffect)(() => {
|
|
5311
4893
|
var _a2;
|
|
5312
4894
|
if (initialPageSizeOptions.includes(pageSize)) {
|
|
5313
4895
|
return;
|
|
@@ -5315,7 +4897,7 @@ function Table({
|
|
|
5315
4897
|
const nextPageSize = (_a2 = initialPageSizeOptions[0]) != null ? _a2 : DEFAULT_PAGE_SIZE;
|
|
5316
4898
|
setPageSize(nextPageSize);
|
|
5317
4899
|
}, [initialPageSizeOptions, pageSize]);
|
|
5318
|
-
const filteredItems = (0,
|
|
4900
|
+
const filteredItems = (0, import_react13.useMemo)(() => {
|
|
5319
4901
|
if (!searchable) {
|
|
5320
4902
|
return items;
|
|
5321
4903
|
}
|
|
@@ -5333,14 +4915,14 @@ function Table({
|
|
|
5333
4915
|
const totalItems = filteredItems.length;
|
|
5334
4916
|
const totalPages = Math.max(1, Math.ceil(totalItems / pageSize));
|
|
5335
4917
|
const normalizedPage = clampPage(page, totalPages);
|
|
5336
|
-
(0,
|
|
4918
|
+
(0, import_react13.useEffect)(() => {
|
|
5337
4919
|
if (normalizedPage === page) {
|
|
5338
4920
|
return;
|
|
5339
4921
|
}
|
|
5340
4922
|
setPage(normalizedPage);
|
|
5341
4923
|
onPageChange == null ? void 0 : onPageChange(normalizedPage);
|
|
5342
4924
|
}, [normalizedPage, onPageChange, page]);
|
|
5343
|
-
const pageItems = (0,
|
|
4925
|
+
const pageItems = (0, import_react13.useMemo)(() => {
|
|
5344
4926
|
const startIndex = (normalizedPage - 1) * pageSize;
|
|
5345
4927
|
return filteredItems.slice(startIndex, startIndex + pageSize);
|
|
5346
4928
|
}, [filteredItems, normalizedPage, pageSize]);
|
|
@@ -5380,7 +4962,7 @@ function Table({
|
|
|
5380
4962
|
}
|
|
5381
4963
|
|
|
5382
4964
|
// src/components/TableAsync.tsx
|
|
5383
|
-
var
|
|
4965
|
+
var import_react14 = require("react");
|
|
5384
4966
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5385
4967
|
var areUnknownArraysEqual2 = (left, right) => {
|
|
5386
4968
|
if (left.length !== right.length) {
|
|
@@ -5406,25 +4988,25 @@ function TableAsync({
|
|
|
5406
4988
|
...props
|
|
5407
4989
|
}) {
|
|
5408
4990
|
var _a;
|
|
5409
|
-
const initialPageSizeOptions = (0,
|
|
4991
|
+
const initialPageSizeOptions = (0, import_react14.useMemo)(() => {
|
|
5410
4992
|
return sanitizePageSizeOptions(pageSizeOptions, defaultPageSize);
|
|
5411
4993
|
}, [defaultPageSize, pageSizeOptions]);
|
|
5412
|
-
const [searchValue, setSearchValue] = (0,
|
|
5413
|
-
const [debouncedSearchValue, setDebouncedSearchValue] = (0,
|
|
5414
|
-
const [page, setPage] = (0,
|
|
5415
|
-
const [pageSize, setPageSize] = (0,
|
|
5416
|
-
const [items, setItems] = (0,
|
|
5417
|
-
const [totalPages, setTotalPages] = (0,
|
|
5418
|
-
const [totalItems, setTotalItems] = (0,
|
|
5419
|
-
const [loading, setLoading] = (0,
|
|
5420
|
-
const [error, setError] = (0,
|
|
5421
|
-
const [reloadKey, setReloadKey] = (0,
|
|
5422
|
-
const loadItemsRef = (0,
|
|
5423
|
-
const cacheUniqsRef = (0,
|
|
5424
|
-
const activeControllerRef = (0,
|
|
5425
|
-
const requestVersionRef = (0,
|
|
4994
|
+
const [searchValue, setSearchValue] = (0, import_react14.useState)(defaultSearchValue);
|
|
4995
|
+
const [debouncedSearchValue, setDebouncedSearchValue] = (0, import_react14.useState)(defaultSearchValue);
|
|
4996
|
+
const [page, setPage] = (0, import_react14.useState)(Math.max(1, Math.floor(defaultPage)));
|
|
4997
|
+
const [pageSize, setPageSize] = (0, import_react14.useState)((_a = initialPageSizeOptions[0]) != null ? _a : DEFAULT_PAGE_SIZE);
|
|
4998
|
+
const [items, setItems] = (0, import_react14.useState)([]);
|
|
4999
|
+
const [totalPages, setTotalPages] = (0, import_react14.useState)(1);
|
|
5000
|
+
const [totalItems, setTotalItems] = (0, import_react14.useState)(void 0);
|
|
5001
|
+
const [loading, setLoading] = (0, import_react14.useState)(false);
|
|
5002
|
+
const [error, setError] = (0, import_react14.useState)(null);
|
|
5003
|
+
const [reloadKey, setReloadKey] = (0, import_react14.useState)(0);
|
|
5004
|
+
const loadItemsRef = (0, import_react14.useRef)(loadItems);
|
|
5005
|
+
const cacheUniqsRef = (0, import_react14.useRef)(cacheUniqs);
|
|
5006
|
+
const activeControllerRef = (0, import_react14.useRef)(null);
|
|
5007
|
+
const requestVersionRef = (0, import_react14.useRef)(0);
|
|
5426
5008
|
loadItemsRef.current = loadItems;
|
|
5427
|
-
(0,
|
|
5009
|
+
(0, import_react14.useEffect)(() => {
|
|
5428
5010
|
var _a2;
|
|
5429
5011
|
if (initialPageSizeOptions.includes(pageSize)) {
|
|
5430
5012
|
return;
|
|
@@ -5432,7 +5014,7 @@ function TableAsync({
|
|
|
5432
5014
|
const nextPageSize = (_a2 = initialPageSizeOptions[0]) != null ? _a2 : DEFAULT_PAGE_SIZE;
|
|
5433
5015
|
setPageSize(nextPageSize);
|
|
5434
5016
|
}, [initialPageSizeOptions, pageSize]);
|
|
5435
|
-
(0,
|
|
5017
|
+
(0, import_react14.useEffect)(() => {
|
|
5436
5018
|
const timeoutId = window.setTimeout(() => {
|
|
5437
5019
|
setDebouncedSearchValue(searchValue);
|
|
5438
5020
|
}, searchDebounceMs);
|
|
@@ -5440,7 +5022,7 @@ function TableAsync({
|
|
|
5440
5022
|
window.clearTimeout(timeoutId);
|
|
5441
5023
|
};
|
|
5442
5024
|
}, [searchDebounceMs, searchValue]);
|
|
5443
|
-
(0,
|
|
5025
|
+
(0, import_react14.useEffect)(() => {
|
|
5444
5026
|
if (areUnknownArraysEqual2(cacheUniqsRef.current, cacheUniqs)) {
|
|
5445
5027
|
return;
|
|
5446
5028
|
}
|
|
@@ -5448,7 +5030,7 @@ function TableAsync({
|
|
|
5448
5030
|
setPage(1);
|
|
5449
5031
|
setReloadKey((currentValue) => currentValue + 1);
|
|
5450
5032
|
}, [cacheUniqs]);
|
|
5451
|
-
(0,
|
|
5033
|
+
(0, import_react14.useEffect)(() => {
|
|
5452
5034
|
var _a2;
|
|
5453
5035
|
requestVersionRef.current += 1;
|
|
5454
5036
|
const currentRequestVersion = requestVersionRef.current;
|
|
@@ -5486,14 +5068,14 @@ function TableAsync({
|
|
|
5486
5068
|
setLoading(false);
|
|
5487
5069
|
});
|
|
5488
5070
|
}, [debouncedSearchValue, keepPreviousData, page, pageSize, reloadKey, searchable, ...cacheUniqs]);
|
|
5489
|
-
(0,
|
|
5071
|
+
(0, import_react14.useEffect)(() => {
|
|
5490
5072
|
return () => {
|
|
5491
5073
|
var _a2;
|
|
5492
5074
|
(_a2 = activeControllerRef.current) == null ? void 0 : _a2.abort();
|
|
5493
5075
|
};
|
|
5494
5076
|
}, []);
|
|
5495
5077
|
const normalizedPage = clampPage(page, totalPages);
|
|
5496
|
-
(0,
|
|
5078
|
+
(0, import_react14.useEffect)(() => {
|
|
5497
5079
|
if (normalizedPage === page) {
|
|
5498
5080
|
return;
|
|
5499
5081
|
}
|
|
@@ -5540,10 +5122,10 @@ function TableAsync({
|
|
|
5540
5122
|
|
|
5541
5123
|
// src/components/Textarea.tsx
|
|
5542
5124
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
5543
|
-
var
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5125
|
+
var TEXTAREA_SIZE_CLASSNAMES = {
|
|
5126
|
+
sm: "px-3 py-[10px] text-[13px] leading-4",
|
|
5127
|
+
md: "px-[14px] py-[11px] text-sm leading-[18px]",
|
|
5128
|
+
lg: "px-4 py-3 text-[15px] leading-[18px]"
|
|
5547
5129
|
};
|
|
5548
5130
|
function Textarea({
|
|
5549
5131
|
label,
|
|
@@ -5556,25 +5138,27 @@ function Textarea({
|
|
|
5556
5138
|
rows = 5,
|
|
5557
5139
|
...rest
|
|
5558
5140
|
}) {
|
|
5559
|
-
|
|
5560
|
-
const
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5141
|
+
useUiKitTheme();
|
|
5142
|
+
const textarea = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5143
|
+
"textarea",
|
|
5144
|
+
{
|
|
5145
|
+
...rest,
|
|
5146
|
+
id,
|
|
5147
|
+
disabled,
|
|
5148
|
+
rows,
|
|
5149
|
+
className: cx(
|
|
5150
|
+
"w-full min-w-0 box-border resize-y rounded-2xl border border-solid bg-[var(--theme-surface)]",
|
|
5151
|
+
"text-[var(--theme-text)] outline-none transition-[border-color,box-shadow,background-color]",
|
|
5152
|
+
"duration-150 disabled:cursor-not-allowed disabled:opacity-70",
|
|
5153
|
+
error ? "border-[var(--theme-negative)]" : "border-[var(--theme-textLight)]",
|
|
5154
|
+
TEXTAREA_SIZE_CLASSNAMES[controlSize]
|
|
5155
|
+
),
|
|
5156
|
+
style: {
|
|
5157
|
+
boxShadow: error ? "0 0 0 3px var(--ui-kit-negative-soft), var(--ui-kit-component-shadow)" : "var(--ui-kit-component-shadow)",
|
|
5158
|
+
...style
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
);
|
|
5578
5162
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ControlFrame, { label, hint, error, htmlFor: id, required: rest.required, children: textarea });
|
|
5579
5163
|
}
|
|
5580
5164
|
// Annotate the CommonJS export names for ESM import in node:
|