@atlaskit/datetime-picker 15.1.4 → 15.2.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.
@@ -9,6 +9,7 @@ import { type ActionMeta, type InputActionMeta } from '@atlaskit/select';
9
9
  import { type DatePickerBaseProps } from '../types';
10
10
  type DatePickerProps = typeof datePickerDefaultProps & DatePickerBaseProps;
11
11
  interface State {
12
+ isKeyDown: boolean;
12
13
  isOpen: boolean;
13
14
  /**
14
15
  * When being cleared from the icon the DatePicker is blurred.
@@ -23,6 +24,7 @@ interface State {
23
24
  l10n: LocalizationProvider;
24
25
  locale: string;
25
26
  shouldSetFocusOnCurrentDay: boolean;
27
+ wasOpenedFromCalendarButton: boolean;
26
28
  }
27
29
  declare const datePickerDefaultProps: {
28
30
  defaultIsOpen: boolean;
@@ -46,6 +48,8 @@ declare class DatePickerComponent extends Component<DatePickerProps, State> {
46
48
  onFocus: (_event: import("react").FocusEvent<HTMLInputElement>) => void;
47
49
  };
48
50
  containerRef: HTMLElement | null;
51
+ calendarRef: React.RefObject<HTMLDivElement | null>;
52
+ calendarButtonRef: React.RefObject<HTMLButtonElement>;
49
53
  constructor(props: any);
50
54
  static getDerivedStateFromProps(nextProps: Readonly<DatePickerProps>, prevState: State): {
51
55
  l10n: LocalizationProvider;
@@ -66,6 +70,8 @@ declare class DatePickerComponent extends Component<DatePickerProps, State> {
66
70
  onSelectFocus: (event: React.FocusEvent<HTMLInputElement>) => void;
67
71
  onTextInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
68
72
  onInputKeyDown: (event: React.KeyboardEvent<HTMLElement>) => void;
73
+ onCalendarButtonKeyDown: (e: React.KeyboardEvent<HTMLButtonElement>) => void;
74
+ onCalendarButtonClick: (e: React.MouseEvent<HTMLButtonElement>) => void;
69
75
  onClear: () => void;
70
76
  onSelectChange: (_value: unknown, action: ActionMeta) => void;
71
77
  handleSelectInputChange: (selectInputValue: string, actionMeta: InputActionMeta) => void;
@@ -82,7 +88,7 @@ export { DatePickerComponent as DatePickerWithoutAnalytics };
82
88
  * - [Code](https://atlassian.design/components/datetime-picker/date-picker/code)
83
89
  * - [Usage](https://atlassian.design/components/datetime-picker/date-picker/usage)
84
90
  */
85
- declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "name" | "spacing" | "isOpen" | "hideIcon"> & Partial<Pick<Omit<DatePickerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "disabled" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "defaultIsOpen">> & Partial<Pick<{
91
+ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Omit<{
86
92
  defaultIsOpen: boolean;
87
93
  defaultValue: string;
88
94
  disabled: string[];
@@ -91,5 +97,23 @@ declare const DatePicker: import("react").ForwardRefExoticComponent<Pick<Pick<Om
91
97
  onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
92
98
  onChange: (_value: string) => void;
93
99
  onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
94
- }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "hideIcon"> & import("react").RefAttributes<any>>;
100
+ } & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "id" | "aria-describedby" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "name" | "spacing" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & Partial<Pick<Omit<{
101
+ defaultIsOpen: boolean;
102
+ defaultValue: string;
103
+ disabled: string[];
104
+ disabledDateFilter: (_: string) => boolean;
105
+ locale: string;
106
+ onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
107
+ onChange: (_value: string) => void;
108
+ onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
109
+ } & DatePickerBaseProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "disabled" | "defaultValue" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "locale" | "defaultIsOpen">> & Partial<Pick<{
110
+ defaultIsOpen: boolean;
111
+ defaultValue: string;
112
+ disabled: string[];
113
+ disabledDateFilter: (_: string) => boolean;
114
+ locale: string;
115
+ onBlur: (_event: React.FocusEvent<HTMLInputElement>) => void;
116
+ onChange: (_value: string) => void;
117
+ onFocus: (_event: React.FocusEvent<HTMLInputElement>) => void;
118
+ }, never>> & import("react").RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "disabled" | "parseInputValue" | "dateFormat" | "formatDisplayLabel" | "placeholder" | "testId" | "label" | "icon" | "appearance" | "selectProps" | "innerProps" | "isDisabled" | "key" | "defaultValue" | "id" | "aria-describedby" | "onFocus" | "onBlur" | "onChange" | "disabledDateFilter" | "maxDate" | "minDate" | "nextMonthLabel" | "previousMonthLabel" | "locale" | "analyticsContext" | "weekStartDay" | "value" | "autoFocus" | "isInvalid" | "name" | "spacing" | "defaultIsOpen" | "isOpen" | "inputLabel" | "inputLabelId" | "openCalendarLabel" | "shouldShowCalendarButton" | "hideIcon"> & import("react").RefAttributes<any>>;
95
119
  export default DatePicker;
@@ -142,6 +142,37 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
142
142
  * Called when the field is focused.
143
143
  */
144
144
  onFocus?: React.FocusEventHandler<HTMLInputElement>;
145
+ /**
146
+ * The name of the input, used when `shouldShowCalendarButton` is true. See `shouldShowCalendarButton` description for more details.
147
+ *
148
+ * @default 'Date picker'
149
+ */
150
+ inputLabel?: string;
151
+ /**
152
+ * The ID of the label for the input, used when `shouldShowCalendarButton` is
153
+ * true. See `shouldShowCalendarButton` description for more details.
154
+ */
155
+ inputLabelId?: string;
156
+ /**
157
+ * The label associated with the button to open the calendar, rendered via the
158
+ * `shouldShowCalendarButton` prop. If a `label` prop is provided, this
159
+ * calendar button label will be prefixed by the value of `label`. If no
160
+ * `label` prop is provided, this prefix should be manually added. For
161
+ * example,
162
+ *
163
+ * ```tsx
164
+ * <label id="label" htmlFor="datepicker">Desired Appointment Date</label>
165
+ * <DatePicker
166
+ * id="datepicker"
167
+ * shouldShowCalendarButton
168
+ * inputLabel="Desired Appointment Date"
169
+ * openCalendarLabel="open calendar"
170
+ * />
171
+ * ```
172
+ *
173
+ * @default 'open calendar'
174
+ */
175
+ openCalendarLabel?: string;
145
176
  /**
146
177
  * A function for parsing input characters and transforming them into a Date object.
147
178
  * By default parses the date string based off the locale.
@@ -155,6 +186,17 @@ export interface DatePickerBaseProps extends WithAnalyticsEventsProps, PickerSel
155
186
  * The aria-label attribute associated with the previous-month arrow.
156
187
  */
157
188
  previousMonthLabel?: string;
189
+ /**
190
+ * Provides a functional calendar button that opens the calendar picker that
191
+ * lives on the right side of the date picker.
192
+ *
193
+ * The accessible name for this button is caculated using either the `label`,
194
+ * `inputLabel`, or `inputLabelId` props, along with the `openCalendarLabel`
195
+ * prop.
196
+ *
197
+ * @default false
198
+ */
199
+ shouldShowCalendarButton?: boolean;
158
200
  /**
159
201
  * The spacing for the select control.
160
202
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/datetime-picker",
3
- "version": "15.1.4",
3
+ "version": "15.2.0",
4
4
  "description": "A date time picker allows the user to select an associated date and time.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -38,16 +38,18 @@
38
38
  "@atlaskit/analytics-next": "^10.1.0",
39
39
  "@atlaskit/calendar": "^15.0.0",
40
40
  "@atlaskit/ds-lib": "^3.0.0",
41
- "@atlaskit/icon": "^22.20.0",
41
+ "@atlaskit/icon": "^22.22.0",
42
42
  "@atlaskit/layering": "^0.5.0",
43
43
  "@atlaskit/locale": "^2.8.0",
44
44
  "@atlaskit/popper": "^6.3.0",
45
+ "@atlaskit/primitives": "^12.2.0",
45
46
  "@atlaskit/select": "^18.0.0",
46
47
  "@atlaskit/theme": "^13.0.0",
47
48
  "@atlaskit/tokens": "^2.0.0",
48
49
  "@babel/runtime": "^7.0.0",
49
50
  "@emotion/react": "^11.7.1",
50
- "date-fns": "^2.17.0"
51
+ "date-fns": "^2.17.0",
52
+ "react-uid": "^2.2.0"
51
53
  },
52
54
  "peerDependencies": {
53
55
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"