baseui 11.0.1 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/a11y/index.d.ts +1 -1
  2. package/accordion/index.d.ts +25 -28
  3. package/app-nav-bar/app-nav-bar.js +33 -40
  4. package/app-nav-bar/app-nav-bar.js.flow +46 -62
  5. package/app-nav-bar/index.d.ts +9 -8
  6. package/app-nav-bar/styled-components.js +49 -29
  7. package/app-nav-bar/styled-components.js.flow +25 -8
  8. package/app-nav-bar/types.js.flow +2 -0
  9. package/aspect-ratio-box/index.d.ts +2 -4
  10. package/avatar/index.d.ts +6 -12
  11. package/badge/badge.js +109 -0
  12. package/badge/badge.js.flow +91 -0
  13. package/badge/constants.js +54 -0
  14. package/badge/constants.js.flow +52 -0
  15. package/badge/hint-dot.js +96 -0
  16. package/badge/hint-dot.js.flow +68 -0
  17. package/badge/index.d.ts +97 -0
  18. package/badge/index.js +80 -0
  19. package/badge/index.js.flow +20 -0
  20. package/badge/notification-circle.js +103 -0
  21. package/badge/notification-circle.js.flow +81 -0
  22. package/badge/package.json +4 -0
  23. package/badge/styled-components.js +242 -0
  24. package/badge/styled-components.js.flow +325 -0
  25. package/badge/types.js +11 -0
  26. package/badge/types.js.flow +59 -0
  27. package/badge/utils.js +33 -0
  28. package/badge/utils.js.flow +23 -0
  29. package/banner/banner.js +283 -0
  30. package/banner/banner.js.flow +253 -0
  31. package/banner/constants.js +35 -0
  32. package/banner/constants.js.flow +33 -0
  33. package/banner/index.d.ts +75 -0
  34. package/banner/index.js +44 -0
  35. package/banner/index.js.flow +16 -0
  36. package/banner/package.json +4 -0
  37. package/banner/styled-components.js +131 -0
  38. package/banner/styled-components.js.flow +119 -0
  39. package/banner/types.js +11 -0
  40. package/banner/types.js.flow +66 -0
  41. package/block/index.d.ts +4 -4
  42. package/breadcrumbs/breadcrumbs.js +5 -1
  43. package/breadcrumbs/breadcrumbs.js.flow +2 -2
  44. package/breadcrumbs/index.d.ts +5 -5
  45. package/button/button.js +2 -1
  46. package/button/button.js.flow +1 -0
  47. package/button/index.d.ts +19 -29
  48. package/button-group/index.d.ts +18 -24
  49. package/card/index.d.ts +16 -14
  50. package/checkbox/index.d.ts +17 -21
  51. package/combobox/index.d.ts +7 -11
  52. package/data-table/index.d.ts +7 -10
  53. package/datepicker/calendar.js +16 -11
  54. package/datepicker/calendar.js.flow +12 -9
  55. package/datepicker/datepicker.js +58 -58
  56. package/datepicker/datepicker.js.flow +51 -34
  57. package/datepicker/index.d.ts +42 -63
  58. package/datepicker/stateful-calendar.js +6 -1
  59. package/datepicker/stateful-calendar.js.flow +8 -1
  60. package/datepicker/stateful-container.js +23 -2
  61. package/datepicker/stateful-container.js.flow +17 -4
  62. package/datepicker/stateful-datepicker.js +6 -1
  63. package/datepicker/stateful-datepicker.js.flow +7 -1
  64. package/datepicker/types.js.flow +21 -43
  65. package/datepicker/utils/date-helpers.js +1 -1
  66. package/datepicker/utils/date-helpers.js.flow +1 -1
  67. package/dnd-list/index.d.ts +22 -35
  68. package/drawer/index.d.ts +22 -27
  69. package/es/app-nav-bar/app-nav-bar.js +9 -19
  70. package/es/app-nav-bar/styled-components.js +32 -13
  71. package/es/badge/badge.js +70 -0
  72. package/es/badge/constants.js +42 -0
  73. package/es/badge/hint-dot.js +55 -0
  74. package/es/badge/index.js +11 -0
  75. package/es/badge/notification-circle.js +65 -0
  76. package/es/badge/styled-components.js +296 -0
  77. package/es/badge/types.js +8 -0
  78. package/es/badge/utils.js +17 -0
  79. package/es/banner/banner.js +213 -0
  80. package/es/banner/constants.js +24 -0
  81. package/es/banner/index.js +9 -0
  82. package/es/banner/styled-components.js +122 -0
  83. package/es/banner/types.js +8 -0
  84. package/es/breadcrumbs/breadcrumbs.js +5 -1
  85. package/es/button/button.js +1 -0
  86. package/es/datepicker/calendar.js +15 -10
  87. package/es/datepicker/datepicker.js +52 -52
  88. package/es/datepicker/stateful-calendar.js +6 -1
  89. package/es/datepicker/stateful-container.js +22 -2
  90. package/es/datepicker/stateful-datepicker.js +6 -1
  91. package/es/datepicker/utils/date-helpers.js +1 -1
  92. package/es/helper/helper-steps.js +3 -1
  93. package/es/input/base-input.js +18 -11
  94. package/es/input/input.js +15 -10
  95. package/es/input/masked-input.js +5 -2
  96. package/es/input/utils.js +4 -2
  97. package/es/locale/tr_TR.js +115 -0
  98. package/es/notification/notification.js +16 -1
  99. package/es/payment-card/custom-cards.config.js +22 -0
  100. package/es/payment-card/icons/uatp.js +52 -0
  101. package/es/payment-card/payment-card.js +8 -3
  102. package/es/popover/popover.js +2 -1
  103. package/es/popover/stateful-container.js +2 -0
  104. package/es/popover/styled-components.js +2 -1
  105. package/es/progress-steps/numbered-step.js +2 -2
  106. package/es/select/select-component.js +48 -23
  107. package/es/select/utils/default-filter-options.js +1 -1
  108. package/es/snackbar/snackbar-context.js +1 -1
  109. package/es/table-semantic/styled-components.js +14 -0
  110. package/es/table-semantic/table-builder.js +12 -5
  111. package/es/textarea/textarea.js +15 -9
  112. package/es/themes/dark-theme/color-component-tokens.js +8 -0
  113. package/es/themes/light-theme/color-component-tokens.js +8 -0
  114. package/es/tree-view/tree-label.js +9 -1
  115. package/esm/app-nav-bar/app-nav-bar.js +32 -38
  116. package/esm/app-nav-bar/styled-components.js +46 -28
  117. package/esm/badge/badge.js +97 -0
  118. package/esm/badge/constants.js +42 -0
  119. package/esm/badge/hint-dot.js +83 -0
  120. package/esm/badge/index.js +11 -0
  121. package/esm/badge/notification-circle.js +91 -0
  122. package/esm/badge/styled-components.js +235 -0
  123. package/esm/badge/types.js +8 -0
  124. package/esm/badge/utils.js +17 -0
  125. package/esm/banner/banner.js +271 -0
  126. package/esm/banner/constants.js +24 -0
  127. package/esm/banner/index.js +9 -0
  128. package/esm/banner/styled-components.js +113 -0
  129. package/esm/banner/types.js +8 -0
  130. package/esm/breadcrumbs/breadcrumbs.js +5 -1
  131. package/esm/button/button.js +2 -1
  132. package/esm/datepicker/calendar.js +16 -11
  133. package/esm/datepicker/datepicker.js +58 -58
  134. package/esm/datepicker/stateful-calendar.js +6 -1
  135. package/esm/datepicker/stateful-container.js +23 -2
  136. package/esm/datepicker/stateful-datepicker.js +6 -1
  137. package/esm/datepicker/utils/date-helpers.js +1 -1
  138. package/esm/helper/helper-steps.js +3 -1
  139. package/esm/input/base-input.js +18 -11
  140. package/esm/input/input.js +15 -10
  141. package/esm/input/masked-input.js +6 -3
  142. package/esm/input/utils.js +4 -2
  143. package/esm/locale/tr_TR.js +115 -0
  144. package/esm/notification/notification.js +17 -1
  145. package/esm/payment-card/custom-cards.config.js +22 -0
  146. package/esm/payment-card/icons/uatp.js +53 -0
  147. package/esm/payment-card/payment-card.js +9 -7
  148. package/esm/popover/popover.js +2 -1
  149. package/esm/popover/stateful-container.js +2 -0
  150. package/esm/popover/styled-components.js +3 -2
  151. package/esm/progress-steps/numbered-step.js +2 -2
  152. package/esm/select/select-component.js +85 -59
  153. package/esm/select/utils/default-filter-options.js +1 -1
  154. package/esm/snackbar/snackbar-context.js +1 -1
  155. package/esm/table-semantic/styled-components.js +31 -18
  156. package/esm/table-semantic/table-builder.js +34 -23
  157. package/esm/textarea/textarea.js +15 -9
  158. package/esm/themes/dark-theme/color-component-tokens.js +8 -0
  159. package/esm/themes/light-theme/color-component-tokens.js +8 -0
  160. package/esm/tree-view/tree-label.js +10 -2
  161. package/file-uploader/index.d.ts +11 -11
  162. package/flex-grid/index.d.ts +3 -3
  163. package/form-control/index.d.ts +7 -19
  164. package/header-navigation/index.d.ts +8 -9
  165. package/heading/index.d.ts +3 -4
  166. package/helper/helper-steps.js +19 -13
  167. package/helper/helper-steps.js.flow +3 -1
  168. package/helper/index.d.ts +7 -7
  169. package/helpers/base-provider.d.ts +16 -0
  170. package/helpers/overrides.d.ts +23 -0
  171. package/icon/index.d.ts +32 -32
  172. package/index.d.ts +34 -114
  173. package/input/base-input.js +18 -11
  174. package/input/base-input.js.flow +18 -6
  175. package/input/index.d.ts +29 -32
  176. package/input/input.js +15 -10
  177. package/input/input.js.flow +10 -5
  178. package/input/masked-input.js +6 -3
  179. package/input/masked-input.js.flow +3 -0
  180. package/input/types.js.flow +4 -0
  181. package/input/utils.js +4 -2
  182. package/input/utils.js.flow +2 -1
  183. package/layer/index.d.ts +6 -11
  184. package/layout-grid/index.d.ts +25 -7
  185. package/link/index.d.ts +2 -2
  186. package/list/index.d.ts +26 -31
  187. package/{locale.ts → locale/index.d.ts} +8 -0
  188. package/locale/tr_TR.js +123 -0
  189. package/locale/tr_TR.js.flow +124 -0
  190. package/map-marker/index.d.ts +41 -47
  191. package/menu/index.d.ts +27 -37
  192. package/modal/index.d.ts +28 -38
  193. package/notification/index.d.ts +2 -3
  194. package/notification/notification.js +18 -1
  195. package/notification/notification.js.flow +15 -1
  196. package/overrides.ts +2 -22
  197. package/package.json +26 -17
  198. package/pagination/index.d.ts +22 -26
  199. package/payment-card/custom-cards.config.js +30 -0
  200. package/payment-card/custom-cards.config.js.flow +29 -0
  201. package/payment-card/icons/uatp.js +67 -0
  202. package/payment-card/icons/uatp.js.flow +62 -0
  203. package/payment-card/index.d.ts +8 -8
  204. package/payment-card/payment-card.js +12 -7
  205. package/payment-card/payment-card.js.flow +12 -0
  206. package/phone-input/index.d.ts +261 -269
  207. package/pin-code/index.d.ts +11 -18
  208. package/popover/index.d.ts +39 -55
  209. package/popover/popover.js +2 -1
  210. package/popover/popover.js.flow +2 -1
  211. package/popover/stateful-container.js +2 -0
  212. package/popover/stateful-container.js.flow +2 -0
  213. package/popover/styled-components.js +3 -2
  214. package/popover/styled-components.js.flow +2 -1
  215. package/popover/types.js.flow +1 -0
  216. package/progress-bar/index.d.ts +11 -12
  217. package/progress-steps/index.d.ts +16 -16
  218. package/progress-steps/numbered-step.js.flow +2 -2
  219. package/radio/index.d.ts +12 -15
  220. package/rating/index.d.ts +9 -12
  221. package/select/index.d.ts +34 -36
  222. package/select/select-component.js +82 -56
  223. package/select/select-component.js.flow +46 -34
  224. package/select/types.js.flow +1 -0
  225. package/select/utils/default-filter-options.js +1 -1
  226. package/select/utils/default-filter-options.js.flow +1 -1
  227. package/side-navigation/index.d.ts +11 -13
  228. package/skeleton/index.d.ts +1 -1
  229. package/slider/index.d.ts +17 -26
  230. package/snackbar/index.d.ts +8 -8
  231. package/snackbar/snackbar-context.js +1 -1
  232. package/snackbar/snackbar-context.js.flow +1 -1
  233. package/spinner/index.d.ts +4 -3
  234. package/styles/index.d.ts +82 -2
  235. package/table/index.d.ts +16 -16
  236. package/table-grid/index.d.ts +6 -8
  237. package/table-semantic/index.d.ts +26 -32
  238. package/table-semantic/styled-components.js +33 -19
  239. package/table-semantic/styled-components.js.flow +12 -0
  240. package/table-semantic/table-builder.js +38 -22
  241. package/table-semantic/table-builder.js.flow +32 -17
  242. package/table-semantic/types.js.flow +1 -0
  243. package/tabs/index.d.ts +20 -23
  244. package/tabs-motion/index.d.ts +23 -23
  245. package/tag/index.d.ts +14 -18
  246. package/tag/types.js.flow +1 -1
  247. package/textarea/index.d.ts +11 -14
  248. package/textarea/textarea.js +15 -9
  249. package/textarea/textarea.js.flow +11 -5
  250. package/textarea/types.js.flow +1 -0
  251. package/theme.ts +36 -777
  252. package/themes/dark-theme/color-component-tokens.js +8 -0
  253. package/themes/dark-theme/color-component-tokens.js.flow +9 -0
  254. package/themes/index.d.ts +765 -0
  255. package/themes/light-theme/color-component-tokens.js +8 -0
  256. package/themes/light-theme/color-component-tokens.js.flow +9 -0
  257. package/themes/types.js.flow +9 -0
  258. package/timepicker/index.d.ts +5 -8
  259. package/timezonepicker/index.d.ts +5 -8
  260. package/toast/index.d.ts +26 -40
  261. package/tokens/index.d.ts +1 -1
  262. package/tooltip/index.d.ts +7 -9
  263. package/tree-view/index.d.ts +15 -19
  264. package/tree-view/tree-label.js +10 -2
  265. package/tree-view/tree-label.js.flow +4 -4
  266. package/typography/index.d.ts +37 -37
package/card/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import {StyletronComponent} from 'styletron-react';
3
- import {Override} from '../overrides';
2
+ import { StyletronComponent } from 'styletron-react';
3
+ import { Override } from '../overrides';
4
4
 
5
5
  export interface CardOverrides {
6
6
  Action?: Override<any>;
@@ -14,20 +14,22 @@ export interface CardOverrides {
14
14
  export interface CardProps {
15
15
  readonly action?: React.ReactNode;
16
16
  readonly children?: React.ReactNode;
17
- readonly hasThumbnail?: (props: {readonly thumbnail?: string}) => boolean;
18
- readonly headerImage?: string | React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
17
+ readonly hasThumbnail?: (props: { readonly thumbnail?: string }) => boolean;
18
+ readonly headerImage?:
19
+ | string
20
+ | React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
19
21
  readonly overrides?: CardOverrides;
20
22
  readonly thumbnail?: string;
21
23
  readonly title?: React.ReactNode;
22
24
  }
23
- export const Card: React.FC<CardProps>;
24
- export type hasThumbnail = (props: {readonly thumbnail?: string}) => boolean;
25
+ export declare const Card: React.FC<CardProps>;
26
+ export type hasThumbnail = (props: { readonly thumbnail?: string }) => boolean;
25
27
 
26
- export const StyledAction: StyletronComponent<any>;
27
- export const StyledBody: StyletronComponent<any>;
28
- export const StyledContents: StyletronComponent<any>;
29
- export const StyledHeaderImage: StyletronComponent<any>;
30
- export const StyledThumbnail: StyletronComponent<any>;
31
- export const StyledTitle: StyletronComponent<any>;
32
- export const StyledRoot: StyletronComponent<any>;
33
- export const StyledWrapper: StyletronComponent<any>;
28
+ export declare const StyledAction: StyletronComponent<any>;
29
+ export declare const StyledBody: StyletronComponent<any>;
30
+ export declare const StyledContents: StyletronComponent<any>;
31
+ export declare const StyledHeaderImage: StyletronComponent<any>;
32
+ export declare const StyledThumbnail: StyletronComponent<any>;
33
+ export declare const StyledTitle: StyletronComponent<any>;
34
+ export declare const StyledRoot: StyletronComponent<any>;
35
+ export declare const StyledWrapper: StyletronComponent<any>;
@@ -2,34 +2,34 @@ import * as React from 'react';
2
2
  import { StyletronComponent } from 'styletron-react';
3
3
  import { Override } from '../overrides';
4
4
 
5
- export interface STATE_TYPE {
5
+ export declare const STATE_TYPE: {
6
6
  change: 'CHANGE';
7
- }
8
- export interface STYLE_TYPE {
7
+ };
8
+ export declare const STYLE_TYPE: {
9
9
  default: 'default';
10
10
  toggle: 'toggle';
11
11
  toggle_round: 'toggle';
12
- }
12
+ };
13
13
 
14
- export interface LABEL_PLACEMENT {
14
+ export declare const LABEL_PLACEMENT: {
15
15
  top: 'top';
16
16
  right: 'right';
17
17
  bottom: 'bottom';
18
18
  left: 'left';
19
- }
19
+ };
20
20
 
21
21
  type initialState = {
22
22
  checked?: boolean;
23
23
  isIndeterminate?: boolean;
24
24
  };
25
25
 
26
- export const StyledRoot: StyletronComponent<any>;
27
- export const StyledCheckmark: StyletronComponent<any>;
28
- export const StyledLabel: StyletronComponent<any>;
29
- export const StyledInput: StyletronComponent<any>;
30
- export const StyledToggle: StyletronComponent<any>;
31
- export const StyledToggleInner: StyletronComponent<any>;
32
- export const StyledToggleTrack: StyletronComponent<any>;
26
+ export declare const StyledRoot: StyletronComponent<any>;
27
+ export declare const StyledCheckmark: StyletronComponent<any>;
28
+ export declare const StyledLabel: StyletronComponent<any>;
29
+ export declare const StyledInput: StyletronComponent<any>;
30
+ export declare const StyledToggle: StyletronComponent<any>;
31
+ export declare const StyledToggleInner: StyletronComponent<any>;
32
+ export declare const StyledToggleTrack: StyletronComponent<any>;
33
33
 
34
34
  export type StateReducer = (
35
35
  stateType: string,
@@ -51,7 +51,7 @@ export interface StatefulContainerProps {
51
51
  autoFocus?: boolean;
52
52
  }
53
53
 
54
- export const StatefulContainer: React.FC<StatefulContainerProps>;
54
+ export declare const StatefulContainer: React.FC<StatefulContainerProps>;
55
55
 
56
56
  export interface StatefulCheckboxProps {
57
57
  overrides?: CheckboxOverrides;
@@ -64,7 +64,7 @@ export interface StatefulCheckboxProps {
64
64
  children?: React.ReactNode;
65
65
  initialState?: initialState;
66
66
  autoFocus?: boolean;
67
- checkmarkType?: STYLE_TYPE[keyof STYLE_TYPE];
67
+ checkmarkType?: typeof STYLE_TYPE[keyof typeof STYLE_TYPE];
68
68
  onChange?: React.FormEventHandler<HTMLInputElement>;
69
69
  onMouseEnter?: React.MouseEventHandler<HTMLInputElement>;
70
70
  onMouseLeave?: React.MouseEventHandler<HTMLInputElement>;
@@ -72,7 +72,7 @@ export interface StatefulCheckboxProps {
72
72
  onBlur?: React.FocusEventHandler<HTMLInputElement>;
73
73
  }
74
74
 
75
- export const StatefulCheckbox: React.FC<StatefulCheckboxProps>;
75
+ export declare const StatefulCheckbox: React.FC<StatefulCheckboxProps>;
76
76
 
77
77
  export interface CheckboxOverrides {
78
78
  Checkmark?: Override<any>;
@@ -101,7 +101,7 @@ export interface CheckboxProps {
101
101
  value?: string;
102
102
  isIndeterminate?: boolean;
103
103
  labelPlacement?: 'top' | 'right' | 'bottom' | 'left';
104
- checkmarkType?: STYLE_TYPE[keyof STYLE_TYPE];
104
+ checkmarkType?: typeof STYLE_TYPE[keyof typeof STYLE_TYPE];
105
105
  title?: string;
106
106
  ariaLabel?: string;
107
107
  'aria-label'?: string;
@@ -128,7 +128,3 @@ export class Checkbox extends React.Component<CheckboxProps, CheckboxState> {
128
128
  onFocus(event: React.FocusEvent<HTMLInputElement>): void;
129
129
  onBlur(event: React.FocusEvent<HTMLInputElement>): void;
130
130
  }
131
-
132
- export const STATE_TYPE: STATE_TYPE;
133
- export const STYLE_TYPE: STYLE_TYPE;
134
- export const LABEL_PLACEMENT: LABEL_PLACEMENT;
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
- import {Override} from '../overrides';
2
+ import { Override } from '../overrides';
3
3
 
4
- export interface SIZE {
4
+ export declare const SIZE: {
5
5
  compact: 'compact';
6
6
  default: 'default';
7
7
  large: 'large';
8
8
  mini: 'mini';
9
- }
9
+ };
10
10
 
11
11
  export interface ComboboxOverrides {
12
12
  Root?: Override<any>;
@@ -20,10 +20,7 @@ export interface ComboboxOverrides {
20
20
  export type PropsT<OptionT = any> = {
21
21
  autocomplete?: boolean;
22
22
  disabled?: boolean;
23
- mapOptionToNode?: (option: {
24
- isSelected: boolean;
25
- option: OptionT;
26
- }) => React.ReactNode;
23
+ mapOptionToNode?: (option: { isSelected: boolean; option: OptionT }) => React.ReactNode;
27
24
  mapOptionToString: (option: OptionT) => string;
28
25
  id?: string;
29
26
  name?: string;
@@ -31,12 +28,11 @@ export type PropsT<OptionT = any> = {
31
28
  onBlur?: (event: React.FocusEvent<HTMLInputElement>) => any;
32
29
  onChange?: (value: string, option: OptionT | null) => any;
33
30
  onFocus?: (event: React.FocusEvent<HTMLInputElement>) => any;
34
- onSubmit?: (params: {closeListbox: () => void; value: string}) => any;
31
+ onSubmit?: (params: { closeListbox: () => void; value: string }) => any;
35
32
  options: OptionT[];
36
33
  overrides?: ComboboxOverrides;
37
- size?: SIZE[keyof SIZE];
34
+ size?: typeof SIZE[keyof typeof SIZE];
38
35
  value: string;
39
36
  };
40
37
 
41
- export const Combobox: React.FC<PropsT>;
42
- export const SIZE: SIZE;
38
+ export declare const Combobox: React.FC<PropsT>;
@@ -10,7 +10,7 @@ export function CustomColumn<ValueT, FilterParamsT>(options: any): any;
10
10
  export function NumericalColumn(options: any): any;
11
11
  export function StringColumn(options: any): any;
12
12
 
13
- export interface COLUMNS {
13
+ export declare const COLUMNS: {
14
14
  ANCHOR: 'ANCHOR';
15
15
  CATEGORICAL: 'CATEGORICAL';
16
16
  DATETIME: 'DATETIME';
@@ -18,23 +18,20 @@ export interface COLUMNS {
18
18
  BOOLEAN: 'BOOLEAN';
19
19
  STRING: 'STRING';
20
20
  CUSTOM: 'CUSTOM';
21
- }
22
- export const COLUMNS: COLUMNS;
21
+ };
23
22
 
24
- export interface NUMERICAL_FORMATS {
23
+ export declare const NUMERICAL_FORMATS: {
25
24
  DEFAULT: 'DEFAULT';
26
25
  ACCOUNTING: 'ACCOUNTING';
27
26
  PERCENTAGE: 'PERCENTAGE';
28
- }
29
- export const NUMERICAL_FORMATS: NUMERICAL_FORMATS;
27
+ };
30
28
 
31
- export interface SORT_DIRECTIONS {
29
+ export declare const SORT_DIRECTIONS: {
32
30
  ASC: 'ASC';
33
31
  DESC: 'DESC';
34
- }
35
- export const SORT_DIRECTIONS: SORT_DIRECTIONS;
32
+ };
36
33
 
37
- export type SortDirectionsT = SORT_DIRECTIONS['ASC'] | SORT_DIRECTIONS['DESC'] | null;
34
+ export type SortDirectionsT = typeof SORT_DIRECTIONS[keyof typeof SORT_DIRECTIONS] | null;
38
35
  export type ColumnT = any;
39
36
  export type RowT = {
40
37
  id: number | string;
@@ -333,12 +333,12 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
333
333
  _defineProperty(_assertThisInitialized(_this), "handleDateChange", function (data) {
334
334
  var _this$props$onChange = _this.props.onChange,
335
335
  onChange = _this$props$onChange === void 0 ? function (params) {} : _this$props$onChange;
336
- var updatedDate = data.date; // We'll need to update the date in time values of internal state
337
-
338
- var newTimeState = _toConsumableArray(_this.state.time); // Apply the currently selected time values (saved in state) to the updated date
339
-
336
+ var updatedDate = data.date; // Apply the currently selected time values (saved in state) to the updated date
340
337
 
341
338
  if (Array.isArray(data.date)) {
339
+ // We'll need to update the date in time values of internal state
340
+ var newTimeState = _toConsumableArray(_this.state.time);
341
+
342
342
  var start = data.date[0] ? _this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
343
343
  var end = data.date[1] ? _this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
344
344
  newTimeState[0] = start;
@@ -348,16 +348,21 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
348
348
  newTimeState[1] = end;
349
349
  } else {
350
350
  updatedDate = [start];
351
- }
351
+ } // Update the date in time values of internal state
352
+
353
+
354
+ _this.setState({
355
+ time: newTimeState
356
+ });
352
357
  } else if (!Array.isArray(_this.props.value) && data.date) {
353
- newTimeState[0] = _this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
354
- updatedDate = newTimeState[0];
355
- } // Update the date in time values of internal state
358
+ var _newTimeState = _this.dateHelpers.applyDateToTime(_this.state.time[0], data.date);
356
359
 
360
+ updatedDate = _newTimeState; // Update the date in time values of internal state
357
361
 
358
- _this.setState({
359
- time: newTimeState
360
- });
362
+ _this.setState({
363
+ time: [_newTimeState]
364
+ });
365
+ }
361
366
 
362
367
  onChange({
363
368
  date: updatedDate
@@ -22,7 +22,7 @@ import {
22
22
  import dateFnsAdapter from './utils/date-fns-adapter.js';
23
23
  import DateHelpers from './utils/date-helpers.js';
24
24
  import { getOverrides, mergeOverrides } from '../helpers/overrides.js';
25
- import type { CalendarPropsT, CalendarInternalState, DateValueT } from './types.js';
25
+ import type { CalendarPropsT, CalendarInternalState } from './types.js';
26
26
  import { DENSITY, ORIENTATION } from './constants.js';
27
27
 
28
28
  export default class Calendar<T = Date> extends React.Component<
@@ -134,7 +134,7 @@ export default class Calendar<T = Date> extends React.Component<
134
134
  return monthDelta >= 0 && monthDelta < (this.props.monthsShown || 1);
135
135
  }
136
136
 
137
- getSingleDate(value: DateValueT<T>): ?T {
137
+ getSingleDate(value: ?T | $ReadOnlyArray<?T>): ?T {
138
138
  // need to check this.props.range but flow would complain
139
139
  // at the return value in the else clause
140
140
  if (Array.isArray(value)) {
@@ -339,13 +339,13 @@ export default class Calendar<T = Date> extends React.Component<
339
339
 
340
340
  /** Responsible for merging time values into date values. Note: the 'Day' component
341
341
  * determines how the days themselves change when a new day is selected. */
342
- handleDateChange: ({ date: DateValueT<T> }) => void = (data) => {
342
+ handleDateChange: ({ +date: ?T | Array<?T> }) => void = (data) => {
343
343
  const { onChange = (params) => {} } = this.props;
344
344
  let updatedDate = data.date;
345
- // We'll need to update the date in time values of internal state
346
- const newTimeState = [...this.state.time];
347
345
  // Apply the currently selected time values (saved in state) to the updated date
348
346
  if (Array.isArray(data.date)) {
347
+ // We'll need to update the date in time values of internal state
348
+ const newTimeState = [...this.state.time];
349
349
  const start = data.date[0]
350
350
  ? this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0])
351
351
  : null;
@@ -359,13 +359,16 @@ export default class Calendar<T = Date> extends React.Component<
359
359
  } else {
360
360
  updatedDate = [start];
361
361
  }
362
+ // Update the date in time values of internal state
363
+ this.setState({ time: newTimeState });
362
364
  } else if (!Array.isArray(this.props.value) && data.date) {
363
- newTimeState[0] = this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
364
- updatedDate = newTimeState[0];
365
+ const newTimeState = this.dateHelpers.applyDateToTime(this.state.time[0], data.date);
366
+ updatedDate = newTimeState;
367
+
368
+ // Update the date in time values of internal state
369
+ this.setState({ time: [newTimeState] });
365
370
  }
366
371
 
367
- // Update the date in time values of internal state
368
- this.setState({ time: newTimeState });
369
372
  onChange({ date: updatedDate });
370
373
  };
371
374
 
@@ -37,6 +37,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
37
37
 
38
38
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
39
39
 
40
+ 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; }
41
+
42
+ 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; }
43
+
40
44
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
41
45
 
42
46
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -45,10 +49,6 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.it
45
49
 
46
50
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
47
51
 
48
- 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; }
49
-
50
- 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; }
51
-
52
52
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
53
53
 
54
54
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -126,7 +126,39 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
126
126
 
127
127
  _defineProperty(_assertThisInitialized(_this), "dateHelpers", void 0);
128
128
 
129
- _defineProperty(_assertThisInitialized(_this), "onChange", function (data) {
129
+ _defineProperty(_assertThisInitialized(_this), "handleChange", function (date) {
130
+ var onChange = _this.props.onChange;
131
+ var onRangeChange = _this.props.onRangeChange;
132
+
133
+ if (Array.isArray(date)) {
134
+ if (onChange && date.every(Boolean)) {
135
+ // flowlint-next-line unclear-type:off
136
+ onChange({
137
+ date: date
138
+ });
139
+ }
140
+
141
+ if (onRangeChange) {
142
+ onRangeChange({
143
+ date: _toConsumableArray(date)
144
+ });
145
+ }
146
+ } else {
147
+ if (onChange) {
148
+ onChange({
149
+ date: date
150
+ });
151
+ }
152
+
153
+ if (onRangeChange) {
154
+ onRangeChange({
155
+ date: date
156
+ });
157
+ }
158
+ }
159
+ });
160
+
161
+ _defineProperty(_assertThisInitialized(_this), "onCalendarSelect", function (data) {
130
162
  var isOpen = false;
131
163
  var isPseudoFocused = false;
132
164
  var calendarFocused = false;
@@ -203,9 +235,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
203
235
  inputValue: _this.formatDisplayValue(nextDate)
204
236
  }));
205
237
 
206
- _this.props.onChange && _this.props.onChange({
207
- date: nextDate
208
- });
238
+ _this.handleChange(nextDate);
209
239
  });
210
240
 
211
241
  _defineProperty(_assertThisInitialized(_this), "formatDisplayValue", function (date) {
@@ -309,16 +339,10 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
309
339
  var formatString = _this.normalizeDashes(_this.props.formatString);
310
340
 
311
341
  if (typeof mask === 'string' && inputValue === mask.replace(/9/g, ' ') || inputValue.length === 0) {
312
- if (_this.props.onChange) {
313
- if (_this.props.range) {
314
- _this.props.onChange({
315
- date: []
316
- });
317
- } else {
318
- _this.props.onChange({
319
- date: null
320
- });
321
- }
342
+ if (_this.props.range) {
343
+ _this.handleChange([]);
344
+ } else {
345
+ _this.handleChange(null);
322
346
  }
323
347
  }
324
348
 
@@ -349,19 +373,13 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
349
373
  endDate = parseDateString(right);
350
374
  }
351
375
 
352
- var onChange = _this.props.onChange;
353
-
354
- if (onChange) {
355
- var datesValid = _this.dateHelpers.isValid(startDate) && _this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
376
+ var datesValid = _this.dateHelpers.isValid(startDate) && _this.dateHelpers.isValid(endDate); // added equal case so that times within the same day can be expressed
356
377
 
357
378
 
358
- var rangeValid = _this.dateHelpers.isAfter(endDate, startDate) || _this.dateHelpers.isEqual(startDate, endDate);
379
+ var rangeValid = _this.dateHelpers.isAfter(endDate, startDate) || _this.dateHelpers.isEqual(startDate, endDate);
359
380
 
360
- if (datesValid && rangeValid) {
361
- onChange({
362
- date: [startDate, endDate]
363
- });
364
- }
381
+ if (datesValid && rangeValid) {
382
+ _this.handleChange([startDate, endDate]);
365
383
  }
366
384
  } else {
367
385
  var dateString = _this.normalizeDashes(inputValue);
@@ -379,11 +397,10 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
379
397
 
380
398
  var _this$props3 = _this.props,
381
399
  displayValueAtRangeIndex = _this$props3.displayValueAtRangeIndex,
382
- _onChange = _this$props3.onChange,
383
400
  range = _this$props3.range,
384
401
  value = _this$props3.value;
385
402
 
386
- if (date && _this.dateHelpers.isValid(date) && _onChange) {
403
+ if (date && _this.dateHelpers.isValid(date)) {
387
404
  if (range && Array.isArray(value) && typeof displayValueAtRangeIndex === 'number') {
388
405
  var _value = _slicedToArray(value, 2),
389
406
  _left = _value[0],
@@ -393,22 +410,16 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
393
410
  _left = date;
394
411
 
395
412
  if (!_right) {
396
- _onChange({
397
- date: [_left]
398
- });
413
+ _this.handleChange([_left]);
399
414
  } else {
400
415
  if (_this.dateHelpers.isAfter(_right, _left) || _this.dateHelpers.isEqual(_left, _right)) {
401
- _onChange({
402
- date: [_left, _right]
403
- });
416
+ _this.handleChange([_left, _right]);
404
417
  } else {
405
418
  // Is resetting back to previous value appropriate? Invalid range is not
406
419
  // communicated to the user, but if it was not reset the text value would
407
420
  // show one value and date value another. This seems a bit better but clearly
408
421
  // has a downside.
409
- _onChange({
410
- date: _toConsumableArray(value)
411
- });
422
+ _this.handleChange(_toConsumableArray(value));
412
423
  }
413
424
  }
414
425
  } else if (displayValueAtRangeIndex === 1) {
@@ -416,26 +427,18 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
416
427
 
417
428
  if (!_left) {
418
429
  // If start value is not defined, set start/end to the same day.
419
- _onChange({
420
- date: [_right, _right]
421
- });
430
+ _this.handleChange([_right, _right]);
422
431
  } else {
423
432
  if (_this.dateHelpers.isAfter(_right, _left) || _this.dateHelpers.isEqual(_left, _right)) {
424
- _onChange({
425
- date: [_left, _right]
426
- });
433
+ _this.handleChange([_left, _right]);
427
434
  } else {
428
435
  // See comment above about resetting dates on invalid range
429
- _onChange({
430
- date: _toConsumableArray(value)
431
- });
436
+ _this.handleChange(_toConsumableArray(value));
432
437
  }
433
438
  }
434
439
  }
435
440
  } else {
436
- _onChange({
437
- date: date
438
- });
441
+ _this.handleChange(date);
439
442
  }
440
443
  }
441
444
  }
@@ -552,11 +555,6 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
552
555
  endDate = _split2$2 === void 0 ? '' : _split2$2;
553
556
 
554
557
  var value = inputRole === _constants.INPUT_ROLE.startDate ? startDate : inputRole === _constants.INPUT_ROLE.endDate ? endDate : this.state.inputValue;
555
-
556
- var onChange = function onChange(event) {
557
- return _this3.handleInputChange(event, inputRole);
558
- };
559
-
560
558
  return /*#__PURE__*/React.createElement(InputComponent, _extends({
561
559
  "aria-disabled": this.props.disabled,
562
560
  "aria-label": this.props['aria-label'] || (this.props.range ? locale.datepicker.ariaLabelRange : locale.datepicker.ariaLabel),
@@ -573,7 +571,9 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
573
571
  },
574
572
  onBlur: this.handleInputBlur,
575
573
  onKeyDown: this.handleKeyDown,
576
- onChange: onChange,
574
+ onChange: function onChange(event) {
575
+ return _this3.handleInputChange(event, inputRole);
576
+ },
577
577
  placeholder: placeholder,
578
578
  mask: this.getMask(),
579
579
  required: this.props.required,
@@ -633,7 +633,7 @@ var Datepicker = /*#__PURE__*/function (_React$Component) {
633
633
  trapTabbing: true,
634
634
  value: _this4.props.value
635
635
  }, _this4.props, {
636
- onChange: _this4.onChange,
636
+ onChange: _this4.onCalendarSelect,
637
637
  selectedInput: _this4.state.selectedInput,
638
638
  hasLockedBehavior: _this4.hasLockedBehavior()
639
639
  }))