baseui 10.12.0 → 11.0.1

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 (291) 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 +10 -2
  32. package/data-table/data-table.js.flow +4 -1
  33. package/data-table/header-cell.js +3 -0
  34. package/data-table/header-cell.js.flow +1 -1
  35. package/data-table/index.d.ts +7 -8
  36. package/data-table/stateful-data-table.js +2 -1
  37. package/data-table/stateful-data-table.js.flow +1 -0
  38. package/data-table/types.js.flow +8 -0
  39. package/datepicker/calendar.js +15 -7
  40. package/datepicker/calendar.js.flow +23 -9
  41. package/datepicker/constants.js +12 -2
  42. package/datepicker/constants.js.flow +10 -0
  43. package/datepicker/datepicker.js +61 -30
  44. package/datepicker/datepicker.js.flow +77 -37
  45. package/datepicker/day.js +85 -34
  46. package/datepicker/day.js.flow +118 -54
  47. package/datepicker/locale.js.flow +0 -1
  48. package/datepicker/month.js +3 -1
  49. package/datepicker/month.js.flow +2 -0
  50. package/datepicker/stateful-container.js.flow +2 -1
  51. package/datepicker/styled-components.js +23 -1
  52. package/datepicker/styled-components.js.flow +12 -2
  53. package/datepicker/types.js.flow +35 -10
  54. package/datepicker/utils/date-helpers.js +30 -0
  55. package/datepicker/utils/date-helpers.js.flow +12 -0
  56. package/datepicker/week.js +3 -1
  57. package/datepicker/week.js.flow +2 -0
  58. package/es/accordion/accordion.js +52 -12
  59. package/es/accordion/panel.js +7 -5
  60. package/es/accordion/stateless-accordion.js +2 -4
  61. package/es/button/constants.js +1 -2
  62. package/es/button/styled-components.js +2 -29
  63. package/es/checkbox/checkbox.js +7 -32
  64. package/es/checkbox/constants.js +2 -1
  65. package/es/checkbox/index.js +1 -1
  66. package/es/checkbox/styled-components.js +51 -146
  67. package/es/data-table/column-categorical.js +1 -1
  68. package/es/data-table/column-datetime.js +1 -1
  69. package/es/data-table/column.js +6 -2
  70. package/es/data-table/data-table.js +6 -2
  71. package/es/data-table/header-cell.js +3 -0
  72. package/es/data-table/stateful-data-table.js +2 -1
  73. package/es/datepicker/calendar.js +15 -7
  74. package/es/datepicker/constants.js +8 -0
  75. package/es/datepicker/datepicker.js +56 -29
  76. package/es/datepicker/day.js +77 -34
  77. package/es/datepicker/month.js +3 -1
  78. package/es/datepicker/styled-components.js +8 -2
  79. package/es/datepicker/types.js +1 -1
  80. package/es/datepicker/utils/date-helpers.js +16 -0
  81. package/es/datepicker/week.js +3 -1
  82. package/es/file-uploader/file-uploader.js +4 -4
  83. package/es/form-control/styled-components.js +0 -1
  84. package/es/header-navigation/styled-components.js +3 -3
  85. package/es/helpers/overrides.js +1 -2
  86. package/es/input/styled-components.js +4 -4
  87. package/es/layer/layer.js +4 -4
  88. package/es/list/list-item.js +5 -1
  89. package/es/list/menu-adapter.js +4 -0
  90. package/es/locale/index.js +0 -7
  91. package/es/menu/stateful-container.js +0 -1
  92. package/es/menu/styled-components.js +1 -1
  93. package/es/modal/index.js +1 -1
  94. package/es/modal/modal.js +19 -65
  95. package/es/modal/styled-components.js +12 -48
  96. package/es/phone-input/default-props.js +1 -1
  97. package/es/phone-input/index.js +0 -4
  98. package/es/phone-input/phone-input-lite.js +55 -31
  99. package/es/radio/radio.js +1 -7
  100. package/es/radio/radiogroup.js +3 -28
  101. package/es/radio/styled-components.js +4 -5
  102. package/es/rating/styled-components.js +3 -3
  103. package/es/select/index.js +1 -2
  104. package/es/select/select-component.js +20 -20
  105. package/es/select/styled-components.js +21 -17
  106. package/es/snackbar/styled-components.js +2 -2
  107. package/es/spinner/index.js +3 -9
  108. package/es/spinner/styled-components.js +2 -32
  109. package/es/table/filter.js +3 -3
  110. package/es/tag/styled-components.js +1 -1
  111. package/es/themes/dark-theme/color-component-tokens.js +0 -38
  112. package/es/themes/dark-theme/color-tokens.js +0 -2
  113. package/es/themes/dark-theme/create-dark-theme.js +0 -2
  114. package/es/themes/dark-theme/dark-theme.js +0 -2
  115. package/es/themes/light-theme/color-component-tokens.js +0 -38
  116. package/es/themes/light-theme/color-tokens.js +0 -2
  117. package/es/themes/light-theme/create-light-theme.js +0 -2
  118. package/es/themes/light-theme/light-theme.js +0 -2
  119. package/es/timepicker/timepicker.js +1 -8
  120. package/es/typography/index.js +1 -31
  121. package/esm/accordion/accordion.js +60 -13
  122. package/esm/accordion/panel.js +7 -6
  123. package/esm/accordion/stateless-accordion.js +2 -4
  124. package/esm/button/constants.js +1 -2
  125. package/esm/button/styled-components.js +2 -29
  126. package/esm/checkbox/checkbox.js +7 -30
  127. package/esm/checkbox/constants.js +2 -1
  128. package/esm/checkbox/index.js +1 -1
  129. package/esm/checkbox/styled-components.js +52 -147
  130. package/esm/data-table/column-categorical.js +1 -1
  131. package/esm/data-table/column-datetime.js +1 -1
  132. package/esm/data-table/column.js +6 -2
  133. package/esm/data-table/data-table.js +10 -2
  134. package/esm/data-table/header-cell.js +3 -0
  135. package/esm/data-table/stateful-data-table.js +2 -1
  136. package/esm/datepicker/calendar.js +15 -7
  137. package/esm/datepicker/constants.js +8 -0
  138. package/esm/datepicker/datepicker.js +60 -30
  139. package/esm/datepicker/day.js +84 -34
  140. package/esm/datepicker/month.js +3 -1
  141. package/esm/datepicker/styled-components.js +24 -2
  142. package/esm/datepicker/types.js +1 -1
  143. package/esm/datepicker/utils/date-helpers.js +30 -0
  144. package/esm/datepicker/week.js +3 -1
  145. package/esm/file-uploader/file-uploader.js +4 -4
  146. package/esm/form-control/styled-components.js +0 -1
  147. package/esm/header-navigation/styled-components.js +3 -3
  148. package/esm/helpers/overrides.js +1 -2
  149. package/esm/input/styled-components.js +4 -4
  150. package/esm/layer/layer.js +4 -4
  151. package/esm/list/list-item.js +5 -1
  152. package/esm/list/menu-adapter.js +4 -0
  153. package/esm/locale/index.js +0 -7
  154. package/esm/menu/stateful-container.js +0 -1
  155. package/esm/menu/styled-components.js +1 -1
  156. package/esm/modal/index.js +1 -1
  157. package/esm/modal/modal.js +28 -71
  158. package/esm/modal/styled-components.js +6 -38
  159. package/esm/phone-input/default-props.js +1 -1
  160. package/esm/phone-input/index.js +0 -4
  161. package/esm/phone-input/phone-input-lite.js +60 -37
  162. package/esm/radio/radio.js +1 -7
  163. package/esm/radio/radiogroup.js +3 -28
  164. package/esm/radio/styled-components.js +4 -5
  165. package/esm/rating/styled-components.js +3 -3
  166. package/esm/select/index.js +1 -2
  167. package/esm/select/select-component.js +20 -20
  168. package/esm/select/styled-components.js +21 -14
  169. package/esm/snackbar/styled-components.js +2 -2
  170. package/esm/spinner/index.js +3 -9
  171. package/esm/spinner/styled-components.js +2 -40
  172. package/esm/table/filter.js +3 -3
  173. package/esm/tag/styled-components.js +1 -1
  174. package/esm/themes/dark-theme/color-component-tokens.js +0 -38
  175. package/esm/themes/dark-theme/color-tokens.js +0 -2
  176. package/esm/themes/dark-theme/create-dark-theme.js +1 -2
  177. package/esm/themes/dark-theme/dark-theme.js +1 -2
  178. package/esm/themes/light-theme/color-component-tokens.js +0 -38
  179. package/esm/themes/light-theme/color-tokens.js +0 -2
  180. package/esm/themes/light-theme/create-light-theme.js +1 -2
  181. package/esm/themes/light-theme/light-theme.js +1 -2
  182. package/esm/timepicker/timepicker.js +1 -8
  183. package/esm/typography/index.js +1 -35
  184. package/file-uploader/file-uploader.js +3 -3
  185. package/file-uploader/file-uploader.js.flow +4 -4
  186. package/form-control/index.d.ts +9 -0
  187. package/form-control/styled-components.js +0 -1
  188. package/form-control/styled-components.js.flow +0 -1
  189. package/header-navigation/styled-components.js +3 -3
  190. package/header-navigation/styled-components.js.flow +3 -3
  191. package/helpers/overrides.js +1 -2
  192. package/helpers/overrides.js.flow +1 -1
  193. package/input/index.d.ts +5 -9
  194. package/input/styled-components.js +4 -4
  195. package/input/styled-components.js.flow +4 -4
  196. package/layer/layer.js +4 -4
  197. package/layer/layer.js.flow +4 -3
  198. package/list/list-item.js +5 -1
  199. package/list/list-item.js.flow +4 -0
  200. package/list/menu-adapter.js +4 -0
  201. package/list/menu-adapter.js.flow +4 -0
  202. package/list/types.js.flow +4 -0
  203. package/locale/index.js +0 -7
  204. package/locale/index.js.flow +0 -7
  205. package/locale.ts +0 -1
  206. package/menu/index.d.ts +1 -3
  207. package/menu/stateful-container.js +0 -1
  208. package/menu/stateful-container.js.flow +0 -1
  209. package/menu/styled-components.js +1 -1
  210. package/menu/styled-components.js.flow +1 -1
  211. package/modal/index.d.ts +4 -6
  212. package/modal/index.js +0 -6
  213. package/modal/index.js.flow +0 -1
  214. package/modal/modal.js +27 -70
  215. package/modal/modal.js.flow +17 -83
  216. package/modal/styled-components.js +7 -40
  217. package/modal/styled-components.js.flow +12 -44
  218. package/modal/types.js.flow +1 -10
  219. package/package.json +3 -2
  220. package/phone-input/default-props.js +1 -1
  221. package/phone-input/default-props.js.flow +1 -1
  222. package/phone-input/index.d.ts +0 -1
  223. package/phone-input/index.js +0 -36
  224. package/phone-input/index.js.flow +0 -4
  225. package/phone-input/phone-input-lite.js +63 -38
  226. package/phone-input/phone-input-lite.js.flow +66 -44
  227. package/radio/index.d.ts +4 -9
  228. package/radio/radio.js +1 -7
  229. package/radio/radio.js.flow +1 -8
  230. package/radio/radiogroup.js +3 -28
  231. package/radio/radiogroup.js.flow +2 -26
  232. package/radio/styled-components.js +4 -5
  233. package/radio/styled-components.js.flow +3 -4
  234. package/radio/types.js.flow +4 -15
  235. package/rating/styled-components.js +3 -3
  236. package/rating/styled-components.js.flow +3 -3
  237. package/select/index.d.ts +0 -2
  238. package/select/index.js +0 -6
  239. package/select/index.js.flow +0 -2
  240. package/select/select-component.js +23 -24
  241. package/select/select-component.js.flow +25 -14
  242. package/select/styled-components.js +23 -17
  243. package/select/styled-components.js.flow +17 -12
  244. package/snackbar/styled-components.js +1 -1
  245. package/snackbar/styled-components.js.flow +11 -11
  246. package/spinner/index.d.ts +5 -18
  247. package/spinner/index.js +2 -68
  248. package/spinner/index.js.flow +2 -27
  249. package/spinner/styled-components.js +9 -45
  250. package/spinner/styled-components.js.flow +2 -34
  251. package/spinner/types.js.flow +1 -19
  252. package/styles/types.js.flow +0 -2
  253. package/table/filter.js +3 -3
  254. package/table/filter.js.flow +3 -3
  255. package/tag/styled-components.js +1 -1
  256. package/tag/styled-components.js.flow +1 -1
  257. package/theme.ts +0 -81
  258. package/themes/dark-theme/color-component-tokens.js +0 -38
  259. package/themes/dark-theme/color-component-tokens.js.flow +0 -42
  260. package/themes/dark-theme/color-tokens.js +0 -2
  261. package/themes/dark-theme/color-tokens.js.flow +0 -2
  262. package/themes/dark-theme/create-dark-theme.js +1 -3
  263. package/themes/dark-theme/create-dark-theme.js.flow +0 -2
  264. package/themes/dark-theme/dark-theme.js +1 -3
  265. package/themes/dark-theme/dark-theme.js.flow +0 -2
  266. package/themes/light-theme/color-component-tokens.js +0 -38
  267. package/themes/light-theme/color-component-tokens.js.flow +0 -43
  268. package/themes/light-theme/color-tokens.js +0 -2
  269. package/themes/light-theme/color-tokens.js.flow +0 -2
  270. package/themes/light-theme/create-light-theme.js +1 -3
  271. package/themes/light-theme/create-light-theme.js.flow +0 -2
  272. package/themes/light-theme/light-theme.js +1 -3
  273. package/themes/light-theme/light-theme.js.flow +0 -2
  274. package/themes/types.js.flow +0 -68
  275. package/timepicker/timepicker.js +1 -8
  276. package/timepicker/timepicker.js.flow +4 -10
  277. package/typography/index.d.ts +0 -23
  278. package/typography/index.js +2 -57
  279. package/typography/index.js.flow +0 -31
  280. package/es/spinner/spinner.js +0 -68
  281. package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
  282. package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
  283. package/esm/spinner/spinner.js +0 -125
  284. package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
  285. package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
  286. package/spinner/spinner.js +0 -136
  287. package/spinner/spinner.js.flow +0 -75
  288. package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
  289. package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
  290. package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
  291. package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
@@ -6,21 +6,19 @@ LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
8
  // @flow
9
- import { styled, expandBorderStyles } from '../styles/index.js';
10
- import { STYLE_TYPE } from './constants.js';
9
+ import { styled } from '../styles/index.js';
11
10
 
12
11
  import type { SharedStylePropsT } from './types.js';
13
12
 
14
13
  function getBorderColor(props) {
15
- const { $disabled, $checked, $isError, $error, $isIndeterminate, $theme, $isFocusVisible } =
16
- props;
14
+ const { $disabled, $checked, $error, $isIndeterminate, $theme, $isFocusVisible } = props;
17
15
  const { colors } = $theme;
18
16
  if ($disabled) {
19
17
  return colors.tickFillDisabled;
20
18
  } else if ($checked || $isIndeterminate) {
21
19
  return 'transparent';
22
- } else if ($error || $isError) {
23
- return colors.borderError;
20
+ } else if ($error) {
21
+ return colors.borderNegative;
24
22
  } else if ($isFocusVisible) {
25
23
  return colors.borderSelected;
26
24
  } else {
@@ -62,29 +60,15 @@ function getLabelPadding(props) {
62
60
  }
63
61
 
64
62
  function getBackgroundColor(props) {
65
- const {
66
- $disabled,
67
- $checked,
68
- $isIndeterminate,
69
- $isError,
70
- $error,
71
- $isHovered,
72
- $isActive,
73
- $theme,
74
- $checkmarkType,
75
- } = props;
76
- const isToggle = $checkmarkType === STYLE_TYPE.toggle;
63
+ const { $disabled, $checked, $isIndeterminate, $error, $isHovered, $isActive, $theme } = props;
77
64
  const { colors } = $theme;
78
65
  if ($disabled) {
79
- if (isToggle) {
80
- return colors.toggleFillDisabled;
81
- }
82
66
  if ($checked || $isIndeterminate) {
83
67
  return colors.tickFillDisabled;
84
68
  } else {
85
69
  return colors.tickFill;
86
70
  }
87
- } else if (($error || $isError) && ($isIndeterminate || $checked)) {
71
+ } else if ($error && ($isIndeterminate || $checked)) {
88
72
  if ($isActive) {
89
73
  return colors.tickFillErrorSelectedHoverActive;
90
74
  } else if ($isHovered) {
@@ -92,7 +76,7 @@ function getBackgroundColor(props) {
92
76
  } else {
93
77
  return colors.tickFillErrorSelected;
94
78
  }
95
- } else if ($error || $isError) {
79
+ } else if ($error) {
96
80
  if ($isActive) {
97
81
  return colors.tickFillErrorHoverActive;
98
82
  } else if ($isHovered) {
@@ -110,11 +94,11 @@ function getBackgroundColor(props) {
110
94
  }
111
95
  } else {
112
96
  if ($isActive) {
113
- return isToggle ? colors.sliderTrackFillActive : colors.tickFillActive;
97
+ return colors.tickFillActive;
114
98
  } else if ($isHovered) {
115
- return isToggle ? colors.sliderTrackFillHover : colors.tickFillHover;
99
+ return colors.tickFillHover;
116
100
  } else {
117
- return isToggle ? colors.toggleTrackFill : colors.tickFill;
101
+ return colors.tickFill;
118
102
  }
119
103
  }
120
104
  }
@@ -137,13 +121,12 @@ export const Root = styled<SharedStylePropsT>('label', (props) => {
137
121
  });
138
122
 
139
123
  export const Checkmark = styled<SharedStylePropsT>('span', (props) => {
140
- const { $checked, $disabled, $isError, $error, $isIndeterminate, $theme, $isFocusVisible } =
141
- props;
124
+ const { $checked, $disabled, $error, $isIndeterminate, $theme, $isFocusVisible } = props;
142
125
  const { sizing, animation } = $theme;
143
126
 
144
127
  const tickColor = $disabled
145
128
  ? $theme.colors.tickMarkFillDisabled
146
- : $isError || $error
129
+ : $error
147
130
  ? $theme.colors.tickMarkFillError
148
131
  : $theme.colors.tickMarkFill;
149
132
 
@@ -208,10 +191,9 @@ export const Checkmark = styled<SharedStylePropsT>('span', (props) => {
208
191
  });
209
192
 
210
193
  export const Label = styled<SharedStylePropsT>('div', (props) => {
211
- const { $theme, $checkmarkType } = props;
194
+ const { $theme } = props;
212
195
  const { typography } = $theme;
213
196
  return ({
214
- flex: $checkmarkType === STYLE_TYPE.toggle ? 'auto' : null,
215
197
  verticalAlign: 'middle',
216
198
  ...getLabelPadding(props),
217
199
  color: getLabelColor(props),
@@ -232,146 +214,58 @@ export const Input = styled('input', {
232
214
  });
233
215
 
234
216
  export const Toggle = styled<SharedStylePropsT>('div', (props) => {
235
- if (props.$checkmarkType === STYLE_TYPE.toggle) {
236
- const borderRadius = props.$theme.borders.useRoundedCorners
237
- ? props.$theme.borders.radius200
238
- : null;
239
- return ({
240
- ...expandBorderStyles(props.$theme.borders.border300),
241
- alignItems: 'center',
242
- backgroundColor: props.$theme.colors.mono100,
243
- borderTopLeftRadius: borderRadius,
244
- borderTopRightRadius: borderRadius,
245
- borderBottomRightRadius: borderRadius,
246
- borderBottomLeftRadius: borderRadius,
247
- boxShadow: props.$isFocusVisible
248
- ? `0 0 0 3px ${props.$theme.colors.accent}`
249
- : props.$theme.lighting.shadow400,
250
- outline: 'none',
251
- display: 'flex',
252
- justifyContent: 'center',
253
- height: props.$theme.sizing.scale800,
254
- width: props.$theme.sizing.scale800,
255
- }: {});
256
- }
257
-
258
- if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
259
- let backgroundColor = props.$theme.colors.toggleFill;
260
- if (props.$disabled) {
261
- backgroundColor = props.$theme.colors.toggleFillDisabled;
262
- } else if (props.$checked && (props.$error || props.$isError)) {
263
- backgroundColor = props.$theme.colors.borderError;
264
- } else if (props.$checked) {
265
- backgroundColor = props.$theme.colors.toggleFillChecked;
266
- }
267
- return {
268
- backgroundColor,
269
- borderTopLeftRadius: '50%',
270
- borderTopRightRadius: '50%',
271
- borderBottomRightRadius: '50%',
272
- borderBottomLeftRadius: '50%',
273
- boxShadow: props.$isFocusVisible
274
- ? `0 0 0 3px ${props.$theme.colors.accent}`
275
- : props.$isHovered && !props.$disabled
276
- ? props.$theme.lighting.shadow500
277
- : props.$theme.lighting.shadow400,
278
- outline: 'none',
279
- height: props.$theme.sizing.scale700,
280
- width: props.$theme.sizing.scale700,
281
- transform: props.$checked
282
- ? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})`
283
- : null,
284
- transition: `transform ${props.$theme.animation.timing200}`,
285
- };
286
- }
287
-
288
- return {};
289
- });
290
-
291
- export const ToggleInner = styled<SharedStylePropsT>('div', (props) => {
292
- if (props.$checkmarkType === STYLE_TYPE.toggle) {
293
- // eslint-disable-next-line no-inner-declarations
294
- const backgroundColor = () => {
295
- if (props.$disabled) {
296
- return props.$theme.colors.sliderHandleInnerFillDisabled;
297
- }
298
-
299
- if (props.$isActive && props.$checked) {
300
- return props.$theme.colors.sliderHandleInnerFillSelectedActive;
301
- }
302
-
303
- if (props.$isHovered && props.$checked) {
304
- return props.$theme.colors.sliderHandleInnerFillSelectedHover;
305
- }
306
-
307
- return props.$theme.colors.toggleTrackFill;
308
- };
309
- return {
310
- height: props.$theme.sizing.scale300,
311
- width: props.$theme.sizing.scale0,
312
- borderTopLeftRadius: props.$theme.borders.radius100,
313
- borderTopRightRadius: props.$theme.borders.radius100,
314
- borderBottomRightRadius: props.$theme.borders.radius100,
315
- borderBottomLeftRadius: props.$theme.borders.radius100,
316
- backgroundColor: backgroundColor(),
317
- };
217
+ let backgroundColor = props.$theme.colors.toggleFill;
218
+ if (props.$disabled) {
219
+ backgroundColor = props.$theme.colors.toggleFillDisabled;
220
+ } else if (props.$checked && props.$error) {
221
+ backgroundColor = props.$theme.colors.tickFillErrorSelected;
222
+ } else if (props.$checked) {
223
+ backgroundColor = props.$theme.colors.toggleFillChecked;
318
224
  }
319
225
 
320
- if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
321
- return {};
322
- }
323
-
324
- return {};
226
+ return {
227
+ backgroundColor,
228
+ borderTopLeftRadius: '50%',
229
+ borderTopRightRadius: '50%',
230
+ borderBottomRightRadius: '50%',
231
+ borderBottomLeftRadius: '50%',
232
+ boxShadow: props.$isFocusVisible
233
+ ? `0 0 0 3px ${props.$theme.colors.accent}`
234
+ : props.$isHovered && !props.$disabled
235
+ ? props.$theme.lighting.shadow500
236
+ : props.$theme.lighting.shadow400,
237
+ outline: 'none',
238
+ height: props.$theme.sizing.scale700,
239
+ width: props.$theme.sizing.scale700,
240
+ transform: props.$checked
241
+ ? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})`
242
+ : null,
243
+ transition: `transform ${props.$theme.animation.timing200}`,
244
+ };
325
245
  });
326
246
 
327
247
  export const ToggleTrack = styled<SharedStylePropsT>('div', (props) => {
328
- if (props.$checkmarkType === STYLE_TYPE.toggle) {
329
- const borderRadius = props.$theme.borders.useRoundedCorners
330
- ? props.$theme.borders.radius200
331
- : null;
332
- return ({
333
- alignItems: 'center',
334
- backgroundColor: getBackgroundColor(props),
335
- borderTopLeftRadius: borderRadius,
336
- borderTopRightRadius: borderRadius,
337
- borderBottomRightRadius: borderRadius,
338
- borderBottomLeftRadius: borderRadius,
339
- display: 'flex',
340
- height: props.$theme.sizing.scale600,
341
- justifyContent: props.$checked ? 'flex-end' : 'flex-start',
342
- marginTop: props.$theme.sizing.scale100,
343
- marginBottom: props.$theme.sizing.scale100,
344
- marginLeft: props.$theme.sizing.scale100,
345
- marginRight: props.$theme.sizing.scale100,
346
- width: props.$theme.sizing.scale1000,
347
- }: {});
348
- }
349
-
350
- if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
351
- let backgroundColor = props.$theme.colors.toggleTrackFill;
352
- if (props.$disabled) {
353
- backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
354
- } else if ((props.$error || props.$isError) && props.$checked) {
355
- backgroundColor = props.$theme.colors.tickFillError;
356
- }
357
- return {
358
- alignItems: 'center',
359
- backgroundColor,
360
- borderTopLeftRadius: '7px',
361
- borderTopRightRadius: '7px',
362
- borderBottomRightRadius: '7px',
363
- borderBottomLeftRadius: '7px',
364
- display: 'flex',
365
- height: props.$theme.sizing.scale550,
366
- marginTop: props.$theme.sizing.scale200,
367
- marginBottom: props.$theme.sizing.scale100,
368
- marginLeft: props.$theme.sizing.scale200,
369
- marginRight: props.$theme.sizing.scale100,
370
- width: props.$theme.sizing.scale1000,
371
- };
248
+ let backgroundColor = props.$theme.colors.toggleTrackFill;
249
+ if (props.$disabled) {
250
+ backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
251
+ } else if (props.$error && props.$checked) {
252
+ backgroundColor = props.$theme.colors.tickFillError;
372
253
  }
373
-
374
- return {};
254
+ return {
255
+ alignItems: 'center',
256
+ backgroundColor,
257
+ borderTopLeftRadius: '7px',
258
+ borderTopRightRadius: '7px',
259
+ borderBottomRightRadius: '7px',
260
+ borderBottomLeftRadius: '7px',
261
+ display: 'flex',
262
+ height: props.$theme.sizing.scale550,
263
+ marginTop: props.$theme.sizing.scale200,
264
+ marginBottom: props.$theme.sizing.scale100,
265
+ marginLeft: props.$theme.sizing.scale200,
266
+ marginRight: props.$theme.sizing.scale100,
267
+ width: props.$theme.sizing.scale1000,
268
+ };
375
269
  });
376
270
 
377
271
  declare var __DEV__: boolean;
@@ -27,7 +27,6 @@ export type DefaultPropsT = {
27
27
  children?: React$Node,
28
28
  checked: boolean,
29
29
  disabled: boolean,
30
- isError: boolean,
31
30
  error: boolean,
32
31
  autoFocus: boolean,
33
32
  isIndeterminate: boolean,
@@ -63,8 +62,6 @@ export type PropsT = {
63
62
  required?: boolean,
64
63
  /** Renders checkbox in errored state. */
65
64
  error?: boolean,
66
- /** You should use error instead. */
67
- isError?: boolean,
68
65
  /** Used to get a ref to the input element. Useful for programmatically focusing the input */
69
66
  inputRef: ReactRefT<HTMLInputElement>,
70
67
  /** Focus the checkbox on initial render. */
@@ -195,14 +192,12 @@ export type SharedStylePropsT = {
195
192
  $isFocusVisible: boolean,
196
193
  $isHovered: boolean,
197
194
  $isActive: boolean,
198
- $isError: boolean,
199
195
  $error: boolean,
200
196
  $checked: boolean,
201
197
  $isIndeterminate: boolean,
202
198
  $required: boolean,
203
199
  $disabled: boolean,
204
200
  $value: string,
205
- $checkmarkType: StyleTypeT,
206
201
  $labelPlacement: LabelPlacementT,
207
202
  };
208
203
 
@@ -79,7 +79,7 @@ function FilterQuickControls(props) {
79
79
  var locale = React.useContext(_index7.LocaleContext);
80
80
  return /*#__PURE__*/React.createElement(_index2.ButtonGroup, {
81
81
  size: _index.SIZE.mini,
82
- kind: _index.KIND.minimal
82
+ kind: _index.KIND.tertiary
83
83
  }, /*#__PURE__*/React.createElement(_index.Button, {
84
84
  type: "button",
85
85
  onClick: props.onSelectAll
@@ -54,7 +54,7 @@ function FilterQuickControls(props: { onSelectAll: () => void, onClearSelection:
54
54
  const locale = React.useContext(LocaleContext);
55
55
 
56
56
  return (
57
- <ButtonGroup size={SIZE.mini} kind={KIND.minimal}>
57
+ <ButtonGroup size={SIZE.mini} kind={KIND.tertiary}>
58
58
  <Button type="button" onClick={props.onSelectAll}>
59
59
  {locale.datatable.categoricalFilterSelectAll}
60
60
  </Button>
@@ -456,7 +456,7 @@ function DatetimeFilter(props) {
456
456
  if (Array.isArray(date)) {
457
457
  if (!date.length) return;
458
458
  var nextDates = date.map(function (d, i) {
459
- return (0, _index13.applyDateToTime)(rangeDates[i], d);
459
+ return d ? (0, _index13.applyDateToTime)(rangeDates[i], d) : null;
460
460
  });
461
461
  setRangeDates(nextDates);
462
462
  }
@@ -382,7 +382,9 @@ function DatetimeFilter(props) {
382
382
  onChange={({ date }) => {
383
383
  if (Array.isArray(date)) {
384
384
  if (!date.length) return;
385
- const nextDates = date.map((d, i) => applyDateToTime(rangeDates[i], d));
385
+ const nextDates = date.map((d, i) =>
386
+ d ? applyDateToTime(rangeDates[i], d) : null
387
+ );
386
388
  setRangeDates(nextDates);
387
389
  }
388
390
  }}
@@ -84,7 +84,11 @@ function Column(options) {
84
84
  display: 'flex',
85
85
  height: '100%'
86
86
  })
87
- }, Boolean(props.onSelect) && /*#__PURE__*/React.createElement(_index.Checkbox, {
87
+ }, Boolean(props.onSelect) && /*#__PURE__*/React.createElement("span", {
88
+ className: css({
89
+ paddingRight: theme.sizing.scale300
90
+ })
91
+ }, /*#__PURE__*/React.createElement(_index.Checkbox, {
88
92
  onChange: props.onSelect,
89
93
  checked: props.isSelected,
90
94
  overrides: {
@@ -95,7 +99,7 @@ function Column(options) {
95
99
  }
96
100
  }
97
101
  }
98
- }), /*#__PURE__*/React.createElement(ProvidedCell, props)));
102
+ })), /*#__PURE__*/React.createElement(ProvidedCell, props)));
99
103
  }),
100
104
  renderFilter: options.renderFilter || function () {
101
105
  return null;
@@ -62,13 +62,15 @@ function Column<ValueT, FilterParamsT>(
62
62
  })}
63
63
  >
64
64
  {Boolean(props.onSelect) && (
65
- <Checkbox
66
- onChange={props.onSelect}
67
- checked={props.isSelected}
68
- overrides={{
69
- Checkmark: { style: { marginTop: null, marginBottom: null } },
70
- }}
71
- />
65
+ <span className={css({ paddingRight: theme.sizing.scale300 })}>
66
+ <Checkbox
67
+ onChange={props.onSelect}
68
+ checked={props.isSelected}
69
+ overrides={{
70
+ Checkmark: { style: { marginTop: null, marginBottom: null } },
71
+ }}
72
+ />
73
+ </span>
72
74
  )}
73
75
  <ProvidedCell {...props} />
74
76
  </div>
@@ -485,7 +485,7 @@ var InnerTableElement = /*#__PURE__*/React.forwardRef(function (props, ref) {
485
485
  });
486
486
  },
487
487
  size: _index.SIZE.compact,
488
- kind: _index.KIND.minimal,
488
+ kind: _index.KIND.tertiary,
489
489
  shape: _index.SHAPE.round,
490
490
  overrides: {
491
491
  BaseButton: {
@@ -555,7 +555,8 @@ function DataTable(_ref2) {
555
555
  sortIndex = _ref2.sortIndex,
556
556
  sortDirection = _ref2.sortDirection,
557
557
  _ref2$textQuery = _ref2.textQuery,
558
- textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery;
558
+ textQuery = _ref2$textQuery === void 0 ? '' : _ref2$textQuery,
559
+ controlRef = _ref2.controlRef;
559
560
 
560
561
  var _useStyletron13 = (0, _index2.useStyletron)(),
561
562
  _useStyletron14 = _slicedToArray(_useStyletron13, 2),
@@ -754,6 +755,13 @@ function DataTable(_ref2) {
754
755
 
755
756
  return result;
756
757
  }, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
758
+ React.useImperativeHandle(controlRef, function () {
759
+ return {
760
+ getRows: function getRows() {
761
+ return rows;
762
+ }
763
+ };
764
+ }, [rows]);
757
765
 
758
766
  var _React$useState19 = React.useState(0),
759
767
  _React$useState20 = _slicedToArray(_React$useState19, 2),
@@ -587,7 +587,7 @@ const InnerTableElement = React.forwardRef<
587
587
  })
588
588
  }
589
589
  size={BUTTON_SIZES.compact}
590
- kind={BUTTON_KINDS.minimal}
590
+ kind={BUTTON_KINDS.tertiary}
591
591
  shape={BUTTON_SHAPES.round}
592
592
  overrides={{
593
593
  BaseButton: {
@@ -658,6 +658,7 @@ export function DataTable({
658
658
  sortIndex,
659
659
  sortDirection,
660
660
  textQuery = '',
661
+ controlRef,
661
662
  }: DataTablePropsT) {
662
663
  const [, theme] = useStyletron();
663
664
  const locale = React.useContext(LocaleContext);
@@ -809,6 +810,8 @@ export function DataTable({
809
810
  return result;
810
811
  }, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
811
812
 
813
+ React.useImperativeHandle(controlRef, () => ({ getRows: () => rows }), [rows]);
814
+
812
815
  const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
813
816
  const normalizedWidths = React.useMemo(() => {
814
817
  const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
@@ -111,6 +111,9 @@ var HeaderCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
111
111
  onFocus: handleFocus,
112
112
  onBlur: handleBlur
113
113
  }, props.isSelectable && /*#__PURE__*/React.createElement("span", {
114
+ className: css({
115
+ paddingRight: theme.sizing.scale300
116
+ }),
114
117
  ref: checkboxRef
115
118
  }, /*#__PURE__*/React.createElement(_index.Checkbox, {
116
119
  onChange: function onChange(e) {
@@ -97,7 +97,7 @@ const HeaderCell = React.forwardRef<HeaderCellPropsT, HTMLDivElement>((props, re
97
97
  onBlur={handleBlur}
98
98
  >
99
99
  {props.isSelectable && (
100
- <span ref={checkboxRef}>
100
+ <span className={css({ paddingRight: theme.sizing.scale300 })} ref={checkboxRef}>
101
101
  <Checkbox
102
102
  onChange={(e) => {
103
103
  if (props.isSelectedAll || props.isSelectedIndeterminate) {
@@ -34,10 +34,7 @@ export interface SORT_DIRECTIONS {
34
34
  }
35
35
  export const SORT_DIRECTIONS: SORT_DIRECTIONS;
36
36
 
37
- export type SortDirectionsT =
38
- | SORT_DIRECTIONS['ASC']
39
- | SORT_DIRECTIONS['DESC']
40
- | null;
37
+ export type SortDirectionsT = SORT_DIRECTIONS['ASC'] | SORT_DIRECTIONS['DESC'] | null;
41
38
  export type ColumnT = any;
42
39
  export type RowT = {
43
40
  id: number | string;
@@ -54,12 +51,13 @@ export type BatchActionT = {
54
51
  renderIcon?: any;
55
52
  };
56
53
 
54
+ export interface ImperativeMethods {
55
+ getRows: () => RowT[];
56
+ }
57
+
57
58
  export type RowActionT = {
58
59
  label: string;
59
- onClick: (params: {
60
- event: React.MouseEvent<HTMLButtonElement>;
61
- row: RowT;
62
- }) => any;
60
+ onClick: (params: { event: React.MouseEvent<HTMLButtonElement>; row: RowT }) => any;
63
61
  renderIcon: any;
64
62
  };
65
63
 
@@ -69,4 +67,5 @@ export type Props = {
69
67
  columns: ColumnT[];
70
68
  onSelectionChange?: (rows: RowT[]) => any;
71
69
  rows: RowT[];
70
+ controlRef?: React.Ref<ImperativeMethods>;
72
71
  };
@@ -347,7 +347,8 @@ function StatefulDataTable(props) {
347
347
  selectedRowIds: selectedRowIds,
348
348
  sortDirection: sortDirection,
349
349
  sortIndex: sortIndex,
350
- textQuery: textQuery
350
+ textQuery: textQuery,
351
+ controlRef: props.controlRef
351
352
  })));
352
353
  });
353
354
  }
@@ -306,6 +306,7 @@ export function StatefulDataTable(props: StatefulDataTablePropsT) {
306
306
  sortDirection={sortDirection}
307
307
  sortIndex={sortIndex}
308
308
  textQuery={textQuery}
309
+ controlRef={props.controlRef}
309
310
  />
310
311
  </div>
311
312
  </React.Fragment>
@@ -87,6 +87,13 @@ export type RowActionT = {|
87
87
  renderButton?: React.AbstractComponent<{||}>,
88
88
  |};
89
89
 
90
+ type ImperativeMethodsT = {|
91
+ getRows: () => RowT[],
92
+ |};
93
+ export type ControlRefT = {
94
+ current: ImperativeMethodsT | null,
95
+ };
96
+
90
97
  export type StatefulDataTablePropsT = {|
91
98
  batchActions?: BatchActionT[],
92
99
  columns: ColumnT<>[],
@@ -109,6 +116,7 @@ export type StatefulDataTablePropsT = {|
109
116
  rowHeight?: number,
110
117
  rowHighlightIndex?: number,
111
118
  searchable?: boolean,
119
+ controlRef?: ControlRefT,
112
120
  |};
113
121
 
114
122
  export type DataTablePropsT = {|
@@ -339,10 +339,16 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
339
339
 
340
340
 
341
341
  if (Array.isArray(data.date)) {
342
- updatedDate = data.date.map(function (date, index) {
343
- newTimeState[index] = _this.dateHelpers.applyDateToTime(newTimeState[index], date);
344
- return newTimeState[index];
345
- });
342
+ var start = data.date[0] ? _this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
343
+ var end = data.date[1] ? _this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
344
+ newTimeState[0] = start;
345
+
346
+ if (end) {
347
+ updatedDate = [start, end];
348
+ newTimeState[1] = end;
349
+ } else {
350
+ updatedDate = [start];
351
+ }
346
352
  } else if (!Array.isArray(_this.props.value) && data.date) {
347
353
  newTimeState[0] = _this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
348
354
  updatedDate = newTimeState[0];
@@ -374,7 +380,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
374
380
 
375
381
  if (Array.isArray(_this.props.value)) {
376
382
  var dates = _this.props.value.map(function (date, i) {
377
- if (index === i) {
383
+ if (date && index === i) {
378
384
  return _this.dateHelpers.applyTimeToDate(date, time);
379
385
  }
380
386
 
@@ -382,7 +388,7 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
382
388
  });
383
389
 
384
390
  onChange({
385
- date: dates
391
+ date: [dates[0], dates[1]]
386
392
  });
387
393
  } else {
388
394
  var date = _this.dateHelpers.applyTimeToDate(_this.props.value, time);
@@ -452,7 +458,9 @@ var Calendar = /*#__PURE__*/function (_React$Component) {
452
458
  overrides: overrides,
453
459
  value: _this.props.value,
454
460
  peekNextMonth: _this.props.peekNextMonth,
455
- fixedHeight: _this.props.fixedHeight
461
+ fixedHeight: _this.props.fixedHeight,
462
+ hasLockedBehavior: !!_this.props.hasLockedBehavior,
463
+ selectedInput: _this.props.selectedInput
456
464
  })));
457
465
  monthList.push( /*#__PURE__*/React.createElement("div", {
458
466
  key: "month-component-".concat(i)