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

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 (118) hide show
  1. package/lib/common/ClearInputAdornment.d.ts.map +1 -1
  2. package/lib/common/ClearInputAdornment.js +6 -2
  3. package/lib/dataGrid/excelExport/generateExcelFile.d.ts.map +1 -1
  4. package/lib/dataGrid/excelExport/generateExcelFile.js +23 -1
  5. package/lib/dateTime/timePicker/TimePicker.d.ts.map +1 -1
  6. package/lib/dateTime/timePicker/TimePicker.js +2 -17
  7. package/lib/dateTime/timeRangePicker/TimeRangePicker.d.ts +71 -0
  8. package/lib/dateTime/timeRangePicker/TimeRangePicker.d.ts.map +1 -0
  9. package/lib/dateTime/timeRangePicker/TimeRangePicker.js +191 -0
  10. package/lib/dateTime/timeRangePickerField/TimeRangePickerField.d.ts +13 -0
  11. package/lib/dateTime/timeRangePickerField/TimeRangePickerField.d.ts.map +1 -0
  12. package/lib/dateTime/timeRangePickerField/TimeRangePickerField.js +31 -0
  13. package/lib/dateTime/utils.d.ts +6 -0
  14. package/lib/dateTime/utils.d.ts.map +1 -1
  15. package/lib/dateTime/utils.js +19 -1
  16. package/lib/{EditDialog.d.ts → editDialog/EditDialog.d.ts} +1 -1
  17. package/lib/editDialog/EditDialog.d.ts.map +1 -0
  18. package/lib/{EditDialog.js → editDialog/EditDialog.js} +5 -5
  19. package/lib/editDialog/EditDialogApiContext.d.ts.map +1 -0
  20. package/lib/form/FinalFormNumberInput.d.ts.map +1 -1
  21. package/lib/form/FinalFormNumberInput.js +2 -3
  22. package/lib/index.d.ts +4 -2
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +4 -2
  25. package/package.json +19 -12
  26. package/lib/EditDialog.d.ts.map +0 -1
  27. package/lib/EditDialogApiContext.d.ts.map +0 -1
  28. package/lib/alert/__stories__/Alert.stories.js +0 -152
  29. package/lib/common/__stories__/Tooltip.stories.js +0 -404
  30. package/lib/common/buttons/__stories__/Button.stories.js +0 -445
  31. package/lib/common/buttons/delete/__stories__/DeleteButton.stories.js +0 -8
  32. package/lib/common/toolbar/__stories__/DataGridToolbar.stories.js +0 -76
  33. package/lib/common/toolbar/__stories__/Toolbar.stories.js +0 -82
  34. package/lib/dataGrid/__stories__/ClickableRows.stories.js +0 -109
  35. package/lib/dataGrid/__stories__/CrudMoreActionsMenu.stories.js +0 -50
  36. package/lib/dataGrid/__stories__/DataGrid.stories.js +0 -94
  37. package/lib/dataGrid/__stories__/DataGridSingleSelectFilter.stories.js +0 -492
  38. package/lib/dateTime/datePicker/__stories__/DatePicker.stories.js +0 -214
  39. package/lib/dateTime/datePickerField/__stories__/DatePickerField.stories.js +0 -220
  40. package/lib/dateTime/dateRangePicker/__stories__/DateRangePicker.stories.js +0 -238
  41. package/lib/dateTime/dateRangePickerField/__stories__/DateRangePickerField.stories.js +0 -224
  42. package/lib/dateTime/dateTimePicker/__stories__/DateTimePicker.stories.js +0 -214
  43. package/lib/dateTime/dateTimePickerField/__stories__/DateTimePickerField.stories.js +0 -220
  44. package/lib/dateTime/dateTimeRangePicker/__stories__/DateTimeRangePicker.stories.js +0 -238
  45. package/lib/dateTime/dateTimeRangePickerField/__stories__/DateTimeRangePickerField.stories.js +0 -223
  46. package/lib/dateTime/timePicker/__stories__/TimePicker.stories.js +0 -219
  47. package/lib/dateTime/timePickerField/__stories__/TimePickerField.stories.js +0 -229
  48. package/lib/form/__stories__/AsyncAutocompleteField.stories.js +0 -660
  49. package/lib/form/__stories__/AsyncSelectField.stories.js +0 -513
  50. package/lib/form/__stories__/Autocomplete.stories.js +0 -188
  51. package/lib/form/__stories__/AutocompleteField.stories.js +0 -48
  52. package/lib/form/__stories__/Checkbox.stories.js +0 -70
  53. package/lib/form/__stories__/CheckboxField.stories.js +0 -87
  54. package/lib/form/__stories__/CheckboxListField.stories.js +0 -172
  55. package/lib/form/__stories__/CustomButtons.stories.js +0 -78
  56. package/lib/form/__stories__/DependentAsyncSelects.stories.js +0 -91
  57. package/lib/form/__stories__/DisableAutoNavigation.stories.js +0 -132
  58. package/lib/form/__stories__/DisabledSubmitIfNotDirty.stories.js +0 -54
  59. package/lib/form/__stories__/FieldContainer.stories.js +0 -87
  60. package/lib/form/__stories__/FinalFormFileSelect.stories.js +0 -155
  61. package/lib/form/__stories__/FormInStack.stories.js +0 -133
  62. package/lib/form/__stories__/FormLayouts.stories.js +0 -174
  63. package/lib/form/__stories__/FormValidation.stories.js +0 -82
  64. package/lib/form/__stories__/Input.stories.js +0 -37
  65. package/lib/form/__stories__/NumberField.stories.js +0 -38
  66. package/lib/form/__stories__/Radio.stories.js +0 -101
  67. package/lib/form/__stories__/RadioGroupField.stories.js +0 -172
  68. package/lib/form/__stories__/RangeInput.stories.js +0 -239
  69. package/lib/form/__stories__/RouterTabs.stories.js +0 -96
  70. package/lib/form/__stories__/RouterTabsInForm.stories.js +0 -73
  71. package/lib/form/__stories__/RouterTabsInFormWithSubroutes.stories.js +0 -96
  72. package/lib/form/__stories__/ScrollToErrorField.stories.js +0 -82
  73. package/lib/form/__stories__/SearchField.stories.js +0 -38
  74. package/lib/form/__stories__/Select.stories.js +0 -187
  75. package/lib/form/__stories__/SelectField.stories.js +0 -100
  76. package/lib/form/__stories__/ShowErrorStrategies.stories.js +0 -107
  77. package/lib/form/__stories__/SingleTextField.stories.js +0 -108
  78. package/lib/form/__stories__/StackInForm.stories.js +0 -53
  79. package/lib/form/__stories__/SubmitErrors.stories.js +0 -90
  80. package/lib/form/__stories__/Switch.stories.js +0 -49
  81. package/lib/form/__stories__/SwitchField.stories.js +0 -87
  82. package/lib/form/__stories__/Tabs.stories.js +0 -78
  83. package/lib/form/__stories__/TextAreaField.stories.js +0 -38
  84. package/lib/form/__stories__/TextField.stories.js +0 -67
  85. package/lib/form/__stories__/ToggleButtonGroupField.stories.js +0 -312
  86. package/lib/form/__stories__/TwoLevelValidation.stories.js +0 -168
  87. package/lib/form/__stories__/Typography.stories.js +0 -71
  88. package/lib/form/file/__stories__/FileDropzone.stories.js +0 -81
  89. package/lib/form/file/__stories__/FileSelect.stories.js +0 -139
  90. package/lib/form/file/__stories__/FileSelectListItem.stories.js +0 -108
  91. package/lib/form/file/__stories__/FileSelectMultipleExamples.stories.js +0 -187
  92. package/lib/section/__stories__/SectionHeadline.stories.js +0 -71
  93. package/lib/stack/__stories__/RouterTabsNestedStack.stories.js +0 -51
  94. package/lib/stack/__stories__/Stack.stories.js +0 -14
  95. package/lib/stack/__stories__/StackBackButton.stories.js +0 -50
  96. package/lib/stack/__stories__/StackBreadcrumbs.stories.js +0 -139
  97. package/lib/stack/__stories__/StackBreadcrumbsTabs.stories.js +0 -47
  98. package/lib/stack/__stories__/StackCustomSeparator.stories.js +0 -47
  99. package/lib/stack/__stories__/StackLink.stories.js +0 -41
  100. package/lib/stack/__stories__/StackNested.stories.js +0 -58
  101. package/lib/stack/__stories__/StackNestedOnInitialPage.stories.js +0 -78
  102. package/lib/stack/__stories__/StackNestedOneStack.stories.js +0 -90
  103. package/lib/stack/__stories__/StackPageTitle.stories.js +0 -121
  104. package/lib/stack/__stories__/StackReactNodeTitle.stories.js +0 -54
  105. package/lib/stack/__stories__/StackRefApi.stories.js +0 -56
  106. package/lib/stack/__stories__/StackTableFormQueryAtStack.stories.js +0 -155
  107. package/lib/stack/__stories__/StackTableFormQueryInTable.stories.js +0 -160
  108. package/lib/stack/__stories__/StackUrl.stories.js +0 -66
  109. package/lib/tabs/__stories__/DynamicTabs.stories.js +0 -84
  110. package/lib/tabs/__stories__/NestedStackSwitchWithRouterTabs.stories.js +0 -84
  111. package/lib/tabs/__stories__/OverflowIssues.stories.js +0 -224
  112. package/lib/tabs/__stories__/RouterTabs.stories.js +0 -31
  113. package/lib/tabs/__stories__/RouterTabsInStack.stories.js +0 -74
  114. package/lib/tabs/__stories__/RouterTabsInSubroute.stories.js +0 -68
  115. package/lib/tabs/__stories__/Tabs.stories.js +0 -219
  116. package/lib/translator/__stories__/ContentTranslation.stories.js +0 -104
  117. /package/lib/{EditDialogApiContext.d.ts → editDialog/EditDialogApiContext.d.ts} +0 -0
  118. /package/lib/{EditDialogApiContext.js → editDialog/EditDialogApiContext.js} +0 -0
@@ -1,492 +0,0 @@
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
- };
@@ -1,214 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
10
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
11
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
- import { Edit } from "@comet/admin-icons";
14
- import { Box, Typography } from "@mui/material";
15
- import { useState } from "react";
16
- import { DatePicker } from "../DatePicker";
17
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
- var config = {
19
- component: DatePicker,
20
- title: "components/dateTime/DatePicker"
21
- };
22
- export default config;
23
-
24
- /**
25
- * The basic DatePicker component allows users to select a date from a calendar interface.
26
- *
27
- * Use this for date input fields where users need to pick a specific date.
28
- */
29
- export var Default = {
30
- render: function render(args) {
31
- var _useState = useState("2024-01-15"),
32
- _useState2 = _slicedToArray(_useState, 2),
33
- value = _useState2[0],
34
- setValue = _useState2[1];
35
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
36
- value: value,
37
- onChange: setValue
38
- }));
39
- }
40
- };
41
- export var FullWidth = {
42
- render: function render(args) {
43
- var _useState3 = useState("2024-01-15"),
44
- _useState4 = _slicedToArray(_useState3, 2),
45
- value = _useState4[0],
46
- setValue = _useState4[1];
47
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
48
- fullWidth: true,
49
- value: value,
50
- onChange: setValue
51
- }));
52
- }
53
- };
54
-
55
- /**
56
- * DatePicker in a required state.
57
- *
58
- * Use this when:
59
- * - The date selection is mandatory
60
- * - Form validation requires a date value
61
- * - Users must select a date to proceed
62
- *
63
- * Note: The clear button is automatically hidden when the field is required.
64
- */
65
- export var Required = {
66
- render: function render(args) {
67
- var _useState5 = useState("2024-01-15"),
68
- _useState6 = _slicedToArray(_useState5, 2),
69
- value = _useState6[0],
70
- setValue = _useState6[1];
71
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
72
- required: true,
73
- value: value,
74
- onChange: setValue
75
- }));
76
- }
77
- };
78
-
79
- /**
80
- * DatePicker in a disabled state.
81
- *
82
- * Use this when:
83
- * - The date cannot be changed due to permissions or state
84
- * - You want to show a date value but prevent interaction
85
- * - Form logic requires the field to be temporarily disabled
86
- */
87
- export var Disabled = {
88
- render: function render(args) {
89
- var _useState7 = useState("2024-01-15"),
90
- _useState8 = _slicedToArray(_useState7, 2),
91
- value = _useState8[0],
92
- setValue = _useState8[1];
93
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
94
- disabled: true,
95
- value: value,
96
- onChange: setValue
97
- }));
98
- }
99
- };
100
-
101
- /**
102
- * DatePicker in a read-only state.
103
- *
104
- * Use this when:
105
- * - The date should be visible but not editable
106
- * - You want to display a date value that cannot be modified
107
- * - The field is used for reference only
108
- */
109
- export var ReadOnly = {
110
- render: function render(args) {
111
- var _useState9 = useState("2024-01-15"),
112
- _useState0 = _slicedToArray(_useState9, 2),
113
- value = _useState0[0],
114
- setValue = _useState0[1];
115
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
116
- readOnly: true,
117
- value: value,
118
- onChange: setValue
119
- }));
120
- }
121
- };
122
-
123
- /**
124
- * DatePicker with a custom icon.
125
- *
126
- * Use this when:
127
- * - You want to match your brand's icon style
128
- * - The default calendar icon doesn't fit your design
129
- * - You need to indicate a specific type of date selection
130
- */
131
- export var WithCustomIcon = {
132
- render: function render(args) {
133
- var _useState1 = useState("2024-01-15"),
134
- _useState10 = _slicedToArray(_useState1, 2),
135
- value = _useState10[0],
136
- setValue = _useState10[1];
137
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
138
- value: value,
139
- onChange: setValue,
140
- iconMapping: {
141
- openPicker: /*#__PURE__*/_jsx(Edit, {})
142
- }
143
- }));
144
- }
145
- };
146
-
147
- /**
148
- * DatePicker with date restrictions.
149
- *
150
- * Use this when:
151
- * - Only certain dates should be selectable
152
- * - You need to limit selection to future or past dates
153
- * - Business rules require date range restrictions
154
- */
155
- export var WithDateRestrictions = {
156
- args: {
157
- minDate: new Date()
158
- },
159
- argTypes: {
160
- minDate: {
161
- control: "date"
162
- }
163
- },
164
- render: function render(args) {
165
- var _useState11 = useState(),
166
- _useState12 = _slicedToArray(_useState11, 2),
167
- value = _useState12[0],
168
- setValue = _useState12[1];
169
- return /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
170
- label: "Future Date Only",
171
- minDate: args.minDate,
172
- value: value,
173
- onChange: setValue
174
- }));
175
- }
176
- };
177
-
178
- /**
179
- * Multiple DatePicker instances demonstrating different configurations.
180
- *
181
- * This example shows how DatePickers can be combined in forms or interfaces
182
- * to collect multiple date values with different requirements and states.
183
- */
184
- export var MultiplePickers = {
185
- render: function render(args) {
186
- var _useState13 = useState("2024-01-15"),
187
- _useState14 = _slicedToArray(_useState13, 2),
188
- startDate = _useState14[0],
189
- setStartDate = _useState14[1];
190
- var _useState15 = useState("2024-01-30"),
191
- _useState16 = _slicedToArray(_useState15, 2),
192
- endDate = _useState16[0],
193
- setEndDate = _useState16[1];
194
- return /*#__PURE__*/_jsxs(Box, {
195
- display: "flex",
196
- flexDirection: "column",
197
- gap: 4,
198
- children: [/*#__PURE__*/_jsx(Typography, {
199
- variant: "h5",
200
- children: "Date Range Selection"
201
- }), /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
202
- label: "Start Date",
203
- fullWidth: true,
204
- value: startDate,
205
- onChange: setStartDate
206
- })), /*#__PURE__*/_jsx(DatePicker, _objectSpread(_objectSpread({}, args), {}, {
207
- label: "End Date",
208
- fullWidth: true,
209
- value: endDate,
210
- onChange: setEndDate
211
- }))]
212
- });
213
- }
214
- };