@atlaskit/datetime-picker 17.9.5 → 18.0.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/CHANGELOG.md +32 -0
- package/__tests__/playwright/top-layer-focus.spec.tsx +85 -0
- package/date-picker/package.json +1 -8
- package/date-time-picker/package.json +1 -8
- package/dist/cjs/components/date-picker.js +1 -1
- package/dist/cjs/components/date-time-picker.js +1 -1
- package/dist/cjs/components/time-picker.js +1 -1
- package/dist/es2019/components/date-picker.js +1 -1
- package/dist/es2019/components/date-time-picker.js +1 -1
- package/dist/es2019/components/time-picker.js +1 -1
- package/dist/esm/components/date-picker.js +1 -1
- package/dist/esm/components/date-time-picker.js +1 -1
- package/dist/esm/components/time-picker.js +1 -1
- package/package.json +27 -35
- package/time-picker/package.json +1 -8
- package/types/package.json +1 -8
- package/dist/types-ts4.5/components/date-picker.d.ts +0 -19
- package/dist/types-ts4.5/components/date-time-picker.d.ts +0 -15
- package/dist/types-ts4.5/components/time-picker.d.ts +0 -13
- package/dist/types-ts4.5/entry-points/date-picker.d.ts +0 -2
- package/dist/types-ts4.5/entry-points/date-time-picker.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/time-picker.d.ts +0 -1
- package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
- package/dist/types-ts4.5/index.d.ts +0 -4
- package/dist/types-ts4.5/internal/convert-to24hr-time.d.ts +0 -7
- package/dist/types-ts4.5/internal/date-time-picker-container.d.ts +0 -19
- package/dist/types-ts4.5/internal/default-date-format.d.ts +0 -1
- package/dist/types-ts4.5/internal/default-times.d.ts +0 -1
- package/dist/types-ts4.5/internal/empty-component.d.ts +0 -4
- package/dist/types-ts4.5/internal/ff-component.d.ts +0 -34
- package/dist/types-ts4.5/internal/fixed-layer-menu-top-layer.d.ts +0 -12
- package/dist/types-ts4.5/internal/fixed-layer-menu.d.ts +0 -5
- package/dist/types-ts4.5/internal/fixed-layer.d.ts +0 -37
- package/dist/types-ts4.5/internal/format-date-time-zone-into-iso.d.ts +0 -4
- package/dist/types-ts4.5/internal/format-date.d.ts +0 -23
- package/dist/types-ts4.5/internal/get-parsed-iso.d.ts +0 -20
- package/dist/types-ts4.5/internal/get-placeholder.d.ts +0 -22
- package/dist/types-ts4.5/internal/get-safe-calendar-value.d.ts +0 -1
- package/dist/types-ts4.5/internal/get-short-iso-string.d.ts +0 -1
- package/dist/types-ts4.5/internal/indicators-container.d.ts +0 -8
- package/dist/types-ts4.5/internal/is-date-disabled.d.ts +0 -20
- package/dist/types-ts4.5/internal/is-valid.d.ts +0 -1
- package/dist/types-ts4.5/internal/menu-top-layer.d.ts +0 -16
- package/dist/types-ts4.5/internal/menu.d.ts +0 -9
- package/dist/types-ts4.5/internal/pad-two.d.ts +0 -1
- package/dist/types-ts4.5/internal/parse-date.d.ts +0 -29
- package/dist/types-ts4.5/internal/parse-time.d.ts +0 -1
- package/dist/types-ts4.5/internal/parse-tokens.d.ts +0 -1
- package/dist/types-ts4.5/internal/placeholder-date-time.d.ts +0 -1
- package/dist/types-ts4.5/internal/remove-spacer.d.ts +0 -1
- package/dist/types-ts4.5/internal/single-value.d.ts +0 -10
- package/dist/types-ts4.5/types.d.ts +0 -530
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
-
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
-
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
-
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
-
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
-
* so, thank you!
|
|
8
|
-
*
|
|
9
|
-
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
-
* be read from within the component at the end of the day. But because we are
|
|
11
|
-
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
-
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
-
* and instead use internal variables.
|
|
14
|
-
*
|
|
15
|
-
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
-
* broken out to be it's own function.
|
|
17
|
-
*/
|
|
18
|
-
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
-
export declare const getPlaceholder: (di: {
|
|
20
|
-
placeholder: string | undefined;
|
|
21
|
-
l10n: LocalizationProvider;
|
|
22
|
-
}) => string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getSafeCalendarValue(calendarValue: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getShortISOString(date: Date): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { type IndicatorsContainerProps } from '@atlaskit/select';
|
|
6
|
-
export declare const IndicatorsContainer: ({ showClearIndicator, ...rest }: IndicatorsContainerProps<any> & {
|
|
7
|
-
showClearIndicator?: boolean;
|
|
8
|
-
}) => JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
-
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
-
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
-
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
-
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
-
* so, thank you!
|
|
8
|
-
*
|
|
9
|
-
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
-
* be read from within the component at the end of the day. But because we are
|
|
11
|
-
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
-
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
-
* and instead use internal variables.
|
|
14
|
-
*
|
|
15
|
-
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
-
* broken out to be it's own function.
|
|
17
|
-
*/
|
|
18
|
-
export declare const isDateDisabled: (date: string, di: {
|
|
19
|
-
disabled: string[];
|
|
20
|
-
}) => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isValid(timeString: string): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
import { type MenuProps, type OptionType } from '@atlaskit/select';
|
|
6
|
-
/**
|
|
7
|
-
* Top-layer version of the date picker menu.
|
|
8
|
-
*
|
|
9
|
-
* Uses `Popover` + `useAnchorPosition` so the calendar renders in the
|
|
10
|
-
* browser's top layer via the native Popover API and is positioned via
|
|
11
|
-
* CSS Anchor Positioning. This avoids overflow clipping, z-index wars,
|
|
12
|
-
* and portal-based layering.
|
|
13
|
-
*
|
|
14
|
-
* Gated behind the `platform-dst-top-layer` feature flag.
|
|
15
|
-
*/
|
|
16
|
-
export declare const MenuTopLayer: ({ selectProps, innerProps }: MenuProps<OptionType>) => JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function padToTwo(number: number): string;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Everything in this file is to smooth out the migration of the new date picker
|
|
3
|
-
* (https://product-fabric.atlassian.net/browse/DSP-20682). When that ticket is
|
|
4
|
-
* complete, all of these functions will ilkely be merged back into the date
|
|
5
|
-
* picker. Please do not pre-optimize and put these back into the date picker
|
|
6
|
-
* unless you are working on the DTP Refresh and you have a good reason to do
|
|
7
|
-
* so, thank you!
|
|
8
|
-
*
|
|
9
|
-
* All variables within the `di` objects are dependency injections. They should
|
|
10
|
-
* be read from within the component at the end of the day. But because we are
|
|
11
|
-
* extracting them, we have to inject them in every place manually. When we
|
|
12
|
-
* re-introduce them to the components, we can likely remove the `di` variables
|
|
13
|
-
* and instead use internal variables.
|
|
14
|
-
*
|
|
15
|
-
* If component _only_ has injected variables, it is fully internal and was
|
|
16
|
-
* broken out to be it's own function.
|
|
17
|
-
*/
|
|
18
|
-
import { type LocalizationProvider } from '@atlaskit/locale';
|
|
19
|
-
/**
|
|
20
|
-
* There are two props that can change how the date is parsed.
|
|
21
|
-
* The priority of props used is:
|
|
22
|
-
* 1. `parseInputValue`
|
|
23
|
-
* 2. `locale`
|
|
24
|
-
*/
|
|
25
|
-
export declare const parseDate: (date: string, di: {
|
|
26
|
-
parseInputValue: ((date: string, dateFormat: string) => Date) | undefined;
|
|
27
|
-
dateFormat: string | undefined;
|
|
28
|
-
l10n: LocalizationProvider;
|
|
29
|
-
}) => Date;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function parseTime(time: string): string | Date;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function convertTokens(format: string): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const placeholderDatetime: Date;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function removeSpacer(time: string): string;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type OptionType, type SingleValueProps } from '@atlaskit/select';
|
|
3
|
-
/**
|
|
4
|
-
* This creates a functional component that `react-select` will use to make the
|
|
5
|
-
* SingleValue part of the different pickers.
|
|
6
|
-
*/
|
|
7
|
-
export declare const makeSingleValue: ({ id, lang }: {
|
|
8
|
-
id?: string;
|
|
9
|
-
lang: string;
|
|
10
|
-
}) => ({ children, className, clearValue, cx, data, getStyles, getValue, hasValue, isDisabled, isMulti, isRtl, options, selectOption, selectProps, setValue, ...rest }: SingleValueProps<OptionType, false>) => React.JSX.Element;
|
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
2
|
-
import { type DropdownIndicatorProps, type OptionType, type SelectProps } from '@atlaskit/select';
|
|
3
|
-
export type Appearance = 'default' | 'subtle' | 'none';
|
|
4
|
-
export type Spacing = 'compact' | 'default';
|
|
5
|
-
type Combine<First, Second> = Omit<First, keyof Second> & Second;
|
|
6
|
-
/**
|
|
7
|
-
* Props to apply to the select. These include all of [the props from our
|
|
8
|
-
* `Select` component](/components/select). For the following properties, use
|
|
9
|
-
* the top-level prop alternatives:
|
|
10
|
-
*
|
|
11
|
-
* - `aria-describedby`, use `aria-describedby` prop
|
|
12
|
-
* - `aria-label`, use `label` prop
|
|
13
|
-
* - `inputId`, use `id` prop
|
|
14
|
-
* - `placeholder`, use `placeholder` prop
|
|
15
|
-
*
|
|
16
|
-
* Example:
|
|
17
|
-
*
|
|
18
|
-
* ```tsx
|
|
19
|
-
* // Don't do this
|
|
20
|
-
* <DatePicker selectProps={{
|
|
21
|
-
* 'aria-describedby': 'helper-id'
|
|
22
|
-
* }} />
|
|
23
|
-
*
|
|
24
|
-
* // Do this
|
|
25
|
-
* <DatePicker aria-describedby="helper-id" />
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export type DateTimePickerSelectProps = Combine<SelectProps<OptionType>, {
|
|
29
|
-
/**
|
|
30
|
-
* Use the `aria-describedby` prop on the picker..
|
|
31
|
-
*/
|
|
32
|
-
'aria-describedby'?: never;
|
|
33
|
-
/**
|
|
34
|
-
* Use the `label` prop on the picker..
|
|
35
|
-
*/
|
|
36
|
-
'aria-label'?: never;
|
|
37
|
-
/**
|
|
38
|
-
* Use the `id` prop on the picker.`.
|
|
39
|
-
*/
|
|
40
|
-
inputId?: never;
|
|
41
|
-
/**
|
|
42
|
-
* Use the `placeholder` prop on the picker.
|
|
43
|
-
*/
|
|
44
|
-
placeholder?: never;
|
|
45
|
-
}>;
|
|
46
|
-
interface PickerSelectProps {
|
|
47
|
-
selectProps?: DateTimePickerSelectProps;
|
|
48
|
-
}
|
|
49
|
-
export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSelectProps {
|
|
50
|
-
/**
|
|
51
|
-
* Set the appearance of the picker.
|
|
52
|
-
* `subtle` will remove the borders, background, and icon.
|
|
53
|
-
* **NOTE:** Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
54
|
-
*
|
|
55
|
-
* @deprecated
|
|
56
|
-
*/
|
|
57
|
-
appearance?: Appearance;
|
|
58
|
-
/**
|
|
59
|
-
* Used to associate accessible descriptions to the date picker.
|
|
60
|
-
*/
|
|
61
|
-
'aria-describedby'?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Set the picker to autofocus on mount.
|
|
64
|
-
*/
|
|
65
|
-
autoFocus?: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Set the `aria-label` for the clear button.
|
|
68
|
-
* Add the word "Clear" at the beginning of the clearControlLabel.
|
|
69
|
-
* For instance, for a field to set an appointment, use "Clear appointment date and time".
|
|
70
|
-
*/
|
|
71
|
-
clearControlLabel?: string;
|
|
72
|
-
/**
|
|
73
|
-
* The default for `isOpen`. Will be `false` if not provided.
|
|
74
|
-
*
|
|
75
|
-
* @deprecated
|
|
76
|
-
*/
|
|
77
|
-
defaultIsOpen?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* The default for `value`.
|
|
80
|
-
*/
|
|
81
|
-
defaultValue?: string;
|
|
82
|
-
/**
|
|
83
|
-
* An array of ISO dates that should be disabled on the calendar. This does not affect what users can type into the picker.
|
|
84
|
-
*/
|
|
85
|
-
disabled?: string[];
|
|
86
|
-
/**
|
|
87
|
-
* A filter function for disabling dates on the calendar. This does not affect what users can type into the picker.
|
|
88
|
-
*
|
|
89
|
-
* The function is called with a date string in the format `YYYY-MM-DD` and should return `true` if the date should be disabled.
|
|
90
|
-
*/
|
|
91
|
-
disabledDateFilter?: (date: string) => boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Accessible name for the Date Picker Select, rendered as `aria-label`. This will override any other method of providing a label.
|
|
94
|
-
*/
|
|
95
|
-
label?: string;
|
|
96
|
-
/**
|
|
97
|
-
* The latest enabled date. Dates after this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
98
|
-
*/
|
|
99
|
-
maxDate?: string;
|
|
100
|
-
/**
|
|
101
|
-
* The earliest enabled date. Dates before this are disabled on the calendar. This does not affect what users can type into the picker.
|
|
102
|
-
*/
|
|
103
|
-
minDate?: string;
|
|
104
|
-
/**
|
|
105
|
-
* The icon shown in the picker.
|
|
106
|
-
*
|
|
107
|
-
* @deprecated
|
|
108
|
-
*/
|
|
109
|
-
icon?: React.ComponentType<DropdownIndicatorProps<OptionType>>;
|
|
110
|
-
/**
|
|
111
|
-
* Set the id of the field.
|
|
112
|
-
* Associates a `<label></label>` with the field.
|
|
113
|
-
*/
|
|
114
|
-
id?: string;
|
|
115
|
-
/**
|
|
116
|
-
* Props to apply to the container.
|
|
117
|
-
*
|
|
118
|
-
* @deprecated If you are looking to set your width, use a `Box` from
|
|
119
|
-
* `@atlaskit/primitives` around the picker to achieve the same effect.
|
|
120
|
-
*/
|
|
121
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
122
|
-
/**
|
|
123
|
-
* Set if the picker is disabled.
|
|
124
|
-
*/
|
|
125
|
-
isDisabled?: boolean;
|
|
126
|
-
/**
|
|
127
|
-
* Set if the picker is open.
|
|
128
|
-
*/
|
|
129
|
-
isOpen?: boolean;
|
|
130
|
-
/**
|
|
131
|
-
* Set the field as required.
|
|
132
|
-
*/
|
|
133
|
-
isRequired?: boolean;
|
|
134
|
-
/**
|
|
135
|
-
* The name of the field.
|
|
136
|
-
*/
|
|
137
|
-
name?: string;
|
|
138
|
-
/**
|
|
139
|
-
* The aria-label attribute associated with the next-month arrow.
|
|
140
|
-
*/
|
|
141
|
-
nextMonthLabel?: string;
|
|
142
|
-
/**
|
|
143
|
-
* Called when the field is blurred.
|
|
144
|
-
*/
|
|
145
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
146
|
-
/**
|
|
147
|
-
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
148
|
-
*/
|
|
149
|
-
onChange?: (value: string) => void;
|
|
150
|
-
/**
|
|
151
|
-
* Called when the field is focused.
|
|
152
|
-
*/
|
|
153
|
-
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
154
|
-
/**
|
|
155
|
-
* The name of the input, used when `shouldShowCalendarButton` is true. See `shouldShowCalendarButton` description for more details.
|
|
156
|
-
*
|
|
157
|
-
* @default 'Date picker'
|
|
158
|
-
*/
|
|
159
|
-
inputLabel?: string;
|
|
160
|
-
/**
|
|
161
|
-
* The ID of the label for the input, used when `shouldShowCalendarButton` is
|
|
162
|
-
* true. See `shouldShowCalendarButton` description for more details.
|
|
163
|
-
*/
|
|
164
|
-
inputLabelId?: string;
|
|
165
|
-
/**
|
|
166
|
-
* The label associated with the button to open the calendar, rendered via the
|
|
167
|
-
* `shouldShowCalendarButton` prop. If a `label` prop is provided, this
|
|
168
|
-
* calendar button label will be prefixed by the value of `label`. If no
|
|
169
|
-
* `label` prop is provided, this prefix should be manually added. For
|
|
170
|
-
* example,
|
|
171
|
-
*
|
|
172
|
-
* ```tsx
|
|
173
|
-
* <label id="label" htmlFor="datepicker">Desired Appointment Date</label>
|
|
174
|
-
* <DatePicker
|
|
175
|
-
* id="datepicker"
|
|
176
|
-
* shouldShowCalendarButton
|
|
177
|
-
* inputLabel="Desired Appointment Date"
|
|
178
|
-
* openCalendarLabel="open calendar"
|
|
179
|
-
* />
|
|
180
|
-
* ```
|
|
181
|
-
*
|
|
182
|
-
* @default 'open calendar'
|
|
183
|
-
*/
|
|
184
|
-
openCalendarLabel?: string;
|
|
185
|
-
/**
|
|
186
|
-
* A function for parsing input characters and transforming them into a Date object.
|
|
187
|
-
* By default parses the date string based off the locale. Note that this does
|
|
188
|
-
* not affect how the resulting value is displayed in the input. Use the
|
|
189
|
-
* `dateFormat` or `formatDisplayLabel` prop to handle how the value is
|
|
190
|
-
* displayed.
|
|
191
|
-
*/
|
|
192
|
-
parseInputValue?: (date: string, dateFormat: string) => Date;
|
|
193
|
-
/**
|
|
194
|
-
* A function for formatting the date displayed in the input. By default composes together [`date-fns`'s parse method](https://date-fns.org/v1.29.0/docs/parse) and [`date-fns`'s format method](https://date-fns.org/v1.29.0/docs/format) to return a correctly formatted date string.
|
|
195
|
-
*
|
|
196
|
-
* Note that this does not affect how the input is parsed. This must be done using the `parseInputValue` prop.
|
|
197
|
-
*/
|
|
198
|
-
formatDisplayLabel?: (value: string, dateFormat: string) => string;
|
|
199
|
-
/**
|
|
200
|
-
* The aria-label attribute associated with the previous-month arrow.
|
|
201
|
-
*/
|
|
202
|
-
previousMonthLabel?: string;
|
|
203
|
-
/**
|
|
204
|
-
* Provides a functional calendar button that opens the calendar picker that
|
|
205
|
-
* lives on the right side of the date picker.
|
|
206
|
-
*
|
|
207
|
-
* The accessible name for this button is caculated using either the `label`,
|
|
208
|
-
* `inputLabel`, or `inputLabelId` props, along with the `openCalendarLabel`
|
|
209
|
-
* prop.
|
|
210
|
-
*
|
|
211
|
-
* @default false
|
|
212
|
-
*/
|
|
213
|
-
shouldShowCalendarButton?: boolean;
|
|
214
|
-
/**
|
|
215
|
-
* The spacing for the select control.
|
|
216
|
-
*
|
|
217
|
-
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
218
|
-
*/
|
|
219
|
-
spacing?: Spacing;
|
|
220
|
-
/**
|
|
221
|
-
* The ISO time used as the input value.
|
|
222
|
-
*/
|
|
223
|
-
value?: string;
|
|
224
|
-
/**
|
|
225
|
-
* Set if the picker has an invalid value.
|
|
226
|
-
*/
|
|
227
|
-
isInvalid?: boolean;
|
|
228
|
-
/**
|
|
229
|
-
* Hides icon for dropdown indicator.
|
|
230
|
-
*
|
|
231
|
-
* @deprecated
|
|
232
|
-
*/
|
|
233
|
-
hideIcon?: boolean;
|
|
234
|
-
/**
|
|
235
|
-
* Format the date with a string that is accepted by [date-fns's format
|
|
236
|
-
* function](https://date-fns.org/v1.29.0/docs/format). **This does not affect
|
|
237
|
-
* how the input is parsed.** This must be done using the `parseInputValue`
|
|
238
|
-
* prop.
|
|
239
|
-
*
|
|
240
|
-
* Note that though we are using `date-fns` version 2, we use [the tokens from
|
|
241
|
-
* `date-fns` version 1](https://date-fns.org/v1.30.1/docs/format) under the
|
|
242
|
-
* hood.
|
|
243
|
-
*/
|
|
244
|
-
dateFormat?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Placeholder text displayed in input.
|
|
247
|
-
*/
|
|
248
|
-
placeholder?: string;
|
|
249
|
-
/**
|
|
250
|
-
* Locale used to format the date and calendar. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
251
|
-
*/
|
|
252
|
-
locale?: string;
|
|
253
|
-
/**
|
|
254
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
255
|
-
* - `{testId}--container` wrapping element of date-picker
|
|
256
|
-
* - `{testId}--calendar--container` nested calendar component
|
|
257
|
-
*/
|
|
258
|
-
testId?: string;
|
|
259
|
-
/**
|
|
260
|
-
* Start day of the week for the calendar.
|
|
261
|
-
* - `0` sunday (default value)
|
|
262
|
-
* - `1` monday
|
|
263
|
-
* - `2` tuesday
|
|
264
|
-
* - `3` wednesday
|
|
265
|
-
* - `4` thursday
|
|
266
|
-
* - `5` friday
|
|
267
|
-
* - `6` saturday
|
|
268
|
-
*/
|
|
269
|
-
weekStartDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
270
|
-
/**
|
|
271
|
-
* This overrides the inner wrapper the Calendar.
|
|
272
|
-
* @private Please use this with extreme caution, this API may be changed in the future.
|
|
273
|
-
*/
|
|
274
|
-
menuInnerWrapper?: React.ComponentType<{
|
|
275
|
-
children: React.ReactNode;
|
|
276
|
-
}>;
|
|
277
|
-
}
|
|
278
|
-
export interface TimePickerBaseProps extends WithAnalyticsEventsProps, PickerSelectProps {
|
|
279
|
-
/**
|
|
280
|
-
* Set the appearance of the picker.
|
|
281
|
-
* `subtle` will remove the borders, background, and icon.
|
|
282
|
-
*
|
|
283
|
-
* __NOTE:__ Appearance values will be ignored if styles are parsed through `selectProps`.
|
|
284
|
-
*
|
|
285
|
-
* @deprecated
|
|
286
|
-
*/
|
|
287
|
-
appearance?: Appearance;
|
|
288
|
-
/**
|
|
289
|
-
* Used to associate accessible descriptions to the time picker.
|
|
290
|
-
*/
|
|
291
|
-
'aria-describedby'?: string;
|
|
292
|
-
/**
|
|
293
|
-
* Set the picker to autofocus on mount.
|
|
294
|
-
*/
|
|
295
|
-
autoFocus?: boolean;
|
|
296
|
-
/**
|
|
297
|
-
* Set the `aria-label` for the clear button.
|
|
298
|
-
* Add the word "Clear" at the beginning of the clearControlLabel.
|
|
299
|
-
* For instance, for a field to set an appointment, use "Clear appointment date and time".
|
|
300
|
-
*/
|
|
301
|
-
clearControlLabel?: string;
|
|
302
|
-
/**
|
|
303
|
-
* The default for `isOpen`.
|
|
304
|
-
*
|
|
305
|
-
* @deprecated
|
|
306
|
-
*/
|
|
307
|
-
defaultIsOpen?: boolean;
|
|
308
|
-
/**
|
|
309
|
-
* The default for `value`.
|
|
310
|
-
*/
|
|
311
|
-
defaultValue?: string;
|
|
312
|
-
/**
|
|
313
|
-
* A function for formatting the displayed time value in the input. By default
|
|
314
|
-
* parses with an internal time parser, and formats using the [date-fns format
|
|
315
|
-
* function]((https://date-fns.org/v1.29.0/docs/format)).
|
|
316
|
-
*
|
|
317
|
-
* Note that this does not affect how the input is parsed. This must be done
|
|
318
|
-
* using the `parseInputValue` prop.
|
|
319
|
-
*/
|
|
320
|
-
formatDisplayLabel?: (time: string, timeFormat: string) => string;
|
|
321
|
-
/**
|
|
322
|
-
* Set the id of the field.
|
|
323
|
-
* Associates a `<label></label>` with the field.
|
|
324
|
-
*/
|
|
325
|
-
id?: string;
|
|
326
|
-
/**
|
|
327
|
-
* Props to apply to the container.
|
|
328
|
-
*
|
|
329
|
-
* @deprecated If you are looking to set your width, use a `Box` from
|
|
330
|
-
* `@atlaskit/primitives` around the picker to achieve the same effect.
|
|
331
|
-
*/
|
|
332
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
333
|
-
/**
|
|
334
|
-
* Set if the field is disabled.
|
|
335
|
-
*/
|
|
336
|
-
isDisabled?: boolean;
|
|
337
|
-
/**
|
|
338
|
-
* Set if the dropdown is open. Will be `false` if not provided.
|
|
339
|
-
*/
|
|
340
|
-
isOpen?: boolean;
|
|
341
|
-
/**
|
|
342
|
-
* Set the field as required.
|
|
343
|
-
*/
|
|
344
|
-
isRequired?: boolean;
|
|
345
|
-
/**
|
|
346
|
-
* Accessible name for the Time Picker Select, rendered as `aria-label`. This will override any other method of providing a label.
|
|
347
|
-
*/
|
|
348
|
-
label?: string;
|
|
349
|
-
/**
|
|
350
|
-
* The name of the field.
|
|
351
|
-
*/
|
|
352
|
-
name?: string;
|
|
353
|
-
/**
|
|
354
|
-
* Called when the field is blurred.
|
|
355
|
-
*/
|
|
356
|
-
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
357
|
-
/**
|
|
358
|
-
* Called when the value changes. The only argument is an ISO time or empty string.
|
|
359
|
-
*/
|
|
360
|
-
onChange?: (value: string) => void;
|
|
361
|
-
/**
|
|
362
|
-
* Called when the field is focused.
|
|
363
|
-
*/
|
|
364
|
-
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
365
|
-
/**
|
|
366
|
-
* A function for parsing input characters and transforming them into either a
|
|
367
|
-
* string or a Date object. By default parses the string based off the locale.
|
|
368
|
-
* Note that this does not affect how the resulting value is displayed in the
|
|
369
|
-
* input. To handle this, use either the `timeFormat` or `formatDisplayLabel`
|
|
370
|
-
* prop.
|
|
371
|
-
*/
|
|
372
|
-
parseInputValue?: (time: string, timeFormat: string) => string | Date;
|
|
373
|
-
/**
|
|
374
|
-
* The spacing for the select control.
|
|
375
|
-
*
|
|
376
|
-
* Compact is `gridSize() * 4`, default is `gridSize * 5`.
|
|
377
|
-
*/
|
|
378
|
-
spacing?: Spacing;
|
|
379
|
-
/**
|
|
380
|
-
* The times shown in the dropdown.
|
|
381
|
-
*/
|
|
382
|
-
times?: string[];
|
|
383
|
-
/**
|
|
384
|
-
* Set if users can edit the input, allowing them to add custom times.
|
|
385
|
-
*/
|
|
386
|
-
timeIsEditable?: boolean;
|
|
387
|
-
/**
|
|
388
|
-
* The ISO time that should be used as the input value.
|
|
389
|
-
*/
|
|
390
|
-
value?: string;
|
|
391
|
-
/**
|
|
392
|
-
* Set if the picker has an invalid value.
|
|
393
|
-
*/
|
|
394
|
-
isInvalid?: boolean;
|
|
395
|
-
/**
|
|
396
|
-
* Hides icon for dropdown indicator.
|
|
397
|
-
*/
|
|
398
|
-
hideIcon?: boolean;
|
|
399
|
-
/**
|
|
400
|
-
* Format the time with a string that is accepted by [date-fns's format
|
|
401
|
-
* function](https://date-fns.org/v1.29.0/docs/format). **This does not affect
|
|
402
|
-
* how the input is parsed.** This must be done using the `parseInputValue`
|
|
403
|
-
* prop.
|
|
404
|
-
*
|
|
405
|
-
* Note that though we are using `date-fns` version 2, we use [the tokens from
|
|
406
|
-
* `date-fns` version 1](https://date-fns.org/v1.30.1/docs/format) under the
|
|
407
|
-
* hood.
|
|
408
|
-
*/
|
|
409
|
-
timeFormat?: string;
|
|
410
|
-
/**
|
|
411
|
-
* Placeholder text displayed in input.
|
|
412
|
-
*/
|
|
413
|
-
placeholder?: string;
|
|
414
|
-
/**
|
|
415
|
-
* Locale used to format the time. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
416
|
-
*/
|
|
417
|
-
locale?: string;
|
|
418
|
-
/**
|
|
419
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests:
|
|
420
|
-
* - `{testId}--container` wrapping element of time-picker
|
|
421
|
-
*/
|
|
422
|
-
testId?: string;
|
|
423
|
-
}
|
|
424
|
-
export interface DateTimePickerBaseProps extends WithAnalyticsEventsProps {
|
|
425
|
-
/**
|
|
426
|
-
* Set the appearance of the picker.
|
|
427
|
-
*
|
|
428
|
-
* `subtle` will remove the borders and background.
|
|
429
|
-
*
|
|
430
|
-
* @deprecated
|
|
431
|
-
*/
|
|
432
|
-
appearance?: Appearance;
|
|
433
|
-
/**
|
|
434
|
-
* Used to associate accessible descriptions to both the date and time
|
|
435
|
-
* picker. If you want to associate individual accessible descriptions, this
|
|
436
|
-
* should be done through the `aria-describedby` props on the
|
|
437
|
-
* `datePickerProps` and `timePickerProps`.
|
|
438
|
-
*/
|
|
439
|
-
'aria-describedby'?: string;
|
|
440
|
-
/**
|
|
441
|
-
* Set the picker to autofocus on mount.
|
|
442
|
-
*/
|
|
443
|
-
autoFocus?: boolean;
|
|
444
|
-
/**
|
|
445
|
-
* Set the `aria-label` for the clear button.
|
|
446
|
-
* Add the word "Clear" at the beginning of the clearControlLabel.
|
|
447
|
-
* For instance, for a field to set an appointment, use "Clear appointment date and time".
|
|
448
|
-
*/
|
|
449
|
-
clearControlLabel?: string;
|
|
450
|
-
/**
|
|
451
|
-
* The default for `value`.
|
|
452
|
-
*/
|
|
453
|
-
defaultValue?: string;
|
|
454
|
-
/**
|
|
455
|
-
* Set the id of the field.
|
|
456
|
-
*/
|
|
457
|
-
id?: string;
|
|
458
|
-
/**
|
|
459
|
-
* Props to apply to the container.
|
|
460
|
-
*
|
|
461
|
-
* @deprecated If you are looking to set your width, use a `Box` from
|
|
462
|
-
* `@atlaskit/primitives` around the picker to achieve the same effect.
|
|
463
|
-
*/
|
|
464
|
-
innerProps?: React.AllHTMLAttributes<HTMLElement>;
|
|
465
|
-
/**
|
|
466
|
-
* Set if the field is disabled.
|
|
467
|
-
*/
|
|
468
|
-
isDisabled?: boolean;
|
|
469
|
-
/**
|
|
470
|
-
* Set the field as required.
|
|
471
|
-
*/
|
|
472
|
-
isRequired?: boolean;
|
|
473
|
-
/**
|
|
474
|
-
* The name of the field.
|
|
475
|
-
*/
|
|
476
|
-
name?: string;
|
|
477
|
-
/**
|
|
478
|
-
* Called when the field is blurred.
|
|
479
|
-
*/
|
|
480
|
-
onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
|
481
|
-
/**
|
|
482
|
-
* Called when the value changes and the date / time is a complete value, or empty. The only value is an ISO string or empty string.
|
|
483
|
-
*/
|
|
484
|
-
onChange?: (value: string) => void;
|
|
485
|
-
/**
|
|
486
|
-
* Called when the field is focused.
|
|
487
|
-
*/
|
|
488
|
-
onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
|
489
|
-
/**
|
|
490
|
-
* The ISO time that should be used as the input value.
|
|
491
|
-
*/
|
|
492
|
-
value?: string;
|
|
493
|
-
/**
|
|
494
|
-
* Set if the picker has an invalid value.
|
|
495
|
-
*/
|
|
496
|
-
isInvalid?: boolean;
|
|
497
|
-
/**
|
|
498
|
-
* Props applied to the `DatePicker`.
|
|
499
|
-
*/
|
|
500
|
-
datePickerProps?: DatePickerBaseProps;
|
|
501
|
-
/**
|
|
502
|
-
* Props applied to the `TimePicker`.
|
|
503
|
-
*/
|
|
504
|
-
timePickerProps?: TimePickerBaseProps;
|
|
505
|
-
/**
|
|
506
|
-
* Function used to parse datetime values into their date, time and timezone sub-values. *
|
|
507
|
-
*/
|
|
508
|
-
parseValue?: (dateTimeValue: string, date: string, time: string, timezone: string) => {
|
|
509
|
-
dateValue: string;
|
|
510
|
-
timeValue: string;
|
|
511
|
-
zoneValue: string;
|
|
512
|
-
};
|
|
513
|
-
/**
|
|
514
|
-
* The spacing for the select control.
|
|
515
|
-
*
|
|
516
|
-
* Compact is `gridSize() * 4`, default is `gridSize() * 5`.
|
|
517
|
-
*/
|
|
518
|
-
spacing?: Spacing;
|
|
519
|
-
/**
|
|
520
|
-
* Locale used for formatting dates and times. See [DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat).
|
|
521
|
-
*/
|
|
522
|
-
locale?: string;
|
|
523
|
-
/**
|
|
524
|
-
* A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
|
|
525
|
-
* - `{testId}--datepicker--container` wrapping element of date-picker
|
|
526
|
-
* - `{testId}--timepicker--container` wrapping element of time-picker
|
|
527
|
-
*/
|
|
528
|
-
testId?: string;
|
|
529
|
-
}
|
|
530
|
-
export {};
|