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