@rovula/ui 0.0.77 → 0.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle.css +43 -3
- package/dist/cjs/bundle.js +3 -3
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +5 -1
- package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.d.ts +75 -0
- package/dist/cjs/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +491 -0
- package/dist/cjs/types/components/MaskedTextInput/index.d.ts +3 -0
- package/dist/cjs/types/components/Menu/Menu.d.ts +65 -0
- package/dist/cjs/types/components/Menu/Menu.stories.d.ts +31 -0
- package/dist/cjs/types/components/Menu/helpers.d.ts +19 -0
- package/dist/cjs/types/components/Menu/index.d.ts +4 -0
- package/dist/cjs/types/components/Search/Search.d.ts +46 -3
- package/dist/cjs/types/components/Search/Search.stories.d.ts +46 -27
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.js +41 -19
- package/dist/components/Dropdown/Dropdown.stories.js +13 -0
- package/dist/components/MaskedTextInput/MaskedTextInput.js +267 -0
- package/dist/components/MaskedTextInput/MaskedTextInput.stories.js +167 -0
- package/dist/components/MaskedTextInput/index.js +2 -0
- package/dist/components/Menu/Menu.js +64 -0
- package/dist/components/Menu/Menu.stories.js +406 -0
- package/dist/components/Menu/helpers.js +28 -0
- package/dist/components/Menu/index.js +3 -0
- package/dist/components/Toast/Toast.styles.js +1 -1
- package/dist/esm/bundle.css +43 -3
- package/dist/esm/bundle.js +3 -3
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +5 -1
- package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.d.ts +75 -0
- package/dist/esm/types/components/MaskedTextInput/MaskedTextInput.stories.d.ts +491 -0
- package/dist/esm/types/components/MaskedTextInput/index.d.ts +3 -0
- package/dist/esm/types/components/Menu/Menu.d.ts +65 -0
- package/dist/esm/types/components/Menu/Menu.stories.d.ts +31 -0
- package/dist/esm/types/components/Menu/helpers.d.ts +19 -0
- package/dist/esm/types/components/Menu/index.d.ts +4 -0
- package/dist/esm/types/components/Search/Search.d.ts +46 -3
- package/dist/esm/types/components/Search/Search.stories.d.ts +46 -27
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/index.d.ts +169 -3
- package/dist/index.js +2 -0
- package/dist/src/theme/global.css +55 -4
- package/package.json +1 -1
- package/src/components/Dropdown/Dropdown.stories.tsx +31 -0
- package/src/components/Dropdown/Dropdown.tsx +73 -54
- package/src/components/MaskedTextInput/MaskedTextInput.stories.tsx +414 -0
- package/src/components/MaskedTextInput/MaskedTextInput.tsx +391 -0
- package/src/components/MaskedTextInput/README.md +202 -0
- package/src/components/MaskedTextInput/index.ts +3 -0
- package/src/components/Menu/Menu.stories.tsx +586 -0
- package/src/components/Menu/Menu.tsx +235 -0
- package/src/components/Menu/helpers.ts +45 -0
- package/src/components/Menu/index.ts +7 -0
- package/src/components/Search/Search.tsx +24 -11
- package/src/components/Toast/Toast.styles.tsx +1 -1
- package/src/index.ts +6 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Menu } from "./Menu";
|
|
4
|
+
import { optionsToMenuItems } from "./helpers";
|
|
5
|
+
import Button from "../Button/Button";
|
|
6
|
+
import Icon from "../Icon/Icon";
|
|
7
|
+
import TextInput from "../TextInput/TextInput";
|
|
8
|
+
import { ChevronDownIcon } from "@heroicons/react/16/solid";
|
|
9
|
+
const meta = {
|
|
10
|
+
title: "Components/Menu",
|
|
11
|
+
component: Menu,
|
|
12
|
+
tags: ["autodocs"],
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: "centered",
|
|
15
|
+
},
|
|
16
|
+
decorators: [
|
|
17
|
+
(Story) => (_jsx("div", { className: "p-20 flex justify-center", children: _jsx(Story, {}) })),
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
// ==================== Basic Menu ====================
|
|
22
|
+
export const Basic = {
|
|
23
|
+
render: () => {
|
|
24
|
+
const items = [
|
|
25
|
+
{ type: "item", item: { value: "1", label: "Option 1" } },
|
|
26
|
+
{ type: "item", item: { value: "2", label: "Option 2" } },
|
|
27
|
+
{ type: "item", item: { value: "3", label: "Option 3" } },
|
|
28
|
+
{ type: "separator" },
|
|
29
|
+
{ type: "item", item: { value: "4", label: "Option 4", disabled: true } },
|
|
30
|
+
{ type: "item", item: { value: "5", label: "Delete", danger: true } },
|
|
31
|
+
];
|
|
32
|
+
return (_jsx(Menu, { items: items, onSelect: (value) => console.log("Selected:", value) }));
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
// ==================== With Icons ====================
|
|
36
|
+
export const WithIcons = {
|
|
37
|
+
render: () => {
|
|
38
|
+
const items = [
|
|
39
|
+
{
|
|
40
|
+
type: "item",
|
|
41
|
+
item: {
|
|
42
|
+
value: "profile",
|
|
43
|
+
label: "Profile",
|
|
44
|
+
icon: _jsx(Icon, { type: "heroicons", name: "user", className: "size-4" }),
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "item",
|
|
49
|
+
item: {
|
|
50
|
+
value: "settings",
|
|
51
|
+
label: "Settings",
|
|
52
|
+
icon: _jsx(Icon, { type: "heroicons", name: "cog-6-tooth", className: "size-4" }),
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: "item",
|
|
57
|
+
item: {
|
|
58
|
+
value: "help",
|
|
59
|
+
label: "Help",
|
|
60
|
+
icon: (_jsx(Icon, { type: "heroicons", name: "question-mark-circle", className: "size-4" })),
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{ type: "separator" },
|
|
64
|
+
{
|
|
65
|
+
type: "item",
|
|
66
|
+
item: {
|
|
67
|
+
value: "logout",
|
|
68
|
+
label: "Logout",
|
|
69
|
+
icon: (_jsx(Icon, { type: "heroicons", name: "arrow-right-on-rectangle", className: "size-4" })),
|
|
70
|
+
danger: true,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
return (_jsx(Menu, { items: items, onSelect: (value) => console.log("Selected:", value) }));
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
// ==================== With Checkbox ====================
|
|
78
|
+
export const WithCheckbox = {
|
|
79
|
+
render: () => {
|
|
80
|
+
const [checked, setChecked] = useState({
|
|
81
|
+
notifications: true,
|
|
82
|
+
emails: false,
|
|
83
|
+
updates: true,
|
|
84
|
+
});
|
|
85
|
+
const items = [
|
|
86
|
+
{ type: "label", label: "Preferences" },
|
|
87
|
+
{
|
|
88
|
+
type: "item",
|
|
89
|
+
item: {
|
|
90
|
+
value: "notifications",
|
|
91
|
+
label: "Notifications",
|
|
92
|
+
type: "checkbox",
|
|
93
|
+
checked: checked.notifications,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: "item",
|
|
98
|
+
item: {
|
|
99
|
+
value: "emails",
|
|
100
|
+
label: "Email Alerts",
|
|
101
|
+
type: "checkbox",
|
|
102
|
+
checked: checked.emails,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "item",
|
|
107
|
+
item: {
|
|
108
|
+
value: "updates",
|
|
109
|
+
label: "Product Updates",
|
|
110
|
+
type: "checkbox",
|
|
111
|
+
checked: checked.updates,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
];
|
|
115
|
+
return (_jsx(Menu, { items: items, onSelect: (value) => {
|
|
116
|
+
setChecked((prev) => (Object.assign(Object.assign({}, prev), { [value]: !prev[value] })));
|
|
117
|
+
} }));
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
// ==================== With Radio ====================
|
|
121
|
+
export const WithRadio = {
|
|
122
|
+
render: () => {
|
|
123
|
+
const [selected, setSelected] = useState("light");
|
|
124
|
+
const items = [
|
|
125
|
+
{ type: "label", label: "Theme" },
|
|
126
|
+
{
|
|
127
|
+
type: "item",
|
|
128
|
+
item: {
|
|
129
|
+
value: "light",
|
|
130
|
+
label: "Light",
|
|
131
|
+
type: "radio",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
type: "item",
|
|
136
|
+
item: {
|
|
137
|
+
value: "dark",
|
|
138
|
+
label: "Dark",
|
|
139
|
+
type: "radio",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "item",
|
|
144
|
+
item: {
|
|
145
|
+
value: "system",
|
|
146
|
+
label: "System",
|
|
147
|
+
type: "radio",
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
return (_jsx(Menu, { items: items, selectedValues: [selected], onSelect: (value) => setSelected(value) }));
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
// ==================== Complex Menu ====================
|
|
155
|
+
export const ComplexMenu = {
|
|
156
|
+
render: () => {
|
|
157
|
+
const [preferences, setPreferences] = useState({
|
|
158
|
+
notifications: true,
|
|
159
|
+
emails: false,
|
|
160
|
+
});
|
|
161
|
+
const [theme, setTheme] = useState("light");
|
|
162
|
+
const items = [
|
|
163
|
+
{ type: "label", label: "My Account" },
|
|
164
|
+
{
|
|
165
|
+
type: "item",
|
|
166
|
+
item: {
|
|
167
|
+
value: "profile",
|
|
168
|
+
label: "Profile",
|
|
169
|
+
icon: _jsx(Icon, { type: "heroicons", name: "user", className: "size-4" }),
|
|
170
|
+
onClick: () => console.log("Go to profile"),
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
type: "item",
|
|
175
|
+
item: {
|
|
176
|
+
value: "billing",
|
|
177
|
+
label: "Billing",
|
|
178
|
+
icon: _jsx(Icon, { type: "heroicons", name: "credit-card", className: "size-4" }),
|
|
179
|
+
onClick: () => console.log("Go to billing"),
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{ type: "separator" },
|
|
183
|
+
{ type: "label", label: "Preferences" },
|
|
184
|
+
{
|
|
185
|
+
type: "item",
|
|
186
|
+
item: {
|
|
187
|
+
value: "notifications",
|
|
188
|
+
label: "Push Notifications",
|
|
189
|
+
type: "checkbox",
|
|
190
|
+
checked: preferences.notifications,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: "item",
|
|
195
|
+
item: {
|
|
196
|
+
value: "emails",
|
|
197
|
+
label: "Email Notifications",
|
|
198
|
+
type: "checkbox",
|
|
199
|
+
checked: preferences.emails,
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{ type: "separator" },
|
|
203
|
+
{ type: "label", label: "Theme" },
|
|
204
|
+
{
|
|
205
|
+
type: "item",
|
|
206
|
+
item: {
|
|
207
|
+
value: "light",
|
|
208
|
+
label: "Light Mode",
|
|
209
|
+
type: "radio",
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
type: "item",
|
|
214
|
+
item: {
|
|
215
|
+
value: "dark",
|
|
216
|
+
label: "Dark Mode",
|
|
217
|
+
type: "radio",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
{ type: "separator" },
|
|
221
|
+
{
|
|
222
|
+
type: "item",
|
|
223
|
+
item: {
|
|
224
|
+
value: "logout",
|
|
225
|
+
label: "Logout",
|
|
226
|
+
icon: (_jsx(Icon, { type: "heroicons", name: "arrow-right-on-rectangle", className: "size-4" })),
|
|
227
|
+
danger: true,
|
|
228
|
+
onClick: () => console.log("Logout"),
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
];
|
|
232
|
+
return (_jsx(Menu, { items: items, selectedValues: [theme], onSelect: (value, item) => {
|
|
233
|
+
// Handle different types
|
|
234
|
+
if (item.type === "checkbox") {
|
|
235
|
+
// Toggle checkbox
|
|
236
|
+
const key = value;
|
|
237
|
+
if (key in preferences) {
|
|
238
|
+
setPreferences(Object.assign(Object.assign({}, preferences), { [key]: !preferences[key] }));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
else if (item.type === "radio") {
|
|
242
|
+
// Radio select
|
|
243
|
+
setTheme(value);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// Regular item
|
|
247
|
+
console.log("Item clicked:", value);
|
|
248
|
+
}
|
|
249
|
+
} }));
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
// ==================== With Dropdown Trigger ====================
|
|
253
|
+
export const WithDropdownTrigger = {
|
|
254
|
+
render: () => {
|
|
255
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
256
|
+
const items = [
|
|
257
|
+
{
|
|
258
|
+
type: "item",
|
|
259
|
+
item: {
|
|
260
|
+
value: "edit",
|
|
261
|
+
label: "Edit",
|
|
262
|
+
icon: _jsx(Icon, { type: "heroicons", name: "pencil", className: "size-4" }),
|
|
263
|
+
onClick: () => {
|
|
264
|
+
console.log("Edit");
|
|
265
|
+
setIsOpen(false);
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
type: "item",
|
|
271
|
+
item: {
|
|
272
|
+
value: "duplicate",
|
|
273
|
+
label: "Duplicate",
|
|
274
|
+
icon: (_jsx(Icon, { type: "heroicons", name: "document-duplicate", className: "size-4" })),
|
|
275
|
+
onClick: () => {
|
|
276
|
+
console.log("Duplicate");
|
|
277
|
+
setIsOpen(false);
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
{ type: "separator" },
|
|
282
|
+
{
|
|
283
|
+
type: "item",
|
|
284
|
+
item: {
|
|
285
|
+
value: "archive",
|
|
286
|
+
label: "Archive",
|
|
287
|
+
icon: _jsx(Icon, { type: "heroicons", name: "archive-box", className: "size-4" }),
|
|
288
|
+
onClick: () => {
|
|
289
|
+
console.log("Archive");
|
|
290
|
+
setIsOpen(false);
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
type: "item",
|
|
296
|
+
item: {
|
|
297
|
+
value: "delete",
|
|
298
|
+
label: "Delete",
|
|
299
|
+
icon: _jsx(Icon, { type: "heroicons", name: "trash", className: "size-4" }),
|
|
300
|
+
danger: true,
|
|
301
|
+
onClick: () => {
|
|
302
|
+
console.log("Delete");
|
|
303
|
+
setIsOpen(false);
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
return (_jsxs("div", { className: "relative", children: [_jsx(Button, { onClick: () => setIsOpen(!isOpen), children: "Actions" }), isOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setIsOpen(false) }), _jsx("div", { className: "absolute top-full mt-2 z-50", children: _jsx(Menu, { items: items }) })] }))] }));
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
// ==================== Custom Items ====================
|
|
312
|
+
export const CustomItems = {
|
|
313
|
+
render: () => {
|
|
314
|
+
const items = [
|
|
315
|
+
{ type: "label", label: "Recent Projects" },
|
|
316
|
+
{
|
|
317
|
+
type: "custom",
|
|
318
|
+
render: () => (_jsxs("div", { className: "px-4 py-3 hover:bg-[var(--dropdown-menu-hover-bg)] cursor-pointer", children: [_jsx("div", { className: "font-semibold", children: "Project Alpha" }), _jsx("div", { className: "text-xs text-gray-500", children: "Updated 2 hours ago" })] })),
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
type: "custom",
|
|
322
|
+
render: () => (_jsxs("div", { className: "px-4 py-3 hover:bg-[var(--dropdown-menu-hover-bg)] cursor-pointer", children: [_jsx("div", { className: "font-semibold", children: "Project Beta" }), _jsx("div", { className: "text-xs text-gray-500", children: "Updated yesterday" })] })),
|
|
323
|
+
},
|
|
324
|
+
{ type: "separator" },
|
|
325
|
+
{
|
|
326
|
+
type: "item",
|
|
327
|
+
item: {
|
|
328
|
+
value: "view-all",
|
|
329
|
+
label: "View All Projects",
|
|
330
|
+
icon: _jsx(Icon, { type: "heroicons", name: "folder-open", className: "size-4" }),
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
];
|
|
334
|
+
return (_jsx(Menu, { items: items, onSelect: (value) => console.log("Selected:", value) }));
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
// ==================== Dropdown Pattern (Select with Search) ====================
|
|
338
|
+
export const DropdownPattern = {
|
|
339
|
+
render: () => {
|
|
340
|
+
var _a;
|
|
341
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
342
|
+
const [selectedValue, setSelectedValue] = useState("");
|
|
343
|
+
const [searchText, setSearchText] = useState("");
|
|
344
|
+
// Simulate options like Dropdown component
|
|
345
|
+
const allOptions = [
|
|
346
|
+
{ value: "apple", label: "Apple" },
|
|
347
|
+
{ value: "banana", label: "Banana" },
|
|
348
|
+
{ value: "cherry", label: "Cherry" },
|
|
349
|
+
{ value: "date", label: "Date" },
|
|
350
|
+
{ value: "elderberry", label: "Elderberry" },
|
|
351
|
+
{ value: "fig", label: "Fig" },
|
|
352
|
+
{ value: "grape", label: "Grape" },
|
|
353
|
+
];
|
|
354
|
+
// Filter options based on search
|
|
355
|
+
const filteredOptions = allOptions.filter((opt) => opt.label.toLowerCase().includes(searchText.toLowerCase()));
|
|
356
|
+
// Convert to MenuItemType
|
|
357
|
+
const menuItems = optionsToMenuItems(filteredOptions);
|
|
358
|
+
// Add "not found" message if no results
|
|
359
|
+
if (filteredOptions.length === 0) {
|
|
360
|
+
menuItems.push({
|
|
361
|
+
type: "custom",
|
|
362
|
+
render: () => (_jsx("div", { className: "px-4 py-14 text-center text-input-text", children: "Not found" })),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
const selectedLabel = ((_a = allOptions.find((opt) => opt.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) || "";
|
|
366
|
+
return (_jsxs("div", { className: "relative w-80", children: [_jsx(TextInput, { value: searchText || selectedLabel, onChange: (e) => setSearchText(e.target.value), onFocus: () => setIsOpen(true), onBlur: () => setTimeout(() => setIsOpen(false), 200), placeholder: "Select a fruit...", endIcon: _jsx(ChevronDownIcon, { className: "size-5 text-gray-400" }) }), isOpen && (_jsx("div", { className: "absolute top-full mt-1 w-full z-50", children: _jsx(Menu, { items: menuItems, selectedValues: [selectedValue], onSelect: (value) => {
|
|
367
|
+
setSelectedValue(value);
|
|
368
|
+
setSearchText("");
|
|
369
|
+
setIsOpen(false);
|
|
370
|
+
}, className: "max-h-60 overflow-y-auto" }) }))] }));
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
// ==================== Multi-Select Pattern ====================
|
|
374
|
+
export const MultiSelectPattern = {
|
|
375
|
+
render: () => {
|
|
376
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
377
|
+
const [selectedValues, setSelectedValues] = useState([]);
|
|
378
|
+
const options = [
|
|
379
|
+
{ value: "react", label: "React" },
|
|
380
|
+
{ value: "vue", label: "Vue" },
|
|
381
|
+
{ value: "angular", label: "Angular" },
|
|
382
|
+
{ value: "svelte", label: "Svelte" },
|
|
383
|
+
{ value: "solid", label: "Solid" },
|
|
384
|
+
];
|
|
385
|
+
const items = options.map((opt) => ({
|
|
386
|
+
type: "item",
|
|
387
|
+
item: {
|
|
388
|
+
value: opt.value,
|
|
389
|
+
label: opt.label,
|
|
390
|
+
type: "checkbox",
|
|
391
|
+
checked: selectedValues.includes(opt.value),
|
|
392
|
+
},
|
|
393
|
+
}));
|
|
394
|
+
const displayText = selectedValues.length > 0
|
|
395
|
+
? `${selectedValues.length} selected`
|
|
396
|
+
: "Select frameworks...";
|
|
397
|
+
return (_jsxs("div", { className: "relative w-80", children: [_jsxs(Button, { onClick: () => setIsOpen(!isOpen), className: "w-full justify-between", children: [displayText, _jsx(ChevronDownIcon, { className: "size-5 ml-2" })] }), isOpen && (_jsxs(_Fragment, { children: [_jsx("div", { className: "fixed inset-0 z-40", onClick: () => setIsOpen(false) }), _jsx("div", { className: "absolute top-full mt-2 w-full z-50", children: _jsx(Menu, { items: items, onSelect: (value) => {
|
|
398
|
+
if (selectedValues.includes(value)) {
|
|
399
|
+
setSelectedValues(selectedValues.filter((v) => v !== value));
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
setSelectedValues([...selectedValues, value]);
|
|
403
|
+
}
|
|
404
|
+
} }) })] }))] }));
|
|
405
|
+
},
|
|
406
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper function to convert simple options to MenuItemType
|
|
3
|
+
* Useful for integrating with Dropdown component
|
|
4
|
+
*/
|
|
5
|
+
export function optionsToMenuItems(options) {
|
|
6
|
+
return options.map((option) => ({
|
|
7
|
+
type: "item",
|
|
8
|
+
item: {
|
|
9
|
+
value: option.value,
|
|
10
|
+
label: option.label,
|
|
11
|
+
disabled: option.disabled,
|
|
12
|
+
},
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Helper to add separator between menu items
|
|
17
|
+
*/
|
|
18
|
+
export function withSeparator(items, atIndex) {
|
|
19
|
+
const result = [...items];
|
|
20
|
+
result.splice(atIndex, 0, { type: "separator" });
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Helper to add label/header to menu items
|
|
25
|
+
*/
|
|
26
|
+
export function withLabel(label, items) {
|
|
27
|
+
return [{ type: "label", label }, ...items];
|
|
28
|
+
}
|
|
@@ -18,7 +18,7 @@ export const toastVariants = cva([
|
|
|
18
18
|
variant: "success",
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
|
-
export const toastViewportVariants = cva(["fixed z-[
|
|
21
|
+
export const toastViewportVariants = cva(["fixed z-[1000] flex w-auto flex-col-reverse px-4"], {
|
|
22
22
|
variants: {
|
|
23
23
|
position: {
|
|
24
24
|
"top-center": "top-[40px] left-0 right-0 justify-self-center",
|
package/dist/esm/bundle.css
CHANGED
|
@@ -662,15 +662,18 @@ input[type=number] {
|
|
|
662
662
|
.z-10{
|
|
663
663
|
z-index: 10;
|
|
664
664
|
}
|
|
665
|
+
.z-40{
|
|
666
|
+
z-index: 40;
|
|
667
|
+
}
|
|
665
668
|
.z-50{
|
|
666
669
|
z-index: 50;
|
|
667
670
|
}
|
|
671
|
+
.z-\[1000\]{
|
|
672
|
+
z-index: 1000;
|
|
673
|
+
}
|
|
668
674
|
.z-\[100\]{
|
|
669
675
|
z-index: 100;
|
|
670
676
|
}
|
|
671
|
-
.z-\[9999\]{
|
|
672
|
-
z-index: 9999;
|
|
673
|
-
}
|
|
674
677
|
.col-span-3{
|
|
675
678
|
grid-column: span 3 / span 3;
|
|
676
679
|
}
|
|
@@ -940,6 +943,9 @@ input[type=number] {
|
|
|
940
943
|
.w-8{
|
|
941
944
|
width: 2rem;
|
|
942
945
|
}
|
|
946
|
+
.w-80{
|
|
947
|
+
width: 20rem;
|
|
948
|
+
}
|
|
943
949
|
.w-\[100px\]{
|
|
944
950
|
width: 100px;
|
|
945
951
|
}
|
|
@@ -993,6 +999,9 @@ input[type=number] {
|
|
|
993
999
|
min-width: -moz-fit-content;
|
|
994
1000
|
min-width: fit-content;
|
|
995
1001
|
}
|
|
1002
|
+
.max-w-2xl{
|
|
1003
|
+
max-width: 42rem;
|
|
1004
|
+
}
|
|
996
1005
|
.max-w-\[300px\]{
|
|
997
1006
|
max-width: 300px;
|
|
998
1007
|
}
|
|
@@ -1002,6 +1011,9 @@ input[type=number] {
|
|
|
1002
1011
|
.max-w-lg{
|
|
1003
1012
|
max-width: 32rem;
|
|
1004
1013
|
}
|
|
1014
|
+
.max-w-md{
|
|
1015
|
+
max-width: 28rem;
|
|
1016
|
+
}
|
|
1005
1017
|
.flex-1{
|
|
1006
1018
|
flex: 1 1 0%;
|
|
1007
1019
|
}
|
|
@@ -1869,6 +1881,10 @@ input[type=number] {
|
|
|
1869
1881
|
--tw-bg-opacity: 1;
|
|
1870
1882
|
background-color: color-mix(in srgb, var(--function-default-stroke) calc(100% * var(--tw-bg-opacity, 1)), transparent);
|
|
1871
1883
|
}
|
|
1884
|
+
.bg-gray-100{
|
|
1885
|
+
--tw-bg-opacity: 1;
|
|
1886
|
+
background-color: rgb(243 244 246 / var(--tw-bg-opacity, 1));
|
|
1887
|
+
}
|
|
1872
1888
|
.bg-gray-200{
|
|
1873
1889
|
--tw-bg-opacity: 1;
|
|
1874
1890
|
background-color: rgb(229 231 235 / var(--tw-bg-opacity, 1));
|
|
@@ -3165,6 +3181,10 @@ input[type=number] {
|
|
|
3165
3181
|
line-height: var(--label-label2-line-height, 10px);
|
|
3166
3182
|
font-weight: var(--label-label2-weight, 400);
|
|
3167
3183
|
}
|
|
3184
|
+
.text-lg{
|
|
3185
|
+
font-size: 1.125rem;
|
|
3186
|
+
line-height: 1.75rem;
|
|
3187
|
+
}
|
|
3168
3188
|
.text-sm{
|
|
3169
3189
|
font-size: 0.875rem;
|
|
3170
3190
|
line-height: 1.25rem;
|
|
@@ -3258,6 +3278,9 @@ input[type=number] {
|
|
|
3258
3278
|
.font-medium{
|
|
3259
3279
|
font-weight: 500;
|
|
3260
3280
|
}
|
|
3281
|
+
.font-semibold{
|
|
3282
|
+
font-weight: 600;
|
|
3283
|
+
}
|
|
3261
3284
|
.uppercase{
|
|
3262
3285
|
text-transform: uppercase;
|
|
3263
3286
|
}
|
|
@@ -3458,6 +3481,10 @@ input[type=number] {
|
|
|
3458
3481
|
--tw-text-opacity: 1;
|
|
3459
3482
|
color: rgb(107 114 128 / var(--tw-text-opacity, 1));
|
|
3460
3483
|
}
|
|
3484
|
+
.text-gray-700{
|
|
3485
|
+
--tw-text-opacity: 1;
|
|
3486
|
+
color: rgb(55 65 81 / var(--tw-text-opacity, 1));
|
|
3487
|
+
}
|
|
3461
3488
|
.text-green-500{
|
|
3462
3489
|
--tw-text-opacity: 1;
|
|
3463
3490
|
color: rgb(34 197 94 / var(--tw-text-opacity, 1));
|
|
@@ -3566,6 +3593,9 @@ input[type=number] {
|
|
|
3566
3593
|
.caret-primary{
|
|
3567
3594
|
caret-color: color-mix(in srgb, var(--state-color-primary-default) calc(100% * 1), transparent);
|
|
3568
3595
|
}
|
|
3596
|
+
.opacity-50{
|
|
3597
|
+
opacity: 0.5;
|
|
3598
|
+
}
|
|
3569
3599
|
.opacity-60{
|
|
3570
3600
|
opacity: 0.6;
|
|
3571
3601
|
}
|
|
@@ -3980,6 +4010,9 @@ input[type=number] {
|
|
|
3980
4010
|
--tw-border-opacity: 1;
|
|
3981
4011
|
border-color: color-mix(in srgb, var(--input-color-active-stroke) calc(100% * var(--tw-border-opacity, 1)), transparent);
|
|
3982
4012
|
}
|
|
4013
|
+
.hover\:bg-\[var\(--dropdown-menu-hover-bg\)\]:hover{
|
|
4014
|
+
background-color: var(--dropdown-menu-hover-bg);
|
|
4015
|
+
}
|
|
3983
4016
|
.hover\:bg-action-button-icon-active-hover:hover{
|
|
3984
4017
|
--tw-bg-opacity: 1;
|
|
3985
4018
|
background-color: color-mix(in srgb, var(--action-button-icon-active-hover-bg) calc(100% * var(--tw-bg-opacity, 1)), transparent);
|
|
@@ -4191,6 +4224,9 @@ input[type=number] {
|
|
|
4191
4224
|
.hover\:fill-input-default-text:hover{
|
|
4192
4225
|
fill: color-mix(in srgb, var(--input-color-default-text) calc(100% * 1), transparent);
|
|
4193
4226
|
}
|
|
4227
|
+
.hover\:text-\[var\(--dropdown-menu-hover-text\)\]:hover{
|
|
4228
|
+
color: var(--dropdown-menu-hover-text);
|
|
4229
|
+
}
|
|
4194
4230
|
.hover\:text-action-button-icon-active-hover:hover{
|
|
4195
4231
|
--tw-text-opacity: 1;
|
|
4196
4232
|
color: color-mix(in srgb, var(--action-button-icon-active-hover-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|
|
@@ -5826,6 +5862,10 @@ input[type=number] {
|
|
|
5826
5862
|
.md\:right-\[40px\]{
|
|
5827
5863
|
right: 40px;
|
|
5828
5864
|
}
|
|
5865
|
+
|
|
5866
|
+
.md\:grid-cols-2{
|
|
5867
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
5868
|
+
}
|
|
5829
5869
|
}
|
|
5830
5870
|
.\[\&\:has\(\[role\=checkbox\]\)\]\:w-4:has([role=checkbox]){
|
|
5831
5871
|
width: 1rem;
|