@indico-data/design-system 3.0.9 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.ts +3 -0
- package/lib/components/badge/types.d.ts +4 -0
- package/lib/components/button/types.d.ts +52 -2
- package/lib/components/card/Card.d.ts +5 -0
- package/lib/components/floatUI/types.d.ts +7 -0
- package/lib/components/forms/checkbox/Checkbox.d.ts +7 -0
- package/lib/components/forms/date/datePicker/types.d.ts +13 -0
- package/lib/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.d.ts +21 -0
- package/lib/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +13 -0
- package/lib/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +14 -0
- package/lib/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.d.ts +14 -0
- package/lib/components/forms/numberInput/NumberInput.d.ts +4 -0
- package/lib/components/forms/passwordInput/PasswordInput.d.ts +1 -0
- package/lib/components/forms/radio/Radio.d.ts +6 -0
- package/lib/components/forms/select/Select.d.ts +10 -0
- package/lib/components/forms/textarea/Textarea.d.ts +7 -0
- package/lib/components/forms/timePicker/TimePicker.d.ts +5 -0
- package/lib/components/forms/toggle/Toggle.d.ts +7 -0
- package/lib/components/icons/types.d.ts +5 -0
- package/lib/components/loading-indicators/BarSpinner/BarSpinner.d.ts +4 -0
- package/lib/components/loading-indicators/CirclePulse/CirclePulse.d.ts +2 -0
- package/lib/components/menu/Menu.d.ts +1 -0
- package/lib/components/modal/types.d.ts +22 -0
- package/lib/components/pagination/types.d.ts +4 -0
- package/lib/components/pill/types.d.ts +3 -0
- package/lib/components/skeleton/Skeleton.d.ts +5 -0
- package/lib/components/stepper/types.d.ts +9 -0
- package/lib/components/table/types.d.ts +9 -0
- package/lib/components/tanstackTable/TankstackTable.types.d.ts +25 -0
- package/lib/components/tanstackTable/components/ActionBar/ActionBar.d.ts +4 -0
- package/lib/components/tooltip/Tooltip.d.ts +6 -0
- package/lib/components/truncate/types.d.ts +4 -0
- package/lib/index.css +10 -0
- package/lib/index.d.ts +277 -2
- package/lib/index.esm.css +10 -0
- package/lib/index.esm.js +124 -119
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +124 -119
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/badge/Badge.stories.tsx +0 -4
- package/src/components/badge/types.ts +4 -0
- package/src/components/button/Button.stories.tsx +5 -18
- package/src/components/button/types.ts +52 -2
- package/src/components/card/Card.stories.tsx +0 -5
- package/src/components/card/Card.tsx +5 -0
- package/src/components/floatUI/FloatUI.stories.tsx +0 -11
- package/src/components/floatUI/types.ts +7 -0
- package/src/components/forms/checkbox/Checkbox.stories.tsx +0 -7
- package/src/components/forms/checkbox/Checkbox.tsx +7 -0
- package/src/components/forms/date/datePicker/DatePicker.stories.tsx +0 -33
- package/src/components/forms/date/datePicker/styles/DatePicker.scss +10 -0
- package/src/components/forms/date/datePicker/types.ts +14 -0
- package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.tsx +32 -19
- package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.tsx +31 -1
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +27 -22
- package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +23 -2
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +23 -32
- package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +24 -2
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.stories.tsx +23 -28
- package/src/components/forms/date/inputDateTimePicker/SingleInputDateTimePicker.tsx +25 -1
- package/src/components/forms/numberInput/NumberInput.stories.tsx +0 -4
- package/src/components/forms/numberInput/NumberInput.tsx +4 -0
- package/src/components/forms/passwordInput/PasswordInput.stories.tsx +0 -1
- package/src/components/forms/passwordInput/PasswordInput.tsx +1 -0
- package/src/components/forms/radio/Radio.stories.tsx +0 -6
- package/src/components/forms/radio/Radio.tsx +6 -0
- package/src/components/forms/select/Select.stories.tsx +1 -14
- package/src/components/forms/select/Select.tsx +10 -0
- package/src/components/forms/textarea/Textarea.stories.tsx +0 -7
- package/src/components/forms/textarea/Textarea.tsx +7 -0
- package/src/components/forms/timePicker/TimePicker.stories.tsx +0 -5
- package/src/components/forms/timePicker/TimePicker.tsx +26 -1
- package/src/components/forms/timePicker/__tests__/TimePicker.test.tsx +4 -2
- package/src/components/forms/toggle/Toggle.stories.tsx +0 -7
- package/src/components/forms/toggle/Toggle.tsx +7 -0
- package/src/components/icons/Icon.stories.tsx +0 -7
- package/src/components/icons/types.ts +5 -0
- package/src/components/loading-indicators/BarSpinner/BarSpinner.stories.tsx +0 -5
- package/src/components/loading-indicators/BarSpinner/BarSpinner.tsx +4 -0
- package/src/components/loading-indicators/CirclePulse/CirclePulse.stories.tsx +0 -3
- package/src/components/loading-indicators/CirclePulse/CirclePulse.tsx +2 -0
- package/src/components/menu/Menu.stories.tsx +0 -3
- package/src/components/menu/Menu.tsx +1 -0
- package/src/components/modal/Modal.stories.tsx +1 -25
- package/src/components/modal/types.ts +22 -0
- package/src/components/pagination/Pagination.stories.tsx +0 -4
- package/src/components/pagination/types.ts +4 -0
- package/src/components/pill/Pill.stories.tsx +0 -3
- package/src/components/pill/types.ts +3 -0
- package/src/components/skeleton/Skeleton.stories.tsx +0 -7
- package/src/components/skeleton/Skeleton.tsx +5 -0
- package/src/components/stepper/Stepper.stories.tsx +0 -19
- package/src/components/stepper/types.ts +9 -0
- package/src/components/table/Table.stories.tsx +0 -35
- package/src/components/table/types.ts +9 -0
- package/src/components/tanstackTable/TankstackTable.types.ts +25 -0
- package/src/components/tanstackTable/TanstackTable.stories.tsx +0 -29
- package/src/components/tanstackTable/components/ActionBar/ActionBar.stories.tsx +0 -4
- package/src/components/tanstackTable/components/ActionBar/ActionBar.tsx +4 -0
- package/src/components/tooltip/Tooltip.stories.tsx +0 -8
- package/src/components/tooltip/Tooltip.tsx +6 -0
- package/src/components/truncate/Truncate.stories.tsx +0 -8
- package/src/components/truncate/types.ts +4 -0
|
@@ -11,16 +11,23 @@ import {
|
|
|
11
11
|
|
|
12
12
|
export interface DatePickerProps {
|
|
13
13
|
ref?: React.LegacyRef<HTMLInputElement>;
|
|
14
|
+
/** The selected day(s). */
|
|
14
15
|
selected?: Date | DateRange | undefined;
|
|
16
|
+
/** Event handler when a day is selected. */
|
|
15
17
|
onSelect?: OnSelectHandler<Date> | OnSelectHandler<DateRange>;
|
|
18
|
+
/** Allows you to select a single day, a range of days, or multiple days. */
|
|
16
19
|
mode?: Mode;
|
|
20
|
+
/** Accepts a CSS class name */
|
|
17
21
|
className?: string;
|
|
22
|
+
/** The layout of the caption. Enables you to add or remove the dropdown navigation for months/years */
|
|
18
23
|
captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
|
|
19
24
|
id?: string;
|
|
20
25
|
month?: Date;
|
|
21
26
|
defaultMonth?: Date;
|
|
22
27
|
startMonth?: Date | undefined;
|
|
28
|
+
/** Whether to show the time picker. */
|
|
23
29
|
hasTimePicker?: boolean;
|
|
30
|
+
/** The time value to display in the date picker. */
|
|
24
31
|
timeValue?: string;
|
|
25
32
|
endMonth?: Date;
|
|
26
33
|
components?: Partial<CustomComponents>;
|
|
@@ -31,8 +38,11 @@ export interface DatePickerProps {
|
|
|
31
38
|
firstWeekContainsDate?: 1 | 4;
|
|
32
39
|
today?: Date;
|
|
33
40
|
isRequired?: any;
|
|
41
|
+
/** The minimum date that can be selected. */
|
|
34
42
|
min?: number;
|
|
43
|
+
/** The maximum date that can be selected. */
|
|
35
44
|
max?: number;
|
|
45
|
+
/** Callback when the time changes. */
|
|
36
46
|
onTimeChange?: (time: string) => void;
|
|
37
47
|
onMonthChange?: MonthChangeEventHandler;
|
|
38
48
|
onNextClick?: MonthChangeEventHandler;
|
|
@@ -64,3 +74,7 @@ export interface CommonProps {
|
|
|
64
74
|
onPrevClick?: MonthChangeEventHandler;
|
|
65
75
|
onDayClick?: DayEventHandler<React.MouseEvent>;
|
|
66
76
|
}
|
|
77
|
+
|
|
78
|
+
export interface PortalOptions {
|
|
79
|
+
rootId?: string;
|
|
80
|
+
}
|
|
@@ -14,9 +14,35 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
14
14
|
),
|
|
15
15
|
],
|
|
16
16
|
argTypes: {
|
|
17
|
+
isPortal: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
table: {
|
|
20
|
+
category: 'Props',
|
|
21
|
+
type: {
|
|
22
|
+
summary: 'boolean',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
portalOptions: {
|
|
27
|
+
control: false,
|
|
28
|
+
table: {
|
|
29
|
+
category: 'Props',
|
|
30
|
+
type: {
|
|
31
|
+
summary: '{ rootId?: string }',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
floatingOptions: {
|
|
36
|
+
control: false,
|
|
37
|
+
table: {
|
|
38
|
+
category: 'Props',
|
|
39
|
+
type: {
|
|
40
|
+
summary: '{ placement?: Placement; middleware?: Middleware[] }',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
17
44
|
ariaLabel: {
|
|
18
45
|
control: 'text',
|
|
19
|
-
description: 'A label for assistive technologies.',
|
|
20
46
|
table: {
|
|
21
47
|
category: 'Props',
|
|
22
48
|
type: {
|
|
@@ -26,7 +52,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
26
52
|
},
|
|
27
53
|
className: {
|
|
28
54
|
control: false,
|
|
29
|
-
description: 'Accepts a CSS class name',
|
|
30
55
|
table: {
|
|
31
56
|
category: 'Props',
|
|
32
57
|
type: {
|
|
@@ -36,7 +61,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
36
61
|
},
|
|
37
62
|
id: {
|
|
38
63
|
control: 'text',
|
|
39
|
-
description: 'The id of the input field.',
|
|
40
64
|
table: {
|
|
41
65
|
category: 'Props',
|
|
42
66
|
type: {
|
|
@@ -46,7 +70,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
46
70
|
},
|
|
47
71
|
label: {
|
|
48
72
|
control: 'text',
|
|
49
|
-
description: 'The label for the input field.',
|
|
50
73
|
table: {
|
|
51
74
|
category: 'Props',
|
|
52
75
|
type: {
|
|
@@ -56,7 +79,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
56
79
|
},
|
|
57
80
|
triggerIcon: {
|
|
58
81
|
control: 'text',
|
|
59
|
-
description: 'The icon to use as a trigger.',
|
|
60
82
|
table: {
|
|
61
83
|
category: 'Props',
|
|
62
84
|
type: {
|
|
@@ -67,17 +89,15 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
67
89
|
triggerIconSize: {
|
|
68
90
|
control: 'select',
|
|
69
91
|
options: ['sm', 'md', 'lg'],
|
|
70
|
-
description: 'The size of the trigger icon.',
|
|
71
92
|
table: {
|
|
72
93
|
category: 'Props',
|
|
73
94
|
type: {
|
|
74
|
-
summary: '
|
|
95
|
+
summary: 'sm | md | lg',
|
|
75
96
|
},
|
|
76
97
|
},
|
|
77
98
|
},
|
|
78
99
|
isOpen: {
|
|
79
|
-
control:
|
|
80
|
-
description: 'Whether the date picker is open.',
|
|
100
|
+
control: 'boolean',
|
|
81
101
|
table: {
|
|
82
102
|
category: 'Props',
|
|
83
103
|
type: {
|
|
@@ -87,18 +107,16 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
87
107
|
},
|
|
88
108
|
selected: {
|
|
89
109
|
control: 'date',
|
|
90
|
-
description: 'The selected day(s).',
|
|
91
110
|
table: {
|
|
92
111
|
category: 'Props',
|
|
93
112
|
type: {
|
|
94
|
-
summary: 'Date |
|
|
113
|
+
summary: 'Date | DateRange | undefined',
|
|
95
114
|
},
|
|
96
115
|
},
|
|
97
116
|
},
|
|
98
117
|
mode: {
|
|
99
118
|
control: 'select',
|
|
100
119
|
options: ['single', 'range', 'multiple'],
|
|
101
|
-
description: 'Allows you to select a single day, a range of days, or multiple days.',
|
|
102
120
|
table: {
|
|
103
121
|
category: 'Props',
|
|
104
122
|
type: {
|
|
@@ -108,7 +126,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
108
126
|
},
|
|
109
127
|
clearOnClose: {
|
|
110
128
|
control: 'boolean',
|
|
111
|
-
description: 'Clear the selected date(s) when the date picker closes.',
|
|
112
129
|
table: {
|
|
113
130
|
category: 'Props',
|
|
114
131
|
type: {
|
|
@@ -118,7 +135,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
118
135
|
},
|
|
119
136
|
disableAfterDate: {
|
|
120
137
|
control: 'date',
|
|
121
|
-
description: 'Disable dates after this date.',
|
|
122
138
|
table: {
|
|
123
139
|
category: 'Props',
|
|
124
140
|
type: {
|
|
@@ -128,7 +144,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
128
144
|
},
|
|
129
145
|
disableBeforeDate: {
|
|
130
146
|
control: 'date',
|
|
131
|
-
description: 'Disable dates before this date.',
|
|
132
147
|
table: {
|
|
133
148
|
category: 'Props',
|
|
134
149
|
type: {
|
|
@@ -138,7 +153,6 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
138
153
|
},
|
|
139
154
|
isDisabled: {
|
|
140
155
|
control: 'boolean',
|
|
141
|
-
description: 'Disable the date picker.',
|
|
142
156
|
table: {
|
|
143
157
|
category: 'Props',
|
|
144
158
|
type: {
|
|
@@ -153,11 +167,10 @@ const meta: Meta<typeof IconTriggerDatePicker> = {
|
|
|
153
167
|
},
|
|
154
168
|
onSelect: {
|
|
155
169
|
control: false,
|
|
156
|
-
description: 'Event handler when a day is selected.',
|
|
157
170
|
table: {
|
|
158
|
-
category: '
|
|
171
|
+
category: 'Events',
|
|
159
172
|
type: {
|
|
160
|
-
summary: '
|
|
173
|
+
summary: '(selected: Date | DateRange | undefined) => void',
|
|
161
174
|
},
|
|
162
175
|
},
|
|
163
176
|
action: 'onSelect',
|
|
@@ -4,23 +4,44 @@ import { IconName, IconSizes } from '../../../icons/types';
|
|
|
4
4
|
import { FloatUI } from '../../../floatUI';
|
|
5
5
|
import { DatePicker } from '../datePicker/DatePicker';
|
|
6
6
|
import { Icon } from '../../../icons/Icon';
|
|
7
|
+
import { UseFloatingOptions } from '@floating-ui/react-dom';
|
|
8
|
+
import { PortalOptions } from '../datePicker/types';
|
|
7
9
|
interface Props {
|
|
10
|
+
/** Allows you to select a single day, a range of days, or multiple days. */
|
|
8
11
|
mode?: Mode;
|
|
12
|
+
/** A label for assistive technologies. */
|
|
9
13
|
ariaLabel: string;
|
|
14
|
+
/** Disable dates before this date. */
|
|
10
15
|
disableBeforeDate?: Date;
|
|
16
|
+
/** Disable dates after this date. */
|
|
11
17
|
disableAfterDate?: Date;
|
|
18
|
+
/** Disable the date picker. */
|
|
12
19
|
isDisabled?: boolean;
|
|
20
|
+
/** The id of the input field. */
|
|
13
21
|
id: string;
|
|
22
|
+
/** The label for the input field. */
|
|
14
23
|
label?: string;
|
|
24
|
+
/** Event handler when a day is selected. */
|
|
15
25
|
onSelect?: (selected: Date | DateRange | undefined) => void;
|
|
16
26
|
selected?: Date | DateRange | undefined;
|
|
27
|
+
/** The icon to use as a trigger. */
|
|
17
28
|
triggerIcon: IconName;
|
|
29
|
+
/** The size of the trigger icon. */
|
|
18
30
|
triggerIconSize: IconSizes;
|
|
31
|
+
/** Whether the date picker is open. */
|
|
19
32
|
isOpen?: boolean;
|
|
33
|
+
/** Clear the selected date(s) when the date picker closes. */
|
|
20
34
|
clearOnClose?: boolean;
|
|
35
|
+
/** Accepts a CSS class name */
|
|
21
36
|
className?: string;
|
|
22
37
|
initialMonth?: Date;
|
|
23
38
|
'data-testid'?: string;
|
|
39
|
+
/** The portal options for the date picker. Follows floating-ui options. */
|
|
40
|
+
portalOptions?: PortalOptions;
|
|
41
|
+
/** Whether the date picker is a portal. */
|
|
42
|
+
isPortal?: boolean;
|
|
43
|
+
/** The floating options for the date picker. Follows floating-ui options. */
|
|
44
|
+
floatingOptions?: UseFloatingOptions;
|
|
24
45
|
}
|
|
25
46
|
|
|
26
47
|
export const IconTriggerDatePicker = (props: Props) => {
|
|
@@ -40,6 +61,9 @@ export const IconTriggerDatePicker = (props: Props) => {
|
|
|
40
61
|
isOpen,
|
|
41
62
|
clearOnClose,
|
|
42
63
|
initialMonth,
|
|
64
|
+
portalOptions,
|
|
65
|
+
floatingOptions,
|
|
66
|
+
isPortal,
|
|
43
67
|
...rest
|
|
44
68
|
} = props;
|
|
45
69
|
|
|
@@ -61,7 +85,13 @@ export const IconTriggerDatePicker = (props: Props) => {
|
|
|
61
85
|
}, [isOpen, clearOnClose]);
|
|
62
86
|
|
|
63
87
|
return (
|
|
64
|
-
<FloatUI
|
|
88
|
+
<FloatUI
|
|
89
|
+
isOpen={isOpen}
|
|
90
|
+
ariaLabel={ariaLabel}
|
|
91
|
+
isPortal={isPortal}
|
|
92
|
+
portalOptions={portalOptions}
|
|
93
|
+
floatingOptions={floatingOptions}
|
|
94
|
+
>
|
|
65
95
|
<Icon
|
|
66
96
|
aria-label="Open date picker"
|
|
67
97
|
name={triggerIcon}
|
|
@@ -13,37 +13,59 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
13
13
|
),
|
|
14
14
|
],
|
|
15
15
|
argTypes: {
|
|
16
|
+
isPortal: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
table: {
|
|
19
|
+
category: 'Props',
|
|
20
|
+
type: {
|
|
21
|
+
summary: 'boolean',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
portalOptions: {
|
|
26
|
+
control: false,
|
|
27
|
+
table: {
|
|
28
|
+
category: 'Props',
|
|
29
|
+
type: {
|
|
30
|
+
summary: '{ rootId?: string }',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
floatingOptions: {
|
|
35
|
+
control: false,
|
|
36
|
+
table: {
|
|
37
|
+
category: 'Props',
|
|
38
|
+
type: {
|
|
39
|
+
summary: '{ placement?: Placement; middleware?: Middleware[] }',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
16
43
|
tabIndex: {
|
|
17
44
|
control: 'number',
|
|
18
|
-
description: 'The tab index of the input field.',
|
|
19
45
|
table: {
|
|
20
46
|
category: 'Props',
|
|
21
47
|
},
|
|
22
48
|
},
|
|
23
49
|
ref: {
|
|
24
50
|
control: false,
|
|
25
|
-
description: 'The ref of the input field.',
|
|
26
51
|
table: {
|
|
27
52
|
category: 'Props',
|
|
28
53
|
},
|
|
29
54
|
},
|
|
30
55
|
isReadOnly: {
|
|
31
56
|
control: 'boolean',
|
|
32
|
-
description: 'Whether the date picker is read only.',
|
|
33
57
|
table: {
|
|
34
58
|
category: 'Props',
|
|
35
59
|
},
|
|
36
60
|
},
|
|
37
61
|
hasHiddenLabel: {
|
|
38
62
|
control: 'boolean',
|
|
39
|
-
description: 'Whether the label is hidden.',
|
|
40
63
|
table: {
|
|
41
64
|
category: 'Props',
|
|
42
65
|
},
|
|
43
66
|
},
|
|
44
67
|
ariaLabel: {
|
|
45
68
|
control: 'text',
|
|
46
|
-
description: 'A label for assistive technologies.',
|
|
47
69
|
table: {
|
|
48
70
|
category: 'Props',
|
|
49
71
|
type: {
|
|
@@ -54,8 +76,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
54
76
|
captionLayout: {
|
|
55
77
|
control: 'select',
|
|
56
78
|
options: ['dropdown', 'dropdown-months', 'dropdown-years', 'label'],
|
|
57
|
-
description:
|
|
58
|
-
'The layout of the caption. Enables you to add or remove the dropdown navigation for months/years',
|
|
59
79
|
table: {
|
|
60
80
|
category: 'Props',
|
|
61
81
|
type: {
|
|
@@ -65,7 +85,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
65
85
|
},
|
|
66
86
|
className: {
|
|
67
87
|
control: false,
|
|
68
|
-
description: 'Accepts a CSS class name',
|
|
69
88
|
table: {
|
|
70
89
|
category: 'Props',
|
|
71
90
|
type: {
|
|
@@ -75,7 +94,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
75
94
|
},
|
|
76
95
|
id: {
|
|
77
96
|
control: 'text',
|
|
78
|
-
description: 'The id of the input field.',
|
|
79
97
|
table: {
|
|
80
98
|
category: 'Props',
|
|
81
99
|
type: {
|
|
@@ -85,7 +103,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
85
103
|
},
|
|
86
104
|
label: {
|
|
87
105
|
control: 'text',
|
|
88
|
-
description: 'The label for the input field.',
|
|
89
106
|
table: {
|
|
90
107
|
category: 'Props',
|
|
91
108
|
type: {
|
|
@@ -95,7 +112,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
95
112
|
},
|
|
96
113
|
onSelect: {
|
|
97
114
|
action: 'selected',
|
|
98
|
-
description: 'Callback function that is called when a date is selected.',
|
|
99
115
|
table: {
|
|
100
116
|
category: 'Events',
|
|
101
117
|
type: {
|
|
@@ -105,7 +121,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
105
121
|
},
|
|
106
122
|
selected: {
|
|
107
123
|
control: 'date',
|
|
108
|
-
description: 'The selected date.',
|
|
109
124
|
table: {
|
|
110
125
|
category: 'Props',
|
|
111
126
|
type: {
|
|
@@ -115,7 +130,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
115
130
|
},
|
|
116
131
|
inputPlaceholder: {
|
|
117
132
|
control: 'text',
|
|
118
|
-
description: 'The placeholder text for the input field.',
|
|
119
133
|
table: {
|
|
120
134
|
category: 'Props',
|
|
121
135
|
type: {
|
|
@@ -125,7 +139,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
125
139
|
},
|
|
126
140
|
inputIconName: {
|
|
127
141
|
control: 'text',
|
|
128
|
-
description: 'The icon to display in the input field.',
|
|
129
142
|
table: {
|
|
130
143
|
category: 'Props',
|
|
131
144
|
type: {
|
|
@@ -135,7 +148,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
135
148
|
},
|
|
136
149
|
isClearable: {
|
|
137
150
|
control: 'boolean',
|
|
138
|
-
description: 'Whether the input field should be clearable.',
|
|
139
151
|
table: {
|
|
140
152
|
category: 'Props',
|
|
141
153
|
type: {
|
|
@@ -145,7 +157,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
145
157
|
},
|
|
146
158
|
isOpen: {
|
|
147
159
|
control: false,
|
|
148
|
-
description: 'Whether the date picker is open.',
|
|
149
160
|
table: {
|
|
150
161
|
category: 'Props',
|
|
151
162
|
type: {
|
|
@@ -155,7 +166,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
155
166
|
},
|
|
156
167
|
clearOnClose: {
|
|
157
168
|
control: 'boolean',
|
|
158
|
-
description: 'Whether the input field should be cleared when the date picker is closed.',
|
|
159
169
|
table: {
|
|
160
170
|
category: 'Props',
|
|
161
171
|
type: {
|
|
@@ -165,7 +175,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
165
175
|
},
|
|
166
176
|
errorMessage: {
|
|
167
177
|
control: 'text',
|
|
168
|
-
description: 'An error message to display.',
|
|
169
178
|
table: {
|
|
170
179
|
category: 'Props',
|
|
171
180
|
type: {
|
|
@@ -175,7 +184,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
175
184
|
},
|
|
176
185
|
disableAfterDate: {
|
|
177
186
|
control: 'date',
|
|
178
|
-
description: 'Disable dates after this date.',
|
|
179
187
|
table: {
|
|
180
188
|
category: 'Props',
|
|
181
189
|
type: {
|
|
@@ -185,7 +193,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
185
193
|
},
|
|
186
194
|
disableBeforeDate: {
|
|
187
195
|
control: 'date',
|
|
188
|
-
description: 'Disable dates before this date.',
|
|
189
196
|
table: {
|
|
190
197
|
category: 'Props',
|
|
191
198
|
type: {
|
|
@@ -195,7 +202,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
195
202
|
},
|
|
196
203
|
isDisabled: {
|
|
197
204
|
control: 'boolean',
|
|
198
|
-
description: 'Disable the date picker.',
|
|
199
205
|
table: {
|
|
200
206
|
category: 'Props',
|
|
201
207
|
type: {
|
|
@@ -205,7 +211,6 @@ const meta: Meta<typeof SingleInputDatePicker> = {
|
|
|
205
211
|
},
|
|
206
212
|
initialMonth: {
|
|
207
213
|
control: 'date',
|
|
208
|
-
description: 'The month to display.',
|
|
209
214
|
table: {
|
|
210
215
|
category: 'Props',
|
|
211
216
|
type: {
|
|
@@ -5,12 +5,15 @@ import { Input } from '../../input';
|
|
|
5
5
|
import type { IconName } from '../../../icons/types';
|
|
6
6
|
import { FloatUI } from '../../../floatUI';
|
|
7
7
|
import { formatDateAsString } from './helpers';
|
|
8
|
-
|
|
8
|
+
import { UseFloatingOptions } from '@floating-ui/react-dom';
|
|
9
|
+
import { PortalOptions } from '../datePicker/types';
|
|
9
10
|
export interface SingleInputDatePickerProps {
|
|
11
|
+
/** A label for assistive technologies. */
|
|
10
12
|
ariaLabel: string;
|
|
11
13
|
disableBeforeDate?: Date;
|
|
12
14
|
disableAfterDate?: Date;
|
|
13
15
|
isDisabled?: boolean;
|
|
16
|
+
/** The layout of the caption. Enables you to add or remove the dropdown navigation for months/years */
|
|
14
17
|
captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
|
|
15
18
|
id?: string;
|
|
16
19
|
label?: string;
|
|
@@ -19,16 +22,25 @@ export interface SingleInputDatePickerProps {
|
|
|
19
22
|
selected?: Date;
|
|
20
23
|
isOpen?: boolean;
|
|
21
24
|
clearOnClose?: boolean;
|
|
25
|
+
/** Accepts a CSS class name */
|
|
22
26
|
className?: string;
|
|
23
27
|
inputIconName?: IconName;
|
|
24
28
|
isClearable?: boolean;
|
|
25
29
|
inputPlaceholder?: string;
|
|
26
30
|
errorMessage?: string | undefined;
|
|
31
|
+
/** Whether the label is hidden. */
|
|
27
32
|
hasHiddenLabel?: boolean;
|
|
28
33
|
'data-testid'?: string;
|
|
34
|
+
/** The ref of the input field. */
|
|
29
35
|
ref?: React.LegacyRef<HTMLInputElement>;
|
|
36
|
+
/** Whether the date picker is read only. */
|
|
30
37
|
isReadOnly?: boolean;
|
|
38
|
+
/** The tab index of the input field. */
|
|
31
39
|
tabIndex?: number;
|
|
40
|
+
portalOptions?: PortalOptions;
|
|
41
|
+
floatingOptions?: UseFloatingOptions;
|
|
42
|
+
/** Whether the date picker is a portal. */
|
|
43
|
+
isPortal?: boolean;
|
|
32
44
|
}
|
|
33
45
|
|
|
34
46
|
export function SingleInputDatePicker(props: SingleInputDatePickerProps) {
|
|
@@ -54,6 +66,9 @@ export function SingleInputDatePicker(props: SingleInputDatePickerProps) {
|
|
|
54
66
|
ref,
|
|
55
67
|
isReadOnly,
|
|
56
68
|
tabIndex,
|
|
69
|
+
portalOptions,
|
|
70
|
+
floatingOptions,
|
|
71
|
+
isPortal,
|
|
57
72
|
...rest
|
|
58
73
|
} = props;
|
|
59
74
|
|
|
@@ -99,7 +114,13 @@ export function SingleInputDatePicker(props: SingleInputDatePickerProps) {
|
|
|
99
114
|
}, [isOpen, clearOnClose]);
|
|
100
115
|
|
|
101
116
|
return (
|
|
102
|
-
<FloatUI
|
|
117
|
+
<FloatUI
|
|
118
|
+
isOpen={isOpen}
|
|
119
|
+
ariaLabel={ariaLabel}
|
|
120
|
+
isPortal={isPortal}
|
|
121
|
+
portalOptions={portalOptions}
|
|
122
|
+
floatingOptions={floatingOptions}
|
|
123
|
+
>
|
|
103
124
|
<Input
|
|
104
125
|
id={inputId}
|
|
105
126
|
value={localTextValue}
|