@comet/admin 9.0.0-beta.4 → 9.0.0-beta.5

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.
Files changed (64) hide show
  1. package/lib/common/DeleteDialog.d.ts +1 -0
  2. package/lib/common/DeleteDialog.d.ts.map +1 -1
  3. package/lib/common/DeleteDialog.js +8 -1
  4. package/lib/common/buttons/clearinput/ClearInputButton.js +1 -1
  5. package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +76 -0
  6. package/lib/common/toolbar/__stories__/Toolbar.stories.js +82 -0
  7. package/lib/dataGrid/__stories__/ClickableRows.stories.js +109 -0
  8. package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +50 -0
  9. package/lib/dataGrid/__stories__/DataGrid.stories.js +94 -0
  10. package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +492 -0
  11. package/lib/form/__stories__/AsyncAutocompleteField.stories.js +660 -0
  12. package/lib/form/__stories__/AsyncSelectField.stories.js +513 -0
  13. package/lib/form/__stories__/Autocomplete.stories.js +188 -0
  14. package/lib/form/__stories__/AutocompleteField.stories.js +48 -0
  15. package/lib/form/__stories__/Checkbox.stories.js +70 -0
  16. package/lib/form/__stories__/CheckboxField.stories.js +87 -0
  17. package/lib/form/__stories__/CheckboxListField.stories.js +172 -0
  18. package/lib/form/__stories__/CustomButtons.stories.js +78 -0
  19. package/lib/form/__stories__/DependentAsyncSelects.stories.js +91 -0
  20. package/lib/form/__stories__/DisableAutoNavigation.stories.js +132 -0
  21. package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +54 -0
  22. package/lib/form/__stories__/FieldContainer.stories.js +87 -0
  23. package/lib/form/__stories__/FinalFormFileSelect.stories.js +155 -0
  24. package/lib/form/__stories__/FormInStack.stories.js +133 -0
  25. package/lib/form/__stories__/FormLayouts.stories.js +174 -0
  26. package/lib/form/__stories__/FormValidation.stories.js +82 -0
  27. package/lib/form/__stories__/Input.stories.js +37 -0
  28. package/lib/form/__stories__/NumberField.stories.js +38 -0
  29. package/lib/form/__stories__/Radio.stories.js +101 -0
  30. package/lib/form/__stories__/RadioGroupField.stories.js +172 -0
  31. package/lib/form/__stories__/RangeInput.stories.js +239 -0
  32. package/lib/form/__stories__/RouterTabs.stories.js +96 -0
  33. package/lib/form/__stories__/RouterTabsInForm.stories.js +73 -0
  34. package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +96 -0
  35. package/lib/form/__stories__/ScrollToErrorField.stories.js +82 -0
  36. package/lib/form/__stories__/SearchField.stories.js +38 -0
  37. package/lib/form/__stories__/Select.stories.js +187 -0
  38. package/lib/form/__stories__/SelectField.stories.js +100 -0
  39. package/lib/form/__stories__/ShowErrorStrategies.stories.js +107 -0
  40. package/lib/form/__stories__/SingleTextField.stories.js +108 -0
  41. package/lib/form/__stories__/StackInForm.stories.js +53 -0
  42. package/lib/form/__stories__/SubmitErrors.stories.js +90 -0
  43. package/lib/form/__stories__/Switch.stories.js +49 -0
  44. package/lib/form/__stories__/SwitchField.stories.js +87 -0
  45. package/lib/form/__stories__/Tabs.stories.js +78 -0
  46. package/lib/form/__stories__/TextAreaField.stories.js +38 -0
  47. package/lib/form/__stories__/TextField.stories.js +67 -0
  48. package/lib/form/__stories__/ToggleButtonGroupField.stories.js +312 -0
  49. package/lib/form/__stories__/TwoLevelValidation.stories.js +168 -0
  50. package/lib/form/__stories__/Typography.stories.js +71 -0
  51. package/lib/form/file/__stories__/FileDropzone.stories.js +81 -0
  52. package/lib/form/file/__stories__/FileSelect.stories.js +139 -0
  53. package/lib/form/file/__stories__/FileSelectListItem.stories.js +108 -0
  54. package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +187 -0
  55. package/lib/helpers/useTopOffset.js +1 -1
  56. package/lib/tabs/__stories__/DynamicTabs.stories.js +84 -0
  57. package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +84 -0
  58. package/lib/tabs/__stories__/OverflowIssues.stories.js +224 -0
  59. package/lib/tabs/__stories__/RouterTabs.stories.js +31 -0
  60. package/lib/tabs/__stories__/RouterTabsInStack.stories.js +74 -0
  61. package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +68 -0
  62. package/lib/tabs/__stories__/Tabs.stories.js +219 -0
  63. package/lib/theme/componentsTheme/MuiDataGrid.js +1 -1
  64. package/package.json +13 -13
@@ -0,0 +1,492 @@
1
+ import { Check, Close, Education } from "@comet/admin-icons";
2
+ import { Box } from "@mui/material";
3
+ import { DataGrid } from "@mui/x-data-grid";
4
+ import { DataGridToolbar } from "../../common/toolbar/DataGridToolbar";
5
+ import { GridCellContent } from "../GridCellContent";
6
+ import { GridFilterButton } from "../GridFilterButton";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ export default {
9
+ title: "components/dataGrid/DataGridSingleSelectFilter"
10
+ };
11
+
12
+ // Sample data
13
+ var rows = [{
14
+ id: 1,
15
+ name: "Product A",
16
+ category: "electronics",
17
+ status: "active",
18
+ priority: "high",
19
+ department: "sales"
20
+ }, {
21
+ id: 2,
22
+ name: "Product B",
23
+ category: "clothing",
24
+ status: "inactive",
25
+ priority: "medium",
26
+ department: "marketing"
27
+ }, {
28
+ id: 3,
29
+ name: "Product C",
30
+ category: "electronics",
31
+ status: "active",
32
+ priority: "low",
33
+ department: "sales"
34
+ }, {
35
+ id: 4,
36
+ name: "Product D",
37
+ category: "furniture",
38
+ status: "pending",
39
+ priority: "high",
40
+ department: "operations"
41
+ }, {
42
+ id: 5,
43
+ name: "Product E",
44
+ category: "clothing",
45
+ status: "active",
46
+ priority: "medium",
47
+ department: "sales"
48
+ }, {
49
+ id: 6,
50
+ name: "Product F",
51
+ category: "electronics",
52
+ status: "inactive",
53
+ priority: "low",
54
+ department: "marketing"
55
+ }, {
56
+ id: 7,
57
+ name: "Product G",
58
+ category: "furniture",
59
+ status: "active",
60
+ priority: "high",
61
+ department: "operations"
62
+ }, {
63
+ id: 8,
64
+ name: "Product H",
65
+ category: "clothing",
66
+ status: "pending",
67
+ priority: "medium",
68
+ department: "sales"
69
+ }];
70
+
71
+ // Story 1: Basic single select with simple string options
72
+ export var BasicSingleSelect = {
73
+ render: function render() {
74
+ var columns = [{
75
+ field: "name",
76
+ headerName: "Product Name",
77
+ flex: 1
78
+ }, {
79
+ field: "category",
80
+ headerName: "Category",
81
+ width: 150,
82
+ type: "singleSelect",
83
+ valueOptions: ["electronics", "clothing", "furniture"]
84
+ }, {
85
+ field: "status",
86
+ headerName: "Status",
87
+ width: 130,
88
+ type: "singleSelect",
89
+ valueOptions: ["active", "inactive", "pending"]
90
+ }];
91
+ return /*#__PURE__*/_jsxs(Box, {
92
+ children: [/*#__PURE__*/_jsx(Box, {
93
+ component: "h4",
94
+ sx: {
95
+ mb: 2
96
+ },
97
+ children: "Basic SingleSelect Filter"
98
+ }), /*#__PURE__*/_jsx(Box, {
99
+ height: 500,
100
+ children: /*#__PURE__*/_jsx(DataGrid, {
101
+ rows: rows,
102
+ columns: columns,
103
+ slots: {
104
+ toolbar: function toolbar() {
105
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
106
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
107
+ });
108
+ }
109
+ },
110
+ initialState: {
111
+ filter: {
112
+ filterModel: {
113
+ items: []
114
+ }
115
+ }
116
+ },
117
+ showToolbar: true
118
+ })
119
+ })]
120
+ });
121
+ }
122
+ };
123
+
124
+ // Story 2: Single select with custom labels
125
+ export var WithCustomLabels = {
126
+ render: function render() {
127
+ var columns = [{
128
+ field: "name",
129
+ headerName: "Product Name",
130
+ flex: 1
131
+ }, {
132
+ field: "priority",
133
+ headerName: "Priority",
134
+ width: 150,
135
+ type: "singleSelect",
136
+ valueOptions: [{
137
+ value: "high",
138
+ label: "🔴 High Priority"
139
+ }, {
140
+ value: "medium",
141
+ label: "🟡 Medium Priority"
142
+ }, {
143
+ value: "low",
144
+ label: "🟢 Low Priority"
145
+ }]
146
+ }, {
147
+ field: "department",
148
+ headerName: "Department",
149
+ width: 150,
150
+ type: "singleSelect",
151
+ valueOptions: [{
152
+ value: "sales",
153
+ label: "💼 Sales Department"
154
+ }, {
155
+ value: "marketing",
156
+ label: "📢 Marketing Department"
157
+ }, {
158
+ value: "operations",
159
+ label: "⚙️ Operations Department"
160
+ }]
161
+ }];
162
+ return /*#__PURE__*/_jsxs(Box, {
163
+ children: [/*#__PURE__*/_jsx(Box, {
164
+ component: "h4",
165
+ sx: {
166
+ mb: 2
167
+ },
168
+ children: "SingleSelect with Custom Labels"
169
+ }), /*#__PURE__*/_jsx(Box, {
170
+ height: 500,
171
+ children: /*#__PURE__*/_jsx(DataGrid, {
172
+ rows: rows,
173
+ columns: columns,
174
+ slots: {
175
+ toolbar: function toolbar() {
176
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
177
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
178
+ });
179
+ }
180
+ },
181
+ showToolbar: true
182
+ })
183
+ })]
184
+ });
185
+ }
186
+ };
187
+
188
+ // Story 3: Single select with long labels (showcases vertical expansion)
189
+ export var WithLongLabels = {
190
+ render: function render() {
191
+ var columns = [{
192
+ field: "name",
193
+ headerName: "Product Name",
194
+ flex: 1
195
+ }, {
196
+ field: "category",
197
+ headerName: "Category",
198
+ width: 200,
199
+ type: "singleSelect",
200
+ valueOptions: [{
201
+ value: "electronics",
202
+ label: "Electronics and Computer Equipment with Accessories"
203
+ }, {
204
+ value: "clothing",
205
+ label: "Clothing, Apparel, and Fashion Items for All Seasons"
206
+ }, {
207
+ value: "furniture",
208
+ label: "Furniture, Home Decor, and Interior Design Products"
209
+ }]
210
+ }];
211
+ return /*#__PURE__*/_jsxs(Box, {
212
+ children: [/*#__PURE__*/_jsx(Box, {
213
+ component: "h4",
214
+ sx: {
215
+ mb: 2
216
+ },
217
+ children: "SingleSelect with Long Labels"
218
+ }), /*#__PURE__*/_jsx(Box, {
219
+ height: 500,
220
+ children: /*#__PURE__*/_jsx(DataGrid, {
221
+ rows: rows,
222
+ columns: columns,
223
+ slots: {
224
+ toolbar: function toolbar() {
225
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
226
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
227
+ });
228
+ }
229
+ },
230
+ showToolbar: true
231
+ })
232
+ })]
233
+ });
234
+ }
235
+ };
236
+
237
+ // Story 4: Single select with many options
238
+ export var WithManyOptions = {
239
+ render: function render() {
240
+ var columns = [{
241
+ field: "name",
242
+ headerName: "Product Name",
243
+ flex: 1
244
+ }, {
245
+ field: "category",
246
+ headerName: "Category (Many Options)",
247
+ width: 200,
248
+ type: "singleSelect",
249
+ valueOptions: ["electronics", "clothing", "furniture", "books", "toys", "sports", "automotive", "food", "health", "beauty", "tools", "garden", "pet supplies", "office supplies", "musical instruments"]
250
+ }];
251
+ return /*#__PURE__*/_jsxs(Box, {
252
+ children: [/*#__PURE__*/_jsx(Box, {
253
+ component: "h4",
254
+ sx: {
255
+ mb: 2
256
+ },
257
+ children: "SingleSelect with Many Options"
258
+ }), /*#__PURE__*/_jsx(Box, {
259
+ height: 500,
260
+ children: /*#__PURE__*/_jsx(DataGrid, {
261
+ rows: rows,
262
+ columns: columns,
263
+ slots: {
264
+ toolbar: function toolbar() {
265
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
266
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
267
+ });
268
+ }
269
+ },
270
+ showToolbar: true
271
+ })
272
+ })]
273
+ });
274
+ }
275
+ };
276
+
277
+ // Story 5: Single select with custom cell content
278
+ export var WithCustomCellContent = {
279
+ render: function render() {
280
+ var columns = [{
281
+ field: "name",
282
+ headerName: "Product Name",
283
+ flex: 1
284
+ }, {
285
+ field: "status",
286
+ headerName: "Status with Icon",
287
+ width: 200,
288
+ type: "singleSelect",
289
+ valueOptions: [{
290
+ value: "active",
291
+ label: "Active Status",
292
+ cellContent: /*#__PURE__*/_jsx(GridCellContent, {
293
+ primaryText: "Active",
294
+ icon: /*#__PURE__*/_jsx(Check, {
295
+ color: "success"
296
+ })
297
+ })
298
+ }, {
299
+ value: "inactive",
300
+ label: "Inactive Status",
301
+ cellContent: /*#__PURE__*/_jsx(GridCellContent, {
302
+ primaryText: "Inactive",
303
+ icon: /*#__PURE__*/_jsx(Close, {
304
+ color: "error"
305
+ })
306
+ })
307
+ }, {
308
+ value: "pending",
309
+ label: "Pending Review",
310
+ cellContent: /*#__PURE__*/_jsx(GridCellContent, {
311
+ primaryText: "Pending",
312
+ icon: /*#__PURE__*/_jsx(Education, {
313
+ color: "warning"
314
+ })
315
+ })
316
+ }]
317
+ }];
318
+ return /*#__PURE__*/_jsxs(Box, {
319
+ children: [/*#__PURE__*/_jsx(Box, {
320
+ component: "h4",
321
+ sx: {
322
+ mb: 2
323
+ },
324
+ children: "SingleSelect with Custom Cell Content"
325
+ }), /*#__PURE__*/_jsx(Box, {
326
+ height: 500,
327
+ children: /*#__PURE__*/_jsx(DataGrid, {
328
+ rows: rows,
329
+ columns: columns,
330
+ slots: {
331
+ toolbar: function toolbar() {
332
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
333
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
334
+ });
335
+ }
336
+ },
337
+ showToolbar: true
338
+ })
339
+ })]
340
+ });
341
+ }
342
+ };
343
+
344
+ // Story 6: Multiple single select columns
345
+ export var MultipleSingleSelectColumns = {
346
+ render: function render() {
347
+ var columns = [{
348
+ field: "name",
349
+ headerName: "Product Name",
350
+ flex: 1
351
+ }, {
352
+ field: "category",
353
+ headerName: "Category",
354
+ width: 140,
355
+ type: "singleSelect",
356
+ valueOptions: ["electronics", "clothing", "furniture"]
357
+ }, {
358
+ field: "status",
359
+ headerName: "Status",
360
+ width: 130,
361
+ type: "singleSelect",
362
+ valueOptions: ["active", "inactive", "pending"]
363
+ }, {
364
+ field: "priority",
365
+ headerName: "Priority",
366
+ width: 130,
367
+ type: "singleSelect",
368
+ valueOptions: [{
369
+ value: "high",
370
+ label: "High"
371
+ }, {
372
+ value: "medium",
373
+ label: "Medium"
374
+ }, {
375
+ value: "low",
376
+ label: "Low"
377
+ }]
378
+ }, {
379
+ field: "department",
380
+ headerName: "Department",
381
+ width: 150,
382
+ type: "singleSelect",
383
+ valueOptions: ["sales", "marketing", "operations"]
384
+ }];
385
+ return /*#__PURE__*/_jsxs(Box, {
386
+ children: [/*#__PURE__*/_jsx(Box, {
387
+ component: "h4",
388
+ sx: {
389
+ mb: 2
390
+ },
391
+ children: "Multiple SingleSelect Columns"
392
+ }), /*#__PURE__*/_jsx(Box, {
393
+ height: 500,
394
+ children: /*#__PURE__*/_jsx(DataGrid, {
395
+ rows: rows,
396
+ columns: columns,
397
+ slots: {
398
+ toolbar: function toolbar() {
399
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
400
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
401
+ });
402
+ }
403
+ },
404
+ showToolbar: true
405
+ })
406
+ })]
407
+ });
408
+ }
409
+ };
410
+
411
+ // Story 7: Different density modes
412
+
413
+ export var DifferentDensityModes = {
414
+ args: {
415
+ density: "standard"
416
+ },
417
+ argTypes: {
418
+ density: {
419
+ name: "Density",
420
+ control: "select",
421
+ options: ["standard", "comfortable", "compact"]
422
+ }
423
+ },
424
+ render: function render(_ref) {
425
+ var density = _ref.density;
426
+ var columns = [{
427
+ field: "name",
428
+ headerName: "Product Name",
429
+ flex: 1
430
+ }, {
431
+ field: "category",
432
+ headerName: "Category",
433
+ width: 150,
434
+ type: "singleSelect",
435
+ valueOptions: ["electronics", "clothing", "furniture"]
436
+ }, {
437
+ field: "status",
438
+ headerName: "Status",
439
+ width: 130,
440
+ type: "singleSelect",
441
+ valueOptions: [{
442
+ value: "active",
443
+ label: "Active Status"
444
+ }, {
445
+ value: "inactive",
446
+ label: "Inactive Status"
447
+ }, {
448
+ value: "pending",
449
+ label: "Pending Review"
450
+ }]
451
+ }, {
452
+ field: "priority",
453
+ headerName: "Priority",
454
+ width: 130,
455
+ type: "singleSelect",
456
+ valueOptions: [{
457
+ value: "high",
458
+ label: "🔴 High Priority"
459
+ }, {
460
+ value: "medium",
461
+ label: "🟡 Medium Priority"
462
+ }, {
463
+ value: "low",
464
+ label: "🟢 Low Priority"
465
+ }]
466
+ }];
467
+ return /*#__PURE__*/_jsxs(Box, {
468
+ children: [/*#__PURE__*/_jsxs(Box, {
469
+ component: "h4",
470
+ sx: {
471
+ mb: 2
472
+ },
473
+ children: ["SingleSelect Filter - ", density, " Density"]
474
+ }), /*#__PURE__*/_jsx(Box, {
475
+ height: 500,
476
+ children: /*#__PURE__*/_jsx(DataGrid, {
477
+ density: density,
478
+ rows: rows,
479
+ columns: columns,
480
+ slots: {
481
+ toolbar: function toolbar() {
482
+ return /*#__PURE__*/_jsx(DataGridToolbar, {
483
+ children: /*#__PURE__*/_jsx(GridFilterButton, {})
484
+ });
485
+ }
486
+ },
487
+ showToolbar: true
488
+ })
489
+ })]
490
+ });
491
+ }
492
+ };