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
|
@@ -1,755 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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);
|
|
19
|
-
|
|
20
|
-
// src/client-components.ts
|
|
21
|
-
var client_components_exports = {};
|
|
22
|
-
__export(client_components_exports, {
|
|
23
|
-
CheckBox: () => CheckBox,
|
|
24
|
-
DropdownMenu: () => DropdownMenu,
|
|
25
|
-
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
26
|
-
MenuContent: () => MenuContent,
|
|
27
|
-
MenuItem: () => MenuItem,
|
|
28
|
-
MenuLabel: () => MenuLabel,
|
|
29
|
-
MenuSeparator: () => MenuSeparator,
|
|
30
|
-
TextArea: () => TextArea,
|
|
31
|
-
Toast: () => Toast,
|
|
32
|
-
Toaster: () => Toaster,
|
|
33
|
-
useToast: () => useToast,
|
|
34
|
-
useToastStore: () => useToastStore
|
|
35
|
-
});
|
|
36
|
-
module.exports = __toCommonJS(client_components_exports);
|
|
37
|
-
|
|
38
|
-
// src/components/CheckBox/CheckBox.tsx
|
|
39
|
-
var import_react = require("react");
|
|
40
|
-
|
|
41
|
-
// src/components/Text/Text.tsx
|
|
42
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
-
var Text = ({
|
|
44
|
-
children,
|
|
45
|
-
size = "md",
|
|
46
|
-
weight = "normal",
|
|
47
|
-
color = "text-text-950",
|
|
48
|
-
as,
|
|
49
|
-
className = "",
|
|
50
|
-
...props
|
|
51
|
-
}) => {
|
|
52
|
-
let sizeClasses = "";
|
|
53
|
-
let weightClasses = "";
|
|
54
|
-
const sizeClassMap = {
|
|
55
|
-
"2xs": "text-2xs",
|
|
56
|
-
xs: "text-xs",
|
|
57
|
-
sm: "text-sm",
|
|
58
|
-
md: "text-md",
|
|
59
|
-
lg: "text-lg",
|
|
60
|
-
xl: "text-xl",
|
|
61
|
-
"2xl": "text-2xl",
|
|
62
|
-
"3xl": "text-3xl",
|
|
63
|
-
"4xl": "text-4xl",
|
|
64
|
-
"5xl": "text-5xl",
|
|
65
|
-
"6xl": "text-6xl"
|
|
66
|
-
};
|
|
67
|
-
sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
|
|
68
|
-
const weightClassMap = {
|
|
69
|
-
hairline: "font-hairline",
|
|
70
|
-
light: "font-light",
|
|
71
|
-
normal: "font-normal",
|
|
72
|
-
medium: "font-medium",
|
|
73
|
-
semibold: "font-semibold",
|
|
74
|
-
bold: "font-bold",
|
|
75
|
-
extrabold: "font-extrabold",
|
|
76
|
-
black: "font-black"
|
|
77
|
-
};
|
|
78
|
-
weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
|
|
79
|
-
const baseClasses = "font-primary";
|
|
80
|
-
const Component = as ?? "p";
|
|
81
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
-
Component,
|
|
83
|
-
{
|
|
84
|
-
className: `${baseClasses} ${sizeClasses} ${weightClasses} ${color} ${className}`,
|
|
85
|
-
...props,
|
|
86
|
-
children
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// src/components/CheckBox/CheckBox.tsx
|
|
92
|
-
var import_phosphor_react = require("phosphor-react");
|
|
93
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
94
|
-
var SIZE_CLASSES = {
|
|
95
|
-
small: {
|
|
96
|
-
checkbox: "w-4 h-4",
|
|
97
|
-
// 16px x 16px
|
|
98
|
-
textSize: "sm",
|
|
99
|
-
spacing: "gap-1.5",
|
|
100
|
-
// 6px
|
|
101
|
-
borderWidth: "border-2",
|
|
102
|
-
iconSize: 14,
|
|
103
|
-
// pixels for Phosphor icons
|
|
104
|
-
labelHeight: "h-[21px]"
|
|
105
|
-
},
|
|
106
|
-
medium: {
|
|
107
|
-
checkbox: "w-5 h-5",
|
|
108
|
-
// 20px x 20px
|
|
109
|
-
textSize: "md",
|
|
110
|
-
spacing: "gap-2",
|
|
111
|
-
// 8px
|
|
112
|
-
borderWidth: "border-2",
|
|
113
|
-
iconSize: 16,
|
|
114
|
-
// pixels for Phosphor icons
|
|
115
|
-
labelHeight: "h-6"
|
|
116
|
-
},
|
|
117
|
-
large: {
|
|
118
|
-
checkbox: "w-6 h-6",
|
|
119
|
-
// 24px x 24px
|
|
120
|
-
textSize: "lg",
|
|
121
|
-
spacing: "gap-2",
|
|
122
|
-
// 8px
|
|
123
|
-
borderWidth: "border-[3px]",
|
|
124
|
-
// 3px border
|
|
125
|
-
iconSize: 20,
|
|
126
|
-
// pixels for Phosphor icons
|
|
127
|
-
labelHeight: "h-[27px]"
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
|
|
131
|
-
var STATE_CLASSES = {
|
|
132
|
-
default: {
|
|
133
|
-
unchecked: "border-border-400 bg-background hover:border-border-500",
|
|
134
|
-
checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
|
|
135
|
-
},
|
|
136
|
-
hovered: {
|
|
137
|
-
unchecked: "border-border-500 bg-background",
|
|
138
|
-
checked: "border-primary-800 bg-primary-800 text-text"
|
|
139
|
-
},
|
|
140
|
-
focused: {
|
|
141
|
-
unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
|
|
142
|
-
checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
|
|
143
|
-
},
|
|
144
|
-
invalid: {
|
|
145
|
-
unchecked: "border-error-700 bg-background hover:border-error-600",
|
|
146
|
-
checked: "border-error-700 bg-primary-950 text-text"
|
|
147
|
-
},
|
|
148
|
-
disabled: {
|
|
149
|
-
unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
|
|
150
|
-
checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
var CheckBox = (0, import_react.forwardRef)(
|
|
154
|
-
({
|
|
155
|
-
label,
|
|
156
|
-
size = "medium",
|
|
157
|
-
state = "default",
|
|
158
|
-
indeterminate = false,
|
|
159
|
-
errorMessage,
|
|
160
|
-
helperText,
|
|
161
|
-
className = "",
|
|
162
|
-
labelClassName = "",
|
|
163
|
-
checked: checkedProp,
|
|
164
|
-
disabled,
|
|
165
|
-
id,
|
|
166
|
-
onChange,
|
|
167
|
-
...props
|
|
168
|
-
}, ref) => {
|
|
169
|
-
const generatedId = (0, import_react.useId)();
|
|
170
|
-
const inputId = id ?? `checkbox-${generatedId}`;
|
|
171
|
-
const [internalChecked, setInternalChecked] = (0, import_react.useState)(false);
|
|
172
|
-
const isControlled = checkedProp !== void 0;
|
|
173
|
-
const checked = isControlled ? checkedProp : internalChecked;
|
|
174
|
-
const handleChange = (event) => {
|
|
175
|
-
if (!isControlled) {
|
|
176
|
-
setInternalChecked(event.target.checked);
|
|
177
|
-
}
|
|
178
|
-
onChange?.(event);
|
|
179
|
-
};
|
|
180
|
-
const currentState = disabled ? "disabled" : state;
|
|
181
|
-
const sizeClasses = SIZE_CLASSES[size];
|
|
182
|
-
const checkVariant = checked || indeterminate ? "checked" : "unchecked";
|
|
183
|
-
const stylingClasses = STATE_CLASSES[currentState][checkVariant];
|
|
184
|
-
const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
|
|
185
|
-
const checkboxClasses = `${BASE_CHECKBOX_CLASSES} ${sizeClasses.checkbox} ${borderWidthClass} ${stylingClasses} ${className}`;
|
|
186
|
-
const renderIcon = () => {
|
|
187
|
-
if (indeterminate) {
|
|
188
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
189
|
-
import_phosphor_react.Minus,
|
|
190
|
-
{
|
|
191
|
-
size: sizeClasses.iconSize,
|
|
192
|
-
weight: "bold",
|
|
193
|
-
color: "currentColor"
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
if (checked) {
|
|
198
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
199
|
-
import_phosphor_react.Check,
|
|
200
|
-
{
|
|
201
|
-
size: sizeClasses.iconSize,
|
|
202
|
-
weight: "bold",
|
|
203
|
-
color: "currentColor"
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
return null;
|
|
208
|
-
};
|
|
209
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex flex-col", children: [
|
|
210
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
211
|
-
"div",
|
|
212
|
-
{
|
|
213
|
-
className: `flex flex-row items-center ${sizeClasses.spacing} ${disabled ? "opacity-40" : ""}`,
|
|
214
|
-
children: [
|
|
215
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
216
|
-
"input",
|
|
217
|
-
{
|
|
218
|
-
ref,
|
|
219
|
-
type: "checkbox",
|
|
220
|
-
id: inputId,
|
|
221
|
-
checked,
|
|
222
|
-
disabled,
|
|
223
|
-
onChange: handleChange,
|
|
224
|
-
className: "sr-only",
|
|
225
|
-
...props
|
|
226
|
-
}
|
|
227
|
-
),
|
|
228
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
|
|
229
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
230
|
-
"div",
|
|
231
|
-
{
|
|
232
|
-
className: `flex flex-row items-center ${sizeClasses.labelHeight}`,
|
|
233
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
234
|
-
Text,
|
|
235
|
-
{
|
|
236
|
-
as: "label",
|
|
237
|
-
htmlFor: inputId,
|
|
238
|
-
size: sizeClasses.textSize,
|
|
239
|
-
weight: "normal",
|
|
240
|
-
className: `cursor-pointer select-none leading-[150%] flex items-center font-roboto ${labelClassName}`,
|
|
241
|
-
children: label
|
|
242
|
-
}
|
|
243
|
-
)
|
|
244
|
-
}
|
|
245
|
-
)
|
|
246
|
-
]
|
|
247
|
-
}
|
|
248
|
-
),
|
|
249
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
250
|
-
Text,
|
|
251
|
-
{
|
|
252
|
-
size: "sm",
|
|
253
|
-
weight: "normal",
|
|
254
|
-
className: "mt-1.5",
|
|
255
|
-
color: "text-error-600",
|
|
256
|
-
children: errorMessage
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
helperText && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
260
|
-
Text,
|
|
261
|
-
{
|
|
262
|
-
size: "sm",
|
|
263
|
-
weight: "normal",
|
|
264
|
-
className: "mt-1.5",
|
|
265
|
-
color: "text-text-500",
|
|
266
|
-
children: helperText
|
|
267
|
-
}
|
|
268
|
-
)
|
|
269
|
-
] });
|
|
270
|
-
}
|
|
271
|
-
);
|
|
272
|
-
CheckBox.displayName = "CheckBox";
|
|
273
|
-
|
|
274
|
-
// src/components/TextArea/TextArea.tsx
|
|
275
|
-
var import_react2 = require("react");
|
|
276
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
277
|
-
var SIZE_CLASSES2 = {
|
|
278
|
-
small: {
|
|
279
|
-
container: "w-72",
|
|
280
|
-
// 288px width
|
|
281
|
-
textarea: "h-24 text-sm",
|
|
282
|
-
// 96px height, 14px font
|
|
283
|
-
textSize: "sm"
|
|
284
|
-
},
|
|
285
|
-
medium: {
|
|
286
|
-
container: "w-72",
|
|
287
|
-
// 288px width
|
|
288
|
-
textarea: "h-24 text-base",
|
|
289
|
-
// 96px height, 16px font
|
|
290
|
-
textSize: "md"
|
|
291
|
-
},
|
|
292
|
-
large: {
|
|
293
|
-
container: "w-72",
|
|
294
|
-
// 288px width
|
|
295
|
-
textarea: "h-24 text-lg",
|
|
296
|
-
// 96px height, 18px font
|
|
297
|
-
textSize: "lg"
|
|
298
|
-
},
|
|
299
|
-
extraLarge: {
|
|
300
|
-
container: "w-72",
|
|
301
|
-
// 288px width
|
|
302
|
-
textarea: "h-24 text-xl",
|
|
303
|
-
// 96px height, 20px font
|
|
304
|
-
textSize: "xl"
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
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";
|
|
308
|
-
var STATE_CLASSES2 = {
|
|
309
|
-
default: {
|
|
310
|
-
base: "border-border-300 bg-background text-text-600",
|
|
311
|
-
hover: "hover:border-border-400",
|
|
312
|
-
focus: "focus:border-border-500"
|
|
313
|
-
},
|
|
314
|
-
hovered: {
|
|
315
|
-
base: "border-border-400 bg-background text-text-600",
|
|
316
|
-
hover: "",
|
|
317
|
-
focus: "focus:border-border-500"
|
|
318
|
-
},
|
|
319
|
-
focused: {
|
|
320
|
-
base: "border-2 border-primary-950 bg-background text-text-900",
|
|
321
|
-
hover: "",
|
|
322
|
-
focus: ""
|
|
323
|
-
},
|
|
324
|
-
invalid: {
|
|
325
|
-
base: "border-2 border-red-700 bg-white text-gray-800",
|
|
326
|
-
hover: "hover:border-red-700",
|
|
327
|
-
focus: "focus:border-red-700"
|
|
328
|
-
},
|
|
329
|
-
disabled: {
|
|
330
|
-
base: "border-border-300 bg-background text-text-600 cursor-not-allowed opacity-40",
|
|
331
|
-
hover: "",
|
|
332
|
-
focus: ""
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
var TextArea = (0, import_react2.forwardRef)(
|
|
336
|
-
({
|
|
337
|
-
label,
|
|
338
|
-
size = "medium",
|
|
339
|
-
state = "default",
|
|
340
|
-
errorMessage,
|
|
341
|
-
helperMessage,
|
|
342
|
-
className = "",
|
|
343
|
-
labelClassName = "",
|
|
344
|
-
disabled,
|
|
345
|
-
id,
|
|
346
|
-
onChange,
|
|
347
|
-
placeholder,
|
|
348
|
-
...props
|
|
349
|
-
}, ref) => {
|
|
350
|
-
const generatedId = (0, import_react2.useId)();
|
|
351
|
-
const inputId = id ?? `textarea-${generatedId}`;
|
|
352
|
-
const [isFocused, setIsFocused] = (0, import_react2.useState)(false);
|
|
353
|
-
const handleChange = (event) => {
|
|
354
|
-
onChange?.(event);
|
|
355
|
-
};
|
|
356
|
-
const handleFocus = (event) => {
|
|
357
|
-
setIsFocused(true);
|
|
358
|
-
props.onFocus?.(event);
|
|
359
|
-
};
|
|
360
|
-
const handleBlur = (event) => {
|
|
361
|
-
setIsFocused(false);
|
|
362
|
-
props.onBlur?.(event);
|
|
363
|
-
};
|
|
364
|
-
let currentState = disabled ? "disabled" : state;
|
|
365
|
-
if (isFocused && currentState !== "invalid" && currentState !== "disabled") {
|
|
366
|
-
currentState = "focused";
|
|
367
|
-
}
|
|
368
|
-
const sizeClasses = SIZE_CLASSES2[size];
|
|
369
|
-
const stateClasses = STATE_CLASSES2[currentState];
|
|
370
|
-
const textareaClasses = `${BASE_TEXTAREA_CLASSES} ${sizeClasses.textarea} ${stateClasses.base} ${stateClasses.hover} ${stateClasses.focus} ${className}`;
|
|
371
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `flex flex-col ${sizeClasses.container}`, children: [
|
|
372
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
373
|
-
Text,
|
|
374
|
-
{
|
|
375
|
-
as: "label",
|
|
376
|
-
htmlFor: inputId,
|
|
377
|
-
size: sizeClasses.textSize,
|
|
378
|
-
weight: "medium",
|
|
379
|
-
color: "text-text-950",
|
|
380
|
-
className: `mb-1.5 ${labelClassName}`,
|
|
381
|
-
children: label
|
|
382
|
-
}
|
|
383
|
-
),
|
|
384
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
385
|
-
"textarea",
|
|
386
|
-
{
|
|
387
|
-
ref,
|
|
388
|
-
id: inputId,
|
|
389
|
-
disabled,
|
|
390
|
-
onChange: handleChange,
|
|
391
|
-
onFocus: handleFocus,
|
|
392
|
-
onBlur: handleBlur,
|
|
393
|
-
className: textareaClasses,
|
|
394
|
-
placeholder,
|
|
395
|
-
...props
|
|
396
|
-
}
|
|
397
|
-
),
|
|
398
|
-
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-error-600", children: errorMessage }),
|
|
399
|
-
helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Text, { size: "sm", weight: "normal", className: "mt-1.5 text-text-500", children: helperMessage })
|
|
400
|
-
] });
|
|
401
|
-
}
|
|
402
|
-
);
|
|
403
|
-
TextArea.displayName = "TextArea";
|
|
404
|
-
|
|
405
|
-
// src/components/DropdownMenu/DropdownMenu.tsx
|
|
406
|
-
var import_react3 = require("react");
|
|
407
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
408
|
-
var DropdownMenuContext = (0, import_react3.createContext)(
|
|
409
|
-
void 0
|
|
410
|
-
);
|
|
411
|
-
var DropdownMenu = ({ children, open, onOpenChange }) => {
|
|
412
|
-
const [internalOpen, setInternalOpen] = (0, import_react3.useState)(false);
|
|
413
|
-
const isControlled = open !== void 0;
|
|
414
|
-
const currentOpen = isControlled ? open : internalOpen;
|
|
415
|
-
const setOpen = (0, import_react3.useCallback)(
|
|
416
|
-
(newOpen) => {
|
|
417
|
-
if (onOpenChange) onOpenChange(newOpen);
|
|
418
|
-
if (!isControlled) setInternalOpen(newOpen);
|
|
419
|
-
},
|
|
420
|
-
[isControlled, onOpenChange]
|
|
421
|
-
);
|
|
422
|
-
const menuRef = (0, import_react3.useRef)(null);
|
|
423
|
-
const handleArrowDownOrArrowUp = (event) => {
|
|
424
|
-
const menuContent = menuRef.current?.querySelector('[role="menu"]');
|
|
425
|
-
if (menuContent) {
|
|
426
|
-
event.preventDefault();
|
|
427
|
-
const items = Array.from(
|
|
428
|
-
menuContent.querySelectorAll(
|
|
429
|
-
'[role="menuitem"]:not([aria-disabled="true"])'
|
|
430
|
-
)
|
|
431
|
-
).filter((el) => el instanceof HTMLElement);
|
|
432
|
-
if (items.length === 0) return;
|
|
433
|
-
const focusedItem = document.activeElement;
|
|
434
|
-
const currentIndex = items.findIndex((item) => item === focusedItem);
|
|
435
|
-
let nextIndex;
|
|
436
|
-
if (event.key === "ArrowDown") {
|
|
437
|
-
nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
438
|
-
} else {
|
|
439
|
-
nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
|
|
440
|
-
}
|
|
441
|
-
items[nextIndex]?.focus();
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
const handleDownkey = (event) => {
|
|
445
|
-
if (event.key === "Escape") {
|
|
446
|
-
setOpen(false);
|
|
447
|
-
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
448
|
-
handleArrowDownOrArrowUp(event);
|
|
449
|
-
}
|
|
450
|
-
};
|
|
451
|
-
const handleClickOutside = (event) => {
|
|
452
|
-
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
453
|
-
setOpen(false);
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
(0, import_react3.useEffect)(() => {
|
|
457
|
-
if (currentOpen) {
|
|
458
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
459
|
-
document.addEventListener("keydown", handleDownkey);
|
|
460
|
-
}
|
|
461
|
-
return () => {
|
|
462
|
-
document.removeEventListener("mousedown", handleClickOutside);
|
|
463
|
-
document.removeEventListener("keydown", handleDownkey);
|
|
464
|
-
};
|
|
465
|
-
}, [currentOpen]);
|
|
466
|
-
const value = (0, import_react3.useMemo)(
|
|
467
|
-
() => ({ open: currentOpen, setOpen }),
|
|
468
|
-
[currentOpen, setOpen]
|
|
469
|
-
);
|
|
470
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(DropdownMenuContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "relative", ref: menuRef, children }) });
|
|
471
|
-
};
|
|
472
|
-
var DropdownMenuTrigger = (0, import_react3.forwardRef)(({ className, children, onClick, ...props }, ref) => {
|
|
473
|
-
const context = (0, import_react3.useContext)(DropdownMenuContext);
|
|
474
|
-
if (!context)
|
|
475
|
-
throw new Error("DropdownMenuTrigger must be used within a DropdownMenu");
|
|
476
|
-
const { open, setOpen } = context;
|
|
477
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
478
|
-
"button",
|
|
479
|
-
{
|
|
480
|
-
ref,
|
|
481
|
-
className: `border border-border-200 cursor-pointer bg-background-muted hover:bg-background-200 transition-colors px-4 py-2 rounded-sm ${className}`,
|
|
482
|
-
onClick: (e) => {
|
|
483
|
-
e.stopPropagation();
|
|
484
|
-
setOpen(!open);
|
|
485
|
-
if (onClick) onClick(e);
|
|
486
|
-
},
|
|
487
|
-
"aria-expanded": open,
|
|
488
|
-
...props,
|
|
489
|
-
children
|
|
490
|
-
}
|
|
491
|
-
);
|
|
492
|
-
});
|
|
493
|
-
DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
|
|
494
|
-
var ITEM_SIZE_CLASSES = {
|
|
495
|
-
small: "text-sm",
|
|
496
|
-
medium: "text-md"
|
|
497
|
-
};
|
|
498
|
-
var SIDE_CLASSES = {
|
|
499
|
-
top: "bottom-full",
|
|
500
|
-
right: "top-full",
|
|
501
|
-
bottom: "top-full",
|
|
502
|
-
left: "top-full"
|
|
503
|
-
};
|
|
504
|
-
var ALIGN_CLASSES = {
|
|
505
|
-
start: "left-0",
|
|
506
|
-
center: "left-1/2 -translate-x-1/2",
|
|
507
|
-
end: "right-0"
|
|
508
|
-
};
|
|
509
|
-
var MenuLabel = (0, import_react3.forwardRef)(({ className, inset, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
510
|
-
"fieldset",
|
|
511
|
-
{
|
|
512
|
-
ref,
|
|
513
|
-
role: "group",
|
|
514
|
-
className: `text-sm w-full ${inset ? "pl-8" : ""} ${className ?? ""}`,
|
|
515
|
-
...props
|
|
516
|
-
}
|
|
517
|
-
));
|
|
518
|
-
MenuLabel.displayName = "MenuLabel";
|
|
519
|
-
var MenuContent = (0, import_react3.forwardRef)(
|
|
520
|
-
({
|
|
521
|
-
className,
|
|
522
|
-
align = "start",
|
|
523
|
-
side = "bottom",
|
|
524
|
-
sideOffset = 4,
|
|
525
|
-
children,
|
|
526
|
-
...props
|
|
527
|
-
}, ref) => {
|
|
528
|
-
const { open } = (0, import_react3.useContext)(DropdownMenuContext);
|
|
529
|
-
const [isVisible, setIsVisible] = (0, import_react3.useState)(open);
|
|
530
|
-
(0, import_react3.useEffect)(() => {
|
|
531
|
-
if (open) {
|
|
532
|
-
setIsVisible(true);
|
|
533
|
-
} else {
|
|
534
|
-
const timer = setTimeout(() => setIsVisible(false), 200);
|
|
535
|
-
return () => clearTimeout(timer);
|
|
536
|
-
}
|
|
537
|
-
}, [open]);
|
|
538
|
-
if (!isVisible) return null;
|
|
539
|
-
const getPositionClasses = () => {
|
|
540
|
-
const vertical = SIDE_CLASSES[side];
|
|
541
|
-
const horizontal = ALIGN_CLASSES[align];
|
|
542
|
-
return `absolute ${vertical} ${horizontal}`;
|
|
543
|
-
};
|
|
544
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
545
|
-
"div",
|
|
546
|
-
{
|
|
547
|
-
ref,
|
|
548
|
-
role: "menu",
|
|
549
|
-
className: `
|
|
550
|
-
bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md border-border-100
|
|
551
|
-
${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
|
|
552
|
-
${getPositionClasses()}
|
|
553
|
-
${className}
|
|
554
|
-
`,
|
|
555
|
-
style: {
|
|
556
|
-
marginTop: side === "bottom" ? sideOffset : void 0,
|
|
557
|
-
marginBottom: side === "top" ? sideOffset : void 0,
|
|
558
|
-
marginLeft: side === "right" ? sideOffset : void 0,
|
|
559
|
-
marginRight: side === "left" ? sideOffset : void 0
|
|
560
|
-
},
|
|
561
|
-
...props,
|
|
562
|
-
children
|
|
563
|
-
}
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
MenuContent.displayName = "MenuContent";
|
|
568
|
-
var MenuItem = (0, import_react3.forwardRef)(
|
|
569
|
-
({
|
|
570
|
-
className,
|
|
571
|
-
inset,
|
|
572
|
-
size = "small",
|
|
573
|
-
children,
|
|
574
|
-
iconRight,
|
|
575
|
-
iconLeft,
|
|
576
|
-
disabled = false,
|
|
577
|
-
onClick,
|
|
578
|
-
...props
|
|
579
|
-
}, ref) => {
|
|
580
|
-
const sizeClasses = ITEM_SIZE_CLASSES[size];
|
|
581
|
-
const handleClick = (e) => {
|
|
582
|
-
if (disabled) {
|
|
583
|
-
e.preventDefault();
|
|
584
|
-
e.stopPropagation();
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
onClick?.(e);
|
|
588
|
-
};
|
|
589
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
590
|
-
"div",
|
|
591
|
-
{
|
|
592
|
-
ref,
|
|
593
|
-
role: "menuitem",
|
|
594
|
-
"aria-disabled": disabled,
|
|
595
|
-
className: `
|
|
596
|
-
focus-visible:bg-background-50
|
|
597
|
-
relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0
|
|
598
|
-
${inset && "pl-8"}
|
|
599
|
-
${sizeClasses}
|
|
600
|
-
${className}
|
|
601
|
-
${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"}
|
|
602
|
-
`,
|
|
603
|
-
onClick: handleClick,
|
|
604
|
-
onKeyDown: (e) => {
|
|
605
|
-
if (e.key === "Enter" || e.key === " ") handleClick(e);
|
|
606
|
-
},
|
|
607
|
-
tabIndex: disabled ? -1 : 0,
|
|
608
|
-
...props,
|
|
609
|
-
children: [
|
|
610
|
-
iconLeft,
|
|
611
|
-
children,
|
|
612
|
-
iconRight
|
|
613
|
-
]
|
|
614
|
-
}
|
|
615
|
-
);
|
|
616
|
-
}
|
|
617
|
-
);
|
|
618
|
-
MenuItem.displayName = "MenuItem";
|
|
619
|
-
var MenuSeparator = (0, import_react3.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
620
|
-
"div",
|
|
621
|
-
{
|
|
622
|
-
ref,
|
|
623
|
-
className: `my-1 h-px bg-border-200 ${className}`,
|
|
624
|
-
...props
|
|
625
|
-
}
|
|
626
|
-
));
|
|
627
|
-
MenuSeparator.displayName = "MenuSeparator";
|
|
628
|
-
|
|
629
|
-
// src/components/Toast/Toast.tsx
|
|
630
|
-
var import_phosphor_react2 = require("phosphor-react");
|
|
631
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
632
|
-
var VARIANT_ACTION_CLASSES = {
|
|
633
|
-
solid: {
|
|
634
|
-
warning: "bg-warning text-warning-800 border-none focus-visible:outline-none",
|
|
635
|
-
success: "bg-success text-success-800 border-none focus-visible:outline-none",
|
|
636
|
-
info: "bg-info text-info-800 border-none focus-visible:outline-none"
|
|
637
|
-
},
|
|
638
|
-
outlined: {
|
|
639
|
-
warning: "bg-warning text-warning-800 border border-warning-200 focus-visible:outline-none",
|
|
640
|
-
success: "bg-success text-success-800 border border-success-200 focus-visible:outline-none",
|
|
641
|
-
info: "bg-info text-info-800 border border-info-200 focus-visible:outline-none"
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
var iconMap = {
|
|
645
|
-
success: import_phosphor_react2.CheckCircle,
|
|
646
|
-
info: import_phosphor_react2.Info,
|
|
647
|
-
warning: import_phosphor_react2.WarningCircle
|
|
648
|
-
};
|
|
649
|
-
var Toast = ({
|
|
650
|
-
variant = "outlined",
|
|
651
|
-
action = "success",
|
|
652
|
-
className = "",
|
|
653
|
-
onClose,
|
|
654
|
-
title,
|
|
655
|
-
description,
|
|
656
|
-
position = "default",
|
|
657
|
-
...props
|
|
658
|
-
}) => {
|
|
659
|
-
const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
|
|
660
|
-
const positionClasses = {
|
|
661
|
-
"top-left": "fixed top-4 left-4",
|
|
662
|
-
"top-center": "fixed top-4 left-1/2 transform -translate-x-1/2",
|
|
663
|
-
"top-right": "fixed top-4 right-4",
|
|
664
|
-
"bottom-left": "fixed bottom-4 left-4",
|
|
665
|
-
"bottom-center": "fixed bottom-4 left-1/2 transform -translate-x-1/2",
|
|
666
|
-
"bottom-right": "fixed bottom-4 right-4",
|
|
667
|
-
default: ""
|
|
668
|
-
};
|
|
669
|
-
const IconAction = iconMap[action] || iconMap["success"];
|
|
670
|
-
const baseClasses = "max-w-[390px] w-full flex flex-row items-start justify-between shadow-lg rounded-lg border p-4 gap-6 group";
|
|
671
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
672
|
-
"div",
|
|
673
|
-
{
|
|
674
|
-
role: "alert",
|
|
675
|
-
"aria-live": "assertive",
|
|
676
|
-
"aria-atomic": "true",
|
|
677
|
-
className: `${baseClasses} ${positionClasses[position]} ${variantClasses} ${className}`,
|
|
678
|
-
...props,
|
|
679
|
-
children: [
|
|
680
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-row items-start gap-3", children: [
|
|
681
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mt-1", "data-testid": `toast-icon-${action}`, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconAction, {}) }),
|
|
682
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col items-start justify-start", children: [
|
|
683
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "font-semibold text-md", children: title }),
|
|
684
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-md text-text-900", children: description })
|
|
685
|
-
] })
|
|
686
|
-
] }),
|
|
687
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
688
|
-
"button",
|
|
689
|
-
{
|
|
690
|
-
onClick: onClose,
|
|
691
|
-
"aria-label": "Dismiss notification",
|
|
692
|
-
className: "text-background-500 cursor-pointer opacity-0 group-hover:opacity-100 transition-opacity",
|
|
693
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_phosphor_react2.X, {})
|
|
694
|
-
}
|
|
695
|
-
)
|
|
696
|
-
]
|
|
697
|
-
}
|
|
698
|
-
);
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
// src/components/Toast/utils/ToastStore.ts
|
|
702
|
-
var import_zustand = require("zustand");
|
|
703
|
-
var useToastStore = (0, import_zustand.create)((set) => ({
|
|
704
|
-
toasts: [],
|
|
705
|
-
addToast: (toast) => {
|
|
706
|
-
const id = crypto.randomUUID();
|
|
707
|
-
set((state) => ({
|
|
708
|
-
toasts: [...state.toasts, { id, ...toast }]
|
|
709
|
-
}));
|
|
710
|
-
},
|
|
711
|
-
removeToast: (id) => {
|
|
712
|
-
set((state) => ({
|
|
713
|
-
toasts: state.toasts.filter((t) => t.id !== id)
|
|
714
|
-
}));
|
|
715
|
-
}
|
|
716
|
-
}));
|
|
717
|
-
|
|
718
|
-
// src/components/Toast/utils/Toaster.tsx
|
|
719
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
720
|
-
var Toaster = () => {
|
|
721
|
-
const toasts = useToastStore((state) => state.toasts);
|
|
722
|
-
const removeToast = useToastStore((state) => state.removeToast);
|
|
723
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
724
|
-
Toast,
|
|
725
|
-
{
|
|
726
|
-
title: toast.title,
|
|
727
|
-
description: toast.description,
|
|
728
|
-
variant: toast.variant,
|
|
729
|
-
action: toast.action,
|
|
730
|
-
position: toast.position,
|
|
731
|
-
onClose: () => removeToast(toast.id)
|
|
732
|
-
},
|
|
733
|
-
toast.id
|
|
734
|
-
)) });
|
|
735
|
-
};
|
|
736
|
-
var useToast = () => {
|
|
737
|
-
const addToast = useToastStore((state) => state.addToast);
|
|
738
|
-
const removeToast = useToastStore((state) => state.removeToast);
|
|
739
|
-
return { addToast, removeToast };
|
|
740
|
-
};
|
|
741
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
742
|
-
0 && (module.exports = {
|
|
743
|
-
CheckBox,
|
|
744
|
-
DropdownMenu,
|
|
745
|
-
DropdownMenuTrigger,
|
|
746
|
-
MenuContent,
|
|
747
|
-
MenuItem,
|
|
748
|
-
MenuLabel,
|
|
749
|
-
MenuSeparator,
|
|
750
|
-
TextArea,
|
|
751
|
-
Toast,
|
|
752
|
-
Toaster,
|
|
753
|
-
useToast,
|
|
754
|
-
useToastStore
|
|
755
|
-
});
|