@bubo-squared/ui-framework 0.1.0
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/README.md +47 -0
- package/dist/index.cjs +2646 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +421 -0
- package/dist/index.d.ts +421 -0
- package/dist/index.js +2582 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2646 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
Avatar: () => Avatar,
|
|
34
|
+
Badge: () => Badge,
|
|
35
|
+
BadgeDigit: () => BadgeDigit,
|
|
36
|
+
BadgeDot: () => BadgeDot,
|
|
37
|
+
BadgeStatus: () => BadgeStatus,
|
|
38
|
+
Button: () => Button,
|
|
39
|
+
ButtonGroup: () => ButtonGroup,
|
|
40
|
+
Checkbox: () => Checkbox,
|
|
41
|
+
Divider: () => Divider,
|
|
42
|
+
Dropdown: () => Dropdown,
|
|
43
|
+
IconButton: () => IconButton,
|
|
44
|
+
IconButtonGroup: () => IconButtonGroup,
|
|
45
|
+
LinkButton: () => LinkButton,
|
|
46
|
+
LogoIconExtraLarge: () => LogoIconExtraLarge_default,
|
|
47
|
+
LogoIconExtraSmall: () => LogoIconExtraSmall_default,
|
|
48
|
+
LogoIconLarge: () => LogoIconLarge_default,
|
|
49
|
+
LogoIconMedium: () => LogoIconMedium_default,
|
|
50
|
+
LogoIconSmall: () => LogoIconSmall_default,
|
|
51
|
+
LogoInline: () => LogoInline_default,
|
|
52
|
+
LogoInlineSmall: () => LogoInlineSmall_default,
|
|
53
|
+
LogoMultiline: () => LogoMultiline_default,
|
|
54
|
+
MessageButton: () => MessageButton,
|
|
55
|
+
PasswordInput: () => PasswordInput,
|
|
56
|
+
Progress: () => Progress,
|
|
57
|
+
RadioGroup: () => RadioGroup,
|
|
58
|
+
SearchInput: () => SearchInput,
|
|
59
|
+
Slider: () => Slider,
|
|
60
|
+
StatusAvatar: () => StatusAvatar,
|
|
61
|
+
Tag: () => Tag,
|
|
62
|
+
TextArea: () => TextArea,
|
|
63
|
+
TextInput: () => TextInput,
|
|
64
|
+
Toggle: () => Toggle,
|
|
65
|
+
WebsiteInput: () => WebsiteInput,
|
|
66
|
+
cn: () => cn
|
|
67
|
+
});
|
|
68
|
+
module.exports = __toCommonJS(index_exports);
|
|
69
|
+
|
|
70
|
+
// src/components/Buttons/Button.tsx
|
|
71
|
+
var React = __toESM(require("react"), 1);
|
|
72
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
73
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
74
|
+
|
|
75
|
+
// src/lib/utils.tsx
|
|
76
|
+
var import_clsx = require("clsx");
|
|
77
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
78
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
79
|
+
function cn(...inputs) {
|
|
80
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/components/Buttons/Button.tsx
|
|
84
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
85
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
86
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded transition-colors disabled:pointer-events-none overflow-hidden cursor-pointer",
|
|
87
|
+
{
|
|
88
|
+
variants: {
|
|
89
|
+
variant: {
|
|
90
|
+
primary: [
|
|
91
|
+
"btn-primary",
|
|
92
|
+
"focus-ring-primary"
|
|
93
|
+
],
|
|
94
|
+
secondary: [
|
|
95
|
+
"btn-secondary",
|
|
96
|
+
"focus-ring-secondary"
|
|
97
|
+
],
|
|
98
|
+
outline: [
|
|
99
|
+
"btn-outline",
|
|
100
|
+
"focus-ring-outline"
|
|
101
|
+
],
|
|
102
|
+
destructive: [
|
|
103
|
+
"btn-destructive",
|
|
104
|
+
"focus-ring-error"
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
size: {
|
|
108
|
+
sm: ["px-1.5", "py-1", "gap-1"],
|
|
109
|
+
md: ["px-2", "py-1", "gap-1.5"],
|
|
110
|
+
lg: ["px-2.5", "py-1", "gap-1.5"],
|
|
111
|
+
xl: ["px-3", "py-0.5", "gap-2"]
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
variant: "primary",
|
|
116
|
+
size: "md"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
var buttonIconVariants = (0, import_class_variance_authority.cva)("relative", {
|
|
121
|
+
variants: {
|
|
122
|
+
size: {
|
|
123
|
+
sm: ["w-5", "h-5", "*:w-5", "*:h-5"],
|
|
124
|
+
md: ["w-6", "h-6", "*:w-6", "*:h-6"],
|
|
125
|
+
lg: ["w-6", "h-6", "*:w-6", "*:h-6"],
|
|
126
|
+
xl: ["w-8", "h-8", "*:w-8", "*:h-8"]
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
var buttonTextVariants = (0, import_class_variance_authority.cva)("flex text-center justify-center font-normal", {
|
|
131
|
+
variants: {
|
|
132
|
+
size: {
|
|
133
|
+
sm: ["text-xl", "leading-7"],
|
|
134
|
+
md: ["text-2xl", "leading-8"],
|
|
135
|
+
lg: ["h-10", "text-3xl", "leading-9"],
|
|
136
|
+
xl: ["h-11", "text-4xl", "leading-10"]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
var Button = React.forwardRef(
|
|
141
|
+
(props, ref) => {
|
|
142
|
+
const {
|
|
143
|
+
className,
|
|
144
|
+
variant,
|
|
145
|
+
size = "md",
|
|
146
|
+
asChild = false,
|
|
147
|
+
children,
|
|
148
|
+
suffixIcon,
|
|
149
|
+
prefixIcon,
|
|
150
|
+
...rest
|
|
151
|
+
} = props;
|
|
152
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
154
|
+
Comp,
|
|
155
|
+
{
|
|
156
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
157
|
+
ref,
|
|
158
|
+
...rest,
|
|
159
|
+
children: [
|
|
160
|
+
prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn(buttonIconVariants({ size })), children: prefixIcon }),
|
|
161
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn(buttonTextVariants({ size })), children }),
|
|
162
|
+
suffixIcon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn(buttonIconVariants({ size })), children: suffixIcon })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
Button.displayName = "Button";
|
|
169
|
+
|
|
170
|
+
// src/components/Buttons/ButtonGroup.tsx
|
|
171
|
+
var import_class_variance_authority2 = require("class-variance-authority");
|
|
172
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
173
|
+
var buttonGroupVariants = (0, import_class_variance_authority2.cva)(
|
|
174
|
+
"flex items-center justify-center gap-4 pt-4 w-80 min-w-80",
|
|
175
|
+
{
|
|
176
|
+
variants: {
|
|
177
|
+
variant: {
|
|
178
|
+
vertical: ["flex-col"],
|
|
179
|
+
horizontal: ["flex-row"]
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
defaultVariants: {
|
|
183
|
+
variant: "horizontal"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
var ButtonGroup = (props) => {
|
|
188
|
+
const { orientation = "horizontal" } = props;
|
|
189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: buttonGroupVariants({ variant: orientation }), ...props, children: props.children });
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
// src/components/Buttons/IconButton.tsx
|
|
193
|
+
var React2 = __toESM(require("react"), 1);
|
|
194
|
+
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
195
|
+
var import_class_variance_authority3 = require("class-variance-authority");
|
|
196
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
197
|
+
var iconButtonVariants = (0, import_class_variance_authority3.cva)(
|
|
198
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded transition-colors disabled:pointer-events-none overflow-hidden p-1.5 cursor-pointer",
|
|
199
|
+
{
|
|
200
|
+
variants: {
|
|
201
|
+
variant: {
|
|
202
|
+
primary: [
|
|
203
|
+
"btn-primary",
|
|
204
|
+
"focus-ring-primary"
|
|
205
|
+
],
|
|
206
|
+
secondary: [
|
|
207
|
+
"btn-secondary",
|
|
208
|
+
"focus-ring-secondary"
|
|
209
|
+
],
|
|
210
|
+
outline: [
|
|
211
|
+
"btn-outline",
|
|
212
|
+
"focus-ring-outline"
|
|
213
|
+
],
|
|
214
|
+
destructive: [
|
|
215
|
+
"btn-destructive-outline",
|
|
216
|
+
"focus-ring-error-outline"
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
size: {
|
|
220
|
+
sm: ["[&>.buttonIcon>svg]:w-5", "[&>.buttonIcon>svg]:h-5"],
|
|
221
|
+
md: ["[&>.buttonIcon>svg]:w-6", "[&>.buttonIcon>svg]:h-6"],
|
|
222
|
+
lg: ["[&>.buttonIcon>svg]:w-8", "[&>.buttonIcon>svg]:h-8"],
|
|
223
|
+
xl: ["[&>.buttonIcon>svg]:w-9", "[&>.buttonIcon>svg]:h-9"]
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
defaultVariants: {
|
|
227
|
+
variant: "primary",
|
|
228
|
+
size: "md"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
var IconButton = React2.forwardRef(
|
|
233
|
+
(props, ref) => {
|
|
234
|
+
const {
|
|
235
|
+
className,
|
|
236
|
+
variant,
|
|
237
|
+
size,
|
|
238
|
+
asChild = false,
|
|
239
|
+
icon,
|
|
240
|
+
...rest
|
|
241
|
+
} = props;
|
|
242
|
+
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
244
|
+
Comp,
|
|
245
|
+
{
|
|
246
|
+
className: cn(iconButtonVariants({ variant, size }), className),
|
|
247
|
+
ref,
|
|
248
|
+
...rest,
|
|
249
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "buttonIcon flex items-center justify-center", children: icon })
|
|
250
|
+
}
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
IconButton.displayName = "IconButton";
|
|
255
|
+
|
|
256
|
+
// src/components/Buttons/IconButtonGroup.tsx
|
|
257
|
+
var React3 = require("react");
|
|
258
|
+
var import_class_variance_authority4 = require("class-variance-authority");
|
|
259
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
260
|
+
var IconGroupLinesClass = "inline-flex items-center justify-center gap-0 [&>button]:outline-none! [&>button]:rounded-none [&>button:focus]:shadow-none [&>button:focus]:bg-(--border-secondary) [&>button:first-child]:rounded-l [&>button:last-child]:rounded-r";
|
|
261
|
+
var IconGroupSizeVariants = (0, import_class_variance_authority4.cva)("", {
|
|
262
|
+
variants: {
|
|
263
|
+
size: {
|
|
264
|
+
sm: "[&>button]:px-1.5",
|
|
265
|
+
md: "[&>button]:px-2",
|
|
266
|
+
lg: "[&>button]:px-2",
|
|
267
|
+
xl: "[&>button]:px-3"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
defaultVariants: {
|
|
271
|
+
size: "sm"
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
var IconButtonGroup = (props) => {
|
|
275
|
+
const { items, size = "sm", className, ...rest } = props;
|
|
276
|
+
if (!items || items.length === 0) {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
280
|
+
"div",
|
|
281
|
+
{
|
|
282
|
+
className: cn(
|
|
283
|
+
IconGroupLinesClass,
|
|
284
|
+
IconGroupSizeVariants({ size }),
|
|
285
|
+
className
|
|
286
|
+
),
|
|
287
|
+
...rest,
|
|
288
|
+
children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
289
|
+
IconButton,
|
|
290
|
+
{
|
|
291
|
+
variant: "secondary",
|
|
292
|
+
size,
|
|
293
|
+
icon: item.icon,
|
|
294
|
+
"aria-label": item.ariaLabel,
|
|
295
|
+
disabled: item.disabled,
|
|
296
|
+
className: cn(
|
|
297
|
+
"rounded-none border-1 border-(--border-secondary) text-(--text-primary) ",
|
|
298
|
+
index === 0 && "rounded-l-[6px]",
|
|
299
|
+
index === items.length - 1 && "rounded-r-[6px]",
|
|
300
|
+
index > 0 && "-ml-px"
|
|
301
|
+
),
|
|
302
|
+
onClick: item.onClick
|
|
303
|
+
},
|
|
304
|
+
index
|
|
305
|
+
))
|
|
306
|
+
}
|
|
307
|
+
);
|
|
308
|
+
};
|
|
309
|
+
IconButtonGroup.displayName = "IconButtonGroup";
|
|
310
|
+
|
|
311
|
+
// src/components/Buttons/LinkButton.tsx
|
|
312
|
+
var React4 = __toESM(require("react"), 1);
|
|
313
|
+
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
314
|
+
var import_class_variance_authority5 = require("class-variance-authority");
|
|
315
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
316
|
+
var linkButtonVariants = (0, import_class_variance_authority5.cva)(
|
|
317
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded transition-colors disabled:pointer-events-none overflow-hidden gap-2 cursor-pointer",
|
|
318
|
+
{
|
|
319
|
+
variants: {
|
|
320
|
+
variant: {
|
|
321
|
+
primary: ["btn-link-primary"],
|
|
322
|
+
secondary: ["btn-link-secondary"],
|
|
323
|
+
destructive: ["btn-link-destructive"]
|
|
324
|
+
},
|
|
325
|
+
size: {
|
|
326
|
+
sm: ["py-2", "px-1"],
|
|
327
|
+
md: ["py-2.5", "px-2"],
|
|
328
|
+
lg: ["py-2.5", "px-2"],
|
|
329
|
+
xl: ["py-3", "px-3"]
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
defaultVariants: {
|
|
333
|
+
variant: "primary",
|
|
334
|
+
size: "md"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
);
|
|
338
|
+
var linkButtonIconVariants = (0, import_class_variance_authority5.cva)("relative", {
|
|
339
|
+
variants: {
|
|
340
|
+
size: {
|
|
341
|
+
sm: ["w-5", "h-5", "*:w-5", "*:h-5"],
|
|
342
|
+
md: ["w-5", "h-5", "*:w-5", "*:h-5"],
|
|
343
|
+
lg: ["w-6", "h-6", "*:w-6", "*:h-6"],
|
|
344
|
+
xl: ["w-6", "h-6", "*:w-6", "*:h-6"]
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
var linkButtonTextVariants = (0, import_class_variance_authority5.cva)("inline-flex items-center text-center font-medium", {
|
|
349
|
+
variants: {
|
|
350
|
+
size: {
|
|
351
|
+
sm: ["text-sm", "leading-5"],
|
|
352
|
+
md: ["text-sm", "leading-5"],
|
|
353
|
+
lg: ["text-base", "leading-6"],
|
|
354
|
+
xl: ["text-base", "leading-6"]
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
var LinkButton = React4.forwardRef(
|
|
359
|
+
(props, ref) => {
|
|
360
|
+
const {
|
|
361
|
+
className,
|
|
362
|
+
variant,
|
|
363
|
+
size = "sm",
|
|
364
|
+
asChild = false,
|
|
365
|
+
children,
|
|
366
|
+
suffixIcon,
|
|
367
|
+
prefixIcon,
|
|
368
|
+
...rest
|
|
369
|
+
} = props;
|
|
370
|
+
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
372
|
+
Comp,
|
|
373
|
+
{
|
|
374
|
+
className: cn(linkButtonVariants({ variant, size, className })),
|
|
375
|
+
ref,
|
|
376
|
+
...rest,
|
|
377
|
+
children: [
|
|
378
|
+
prefixIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(linkButtonIconVariants({ size })), children: prefixIcon }),
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(linkButtonTextVariants({ size })), children }),
|
|
380
|
+
suffixIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn(linkButtonIconVariants({ size })), children: suffixIcon })
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
);
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
LinkButton.displayName = "LinkButton";
|
|
387
|
+
|
|
388
|
+
// src/components/Buttons/MessageButton.tsx
|
|
389
|
+
var React5 = __toESM(require("react"), 1);
|
|
390
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
391
|
+
var MessageButton = (props) => {
|
|
392
|
+
const {
|
|
393
|
+
onClick,
|
|
394
|
+
idleLabel = "Save",
|
|
395
|
+
loadingLabel = "Saving\u2026",
|
|
396
|
+
successLabel = "Saved!",
|
|
397
|
+
errorLabel = "Error",
|
|
398
|
+
feedbackDuration = 1500,
|
|
399
|
+
className = "",
|
|
400
|
+
...buttonProps
|
|
401
|
+
} = props;
|
|
402
|
+
const [status, setStatus] = React5.useState("idle");
|
|
403
|
+
const handleClick = async (_event) => {
|
|
404
|
+
if (status === "loading") return;
|
|
405
|
+
setStatus("loading");
|
|
406
|
+
try {
|
|
407
|
+
await Promise.resolve(onClick?.());
|
|
408
|
+
setStatus("success");
|
|
409
|
+
} catch (err) {
|
|
410
|
+
console.error(err);
|
|
411
|
+
setStatus("error");
|
|
412
|
+
} finally {
|
|
413
|
+
if (feedbackDuration > 0) {
|
|
414
|
+
window.setTimeout(() => setStatus("idle"), feedbackDuration);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
const label = status === "loading" ? loadingLabel : status === "success" ? successLabel : status === "error" ? errorLabel : idleLabel;
|
|
419
|
+
const statusClasses = status === "success" ? "btn-msg-success" : status === "error" ? "btn-destructive" : "btn-outline focus-ring-outline";
|
|
420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
421
|
+
"button",
|
|
422
|
+
{
|
|
423
|
+
type: "button",
|
|
424
|
+
...buttonProps,
|
|
425
|
+
onClick: handleClick,
|
|
426
|
+
className: `inline-flex items-center justify-center rounded px-1.5 py-1 gap-1 text-sm transition-colors cursor-pointer ${statusClasses} ${className}`,
|
|
427
|
+
children: [
|
|
428
|
+
props.icon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-5 *:w-5 h-5 *:h-5 relative", children: props.icon }),
|
|
429
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-center text-xl font-normal leading-7", children: label })
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
};
|
|
434
|
+
MessageButton.displayName = "MessageButton";
|
|
435
|
+
|
|
436
|
+
// src/components/Content/Avatar.tsx
|
|
437
|
+
var React6 = __toESM(require("react"), 1);
|
|
438
|
+
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
439
|
+
var import_class_variance_authority6 = require("class-variance-authority");
|
|
440
|
+
var import_icons = require("@bubo-squared/icons");
|
|
441
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
442
|
+
var avatarVariants = (0, import_class_variance_authority6.cva)(
|
|
443
|
+
"relative inline-flex items-center justify-center rounded-full border-(--border-secondary) border-1 bg-(--background-primary) text-(--text-primary) overflow-hidden hover:border-(--focus-secondary) focus-visible:border-(--focus-primary) focus-visible:outline-none",
|
|
444
|
+
{
|
|
445
|
+
variants: {
|
|
446
|
+
size: {
|
|
447
|
+
"20": "w-5 h-5 hover:border-2 focus-visible:border-2",
|
|
448
|
+
"24": "w-6 h-6 hover:border-2 focus-visible:border-2",
|
|
449
|
+
"32": "w-8 h-8 hover:border-2 focus-visible:border-2",
|
|
450
|
+
"40": "w-10 h-10 hover:border-2 focus-visible:border-2",
|
|
451
|
+
"48": "w-12 h-12 hover:border-2 focus-visible:border-2",
|
|
452
|
+
"56": "w-14 h-14 hover:border-4 focus-visible:border-4",
|
|
453
|
+
"64": "w-16 h-16 hover:border-4 focus-visible:border-4"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
defaultVariants: {
|
|
457
|
+
size: "32"
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
);
|
|
461
|
+
var avatarInitialsVariants = (0, import_class_variance_authority6.cva)(
|
|
462
|
+
"flex items-center justify-center text-(--text-primary) leading-none ",
|
|
463
|
+
{
|
|
464
|
+
variants: {
|
|
465
|
+
size: {
|
|
466
|
+
"20": "footnote-xs-medium",
|
|
467
|
+
"24": "footnote-medium",
|
|
468
|
+
"32": "paragraph-s font-medium",
|
|
469
|
+
"40": "paragraph-m font-medium",
|
|
470
|
+
"48": "paragraph-l font-medium",
|
|
471
|
+
"56": "subtitle font-medium",
|
|
472
|
+
"64": "h6-title font-medium"
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
defaultVariants: {
|
|
476
|
+
size: "32"
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
var avatarIconVariants = (0, import_class_variance_authority6.cva)(
|
|
481
|
+
"flex items-center justify-center text-(--icon-primary)",
|
|
482
|
+
{
|
|
483
|
+
variants: {
|
|
484
|
+
size: {
|
|
485
|
+
"20": "w-3 h-3 [&>svg]:w-3 [&>svg]:h-3",
|
|
486
|
+
"24": "w-3.5 h-3.5 [&>svg]:w-3.5 [&>svg]:h-3.5",
|
|
487
|
+
"32": "w-4 h-4 [&>svg]:w-4 [&>svg]:h-4",
|
|
488
|
+
"40": "w-5 h-5 [&>svg]:w-5 [&>svg]:h-5",
|
|
489
|
+
"48": "w-6 h-6 [&>svg]:w-6 [&>svg]:h-6",
|
|
490
|
+
"56": "w-7 h-7 [&>svg]:w-7 [&>svg]:h-7",
|
|
491
|
+
"64": "w-8 h-8 [&>svg]:w-8 [&>svg]:h-8"
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
defaultVariants: {
|
|
495
|
+
size: "32"
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
var Avatar = React6.forwardRef(
|
|
500
|
+
(props, ref) => {
|
|
501
|
+
const {
|
|
502
|
+
asChild = false,
|
|
503
|
+
variant = "initial",
|
|
504
|
+
size = "32",
|
|
505
|
+
initials = "RA",
|
|
506
|
+
src,
|
|
507
|
+
alt,
|
|
508
|
+
className,
|
|
509
|
+
...rest
|
|
510
|
+
} = props;
|
|
511
|
+
const Comp = asChild ? import_react_slot4.Slot : "button";
|
|
512
|
+
const hasImage = variant === "image" && typeof src === "string" && src.length > 0;
|
|
513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
514
|
+
Comp,
|
|
515
|
+
{
|
|
516
|
+
ref,
|
|
517
|
+
className: cn(avatarVariants({ size }), className),
|
|
518
|
+
...rest,
|
|
519
|
+
children: [
|
|
520
|
+
hasImage ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
521
|
+
"img",
|
|
522
|
+
{
|
|
523
|
+
src,
|
|
524
|
+
alt,
|
|
525
|
+
className: "w-full h-full object-cover"
|
|
526
|
+
}
|
|
527
|
+
) : null,
|
|
528
|
+
!hasImage && variant === "initial" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cn(avatarInitialsVariants({ size }), "relative bottom-px"), style: { marginBottom: 0 }, children: initials }),
|
|
529
|
+
!hasImage && variant === "icon" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: cn(avatarIconVariants({ size })), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_icons.UserIcon, {}) })
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
);
|
|
535
|
+
Avatar.displayName = "Avatar";
|
|
536
|
+
|
|
537
|
+
// src/components/Content/Badge.tsx
|
|
538
|
+
var React7 = __toESM(require("react"), 1);
|
|
539
|
+
var import_react_slot5 = require("@radix-ui/react-slot");
|
|
540
|
+
var import_class_variance_authority7 = require("class-variance-authority");
|
|
541
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
542
|
+
var badgeVariants = (0, import_class_variance_authority7.cva)(
|
|
543
|
+
"inline-flex items-center justify-center rounded-[4px] leading-none whitespace-nowrap gap-1 px-1 py-0",
|
|
544
|
+
{
|
|
545
|
+
variants: {
|
|
546
|
+
size: {
|
|
547
|
+
sm: "px-1 paragraph-s",
|
|
548
|
+
md: "px-1 paragraph-m",
|
|
549
|
+
lg: "px-1.5 subtitle",
|
|
550
|
+
xl: "px-2 h6-title"
|
|
551
|
+
},
|
|
552
|
+
variant: {
|
|
553
|
+
primary: "bg-(--background-secondary) text-(--text-primary)",
|
|
554
|
+
secondary: "bg-(--background-primary) border-1 border-(--border-primary) text-(--text-primary)",
|
|
555
|
+
active: "bg-(--color-ac-lilac) text-(--text-neutral-badge-black)",
|
|
556
|
+
informal: "bg-(--color-ac-neon-blue) text-(--text-neutral-badge-black)",
|
|
557
|
+
success: "bg-(--color-ac-neon-green) text-(--text-neutral-badge-black)",
|
|
558
|
+
warning: "bg-(--color-ac-light-orange) text-(--text-neutral-badge-black)",
|
|
559
|
+
error: "bg-(--color-s-error-300) text-(--text-neutral-badge-black)",
|
|
560
|
+
disabled: "bg-(--background-primary-disabled) border-1 border-(--border-primary-disabled) text-(--text-primary-disabled)",
|
|
561
|
+
"double-default": "bg-(--background-secondary) text-(--text-primary)",
|
|
562
|
+
"double-current": "bg-(--color-ac-lilac) text-(--text-neutral-badge-black)"
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
defaultVariants: {
|
|
566
|
+
size: "sm",
|
|
567
|
+
variant: "primary"
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
var Badge = React7.forwardRef(
|
|
572
|
+
(props, ref) => {
|
|
573
|
+
const {
|
|
574
|
+
asChild = false,
|
|
575
|
+
label,
|
|
576
|
+
value,
|
|
577
|
+
size = "sm",
|
|
578
|
+
variant = "primary",
|
|
579
|
+
className,
|
|
580
|
+
...rest
|
|
581
|
+
} = props;
|
|
582
|
+
const Comp = asChild ? import_react_slot5.Slot : "div";
|
|
583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
584
|
+
Comp,
|
|
585
|
+
{
|
|
586
|
+
ref,
|
|
587
|
+
className: cn(badgeVariants({ size, variant }), className),
|
|
588
|
+
...rest,
|
|
589
|
+
style: { marginBottom: 0 },
|
|
590
|
+
children: value ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-normal", children: label }),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-normal", children: ":" }),
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-medium", children: value })
|
|
594
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-normal", children: label })
|
|
595
|
+
}
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
Badge.displayName = "Badge";
|
|
600
|
+
|
|
601
|
+
// src/components/Content/BadgeDigit.tsx
|
|
602
|
+
var React8 = __toESM(require("react"), 1);
|
|
603
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
604
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
605
|
+
var badgeDigitVariants = (0, import_class_variance_authority8.cva)(
|
|
606
|
+
"inline-flex items-center justify-center leading-none whitespace-nowrap text-(--text-primary-inverse)",
|
|
607
|
+
{
|
|
608
|
+
variants: {
|
|
609
|
+
size: {
|
|
610
|
+
sm: "px-[6px] rounded-[2px] caption-medium",
|
|
611
|
+
md: "px-2 py-[2px] rounded-[4px] paragraph-s-medium"
|
|
612
|
+
},
|
|
613
|
+
variant: {
|
|
614
|
+
primary: "bg-(--background-brand)",
|
|
615
|
+
secondary: "bg-(--background-primary) border-1 border-(--border-secondary) text-(--text-secondary)",
|
|
616
|
+
informal: "bg-(--background-informal)",
|
|
617
|
+
success: "bg-(--background-success)",
|
|
618
|
+
warning: "bg-(--background-warning)",
|
|
619
|
+
error: "bg-(--background-error)",
|
|
620
|
+
disabled: "bg-(--background-primary) border-1 border-(--border-primary-disabled) text-(--text-primary-disabled)"
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
defaultVariants: {
|
|
624
|
+
size: "sm",
|
|
625
|
+
variant: "primary"
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
var BadgeDigit = React8.forwardRef(
|
|
630
|
+
(props, ref) => {
|
|
631
|
+
const {
|
|
632
|
+
value,
|
|
633
|
+
size = "sm",
|
|
634
|
+
variant = "primary",
|
|
635
|
+
className,
|
|
636
|
+
...rest
|
|
637
|
+
} = props;
|
|
638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
639
|
+
"div",
|
|
640
|
+
{
|
|
641
|
+
ref,
|
|
642
|
+
className: cn(badgeDigitVariants({ size, variant }), className),
|
|
643
|
+
style: { marginBottom: 0 },
|
|
644
|
+
...rest,
|
|
645
|
+
children: String(value)
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
);
|
|
650
|
+
BadgeDigit.displayName = "BadgeDigit";
|
|
651
|
+
|
|
652
|
+
// src/components/Content/BadgeDot.tsx
|
|
653
|
+
var React9 = require("react");
|
|
654
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
655
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
656
|
+
var badgeDotVariants = (0, import_class_variance_authority9.cva)("rounded-xl w-3 h-3", {
|
|
657
|
+
variants: {
|
|
658
|
+
status: {
|
|
659
|
+
disabled: "bg-(--text-primary)",
|
|
660
|
+
informal: "bg-(--background-informal)",
|
|
661
|
+
"success/online": "bg-(--background-success)",
|
|
662
|
+
warning: "bg-(--background-warning)",
|
|
663
|
+
error: "bg-(--background-error)"
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
defaultVariants: {
|
|
667
|
+
status: "disabled"
|
|
668
|
+
}
|
|
669
|
+
});
|
|
670
|
+
var BadgeDot = ({ status, className }) => {
|
|
671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn(badgeDotVariants({ status }), className) });
|
|
672
|
+
};
|
|
673
|
+
BadgeDot.displayName = "BadgeDot";
|
|
674
|
+
|
|
675
|
+
// src/components/Content/BadgeStatus.tsx
|
|
676
|
+
var React10 = __toESM(require("react"), 1);
|
|
677
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
678
|
+
var BadgeStatus = React10.forwardRef(
|
|
679
|
+
(props, ref) => {
|
|
680
|
+
const {
|
|
681
|
+
label,
|
|
682
|
+
active = true,
|
|
683
|
+
className,
|
|
684
|
+
dotClassName,
|
|
685
|
+
...rest
|
|
686
|
+
} = props;
|
|
687
|
+
const textClasses = active ? "caption-medium text-(--text-primary)" : "caption-medium text-(--text-primary-disabled)";
|
|
688
|
+
const dotClasses = active ? "bg-(--background-informal)" : "bg-(--background-primary)";
|
|
689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
690
|
+
"div",
|
|
691
|
+
{
|
|
692
|
+
ref,
|
|
693
|
+
className: cn("inline-flex items-center gap-2", className),
|
|
694
|
+
...rest,
|
|
695
|
+
children: [
|
|
696
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
697
|
+
"span",
|
|
698
|
+
{
|
|
699
|
+
className: cn(
|
|
700
|
+
"shrink-0 w-3 h-3 rounded-full",
|
|
701
|
+
dotClasses,
|
|
702
|
+
dotClassName
|
|
703
|
+
)
|
|
704
|
+
}
|
|
705
|
+
),
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: textClasses, style: { marginBottom: 0 }, children: label })
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
}
|
|
711
|
+
);
|
|
712
|
+
BadgeStatus.displayName = "BadgeStatus";
|
|
713
|
+
|
|
714
|
+
// src/components/Content/Divider.tsx
|
|
715
|
+
var React11 = require("react");
|
|
716
|
+
var import_icons2 = require("@bubo-squared/icons");
|
|
717
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
718
|
+
var lineClass = "h-px flex-1 bg-(--border-secondary)";
|
|
719
|
+
var Divider = (props) => {
|
|
720
|
+
const { type = "line", className, ...rest } = props;
|
|
721
|
+
const showCenter = type !== "line";
|
|
722
|
+
const textLabel = type === "text-lines" && "label" in rest && rest.label ? rest.label : "OR";
|
|
723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
724
|
+
"div",
|
|
725
|
+
{
|
|
726
|
+
className: cn(
|
|
727
|
+
"flex w-full items-center",
|
|
728
|
+
showCenter ? "gap-2" : "gap-0",
|
|
729
|
+
className
|
|
730
|
+
),
|
|
731
|
+
...rest,
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: lineClass }),
|
|
734
|
+
type === "text-lines" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
735
|
+
"span",
|
|
736
|
+
{
|
|
737
|
+
className: "footnote text-(--text-secondary)",
|
|
738
|
+
style: { marginBottom: 0 },
|
|
739
|
+
children: textLabel
|
|
740
|
+
}
|
|
741
|
+
),
|
|
742
|
+
type === "icon-lines" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
743
|
+
IconButton,
|
|
744
|
+
{
|
|
745
|
+
variant: props.type === "icon-lines" && props.iconButtonVariant ? props.iconButtonVariant : "secondary",
|
|
746
|
+
size: "sm",
|
|
747
|
+
"aria-label": props.type === "icon-lines" && props.ariaLabel ? props.ariaLabel : textLabel || "More options",
|
|
748
|
+
icon: props.type === "icon-lines" ? props.icon : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons2.TargetIcon, {}),
|
|
749
|
+
onClick: props.type === "icon-lines" ? props.onIconClick : void 0
|
|
750
|
+
}
|
|
751
|
+
),
|
|
752
|
+
type === "icon-group-lines" && (props.type === "icon-group-lines" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
753
|
+
IconButtonGroup,
|
|
754
|
+
{
|
|
755
|
+
items: props.iconGroupItems,
|
|
756
|
+
size: props.iconGroupSize
|
|
757
|
+
}
|
|
758
|
+
) : null),
|
|
759
|
+
type === "button-lines" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
760
|
+
Button,
|
|
761
|
+
{
|
|
762
|
+
variant: props.type === "button-lines" && props.buttonVariant ? props.buttonVariant : "secondary",
|
|
763
|
+
size: "md",
|
|
764
|
+
onClick: props.type === "button-lines" ? props.onButtonClick : void 0,
|
|
765
|
+
children: props.type === "button-lines" ? props.buttonLabel : "Label"
|
|
766
|
+
}
|
|
767
|
+
),
|
|
768
|
+
showCenter && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: lineClass })
|
|
769
|
+
]
|
|
770
|
+
}
|
|
771
|
+
);
|
|
772
|
+
};
|
|
773
|
+
Divider.displayName = "Divider";
|
|
774
|
+
|
|
775
|
+
// src/components/Content/Progress.tsx
|
|
776
|
+
var React12 = __toESM(require("react"), 1);
|
|
777
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
778
|
+
var sizeToBarClasses = {
|
|
779
|
+
lg: "h-4 rounded-[16px]",
|
|
780
|
+
md: "h-2 rounded-[8px]",
|
|
781
|
+
sm: "h-1 rounded-[4px]"
|
|
782
|
+
};
|
|
783
|
+
var Progress = React12.forwardRef(
|
|
784
|
+
(props, ref) => {
|
|
785
|
+
const {
|
|
786
|
+
value,
|
|
787
|
+
label,
|
|
788
|
+
hint,
|
|
789
|
+
showLabel = true,
|
|
790
|
+
showHint = !!hint,
|
|
791
|
+
size = "lg",
|
|
792
|
+
className,
|
|
793
|
+
...rest
|
|
794
|
+
} = props;
|
|
795
|
+
const clamped = Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : 0;
|
|
796
|
+
const percentageLabel = `${Math.round(clamped)}%`;
|
|
797
|
+
const barHeightClasses = sizeToBarClasses[size];
|
|
798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
799
|
+
"div",
|
|
800
|
+
{
|
|
801
|
+
ref,
|
|
802
|
+
className: cn("flex flex-col gap-2 items-start w-full", className),
|
|
803
|
+
role: "progressbar",
|
|
804
|
+
"aria-valuenow": clamped,
|
|
805
|
+
"aria-valuemin": 0,
|
|
806
|
+
"aria-valuemax": 100,
|
|
807
|
+
"aria-label": label,
|
|
808
|
+
...rest,
|
|
809
|
+
children: [
|
|
810
|
+
showLabel && label && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex w-full items-center justify-between", children: [
|
|
811
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "paragraph-s-bold text-(--text-primary)", style: { marginBottom: 0 }, children: label }),
|
|
812
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "footnote text-(--text-secondary)", style: { marginBottom: 0 }, children: percentageLabel })
|
|
813
|
+
] }),
|
|
814
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: cn("w-full bg-(--chart-mono) overflow-hidden", barHeightClasses), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
815
|
+
"div",
|
|
816
|
+
{
|
|
817
|
+
className: cn(
|
|
818
|
+
"bg-(--chart-brand) h-full",
|
|
819
|
+
size === "lg" ? "rounded-4" : size === "md" ? "rounded-2" : "rounded-1"
|
|
820
|
+
),
|
|
821
|
+
style: { width: `${clamped}%` }
|
|
822
|
+
}
|
|
823
|
+
) }),
|
|
824
|
+
showHint && hint && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "caption text-(--text-secondary)", style: { marginBottom: 0 }, children: hint })
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
);
|
|
830
|
+
Progress.displayName = "Progress";
|
|
831
|
+
|
|
832
|
+
// src/components/Content/StatusAvatar.tsx
|
|
833
|
+
var React13 = __toESM(require("react"), 1);
|
|
834
|
+
var import_class_variance_authority10 = require("class-variance-authority");
|
|
835
|
+
var import_icons3 = require("@bubo-squared/icons");
|
|
836
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
837
|
+
var iconStatusVariants = (0, import_class_variance_authority10.cva)(
|
|
838
|
+
"inline-flex h-5 w-5 items-center justify-center rounded-full border-1 border-(--text-primary-inverse) p-1",
|
|
839
|
+
{
|
|
840
|
+
variants: {
|
|
841
|
+
variant: {
|
|
842
|
+
verified: "bg-(--background-informal)",
|
|
843
|
+
bookmark: "bg-(--background-brand)",
|
|
844
|
+
favorite: "bg-(--background-success)",
|
|
845
|
+
add: "bg-(--background-primary-hover)",
|
|
846
|
+
remove: "bg-(--background-error)"
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
defaultVariants: {
|
|
850
|
+
variant: "verified"
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
);
|
|
854
|
+
var presenceDotBase = "inline-flex h-5 w-5 items-center justify-center";
|
|
855
|
+
var presenceDotByVariant = {
|
|
856
|
+
offline: "bg-(--background-primary) border-1 border-(--text-primary-inverse)",
|
|
857
|
+
online: "bg-(--background-success) border-1 border-(--text-primary-inverse)",
|
|
858
|
+
away: "bg-(--background-warning) border-1 border-(--text-primary-inverse)",
|
|
859
|
+
busy: "bg-(--background-error) border-1 border-(--text-primary-inverse)"
|
|
860
|
+
};
|
|
861
|
+
var StatusAvatar = React13.forwardRef((props, ref) => {
|
|
862
|
+
const { variant = "verified", className, ...rest } = props;
|
|
863
|
+
if (variant === "offline" || variant === "online" || variant === "away" || variant === "busy") {
|
|
864
|
+
const dotClasses = presenceDotByVariant[variant];
|
|
865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
866
|
+
"div",
|
|
867
|
+
{
|
|
868
|
+
ref,
|
|
869
|
+
className: cn(
|
|
870
|
+
presenceDotBase,
|
|
871
|
+
className
|
|
872
|
+
),
|
|
873
|
+
...rest,
|
|
874
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn(dotClasses, "h-3.5 w-3.5 rounded-full") })
|
|
875
|
+
}
|
|
876
|
+
);
|
|
877
|
+
}
|
|
878
|
+
const iconVariant = variant;
|
|
879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
880
|
+
"div",
|
|
881
|
+
{
|
|
882
|
+
ref,
|
|
883
|
+
className: cn(iconStatusVariants({ variant: iconVariant }), className),
|
|
884
|
+
...rest,
|
|
885
|
+
children: [
|
|
886
|
+
iconVariant === "verified" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons3.CheckIcon, { className: "h-3 w-3 text-(--text-button-white)" }),
|
|
887
|
+
iconVariant === "bookmark" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons3.BookmarkCheckIcon, { className: "h-3 w-3 text-(--text-button-white)" }),
|
|
888
|
+
iconVariant === "favorite" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons3.StarIcon, { className: "h-3 w-3 text-(--text-button-white)" }),
|
|
889
|
+
iconVariant === "add" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons3.PlusIcon, { className: "h-3 w-3 text-(--text-button-white)" }),
|
|
890
|
+
iconVariant === "remove" && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons3.CrossIcon, { className: "h-3 w-3 text-(--text-button-white)" })
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
);
|
|
894
|
+
});
|
|
895
|
+
StatusAvatar.displayName = "StatusAvatar";
|
|
896
|
+
|
|
897
|
+
// src/components/Content/Tag.tsx
|
|
898
|
+
var React14 = __toESM(require("react"), 1);
|
|
899
|
+
var import_react_slot6 = require("@radix-ui/react-slot");
|
|
900
|
+
var import_class_variance_authority11 = require("class-variance-authority");
|
|
901
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
902
|
+
var tagVariants = (0, import_class_variance_authority11.cva)(
|
|
903
|
+
"inline-flex flex-row items-center justify-center rounded-[6px] gap-2 px-3 overflow-hidden border-1 border-(--border-secondary) bg-(--background-neutral) hover:border-(--border-secondary-hover) focus:border-(--border-brand) focus-ring-primary ",
|
|
904
|
+
{
|
|
905
|
+
variants: {
|
|
906
|
+
size: {
|
|
907
|
+
sm: "py-0.5",
|
|
908
|
+
md: "py-1.5"
|
|
909
|
+
}
|
|
910
|
+
},
|
|
911
|
+
defaultVariants: {
|
|
912
|
+
size: "sm"
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
var disabledTag = "pointer-events-none border-(--border-secondary-disabled) bg-(--background-neutral-disabled) text-(--text-primary-disabled)";
|
|
917
|
+
var iconClasses = "flex items-center justify-center w-5 h-5 [&>*]:w-5 [&>*]:h-5 shrink-0 text-(--text-primary)";
|
|
918
|
+
var Tag = React14.forwardRef(
|
|
919
|
+
(props, ref) => {
|
|
920
|
+
const {
|
|
921
|
+
size = "sm",
|
|
922
|
+
className,
|
|
923
|
+
asChild = false,
|
|
924
|
+
disabled = false,
|
|
925
|
+
label,
|
|
926
|
+
value,
|
|
927
|
+
...rest
|
|
928
|
+
} = props;
|
|
929
|
+
const Comp = asChild ? import_react_slot6.Slot : "div";
|
|
930
|
+
const leading = props.leadingIcon && React14.isValidElement(props.leadingIcon) ? React14.cloneElement(props.leadingIcon, { disabled, ...props.leadingIcon.props }) : null;
|
|
931
|
+
const trailing = props.trailingIcon && React14.isValidElement(props.trailingIcon) ? React14.cloneElement(props.trailingIcon, { disabled, ...props.trailingIcon.props }) : null;
|
|
932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
933
|
+
Comp,
|
|
934
|
+
{
|
|
935
|
+
className: cn(tagVariants({ size }), disabled && disabledTag, className),
|
|
936
|
+
ref,
|
|
937
|
+
...rest,
|
|
938
|
+
children: [
|
|
939
|
+
leading && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: iconClasses, children: leading }),
|
|
940
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-row gap-1 items-center", children: [
|
|
941
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-(--text-primary) paragraph-l mb-0! cursor-default font-normal", children: label }),
|
|
942
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-(--text-primary) paragraph-l mb-0! cursor-default font-normal", children: ":" }),
|
|
943
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-(--text-primary) paragraph-l-medium mb-0! cursor-default font-medium", children: value })
|
|
944
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-(--text-primary) paragraph-l mb-0! cursor-default", children: label }),
|
|
945
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: iconClasses, children: trailing })
|
|
946
|
+
]
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
);
|
|
951
|
+
|
|
952
|
+
// src/components/Inputs/Checkbox.tsx
|
|
953
|
+
var React15 = require("react");
|
|
954
|
+
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
955
|
+
var import_icons4 = require("@bubo-squared/icons");
|
|
956
|
+
var import_icons5 = require("@bubo-squared/icons");
|
|
957
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
958
|
+
function Checkbox({ label, className, ...props }) {
|
|
959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "inline-flex items-center gap-(--space-12) cursor-pointer select-none", children: [
|
|
960
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
961
|
+
CheckboxPrimitive.Root,
|
|
962
|
+
{
|
|
963
|
+
className: cn(
|
|
964
|
+
"group flex h-5 w-5 items-center justify-center rounded-xs border border-(--border-secondary) bg-(--background-neutral) text-(--text-primary)",
|
|
965
|
+
"data-[state=checked]:bg-(--background-brand) data-[state=checked]:text-(--text-button-white) data-[state=checked]:border-none",
|
|
966
|
+
"data-[state=indeterminate]:bg-(--background-brand) data-[state=indeterminate]:text-(--text-button-white) data-[state=indeterminate]:border-none",
|
|
967
|
+
"data-[state=checked]:hover:bg-(--background-brand-hover) data-[state=indeterminate]:hover:bg-(--background-brand-hover)",
|
|
968
|
+
"focus-visible:border-(--border-brand)",
|
|
969
|
+
"disabled:bg-(--background-primary-disabled) disabled:border-none disabled:text-(--icon-primary-disabled)",
|
|
970
|
+
"data-[state=checked]:disabled:bg-(--background-primary-disabled) data-[state=checked]:disabled:border-none data-[state=checked]:disabled:text-(--icon-primary-disabled)",
|
|
971
|
+
"data-[state=indeterminate]:disabled:bg-(--background-primary-disabled) data-[state=indeterminate]:disabled:border-none data-[state=indeterminate]:disabled:text-(--icon-primary-disabled)",
|
|
972
|
+
"focus-ring-primary hover:cursor-pointer hover:border-(--border-secondary-hover)",
|
|
973
|
+
className
|
|
974
|
+
),
|
|
975
|
+
...props,
|
|
976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons4.CheckIcon, { className: "h-5 w-5 hidden group-data-[state=checked]:block" }),
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_icons5.MinusIcon, { className: "h-5 w-5 hidden group-data-[state=indeterminate]:block" })
|
|
979
|
+
] })
|
|
980
|
+
}
|
|
981
|
+
),
|
|
982
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "paragraph-m-medium text-(--text-primary)", style: { marginBottom: 0 }, children: label })
|
|
983
|
+
] });
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// src/components/Inputs/Dropdown.tsx
|
|
987
|
+
var React16 = __toESM(require("react"), 1);
|
|
988
|
+
var import_class_variance_authority12 = require("class-variance-authority");
|
|
989
|
+
var import_icons6 = require("@bubo-squared/icons");
|
|
990
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
991
|
+
var dropdownWrapperBase = "flex flex-col gap-2 items-start min-w-[343px]";
|
|
992
|
+
var dropdownTriggerVariants = (0, import_class_variance_authority12.cva)(
|
|
993
|
+
"group flex w-full items-center justify-between rounded border bg-(--background-primary) px-3 py-2 text-left transition-colors cursor-pointer focus-ring-primary focus:border-(--border-brand) hover:bg-(--background-primary-hover) disabled:bg-(--background-primary) disabled:border-(--border-secondary-disabled) disabled:text-(--text-primary-disabled) disabled:cursor-default",
|
|
994
|
+
{
|
|
995
|
+
variants: {
|
|
996
|
+
size: {
|
|
997
|
+
large: "h-11",
|
|
998
|
+
"extra-large": "h-14"
|
|
999
|
+
},
|
|
1000
|
+
status: {
|
|
1001
|
+
default: "border-(--border-secondary)",
|
|
1002
|
+
success: "border-(--border-success)",
|
|
1003
|
+
error: "border-(--border-error)"
|
|
1004
|
+
}
|
|
1005
|
+
},
|
|
1006
|
+
defaultVariants: {
|
|
1007
|
+
size: "large",
|
|
1008
|
+
status: "default"
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
);
|
|
1012
|
+
var dropdownTextVariants = (0, import_class_variance_authority12.cva)("truncate", {
|
|
1013
|
+
variants: {
|
|
1014
|
+
size: {
|
|
1015
|
+
large: "subtitle",
|
|
1016
|
+
"extra-large": "h6-title"
|
|
1017
|
+
},
|
|
1018
|
+
hasValue: {
|
|
1019
|
+
false: "text-(--text-secondary)",
|
|
1020
|
+
true: "text-(--text-primary)"
|
|
1021
|
+
},
|
|
1022
|
+
disabled: {
|
|
1023
|
+
true: "text-(--text-primary-disabled)"
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
defaultVariants: {
|
|
1027
|
+
size: "large",
|
|
1028
|
+
hasValue: false
|
|
1029
|
+
}
|
|
1030
|
+
});
|
|
1031
|
+
var dropdownIconVariants = (0, import_class_variance_authority12.cva)("flex items-center justify-center shrink-0", {
|
|
1032
|
+
variants: {
|
|
1033
|
+
size: {
|
|
1034
|
+
large: "w-5 h-5",
|
|
1035
|
+
"extra-large": "w-6 h-6"
|
|
1036
|
+
},
|
|
1037
|
+
disabled: {
|
|
1038
|
+
false: "text-(--icon-primary)",
|
|
1039
|
+
true: "text-(--icon-primary-disabled)"
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
defaultVariants: {
|
|
1043
|
+
size: "large",
|
|
1044
|
+
disabled: false
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
var Dropdown = (props) => {
|
|
1048
|
+
const {
|
|
1049
|
+
label = "Field Label",
|
|
1050
|
+
showLabel = true,
|
|
1051
|
+
hint = "This is a hint text to help user.",
|
|
1052
|
+
showHint = true,
|
|
1053
|
+
placeholder = "Placeholder text",
|
|
1054
|
+
size = "large",
|
|
1055
|
+
status = "default",
|
|
1056
|
+
disabled,
|
|
1057
|
+
options,
|
|
1058
|
+
value,
|
|
1059
|
+
defaultValue,
|
|
1060
|
+
onChange,
|
|
1061
|
+
className,
|
|
1062
|
+
showMenu,
|
|
1063
|
+
...buttonProps
|
|
1064
|
+
} = props;
|
|
1065
|
+
const dropdownRef = React16.useRef(null);
|
|
1066
|
+
const isControlled = value !== void 0;
|
|
1067
|
+
const [internalValue, setInternalValue] = React16.useState(
|
|
1068
|
+
defaultValue
|
|
1069
|
+
);
|
|
1070
|
+
const [open, setOpen] = React16.useState(false);
|
|
1071
|
+
const currentValue = isControlled ? value : internalValue;
|
|
1072
|
+
const selectedOption = options.find((opt) => opt.value === currentValue);
|
|
1073
|
+
const hasValue = !!selectedOption;
|
|
1074
|
+
const isOpen = showMenu ?? open;
|
|
1075
|
+
const handleToggle = () => {
|
|
1076
|
+
if (disabled) return;
|
|
1077
|
+
if (showMenu === void 0) {
|
|
1078
|
+
setOpen((prev) => !prev);
|
|
1079
|
+
}
|
|
1080
|
+
};
|
|
1081
|
+
const handleSelect = (optionValue) => {
|
|
1082
|
+
if (!isControlled) {
|
|
1083
|
+
setInternalValue(optionValue);
|
|
1084
|
+
}
|
|
1085
|
+
onChange?.(optionValue);
|
|
1086
|
+
if (showMenu === void 0) {
|
|
1087
|
+
setOpen(false);
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
const triggerId = React16.useId();
|
|
1091
|
+
const labelId = `${triggerId}-label`;
|
|
1092
|
+
const hintId = `${triggerId}-hint`;
|
|
1093
|
+
React16.useEffect(() => {
|
|
1094
|
+
if (showMenu !== void 0) return;
|
|
1095
|
+
const handleClickOutside = (event) => {
|
|
1096
|
+
if (!dropdownRef.current) return;
|
|
1097
|
+
if (!dropdownRef.current.contains(event.target)) {
|
|
1098
|
+
setOpen(false);
|
|
1099
|
+
}
|
|
1100
|
+
};
|
|
1101
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1102
|
+
return () => {
|
|
1103
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1104
|
+
};
|
|
1105
|
+
}, [showMenu]);
|
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: dropdownRef, className: dropdownWrapperBase, children: [
|
|
1107
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1108
|
+
"label",
|
|
1109
|
+
{
|
|
1110
|
+
htmlFor: triggerId,
|
|
1111
|
+
id: labelId,
|
|
1112
|
+
className: cn(
|
|
1113
|
+
"paragraph-s",
|
|
1114
|
+
disabled ? "text-(--text-primary-disabled)" : "text-(--text-primary)"
|
|
1115
|
+
),
|
|
1116
|
+
style: { marginBottom: 0 },
|
|
1117
|
+
children: label
|
|
1118
|
+
}
|
|
1119
|
+
),
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative w-full", children: [
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1122
|
+
"button",
|
|
1123
|
+
{
|
|
1124
|
+
type: "button",
|
|
1125
|
+
id: triggerId,
|
|
1126
|
+
"aria-haspopup": "listbox",
|
|
1127
|
+
"aria-expanded": isOpen,
|
|
1128
|
+
"aria-labelledby": showLabel ? labelId : void 0,
|
|
1129
|
+
"aria-describedby": showHint ? hintId : void 0,
|
|
1130
|
+
disabled,
|
|
1131
|
+
className: cn(
|
|
1132
|
+
dropdownTriggerVariants({ size, status }),
|
|
1133
|
+
className
|
|
1134
|
+
),
|
|
1135
|
+
onClick: handleToggle,
|
|
1136
|
+
"data-open": isOpen || void 0,
|
|
1137
|
+
...buttonProps,
|
|
1138
|
+
children: [
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1140
|
+
"span",
|
|
1141
|
+
{
|
|
1142
|
+
className: cn(
|
|
1143
|
+
dropdownTextVariants({
|
|
1144
|
+
size,
|
|
1145
|
+
hasValue,
|
|
1146
|
+
disabled: !!disabled
|
|
1147
|
+
})
|
|
1148
|
+
),
|
|
1149
|
+
style: { marginBottom: 0 },
|
|
1150
|
+
children: hasValue ? selectedOption?.label : placeholder
|
|
1151
|
+
}
|
|
1152
|
+
),
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1154
|
+
"span",
|
|
1155
|
+
{
|
|
1156
|
+
className: cn(
|
|
1157
|
+
dropdownIconVariants({ size, disabled: !!disabled })
|
|
1158
|
+
),
|
|
1159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons6.ChevronDownIcon, {})
|
|
1160
|
+
}
|
|
1161
|
+
)
|
|
1162
|
+
]
|
|
1163
|
+
}
|
|
1164
|
+
),
|
|
1165
|
+
isOpen && options.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "absolute z-10 mt-1 w-full min-w-343 rounded-(--border-radius-4) border border-(--border-primary-hover) bg-(--background-neutral) shadow-card-md flex overflow-y-scroll dropdown-scrollbar max-h-[316px]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { role: "listbox", className: "flex flex-1 flex-col", children: options.map((opt) => {
|
|
1166
|
+
const selected = opt.value === currentValue;
|
|
1167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1168
|
+
"li",
|
|
1169
|
+
{
|
|
1170
|
+
className: cn(
|
|
1171
|
+
"bg-(--background-neutral) border-b border-(--border-secondary) last:border-b-0",
|
|
1172
|
+
selected && "bg-(--background-secondary)"
|
|
1173
|
+
),
|
|
1174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1175
|
+
"button",
|
|
1176
|
+
{
|
|
1177
|
+
type: "button",
|
|
1178
|
+
className: "flex w-full items-center gap-2 pl-(--space-8) pr-(--space-16) py-(--space-8) text-left paragraph-l text-(--text-primary) hover:bg-(--background-secondary)",
|
|
1179
|
+
style: { marginBottom: 0 },
|
|
1180
|
+
role: "option",
|
|
1181
|
+
"aria-selected": selected,
|
|
1182
|
+
onClick: () => handleSelect(opt.value),
|
|
1183
|
+
children: opt.label
|
|
1184
|
+
}
|
|
1185
|
+
)
|
|
1186
|
+
},
|
|
1187
|
+
opt.value
|
|
1188
|
+
);
|
|
1189
|
+
}) }) })
|
|
1190
|
+
] }),
|
|
1191
|
+
showHint && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1192
|
+
"p",
|
|
1193
|
+
{
|
|
1194
|
+
id: hintId,
|
|
1195
|
+
className: cn(
|
|
1196
|
+
"caption",
|
|
1197
|
+
disabled ? "text-(--text-primary-disabled)" : "text-(--text-secondary)"
|
|
1198
|
+
),
|
|
1199
|
+
style: { marginBottom: 0 },
|
|
1200
|
+
children: hint
|
|
1201
|
+
}
|
|
1202
|
+
)
|
|
1203
|
+
] });
|
|
1204
|
+
};
|
|
1205
|
+
Dropdown.displayName = "Dropdown";
|
|
1206
|
+
|
|
1207
|
+
// src/components/Inputs/PasswordInput.tsx
|
|
1208
|
+
var React20 = __toESM(require("react"), 1);
|
|
1209
|
+
var import_class_variance_authority14 = require("class-variance-authority");
|
|
1210
|
+
|
|
1211
|
+
// src/components/ui/input.tsx
|
|
1212
|
+
var React17 = __toESM(require("react"), 1);
|
|
1213
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1214
|
+
var Input = React17.forwardRef(
|
|
1215
|
+
({ className, type, variant = "default", ...props }, ref) => {
|
|
1216
|
+
const base = "text-(--text-primary) placeholder:text-(--text-secondary) disabled:text-(--text-primary-disabled) disabled:placeholder:text-(--text-primary-disabled) selection:bg-primary selection:text-primary-foreground file:text-foreground";
|
|
1217
|
+
const defaultStyles = "dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 shadow-xs transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 focus-visible:border-ring focus-visible:ring-0 focus-visible:shadow-none aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive";
|
|
1218
|
+
const bareStyles = "bg-transparent outline-none w-full";
|
|
1219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1220
|
+
"input",
|
|
1221
|
+
{
|
|
1222
|
+
ref,
|
|
1223
|
+
type,
|
|
1224
|
+
"data-slot": "input",
|
|
1225
|
+
className: cn(
|
|
1226
|
+
base,
|
|
1227
|
+
variant === "default" ? defaultStyles : bareStyles,
|
|
1228
|
+
className
|
|
1229
|
+
),
|
|
1230
|
+
...props
|
|
1231
|
+
}
|
|
1232
|
+
);
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1235
|
+
Input.displayName = "Input";
|
|
1236
|
+
|
|
1237
|
+
// src/components/Inputs/Field.tsx
|
|
1238
|
+
var React18 = __toESM(require("react"), 1);
|
|
1239
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1240
|
+
var fieldBase = "flex flex-col gap-2 items-start min-w-[343px]";
|
|
1241
|
+
var Field = (props) => {
|
|
1242
|
+
const {
|
|
1243
|
+
label,
|
|
1244
|
+
hint,
|
|
1245
|
+
status = "default",
|
|
1246
|
+
disabled,
|
|
1247
|
+
className,
|
|
1248
|
+
children
|
|
1249
|
+
} = props;
|
|
1250
|
+
const fieldId = React18.useId();
|
|
1251
|
+
const labelId = label ? `${fieldId}-label` : void 0;
|
|
1252
|
+
const hintId = hint ? `${fieldId}-hint` : void 0;
|
|
1253
|
+
const hintColorClass = disabled ? "text-(--text-primary-disabled)" : status === "success" ? "text-(--text-success)" : status === "error" ? "text-(--text-error)" : "text-(--text-secondary)";
|
|
1254
|
+
const labelColorClass = disabled ? "text-(--text-primary-disabled)" : "text-(--text-primary)";
|
|
1255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn(fieldBase, className), children: [
|
|
1256
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1257
|
+
"label",
|
|
1258
|
+
{
|
|
1259
|
+
id: labelId,
|
|
1260
|
+
className: cn("paragraph-s", labelColorClass),
|
|
1261
|
+
style: { marginBottom: 0 },
|
|
1262
|
+
children: label
|
|
1263
|
+
}
|
|
1264
|
+
),
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "relative w-full", children }),
|
|
1266
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1267
|
+
"p",
|
|
1268
|
+
{
|
|
1269
|
+
id: hint ? hintId : void 0,
|
|
1270
|
+
className: cn("caption", hint ? hintColorClass : "invisible"),
|
|
1271
|
+
style: { marginBottom: 0 },
|
|
1272
|
+
children: hint || "\xA0"
|
|
1273
|
+
}
|
|
1274
|
+
)
|
|
1275
|
+
] });
|
|
1276
|
+
};
|
|
1277
|
+
Field.displayName = "Field";
|
|
1278
|
+
|
|
1279
|
+
// src/components/Inputs/InputShell.tsx
|
|
1280
|
+
var React19 = __toESM(require("react"), 1);
|
|
1281
|
+
var import_class_variance_authority13 = require("class-variance-authority");
|
|
1282
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1283
|
+
var inputShellVariants = (0, import_class_variance_authority13.cva)(
|
|
1284
|
+
"group flex w-full items-center rounded border bg-(--background-primary) text-left cursor-text border-(--border-secondary)",
|
|
1285
|
+
{
|
|
1286
|
+
variants: {
|
|
1287
|
+
size: {
|
|
1288
|
+
large: "gap-2 px-2 py-2 h-11",
|
|
1289
|
+
"extra-large": "gap-2 px-[10px] py-2 h-14"
|
|
1290
|
+
},
|
|
1291
|
+
status: {
|
|
1292
|
+
default: "input-default",
|
|
1293
|
+
success: "input-success",
|
|
1294
|
+
error: "input-error"
|
|
1295
|
+
},
|
|
1296
|
+
disabled: {
|
|
1297
|
+
true: "bg-(--background-primary-disabled) border-(--border-secondary-disabled) text-(--text-primary-disabled) cursor-default"
|
|
1298
|
+
}
|
|
1299
|
+
},
|
|
1300
|
+
defaultVariants: {
|
|
1301
|
+
size: "large",
|
|
1302
|
+
status: "default"
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1306
|
+
var InputShell = React19.forwardRef(
|
|
1307
|
+
({ size, status, disabled, className, ...rest }, ref) => {
|
|
1308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1309
|
+
"div",
|
|
1310
|
+
{
|
|
1311
|
+
ref,
|
|
1312
|
+
"aria-disabled": disabled || void 0,
|
|
1313
|
+
className: cn(
|
|
1314
|
+
inputShellVariants({ size, status, disabled }),
|
|
1315
|
+
className
|
|
1316
|
+
),
|
|
1317
|
+
...rest
|
|
1318
|
+
}
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
);
|
|
1322
|
+
InputShell.displayName = "InputShell";
|
|
1323
|
+
|
|
1324
|
+
// src/components/Inputs/PasswordInput.tsx
|
|
1325
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1326
|
+
var passwordTextVariants = (0, import_class_variance_authority14.cva)("truncate", {
|
|
1327
|
+
variants: {
|
|
1328
|
+
size: {
|
|
1329
|
+
large: "subtitle",
|
|
1330
|
+
"extra-large": "h6-title"
|
|
1331
|
+
},
|
|
1332
|
+
disabled: {
|
|
1333
|
+
true: "text-(--text-primary-disabled)",
|
|
1334
|
+
false: "text-(--text-primary)"
|
|
1335
|
+
}
|
|
1336
|
+
},
|
|
1337
|
+
defaultVariants: {
|
|
1338
|
+
size: "large",
|
|
1339
|
+
disabled: false
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
var iconWrapperVariants = (0, import_class_variance_authority14.cva)(
|
|
1343
|
+
"flex items-center justify-center shrink-0 text-(--icon-primary)",
|
|
1344
|
+
{
|
|
1345
|
+
variants: {
|
|
1346
|
+
size: {
|
|
1347
|
+
large: "w-5 h-5 [&>svg]:w-5 [&>svg]:h-5",
|
|
1348
|
+
"extra-large": "w-6 h-6 [&>svg]:w-6 [&>svg]:h-6"
|
|
1349
|
+
},
|
|
1350
|
+
disabled: {
|
|
1351
|
+
true: "text-(--icon-primary-disabled)"
|
|
1352
|
+
}
|
|
1353
|
+
},
|
|
1354
|
+
defaultVariants: {
|
|
1355
|
+
size: "large"
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
);
|
|
1359
|
+
var actionButtonVariants = (0, import_class_variance_authority14.cva)(
|
|
1360
|
+
"flex items-center justify-center shrink-0 cursor-pointer bg-transparent border-0 p-0 text-left paragraph-s text-(--icon-primary) hover:text-(--icon-primary-hover) focus:outline-none ",
|
|
1361
|
+
{
|
|
1362
|
+
variants: {
|
|
1363
|
+
size: {
|
|
1364
|
+
large: "paragraph-s",
|
|
1365
|
+
"extra-large": "paragraph-m"
|
|
1366
|
+
},
|
|
1367
|
+
disabled: {
|
|
1368
|
+
true: "cursor-default text-(--text-primary-disabled) hover:text-(--text-primary-disabled)"
|
|
1369
|
+
}
|
|
1370
|
+
},
|
|
1371
|
+
defaultVariants: {
|
|
1372
|
+
size: "large"
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
);
|
|
1376
|
+
var PasswordInput = (props) => {
|
|
1377
|
+
const {
|
|
1378
|
+
label,
|
|
1379
|
+
hint,
|
|
1380
|
+
placeholder = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",
|
|
1381
|
+
size = "large",
|
|
1382
|
+
status = "default",
|
|
1383
|
+
variant = "icons",
|
|
1384
|
+
disabled,
|
|
1385
|
+
className,
|
|
1386
|
+
leadingIcon,
|
|
1387
|
+
trailingIcon,
|
|
1388
|
+
actionLabel = "Action",
|
|
1389
|
+
onActionClick,
|
|
1390
|
+
value,
|
|
1391
|
+
defaultValue,
|
|
1392
|
+
onChange,
|
|
1393
|
+
...inputProps
|
|
1394
|
+
} = props;
|
|
1395
|
+
const isControlled = value !== void 0;
|
|
1396
|
+
const [internalValue, setInternalValue] = React20.useState(
|
|
1397
|
+
defaultValue ?? ""
|
|
1398
|
+
);
|
|
1399
|
+
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
1400
|
+
const inputRef = React20.useRef(null);
|
|
1401
|
+
const handleContainerClick = () => {
|
|
1402
|
+
if (disabled) return;
|
|
1403
|
+
inputRef.current?.focus();
|
|
1404
|
+
};
|
|
1405
|
+
const handleChange = (event) => {
|
|
1406
|
+
if (!isControlled) {
|
|
1407
|
+
setInternalValue(event.target.value);
|
|
1408
|
+
}
|
|
1409
|
+
onChange?.(event);
|
|
1410
|
+
};
|
|
1411
|
+
const showLeadingIcon = variant === "icons" && !!leadingIcon;
|
|
1412
|
+
const showTrailingIcon = variant === "icons" && !!trailingIcon;
|
|
1413
|
+
const showAction = variant === "action" && !!actionLabel;
|
|
1414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1415
|
+
Field,
|
|
1416
|
+
{
|
|
1417
|
+
label,
|
|
1418
|
+
hint,
|
|
1419
|
+
status,
|
|
1420
|
+
disabled,
|
|
1421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1422
|
+
InputShell,
|
|
1423
|
+
{
|
|
1424
|
+
size,
|
|
1425
|
+
status,
|
|
1426
|
+
disabled,
|
|
1427
|
+
className,
|
|
1428
|
+
onClick: handleContainerClick,
|
|
1429
|
+
children: [
|
|
1430
|
+
showLeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1431
|
+
"span",
|
|
1432
|
+
{
|
|
1433
|
+
className: cn(
|
|
1434
|
+
iconWrapperVariants({ size, disabled: !!disabled })
|
|
1435
|
+
),
|
|
1436
|
+
children: leadingIcon
|
|
1437
|
+
}
|
|
1438
|
+
),
|
|
1439
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1440
|
+
Input,
|
|
1441
|
+
{
|
|
1442
|
+
ref: inputRef,
|
|
1443
|
+
type: "password",
|
|
1444
|
+
disabled: disabled ?? void 0,
|
|
1445
|
+
placeholder,
|
|
1446
|
+
value: isControlled ? value : currentValue,
|
|
1447
|
+
defaultValue: isControlled ? void 0 : defaultValue,
|
|
1448
|
+
onChange: handleChange,
|
|
1449
|
+
variant: "bare",
|
|
1450
|
+
className: cn(
|
|
1451
|
+
passwordTextVariants({ size, disabled: !!disabled })
|
|
1452
|
+
),
|
|
1453
|
+
style: { marginBottom: 0 },
|
|
1454
|
+
...inputProps
|
|
1455
|
+
}
|
|
1456
|
+
),
|
|
1457
|
+
showTrailingIcon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1458
|
+
"span",
|
|
1459
|
+
{
|
|
1460
|
+
className: cn(
|
|
1461
|
+
iconWrapperVariants({ size, disabled: !!disabled })
|
|
1462
|
+
),
|
|
1463
|
+
children: trailingIcon
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
showAction && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1467
|
+
"button",
|
|
1468
|
+
{
|
|
1469
|
+
type: "button",
|
|
1470
|
+
style: { marginBottom: 0 },
|
|
1471
|
+
className: cn(
|
|
1472
|
+
actionButtonVariants({ size, disabled: !!disabled })
|
|
1473
|
+
),
|
|
1474
|
+
onClick: disabled ? void 0 : onActionClick,
|
|
1475
|
+
children: actionLabel
|
|
1476
|
+
}
|
|
1477
|
+
)
|
|
1478
|
+
]
|
|
1479
|
+
}
|
|
1480
|
+
)
|
|
1481
|
+
}
|
|
1482
|
+
);
|
|
1483
|
+
};
|
|
1484
|
+
PasswordInput.displayName = "PasswordInput";
|
|
1485
|
+
|
|
1486
|
+
// src/components/Inputs/RadioGroup.tsx
|
|
1487
|
+
var React21 = __toESM(require("react"), 1);
|
|
1488
|
+
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"), 1);
|
|
1489
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1490
|
+
var wrapperBase = "flex flex-col gap-2 items-start min-w-[343px]";
|
|
1491
|
+
var RadioGroup = ({
|
|
1492
|
+
label,
|
|
1493
|
+
hint,
|
|
1494
|
+
options,
|
|
1495
|
+
orientation = "vertical",
|
|
1496
|
+
disabled = false,
|
|
1497
|
+
value,
|
|
1498
|
+
defaultValue,
|
|
1499
|
+
onValueChange,
|
|
1500
|
+
className,
|
|
1501
|
+
...rootProps
|
|
1502
|
+
}) => {
|
|
1503
|
+
const groupId = React21.useId();
|
|
1504
|
+
const hintId = hint ? `${groupId}-hint` : void 0;
|
|
1505
|
+
const handleValueChange = (next) => {
|
|
1506
|
+
onValueChange?.(next);
|
|
1507
|
+
};
|
|
1508
|
+
const isHorizontal = orientation === "horizontal";
|
|
1509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: wrapperBase, children: [
|
|
1510
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1511
|
+
"span",
|
|
1512
|
+
{
|
|
1513
|
+
className: cn(
|
|
1514
|
+
"paragraph-s text-(--text-primary)",
|
|
1515
|
+
disabled && "text-(--text-primary-disabled)"
|
|
1516
|
+
),
|
|
1517
|
+
style: { marginBottom: 0 },
|
|
1518
|
+
children: label
|
|
1519
|
+
}
|
|
1520
|
+
),
|
|
1521
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1522
|
+
RadioGroupPrimitive.Root,
|
|
1523
|
+
{
|
|
1524
|
+
...rootProps,
|
|
1525
|
+
value,
|
|
1526
|
+
defaultValue,
|
|
1527
|
+
onValueChange: handleValueChange,
|
|
1528
|
+
"aria-describedby": hintId,
|
|
1529
|
+
className: cn(
|
|
1530
|
+
"flex",
|
|
1531
|
+
isHorizontal ? "flex-row gap-6" : "flex-col gap-2",
|
|
1532
|
+
className
|
|
1533
|
+
),
|
|
1534
|
+
children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1535
|
+
RadioGroupPrimitive.Item,
|
|
1536
|
+
{
|
|
1537
|
+
value: option.value,
|
|
1538
|
+
disabled: disabled || option.disabled,
|
|
1539
|
+
asChild: true,
|
|
1540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1541
|
+
"button",
|
|
1542
|
+
{
|
|
1543
|
+
type: "button",
|
|
1544
|
+
className: cn(
|
|
1545
|
+
"group inline-flex items-center gap-2 outline-none",
|
|
1546
|
+
"data-[disabled]:pointer-events-none",
|
|
1547
|
+
disabled || option.disabled ? "cursor-default" : "cursor-pointer"
|
|
1548
|
+
),
|
|
1549
|
+
children: [
|
|
1550
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1551
|
+
"span",
|
|
1552
|
+
{
|
|
1553
|
+
className: cn(
|
|
1554
|
+
"flex items-center justify-center shrink-0 h-5 w-5 rounded-full border bg-(--background-primary) transition-all",
|
|
1555
|
+
// 1: enabled, unchecked, unfocused, unhovered
|
|
1556
|
+
"group-data-[state=unchecked]:border-(--border-secondary)",
|
|
1557
|
+
// 2: enabled, checked, unfocused, unhovered
|
|
1558
|
+
"group-data-[state=checked]:border-(--border-brand)",
|
|
1559
|
+
// 3: enabled, unchecked, hovered, unfocused
|
|
1560
|
+
"group-data-[state=unchecked]:group-hover:border-(--border-secondary-hover)",
|
|
1561
|
+
// 4: enabled, checked, hovered, unfocused
|
|
1562
|
+
"group-data-[state=checked]:group-hover:border-(--border-brand-hover)",
|
|
1563
|
+
"group-data-[state=checked]:group-hover:shadow-[0_0_0_var(--focus-ring-spread)_var(--color-b-100)]",
|
|
1564
|
+
// 5: enabled, unchecked, focused (override 1/3)
|
|
1565
|
+
"group-data-[state=unchecked]:group-focus-visible:border-(--border-secondary-hover)",
|
|
1566
|
+
// 6: enabled, checked, focused (override 2/4)
|
|
1567
|
+
"group-data-[state=checked]:group-focus-visible:border-(--border-brand-focus)",
|
|
1568
|
+
"group-data-[state=checked]:group-focus-visible:shadow-[0_0_0_var(--focus-ring-spread)_var(--focus-primary)]",
|
|
1569
|
+
// 7: disabled, unchecked (override everything above)
|
|
1570
|
+
"group-[&[data-disabled][data-state=unchecked]]:border-none",
|
|
1571
|
+
"group-[&[data-disabled][data-state=unchecked]]:bg-(--background-primary-disabled)",
|
|
1572
|
+
// 8: disabled, checked (override everything above)
|
|
1573
|
+
"group-[&[data-disabled][data-state=checked]]:border-(--border-primary-disabled)",
|
|
1574
|
+
"group-[&[data-disabled][data-state=checked]]:bg-(--background-primary-disabled)"
|
|
1575
|
+
),
|
|
1576
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1577
|
+
"span",
|
|
1578
|
+
{
|
|
1579
|
+
className: cn(
|
|
1580
|
+
"h-4 w-4 rounded-full bg-(--background-brand) scale-0 transition-transform",
|
|
1581
|
+
"group-data-[state=checked]:scale-100",
|
|
1582
|
+
"group-data-[state=checked]:group-hover:bg-(--background-brand-hover)",
|
|
1583
|
+
"group-data-[state=checked]:group-focus-visible:bg-(--background-brand-hover)",
|
|
1584
|
+
"group-[&[data-disabled][data-state=checked]]:bg-(--background-brand-disabled)",
|
|
1585
|
+
"group-[&[data-disabled][data-state=unchecked]]:scale-0"
|
|
1586
|
+
)
|
|
1587
|
+
}
|
|
1588
|
+
)
|
|
1589
|
+
}
|
|
1590
|
+
),
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1592
|
+
"span",
|
|
1593
|
+
{
|
|
1594
|
+
className: cn(
|
|
1595
|
+
"paragraph-s text-(--text-primary)",
|
|
1596
|
+
"group-data-[disabled]:text-(--text-primary-disabled) whitespace-nowrap"
|
|
1597
|
+
),
|
|
1598
|
+
style: { marginBottom: 0 },
|
|
1599
|
+
children: option.label
|
|
1600
|
+
}
|
|
1601
|
+
)
|
|
1602
|
+
]
|
|
1603
|
+
}
|
|
1604
|
+
)
|
|
1605
|
+
},
|
|
1606
|
+
option.value
|
|
1607
|
+
))
|
|
1608
|
+
}
|
|
1609
|
+
),
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1611
|
+
"p",
|
|
1612
|
+
{
|
|
1613
|
+
id: hintId,
|
|
1614
|
+
className: cn(
|
|
1615
|
+
"caption text-(--text-secondary)",
|
|
1616
|
+
disabled && "text-(--text-primary-disabled)"
|
|
1617
|
+
),
|
|
1618
|
+
style: { marginBottom: 0 },
|
|
1619
|
+
children: hint ?? "\xA0"
|
|
1620
|
+
}
|
|
1621
|
+
)
|
|
1622
|
+
] });
|
|
1623
|
+
};
|
|
1624
|
+
|
|
1625
|
+
// src/components/Inputs/SearchInput.tsx
|
|
1626
|
+
var React22 = __toESM(require("react"), 1);
|
|
1627
|
+
var import_class_variance_authority15 = require("class-variance-authority");
|
|
1628
|
+
var import_icons7 = require("@bubo-squared/icons");
|
|
1629
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1630
|
+
var searchTextVariants = (0, import_class_variance_authority15.cva)("truncate", {
|
|
1631
|
+
variants: {
|
|
1632
|
+
size: {
|
|
1633
|
+
large: "subtitle",
|
|
1634
|
+
"extra-large": "h6-title"
|
|
1635
|
+
}
|
|
1636
|
+
},
|
|
1637
|
+
defaultVariants: {
|
|
1638
|
+
size: "large"
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
var iconWrapperVariants2 = (0, import_class_variance_authority15.cva)("flex items-center justify-center shrink-0 text-(--icon-primary)", {
|
|
1642
|
+
variants: {
|
|
1643
|
+
size: {
|
|
1644
|
+
large: "w-5 h-5 [&>svg]:w-5 [&>svg]:h-5",
|
|
1645
|
+
"extra-large": "w-6 h-6 [&>svg]:w-6 [&>svg]:h-6"
|
|
1646
|
+
},
|
|
1647
|
+
disabled: {
|
|
1648
|
+
true: "text-(--icon-primary-disabled)"
|
|
1649
|
+
}
|
|
1650
|
+
},
|
|
1651
|
+
defaultVariants: {
|
|
1652
|
+
size: "large"
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
var SearchInput = (props) => {
|
|
1656
|
+
const {
|
|
1657
|
+
placeholder = "Search...",
|
|
1658
|
+
size = "large",
|
|
1659
|
+
disabled,
|
|
1660
|
+
className,
|
|
1661
|
+
leadingIcon,
|
|
1662
|
+
showLeadingIcon = true,
|
|
1663
|
+
...inputProps
|
|
1664
|
+
} = props;
|
|
1665
|
+
const inputRef = React22.useRef(null);
|
|
1666
|
+
const handleContainerClick = () => {
|
|
1667
|
+
if (disabled) return;
|
|
1668
|
+
inputRef.current?.focus();
|
|
1669
|
+
};
|
|
1670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-col gap-2 items-start min-w-[343px]", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "relative w-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
1671
|
+
InputShell,
|
|
1672
|
+
{
|
|
1673
|
+
size,
|
|
1674
|
+
status: "default",
|
|
1675
|
+
disabled,
|
|
1676
|
+
className,
|
|
1677
|
+
onClick: handleContainerClick,
|
|
1678
|
+
children: [
|
|
1679
|
+
showLeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: cn(iconWrapperVariants2({ size, disabled: !!disabled })), children: leadingIcon ?? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_icons7.SearchIcon, {}) }),
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
1681
|
+
Input,
|
|
1682
|
+
{
|
|
1683
|
+
ref: inputRef,
|
|
1684
|
+
type: "search",
|
|
1685
|
+
placeholder,
|
|
1686
|
+
disabled: disabled ?? void 0,
|
|
1687
|
+
variant: "bare",
|
|
1688
|
+
className: cn(
|
|
1689
|
+
searchTextVariants({ size })
|
|
1690
|
+
),
|
|
1691
|
+
style: { marginBottom: 0 },
|
|
1692
|
+
...inputProps
|
|
1693
|
+
}
|
|
1694
|
+
)
|
|
1695
|
+
]
|
|
1696
|
+
}
|
|
1697
|
+
) }) });
|
|
1698
|
+
};
|
|
1699
|
+
SearchInput.displayName = "SearchInput";
|
|
1700
|
+
|
|
1701
|
+
// src/components/Inputs/Slider.tsx
|
|
1702
|
+
var React23 = __toESM(require("react"), 1);
|
|
1703
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1704
|
+
var wrapperBase2 = "flex flex-col gap-2 items-start min-w-[343px]";
|
|
1705
|
+
var Slider = (props) => {
|
|
1706
|
+
const {
|
|
1707
|
+
display = "flat",
|
|
1708
|
+
type = "single",
|
|
1709
|
+
tooltipPlacement = "top",
|
|
1710
|
+
tooltipFormatter,
|
|
1711
|
+
showPercentage = true,
|
|
1712
|
+
min = 0,
|
|
1713
|
+
max = 100,
|
|
1714
|
+
step = 1,
|
|
1715
|
+
disabled = false,
|
|
1716
|
+
value,
|
|
1717
|
+
defaultValue,
|
|
1718
|
+
onValueChange,
|
|
1719
|
+
className
|
|
1720
|
+
} = props;
|
|
1721
|
+
const isControlled = value !== void 0;
|
|
1722
|
+
const expectedLength = type === "multi" ? 2 : 1;
|
|
1723
|
+
const normalizeArray = React23.useCallback(
|
|
1724
|
+
(arr, fallback) => {
|
|
1725
|
+
if (!arr || arr.length === 0) return fallback;
|
|
1726
|
+
if (arr.length === expectedLength) return arr;
|
|
1727
|
+
if (arr.length > expectedLength) return arr.slice(0, expectedLength);
|
|
1728
|
+
if (arr.length === 1 && expectedLength === 2) {
|
|
1729
|
+
return [arr[0], max];
|
|
1730
|
+
}
|
|
1731
|
+
return fallback;
|
|
1732
|
+
},
|
|
1733
|
+
[expectedLength, max]
|
|
1734
|
+
);
|
|
1735
|
+
const defaultInternal = React23.useMemo(() => {
|
|
1736
|
+
if (defaultValue) return normalizeArray(defaultValue, []);
|
|
1737
|
+
if (type === "multi") return [min, Math.min(min + (max - min) / 4, max)];
|
|
1738
|
+
return [min + (max - min) / 3];
|
|
1739
|
+
}, [defaultValue, min, max, type, normalizeArray]);
|
|
1740
|
+
const [internalValue, setInternalValue] = React23.useState(
|
|
1741
|
+
() => normalizeArray(isControlled ? value : defaultInternal, defaultInternal)
|
|
1742
|
+
);
|
|
1743
|
+
React23.useEffect(() => {
|
|
1744
|
+
if (isControlled) {
|
|
1745
|
+
setInternalValue(
|
|
1746
|
+
(current2) => normalizeArray(value, current2.length ? current2 : defaultInternal)
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
}, [isControlled, value, normalizeArray, defaultInternal]);
|
|
1750
|
+
const current = internalValue;
|
|
1751
|
+
const trackRef = React23.useRef(null);
|
|
1752
|
+
const clamp = (val) => {
|
|
1753
|
+
if (val < min) return min;
|
|
1754
|
+
if (val > max) return max;
|
|
1755
|
+
return val;
|
|
1756
|
+
};
|
|
1757
|
+
React23.useEffect(() => {
|
|
1758
|
+
if (!isControlled) {
|
|
1759
|
+
setInternalValue((prev) => {
|
|
1760
|
+
const clamped = prev.map((v) => clamp(v));
|
|
1761
|
+
if (type === "multi" && clamped.length === 2 && step > 0) {
|
|
1762
|
+
return enforceMinGap(clamped, prev);
|
|
1763
|
+
}
|
|
1764
|
+
return clamped;
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
}, [isControlled, min, max]);
|
|
1768
|
+
const snap = (val) => {
|
|
1769
|
+
const range = max - min;
|
|
1770
|
+
if (range <= 0 || step <= 0) return clamp(val);
|
|
1771
|
+
const stepsFromMin = Math.round((val - min) / step);
|
|
1772
|
+
return clamp(min + stepsFromMin * step);
|
|
1773
|
+
};
|
|
1774
|
+
const enforceMinGap = (next, prev) => {
|
|
1775
|
+
if (type !== "multi" || next.length !== 2 || step <= 0) return next;
|
|
1776
|
+
let [low, high] = next;
|
|
1777
|
+
const [prevLow, prevHigh] = prev.length === 2 ? prev : next;
|
|
1778
|
+
if (low > high) {
|
|
1779
|
+
[low, high] = [high, low];
|
|
1780
|
+
}
|
|
1781
|
+
const minGap = step;
|
|
1782
|
+
if (high - low < minGap) {
|
|
1783
|
+
const lowChanged = low !== prevLow;
|
|
1784
|
+
const highChanged = high !== prevHigh;
|
|
1785
|
+
if (lowChanged && !highChanged) {
|
|
1786
|
+
low = clamp(high - minGap);
|
|
1787
|
+
} else if (highChanged && !lowChanged) {
|
|
1788
|
+
high = clamp(low + minGap);
|
|
1789
|
+
} else {
|
|
1790
|
+
high = clamp(low + minGap);
|
|
1791
|
+
}
|
|
1792
|
+
if (high - low < minGap) {
|
|
1793
|
+
low = clamp(high - minGap);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
return [low, high];
|
|
1797
|
+
};
|
|
1798
|
+
const updateValue = (next) => {
|
|
1799
|
+
let normalized = normalizeArray(next, current);
|
|
1800
|
+
if (type === "multi" && normalized.length === 2) {
|
|
1801
|
+
normalized = enforceMinGap(normalized, current);
|
|
1802
|
+
}
|
|
1803
|
+
if (!isControlled) {
|
|
1804
|
+
setInternalValue(normalized);
|
|
1805
|
+
}
|
|
1806
|
+
onValueChange?.(normalized);
|
|
1807
|
+
};
|
|
1808
|
+
const getSnappedValueFromClientX = (clientX, track) => {
|
|
1809
|
+
const rect = track.getBoundingClientRect();
|
|
1810
|
+
const offsetX = clientX - rect.left;
|
|
1811
|
+
const ratio = rect.width === 0 ? 0 : offsetX / rect.width;
|
|
1812
|
+
const rawValue = min + ratio * (max - min);
|
|
1813
|
+
return snap(rawValue);
|
|
1814
|
+
};
|
|
1815
|
+
const startDrag = (thumbIndex, clientX) => {
|
|
1816
|
+
if (disabled) return;
|
|
1817
|
+
const track = trackRef.current;
|
|
1818
|
+
if (!track) return;
|
|
1819
|
+
const handlePointerMove = (event) => {
|
|
1820
|
+
if (disabled) return;
|
|
1821
|
+
const snapped = getSnappedValueFromClientX(event.clientX, track);
|
|
1822
|
+
if (type === "multi" && current.length === 2) {
|
|
1823
|
+
const [a, b] = current;
|
|
1824
|
+
if (thumbIndex === 0) {
|
|
1825
|
+
updateValue([snapped, b]);
|
|
1826
|
+
} else {
|
|
1827
|
+
updateValue([a, snapped]);
|
|
1828
|
+
}
|
|
1829
|
+
} else {
|
|
1830
|
+
updateValue([snapped]);
|
|
1831
|
+
}
|
|
1832
|
+
};
|
|
1833
|
+
const handlePointerUp = () => {
|
|
1834
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
1835
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
1836
|
+
};
|
|
1837
|
+
const initialSnapped = getSnappedValueFromClientX(clientX, track);
|
|
1838
|
+
if (type === "multi" && current.length === 2) {
|
|
1839
|
+
const [a, b] = current;
|
|
1840
|
+
if (thumbIndex === 0) {
|
|
1841
|
+
updateValue([initialSnapped, b]);
|
|
1842
|
+
} else {
|
|
1843
|
+
updateValue([a, initialSnapped]);
|
|
1844
|
+
}
|
|
1845
|
+
} else {
|
|
1846
|
+
updateValue([initialSnapped]);
|
|
1847
|
+
}
|
|
1848
|
+
window.addEventListener("pointermove", handlePointerMove);
|
|
1849
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
1850
|
+
};
|
|
1851
|
+
const handleTrackPointerDown = (event) => {
|
|
1852
|
+
if (disabled) return;
|
|
1853
|
+
if (event.button !== 0) return;
|
|
1854
|
+
const track = trackRef.current;
|
|
1855
|
+
if (!track) return;
|
|
1856
|
+
const snapped = getSnappedValueFromClientX(event.clientX, track);
|
|
1857
|
+
let thumbIndex = 0;
|
|
1858
|
+
if (type === "multi" && current.length === 2) {
|
|
1859
|
+
const [a, b] = current;
|
|
1860
|
+
const distToA = Math.abs(snapped - a);
|
|
1861
|
+
const distToB = Math.abs(snapped - b);
|
|
1862
|
+
thumbIndex = distToA <= distToB ? 0 : 1;
|
|
1863
|
+
}
|
|
1864
|
+
event.preventDefault();
|
|
1865
|
+
startDrag(thumbIndex, event.clientX);
|
|
1866
|
+
};
|
|
1867
|
+
const handleThumbKeyDown = (index, event) => {
|
|
1868
|
+
if (disabled) return;
|
|
1869
|
+
const key = event.key;
|
|
1870
|
+
let delta = 0;
|
|
1871
|
+
if (key === "ArrowRight" || key === "ArrowUp") {
|
|
1872
|
+
delta = step;
|
|
1873
|
+
} else if (key === "ArrowLeft" || key === "ArrowDown") {
|
|
1874
|
+
delta = -step;
|
|
1875
|
+
} else if (key === "Home") {
|
|
1876
|
+
updateValue(
|
|
1877
|
+
current.map((v, i) => i === index ? min : v)
|
|
1878
|
+
);
|
|
1879
|
+
event.preventDefault();
|
|
1880
|
+
return;
|
|
1881
|
+
} else if (key === "End") {
|
|
1882
|
+
updateValue(
|
|
1883
|
+
current.map((v, i) => i === index ? max : v)
|
|
1884
|
+
);
|
|
1885
|
+
event.preventDefault();
|
|
1886
|
+
return;
|
|
1887
|
+
}
|
|
1888
|
+
if (delta !== 0) {
|
|
1889
|
+
const next = current.map(
|
|
1890
|
+
(v, i) => i === index ? snap(v + delta) : v
|
|
1891
|
+
);
|
|
1892
|
+
updateValue(next);
|
|
1893
|
+
event.preventDefault();
|
|
1894
|
+
}
|
|
1895
|
+
};
|
|
1896
|
+
const [primary, secondary] = type === "multi" && current.length === 2 ? [current[0], current[1]] : [current[0], void 0];
|
|
1897
|
+
const valueToPercent = (val) => {
|
|
1898
|
+
if (val === void 0) return 0;
|
|
1899
|
+
if (max === min) return 0;
|
|
1900
|
+
const clamped = clamp(val);
|
|
1901
|
+
return (clamped - min) / (max - min) * 100;
|
|
1902
|
+
};
|
|
1903
|
+
const primaryPercent = valueToPercent(primary);
|
|
1904
|
+
const secondaryPercent = valueToPercent(secondary);
|
|
1905
|
+
const showNumeric = display === "numeric";
|
|
1906
|
+
const showTooltip = display === "tooltip";
|
|
1907
|
+
const isTooltipAbove = tooltipPlacement === "top";
|
|
1908
|
+
const isDecimalDomain = !Number.isInteger(step) || !Number.isInteger(min) || !Number.isInteger(max);
|
|
1909
|
+
const formatNumber = (num) => {
|
|
1910
|
+
if (!isDecimalDomain) {
|
|
1911
|
+
return `${Math.round(num)}`;
|
|
1912
|
+
}
|
|
1913
|
+
const rounded = Number(num.toFixed(2));
|
|
1914
|
+
if (Number.isInteger(rounded)) {
|
|
1915
|
+
return `${rounded}`;
|
|
1916
|
+
}
|
|
1917
|
+
return rounded.toFixed(2);
|
|
1918
|
+
};
|
|
1919
|
+
const formatDisplayValue = (val) => {
|
|
1920
|
+
const value2 = val ?? min;
|
|
1921
|
+
if (tooltipFormatter) return tooltipFormatter(value2);
|
|
1922
|
+
if (showPercentage) {
|
|
1923
|
+
const percent = valueToPercent(value2);
|
|
1924
|
+
return `${formatNumber(percent)}%`;
|
|
1925
|
+
}
|
|
1926
|
+
return formatNumber(value2);
|
|
1927
|
+
};
|
|
1928
|
+
const formatNumericLabel = () => {
|
|
1929
|
+
if (type === "multi" && secondary !== void 0) {
|
|
1930
|
+
if (!tooltipFormatter && showPercentage && display === "numeric") {
|
|
1931
|
+
const first = formatNumber(valueToPercent(primary));
|
|
1932
|
+
const second = formatNumber(valueToPercent(secondary));
|
|
1933
|
+
return `${first} - ${second}`;
|
|
1934
|
+
}
|
|
1935
|
+
return `${formatDisplayValue(primary)} - ${formatDisplayValue(secondary)}`;
|
|
1936
|
+
}
|
|
1937
|
+
return formatDisplayValue(primary);
|
|
1938
|
+
};
|
|
1939
|
+
const trackHeight = 32;
|
|
1940
|
+
const thumbWidth = 18;
|
|
1941
|
+
const thumbRadius = thumbWidth / 2;
|
|
1942
|
+
const renderTooltipBubble = (key, percent, labelText) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1943
|
+
"div",
|
|
1944
|
+
{
|
|
1945
|
+
className: "absolute -translate-x-1/2 flex flex-col items-center",
|
|
1946
|
+
style: {
|
|
1947
|
+
left: `${percent}%`,
|
|
1948
|
+
bottom: isTooltipAbove ? "100%" : void 0,
|
|
1949
|
+
top: isTooltipAbove ? void 0 : "100%",
|
|
1950
|
+
marginBottom: isTooltipAbove ? 8 : void 0,
|
|
1951
|
+
marginTop: isTooltipAbove ? void 0 : 8
|
|
1952
|
+
},
|
|
1953
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
1954
|
+
"div",
|
|
1955
|
+
{
|
|
1956
|
+
className: cn(
|
|
1957
|
+
"relative rounded-(--border-radius-4) shadow-card-md px-(--space-8) py-(--space-4)",
|
|
1958
|
+
disabled ? "bg-(--background-primary-disabled)" : "bg-(--background-neutral)"
|
|
1959
|
+
),
|
|
1960
|
+
style: { marginBottom: 0 },
|
|
1961
|
+
children: [
|
|
1962
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1963
|
+
"p",
|
|
1964
|
+
{
|
|
1965
|
+
className: cn(
|
|
1966
|
+
"paragraph-s",
|
|
1967
|
+
disabled ? "text-(--text-primary-disabled)" : "text-(--text-primary)"
|
|
1968
|
+
),
|
|
1969
|
+
style: { marginBottom: 0 },
|
|
1970
|
+
children: labelText
|
|
1971
|
+
}
|
|
1972
|
+
),
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1974
|
+
"div",
|
|
1975
|
+
{
|
|
1976
|
+
className: cn(
|
|
1977
|
+
"absolute left-1/2 -translate-x-1/2 w-2 h-2 rotate-45",
|
|
1978
|
+
disabled ? "bg-(--background-primary-disabled)" : "bg-(--background-neutral)",
|
|
1979
|
+
isTooltipAbove ? "-bottom-1" : "-top-1"
|
|
1980
|
+
)
|
|
1981
|
+
}
|
|
1982
|
+
)
|
|
1983
|
+
]
|
|
1984
|
+
}
|
|
1985
|
+
)
|
|
1986
|
+
},
|
|
1987
|
+
key
|
|
1988
|
+
);
|
|
1989
|
+
const renderHandle = (index, percent, ariaValueText) => {
|
|
1990
|
+
const val = index === 0 ? primary : secondary;
|
|
1991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1992
|
+
"button",
|
|
1993
|
+
{
|
|
1994
|
+
type: "button",
|
|
1995
|
+
role: "slider",
|
|
1996
|
+
"aria-valuemin": min,
|
|
1997
|
+
"aria-valuemax": max,
|
|
1998
|
+
"aria-valuenow": val,
|
|
1999
|
+
"aria-valuetext": ariaValueText,
|
|
2000
|
+
"aria-disabled": disabled || void 0,
|
|
2001
|
+
tabIndex: disabled ? -1 : 0,
|
|
2002
|
+
className: cn(
|
|
2003
|
+
"absolute -translate-x-1/2 flex items-center justify-center",
|
|
2004
|
+
"h-8 w-[18px] rounded-(--border-radius-4)",
|
|
2005
|
+
disabled ? "bg-(--icon-primary-disabled) cursor-default" : "bg-(--icon-primary-hover) outline-none focus-visible:shadow-[0_0_0_var(--focus-ring-spread)_var(--focus-primary)] cursor-pointer"
|
|
2006
|
+
),
|
|
2007
|
+
style: {
|
|
2008
|
+
left: `${percent}%`,
|
|
2009
|
+
top: `calc(50% - ${trackHeight / 2}px)`
|
|
2010
|
+
},
|
|
2011
|
+
onPointerDown: (event) => {
|
|
2012
|
+
if (disabled) return;
|
|
2013
|
+
if (event.button !== 0) return;
|
|
2014
|
+
event.preventDefault();
|
|
2015
|
+
startDrag(index, event.clientX);
|
|
2016
|
+
},
|
|
2017
|
+
onKeyDown: (event) => handleThumbKeyDown(index, event)
|
|
2018
|
+
},
|
|
2019
|
+
index
|
|
2020
|
+
);
|
|
2021
|
+
};
|
|
2022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: wrapperBase2, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: cn("w-[354px] flex flex-col gap-1", className), children: [
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "relative w-full", children: [
|
|
2024
|
+
showTooltip && primary !== void 0 && renderTooltipBubble("primary", primaryPercent, formatDisplayValue(primary)),
|
|
2025
|
+
showTooltip && type === "multi" && secondary !== void 0 && renderTooltipBubble("secondary", secondaryPercent, formatDisplayValue(secondary)),
|
|
2026
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2027
|
+
"div",
|
|
2028
|
+
{
|
|
2029
|
+
className: cn(
|
|
2030
|
+
"relative w-full flex items-center rounded-(--border-radius-4)",
|
|
2031
|
+
disabled ? "bg-(--background-primary-disabled) cursor-default" : "bg-(--background-secondary) cursor-pointer"
|
|
2032
|
+
),
|
|
2033
|
+
style: { height: `${trackHeight}px` },
|
|
2034
|
+
ref: trackRef,
|
|
2035
|
+
onPointerDown: handleTrackPointerDown,
|
|
2036
|
+
children: [
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2038
|
+
"div",
|
|
2039
|
+
{
|
|
2040
|
+
className: cn(
|
|
2041
|
+
"absolute h-full",
|
|
2042
|
+
disabled ? "bg-(--background-primary-disabled)" : "bg-(--background-secondary)"
|
|
2043
|
+
),
|
|
2044
|
+
style: {
|
|
2045
|
+
width: `calc(100% + ${thumbWidth}px)`,
|
|
2046
|
+
left: `-${thumbRadius}px`,
|
|
2047
|
+
borderRadius: "var(--border-radius-4)"
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
),
|
|
2051
|
+
renderHandle(0, primaryPercent, formatDisplayValue(primary)),
|
|
2052
|
+
type === "multi" && secondary !== void 0 && renderHandle(1, secondaryPercent, formatDisplayValue(secondary))
|
|
2053
|
+
]
|
|
2054
|
+
}
|
|
2055
|
+
)
|
|
2056
|
+
] }),
|
|
2057
|
+
showNumeric && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2058
|
+
"p",
|
|
2059
|
+
{
|
|
2060
|
+
className: cn(
|
|
2061
|
+
"paragraph-s text-(--text-primary)",
|
|
2062
|
+
disabled && "text-(--text-primary-disabled)"
|
|
2063
|
+
),
|
|
2064
|
+
style: { marginBottom: 0 },
|
|
2065
|
+
children: formatNumericLabel()
|
|
2066
|
+
}
|
|
2067
|
+
)
|
|
2068
|
+
] }) });
|
|
2069
|
+
};
|
|
2070
|
+
Slider.displayName = "Slider";
|
|
2071
|
+
|
|
2072
|
+
// src/components/Inputs/TextArea.tsx
|
|
2073
|
+
var React24 = __toESM(require("react"), 1);
|
|
2074
|
+
var import_icons8 = require("@bubo-squared/icons");
|
|
2075
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2076
|
+
var wrapperBase3 = "flex flex-col gap-2 items-start min-w-[343px]";
|
|
2077
|
+
var TextArea = (props) => {
|
|
2078
|
+
const {
|
|
2079
|
+
label,
|
|
2080
|
+
hint,
|
|
2081
|
+
status = "default",
|
|
2082
|
+
type = "responsive",
|
|
2083
|
+
maxLength,
|
|
2084
|
+
disabled,
|
|
2085
|
+
className,
|
|
2086
|
+
value,
|
|
2087
|
+
defaultValue,
|
|
2088
|
+
onChange,
|
|
2089
|
+
rows = 3,
|
|
2090
|
+
...textareaProps
|
|
2091
|
+
} = props;
|
|
2092
|
+
const isControlled = value !== void 0;
|
|
2093
|
+
const [internalValue, setInternalValue] = React24.useState(
|
|
2094
|
+
defaultValue ?? ""
|
|
2095
|
+
);
|
|
2096
|
+
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
2097
|
+
const hasValue = currentValue.length > 0;
|
|
2098
|
+
const currentLength = currentValue.length;
|
|
2099
|
+
const effectiveMaxLength = type === "character-limit" ? maxLength ?? 144 : void 0;
|
|
2100
|
+
const showCharacterLimit = type === "character-limit" && typeof effectiveMaxLength === "number";
|
|
2101
|
+
const textareaRef = React24.useRef(null);
|
|
2102
|
+
const containerRef = React24.useRef(null);
|
|
2103
|
+
const [height, setHeight] = React24.useState(void 0);
|
|
2104
|
+
const [width, setWidth] = React24.useState(void 0);
|
|
2105
|
+
const minHeight = 80;
|
|
2106
|
+
const minWidth = 240;
|
|
2107
|
+
const handleContainerClick = () => {
|
|
2108
|
+
if (disabled) return;
|
|
2109
|
+
textareaRef.current?.focus();
|
|
2110
|
+
};
|
|
2111
|
+
const handleChange = (event) => {
|
|
2112
|
+
if (!isControlled) {
|
|
2113
|
+
setInternalValue(event.target.value);
|
|
2114
|
+
}
|
|
2115
|
+
onChange?.(event);
|
|
2116
|
+
};
|
|
2117
|
+
const inputId = React24.useId();
|
|
2118
|
+
const labelId = `${inputId}-label`;
|
|
2119
|
+
const hintId = `${inputId}-hint`;
|
|
2120
|
+
const statusBorderClass = {
|
|
2121
|
+
default: "",
|
|
2122
|
+
success: "border-(--border-success)",
|
|
2123
|
+
error: "border-(--border-error)"
|
|
2124
|
+
};
|
|
2125
|
+
const statusFocusClass = {
|
|
2126
|
+
default: "focus-within:border-(--border-brand) focus-within:hover:border-(--border-brand) focus-within:shadow-[0_0_0_var(--focus-ring-spread)_var(--focus-primary)]",
|
|
2127
|
+
success: "focus-within:border-(--border-success) focus-within:hover:border-(--border-success) focus-within:shadow-[0_0_0_var(--focus-ring-spread)_var(--focus-success)]",
|
|
2128
|
+
error: "focus-within:border-(--border-error) focus-within:hover:border-(--border-error) focus-within:shadow-[0_0_0_var(--focus-ring-spread)_var(--focus-error)]"
|
|
2129
|
+
};
|
|
2130
|
+
const hintColorClass = disabled ? "text-(--text-primary-disabled)" : status === "success" ? "text-(--text-success)" : status === "error" ? "text-(--text-error)" : "text-(--text-secondary)";
|
|
2131
|
+
const counterColorClass = disabled ? "text-(--text-primary-disabled)" : status === "success" ? "text-(--text-success)" : status === "error" ? "text-(--text-error)" : "text-(--text-primary)";
|
|
2132
|
+
const handleResizePointerDown = (event) => {
|
|
2133
|
+
if (disabled) return;
|
|
2134
|
+
if (event.button !== 0) return;
|
|
2135
|
+
const container = containerRef.current;
|
|
2136
|
+
if (!container) return;
|
|
2137
|
+
event.preventDefault();
|
|
2138
|
+
const startX = event.clientX;
|
|
2139
|
+
const startY = event.clientY;
|
|
2140
|
+
const { height: startHeight, width: startWidth } = container.getBoundingClientRect();
|
|
2141
|
+
const handlePointerMove = (e) => {
|
|
2142
|
+
const deltaX = e.clientX - startX;
|
|
2143
|
+
const deltaY = e.clientY - startY;
|
|
2144
|
+
const nextHeight = Math.max(minHeight, startHeight + deltaY);
|
|
2145
|
+
const nextWidth = Math.max(minWidth, startWidth + deltaX);
|
|
2146
|
+
setHeight(nextHeight);
|
|
2147
|
+
setWidth(nextWidth);
|
|
2148
|
+
};
|
|
2149
|
+
const handlePointerUp = () => {
|
|
2150
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
2151
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
2152
|
+
};
|
|
2153
|
+
window.addEventListener("pointermove", handlePointerMove);
|
|
2154
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
2155
|
+
};
|
|
2156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: wrapperBase3, children: [
|
|
2157
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2158
|
+
"label",
|
|
2159
|
+
{
|
|
2160
|
+
htmlFor: inputId,
|
|
2161
|
+
id: labelId,
|
|
2162
|
+
className: cn(
|
|
2163
|
+
"paragraph-s",
|
|
2164
|
+
disabled ? "text-(--text-primary-disabled)" : "text-(--text-primary)"
|
|
2165
|
+
),
|
|
2166
|
+
style: { marginBottom: 0 },
|
|
2167
|
+
children: label
|
|
2168
|
+
}
|
|
2169
|
+
),
|
|
2170
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "relative w-full", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2171
|
+
"div",
|
|
2172
|
+
{
|
|
2173
|
+
className: cn(
|
|
2174
|
+
"relative flex w-full rounded border bg-(--background-primary) cursor-text transition-colors",
|
|
2175
|
+
"border-(--border-secondary) hover:border-(--border-secondary-hover) hover:bg-(--background-primary-hover)",
|
|
2176
|
+
disabled && "bg-(--background-primary-disabled) border-(--border-secondary-disabled) cursor-default",
|
|
2177
|
+
statusBorderClass[status],
|
|
2178
|
+
!disabled && statusFocusClass[status],
|
|
2179
|
+
className
|
|
2180
|
+
),
|
|
2181
|
+
ref: containerRef,
|
|
2182
|
+
style: {
|
|
2183
|
+
...type === "responsive" && height !== void 0 ? { height } : {},
|
|
2184
|
+
...type === "responsive" && width !== void 0 ? { width } : {}
|
|
2185
|
+
},
|
|
2186
|
+
onClick: handleContainerClick,
|
|
2187
|
+
"aria-disabled": disabled || void 0,
|
|
2188
|
+
children: [
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2190
|
+
"textarea",
|
|
2191
|
+
{
|
|
2192
|
+
id: inputId,
|
|
2193
|
+
ref: textareaRef,
|
|
2194
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
2195
|
+
"aria-describedby": hint ? hintId : void 0,
|
|
2196
|
+
disabled: disabled ?? void 0,
|
|
2197
|
+
value: isControlled ? value : currentValue,
|
|
2198
|
+
defaultValue: isControlled ? void 0 : defaultValue,
|
|
2199
|
+
onChange: handleChange,
|
|
2200
|
+
rows,
|
|
2201
|
+
maxLength: effectiveMaxLength,
|
|
2202
|
+
className: cn(
|
|
2203
|
+
"paragraph-m bg-transparent outline-none w-full h-full resize-none px-2 py-2 pr-8",
|
|
2204
|
+
disabled ? "text-(--text-primary-disabled)" : hasValue ? "text-(--text-primary)" : "text-(--text-secondary)",
|
|
2205
|
+
showCharacterLimit && "pr-16"
|
|
2206
|
+
),
|
|
2207
|
+
style: { marginBottom: 0 },
|
|
2208
|
+
...textareaProps
|
|
2209
|
+
}
|
|
2210
|
+
),
|
|
2211
|
+
showCharacterLimit && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2212
|
+
"span",
|
|
2213
|
+
{
|
|
2214
|
+
className: cn(
|
|
2215
|
+
"absolute bottom-1 right-1 footnote mb-0!",
|
|
2216
|
+
counterColorClass
|
|
2217
|
+
),
|
|
2218
|
+
children: [
|
|
2219
|
+
currentLength,
|
|
2220
|
+
"/",
|
|
2221
|
+
effectiveMaxLength
|
|
2222
|
+
]
|
|
2223
|
+
}
|
|
2224
|
+
),
|
|
2225
|
+
type === "responsive" && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2226
|
+
"div",
|
|
2227
|
+
{
|
|
2228
|
+
className: "absolute bottom-1 right-1 h-3 w-3 " + (disabled ? "cursor-auto" : "cursor-nwse-resize"),
|
|
2229
|
+
onPointerDown: disabled ? void 0 : handleResizePointerDown,
|
|
2230
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2231
|
+
"span",
|
|
2232
|
+
{
|
|
2233
|
+
className: cn(
|
|
2234
|
+
"absolute bottom-0 right-0 flex h-4 w-4 items-center justify-center text-(--icon-primary)",
|
|
2235
|
+
disabled && "text-(--icon-primary-disabled)"
|
|
2236
|
+
),
|
|
2237
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons8.MaximizeIcon, {})
|
|
2238
|
+
}
|
|
2239
|
+
)
|
|
2240
|
+
}
|
|
2241
|
+
)
|
|
2242
|
+
]
|
|
2243
|
+
}
|
|
2244
|
+
) }),
|
|
2245
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2246
|
+
"p",
|
|
2247
|
+
{
|
|
2248
|
+
id: hint ? hintId : void 0,
|
|
2249
|
+
className: cn("caption", hint ? hintColorClass : "invisible"),
|
|
2250
|
+
style: { marginBottom: 0 },
|
|
2251
|
+
children: hint || "\xA0"
|
|
2252
|
+
}
|
|
2253
|
+
)
|
|
2254
|
+
] });
|
|
2255
|
+
};
|
|
2256
|
+
TextArea.displayName = "TextArea";
|
|
2257
|
+
|
|
2258
|
+
// src/components/Inputs/TextInput.tsx
|
|
2259
|
+
var React25 = __toESM(require("react"), 1);
|
|
2260
|
+
var import_class_variance_authority16 = require("class-variance-authority");
|
|
2261
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2262
|
+
var inputTextVariants = (0, import_class_variance_authority16.cva)("truncate", {
|
|
2263
|
+
variants: {
|
|
2264
|
+
size: {
|
|
2265
|
+
large: "subtitle",
|
|
2266
|
+
"extra-large": "h6-title"
|
|
2267
|
+
}
|
|
2268
|
+
},
|
|
2269
|
+
defaultVariants: {
|
|
2270
|
+
size: "large"
|
|
2271
|
+
}
|
|
2272
|
+
});
|
|
2273
|
+
var iconWrapperVariants3 = (0, import_class_variance_authority16.cva)(
|
|
2274
|
+
"flex items-center justify-center shrink-0 text-(--icon-primary)",
|
|
2275
|
+
{
|
|
2276
|
+
variants: {
|
|
2277
|
+
size: {
|
|
2278
|
+
large: "w-5 h-5 [&>svg]:w-5 [&>svg]:h-5",
|
|
2279
|
+
"extra-large": "w-6 h-6 [&>svg]:w-6 [&>svg]:h-6"
|
|
2280
|
+
},
|
|
2281
|
+
disabled: {
|
|
2282
|
+
true: "text-(--icon-primary-disabled)"
|
|
2283
|
+
}
|
|
2284
|
+
},
|
|
2285
|
+
defaultVariants: {
|
|
2286
|
+
size: "large"
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
);
|
|
2290
|
+
var TextInput = (props) => {
|
|
2291
|
+
const {
|
|
2292
|
+
label,
|
|
2293
|
+
hint,
|
|
2294
|
+
placeholder = "Placeholder text",
|
|
2295
|
+
size = "large",
|
|
2296
|
+
status = "default",
|
|
2297
|
+
disabled = false,
|
|
2298
|
+
className,
|
|
2299
|
+
leadingIcon,
|
|
2300
|
+
trailingIcon,
|
|
2301
|
+
value,
|
|
2302
|
+
defaultValue,
|
|
2303
|
+
onChange,
|
|
2304
|
+
...inputProps
|
|
2305
|
+
} = props;
|
|
2306
|
+
const isControlled = value !== void 0;
|
|
2307
|
+
const [internalValue, setInternalValue] = React25.useState(
|
|
2308
|
+
defaultValue ?? ""
|
|
2309
|
+
);
|
|
2310
|
+
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
2311
|
+
const inputRef = React25.useRef(null);
|
|
2312
|
+
const handleContainerClick = () => {
|
|
2313
|
+
if (disabled) return;
|
|
2314
|
+
inputRef.current?.focus();
|
|
2315
|
+
};
|
|
2316
|
+
const handleChange = (event) => {
|
|
2317
|
+
if (!isControlled) {
|
|
2318
|
+
setInternalValue(event.target.value);
|
|
2319
|
+
}
|
|
2320
|
+
onChange?.(event);
|
|
2321
|
+
};
|
|
2322
|
+
const showLeadingIcon = !!leadingIcon;
|
|
2323
|
+
const showTrailingIcon = !!trailingIcon;
|
|
2324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2325
|
+
Field,
|
|
2326
|
+
{
|
|
2327
|
+
label,
|
|
2328
|
+
hint,
|
|
2329
|
+
status,
|
|
2330
|
+
disabled,
|
|
2331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2332
|
+
InputShell,
|
|
2333
|
+
{
|
|
2334
|
+
size,
|
|
2335
|
+
status,
|
|
2336
|
+
disabled,
|
|
2337
|
+
className,
|
|
2338
|
+
onClick: handleContainerClick,
|
|
2339
|
+
children: [
|
|
2340
|
+
showLeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2341
|
+
"span",
|
|
2342
|
+
{
|
|
2343
|
+
className: cn(
|
|
2344
|
+
iconWrapperVariants3({ size, disabled })
|
|
2345
|
+
),
|
|
2346
|
+
children: leadingIcon
|
|
2347
|
+
}
|
|
2348
|
+
),
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2350
|
+
Input,
|
|
2351
|
+
{
|
|
2352
|
+
ref: inputRef,
|
|
2353
|
+
type: "text",
|
|
2354
|
+
disabled: disabled ?? void 0,
|
|
2355
|
+
placeholder,
|
|
2356
|
+
value: isControlled ? value : currentValue,
|
|
2357
|
+
defaultValue: isControlled ? void 0 : defaultValue,
|
|
2358
|
+
onChange: handleChange,
|
|
2359
|
+
variant: "bare",
|
|
2360
|
+
className: cn(
|
|
2361
|
+
inputTextVariants({ size }),
|
|
2362
|
+
"bg-transparent outline-none w-full"
|
|
2363
|
+
),
|
|
2364
|
+
style: { marginBottom: 0 },
|
|
2365
|
+
...inputProps
|
|
2366
|
+
}
|
|
2367
|
+
),
|
|
2368
|
+
showTrailingIcon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2369
|
+
"span",
|
|
2370
|
+
{
|
|
2371
|
+
className: cn(
|
|
2372
|
+
iconWrapperVariants3({ size, disabled: !!disabled })
|
|
2373
|
+
),
|
|
2374
|
+
children: trailingIcon
|
|
2375
|
+
}
|
|
2376
|
+
)
|
|
2377
|
+
]
|
|
2378
|
+
}
|
|
2379
|
+
)
|
|
2380
|
+
}
|
|
2381
|
+
);
|
|
2382
|
+
};
|
|
2383
|
+
TextInput.displayName = "TextInput";
|
|
2384
|
+
|
|
2385
|
+
// src/components/Inputs/Toggle.tsx
|
|
2386
|
+
var React26 = require("react");
|
|
2387
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2388
|
+
var Toggle = (props) => {
|
|
2389
|
+
const { label, className, disabled, ...inputProps } = props;
|
|
2390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2391
|
+
"label",
|
|
2392
|
+
{
|
|
2393
|
+
className: cn(
|
|
2394
|
+
"inline-flex items-center gap-2 select-none",
|
|
2395
|
+
disabled ? "cursor-default" : "cursor-pointer"
|
|
2396
|
+
),
|
|
2397
|
+
children: [
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "relative inline-flex items-center", children: [
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2400
|
+
"input",
|
|
2401
|
+
{
|
|
2402
|
+
type: "checkbox",
|
|
2403
|
+
disabled,
|
|
2404
|
+
className: "peer sr-only",
|
|
2405
|
+
...inputProps
|
|
2406
|
+
}
|
|
2407
|
+
),
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2409
|
+
"span",
|
|
2410
|
+
{
|
|
2411
|
+
className: cn(
|
|
2412
|
+
// Base track
|
|
2413
|
+
"flex items-center w-9 h-5 rounded-3xl border bg-(--background-primary) p-(--space-2) transition-all",
|
|
2414
|
+
// Knob position
|
|
2415
|
+
"justify-start peer-checked:justify-end",
|
|
2416
|
+
// 1: enabled, unchecked, unhovered, unfocused
|
|
2417
|
+
"border-(--border-secondary)",
|
|
2418
|
+
// 3: enabled, unchecked, hovered, unfocused
|
|
2419
|
+
"hover:border-(--border-secondary-hover)",
|
|
2420
|
+
// 2: enabled, checked, unhovered, unfocused
|
|
2421
|
+
"peer-checked:border-(--border-brand)",
|
|
2422
|
+
// 4: enabled, checked, hovered, unfocused
|
|
2423
|
+
"peer-checked:hover:border-(--border-brand-hover)",
|
|
2424
|
+
"peer-checked:hover:shadow-[0_0_0_var(--focus-ring-spread)_var(--color-b-100)]",
|
|
2425
|
+
// 5: enabled, unchecked, unhovered, focused
|
|
2426
|
+
"peer-focus-visible:border-(--border-brand-focus)",
|
|
2427
|
+
// 6: enabled, checked, unhovered, focused
|
|
2428
|
+
"peer-checked:peer-focus-visible:bg-(--background-brand-focus)",
|
|
2429
|
+
"peer-checked:peer-focus-visible:shadow-[0_0_0_var(--focus-ring-spread)_var(--focus-primary)]",
|
|
2430
|
+
// 7: disabled, unchecked (override)
|
|
2431
|
+
"peer-disabled:bg-(--background-primary-disabled)",
|
|
2432
|
+
"peer-disabled:border-none",
|
|
2433
|
+
"peer-disabled:shadow-none",
|
|
2434
|
+
// 8: disabled, checked (override)
|
|
2435
|
+
"peer-disabled:peer-checked:border-(--border-primary-disabled)",
|
|
2436
|
+
// Disable hover when disabled
|
|
2437
|
+
"peer-disabled:pointer-events-none",
|
|
2438
|
+
// Knob on (enabled)
|
|
2439
|
+
"peer-checked:[&>.knob]:bg-(--background-brand)",
|
|
2440
|
+
// Hover / focus when on
|
|
2441
|
+
"peer-checked:[&>.knob]:hover:bg-(--background-brand-hover)",
|
|
2442
|
+
"peer-checked:peer-focus-visible:[&>.knob]:bg-(--background-neutral)",
|
|
2443
|
+
// Disabled knob (both off and on use disabled brand token)
|
|
2444
|
+
"peer-disabled:[&>.knob]:bg-(--background-primary-hover)",
|
|
2445
|
+
"peer-disabled:[&>.knob]:peer-checked:bg-(--background-primary-hover)",
|
|
2446
|
+
className
|
|
2447
|
+
),
|
|
2448
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2449
|
+
"span",
|
|
2450
|
+
{
|
|
2451
|
+
className: cn(
|
|
2452
|
+
"h-4 w-4 rounded-full transition-colors knob",
|
|
2453
|
+
"bg-b-100"
|
|
2454
|
+
)
|
|
2455
|
+
}
|
|
2456
|
+
)
|
|
2457
|
+
}
|
|
2458
|
+
)
|
|
2459
|
+
] }),
|
|
2460
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2461
|
+
"span",
|
|
2462
|
+
{
|
|
2463
|
+
className: cn(
|
|
2464
|
+
"paragraph-s text-(--text-primary)",
|
|
2465
|
+
disabled && "text-(--text-primary-disabled)"
|
|
2466
|
+
),
|
|
2467
|
+
style: { marginBottom: 0 },
|
|
2468
|
+
children: label
|
|
2469
|
+
}
|
|
2470
|
+
)
|
|
2471
|
+
]
|
|
2472
|
+
}
|
|
2473
|
+
);
|
|
2474
|
+
};
|
|
2475
|
+
Toggle.displayName = "Toggle";
|
|
2476
|
+
|
|
2477
|
+
// src/components/Inputs/WebsiteInput.tsx
|
|
2478
|
+
var React27 = require("react");
|
|
2479
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2480
|
+
var WebsiteInput = (props) => {
|
|
2481
|
+
const {
|
|
2482
|
+
hierarchy = "prefix",
|
|
2483
|
+
protocolLabel = "http://",
|
|
2484
|
+
icon,
|
|
2485
|
+
size = "large",
|
|
2486
|
+
disabled,
|
|
2487
|
+
className,
|
|
2488
|
+
...rest
|
|
2489
|
+
} = props;
|
|
2490
|
+
const isPrefix = hierarchy === "prefix";
|
|
2491
|
+
const baseClass = cn(
|
|
2492
|
+
"[&>span]:w-[unset] hover:bg-[unset]",
|
|
2493
|
+
!disabled && "[&:not(:focus-within):hover]:shadow-[0_0_0_var(--focus-ring-spread)_var(--background-secondary-hover)]",
|
|
2494
|
+
disabled && "bg-[unset] hover:shadow-none hover:border-(--border-secondary-disabled) border-(--border-secondary-disabled)",
|
|
2495
|
+
size === "extra-large" ? "[&>span]:h-14!" : "[&>span]:h-11!"
|
|
2496
|
+
);
|
|
2497
|
+
const addonTextClass = cn(
|
|
2498
|
+
"flex mb-0!",
|
|
2499
|
+
size === "extra-large" ? "paragraph-m" : "paragraph-s",
|
|
2500
|
+
disabled ? "text-(--text-primary-disabled)" : "text-(--text-primary) group-hover:text-(--text-primary-hover) group-focus-within:text-(--text-primary-focus)"
|
|
2501
|
+
);
|
|
2502
|
+
const baseAddonClass = cn(
|
|
2503
|
+
"flex items-center gap-2 px-2 h-full",
|
|
2504
|
+
// layout + padding
|
|
2505
|
+
"border-(--border-secondary)",
|
|
2506
|
+
// divider color
|
|
2507
|
+
disabled && "border-(--border-secondary-disabled) hover:border-(--border-secondary-disabled)",
|
|
2508
|
+
isPrefix ? "border-r" : "border-l"
|
|
2509
|
+
);
|
|
2510
|
+
const iconWrapperClass = cn(
|
|
2511
|
+
"flex items-center justify-center shrink-0",
|
|
2512
|
+
size === "extra-large" ? "[&>svg]:w-6 [&>svg]:h-6" : "[&>svg]:w-5 [&>svg]:h-5",
|
|
2513
|
+
disabled ? "text-(--icon-primary-disabled)" : "text-(--icon-primary) group-hover:text-(--icon-primary-hover) group-focus-within:text-(--icon-primary-focus)"
|
|
2514
|
+
);
|
|
2515
|
+
const prefixAddon = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: baseAddonClass, children: [
|
|
2516
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: addonTextClass, children: protocolLabel }),
|
|
2517
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: iconWrapperClass, children: icon })
|
|
2518
|
+
] });
|
|
2519
|
+
const suffixAddon = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: baseAddonClass, children: [
|
|
2520
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: iconWrapperClass, children: icon }),
|
|
2521
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: addonTextClass, children: protocolLabel })
|
|
2522
|
+
] });
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2524
|
+
TextInput,
|
|
2525
|
+
{
|
|
2526
|
+
...rest,
|
|
2527
|
+
size,
|
|
2528
|
+
disabled,
|
|
2529
|
+
className: cn(baseClass, className),
|
|
2530
|
+
leadingIcon: isPrefix ? prefixAddon : void 0,
|
|
2531
|
+
trailingIcon: !isPrefix ? suffixAddon : void 0
|
|
2532
|
+
}
|
|
2533
|
+
);
|
|
2534
|
+
};
|
|
2535
|
+
WebsiteInput.displayName = "WebsiteInput";
|
|
2536
|
+
|
|
2537
|
+
// src/components/Logo/LogoIconExtraLarge.tsx
|
|
2538
|
+
var import_icons9 = require("@bubo-squared/icons");
|
|
2539
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2540
|
+
var LogoIconExtraLarge = () => {
|
|
2541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "w-lg h-[512px] relative bg-linear-to-t from-gray-800 to-gray-950 rounded-[80px] overflow-hidden flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_icons9.LogoIconLIcon, { className: "w-96 h-96" }) });
|
|
2542
|
+
};
|
|
2543
|
+
var LogoIconExtraLarge_default = LogoIconExtraLarge;
|
|
2544
|
+
|
|
2545
|
+
// src/components/Logo/LogoIconExtraSmall.tsx
|
|
2546
|
+
var import_icons10 = require("@bubo-squared/icons");
|
|
2547
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2548
|
+
var LogoIconExtraSmall = () => {
|
|
2549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-8 h-8 relative bg-linear-to-t from-gray-800 to-gray-950 rounded-[5px] overflow-hidden flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons10.LogoIconMIcon, { className: "w-6 h-6" }) });
|
|
2550
|
+
};
|
|
2551
|
+
var LogoIconExtraSmall_default = LogoIconExtraSmall;
|
|
2552
|
+
|
|
2553
|
+
// src/components/Logo/LogoIconLarge.tsx
|
|
2554
|
+
var import_icons11 = require("@bubo-squared/icons");
|
|
2555
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2556
|
+
var LogoIconLarge = () => {
|
|
2557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-64 h-64 relative bg-linear-to-t from-gray-800 to-gray-950 rounded-[40px] overflow-hidden flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_icons11.LogoIconMIcon, { className: "w-44 h-44" }) });
|
|
2558
|
+
};
|
|
2559
|
+
var LogoIconLarge_default = LogoIconLarge;
|
|
2560
|
+
|
|
2561
|
+
// src/components/Logo/LogoIconMedium.tsx
|
|
2562
|
+
var import_icons12 = require("@bubo-squared/icons");
|
|
2563
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2564
|
+
var LogoIconMedium = () => {
|
|
2565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "w-32 h-32 relative bg-linear-to-t from-gray-800 to-gray-950 rounded-[20px] overflow-hidden flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_icons12.LogoIconMIcon, { className: "w-24 h-24" }) });
|
|
2566
|
+
};
|
|
2567
|
+
var LogoIconMedium_default = LogoIconMedium;
|
|
2568
|
+
|
|
2569
|
+
// src/components/Logo/LogoIconSmall.tsx
|
|
2570
|
+
var import_icons13 = require("@bubo-squared/icons");
|
|
2571
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2572
|
+
var LogoIconSmall = () => {
|
|
2573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "w-14 h-14 relative bg-linear-to-t from-gray-800 to-gray-950 rounded-lg overflow-hidden flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_icons13.LogoIconMIcon, { className: "w-10 h-10" }) });
|
|
2574
|
+
};
|
|
2575
|
+
var LogoIconSmall_default = LogoIconSmall;
|
|
2576
|
+
|
|
2577
|
+
// src/components/Logo/LogoInline.tsx
|
|
2578
|
+
var import_icons14 = require("@bubo-squared/icons");
|
|
2579
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2580
|
+
var LogoInline = () => {
|
|
2581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "w-44 h-12 inline-flex justify-start items-center gap-4", children: [
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons14.LogoIconMIcon, { className: "w-12 h-12" }),
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_icons14.LogoTextMIcon, { className: "h-8 w-[110px] text-(--text-primary)" })
|
|
2584
|
+
] });
|
|
2585
|
+
};
|
|
2586
|
+
var LogoInline_default = LogoInline;
|
|
2587
|
+
|
|
2588
|
+
// src/components/Logo/LogoInlineSmall.tsx
|
|
2589
|
+
var import_icons15 = require("@bubo-squared/icons");
|
|
2590
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2591
|
+
var LogoInline2 = () => {
|
|
2592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "w-32 h-9 inline-flex justify-start items-center gap-3", children: [
|
|
2593
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons15.LogoIconMIcon, { className: "w-9 h-9" }),
|
|
2594
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_icons15.LogoTextMIcon, { className: "h-6 w-[83px] text-(--text-primary)" })
|
|
2595
|
+
] });
|
|
2596
|
+
};
|
|
2597
|
+
var LogoInlineSmall_default = LogoInline2;
|
|
2598
|
+
|
|
2599
|
+
// src/components/Logo/LogoMultiline.tsx
|
|
2600
|
+
var import_icons16 = require("@bubo-squared/icons");
|
|
2601
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2602
|
+
var LogoMultiline = () => {
|
|
2603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "w-36 inline-flex flex-col justify-start items-start gap-2", children: [
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons16.LogoIconMIcon, { className: "w-12 h-12" }),
|
|
2605
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_icons16.LogoTextMIcon, { className: "h-8 w-[111px] text-(--text-primary)" })
|
|
2606
|
+
] });
|
|
2607
|
+
};
|
|
2608
|
+
var LogoMultiline_default = LogoMultiline;
|
|
2609
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2610
|
+
0 && (module.exports = {
|
|
2611
|
+
Avatar,
|
|
2612
|
+
Badge,
|
|
2613
|
+
BadgeDigit,
|
|
2614
|
+
BadgeDot,
|
|
2615
|
+
BadgeStatus,
|
|
2616
|
+
Button,
|
|
2617
|
+
ButtonGroup,
|
|
2618
|
+
Checkbox,
|
|
2619
|
+
Divider,
|
|
2620
|
+
Dropdown,
|
|
2621
|
+
IconButton,
|
|
2622
|
+
IconButtonGroup,
|
|
2623
|
+
LinkButton,
|
|
2624
|
+
LogoIconExtraLarge,
|
|
2625
|
+
LogoIconExtraSmall,
|
|
2626
|
+
LogoIconLarge,
|
|
2627
|
+
LogoIconMedium,
|
|
2628
|
+
LogoIconSmall,
|
|
2629
|
+
LogoInline,
|
|
2630
|
+
LogoInlineSmall,
|
|
2631
|
+
LogoMultiline,
|
|
2632
|
+
MessageButton,
|
|
2633
|
+
PasswordInput,
|
|
2634
|
+
Progress,
|
|
2635
|
+
RadioGroup,
|
|
2636
|
+
SearchInput,
|
|
2637
|
+
Slider,
|
|
2638
|
+
StatusAvatar,
|
|
2639
|
+
Tag,
|
|
2640
|
+
TextArea,
|
|
2641
|
+
TextInput,
|
|
2642
|
+
Toggle,
|
|
2643
|
+
WebsiteInput,
|
|
2644
|
+
cn
|
|
2645
|
+
});
|
|
2646
|
+
//# sourceMappingURL=index.cjs.map
|