@indico-data/design-system 1.0.52 → 1.0.53

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 (58) hide show
  1. package/jest.config.js +1 -2
  2. package/lib/components/Icon/Icon.stories.d.ts +2 -2
  3. package/lib/components/Icon/indicons.d.ts +1 -0
  4. package/lib/components/Navigation/Drawer/constants.d.ts +3 -0
  5. package/lib/components/index.d.ts +1 -1
  6. package/lib/components/inputs/DatePicker/DatePicker.d.ts +15 -0
  7. package/lib/components/inputs/DatePicker/DatePicker.stories.d.ts +6 -0
  8. package/lib/components/inputs/DatePicker/DatePicker.styles.d.ts +2 -0
  9. package/lib/components/inputs/DatePicker/index.d.ts +1 -0
  10. package/lib/components/inputs/NoInputDatePicker/NoInputDatePicker.d.ts +19 -0
  11. package/lib/components/inputs/NoInputDatePicker/NoInputDatePicker.stories.d.ts +7 -0
  12. package/lib/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.d.ts +2 -0
  13. package/lib/components/inputs/NoInputDatePicker/__tests__/NoInputDatePicker.test.d.ts +1 -0
  14. package/lib/components/inputs/NoInputDatePicker/index.d.ts +1 -0
  15. package/lib/components/inputs/index.d.ts +2 -0
  16. package/lib/components/text-truncate/TextTruncate.d.ts +1 -1
  17. package/lib/index.d.ts +61 -28
  18. package/lib/index.esm.js +21441 -13325
  19. package/lib/index.esm.js.map +1 -1
  20. package/lib/index.js +21462 -13328
  21. package/lib/index.js.map +1 -1
  22. package/lib/types.d.ts +1 -0
  23. package/lib/utils/color.d.ts +21 -0
  24. package/lib/utils/index.d.ts +4 -0
  25. package/lib/utils/number.d.ts +21 -0
  26. package/lib/utils/string.d.ts +12 -0
  27. package/package.json +10 -3
  28. package/src/components/Icon/indicons.tsx +6 -0
  29. package/src/components/ListTable/Header/Header.tsx +1 -1
  30. package/src/components/Pagination/Pagination.tsx +1 -1
  31. package/src/components/basic-section/SectionTable/SectionTable.styles.ts +1 -2
  32. package/src/components/basic-section/SectionTable/SectionTable.tsx +12 -10
  33. package/src/components/dropdowns/MultiCombobox/MultiCombobox.stories.tsx +1 -1
  34. package/src/components/dropdowns/MultiCombobox/MultiCombobox.tsx +1 -1
  35. package/src/components/dropdowns/SingleCombobox/SingleCombobox.tsx +1 -1
  36. package/src/components/index.ts +2 -0
  37. package/src/components/inputs/DatePicker/DatePicker.stories.tsx +30 -0
  38. package/src/components/inputs/DatePicker/DatePicker.styles.ts +437 -0
  39. package/src/components/inputs/DatePicker/DatePicker.tsx +165 -0
  40. package/src/components/inputs/DatePicker/index.ts +1 -0
  41. package/src/components/inputs/EditableInput/EditableInput.tsx +1 -1
  42. package/src/components/inputs/NoInputDatePicker/NoInputDatePicker.stories.tsx +52 -0
  43. package/src/components/inputs/NoInputDatePicker/NoInputDatePicker.styles.ts +449 -0
  44. package/src/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +204 -0
  45. package/src/components/inputs/NoInputDatePicker/__tests__/NoInputDatePicker.test.tsx +126 -0
  46. package/src/components/inputs/NoInputDatePicker/index.ts +1 -0
  47. package/src/components/inputs/TextInput/TextInput.stories.tsx +1 -1
  48. package/src/components/inputs/index.ts +2 -0
  49. package/src/components/modals/ModalBase/ModalBase.styles.tsx +1 -1
  50. package/src/components/text-truncate/TextTruncate.test.tsx +3 -4
  51. package/src/components/text-truncate/TextTruncate.tsx +3 -2
  52. package/src/index.ts +2 -0
  53. package/src/styles/globals/forms.ts +1 -9
  54. package/src/styles/globals/tables.ts +1 -5
  55. package/src/utils/color.ts +139 -0
  56. package/src/utils/index.ts +5 -0
  57. package/src/utils/number.ts +29 -0
  58. package/src/utils/string.ts +87 -0
@@ -0,0 +1,437 @@
1
+ import styled from 'styled-components';
2
+
3
+ import { COLORS } from '@/index';
4
+
5
+ export const StyledDatePicker = styled.div`
6
+ /************************************
7
+ * Default react-day-picker styling - this needed to be added because we were unable to import styling as specified by the docs (most likely because we are not using webpack)
8
+ *************************************/
9
+
10
+ .rdp {
11
+ --rdp-cell-size: 40px;
12
+ --rdp-accent-color: #0000ff;
13
+ --rdp-background-color: #e7edff;
14
+ --rdp-accent-color-dark: #3003e1;
15
+ --rdp-background-color-dark: #180270;
16
+ --rdp-outline: 2px solid var(--rdp-accent-color); /* Outline border for focused elements */
17
+ --rdp-outline-selected: 3px solid var(--rdp-accent-color); /* Outline border for focused _and_ selected elements */
18
+
19
+ margin: 1em;
20
+ }
21
+
22
+ /* Hide elements for devices that are not screen readers */
23
+ .rdp-vhidden {
24
+ box-sizing: border-box;
25
+ padding: 0;
26
+ margin: 0;
27
+ background: transparent;
28
+ border: 0;
29
+ -moz-appearance: none;
30
+ -webkit-appearance: none;
31
+ appearance: none;
32
+ position: absolute !important;
33
+ top: 0;
34
+ width: 1px !important;
35
+ height: 1px !important;
36
+ padding: 0 !important;
37
+ overflow: hidden !important;
38
+ clip: rect(1px, 1px, 1px, 1px) !important;
39
+ border: 0 !important;
40
+ }
41
+
42
+ /* Buttons */
43
+ .rdp-button_reset {
44
+ appearance: none;
45
+ position: relative;
46
+ margin: 0;
47
+ padding: 0;
48
+ cursor: default;
49
+ color: inherit;
50
+ background: none;
51
+ font: inherit;
52
+
53
+ -moz-appearance: none;
54
+ -webkit-appearance: none;
55
+ }
56
+
57
+ .rdp-button_reset:focus-visible {
58
+ /* Make sure to reset outline only when :focus-visible is supported */
59
+ outline: none;
60
+ }
61
+
62
+ .rdp-button {
63
+ border: 2px solid transparent;
64
+ }
65
+
66
+ .rdp-button[disabled]:not(.rdp-day_selected) {
67
+ opacity: 0.25;
68
+ }
69
+
70
+ .rdp-button:not([disabled]) {
71
+ cursor: pointer;
72
+ }
73
+
74
+ .rdp-button:focus-visible:not([disabled]) {
75
+ color: inherit;
76
+ background-color: var(--rdp-background-color);
77
+ border: var(--rdp-outline);
78
+ }
79
+
80
+ .rdp-button:hover:not([disabled]):not(.rdp-day_selected) {
81
+ background-color: var(--rdp-background-color);
82
+ }
83
+
84
+ .rdp-months {
85
+ display: flex;
86
+ }
87
+
88
+ .rdp-month {
89
+ margin: 0 1em;
90
+ }
91
+
92
+ .rdp-month:first-child {
93
+ margin-left: 0;
94
+ }
95
+
96
+ .rdp-month:last-child {
97
+ margin-right: 0;
98
+ }
99
+
100
+ .rdp-table {
101
+ margin: 0;
102
+ max-width: calc(var(--rdp-cell-size) * 7);
103
+ border-collapse: collapse;
104
+ }
105
+
106
+ .rdp-with_weeknumber .rdp-table {
107
+ max-width: calc(var(--rdp-cell-size) * 8);
108
+ border-collapse: collapse;
109
+ }
110
+
111
+ .rdp-caption {
112
+ display: flex;
113
+ align-items: center;
114
+ justify-content: space-between;
115
+ padding: 0;
116
+ text-align: left;
117
+ }
118
+
119
+ .rdp-multiple_months .rdp-caption {
120
+ position: relative;
121
+ display: block;
122
+ text-align: center;
123
+ }
124
+
125
+ .rdp-caption_dropdowns {
126
+ position: relative;
127
+ display: inline-flex;
128
+ }
129
+
130
+ .rdp-caption_label {
131
+ position: relative;
132
+ z-index: 1;
133
+ display: inline-flex;
134
+ align-items: center;
135
+ margin: 0;
136
+ padding: 0 0.25em;
137
+ white-space: nowrap;
138
+ color: currentColor;
139
+ border: 0;
140
+ border: 2px solid transparent;
141
+ font-family: inherit;
142
+ font-size: 140%;
143
+ font-weight: bold;
144
+ }
145
+
146
+ .rdp-nav {
147
+ white-space: nowrap;
148
+ }
149
+
150
+ .rdp-multiple_months .rdp-caption_start .rdp-nav {
151
+ position: absolute;
152
+ top: 50%;
153
+ left: 0;
154
+ transform: translateY(-50%);
155
+ }
156
+
157
+ .rdp-multiple_months .rdp-caption_end .rdp-nav {
158
+ position: absolute;
159
+ top: 50%;
160
+ right: 0;
161
+ transform: translateY(-50%);
162
+ }
163
+
164
+ .rdp-nav_button {
165
+ display: inline-flex;
166
+ align-items: center;
167
+ justify-content: center;
168
+ width: var(--rdp-cell-size);
169
+ height: var(--rdp-cell-size);
170
+ padding: 0.25em;
171
+ border-radius: 100%;
172
+ }
173
+
174
+ /* ---------- */
175
+ /* Dropdowns */
176
+ /* ---------- */
177
+
178
+ .rdp-dropdown_year,
179
+ .rdp-dropdown_month {
180
+ position: relative;
181
+ display: inline-flex;
182
+ align-items: center;
183
+ }
184
+
185
+ .rdp-dropdown {
186
+ appearance: none;
187
+ position: absolute;
188
+ z-index: 2;
189
+ top: 0;
190
+ bottom: 0;
191
+ left: 0;
192
+ width: 100%;
193
+ margin: 0;
194
+ padding: 0;
195
+ cursor: inherit;
196
+ opacity: 0;
197
+ border: none;
198
+ background-color: transparent;
199
+ font-family: inherit;
200
+ font-size: inherit;
201
+ line-height: inherit;
202
+ }
203
+
204
+ .rdp-dropdown[disabled] {
205
+ opacity: unset;
206
+ color: unset;
207
+ }
208
+
209
+ .rdp-dropdown:focus-visible:not([disabled]) + .rdp-caption_label {
210
+ background-color: var(--rdp-background-color);
211
+ border: var(--rdp-outline);
212
+ border-radius: 6px;
213
+ }
214
+
215
+ .rdp-dropdown_icon {
216
+ margin: 0 0 0 5px;
217
+ }
218
+
219
+ .rdp-head {
220
+ border: 0;
221
+ }
222
+
223
+ .rdp-head_row,
224
+ .rdp-row {
225
+ height: 100%;
226
+ }
227
+
228
+ .rdp-head_cell {
229
+ vertical-align: middle;
230
+ font-size: 0.75em;
231
+ font-weight: 700;
232
+ text-align: center;
233
+ height: 100%;
234
+ height: var(--rdp-cell-size);
235
+ padding: 0;
236
+ }
237
+
238
+ .rdp-tbody {
239
+ border: 0;
240
+ }
241
+
242
+ .rdp-tfoot {
243
+ margin: 0.5em;
244
+ }
245
+
246
+ .rdp-cell {
247
+ width: var(--rdp-cell-size);
248
+ height: 100%;
249
+ height: var(--rdp-cell-size);
250
+ padding: 0;
251
+ text-align: center;
252
+ }
253
+
254
+ .rdp-weeknumber {
255
+ font-size: 0.75em;
256
+ }
257
+
258
+ .rdp-weeknumber,
259
+ .rdp-day {
260
+ display: flex;
261
+ overflow: hidden;
262
+ align-items: center;
263
+ justify-content: center;
264
+ box-sizing: border-box;
265
+ width: var(--rdp-cell-size);
266
+ max-width: var(--rdp-cell-size);
267
+ height: var(--rdp-cell-size);
268
+ margin: 0;
269
+ border: 2px solid transparent;
270
+ border-radius: 100%;
271
+ }
272
+
273
+ .rdp-day_today:not(.rdp-day_outside) {
274
+ font-weight: bold;
275
+ }
276
+
277
+ .rdp-day_selected,
278
+ .rdp-day_selected:focus-visible,
279
+ .rdp-day_selected:hover {
280
+ color: white;
281
+ opacity: 1;
282
+ background-color: var(--rdp-accent-color);
283
+ }
284
+
285
+ .rdp-day_outside {
286
+ opacity: 0.5;
287
+ }
288
+
289
+ .rdp-day_selected:focus-visible {
290
+ /* Since the background is the same use again the outline */
291
+ outline: var(--rdp-outline);
292
+ outline-offset: 2px;
293
+ z-index: 1;
294
+ }
295
+
296
+ .rdp:not([dir='rtl']) .rdp-day_range_start:not(.rdp-day_range_end) {
297
+ border-top-right-radius: 0;
298
+ border-bottom-right-radius: 0;
299
+ }
300
+
301
+ .rdp:not([dir='rtl']) .rdp-day_range_end:not(.rdp-day_range_start) {
302
+ border-top-left-radius: 0;
303
+ border-bottom-left-radius: 0;
304
+ }
305
+
306
+ .rdp[dir='rtl'] .rdp-day_range_start:not(.rdp-day_range_end) {
307
+ border-top-left-radius: 0;
308
+ border-bottom-left-radius: 0;
309
+ }
310
+
311
+ .rdp[dir='rtl'] .rdp-day_range_end:not(.rdp-day_range_start) {
312
+ border-top-right-radius: 0;
313
+ border-bottom-right-radius: 0;
314
+ }
315
+
316
+ .rdp-day_range_end.rdp-day_range_start {
317
+ border-radius: 100%;
318
+ }
319
+
320
+ .rdp-day_range_middle {
321
+ border-radius: 0;
322
+ }
323
+
324
+ /*# sourceMappingURL=style.css.map */
325
+
326
+ /******************************
327
+ * Indico Custom Styling
328
+ *******************************/
329
+
330
+ .datepicker--inputParent {
331
+ position: relative;
332
+ width: 150px;
333
+ }
334
+
335
+ .datepicker-label {
336
+ padding: 10px 10px 10px 0;
337
+ color: ${COLORS.white};
338
+ font-size: 14px;
339
+ }
340
+
341
+ .datepicker--input {
342
+ width: 150px;
343
+ border: solid ${COLORS.baliHai} 1px;
344
+ border-radius: 4px;
345
+ text-align: center;
346
+ color: ${COLORS.white};
347
+
348
+ &::placeholder {
349
+ opacity: 0.5;
350
+ }
351
+ }
352
+
353
+ .remove-btn {
354
+ position: absolute;
355
+ top: 0;
356
+ right: 0;
357
+ }
358
+
359
+ .remove-btn svg {
360
+ height: 8px;
361
+ margin-right: 10px;
362
+ width: 8px;
363
+ }
364
+
365
+ .remove-btn,
366
+ .remove-btn:hover,
367
+ .remove-btn:focus {
368
+ color: ${COLORS.defaultFontColor};
369
+ background: transparent;
370
+ box-shadow: none;
371
+ font-size: 16px;
372
+ padding: 0 !important;
373
+ }
374
+
375
+ .DayPickerInput-Overlay {
376
+ background: ${COLORS.oxfordBlue};
377
+ border-radius: 4px;
378
+ z-index: 999;
379
+ .rdp {
380
+ background: ${COLORS.oxfordBlue};
381
+ z-index: 999;
382
+ }
383
+ }
384
+
385
+ .rdp-caption_label {
386
+ font-weight: 500;
387
+ font-size: 1.15em;
388
+ }
389
+
390
+ .rdp-button,
391
+ .rdp-day {
392
+ box-shadow: none;
393
+ }
394
+
395
+ .rdp-head_cell,
396
+ .rdp-cell {
397
+ border: none;
398
+ }
399
+
400
+ .rdp-head_cell {
401
+ color: ${COLORS.mediumGray};
402
+ }
403
+
404
+ .rdp-day_today {
405
+ color: ${COLORS.ebony} !important;
406
+ }
407
+
408
+ //on hover font color
409
+ .rdp:not(.rdp-day_disabled)
410
+ .rdp-day:not(.rdp-day_disabled):not(.rdp-day_selected):not(.rdp-day_outside):hover {
411
+ color: ${COLORS.mirage};
412
+ background-color: ${COLORS.white};
413
+ }
414
+
415
+ .rdp-day_today:not(.rdp-day_disabled):not(.rdp-day_selected):not(.rdp-day_outside) {
416
+ color: ${COLORS.red} !important;
417
+ }
418
+
419
+ .rdp-day_selected:not(.rdp-day_disabled):not(.rdp-day_outside) {
420
+ position: relative;
421
+ background-color: ${COLORS.curiousBlue};
422
+ color: ${COLORS.white};
423
+ }
424
+
425
+ .rdp-day_disabled:not(.rdp-day_today) {
426
+ opacity: 0.3;
427
+ }
428
+
429
+ .rdp-day_disabled {
430
+ background-color: inherit !important;
431
+ cursor: auto !important;
432
+ }
433
+
434
+ .rdp-day_disabled:hover {
435
+ color: inherit !important;
436
+ }
437
+ `;
@@ -0,0 +1,165 @@
1
+ // TODO: This component's migration was fast-tracked for Insights. Assess for potential refactor and documentation.
2
+ import React, { ChangeEventHandler, useRef, useState } from 'react';
3
+
4
+ import { format, isValid, parse } from 'date-fns';
5
+ import FocusTrap from 'focus-trap-react';
6
+ import { DayPicker, SelectSingleEventHandler } from 'react-day-picker';
7
+ import { usePopper } from 'react-popper';
8
+ import { PermafrostComponent } from '@/types';
9
+ import { IconButton } from '@/index';
10
+
11
+ import { StyledDatePicker } from './DatePicker.styles';
12
+
13
+ type Props = PermafrostComponent & {
14
+ ariaLabel?: string;
15
+ disableBeforeDate?: Date;
16
+ disableAfterDate?: Date;
17
+ disabled?: boolean;
18
+ id: string;
19
+ label?: string;
20
+ onChange: (value: Date | undefined) => void;
21
+ placeholder?: string;
22
+ selected?: Date | undefined;
23
+ value: Date | undefined;
24
+ };
25
+
26
+ export const DatePicker = (props: Props) => {
27
+ const {
28
+ ariaLabel,
29
+ className,
30
+ disabled,
31
+ disableBeforeDate,
32
+ disableAfterDate,
33
+ id,
34
+ label,
35
+ onChange,
36
+ placeholder,
37
+ value,
38
+ selected,
39
+ } = props;
40
+
41
+ const [localSelected, setLocalSelected] = useState<Date | undefined>(selected || undefined);
42
+ const [inputValue, setInputValue] = useState<string>(
43
+ isValid(value) ? format(value as Date, 'y-MM-dd') : '',
44
+ );
45
+ const [isPopperOpen, setIsPopperOpen] = useState(false);
46
+ const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);
47
+ const popperRef = useRef<HTMLDivElement>(null);
48
+ const popper = usePopper(popperRef.current, popperElement, {
49
+ placement: 'bottom-start',
50
+ modifiers: [
51
+ {
52
+ name: 'offset',
53
+ options: {
54
+ offset: [0, 10],
55
+ },
56
+ },
57
+ ],
58
+ });
59
+ const inputRef = useRef<HTMLInputElement>(null);
60
+
61
+ const closePopper = () => {
62
+ setIsPopperOpen(false);
63
+ };
64
+
65
+ // TODO -- After discussing with product, we determined handling invalid would happen at a later date.
66
+ const handleInputChange: ChangeEventHandler<HTMLInputElement> = (e) => {
67
+ setInputValue(e.currentTarget.value);
68
+ const date = parse(e.currentTarget.value, 'y-MM-dd', new Date());
69
+ if (isValid(date)) {
70
+ setLocalSelected(date);
71
+ onChange(date);
72
+ } else if (e.currentTarget.value === '') {
73
+ setLocalSelected(undefined);
74
+ setInputValue('');
75
+ onChange(undefined);
76
+ } else {
77
+ setLocalSelected(undefined);
78
+ }
79
+ };
80
+
81
+ const handleDaySelect: SelectSingleEventHandler = (date) => {
82
+ setLocalSelected(date);
83
+ if (date) {
84
+ setInputValue(format(date, 'y-MM-dd'));
85
+ onChange(date);
86
+ closePopper();
87
+ } else {
88
+ setInputValue('');
89
+ onChange(date);
90
+ }
91
+ };
92
+
93
+ return (
94
+ <StyledDatePicker
95
+ className={className}
96
+ aria-label={ariaLabel || 'date select'}
97
+ aria-describedby={`picker-label--${id}`}
98
+ data-cy={props['data-cy']}
99
+ data-testid={props['data-testid']}
100
+ id={id}
101
+ >
102
+ {label ? (
103
+ <div id={`picker-label--${id}`} className="datepicker-label">
104
+ {label}
105
+ </div>
106
+ ) : null}
107
+ <div ref={popperRef} className="datepicker--inputParent">
108
+ <input
109
+ ref={inputRef}
110
+ data-testid={`datepicker-input-${id}`}
111
+ disabled={disabled}
112
+ type="text"
113
+ placeholder={placeholder || format(new Date(), 'y-MM-dd')}
114
+ value={inputValue}
115
+ onChange={handleInputChange}
116
+ className="datepicker--input"
117
+ onClick={() => setIsPopperOpen(!isPopperOpen)}
118
+ />
119
+ <IconButton
120
+ className="remove-btn"
121
+ data-testid="button-remove-date-value"
122
+ iconName="x-close"
123
+ onPress={() => {
124
+ closePopper();
125
+ setInputValue('');
126
+ setLocalSelected(undefined);
127
+ onChange(undefined);
128
+ }}
129
+ />
130
+ </div>
131
+ {isPopperOpen && (
132
+ <FocusTrap
133
+ active
134
+ focusTrapOptions={{
135
+ initialFocus: false,
136
+ allowOutsideClick: true,
137
+ clickOutsideDeactivates: true,
138
+ onDeactivate: closePopper,
139
+ fallbackFocus: inputRef.current || undefined,
140
+ }}
141
+ >
142
+ <div
143
+ tabIndex={-1}
144
+ style={popper.styles.popper}
145
+ className="DayPickerInput-Overlay"
146
+ {...popper.attributes.popper}
147
+ ref={setPopperElement}
148
+ role="dialog"
149
+ aria-label="DayPicker calendar"
150
+ >
151
+ <DayPicker
152
+ disabled={disabled}
153
+ mode="single"
154
+ defaultMonth={localSelected}
155
+ selected={localSelected}
156
+ onSelect={handleDaySelect}
157
+ fromDate={disableBeforeDate}
158
+ toDate={disableAfterDate}
159
+ />
160
+ </div>
161
+ </FocusTrap>
162
+ )}
163
+ </StyledDatePicker>
164
+ );
165
+ };
@@ -0,0 +1 @@
1
+ export { DatePicker } from './DatePicker';
@@ -6,7 +6,7 @@ import React, { MutableRefObject, useEffect, useRef, useState } from 'react';
6
6
 
7
7
  import classNames from 'classnames';
8
8
 
9
- import { stringUtils } from '@indico-data/utils';
9
+ import { stringUtils } from '@/utils';
10
10
 
11
11
  import { Icon } from '@/components/Icon';
12
12
  import { PermafrostComponent } from '@/types';
@@ -0,0 +1,52 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import React from 'react';
3
+
4
+ import { NoInputDatePicker } from '@/components/inputs/NoInputDatePicker';
5
+ import { DateRange } from 'react-day-picker';
6
+ const meta: Meta<typeof NoInputDatePicker> = {
7
+ component: NoInputDatePicker,
8
+ tags: ['autodocs'],
9
+ title: 'Inputs/NoInputDatePicker',
10
+ decorators: [
11
+ (Story) => (
12
+ <div style={{ height: '500px' }}>
13
+ <Story />
14
+ </div>
15
+ ),
16
+ ],
17
+ };
18
+
19
+ export default meta;
20
+
21
+ type Story = StoryObj<typeof NoInputDatePicker>;
22
+
23
+ const today = new Date();
24
+
25
+ export const Single: Story = {
26
+ args: {
27
+ id: 'date-picker',
28
+ label: 'Pick a date:',
29
+ value: today,
30
+ triggerIcon: 'calendar',
31
+ triggerIconSize: [20],
32
+ onChange: (date: Date | DateRange | undefined) => {
33
+ // eslint-disable-next-line no-console
34
+ console.log(date);
35
+ },
36
+ },
37
+ };
38
+
39
+ export const Range: Story = {
40
+ args: {
41
+ id: 'date-picker',
42
+ label: 'Pick a date:',
43
+ value: today,
44
+ isRangePicker: true,
45
+ triggerIcon: 'calendar',
46
+ triggerIconSize: [20],
47
+ onChange: (date: Date | DateRange | undefined) => {
48
+ // eslint-disable-next-line no-console
49
+ console.log(date);
50
+ },
51
+ },
52
+ };