@indico-data/design-system 2.37.0 → 2.38.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.
Files changed (66) hide show
  1. package/lib/index.css +40 -408
  2. package/lib/index.d.ts +120 -82
  3. package/lib/index.esm.css +40 -408
  4. package/lib/index.esm.js +15630 -16558
  5. package/lib/index.esm.js.map +1 -1
  6. package/lib/index.js +14164 -15091
  7. package/lib/index.js.map +1 -1
  8. package/lib/src/components/forms/date/datePicker/DatePicker.d.ts +3 -0
  9. package/lib/src/components/forms/date/datePicker/DatePicker.stories.d.ts +9 -0
  10. package/lib/src/components/forms/date/datePicker/contants.d.ts +21 -0
  11. package/lib/src/components/forms/date/datePicker/types.d.ts +48 -0
  12. package/lib/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.d.ts +22 -0
  13. package/lib/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.d.ts +6 -0
  14. package/lib/src/components/forms/date/iconTriggerDatePicker/index.d.ts +1 -0
  15. package/lib/src/components/forms/date/inputDatePicker/SingleInputDatePicker.d.ts +23 -0
  16. package/lib/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.d.ts +6 -0
  17. package/lib/src/components/forms/date/inputDatePicker/index.d.ts +1 -0
  18. package/lib/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.d.ts +23 -0
  19. package/lib/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.d.ts +6 -0
  20. package/lib/src/components/forms/date/inputDateRangePicker/index.d.ts +1 -0
  21. package/lib/src/components/forms/input/Input.d.ts +1 -0
  22. package/lib/src/components/index.d.ts +3 -0
  23. package/lib/src/index.d.ts +4 -1
  24. package/lib/src/legacy/components/index.d.ts +1 -1
  25. package/lib/src/legacy/components/inputs/index.d.ts +0 -2
  26. package/package.json +2 -2
  27. package/src/components/forms/date/datePicker/DatePicker.mdx +41 -0
  28. package/src/components/forms/date/datePicker/DatePicker.stories.tsx +307 -0
  29. package/src/components/forms/date/datePicker/DatePicker.tsx +68 -0
  30. package/src/components/forms/date/datePicker/contants.ts +22 -0
  31. package/src/components/forms/date/datePicker/styles/DatePicker.scss +85 -0
  32. package/src/components/forms/date/datePicker/types.ts +59 -0
  33. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.mdx +17 -0
  34. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.stories.tsx +201 -0
  35. package/src/components/forms/date/iconTriggerDatePicker/IconTriggerDatePicker.tsx +89 -0
  36. package/src/components/forms/date/iconTriggerDatePicker/index.ts +1 -0
  37. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.mdx +18 -0
  38. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.stories.tsx +208 -0
  39. package/src/components/forms/date/inputDatePicker/SingleInputDatePicker.tsx +117 -0
  40. package/src/components/forms/date/inputDatePicker/index.ts +1 -0
  41. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.mdx +18 -0
  42. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.stories.tsx +208 -0
  43. package/src/components/forms/date/inputDateRangePicker/InputDateRangePicker.tsx +117 -0
  44. package/src/components/forms/date/inputDateRangePicker/index.ts +1 -0
  45. package/src/components/forms/input/Input.tsx +3 -0
  46. package/src/components/index.ts +3 -0
  47. package/src/index.ts +3 -2
  48. package/src/legacy/components/index.ts +0 -2
  49. package/src/legacy/components/inputs/index.ts +0 -2
  50. package/src/styles/index.scss +2 -1
  51. package/lib/src/legacy/components/inputs/DatePicker/DatePicker.d.ts +0 -15
  52. package/lib/src/legacy/components/inputs/DatePicker/DatePicker.stories.d.ts +0 -6
  53. package/lib/src/legacy/components/inputs/DatePicker/DatePicker.styles.d.ts +0 -1
  54. package/lib/src/legacy/components/inputs/DatePicker/index.d.ts +0 -1
  55. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.d.ts +0 -21
  56. package/lib/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.stories.d.ts +0 -7
  57. package/lib/src/legacy/components/inputs/NoInputDatePicker/index.d.ts +0 -1
  58. package/src/legacy/components/inputs/DatePicker/DatePicker.stories.tsx +0 -30
  59. package/src/legacy/components/inputs/DatePicker/DatePicker.styles.ts +0 -437
  60. package/src/legacy/components/inputs/DatePicker/DatePicker.tsx +0 -165
  61. package/src/legacy/components/inputs/DatePicker/index.ts +0 -1
  62. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.scss +0 -441
  63. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.stories.tsx +0 -52
  64. package/src/legacy/components/inputs/NoInputDatePicker/NoInputDatePicker.tsx +0 -245
  65. package/src/legacy/components/inputs/NoInputDatePicker/index.ts +0 -1
  66. /package/src/{legacy/components/inputs/NoInputDatePicker/__tests__/NoInputDatePicker.test.tsx → components/forms/date/iconTriggerDatePicker/__tests__/IconTriggerDatePicker.test.tsx} +0 -0
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { DatePickerProps } from './types';
3
+ export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { DatePicker } from './DatePicker';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ type Story = StoryObj<typeof DatePicker>;
6
+ export declare const Default: Story;
7
+ export declare const Single: Story;
8
+ export declare const Range: Story;
9
+ export declare const Multi: Story;
@@ -0,0 +1,21 @@
1
+ import { CommonProps } from './types';
2
+ export declare const getCommonProps: (props: CommonProps) => {
3
+ className: string | undefined;
4
+ id: string | undefined;
5
+ month: Date | undefined;
6
+ captionLayout: "label" | "dropdown" | "dropdown-months" | "dropdown-years" | undefined;
7
+ defaultMonth: Date | undefined;
8
+ startMonth: Date | undefined;
9
+ endMonth: Date | undefined;
10
+ components: Partial<import("react-day-picker").CustomComponents> | undefined;
11
+ isDisabled: import("react-day-picker").Matcher | import("react-day-picker").Matcher[] | undefined;
12
+ formatters: Partial<import("react-day-picker").Formatters> | undefined;
13
+ weekStartsOn: 0 | 5 | 2 | 4 | 3 | 1 | 6 | undefined;
14
+ firstWeekContainsDate: 4 | 1 | undefined;
15
+ today: Date | undefined;
16
+ required: any;
17
+ onMonthChange: import("react-day-picker").MonthChangeEventHandler | undefined;
18
+ onNextClick: import("react-day-picker").MonthChangeEventHandler | undefined;
19
+ onPrevClick: import("react-day-picker").MonthChangeEventHandler | undefined;
20
+ onDayClick: import("react-day-picker").DayEventHandler<import("react").MouseEvent<Element, MouseEvent>> | undefined;
21
+ };
@@ -0,0 +1,48 @@
1
+ import { CustomComponents, DateRange, DayEventHandler, Formatters, Matcher, Mode, MonthChangeEventHandler, OnSelectHandler } from 'react-day-picker';
2
+ export interface DatePickerProps {
3
+ selected?: Date | DateRange | undefined;
4
+ onSelect?: OnSelectHandler<Date> | OnSelectHandler<DateRange>;
5
+ mode?: Mode;
6
+ className?: string;
7
+ captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
8
+ id?: string;
9
+ month?: Date;
10
+ defaultMonth?: Date;
11
+ startMonth?: Date | undefined;
12
+ endMonth?: Date;
13
+ components?: Partial<CustomComponents>;
14
+ numberOfMonths?: number;
15
+ isDisabled?: Matcher | Matcher[] | undefined;
16
+ formatters?: Partial<Formatters>;
17
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
18
+ firstWeekContainsDate?: 1 | 4;
19
+ today?: Date;
20
+ isRequired?: any;
21
+ min?: number;
22
+ max?: number;
23
+ onMonthChange?: MonthChangeEventHandler;
24
+ onNextClick?: MonthChangeEventHandler;
25
+ onPrevClick?: MonthChangeEventHandler;
26
+ onDayClick?: DayEventHandler<React.MouseEvent>;
27
+ }
28
+ export interface CommonProps {
29
+ className?: string;
30
+ id?: string;
31
+ month?: Date;
32
+ captionLayout?: 'dropdown' | 'dropdown-months' | 'dropdown-years' | 'label';
33
+ defaultMonth?: Date;
34
+ startMonth?: Date | undefined;
35
+ endMonth?: Date;
36
+ components?: Partial<CustomComponents>;
37
+ numberOfMonths?: number;
38
+ isDisabled?: Matcher | Matcher[] | undefined;
39
+ formatters?: Partial<Formatters>;
40
+ weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | undefined;
41
+ firstWeekContainsDate?: 1 | 4;
42
+ isRequired?: any;
43
+ today?: Date;
44
+ onMonthChange?: MonthChangeEventHandler;
45
+ onNextClick?: MonthChangeEventHandler;
46
+ onPrevClick?: MonthChangeEventHandler;
47
+ onDayClick?: DayEventHandler<React.MouseEvent>;
48
+ }
@@ -0,0 +1,22 @@
1
+ import { DateRange, Mode } from 'react-day-picker';
2
+ import { IconName, IconSizes } from '@/types';
3
+ interface Props {
4
+ mode?: Mode;
5
+ ariaLabel: string;
6
+ disableBeforeDate?: Date;
7
+ disableAfterDate?: Date;
8
+ isDisabled?: boolean;
9
+ id: string;
10
+ label?: string;
11
+ onSelect?: (selected: Date | DateRange | Date[] | undefined) => void;
12
+ month?: Date;
13
+ selected?: Date | DateRange | Date[] | undefined;
14
+ triggerIcon: IconName;
15
+ triggerIconSize: IconSizes;
16
+ isOpen?: boolean;
17
+ clearOnClose?: boolean;
18
+ className?: string;
19
+ 'data-testid'?: string;
20
+ }
21
+ export declare const IconTriggerDatePicker: (props: Props) => import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { IconTriggerDatePicker } from '@/components/forms/date/iconTriggerDatePicker';
3
+ declare const meta: Meta<typeof IconTriggerDatePicker>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof IconTriggerDatePicker>;
6
+ export declare const Default: Story;
@@ -0,0 +1 @@
1
+ export { IconTriggerDatePicker } from './IconTriggerDatePicker';
@@ -0,0 +1,23 @@
1
+ import { IconName } from '@/types';
2
+ import { DateRange } from 'react-day-picker';
3
+ interface SingleInputDatePickerProps {
4
+ ariaLabel: string;
5
+ disableBeforeDate?: Date;
6
+ disableAfterDate?: Date;
7
+ isDisabled?: boolean;
8
+ id?: string;
9
+ label?: string;
10
+ onSelect?: (selected: Date | undefined) => void;
11
+ month?: Date;
12
+ selected?: Date | DateRange | Date[] | undefined;
13
+ isOpen?: boolean;
14
+ clearOnClose?: boolean;
15
+ className?: string;
16
+ inputIconName?: IconName;
17
+ isClearable?: boolean;
18
+ inputPlaceholder?: string;
19
+ errorMessage?: string | undefined;
20
+ 'data-testid'?: string;
21
+ }
22
+ export declare function SingleInputDatePicker(props: SingleInputDatePickerProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { SingleInputDatePicker } from './SingleInputDatePicker';
3
+ declare const meta: Meta<typeof SingleInputDatePicker>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SingleInputDatePicker>;
6
+ export declare const SingleInput: Story;
@@ -0,0 +1 @@
1
+ export { SingleInputDatePicker } from './SingleInputDatePicker';
@@ -0,0 +1,23 @@
1
+ import { IconName } from '@/types';
2
+ import { DateRange } from 'react-day-picker';
3
+ interface InputDateRangePickerProps {
4
+ ariaLabel: string;
5
+ disableBeforeDate?: Date;
6
+ disableAfterDate?: Date;
7
+ isDisabled?: boolean;
8
+ id?: string;
9
+ label?: string;
10
+ onSelect?: (selected: Date | undefined) => void;
11
+ month?: Date;
12
+ selected?: Date | DateRange | Date[] | undefined;
13
+ isOpen?: boolean;
14
+ clearOnClose?: boolean;
15
+ className?: string;
16
+ inputIconName?: IconName;
17
+ isClearable?: boolean;
18
+ inputPlaceholder?: string;
19
+ errorMessage?: string | undefined;
20
+ 'data-testid'?: string;
21
+ }
22
+ export declare function InputDateRangePicker(props: InputDateRangePickerProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { InputDateRangePicker } from './InputDateRangePicker';
3
+ declare const meta: Meta<typeof InputDateRangePicker>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof InputDateRangePicker>;
6
+ export declare const SingleInput: Story;
@@ -0,0 +1 @@
1
+ export { InputDateRangePicker } from './InputDateRangePicker';
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { IconName } from '@/types';
3
3
  import { LabelProps } from '../subcomponents/Label';
4
4
  export interface BaseInputProps {
5
+ id?: string;
5
6
  value?: string | undefined;
6
7
  placeholder?: string;
7
8
  isDisabled?: boolean;
@@ -14,3 +14,6 @@ export { Skeleton } from './skeleton';
14
14
  export { Card } from './card';
15
15
  export { FloatUI } from './floatUI';
16
16
  export { Menu } from './menu';
17
+ export { DatePicker } from './forms/date/datePicker/DatePicker';
18
+ export { IconTriggerDatePicker } from './forms/date/iconTriggerDatePicker';
19
+ export { SingleInputDatePicker } from './forms/date/inputDatePicker';
@@ -2,7 +2,7 @@ import './styles/index.scss';
2
2
  export * from '@floating-ui/react-dom';
3
3
  export { GlobalStyles } from './legacy/styles/globals/index';
4
4
  export { ANIMATION, BREAKPOINT, COLORS, MATH, MEDIA_QUERIES, MARGINS, PADDINGS, SPACING, TYPOGRAPHY, } from './legacy/tokens';
5
- export { AbstractRadio, AbstractRadioGroup, Accordion, BarSpinner, BorderSelect, Button as LegacyButton, CirclePulse, CircleSpinner, ConfirmModal, DatePicker, EditableInput, IconButton, ListTable, LoadingAwareContainer, LoadingList, ModalBase, MultiCombobox, NoInputDatePicker, NumberInput, Pagination, PercentageRing, Radio, RadioGroup, RandomLoadingMessage, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, TextInput, TextTruncate, Toggle, Tooltip, } from './legacy/components';
5
+ export { AbstractRadio, AbstractRadioGroup, Accordion, BarSpinner, BorderSelect, Button as LegacyButton, CirclePulse, CircleSpinner, ConfirmModal, EditableInput, IconButton, ListTable, LoadingAwareContainer, LoadingList, ModalBase, MultiCombobox, NumberInput, Pagination, PercentageRing, Radio, RadioGroup, RandomLoadingMessage, SearchInput, Section, SectionBlock, SectionBody, SectionHeader, SectionTable, Select, Shrug, SingleCombobox, TextInput, TextTruncate, Toggle, Tooltip, } from './legacy/components';
6
6
  export { numberUtils, stringUtils, colorUtils } from './legacy/utils';
7
7
  export { Container, Row, Col } from './components/grid';
8
8
  export { Button } from './components/button';
@@ -15,6 +15,9 @@ export { Toggle as ToggleInput } from './components/forms/toggle';
15
15
  export { Textarea } from './components/forms/textarea';
16
16
  export { PasswordInput } from './components/forms/passwordInput';
17
17
  export { Select as SelectInput } from './components/forms/select';
18
+ export { DatePicker } from './components/forms/date/datePicker/DatePicker';
19
+ export { IconTriggerDatePicker } from './components/forms/date/iconTriggerDatePicker';
20
+ export { SingleInputDatePicker } from './components/forms/date/inputDatePicker';
18
21
  export { Form } from './components/forms/form';
19
22
  export { Skeleton } from './components/skeleton';
20
23
  export { Card } from './components/card';
@@ -2,7 +2,7 @@ export { Accordion } from './Accordion';
2
2
  export { Section, SectionBlock, SectionBody, SectionHeader, SectionTable } from './basic-section';
3
3
  export { Button, IconButton } from './buttons';
4
4
  export { BorderSelect, MultiCombobox, Select, SingleCombobox } from './dropdowns';
5
- export { EditableInput, NumberInput, SearchInput, TextInput, Radio, RadioGroup, AbstractRadio, AbstractRadioGroup, DatePicker, NoInputDatePicker, } from './inputs';
5
+ export { EditableInput, NumberInput, SearchInput, TextInput, Radio, RadioGroup, AbstractRadio, AbstractRadioGroup, } from './inputs';
6
6
  export { BarSpinner, CirclePulse, CircleSpinner, LoadingList, PercentageRing, RandomLoadingMessage, LoadingIndicator, } from './loading-indicators';
7
7
  export { ListTable } from './ListTable';
8
8
  export { Pagination } from './Pagination';
@@ -4,5 +4,3 @@ export { SearchInput } from './SearchInput';
4
4
  export { TextInput } from './TextInput';
5
5
  export { Radio, RadioGroup } from './RadioButtons';
6
6
  export { AbstractRadio, AbstractRadioGroup } from './RadioGroup';
7
- export { DatePicker } from './DatePicker';
8
- export { NoInputDatePicker } from './NoInputDatePicker';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indico-data/design-system",
3
- "version": "2.37.0",
3
+ "version": "2.38.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "lib/index.js",
@@ -49,7 +49,7 @@
49
49
  "prop-types": "^15.8.1",
50
50
  "react-aria-components": "^1.2.1",
51
51
  "react-data-table-component": "^7.6.2",
52
- "react-day-picker": "^8.10.1",
52
+ "react-day-picker": "9.1.3",
53
53
  "react-grid-system": "^8.2.0",
54
54
  "react-hook-form": "^7.52.1",
55
55
  "react-modal": "^3.16.1",
@@ -0,0 +1,41 @@
1
+ import { Canvas, Meta, Controls } from '@storybook/blocks';
2
+ import * as DatePicker from './DatePicker.stories';
3
+ import { Row, Col } from '../../../grid/index';
4
+
5
+ <Meta title="Forms/DatePicker" name="DatePicker" />
6
+
7
+ # DatePicker
8
+ The Date Picker component is wrapped around the library React-Day-Picker and is used to select a date from a calendar. It accepts the props listed below and you can also pass in props from the official library. Full library documentation can be found [here](https://daypicker.dev/).
9
+ <Canvas of={DatePicker.Default} />
10
+ <Controls of={DatePicker.Default} />
11
+
12
+ ## Modes
13
+ This Date Picker comes in various modes, which can be used to select a single date, a range of dates, or multiple dates.
14
+
15
+ <Row>
16
+ <Col sm={12} md={4}>
17
+ ### Single Date
18
+ The default mode of the Date Picker is to select a single date. This mode is used when you only need to select one date.
19
+ <Canvas of={DatePicker.Single} />
20
+ </Col>
21
+ <Col sm={12} md={4}>
22
+ ### Range
23
+ The range mode of the Date Picker is used to select a range of dates. This mode is used when you need to select a start and end date.
24
+ <Canvas of={DatePicker.Range} />
25
+ </Col>
26
+ <Col sm={12} md={4}>
27
+ ### Multiple Dates
28
+ The multiple dates mode of the Date Picker is used to select multiple dates. This mode is used when you need to select multiple dates.
29
+ <Canvas of={DatePicker.Multi} />
30
+ </Col>
31
+ </Row>
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+ ## ToDo
40
+ - Baked in DateTime support.
41
+ - Baked in formatting support.
@@ -0,0 +1,307 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { useArgs } from '@storybook/preview-api';
3
+ import { DatePicker } from './DatePicker';
4
+
5
+ const meta: Meta = {
6
+ title: 'Forms/DatePicker',
7
+ component: DatePicker,
8
+ argTypes: {
9
+ captionLayout: {
10
+ control: 'select',
11
+ options: ['dropdown', 'dropdown-months', 'dropdown-years', 'label'],
12
+ description:
13
+ 'The layout of the caption. Enables you to add or remove the dropdown navigation for months/years',
14
+ table: {
15
+ category: 'Props',
16
+ type: {
17
+ summary: 'dropdown | dropdown-months | dropdown-years | label',
18
+ },
19
+ },
20
+ },
21
+ onSelect: {
22
+ control: false,
23
+ description: 'Event handler when a day is selected.',
24
+ table: {
25
+ category: 'Callbacks',
26
+ type: {
27
+ summary: 'OnSelectHandler<Date> | OnSelectHandler<DateRange>',
28
+ },
29
+ },
30
+ action: 'onSelect',
31
+ },
32
+ selected: {
33
+ control: 'date',
34
+ description: 'The selected day(s).',
35
+ table: {
36
+ category: 'Props',
37
+ type: {
38
+ summary: 'Date | Date[] | DateRange | undefined',
39
+ },
40
+ },
41
+ },
42
+ className: {
43
+ control: false,
44
+ description: 'Accepts a CSS class name',
45
+ table: {
46
+ category: 'Props',
47
+ type: {
48
+ summary: 'string',
49
+ },
50
+ },
51
+ },
52
+ mode: {
53
+ control: 'select',
54
+ options: ['single', 'range', 'multiple'],
55
+ description: 'Allows you to select a single day, a range of days, or multiple days.',
56
+ table: {
57
+ category: 'Props',
58
+ type: {
59
+ summary: 'single | range | multiple',
60
+ },
61
+ },
62
+ defaultValue: { summary: 'single' },
63
+ },
64
+ id: {
65
+ control: false,
66
+ description: 'id',
67
+ table: {
68
+ category: 'Props',
69
+ type: {
70
+ summary: 'string',
71
+ },
72
+ },
73
+ },
74
+ month: {
75
+ control: 'date',
76
+ description: 'The month displayed in the calendar.',
77
+ table: {
78
+ category: 'Props',
79
+ type: {
80
+ summary: 'Date',
81
+ },
82
+ },
83
+ },
84
+ defaultMonth: {
85
+ control: 'date',
86
+ description: 'The initial month to show in the calendar. Default is the current month.',
87
+ table: {
88
+ category: 'Props',
89
+ type: {
90
+ summary: 'Date',
91
+ },
92
+ },
93
+ },
94
+ startMonth: {
95
+ control: 'date',
96
+ description: 'The earliest month to start the navigation.',
97
+ table: {
98
+ category: 'Props',
99
+ type: {
100
+ summary: 'Date',
101
+ },
102
+ },
103
+ },
104
+ endMonth: {
105
+ control: 'date',
106
+ description: 'The latest month to end the navigation.',
107
+ table: {
108
+ category: 'Props',
109
+ type: {
110
+ summary: 'Date',
111
+ },
112
+ },
113
+ },
114
+ components: {
115
+ control: false,
116
+ description:
117
+ 'Components you can pass to the DayPicker to override defaults [Full Components Documentation](https://daypicker.dev/guides/custom-components)',
118
+ table: {
119
+ category: 'Props',
120
+ type: {
121
+ summary: 'React.Node',
122
+ },
123
+ },
124
+ },
125
+ numberOfMonths: {
126
+ control: 'number',
127
+ description: 'The number of displayed months. Default is 1.',
128
+ table: {
129
+ category: 'Props',
130
+ type: {
131
+ summary: 'number',
132
+ },
133
+ },
134
+ },
135
+ isDisabled: {
136
+ control: 'boolean',
137
+ description: 'Disables selecton, more info [here](https://daypicker.dev/guides/disabled)',
138
+ table: {
139
+ category: 'Props',
140
+ type: {
141
+ summary: 'Matcher | Matcher[]',
142
+ },
143
+ },
144
+ },
145
+ formatters: {
146
+ control: false,
147
+ description:
148
+ 'Use the formatters prop to customize the formatting of dates, week numbers, day names, and more. [Full Formatters Documentation](https://daypicker.dev/guides/formatters)',
149
+ table: {
150
+ category: 'Props',
151
+ type: {
152
+ summary: 'Formatters',
153
+ },
154
+ },
155
+ },
156
+ weekStartsOn: {
157
+ control: 'select',
158
+ options: [0, 1, 2, 3, 4, 5, 6],
159
+ description:
160
+ "The index of the first day of the week (0 - Sunday). Overrides the locale's one.",
161
+ table: {
162
+ category: 'Props',
163
+ type: {
164
+ summary: '0 | 1 | 2 | 3 | 4 | 5 | 6',
165
+ },
166
+ },
167
+ },
168
+ firstWeekContainsDate: {
169
+ control: 'date',
170
+ description:
171
+ "The firstWeekContainsDate prop sets the first day of the year's initial week, which is used to calculate week numbers. Acceptable values are 1 for Monday and 4 for Thursday.",
172
+ table: {
173
+ category: 'Props',
174
+ type: {
175
+ summary: '1 | 4',
176
+ },
177
+ },
178
+ },
179
+ today: {
180
+ control: 'date',
181
+ description:
182
+ 'The today’s date. Default is the current date. This date will get the today modifier to style the day.',
183
+ table: {
184
+ category: 'Props',
185
+ type: {
186
+ summary: 'Date',
187
+ },
188
+ },
189
+ },
190
+ isRequired: {
191
+ control: 'boolean',
192
+ description: 'When true, the selection is required.',
193
+ table: {
194
+ category: 'Props',
195
+ type: {
196
+ summary: 'boolean',
197
+ },
198
+ },
199
+ },
200
+ onMonthChange: {
201
+ control: false,
202
+ description: 'Callback when the month changes.',
203
+ table: {
204
+ category: 'Callbacks',
205
+ type: {
206
+ summary: 'OnMonthChangeHandler',
207
+ },
208
+ },
209
+ },
210
+ onNextClick: {
211
+ control: false,
212
+
213
+ description: 'Callback when the next month is clicked.',
214
+ table: {
215
+ category: 'Callbacks',
216
+ type: {
217
+ summary: 'OnNextClickHandler',
218
+ },
219
+ },
220
+ },
221
+ onPrevClick: {
222
+ control: false,
223
+ description: 'Callback when the previous month is clicked.',
224
+ table: {
225
+ category: 'Callbacks',
226
+ type: {
227
+ summary: 'OnPrevClickHandler',
228
+ },
229
+ },
230
+ },
231
+ onDayClick: {
232
+ control: false,
233
+ description: 'Callback when a day is clicked.',
234
+ table: {
235
+ category: 'Callbacks',
236
+ type: {
237
+ summary: 'OnDayClickHandler',
238
+ },
239
+ },
240
+ },
241
+ },
242
+ };
243
+
244
+ export default meta;
245
+
246
+ type Story = StoryObj<typeof DatePicker>;
247
+ export const Default: Story = {
248
+ args: {
249
+ numberOfMonths: 1,
250
+ isRequired: false,
251
+ isDisabled: false,
252
+ },
253
+ render: (args) => {
254
+ const [{ selected }, updateArgs] = useArgs();
255
+ const handleSelect = (date: Date) => {
256
+ updateArgs({ selected: date });
257
+ };
258
+ return <DatePicker {...args} selected={selected} onSelect={handleSelect} />;
259
+ },
260
+ };
261
+
262
+ export const Single: Story = {
263
+ args: {
264
+ numberOfMonths: 1,
265
+ isRequired: false,
266
+ isDisabled: false,
267
+ mode: 'single',
268
+ },
269
+ render: (args) => {
270
+ const [{ selected }, updateArgs] = useArgs();
271
+ const handleSelect = (date: Date) => {
272
+ updateArgs({ selected: date });
273
+ };
274
+ return <DatePicker {...args} selected={selected} onSelect={handleSelect} />;
275
+ },
276
+ };
277
+
278
+ export const Range: Story = {
279
+ args: {
280
+ isRequired: false,
281
+ isDisabled: false,
282
+ mode: 'range',
283
+ },
284
+ render: (args) => {
285
+ const [{ selected }, updateArgs] = useArgs();
286
+ const handleSelect = (date: Date) => {
287
+ updateArgs({ selected: date });
288
+ };
289
+ return <DatePicker {...args} selected={selected} onSelect={handleSelect} />;
290
+ },
291
+ };
292
+
293
+ export const Multi: Story = {
294
+ args: {
295
+ numberOfMonths: 1,
296
+ isRequired: false,
297
+ isDisabled: false,
298
+ mode: 'multiple',
299
+ },
300
+ render: (args) => {
301
+ const [{ selected }, updateArgs] = useArgs();
302
+ const handleSelect = (date: Date) => {
303
+ updateArgs({ selected: date });
304
+ };
305
+ return <DatePicker {...args} selected={selected} onSelect={handleSelect} />;
306
+ },
307
+ };