analytica-frontend-lib 1.0.24 → 1.0.26
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/{chunk-JNPCNN67.mjs → Alert/Alert.mjs} +1 -2
- package/dist/{components/Badge → Badge}/Badge.js +2 -2
- package/dist/{chunk-GSEO6POW.mjs → Badge/Badge.mjs} +2 -3
- package/dist/{chunk-IB4IJ3GF.mjs → Button/Button.mjs} +0 -1
- package/dist/{chunk-LYOJCBOM.mjs → CheckBox/CheckBox.mjs} +2 -2
- package/dist/{chunk-KT6HNGRV.mjs → DropdownMenu/DropdownMenu.mjs} +3 -2
- package/dist/{chunk-RPYPJ5O5.mjs → IconButton/IconButton.mjs} +0 -1
- package/dist/{chunk-QOFMTSHE.mjs → IconRoundedButton/IconRoundedButton.mjs} +0 -1
- package/dist/{chunk-CETSS3RA.mjs → NavButton/NavButton.mjs} +0 -1
- package/dist/{chunk-SESX5OEP.mjs → SelectionButton/SelectionButton.mjs} +0 -1
- package/dist/{chunk-NWGRQN6R.mjs → Table/Table.mjs} +4 -5
- package/dist/{components/Text → Text}/Text.mjs +1 -1
- package/dist/{chunk-QODEDLAX.mjs → TextArea/TextArea.mjs} +2 -2
- package/dist/{components/Toast → Toast}/Toast.js +2 -2
- package/dist/{components/Toast → Toast}/Toast.mjs +1 -1
- package/dist/{components/Toast → Toast}/utils/ToastStore.d.mts +1 -1
- package/dist/{components/Toast → Toast}/utils/ToastStore.d.ts +1 -1
- package/dist/{components/Toast → Toast}/utils/ToastStore.mjs +1 -1
- package/dist/Toast/utils/Toaster.d.mts +16 -0
- package/dist/Toast/utils/Toaster.d.ts +16 -0
- package/dist/{components/Toast → Toast}/utils/Toaster.js +2 -2
- package/dist/{chunk-IH5TEC64.mjs → Toast/utils/Toaster.mjs} +3 -3
- package/dist/{chunk-MI5FIRHM.mjs → chunk-XYTNJU4A.mjs} +2 -2
- package/dist/index.css +14 -10
- package/dist/index.d.mts +154 -26
- package/dist/index.d.ts +154 -26
- package/dist/index.js +695 -134
- package/dist/index.mjs +673 -91
- package/package.json +19 -8
- package/dist/client-components.d.mts +0 -9
- package/dist/client-components.d.ts +0 -9
- package/dist/client-components.js +0 -755
- package/dist/client-components.mjs +0 -39
- package/dist/components/Alert/Alert.mjs +0 -7
- package/dist/components/Badge/Badge.mjs +0 -6
- package/dist/components/Button/Button.mjs +0 -6
- package/dist/components/CheckBox/CheckBox.mjs +0 -8
- package/dist/components/DropdownMenu/DropdownMenu.mjs +0 -17
- package/dist/components/IconButton/IconButton.mjs +0 -6
- package/dist/components/IconRoundedButton/IconRoundedButton.mjs +0 -6
- package/dist/components/NavButton/NavButton.mjs +0 -6
- package/dist/components/SelectionButton/SelectionButton.mjs +0 -6
- package/dist/components/Table/Table.mjs +0 -20
- package/dist/components/TextArea/TextArea.mjs +0 -8
- package/dist/components/Toast/utils/Toaster.d.mts +0 -11
- package/dist/components/Toast/utils/Toaster.d.ts +0 -11
- package/dist/components/Toast/utils/Toaster.mjs +0 -11
- package/dist/server-components.d.mts +0 -11
- package/dist/server-components.d.ts +0 -11
- package/dist/server-components.js +0 -629
- package/dist/server-components.mjs +0 -52
- /package/dist/{components/Alert → Alert}/Alert.d.mts +0 -0
- /package/dist/{components/Alert → Alert}/Alert.d.ts +0 -0
- /package/dist/{components/Alert → Alert}/Alert.js +0 -0
- /package/dist/{components/Badge → Badge}/Badge.d.mts +0 -0
- /package/dist/{components/Badge → Badge}/Badge.d.ts +0 -0
- /package/dist/{components/Button → Button}/Button.d.mts +0 -0
- /package/dist/{components/Button → Button}/Button.d.ts +0 -0
- /package/dist/{components/Button → Button}/Button.js +0 -0
- /package/dist/{components/CheckBox → CheckBox}/CheckBox.d.mts +0 -0
- /package/dist/{components/CheckBox → CheckBox}/CheckBox.d.ts +0 -0
- /package/dist/{components/CheckBox → CheckBox}/CheckBox.js +0 -0
- /package/dist/{components/DropdownMenu → DropdownMenu}/DropdownMenu.d.mts +0 -0
- /package/dist/{components/DropdownMenu → DropdownMenu}/DropdownMenu.d.ts +0 -0
- /package/dist/{components/DropdownMenu → DropdownMenu}/DropdownMenu.js +0 -0
- /package/dist/{components/IconButton → IconButton}/IconButton.d.mts +0 -0
- /package/dist/{components/IconButton → IconButton}/IconButton.d.ts +0 -0
- /package/dist/{components/IconButton → IconButton}/IconButton.js +0 -0
- /package/dist/{components/IconRoundedButton → IconRoundedButton}/IconRoundedButton.d.mts +0 -0
- /package/dist/{components/IconRoundedButton → IconRoundedButton}/IconRoundedButton.d.ts +0 -0
- /package/dist/{components/IconRoundedButton → IconRoundedButton}/IconRoundedButton.js +0 -0
- /package/dist/{components/NavButton → NavButton}/NavButton.d.mts +0 -0
- /package/dist/{components/NavButton → NavButton}/NavButton.d.ts +0 -0
- /package/dist/{components/NavButton → NavButton}/NavButton.js +0 -0
- /package/dist/{components/SelectionButton → SelectionButton}/SelectionButton.d.mts +0 -0
- /package/dist/{components/SelectionButton → SelectionButton}/SelectionButton.d.ts +0 -0
- /package/dist/{components/SelectionButton → SelectionButton}/SelectionButton.js +0 -0
- /package/dist/{components/Table → Table}/Table.d.mts +0 -0
- /package/dist/{components/Table → Table}/Table.d.ts +0 -0
- /package/dist/{components/Table → Table}/Table.js +0 -0
- /package/dist/{components/Text → Text}/Text.d.mts +0 -0
- /package/dist/{components/Text → Text}/Text.d.ts +0 -0
- /package/dist/{components/Text → Text}/Text.js +0 -0
- /package/dist/{components/TextArea → TextArea}/TextArea.d.mts +0 -0
- /package/dist/{components/TextArea → TextArea}/TextArea.d.ts +0 -0
- /package/dist/{components/TextArea → TextArea}/TextArea.js +0 -0
- /package/dist/{components/Toast → Toast}/Toast.d.mts +0 -0
- /package/dist/{components/Toast → Toast}/Toast.d.ts +0 -0
- /package/dist/{components/Toast → Toast}/utils/ToastStore.js +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { Minus, Check, Bell, WarningCircle, Info, CheckCircle, X, XCircle } from 'phosphor-react';
|
|
3
|
+
import { forwardRef, useId, useState, createContext, useContext, useEffect, useCallback, useRef, useMemo } from 'react';
|
|
4
|
+
import { create } from 'zustand';
|
|
5
|
+
|
|
1
6
|
// src/components/Text/Text.tsx
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
7
|
var Text = ({
|
|
4
8
|
children,
|
|
5
9
|
size = "md",
|
|
@@ -47,9 +51,6 @@ var Text = ({
|
|
|
47
51
|
}
|
|
48
52
|
);
|
|
49
53
|
};
|
|
50
|
-
|
|
51
|
-
// src/components/Button/Button.tsx
|
|
52
|
-
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
53
54
|
var VARIANT_ACTION_CLASSES = {
|
|
54
55
|
solid: {
|
|
55
56
|
primary: "bg-primary-950 text-text border border-primary-950 hover:bg-primary-800 hover:border-primary-800 focus-visible:outline-none focus-visible:bg-primary-950 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-primary-700 active:border-primary-700 disabled:bg-primary-500 disabled:border-primary-500 disabled:opacity-40 disabled:cursor-not-allowed",
|
|
@@ -97,17 +98,13 @@ var Button = ({
|
|
|
97
98
|
type,
|
|
98
99
|
...props,
|
|
99
100
|
children: [
|
|
100
|
-
iconLeft && /* @__PURE__ */
|
|
101
|
+
iconLeft && /* @__PURE__ */ jsx("span", { className: "mr-2 flex items-center", children: iconLeft }),
|
|
101
102
|
children,
|
|
102
|
-
iconRight && /* @__PURE__ */
|
|
103
|
+
iconRight && /* @__PURE__ */ jsx("span", { className: "ml-2 flex items-center", children: iconRight })
|
|
103
104
|
]
|
|
104
105
|
}
|
|
105
106
|
);
|
|
106
107
|
};
|
|
107
|
-
|
|
108
|
-
// src/components/Badge/Badge.tsx
|
|
109
|
-
import { Bell } from "phosphor-react";
|
|
110
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
111
108
|
var VARIANT_ACTION_CLASSES2 = {
|
|
112
109
|
solid: {
|
|
113
110
|
error: "bg-error text-error-700 focus-visible:outline-none",
|
|
@@ -124,7 +121,7 @@ var VARIANT_ACTION_CLASSES2 = {
|
|
|
124
121
|
muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
|
|
125
122
|
},
|
|
126
123
|
exams: {
|
|
127
|
-
exam1: "bg-exam-1 text-info-
|
|
124
|
+
exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
|
|
128
125
|
exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
|
|
129
126
|
exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
|
|
130
127
|
exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
|
|
@@ -160,17 +157,17 @@ var Badge = ({
|
|
|
160
157
|
const sizeClassesIcon = SIZE_CLASSES_ICON[size];
|
|
161
158
|
const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
|
|
162
159
|
const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
|
|
163
|
-
const baseClasses = "inline-flex items-center justify-center rounded-xs font-
|
|
160
|
+
const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
|
|
164
161
|
const baseClassesIcon = "flex items-center";
|
|
165
162
|
if (variant === "notification") {
|
|
166
|
-
return /* @__PURE__ */
|
|
163
|
+
return /* @__PURE__ */ jsxs(
|
|
167
164
|
"div",
|
|
168
165
|
{
|
|
169
166
|
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
170
167
|
...props,
|
|
171
168
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
notificationActive && /* @__PURE__ */
|
|
169
|
+
/* @__PURE__ */ jsx(Bell, { size: 24, className: "text-primary-950" }),
|
|
170
|
+
notificationActive && /* @__PURE__ */ jsx(
|
|
174
171
|
"span",
|
|
175
172
|
{
|
|
176
173
|
"data-testid": "notification-dot",
|
|
@@ -181,23 +178,19 @@ var Badge = ({
|
|
|
181
178
|
}
|
|
182
179
|
);
|
|
183
180
|
}
|
|
184
|
-
return /* @__PURE__ */
|
|
181
|
+
return /* @__PURE__ */ jsxs(
|
|
185
182
|
"div",
|
|
186
183
|
{
|
|
187
184
|
className: `${baseClasses} ${variantClasses} ${sizeClasses} ${className}`,
|
|
188
185
|
...props,
|
|
189
186
|
children: [
|
|
190
|
-
iconLeft && /* @__PURE__ */
|
|
187
|
+
iconLeft && /* @__PURE__ */ jsx("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconLeft }),
|
|
191
188
|
children,
|
|
192
|
-
iconRight && /* @__PURE__ */
|
|
189
|
+
iconRight && /* @__PURE__ */ jsx("span", { className: `${baseClassesIcon} ${sizeClassesIcon}`, children: iconRight })
|
|
193
190
|
]
|
|
194
191
|
}
|
|
195
192
|
);
|
|
196
193
|
};
|
|
197
|
-
|
|
198
|
-
// src/components/Alert/Alert.tsx
|
|
199
|
-
import { CheckCircle, Info, WarningCircle, XCircle } from "phosphor-react";
|
|
200
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
201
194
|
var VARIANT_ACTION_CLASSES3 = {
|
|
202
195
|
solid: {
|
|
203
196
|
default: "bg-background-50 border-transparent",
|
|
@@ -222,11 +215,11 @@ var COLOR_CLASSES = {
|
|
|
222
215
|
error: "text-error-800"
|
|
223
216
|
};
|
|
224
217
|
var ICONS = {
|
|
225
|
-
default: /* @__PURE__ */
|
|
226
|
-
info: /* @__PURE__ */
|
|
227
|
-
success: /* @__PURE__ */
|
|
228
|
-
warning: /* @__PURE__ */
|
|
229
|
-
error: /* @__PURE__ */
|
|
218
|
+
default: /* @__PURE__ */ jsx(CheckCircle, { size: 18 }),
|
|
219
|
+
info: /* @__PURE__ */ jsx(Info, { size: 18 }),
|
|
220
|
+
success: /* @__PURE__ */ jsx(CheckCircle, { size: 18 }),
|
|
221
|
+
warning: /* @__PURE__ */ jsx(WarningCircle, { size: 18 }),
|
|
222
|
+
error: /* @__PURE__ */ jsx(XCircle, { size: 18 })
|
|
230
223
|
};
|
|
231
224
|
var Alert = ({
|
|
232
225
|
variant = "solid",
|
|
@@ -241,15 +234,15 @@ var Alert = ({
|
|
|
241
234
|
const variantColor = COLOR_CLASSES[action];
|
|
242
235
|
const variantIcon = ICONS[action];
|
|
243
236
|
const hasHeading = Boolean(title);
|
|
244
|
-
return /* @__PURE__ */
|
|
237
|
+
return /* @__PURE__ */ jsxs(
|
|
245
238
|
"div",
|
|
246
239
|
{
|
|
247
240
|
className: `${baseClasses} ${variantClasses} ${className ?? ""}`,
|
|
248
241
|
...props,
|
|
249
242
|
children: [
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
hasHeading && /* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ jsx("span", { className: `mt-0.5 ${variantColor}`, children: variantIcon }),
|
|
244
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
245
|
+
hasHeading && /* @__PURE__ */ jsx(
|
|
253
246
|
Text,
|
|
254
247
|
{
|
|
255
248
|
size: "md",
|
|
@@ -259,7 +252,7 @@ var Alert = ({
|
|
|
259
252
|
children: title
|
|
260
253
|
}
|
|
261
254
|
),
|
|
262
|
-
/* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ jsx(
|
|
263
256
|
Text,
|
|
264
257
|
{
|
|
265
258
|
size: hasHeading ? "sm" : "md",
|
|
@@ -273,10 +266,6 @@ var Alert = ({
|
|
|
273
266
|
}
|
|
274
267
|
);
|
|
275
268
|
};
|
|
276
|
-
|
|
277
|
-
// src/components/IconButton/IconButton.tsx
|
|
278
|
-
import { forwardRef } from "react";
|
|
279
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
280
269
|
var IconButton = forwardRef(
|
|
281
270
|
({ icon, size = "md", active = false, className = "", disabled, ...props }, ref) => {
|
|
282
271
|
const baseClasses = [
|
|
@@ -309,7 +298,7 @@ var IconButton = forwardRef(
|
|
|
309
298
|
...activeClasses
|
|
310
299
|
].join(" ");
|
|
311
300
|
const ariaLabel = props["aria-label"] ?? "Bot\xE3o de a\xE7\xE3o";
|
|
312
|
-
return /* @__PURE__ */
|
|
301
|
+
return /* @__PURE__ */ jsx(
|
|
313
302
|
"button",
|
|
314
303
|
{
|
|
315
304
|
ref,
|
|
@@ -319,15 +308,12 @@ var IconButton = forwardRef(
|
|
|
319
308
|
"aria-pressed": active,
|
|
320
309
|
"aria-label": ariaLabel,
|
|
321
310
|
...props,
|
|
322
|
-
children: /* @__PURE__ */
|
|
311
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex items-center justify-center", children: icon })
|
|
323
312
|
}
|
|
324
313
|
);
|
|
325
314
|
}
|
|
326
315
|
);
|
|
327
316
|
IconButton.displayName = "IconButton";
|
|
328
|
-
|
|
329
|
-
// src/components/IconRoundedButton/IconRoundedButton.tsx
|
|
330
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
331
317
|
var IconRoundedButton = ({
|
|
332
318
|
icon,
|
|
333
319
|
className = "",
|
|
@@ -355,22 +341,18 @@ var IconRoundedButton = ({
|
|
|
355
341
|
"disabled:opacity-50",
|
|
356
342
|
"disabled:cursor-not-allowed"
|
|
357
343
|
].join(" ");
|
|
358
|
-
return /* @__PURE__ */
|
|
344
|
+
return /* @__PURE__ */ jsx(
|
|
359
345
|
"button",
|
|
360
346
|
{
|
|
361
347
|
type: "button",
|
|
362
348
|
className: `${baseClasses} ${className}`,
|
|
363
349
|
disabled,
|
|
364
350
|
...props,
|
|
365
|
-
children: /* @__PURE__ */
|
|
351
|
+
children: /* @__PURE__ */ jsx("span", { className: "flex items-center justify-center w-5 h-5", children: icon })
|
|
366
352
|
}
|
|
367
353
|
);
|
|
368
354
|
};
|
|
369
|
-
|
|
370
|
-
// src/components/NavButton/NavButton.tsx
|
|
371
|
-
import { forwardRef as forwardRef2 } from "react";
|
|
372
|
-
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
373
|
-
var NavButton = forwardRef2(
|
|
355
|
+
var NavButton = forwardRef(
|
|
374
356
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
375
357
|
const baseClasses = [
|
|
376
358
|
"flex",
|
|
@@ -397,7 +379,7 @@ var NavButton = forwardRef2(
|
|
|
397
379
|
];
|
|
398
380
|
const stateClasses = selected ? ["bg-primary-50", "text-primary-950"] : [];
|
|
399
381
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
400
|
-
return /* @__PURE__ */
|
|
382
|
+
return /* @__PURE__ */ jsxs(
|
|
401
383
|
"button",
|
|
402
384
|
{
|
|
403
385
|
ref,
|
|
@@ -407,19 +389,15 @@ var NavButton = forwardRef2(
|
|
|
407
389
|
"aria-pressed": selected,
|
|
408
390
|
...props,
|
|
409
391
|
children: [
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
-
/* @__PURE__ */
|
|
392
|
+
/* @__PURE__ */ jsx("span", { className: "flex items-center justify-center w-5 h-5", children: icon }),
|
|
393
|
+
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: label })
|
|
412
394
|
]
|
|
413
395
|
}
|
|
414
396
|
);
|
|
415
397
|
}
|
|
416
398
|
);
|
|
417
399
|
NavButton.displayName = "NavButton";
|
|
418
|
-
|
|
419
|
-
// src/components/SelectionButton/SelectionButton.tsx
|
|
420
|
-
import { forwardRef as forwardRef3 } from "react";
|
|
421
|
-
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
422
|
-
var SelectionButton = forwardRef3(
|
|
400
|
+
var SelectionButton = forwardRef(
|
|
423
401
|
({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
|
|
424
402
|
const baseClasses = [
|
|
425
403
|
"inline-flex",
|
|
@@ -451,7 +429,7 @@ var SelectionButton = forwardRef3(
|
|
|
451
429
|
];
|
|
452
430
|
const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
|
|
453
431
|
const allClasses = [...baseClasses, ...stateClasses].join(" ");
|
|
454
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ jsxs(
|
|
455
433
|
"button",
|
|
456
434
|
{
|
|
457
435
|
ref,
|
|
@@ -461,34 +439,30 @@ var SelectionButton = forwardRef3(
|
|
|
461
439
|
"aria-pressed": selected,
|
|
462
440
|
...props,
|
|
463
441
|
children: [
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */
|
|
442
|
+
/* @__PURE__ */ jsx("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
|
|
443
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
466
444
|
]
|
|
467
445
|
}
|
|
468
446
|
);
|
|
469
447
|
}
|
|
470
448
|
);
|
|
471
449
|
SelectionButton.displayName = "SelectionButton";
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
import { forwardRef as forwardRef4 } from "react";
|
|
475
|
-
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
476
|
-
var Table = forwardRef4(
|
|
477
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx9("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ jsxs6(
|
|
450
|
+
var Table = forwardRef(
|
|
451
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "border border-border-200 rounded-xl relative w-full overflow-hidden", children: /* @__PURE__ */ jsxs(
|
|
478
452
|
"table",
|
|
479
453
|
{
|
|
480
454
|
ref,
|
|
481
455
|
className: `w-full caption-bottom text-sm ${className ?? ""}`,
|
|
482
456
|
...props,
|
|
483
457
|
children: [
|
|
484
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ jsx("caption", { className: "sr-only", children: "My Table" }),
|
|
485
459
|
children
|
|
486
460
|
]
|
|
487
461
|
}
|
|
488
462
|
) })
|
|
489
463
|
);
|
|
490
464
|
Table.displayName = "Table";
|
|
491
|
-
var TableHeader =
|
|
465
|
+
var TableHeader = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
492
466
|
"thead",
|
|
493
467
|
{
|
|
494
468
|
ref,
|
|
@@ -497,7 +471,7 @@ var TableHeader = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
497
471
|
}
|
|
498
472
|
));
|
|
499
473
|
TableHeader.displayName = "TableHeader";
|
|
500
|
-
var TableBody =
|
|
474
|
+
var TableBody = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
501
475
|
"tbody",
|
|
502
476
|
{
|
|
503
477
|
ref,
|
|
@@ -506,7 +480,7 @@ var TableBody = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ js
|
|
|
506
480
|
}
|
|
507
481
|
));
|
|
508
482
|
TableBody.displayName = "TableBody";
|
|
509
|
-
var TableFooter =
|
|
483
|
+
var TableFooter = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
510
484
|
"tfoot",
|
|
511
485
|
{
|
|
512
486
|
ref,
|
|
@@ -521,9 +495,9 @@ var VARIANT_STATES_ROW = {
|
|
|
521
495
|
invalid: "border-b-2 border-indicator-error",
|
|
522
496
|
disabled: "border-b border-border-100 bg-background-50 opacity-50 cursor-not-allowed"
|
|
523
497
|
};
|
|
524
|
-
var TableRow =
|
|
498
|
+
var TableRow = forwardRef(
|
|
525
499
|
({ state = "default", className, ...props }, ref) => {
|
|
526
|
-
return /* @__PURE__ */
|
|
500
|
+
return /* @__PURE__ */ jsx(
|
|
527
501
|
"tr",
|
|
528
502
|
{
|
|
529
503
|
ref,
|
|
@@ -540,7 +514,7 @@ var TableRow = forwardRef4(
|
|
|
540
514
|
}
|
|
541
515
|
);
|
|
542
516
|
TableRow.displayName = "TableRow";
|
|
543
|
-
var TableHead =
|
|
517
|
+
var TableHead = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
544
518
|
"th",
|
|
545
519
|
{
|
|
546
520
|
ref,
|
|
@@ -549,7 +523,7 @@ var TableHead = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ js
|
|
|
549
523
|
}
|
|
550
524
|
));
|
|
551
525
|
TableHead.displayName = "TableHead";
|
|
552
|
-
var TableCell =
|
|
526
|
+
var TableCell = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
553
527
|
"td",
|
|
554
528
|
{
|
|
555
529
|
ref,
|
|
@@ -558,7 +532,7 @@ var TableCell = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ js
|
|
|
558
532
|
}
|
|
559
533
|
));
|
|
560
534
|
TableCell.displayName = "TableCell";
|
|
561
|
-
var TableCaption =
|
|
535
|
+
var TableCaption = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
562
536
|
"caption",
|
|
563
537
|
{
|
|
564
538
|
ref,
|
|
@@ -567,21 +541,629 @@ var TableCaption = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */
|
|
|
567
541
|
}
|
|
568
542
|
));
|
|
569
543
|
TableCaption.displayName = "TableCaption";
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
544
|
+
var SIZE_CLASSES3 = {
|
|
545
|
+
small: {
|
|
546
|
+
checkbox: "w-4 h-4",
|
|
547
|
+
// 16px x 16px
|
|
548
|
+
textSize: "sm",
|
|
549
|
+
spacing: "gap-1.5",
|
|
550
|
+
// 6px
|
|
551
|
+
borderWidth: "border-2",
|
|
552
|
+
iconSize: 14,
|
|
553
|
+
// pixels for Phosphor icons
|
|
554
|
+
labelHeight: "h-[21px]"
|
|
555
|
+
},
|
|
556
|
+
medium: {
|
|
557
|
+
checkbox: "w-5 h-5",
|
|
558
|
+
// 20px x 20px
|
|
559
|
+
textSize: "md",
|
|
560
|
+
spacing: "gap-2",
|
|
561
|
+
// 8px
|
|
562
|
+
borderWidth: "border-2",
|
|
563
|
+
iconSize: 16,
|
|
564
|
+
// pixels for Phosphor icons
|
|
565
|
+
labelHeight: "h-6"
|
|
566
|
+
},
|
|
567
|
+
large: {
|
|
568
|
+
checkbox: "w-6 h-6",
|
|
569
|
+
// 24px x 24px
|
|
570
|
+
textSize: "lg",
|
|
571
|
+
spacing: "gap-2",
|
|
572
|
+
// 8px
|
|
573
|
+
borderWidth: "border-[3px]",
|
|
574
|
+
// 3px border
|
|
575
|
+
iconSize: 20,
|
|
576
|
+
// pixels for Phosphor icons
|
|
577
|
+
labelHeight: "h-[27px]"
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
581
|
+
var STATE_CLASSES = {
|
|
582
|
+
default: {
|
|
583
|
+
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
584
|
+
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
585
|
+
},
|
|
586
|
+
hovered: {
|
|
587
|
+
unchecked: "border-border-500 bg-background",
|
|
588
|
+
checked: "border-primary-800 bg-primary-800 text-text"
|
|
589
|
+
},
|
|
590
|
+
focused: {
|
|
591
|
+
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
592
|
+
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
593
|
+
},
|
|
594
|
+
invalid: {
|
|
595
|
+
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
596
|
+
checked: "border-error-700 bg-primary-950 text-text"
|
|
597
|
+
},
|
|
598
|
+
disabled: {
|
|
599
|
+
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
600
|
+
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
var CheckBox = forwardRef(
|
|
604
|
+
({
|
|
605
|
+
label,
|
|
606
|
+
size = "medium",
|
|
607
|
+
state = "default",
|
|
608
|
+
indeterminate = false,
|
|
609
|
+
errorMessage,
|
|
610
|
+
helperText,
|
|
611
|
+
className = "",
|
|
612
|
+
labelClassName = "",
|
|
613
|
+
checked: checkedProp,
|
|
614
|
+
disabled,
|
|
615
|
+
id,
|
|
616
|
+
onChange,
|
|
617
|
+
...props
|
|
618
|
+
}, ref) => {
|
|
619
|
+
const generatedId = useId();
|
|
620
|
+
const inputId = id ?? `checkbox-${generatedId}`;
|
|
621
|
+
const [internalChecked, setInternalChecked] = useState(false);
|
|
622
|
+
const isControlled = checkedProp !== void 0;
|
|
623
|
+
const checked = isControlled ? checkedProp : internalChecked;
|
|
624
|
+
const handleChange = (event) => {
|
|
625
|
+
if (!isControlled) {
|
|
626
|
+
setInternalChecked(event.target.checked);
|
|
627
|
+
}
|
|
628
|
+
onChange?.(event);
|
|
629
|
+
};
|
|
630
|
+
const currentState = disabled ? "disabled" : state;
|
|
631
|
+
const sizeClasses = SIZE_CLASSES3[size];
|
|
632
|
+
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
633
|
+
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
634
|
+
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
635
|
+
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
636
|
+
const renderIcon = () => {
|
|
637
|
+
if (indeterminate) {
|
|
638
|
+
return /* @__PURE__ */ jsx(
|
|
639
|
+
Minus,
|
|
640
|
+
{
|
|
641
|
+
size: sizeClasses.iconSize,
|
|
642
|
+
weight: "bold",
|
|
643
|
+
color: "currentColor"
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
if (checked) {
|
|
648
|
+
return /* @__PURE__ */ jsx(
|
|
649
|
+
Check,
|
|
650
|
+
{
|
|
651
|
+
size: sizeClasses.iconSize,
|
|
652
|
+
weight: "bold",
|
|
653
|
+
color: "currentColor"
|
|
654
|
+
}
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
return null;
|
|
658
|
+
};
|
|
659
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
660
|
+
/* @__PURE__ */ jsxs(
|
|
661
|
+
"div",
|
|
662
|
+
{
|
|
663
|
+
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
664
|
+
children: [
|
|
665
|
+
/* @__PURE__ */ jsx(
|
|
666
|
+
"input",
|
|
667
|
+
{
|
|
668
|
+
ref,
|
|
669
|
+
type: "checkbox",
|
|
670
|
+
id: inputId,
|
|
671
|
+
checked,
|
|
672
|
+
disabled,
|
|
673
|
+
onChange: handleChange,
|
|
674
|
+
className: "sr-only",
|
|
675
|
+
...props
|
|
676
|
+
}
|
|
677
|
+
),
|
|
678
|
+
/* @__PURE__ */ jsx("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
679
|
+
label && /* @__PURE__ */ jsx(
|
|
680
|
+
"div",
|
|
681
|
+
{
|
|
682
|
+
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
683
|
+
children: /* @__PURE__ */ jsx(
|
|
684
|
+
Text,
|
|
685
|
+
{
|
|
686
|
+
as: "label",
|
|
687
|
+
htmlFor: inputId,
|
|
688
|
+
size: sizeClasses.textSize,
|
|
689
|
+
weight: "normal",
|
|
690
|
+
className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
|
|
691
|
+
children: label
|
|
692
|
+
}
|
|
693
|
+
)
|
|
694
|
+
}
|
|
695
|
+
)
|
|
696
|
+
]
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
errorMessage && /* @__PURE__ */ jsx(
|
|
700
|
+
Text,
|
|
701
|
+
{
|
|
702
|
+
size: "sm",
|
|
703
|
+
weight: "normal",
|
|
704
|
+
className: "mt-1.5",
|
|
705
|
+
color: "text-error-600",
|
|
706
|
+
children: errorMessage
|
|
707
|
+
}
|
|
708
|
+
),
|
|
709
|
+
helperText && !errorMessage && /* @__PURE__ */ jsx(
|
|
710
|
+
Text,
|
|
711
|
+
{
|
|
712
|
+
size: "sm",
|
|
713
|
+
weight: "normal",
|
|
714
|
+
className: "mt-1.5",
|
|
715
|
+
color: "text-text-500",
|
|
716
|
+
children: helperText
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
] });
|
|
720
|
+
}
|
|
721
|
+
);
|
|
722
|
+
CheckBox.displayName = "CheckBox";
|
|
723
|
+
var SIZE_CLASSES4 = {
|
|
724
|
+
small: {
|
|
725
|
+
container: "w-72",
|
|
726
|
+
// 288px width
|
|
727
|
+
textarea: "h-24 text-sm",
|
|
728
|
+
// 96px height, 14px font
|
|
729
|
+
textSize: "sm"
|
|
730
|
+
},
|
|
731
|
+
medium: {
|
|
732
|
+
container: "w-72",
|
|
733
|
+
// 288px width
|
|
734
|
+
textarea: "h-24 text-base",
|
|
735
|
+
// 96px height, 16px font
|
|
736
|
+
textSize: "md"
|
|
737
|
+
},
|
|
738
|
+
large: {
|
|
739
|
+
container: "w-72",
|
|
740
|
+
// 288px width
|
|
741
|
+
textarea: "h-24 text-lg",
|
|
742
|
+
// 96px height, 18px font
|
|
743
|
+
textSize: "lg"
|
|
744
|
+
},
|
|
745
|
+
extraLarge: {
|
|
746
|
+
container: "w-72",
|
|
747
|
+
// 288px width
|
|
748
|
+
textarea: "h-24 text-xl",
|
|
749
|
+
// 96px height, 20px font
|
|
750
|
+
textSize: "xl"
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
var BASE_TEXTAREA_CLASSES = "w-full box-border p-3 bg-background border border-solid rounded-[4px] resize-none focus:outline-none font-roboto font-normal leading-[150%] placeholder:text-text-600 transition-all duration-200";
|
|
754
|
+
var STATE_CLASSES2 = {
|
|
755
|
+
default: {
|
|
756
|
+
base: "border-border-300 bg-background text-text-600",
|
|
757
|
+
hover: "hover:border-border-400",
|
|
758
|
+
focus: "focus:border-border-500"
|
|
759
|
+
},
|
|
760
|
+
hovered: {
|
|
761
|
+
base: "border-border-400 bg-background text-text-600",
|
|
762
|
+
hover: "",
|
|
763
|
+
focus: "focus:border-border-500"
|
|
764
|
+
},
|
|
765
|
+
focused: {
|
|
766
|
+
base: "border-2 border-primary-950 bg-background text-text-900",
|
|
767
|
+
hover: "",
|
|
768
|
+
focus: ""
|
|
769
|
+
},
|
|
770
|
+
invalid: {
|
|
771
|
+
base: "border-2 border-red-700 bg-white text-gray-800",
|
|
772
|
+
hover: "hover:border-red-700",
|
|
773
|
+
focus: "focus:border-red-700"
|
|
774
|
+
},
|
|
775
|
+
disabled: {
|
|
776
|
+
base: "border-border-300 bg-background text-text-600 cursor-not-allowed opacity-40",
|
|
777
|
+
hover: "",
|
|
778
|
+
focus: ""
|
|
779
|
+
}
|
|
780
|
+
};
|
|
781
|
+
var TextArea = forwardRef(
|
|
782
|
+
({
|
|
783
|
+
label,
|
|
784
|
+
size = "medium",
|
|
785
|
+
state = "default",
|
|
786
|
+
errorMessage,
|
|
787
|
+
helperMessage,
|
|
788
|
+
className = "",
|
|
789
|
+
labelClassName = "",
|
|
790
|
+
disabled,
|
|
791
|
+
id,
|
|
792
|
+
onChange,
|
|
793
|
+
placeholder,
|
|
794
|
+
...props
|
|
795
|
+
}, ref) => {
|
|
796
|
+
const generatedId = useId();
|
|
797
|
+
const inputId = id ?? `textarea-${generatedId}`;
|
|
798
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
799
|
+
const handleChange = (event) => {
|
|
800
|
+
onChange?.(event);
|
|
801
|
+
};
|
|
802
|
+
const handleFocus = (event) => {
|
|
803
|
+
setIsFocused(true);
|
|
804
|
+
props.onFocus?.(event);
|
|
805
|
+
};
|
|
806
|
+
const handleBlur = (event) => {
|
|
807
|
+
setIsFocused(false);
|
|
808
|
+
props.onBlur?.(event);
|
|
809
|
+
};
|
|
810
|
+
let currentState = disabled ? "disabled" : state;
|
|
811
|
+
if (isFocused && currentState !== "invalid" && currentState !== "disabled") {
|
|
812
|
+
currentState = "focused";
|
|
813
|
+
}
|
|
814
|
+
const sizeClasses = SIZE_CLASSES4[size];
|
|
815
|
+
const stateClasses = STATE_CLASSES2[currentState];
|
|
816
|
+
const textareaClasses = `${BASE_TEXTAREA_CLASSES} ${sizeClasses.textarea} ${stateClasses.base} ${stateClasses.hover} ${stateClasses.focus} ${className}`;
|
|
817
|
+
return /* @__PURE__ */ jsxs("div", { className: `flex flex-col ${sizeClasses.container}`, children: [
|
|
818
|
+
label && /* @__PURE__ */ jsx(
|
|
819
|
+
Text,
|
|
820
|
+
{
|
|
821
|
+
as: "label",
|
|
822
|
+
htmlFor: inputId,
|
|
823
|
+
size: sizeClasses.textSize,
|
|
824
|
+
weight: "medium",
|
|
825
|
+
color: "text-text-950",
|
|
826
|
+
className: `mb-1.5 ${labelClassName}`,
|
|
827
|
+
children: label
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ jsx(
|
|
831
|
+
"textarea",
|
|
832
|
+
{
|
|
833
|
+
ref,
|
|
834
|
+
id: inputId,
|
|
835
|
+
disabled,
|
|
836
|
+
onChange: handleChange,
|
|
837
|
+
onFocus: handleFocus,
|
|
838
|
+
onBlur: handleBlur,
|
|
839
|
+
className: textareaClasses,
|
|
840
|
+
placeholder,
|
|
841
|
+
...props
|
|
842
|
+
}
|
|
843
|
+
),
|
|
844
|
+
errorMessage && /* @__PURE__ */ jsx(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
845
|
+
helperMessage && !errorMessage && /* @__PURE__ */ jsx(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperMessage })
|
|
846
|
+
] });
|
|
847
|
+
}
|
|
848
|
+
);
|
|
849
|
+
TextArea.displayName = "TextArea";
|
|
850
|
+
var DropdownMenuContext = createContext(
|
|
851
|
+
void 0
|
|
852
|
+
);
|
|
853
|
+
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
854
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
855
|
+
const isControlled = open !== void 0;
|
|
856
|
+
const currentOpen = isControlled ? open : internalOpen;
|
|
857
|
+
const setOpen = useCallback(
|
|
858
|
+
(newOpen) => {
|
|
859
|
+
if (onOpenChange) onOpenChange(newOpen);
|
|
860
|
+
if (!isControlled) setInternalOpen(newOpen);
|
|
861
|
+
},
|
|
862
|
+
[isControlled, onOpenChange]
|
|
863
|
+
);
|
|
864
|
+
const menuRef = useRef(null);
|
|
865
|
+
const handleArrowDownOrArrowUp = (event) => {
|
|
866
|
+
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
867
|
+
if (menuContent) {
|
|
868
|
+
event.preventDefault();
|
|
869
|
+
const items = Array.from(
|
|
870
|
+
menuContent.querySelectorAll(
|
|
871
|
+
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
872
|
+
)
|
|
873
|
+
).filter((el) => el instanceof HTMLElement);
|
|
874
|
+
if (items.length === 0) return;
|
|
875
|
+
const focusedItem = document.activeElement;
|
|
876
|
+
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
877
|
+
let nextIndex;
|
|
878
|
+
if (event.key === "ArrowDown") {
|
|
879
|
+
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
880
|
+
} else {
|
|
881
|
+
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
882
|
+
}
|
|
883
|
+
items[nextIndex]?.focus();
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
const handleDownkey = (event) => {
|
|
887
|
+
if (event.key === "Escape") {
|
|
888
|
+
setOpen(false);
|
|
889
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
890
|
+
handleArrowDownOrArrowUp(event);
|
|
891
|
+
}
|
|
892
|
+
};
|
|
893
|
+
const handleClickOutside = (event) => {
|
|
894
|
+
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
895
|
+
setOpen(false);
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
useEffect(() => {
|
|
899
|
+
if (currentOpen) {
|
|
900
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
901
|
+
document.addEventListener("keydown", handleDownkey);
|
|
902
|
+
}
|
|
903
|
+
return () => {
|
|
904
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
905
|
+
document.removeEventListener("keydown", handleDownkey);
|
|
906
|
+
};
|
|
907
|
+
}, [currentOpen]);
|
|
908
|
+
const value = useMemo(
|
|
909
|
+
() => ({ open: currentOpen, setOpen }),
|
|
910
|
+
[currentOpen, setOpen]
|
|
911
|
+
);
|
|
912
|
+
return /* @__PURE__ */ jsx(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { className: "relative", ref: menuRef, children }) });
|
|
913
|
+
};
|
|
914
|
+
var DropdownMenuTrigger = forwardRef(({ className, children, onClick, ...props }, ref) => {
|
|
915
|
+
const context = useContext(DropdownMenuContext);
|
|
916
|
+
if (!context)
|
|
917
|
+
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
918
|
+
const { open, setOpen } = context;
|
|
919
|
+
return /* @__PURE__ */ jsx(
|
|
920
|
+
"button",
|
|
921
|
+
{
|
|
922
|
+
ref,
|
|
923
|
+
className: `border border-border-200 cursor-pointer bg-background-muted hover:bg-background-200 transition-colors px-4 py-2 rounded-sm ${className}`,
|
|
924
|
+
onClick: (e) => {
|
|
925
|
+
e.stopPropagation();
|
|
926
|
+
setOpen(!open);
|
|
927
|
+
if (onClick) onClick(e);
|
|
928
|
+
},
|
|
929
|
+
"aria-expanded": open,
|
|
930
|
+
...props,
|
|
931
|
+
children
|
|
932
|
+
}
|
|
933
|
+
);
|
|
934
|
+
});
|
|
935
|
+
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
936
|
+
var ITEM_SIZE_CLASSES = {
|
|
937
|
+
small: "text-sm",
|
|
938
|
+
medium: "text-md"
|
|
939
|
+
};
|
|
940
|
+
var SIDE_CLASSES = {
|
|
941
|
+
top: "bottom-full",
|
|
942
|
+
right: "top-full",
|
|
943
|
+
bottom: "top-full",
|
|
944
|
+
left: "top-full"
|
|
945
|
+
};
|
|
946
|
+
var ALIGN_CLASSES = {
|
|
947
|
+
start: "left-0",
|
|
948
|
+
center: "left-1/2 -translate-x-1/2",
|
|
949
|
+
end: "right-0"
|
|
950
|
+
};
|
|
951
|
+
var MenuLabel = forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
952
|
+
"fieldset",
|
|
953
|
+
{
|
|
954
|
+
ref,
|
|
955
|
+
role: "group",
|
|
956
|
+
className: `text-sm w-full ${inset ? "pl-8" : ""} ${className ?? ""}`,
|
|
957
|
+
...props
|
|
958
|
+
}
|
|
959
|
+
));
|
|
960
|
+
MenuLabel.displayName = "MenuLabel";
|
|
961
|
+
var MenuContent = forwardRef(
|
|
962
|
+
({
|
|
963
|
+
className,
|
|
964
|
+
align = "start",
|
|
965
|
+
side = "bottom",
|
|
966
|
+
sideOffset = 4,
|
|
967
|
+
children,
|
|
968
|
+
...props
|
|
969
|
+
}, ref) => {
|
|
970
|
+
const { open } = useContext(DropdownMenuContext);
|
|
971
|
+
const [isVisible, setIsVisible] = useState(open);
|
|
972
|
+
useEffect(() => {
|
|
973
|
+
if (open) {
|
|
974
|
+
setIsVisible(true);
|
|
975
|
+
} else {
|
|
976
|
+
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
977
|
+
return () => clearTimeout(timer);
|
|
978
|
+
}
|
|
979
|
+
}, [open]);
|
|
980
|
+
if (!isVisible) return null;
|
|
981
|
+
const getPositionClasses = () => {
|
|
982
|
+
const vertical = SIDE_CLASSES[side];
|
|
983
|
+
const horizontal = ALIGN_CLASSES[align];
|
|
984
|
+
return `absolute ${vertical} ${horizontal}`;
|
|
985
|
+
};
|
|
986
|
+
return /* @__PURE__ */ jsx(
|
|
987
|
+
"div",
|
|
988
|
+
{
|
|
989
|
+
ref,
|
|
990
|
+
role: "menu",
|
|
991
|
+
className: `
|
|
992
|
+
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100
|
|
993
|
+
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
994
|
+
${getPositionClasses()}
|
|
995
|
+
${className}
|
|
996
|
+
`,
|
|
997
|
+
style: {
|
|
998
|
+
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
999
|
+
marginBottom: side === "top" ? sideOffset : void 0,
|
|
1000
|
+
marginLeft: side === "right" ? sideOffset : void 0,
|
|
1001
|
+
marginRight: side === "left" ? sideOffset : void 0
|
|
1002
|
+
},
|
|
1003
|
+
...props,
|
|
1004
|
+
children
|
|
1005
|
+
}
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
1008
|
+
);
|
|
1009
|
+
MenuContent.displayName = "MenuContent";
|
|
1010
|
+
var MenuItem = forwardRef(
|
|
1011
|
+
({
|
|
1012
|
+
className,
|
|
1013
|
+
inset,
|
|
1014
|
+
size = "small",
|
|
1015
|
+
children,
|
|
1016
|
+
iconRight,
|
|
1017
|
+
iconLeft,
|
|
1018
|
+
disabled = false,
|
|
1019
|
+
onClick,
|
|
1020
|
+
...props
|
|
1021
|
+
}, ref) => {
|
|
1022
|
+
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
1023
|
+
const handleClick = (e) => {
|
|
1024
|
+
if (disabled) {
|
|
1025
|
+
e.preventDefault();
|
|
1026
|
+
e.stopPropagation();
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
onClick?.(e);
|
|
1030
|
+
};
|
|
1031
|
+
return /* @__PURE__ */ jsxs(
|
|
1032
|
+
"div",
|
|
1033
|
+
{
|
|
1034
|
+
ref,
|
|
1035
|
+
role: "menuitem",
|
|
1036
|
+
"aria-disabled": disabled,
|
|
1037
|
+
className: `
|
|
1038
|
+
focus-visible:bg-background-50
|
|
1039
|
+
relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
|
|
1040
|
+
${inset && "pl-8"}
|
|
1041
|
+
${sizeClasses}
|
|
1042
|
+
${className}
|
|
1043
|
+
${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
|
|
1044
|
+
`,
|
|
1045
|
+
onClick: handleClick,
|
|
1046
|
+
onKeyDown: (e) => {
|
|
1047
|
+
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
1048
|
+
},
|
|
1049
|
+
tabIndex: disabled ? -1 : 0,
|
|
1050
|
+
...props,
|
|
1051
|
+
children: [
|
|
1052
|
+
iconLeft,
|
|
1053
|
+
children,
|
|
1054
|
+
iconRight
|
|
1055
|
+
]
|
|
1056
|
+
}
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
);
|
|
1060
|
+
MenuItem.displayName = "MenuItem";
|
|
1061
|
+
var MenuSeparator = forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1062
|
+
"div",
|
|
1063
|
+
{
|
|
1064
|
+
ref,
|
|
1065
|
+
className: `my-1 h-px bg-border-200 ${className}`,
|
|
1066
|
+
...props
|
|
1067
|
+
}
|
|
1068
|
+
));
|
|
1069
|
+
MenuSeparator.displayName = "MenuSeparator";
|
|
1070
|
+
var VARIANT_ACTION_CLASSES4 = {
|
|
1071
|
+
solid: {
|
|
1072
|
+
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
1073
|
+
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
1074
|
+
info: "bg-info text-info-800 border-none focus-visible:outline-none"
|
|
1075
|
+
},
|
|
1076
|
+
outlined: {
|
|
1077
|
+
warning: "bg-warning text-warning-600 border border-warning-300 focus-visible:outline-none",
|
|
1078
|
+
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
1079
|
+
info: "bg-info text-info-600 border border-info-600 focus-visible:outline-none"
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
var iconMap = {
|
|
1083
|
+
success: CheckCircle,
|
|
1084
|
+
info: Info,
|
|
1085
|
+
warning: WarningCircle
|
|
1086
|
+
};
|
|
1087
|
+
var Toast = ({
|
|
1088
|
+
variant = "outlined",
|
|
1089
|
+
action = "success",
|
|
1090
|
+
className = "",
|
|
1091
|
+
onClose,
|
|
1092
|
+
title,
|
|
1093
|
+
description,
|
|
1094
|
+
position = "default",
|
|
1095
|
+
...props
|
|
1096
|
+
}) => {
|
|
1097
|
+
const variantClasses = VARIANT_ACTION_CLASSES4[variant][action];
|
|
1098
|
+
const positionClasses = {
|
|
1099
|
+
"top-left": "fixed top-4 left-4",
|
|
1100
|
+
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
1101
|
+
"top-right": "fixed top-4 right-4",
|
|
1102
|
+
"bottom-left": "fixed bottom-4 left-4",
|
|
1103
|
+
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
1104
|
+
"bottom-right": "fixed bottom-4 right-4",
|
|
1105
|
+
default: ""
|
|
1106
|
+
};
|
|
1107
|
+
const IconAction = iconMap[action] || iconMap["success"];
|
|
1108
|
+
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
1109
|
+
return /* @__PURE__ */ jsxs(
|
|
1110
|
+
"div",
|
|
1111
|
+
{
|
|
1112
|
+
role: "alert",
|
|
1113
|
+
"aria-live": "assertive",
|
|
1114
|
+
"aria-atomic": "true",
|
|
1115
|
+
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
1116
|
+
...props,
|
|
1117
|
+
children: [
|
|
1118
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-row items-start gap-3", children: [
|
|
1119
|
+
/* @__PURE__ */ jsx("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ jsx(IconAction, {}) }),
|
|
1120
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start justify-start", children: [
|
|
1121
|
+
/* @__PURE__ */ jsx("p", { className: "font-semibold text-md", children: title }),
|
|
1122
|
+
description && /* @__PURE__ */ jsx("p", { className: "text-md text-text-900", children: description })
|
|
1123
|
+
] })
|
|
1124
|
+
] }),
|
|
1125
|
+
/* @__PURE__ */ jsx(
|
|
1126
|
+
"button",
|
|
1127
|
+
{
|
|
1128
|
+
onClick: onClose,
|
|
1129
|
+
"aria-label": "Dismiss notification",
|
|
1130
|
+
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1131
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1134
|
+
]
|
|
1135
|
+
}
|
|
1136
|
+
);
|
|
1137
|
+
};
|
|
1138
|
+
var useToastStore = create((set) => ({
|
|
1139
|
+
toasts: [],
|
|
1140
|
+
addToast: (toast) => {
|
|
1141
|
+
const id = crypto.randomUUID();
|
|
1142
|
+
set((state) => ({
|
|
1143
|
+
toasts: [...state.toasts, { id, ...toast }]
|
|
1144
|
+
}));
|
|
1145
|
+
},
|
|
1146
|
+
removeToast: (id) => {
|
|
1147
|
+
set((state) => ({
|
|
1148
|
+
toasts: state.toasts.filter((t) => t.id !== id)
|
|
1149
|
+
}));
|
|
1150
|
+
}
|
|
1151
|
+
}));
|
|
1152
|
+
var Toaster = () => {
|
|
1153
|
+
const toasts = useToastStore((state) => state.toasts);
|
|
1154
|
+
const removeToast = useToastStore((state) => state.removeToast);
|
|
1155
|
+
return /* @__PURE__ */ jsx(Fragment, { children: toasts.map((toast) => /* @__PURE__ */ jsx(
|
|
1156
|
+
Toast,
|
|
1157
|
+
{
|
|
1158
|
+
title: toast.title,
|
|
1159
|
+
description: toast.description,
|
|
1160
|
+
variant: toast.variant,
|
|
1161
|
+
action: toast.action,
|
|
1162
|
+
position: toast.position,
|
|
1163
|
+
onClose: () => removeToast(toast.id)
|
|
1164
|
+
},
|
|
1165
|
+
toast.id
|
|
1166
|
+
)) });
|
|
587
1167
|
};
|
|
1168
|
+
|
|
1169
|
+
export { Alert, Badge, Button, CheckBox, DropdownMenu, MenuContent as DropdownMenuContent, MenuItem as DropdownMenuItem, MenuLabel as DropdownMenuLabel, MenuSeparator as DropdownMenuSeparator, DropdownMenuTrigger, IconButton, IconRoundedButton, NavButton, SelectionButton, Table, Text, TextArea, Toast, Toaster, useToastStore };
|