baseui 10.11.1 → 11.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.
Files changed (273) hide show
  1. package/README.md +3 -3
  2. package/accordion/accordion.js +60 -13
  3. package/accordion/accordion.js.flow +49 -12
  4. package/accordion/index.d.ts +0 -3
  5. package/accordion/panel.js +7 -6
  6. package/accordion/panel.js.flow +20 -20
  7. package/accordion/stateless-accordion.js +2 -4
  8. package/accordion/stateless-accordion.js.flow +0 -2
  9. package/accordion/types.js.flow +0 -5
  10. package/button/constants.js +1 -2
  11. package/button/constants.js.flow +0 -1
  12. package/button/index.d.ts +0 -1
  13. package/button/styled-components.js +2 -29
  14. package/button/styled-components.js.flow +2 -30
  15. package/checkbox/checkbox.js +6 -30
  16. package/checkbox/checkbox.js.flow +7 -38
  17. package/checkbox/constants.js +2 -1
  18. package/checkbox/constants.js.flow +2 -1
  19. package/checkbox/index.d.ts +4 -6
  20. package/checkbox/index.js +0 -6
  21. package/checkbox/index.js.flow +0 -1
  22. package/checkbox/styled-components.js +52 -149
  23. package/checkbox/styled-components.js.flow +59 -165
  24. package/checkbox/types.js.flow +0 -5
  25. package/data-table/column-categorical.js +1 -1
  26. package/data-table/column-categorical.js.flow +1 -1
  27. package/data-table/column-datetime.js +1 -1
  28. package/data-table/column-datetime.js.flow +3 -1
  29. package/data-table/column.js +6 -2
  30. package/data-table/column.js.flow +9 -7
  31. package/data-table/data-table.js +1 -1
  32. package/data-table/data-table.js.flow +1 -1
  33. package/data-table/header-cell.js +3 -0
  34. package/data-table/header-cell.js.flow +1 -1
  35. package/datepicker/calendar.js +15 -7
  36. package/datepicker/calendar.js.flow +23 -9
  37. package/datepicker/constants.js +12 -2
  38. package/datepicker/constants.js.flow +10 -0
  39. package/datepicker/datepicker.js +61 -30
  40. package/datepicker/datepicker.js.flow +77 -37
  41. package/datepicker/day.js +85 -34
  42. package/datepicker/day.js.flow +118 -54
  43. package/datepicker/locale.js.flow +0 -1
  44. package/datepicker/month.js +3 -1
  45. package/datepicker/month.js.flow +2 -0
  46. package/datepicker/stateful-container.js.flow +2 -1
  47. package/datepicker/styled-components.js +23 -1
  48. package/datepicker/styled-components.js.flow +12 -2
  49. package/datepicker/types.js.flow +35 -10
  50. package/datepicker/utils/date-helpers.js +30 -0
  51. package/datepicker/utils/date-helpers.js.flow +12 -0
  52. package/datepicker/week.js +3 -1
  53. package/datepicker/week.js.flow +2 -0
  54. package/es/accordion/accordion.js +52 -12
  55. package/es/accordion/panel.js +7 -5
  56. package/es/accordion/stateless-accordion.js +2 -4
  57. package/es/button/constants.js +1 -2
  58. package/es/button/styled-components.js +2 -29
  59. package/es/checkbox/checkbox.js +7 -32
  60. package/es/checkbox/constants.js +2 -1
  61. package/es/checkbox/index.js +1 -1
  62. package/es/checkbox/styled-components.js +51 -146
  63. package/es/data-table/column-categorical.js +1 -1
  64. package/es/data-table/column-datetime.js +1 -1
  65. package/es/data-table/column.js +6 -2
  66. package/es/data-table/data-table.js +1 -1
  67. package/es/data-table/header-cell.js +3 -0
  68. package/es/datepicker/calendar.js +15 -7
  69. package/es/datepicker/constants.js +8 -0
  70. package/es/datepicker/datepicker.js +56 -29
  71. package/es/datepicker/day.js +77 -34
  72. package/es/datepicker/month.js +3 -1
  73. package/es/datepicker/styled-components.js +8 -2
  74. package/es/datepicker/types.js +1 -1
  75. package/es/datepicker/utils/date-helpers.js +16 -0
  76. package/es/datepicker/week.js +3 -1
  77. package/es/file-uploader/file-uploader.js +4 -4
  78. package/es/header-navigation/styled-components.js +3 -3
  79. package/es/helpers/overrides.js +1 -2
  80. package/es/input/styled-components.js +4 -4
  81. package/es/layer/layer.js +4 -4
  82. package/es/locale/index.js +0 -7
  83. package/es/menu/stateful-container.js +0 -1
  84. package/es/menu/styled-components.js +1 -1
  85. package/es/modal/index.js +1 -1
  86. package/es/modal/modal.js +19 -65
  87. package/es/modal/styled-components.js +12 -48
  88. package/es/phone-input/default-props.js +1 -1
  89. package/es/phone-input/index.js +0 -4
  90. package/es/phone-input/phone-input-lite.js +55 -31
  91. package/es/radio/radio.js +1 -7
  92. package/es/radio/radiogroup.js +3 -28
  93. package/es/radio/styled-components.js +4 -5
  94. package/es/rating/styled-components.js +3 -3
  95. package/es/select/index.js +1 -2
  96. package/es/select/select-component.js +32 -20
  97. package/es/select/styled-components.js +4 -4
  98. package/es/snackbar/styled-components.js +2 -2
  99. package/es/spinner/index.js +3 -9
  100. package/es/spinner/styled-components.js +2 -32
  101. package/es/table/filter.js +3 -3
  102. package/es/tag/styled-components.js +1 -1
  103. package/es/themes/dark-theme/color-component-tokens.js +0 -38
  104. package/es/themes/dark-theme/color-tokens.js +0 -2
  105. package/es/themes/dark-theme/create-dark-theme.js +0 -2
  106. package/es/themes/dark-theme/dark-theme.js +0 -2
  107. package/es/themes/light-theme/color-component-tokens.js +0 -38
  108. package/es/themes/light-theme/color-tokens.js +0 -2
  109. package/es/themes/light-theme/create-light-theme.js +0 -2
  110. package/es/themes/light-theme/light-theme.js +0 -2
  111. package/es/timepicker/timepicker.js +1 -8
  112. package/es/typography/index.js +1 -31
  113. package/esm/accordion/accordion.js +60 -13
  114. package/esm/accordion/panel.js +7 -6
  115. package/esm/accordion/stateless-accordion.js +2 -4
  116. package/esm/button/constants.js +1 -2
  117. package/esm/button/styled-components.js +2 -29
  118. package/esm/checkbox/checkbox.js +7 -30
  119. package/esm/checkbox/constants.js +2 -1
  120. package/esm/checkbox/index.js +1 -1
  121. package/esm/checkbox/styled-components.js +52 -147
  122. package/esm/data-table/column-categorical.js +1 -1
  123. package/esm/data-table/column-datetime.js +1 -1
  124. package/esm/data-table/column.js +6 -2
  125. package/esm/data-table/data-table.js +1 -1
  126. package/esm/data-table/header-cell.js +3 -0
  127. package/esm/datepicker/calendar.js +15 -7
  128. package/esm/datepicker/constants.js +8 -0
  129. package/esm/datepicker/datepicker.js +60 -30
  130. package/esm/datepicker/day.js +84 -34
  131. package/esm/datepicker/month.js +3 -1
  132. package/esm/datepicker/styled-components.js +24 -2
  133. package/esm/datepicker/types.js +1 -1
  134. package/esm/datepicker/utils/date-helpers.js +30 -0
  135. package/esm/datepicker/week.js +3 -1
  136. package/esm/file-uploader/file-uploader.js +4 -4
  137. package/esm/header-navigation/styled-components.js +3 -3
  138. package/esm/helpers/overrides.js +1 -2
  139. package/esm/input/styled-components.js +4 -4
  140. package/esm/layer/layer.js +4 -4
  141. package/esm/locale/index.js +0 -7
  142. package/esm/menu/stateful-container.js +0 -1
  143. package/esm/menu/styled-components.js +1 -1
  144. package/esm/modal/index.js +1 -1
  145. package/esm/modal/modal.js +28 -71
  146. package/esm/modal/styled-components.js +6 -38
  147. package/esm/phone-input/default-props.js +1 -1
  148. package/esm/phone-input/index.js +0 -4
  149. package/esm/phone-input/phone-input-lite.js +60 -37
  150. package/esm/radio/radio.js +1 -7
  151. package/esm/radio/radiogroup.js +3 -28
  152. package/esm/radio/styled-components.js +4 -5
  153. package/esm/rating/styled-components.js +3 -3
  154. package/esm/select/index.js +1 -2
  155. package/esm/select/select-component.js +34 -19
  156. package/esm/select/styled-components.js +4 -4
  157. package/esm/snackbar/styled-components.js +2 -2
  158. package/esm/spinner/index.js +3 -9
  159. package/esm/spinner/styled-components.js +2 -40
  160. package/esm/table/filter.js +3 -3
  161. package/esm/tag/styled-components.js +1 -1
  162. package/esm/themes/dark-theme/color-component-tokens.js +0 -38
  163. package/esm/themes/dark-theme/color-tokens.js +0 -2
  164. package/esm/themes/dark-theme/create-dark-theme.js +1 -2
  165. package/esm/themes/dark-theme/dark-theme.js +1 -2
  166. package/esm/themes/light-theme/color-component-tokens.js +0 -38
  167. package/esm/themes/light-theme/color-tokens.js +0 -2
  168. package/esm/themes/light-theme/create-light-theme.js +1 -2
  169. package/esm/themes/light-theme/light-theme.js +1 -2
  170. package/esm/timepicker/timepicker.js +1 -8
  171. package/esm/typography/index.js +1 -35
  172. package/file-uploader/file-uploader.js +3 -3
  173. package/file-uploader/file-uploader.js.flow +4 -4
  174. package/header-navigation/styled-components.js +3 -3
  175. package/header-navigation/styled-components.js.flow +3 -3
  176. package/helpers/overrides.js +1 -2
  177. package/helpers/overrides.js.flow +1 -1
  178. package/input/index.d.ts +5 -9
  179. package/input/styled-components.js +4 -4
  180. package/input/styled-components.js.flow +4 -4
  181. package/layer/layer.js +4 -4
  182. package/layer/layer.js.flow +4 -3
  183. package/locale/index.js +0 -7
  184. package/locale/index.js.flow +0 -7
  185. package/locale.ts +0 -1
  186. package/menu/index.d.ts +1 -3
  187. package/menu/stateful-container.js +0 -1
  188. package/menu/stateful-container.js.flow +0 -1
  189. package/menu/styled-components.js +1 -1
  190. package/menu/styled-components.js.flow +1 -1
  191. package/modal/index.d.ts +4 -6
  192. package/modal/index.js +0 -6
  193. package/modal/index.js.flow +0 -1
  194. package/modal/modal.js +27 -70
  195. package/modal/modal.js.flow +17 -83
  196. package/modal/styled-components.js +7 -40
  197. package/modal/styled-components.js.flow +12 -44
  198. package/modal/types.js.flow +1 -10
  199. package/package.json +10 -10
  200. package/phone-input/default-props.js +1 -1
  201. package/phone-input/default-props.js.flow +1 -1
  202. package/phone-input/index.d.ts +0 -1
  203. package/phone-input/index.js +0 -36
  204. package/phone-input/index.js.flow +0 -4
  205. package/phone-input/phone-input-lite.js +63 -38
  206. package/phone-input/phone-input-lite.js.flow +66 -44
  207. package/progress-bar/index.d.ts +3 -3
  208. package/radio/index.d.ts +4 -9
  209. package/radio/radio.js +1 -7
  210. package/radio/radio.js.flow +1 -8
  211. package/radio/radiogroup.js +3 -28
  212. package/radio/radiogroup.js.flow +2 -26
  213. package/radio/styled-components.js +4 -5
  214. package/radio/styled-components.js.flow +3 -4
  215. package/radio/types.js.flow +4 -15
  216. package/rating/styled-components.js +3 -3
  217. package/rating/styled-components.js.flow +3 -3
  218. package/select/index.d.ts +8 -3
  219. package/select/index.js +0 -6
  220. package/select/index.js.flow +0 -2
  221. package/select/select-component.js +34 -19
  222. package/select/select-component.js.flow +29 -13
  223. package/select/styled-components.js +4 -4
  224. package/select/styled-components.js.flow +4 -4
  225. package/select/types.js.flow +11 -7
  226. package/snackbar/styled-components.js +1 -1
  227. package/snackbar/styled-components.js.flow +11 -11
  228. package/spinner/index.d.ts +5 -18
  229. package/spinner/index.js +2 -68
  230. package/spinner/index.js.flow +2 -27
  231. package/spinner/styled-components.js +9 -45
  232. package/spinner/styled-components.js.flow +2 -34
  233. package/spinner/types.js.flow +1 -19
  234. package/styles/types.js.flow +0 -2
  235. package/table/filter.js +3 -3
  236. package/table/filter.js.flow +3 -3
  237. package/tag/styled-components.js +1 -1
  238. package/tag/styled-components.js.flow +1 -1
  239. package/theme.ts +0 -81
  240. package/themes/dark-theme/color-component-tokens.js +0 -38
  241. package/themes/dark-theme/color-component-tokens.js.flow +0 -42
  242. package/themes/dark-theme/color-tokens.js +0 -2
  243. package/themes/dark-theme/color-tokens.js.flow +0 -2
  244. package/themes/dark-theme/create-dark-theme.js +1 -3
  245. package/themes/dark-theme/create-dark-theme.js.flow +0 -2
  246. package/themes/dark-theme/dark-theme.js +1 -3
  247. package/themes/dark-theme/dark-theme.js.flow +0 -2
  248. package/themes/light-theme/color-component-tokens.js +0 -38
  249. package/themes/light-theme/color-component-tokens.js.flow +0 -43
  250. package/themes/light-theme/color-tokens.js +0 -2
  251. package/themes/light-theme/color-tokens.js.flow +0 -2
  252. package/themes/light-theme/create-light-theme.js +1 -3
  253. package/themes/light-theme/create-light-theme.js.flow +0 -2
  254. package/themes/light-theme/light-theme.js +1 -3
  255. package/themes/light-theme/light-theme.js.flow +0 -2
  256. package/themes/types.js.flow +0 -68
  257. package/timepicker/timepicker.js +1 -8
  258. package/timepicker/timepicker.js.flow +4 -10
  259. package/typography/index.d.ts +0 -23
  260. package/typography/index.js +2 -57
  261. package/typography/index.js.flow +0 -31
  262. package/es/spinner/spinner.js +0 -68
  263. package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
  264. package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
  265. package/esm/spinner/spinner.js +0 -125
  266. package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
  267. package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
  268. package/spinner/spinner.js +0 -136
  269. package/spinner/spinner.js.flow +0 -75
  270. package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
  271. package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
  272. package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
  273. package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
@@ -9,7 +9,13 @@ LICENSE file in the root directory of this source tree.
9
9
  import * as React from 'react';
10
10
  import type { OverrideT } from '../helpers/overrides.js';
11
11
  import type { SizeT } from '../input/types.js';
12
- import { ORIENTATION, STATE_CHANGE_TYPE, DENSITY } from './constants.js';
12
+ import {
13
+ INPUT_ROLE,
14
+ ORIENTATION,
15
+ RANGED_CALENDAR_BEHAVIOR,
16
+ STATE_CHANGE_TYPE,
17
+ DENSITY,
18
+ } from './constants.js';
13
19
  import type { DateIOAdapter } from './utils/types.js';
14
20
  import type {
15
21
  TimePickerPropsT as TimePickerPropsTBase,
@@ -21,7 +27,9 @@ import type { OptionT } from '../select/index.js';
21
27
  // flowlint-next-line unclear-type:off
22
28
  type LocaleT = any; // see https://github.com/date-fns/date-fns/blob/master/src/locale/index.js.flow
23
29
 
24
- type onChangeT<T> = ({ date: ?T | Array<T> }) => mixed;
30
+ export type DateValueT<T> = ?T | Array<?T>;
31
+
32
+ type onChangeT<T> = ({ date: DateValueT<T> }) => mixed;
25
33
 
26
34
  export type DensityT = $Keys<typeof DENSITY>;
27
35
 
@@ -74,6 +82,8 @@ export type DayPropsT<T = Date> = {
74
82
  includeDates: ?Array<T>,
75
83
  highlighted: boolean,
76
84
  range: boolean,
85
+ hasLockedBehavior: boolean,
86
+ selectedInput: InputRoleT,
77
87
  focusedCalendar: boolean,
78
88
  locale: ?LocaleT,
79
89
  maxDate: ?T,
@@ -82,13 +92,13 @@ export type DayPropsT<T = Date> = {
82
92
  month: ?number,
83
93
  onBlur: ({ event: Event, date: T }) => mixed,
84
94
  onFocus: ({ event: Event, date: T }) => mixed,
85
- onSelect: ({ date: ?T | Array<T> }) => mixed,
95
+ onSelect: ({ date: DateValueT<T> }) => mixed,
86
96
  onClick: ({ event: Event, date: T }) => mixed,
87
97
  onMouseOver: ({ event: Event, date: T }) => mixed,
88
98
  onMouseLeave: ({ event: Event, date: T }) => mixed,
89
99
  overrides?: DatepickerOverridesT,
90
100
  peekNextMonth: boolean,
91
- value: ?T | Array<T>,
101
+ value: DateValueT<T>,
92
102
  };
93
103
 
94
104
  export type DayStateT = {
@@ -120,7 +130,9 @@ export type WeekPropsT<T = Date> = {
120
130
  onChange?: onChangeT<T>,
121
131
  overrides?: DatepickerOverridesT,
122
132
  peekNextMonth: boolean,
123
- value: ?T | Array<T>,
133
+ value: DateValueT<T>,
134
+ hasLockedBehavior: boolean,
135
+ selectedInput?: InputRoleT,
124
136
  };
125
137
 
126
138
  export type MonthPropsT<T = Date> = WeekPropsT<T> & {
@@ -133,7 +145,7 @@ export type CalendarInternalState<T = Date> = {
133
145
  date: T,
134
146
  quickSelectId: ?string,
135
147
  rootElement: ?HTMLElement,
136
- time: Array<T>,
148
+ time: Array<?T>,
137
149
  };
138
150
 
139
151
  export type CalendarPropsT<T = Date> = {
@@ -157,6 +169,8 @@ export type CalendarPropsT<T = Date> = {
157
169
  includeDates?: ?Array<T>,
158
170
  /** Defines if a range of dates can be selected. */
159
171
  range?: boolean,
172
+ /** Determines whether startDate and endDate should be updated independently of eachother */
173
+ hasLockedBehavior?: boolean,
160
174
  /** A locale object. See `date-fns` for more details https://github.com/date-fns/date-fns/tree/master/src/locale. */
161
175
  locale?: ?LocaleT,
162
176
  /** A max date that is selectable. */
@@ -194,8 +208,10 @@ export type CalendarPropsT<T = Date> = {
194
208
  /** Defines if tabbing inside the calendar is circled within it. */
195
209
  trapTabbing?: boolean,
196
210
  /** Currently selected date. */
197
- value?: ?T | Array<T>,
211
+ value?: DateValueT<T>,
198
212
  fixedHeight?: boolean,
213
+ /** Determines whether user clicked startDate or endDate input to trigger calendar open */
214
+ selectedInput?: InputRoleT,
199
215
  };
200
216
 
201
217
  export type HeaderPropsT<T = Date> = CalendarPropsT<T> & {
@@ -222,7 +238,7 @@ export type DatepickerPropsT<T = Date> = CalendarPropsT<T> & {
222
238
  required?: boolean,
223
239
  clearable?: boolean,
224
240
  displayValueAtRangeIndex?: number,
225
- formatDisplayValue?: (date: ?T | Array<T>, formatString: string) => string,
241
+ formatDisplayValue?: (date: DateValueT<T>, formatString: string) => string,
226
242
  formatString: string,
227
243
  /** Where to mount the popover */
228
244
  mountNode?: HTMLElement,
@@ -231,6 +247,8 @@ export type DatepickerPropsT<T = Date> = CalendarPropsT<T> & {
231
247
  /** Called when calendar is opened */
232
248
  onOpen?: () => mixed,
233
249
  mask?: string | null,
250
+ /** Determines whether startDate and endDate should be updated independently of eachother */
251
+ rangedCalendarBehavior?: RangedCalendarBehaviorT,
234
252
  /** Determines if startDate and endDate should be separated into two input fields. Ignored if `range` is not true. */
235
253
  separateRangeInputs?: boolean,
236
254
  startDateLabel?: string,
@@ -260,6 +278,9 @@ export type SharedStylePropsT = {
260
278
  $hasRangeHighlighted: ?boolean,
261
279
  $hasRangeOnRight: ?boolean,
262
280
  $hasRangeSelected: ?boolean,
281
+ $hasLockedBehavior: boolean,
282
+ $selectedInput: InputRoleT,
283
+ $value: Date | Array<Date>,
263
284
  $order: ?number,
264
285
  $hasDateLabel: ?boolean,
265
286
  };
@@ -268,7 +289,7 @@ export type StateChangeTypeT = ?$Values<typeof STATE_CHANGE_TYPE>;
268
289
 
269
290
  export type ContainerStateT<T = Date> = {
270
291
  /** Selected `Date`. If `range` is set, `value` is an array of 2 values. */
271
- value?: ?T | Array<T>,
292
+ value?: DateValueT<T>,
272
293
  };
273
294
 
274
295
  export type NavigationContainerStateT<T = Date> = {
@@ -324,7 +345,7 @@ export type NavigationContainerPropsT<T = Date> = {
324
345
  /** Event handler that is called when the current rendered year is changed. */
325
346
  onYearChange?: ({ date: T }) => mixed,
326
347
  /** Selected `Date`. If `range` is set, `value` is an array of 2 values. */
327
- value?: ?T | Array<T>,
348
+ value?: DateValueT<T>,
328
349
  stateReducer: NavigationContainerStateReducerT<T>,
329
350
  trapTabbing: boolean,
330
351
  };
@@ -372,6 +393,10 @@ export type TimezonePickerPropsT = {
372
393
  positive?: boolean,
373
394
  };
374
395
 
396
+ export type InputRoleT = ?$Values<typeof INPUT_ROLE>;
397
+
398
+ export type RangedCalendarBehaviorT = ?$Values<typeof RANGED_CALENDAR_BEHAVIOR>;
399
+
375
400
  declare var __DEV__: boolean;
376
401
  declare var __NODE__: boolean;
377
402
  declare var __BROWSER__: boolean;
@@ -5,6 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
+
10
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
+
12
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
+
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15
+
16
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
17
+
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+
8
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
9
21
 
10
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -230,6 +242,24 @@ var DateHelpers = function DateHelpers(_adapter) {
230
242
  return false;
231
243
  });
232
244
 
245
+ _defineProperty(this, "dateRangeIncludesDates", function (dateRange, dates) {
246
+ var _dateRange = _slicedToArray(dateRange, 2),
247
+ startDate = _dateRange[0],
248
+ endDate = _dateRange[1];
249
+
250
+ if (startDate && endDate && Array.isArray(dates) && dates.length) {
251
+ for (var i = 0; i < dates.length; i++) {
252
+ var _day = dates[i];
253
+
254
+ if (_this.isDayInRange(_day, startDate, endDate)) {
255
+ return true;
256
+ }
257
+ }
258
+ }
259
+
260
+ return false;
261
+ });
262
+
233
263
  _defineProperty(this, "subDays", function (date, days) {
234
264
  return _this.adapter.addDays(date, days * -1);
235
265
  });
@@ -191,6 +191,18 @@ class DateHelpers<T> {
191
191
  }
192
192
  return false;
193
193
  };
194
+ dateRangeIncludesDates: (Array<?T>, ?Array<T>) => boolean = (dateRange, dates) => {
195
+ const [startDate, endDate] = dateRange;
196
+ if (startDate && endDate && Array.isArray(dates) && dates.length) {
197
+ for (let i = 0; i < dates.length; i++) {
198
+ const day = dates[i];
199
+ if (this.isDayInRange(day, startDate, endDate)) {
200
+ return true;
201
+ }
202
+ }
203
+ }
204
+ return false;
205
+ };
194
206
  subDays: (T, number) => T = (date, days) => {
195
207
  return this.adapter.addDays(date, days * -1);
196
208
  };
@@ -114,7 +114,9 @@ var Week = /*#__PURE__*/function (_React$Component) {
114
114
  onMouseLeave: _this.props.onDayMouseLeave,
115
115
  overrides: _this.props.overrides,
116
116
  peekNextMonth: _this.props.peekNextMonth,
117
- value: _this.props.value
117
+ value: _this.props.value,
118
+ hasLockedBehavior: _this.props.hasLockedBehavior,
119
+ selectedInput: _this.props.selectedInput
118
120
  })
119
121
  );
120
122
  }));
@@ -75,6 +75,8 @@ export default class Week<T = Date> extends React.Component<WeekPropsT<T>> {
75
75
  overrides={this.props.overrides}
76
76
  peekNextMonth={this.props.peekNextMonth}
77
77
  value={this.props.value}
78
+ hasLockedBehavior={this.props.hasLockedBehavior}
79
+ selectedInput={this.props.selectedInput}
78
80
  />
79
81
  );
80
82
  })
@@ -22,6 +22,8 @@ export default class Accordion extends React.Component {
22
22
  expanded: [],
23
23
  ...this.props.initialState
24
24
  });
25
+
26
+ _defineProperty(this, "itemRefs", []);
25
27
  }
26
28
 
27
29
  //flowlint-next-line unclear-type:off
@@ -64,6 +66,50 @@ export default class Accordion extends React.Component {
64
66
  typeof onChange === 'function' && onChange(newState);
65
67
  }
66
68
 
69
+ handleKeyDown(e) {
70
+ if (this.props.disabled) {
71
+ return;
72
+ }
73
+
74
+ const itemRefs = this.itemRefs;
75
+ const HOME = 36;
76
+ const END = 35;
77
+ const ARROW_UP = 38;
78
+ const ARROW_DOWN = 40;
79
+
80
+ if (e.keyCode === HOME) {
81
+ e.preventDefault();
82
+ const firstItem = itemRefs[0];
83
+ firstItem.current && firstItem.current.focus();
84
+ }
85
+
86
+ if (e.keyCode === END) {
87
+ e.preventDefault();
88
+ const lastItem = itemRefs[itemRefs.length - 1];
89
+ lastItem.current && lastItem.current.focus();
90
+ }
91
+
92
+ if (e.keyCode === ARROW_UP) {
93
+ e.preventDefault();
94
+ const activeItemIdx = itemRefs.findIndex(item => item.current === document.activeElement);
95
+
96
+ if (activeItemIdx > 0) {
97
+ const prevItem = itemRefs[activeItemIdx - 1];
98
+ prevItem.current && prevItem.current.focus();
99
+ }
100
+ }
101
+
102
+ if (e.keyCode === ARROW_DOWN) {
103
+ e.preventDefault();
104
+ const activeItemIdx = itemRefs.findIndex(item => item.current === document.activeElement);
105
+
106
+ if (activeItemIdx < itemRefs.length - 1) {
107
+ const nextItem = itemRefs[activeItemIdx + 1];
108
+ nextItem.current && nextItem.current.focus();
109
+ }
110
+ }
111
+ }
112
+
67
113
  getItems() {
68
114
  const {
69
115
  expanded
@@ -72,13 +118,14 @@ export default class Accordion extends React.Component {
72
118
  accordion,
73
119
  disabled,
74
120
  children,
75
- renderPanelContent,
76
121
  renderAll,
77
122
  overrides
78
123
  } = this.props; // flowlint-next-line unclear-type:off
79
124
 
80
125
  return React.Children.map(children, (child, index) => {
81
- if (!child) return; // If there is no key provided use the panel order as a default key
126
+ if (!child) return;
127
+ const itemRef = /*#__PURE__*/React.createRef();
128
+ this.itemRefs.push(itemRef); // If there is no key provided use the panel order as a default key
82
129
 
83
130
  const key = child.key || String(index);
84
131
  let isExpanded = false;
@@ -91,9 +138,9 @@ export default class Accordion extends React.Component {
91
138
 
92
139
  const props = {
93
140
  key,
141
+ ref: itemRef,
94
142
  expanded: isExpanded || child.props.expanded,
95
143
  accordion,
96
- renderPanelContent,
97
144
  renderAll,
98
145
  overrides: child.props.overrides || overrides,
99
146
  disabled: child.props.disabled || disabled,
@@ -103,13 +150,6 @@ export default class Accordion extends React.Component {
103
150
  });
104
151
  }
105
152
 
106
- componentDidMount() {
107
- // TODO(v11)
108
- if (process.env.NODE_ENV !== "production" && this.props.renderPanelContent) {
109
- console.warn('baseui:Accordion The `renderPanelContent` prop is deprecated. Please update your code to use `renderAll`.');
110
- }
111
- }
112
-
113
153
  render() {
114
154
  const {
115
155
  overrides = {}
@@ -121,7 +161,8 @@ export default class Accordion extends React.Component {
121
161
  return /*#__PURE__*/React.createElement(Root, _extends({
122
162
  "data-baseweb": "accordion",
123
163
  $disabled: this.props.disabled,
124
- $isFocusVisible: false
164
+ $isFocusVisible: false,
165
+ onKeyDown: this.handleKeyDown.bind(this)
125
166
  }, rootProps), this.getItems());
126
167
  }
127
168
 
@@ -136,6 +177,5 @@ _defineProperty(Accordion, "defaultProps", {
136
177
  onChange: () => {},
137
178
  overrides: {},
138
179
  renderAll: false,
139
- renderPanelContent: false,
140
180
  stateReducer: (type, newState) => newState
141
181
  });
@@ -22,9 +22,8 @@ const Panel = ({
22
22
  onKeyDown = () => {},
23
23
  overrides = {},
24
24
  title = '',
25
- renderPanelContent = false,
26
25
  renderAll = false
27
- }) => {
26
+ }, ref) => {
28
27
  const [localState, setLocalState] = React.useState({
29
28
  expanded,
30
29
  isFocusVisible: false,
@@ -148,7 +147,8 @@ const Panel = ({
148
147
  onClick: handleClick,
149
148
  onKeyDown: handleKeyDown,
150
149
  onFocus: forkFocus(headerProps, handleFocus),
151
- onBlur: forkBlur(headerProps, handleBlur)
150
+ onBlur: forkBlur(headerProps, handleBlur),
151
+ ref: ref
152
152
  }), title, /*#__PURE__*/React.createElement(ToggleIcon, _extends({
153
153
  viewBox: "0 0 24 24",
154
154
  title: localState.expanded ? locale.accordion.collapse : locale.accordion.expand,
@@ -174,7 +174,9 @@ const Panel = ({
174
174
  ref: _animateRef
175
175
  }, sharedProps, contentProps, ariaControls ? {
176
176
  id: ariaControls
177
- } : {}), localState.expanded || renderAll || renderPanelContent || localState.animationInProgress ? children : null))));
177
+ } : {}), localState.expanded || renderAll || localState.animationInProgress ? children : null))));
178
178
  };
179
179
 
180
- export default Panel;
180
+ const ForwardedPanel = /*#__PURE__*/React.forwardRef(Panel);
181
+ ForwardedPanel.displayName = 'Panel';
182
+ export default ForwardedPanel;
@@ -17,8 +17,7 @@ function StatelessAccordion({
17
17
  expanded,
18
18
  onChange,
19
19
  overrides = {},
20
- renderAll,
21
- renderPanelContent
20
+ renderAll
22
21
  }) {
23
22
  const {
24
23
  Root: RootOverrides,
@@ -57,8 +56,7 @@ function StatelessAccordion({
57
56
  });
58
57
  } : onChange,
59
58
  overrides: child.props.overrides || PanelOverrides,
60
- renderAll,
61
- renderPanelContent
59
+ renderAll
62
60
  });
63
61
  }));
64
62
  }
@@ -7,8 +7,7 @@ LICENSE file in the root directory of this source tree.
7
7
  export const KIND = {
8
8
  primary: 'primary',
9
9
  secondary: 'secondary',
10
- tertiary: 'tertiary',
11
- minimal: 'minimal'
10
+ tertiary: 'tertiary'
12
11
  };
13
12
  export const SHAPE = {
14
13
  default: 'default',
@@ -212,14 +212,6 @@ function getLoadingSpinnerColors({
212
212
  };
213
213
  }
214
214
 
215
- case KIND.minimal:
216
- {
217
- return {
218
- foreground: $theme.colors.buttonMinimalSpinnerForeground,
219
- background: $theme.colors.buttonMinimalSpinnerBackground
220
- };
221
- }
222
-
223
215
  case KIND.primary:
224
216
  default:
225
217
  {
@@ -289,7 +281,7 @@ function getDisabledStyles({
289
281
  color: $theme.colors.buttonDisabledActiveText,
290
282
  backgroundColor: $theme.colors.buttonDisabledActiveFill
291
283
  };
292
- } else if ($kind === KIND.minimal || $kind === KIND.tertiary) {
284
+ } else if ($kind === KIND.tertiary) {
293
285
  return {
294
286
  backgroundColor: $theme.colors.buttonTertiaryDisabledActiveFill,
295
287
  color: $theme.colors.buttonTertiaryDisabledActiveText
@@ -298,7 +290,7 @@ function getDisabledStyles({
298
290
  }
299
291
 
300
292
  return {
301
- backgroundColor: $kind === KIND.minimal || $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
293
+ backgroundColor: $kind === KIND.tertiary ? 'transparent' : $theme.colors.buttonDisabledFill,
302
294
  color: $theme.colors.buttonDisabledText
303
295
  };
304
296
  }
@@ -428,25 +420,6 @@ function getColorStyles({
428
420
  }
429
421
  };
430
422
 
431
- case KIND.minimal:
432
- if ($isSelected) {
433
- return {
434
- color: $theme.colors.buttonMinimalSelectedText,
435
- backgroundColor: $theme.colors.buttonMinimalSelectedFill
436
- };
437
- }
438
-
439
- return {
440
- color: $theme.colors.buttonMinimalText,
441
- backgroundColor: $theme.colors.buttonMinimalFill,
442
- ':hover': {
443
- backgroundColor: $isLoading ? $theme.colors.buttonMinimalActive : $theme.colors.buttonMinimalHover
444
- },
445
- ':active': {
446
- backgroundColor: $theme.colors.buttonMinimalActive
447
- }
448
- };
449
-
450
423
  default:
451
424
  return Object.freeze({});
452
425
  }
@@ -10,7 +10,7 @@ LICENSE file in the root directory of this source tree.
10
10
  */
11
11
  import * as React from 'react';
12
12
  import { getOverride, getOverrideProps } from '../helpers/overrides.js';
13
- import { Checkmark as StyledCheckmark, Input as StyledInput, Label as StyledLabel, Root as StyledRoot, Toggle as StyledToggle, ToggleInner as StyledToggleInner, ToggleTrack as StyledToggleTrack } from './styled-components.js';
13
+ import { Checkmark as StyledCheckmark, Input as StyledInput, Label as StyledLabel, Root as StyledRoot, Toggle as StyledToggle, ToggleTrack as StyledToggleTrack } from './styled-components.js';
14
14
  import { STYLE_TYPE } from './constants.js';
15
15
  import { isFocusVisible } from '../utils/focusVisible.js';
16
16
 
@@ -81,10 +81,6 @@ class StatelessCheckbox extends React.Component {
81
81
  });
82
82
  }
83
83
  });
84
-
85
- _defineProperty(this, "isToggle", () => {
86
- return this.props.checkmarkType === STYLE_TYPE.toggle || this.props.checkmarkType === STYLE_TYPE.toggle_round;
87
- });
88
84
  }
89
85
 
90
86
  componentDidMount() {
@@ -95,31 +91,16 @@ class StatelessCheckbox extends React.Component {
95
91
 
96
92
  if (autoFocus && inputRef.current) {
97
93
  inputRef.current.focus();
98
- } // TODO(v11)
99
-
100
-
101
- if (process.env.NODE_ENV !== "production") {
102
- if (this.props.checkmarkType === STYLE_TYPE.toggle) {
103
- console.warn("baseui:Checkbox The STYLE_TYPE.toggle value on the 'checkmarkType' prop does not conform to the current base design specification. " + 'Please update your code to STYLE_TYPE.toggle_round. This will be updated automatically in a future major version.');
104
- }
105
-
106
- if (this.props.isError) {
107
- console.warn('baseui:Checkbox Property "isError" will be removed in the next major version. Use "error" property instead.');
108
- }
109
94
  }
110
95
  }
111
96
 
112
97
  render() {
113
- const {
114
- checkmarkType
115
- } = this.props;
116
98
  const {
117
99
  overrides = {},
118
100
  onChange,
119
- labelPlacement = this.isToggle() ? 'left' : 'right',
101
+ labelPlacement = this.props.checkmarkType === STYLE_TYPE.toggle ? 'left' : 'right',
120
102
  inputRef,
121
103
  isIndeterminate,
122
- isError,
123
104
  error,
124
105
  disabled,
125
106
  value,
@@ -136,7 +117,6 @@ class StatelessCheckbox extends React.Component {
136
117
  Label: LabelOverride,
137
118
  Input: InputOverride,
138
119
  Toggle: ToggleOverride,
139
- ToggleInner: ToggleInnerOverride,
140
120
  ToggleTrack: ToggleTrackOverride
141
121
  } = overrides;
142
122
  const Root = getOverride(RootOverride) || StyledRoot;
@@ -144,7 +124,6 @@ class StatelessCheckbox extends React.Component {
144
124
  const Label = getOverride(LabelOverride) || StyledLabel;
145
125
  const Input = getOverride(InputOverride) || StyledInput;
146
126
  const Toggle = getOverride(ToggleOverride) || StyledToggle;
147
- const ToggleInner = getOverride(ToggleInnerOverride) || StyledToggleInner;
148
127
  const ToggleTrack = getOverride(ToggleTrackOverride) || StyledToggleTrack;
149
128
  const inputEvents = {
150
129
  onChange,
@@ -162,17 +141,14 @@ class StatelessCheckbox extends React.Component {
162
141
  $isFocusVisible: this.state.isFocusVisible,
163
142
  $isHovered: this.state.isHovered,
164
143
  $isActive: this.state.isActive,
165
- $isError: isError,
166
144
  $error: error,
167
145
  $checked: checked,
168
146
  $isIndeterminate: isIndeterminate,
169
147
  $required: required,
170
148
  $disabled: disabled,
171
- $value: value,
172
- $checkmarkType: checkmarkType
173
- }; // TODO(v11) - add check for children (#2172)
174
-
175
- const labelComp = /*#__PURE__*/React.createElement(Label, _extends({
149
+ $value: value
150
+ };
151
+ const labelComp = children && /*#__PURE__*/React.createElement(Label, _extends({
176
152
  $labelPlacement: labelPlacement
177
153
  }, sharedProps, getOverrideProps(LabelOverride)), this.props.containsInteractiveElement ?
178
154
  /*#__PURE__*/
@@ -185,7 +161,7 @@ class StatelessCheckbox extends React.Component {
185
161
  "data-baseweb": "checkbox",
186
162
  title: title || null,
187
163
  $labelPlacement: labelPlacement
188
- }, sharedProps, mouseEvents, getOverrideProps(RootOverride)), (labelPlacement === 'top' || labelPlacement === 'left') && labelComp, this.isToggle() ? /*#__PURE__*/React.createElement(ToggleTrack, _extends({}, sharedProps, getOverrideProps(ToggleTrackOverride)), /*#__PURE__*/React.createElement(Toggle, _extends({}, sharedProps, getOverrideProps(ToggleOverride)), /*#__PURE__*/React.createElement(ToggleInner, _extends({}, sharedProps, getOverrideProps(ToggleInnerOverride))))) : /*#__PURE__*/React.createElement(Checkmark, _extends({}, sharedProps, getOverrideProps(CheckmarkOverride))), /*#__PURE__*/React.createElement(Input, _extends({
164
+ }, sharedProps, mouseEvents, getOverrideProps(RootOverride)), (labelPlacement === 'top' || labelPlacement === 'left') && labelComp, this.props.checkmarkType === STYLE_TYPE.toggle ? /*#__PURE__*/React.createElement(ToggleTrack, _extends({}, sharedProps, getOverrideProps(ToggleTrackOverride)), /*#__PURE__*/React.createElement(Toggle, _extends({}, sharedProps, getOverrideProps(ToggleOverride)))) : /*#__PURE__*/React.createElement(Checkmark, _extends({}, sharedProps, getOverrideProps(CheckmarkOverride))), /*#__PURE__*/React.createElement(Input, _extends({
189
165
  value: value,
190
166
  name: name,
191
167
  checked: checked,
@@ -194,7 +170,7 @@ class StatelessCheckbox extends React.Component {
194
170
  "aria-checked": isIndeterminate ? 'mixed' : checked,
195
171
  "aria-describedby": this.props['aria-describedby'],
196
172
  "aria-errormessage": this.props['aria-errormessage'],
197
- "aria-invalid": error || isError || null,
173
+ "aria-invalid": error || null,
198
174
  "aria-required": required || null,
199
175
  disabled: disabled,
200
176
  type: type,
@@ -215,7 +191,6 @@ _defineProperty(StatelessCheckbox, "defaultProps", {
215
191
  autoFocus: false,
216
192
  isIndeterminate: false,
217
193
  inputRef: /*#__PURE__*/React.createRef(),
218
- isError: false,
219
194
  error: false,
220
195
  type: 'checkbox',
221
196
  checkmarkType: STYLE_TYPE.default,
@@ -12,7 +12,8 @@ export const STATE_TYPE = {
12
12
  export const STYLE_TYPE = Object.freeze({
13
13
  default: 'default',
14
14
  toggle: 'toggle',
15
- toggle_round: 'toggle_round'
15
+ // maintaining key with aliased value to assist in transition to v11 but will be removed soon after release
16
+ toggle_round: 'toggle'
16
17
  });
17
18
  export const LABEL_PLACEMENT = Object.freeze({
18
19
  top: 'top',
@@ -8,5 +8,5 @@ export { default as StatefulCheckbox } from './stateful-checkbox.js';
8
8
  export { default as StatefulContainer } from './stateful-checkbox-container.js';
9
9
  export { default as Checkbox } from './checkbox.js'; // Styled elements
10
10
 
11
- export { Root as StyledRoot, Checkmark as StyledCheckmark, Label as StyledLabel, Input as StyledInput, Toggle as StyledToggle, ToggleInner as StyledToggleInner, ToggleTrack as StyledToggleTrack } from './styled-components.js';
11
+ export { Root as StyledRoot, Checkmark as StyledCheckmark, Label as StyledLabel, Input as StyledInput, Toggle as StyledToggle, ToggleTrack as StyledToggleTrack } from './styled-components.js';
12
12
  export { STATE_TYPE, STYLE_TYPE, LABEL_PLACEMENT } from './constants.js'; // Flow