baseui 10.12.1 → 11.0.2

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 (307) 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 +28 -15
  40. package/datepicker/calendar.js.flow +31 -14
  41. package/datepicker/constants.js +12 -2
  42. package/datepicker/constants.js.flow +10 -0
  43. package/datepicker/datepicker.js +117 -86
  44. package/datepicker/datepicker.js.flow +123 -66
  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-calendar.js +6 -1
  51. package/datepicker/stateful-calendar.js.flow +8 -1
  52. package/datepicker/stateful-container.js +23 -2
  53. package/datepicker/stateful-container.js.flow +17 -3
  54. package/datepicker/stateful-datepicker.js +6 -1
  55. package/datepicker/stateful-datepicker.js.flow +7 -1
  56. package/datepicker/styled-components.js +23 -1
  57. package/datepicker/styled-components.js.flow +12 -2
  58. package/datepicker/types.js.flow +46 -43
  59. package/datepicker/utils/date-helpers.js +30 -0
  60. package/datepicker/utils/date-helpers.js.flow +12 -0
  61. package/datepicker/week.js +3 -1
  62. package/datepicker/week.js.flow +2 -0
  63. package/es/accordion/accordion.js +52 -12
  64. package/es/accordion/panel.js +7 -5
  65. package/es/accordion/stateless-accordion.js +2 -4
  66. package/es/button/constants.js +1 -2
  67. package/es/button/styled-components.js +2 -29
  68. package/es/checkbox/checkbox.js +7 -32
  69. package/es/checkbox/constants.js +2 -1
  70. package/es/checkbox/index.js +1 -1
  71. package/es/checkbox/styled-components.js +51 -146
  72. package/es/data-table/column-categorical.js +1 -1
  73. package/es/data-table/column-datetime.js +1 -1
  74. package/es/data-table/column.js +6 -2
  75. package/es/data-table/data-table.js +6 -2
  76. package/es/data-table/header-cell.js +3 -0
  77. package/es/data-table/stateful-data-table.js +2 -1
  78. package/es/datepicker/calendar.js +28 -15
  79. package/es/datepicker/constants.js +8 -0
  80. package/es/datepicker/datepicker.js +106 -79
  81. package/es/datepicker/day.js +77 -34
  82. package/es/datepicker/month.js +3 -1
  83. package/es/datepicker/stateful-calendar.js +6 -1
  84. package/es/datepicker/stateful-container.js +22 -2
  85. package/es/datepicker/stateful-datepicker.js +6 -1
  86. package/es/datepicker/styled-components.js +8 -2
  87. package/es/datepicker/types.js +1 -1
  88. package/es/datepicker/utils/date-helpers.js +16 -0
  89. package/es/datepicker/week.js +3 -1
  90. package/es/file-uploader/file-uploader.js +4 -4
  91. package/es/form-control/styled-components.js +0 -1
  92. package/es/header-navigation/styled-components.js +3 -3
  93. package/es/helpers/overrides.js +1 -2
  94. package/es/input/styled-components.js +4 -4
  95. package/es/layer/layer.js +4 -4
  96. package/es/list/list-item.js +5 -1
  97. package/es/list/menu-adapter.js +4 -0
  98. package/es/locale/index.js +0 -7
  99. package/es/menu/stateful-container.js +0 -1
  100. package/es/menu/styled-components.js +1 -1
  101. package/es/modal/index.js +1 -1
  102. package/es/modal/modal.js +19 -65
  103. package/es/modal/styled-components.js +12 -48
  104. package/es/phone-input/default-props.js +1 -1
  105. package/es/phone-input/index.js +0 -4
  106. package/es/phone-input/phone-input-lite.js +55 -31
  107. package/es/radio/radio.js +1 -7
  108. package/es/radio/radiogroup.js +3 -28
  109. package/es/radio/styled-components.js +4 -5
  110. package/es/rating/styled-components.js +3 -3
  111. package/es/select/index.js +1 -2
  112. package/es/select/select-component.js +20 -20
  113. package/es/select/styled-components.js +21 -17
  114. package/es/snackbar/snackbar-context.js +1 -1
  115. package/es/snackbar/styled-components.js +2 -2
  116. package/es/spinner/index.js +3 -9
  117. package/es/spinner/styled-components.js +2 -32
  118. package/es/table/filter.js +3 -3
  119. package/es/tag/styled-components.js +1 -1
  120. package/es/themes/dark-theme/color-component-tokens.js +0 -38
  121. package/es/themes/dark-theme/color-tokens.js +0 -2
  122. package/es/themes/dark-theme/create-dark-theme.js +0 -2
  123. package/es/themes/dark-theme/dark-theme.js +0 -2
  124. package/es/themes/light-theme/color-component-tokens.js +0 -38
  125. package/es/themes/light-theme/color-tokens.js +0 -2
  126. package/es/themes/light-theme/create-light-theme.js +0 -2
  127. package/es/themes/light-theme/light-theme.js +0 -2
  128. package/es/timepicker/timepicker.js +1 -8
  129. package/es/typography/index.js +1 -31
  130. package/esm/accordion/accordion.js +60 -13
  131. package/esm/accordion/panel.js +7 -6
  132. package/esm/accordion/stateless-accordion.js +2 -4
  133. package/esm/button/constants.js +1 -2
  134. package/esm/button/styled-components.js +2 -29
  135. package/esm/checkbox/checkbox.js +7 -30
  136. package/esm/checkbox/constants.js +2 -1
  137. package/esm/checkbox/index.js +1 -1
  138. package/esm/checkbox/styled-components.js +52 -147
  139. package/esm/data-table/column-categorical.js +1 -1
  140. package/esm/data-table/column-datetime.js +1 -1
  141. package/esm/data-table/column.js +6 -2
  142. package/esm/data-table/data-table.js +10 -2
  143. package/esm/data-table/header-cell.js +3 -0
  144. package/esm/data-table/stateful-data-table.js +2 -1
  145. package/esm/datepicker/calendar.js +28 -15
  146. package/esm/datepicker/constants.js +8 -0
  147. package/esm/datepicker/datepicker.js +116 -86
  148. package/esm/datepicker/day.js +84 -34
  149. package/esm/datepicker/month.js +3 -1
  150. package/esm/datepicker/stateful-calendar.js +6 -1
  151. package/esm/datepicker/stateful-container.js +23 -2
  152. package/esm/datepicker/stateful-datepicker.js +6 -1
  153. package/esm/datepicker/styled-components.js +24 -2
  154. package/esm/datepicker/types.js +1 -1
  155. package/esm/datepicker/utils/date-helpers.js +30 -0
  156. package/esm/datepicker/week.js +3 -1
  157. package/esm/file-uploader/file-uploader.js +4 -4
  158. package/esm/form-control/styled-components.js +0 -1
  159. package/esm/header-navigation/styled-components.js +3 -3
  160. package/esm/helpers/overrides.js +1 -2
  161. package/esm/input/styled-components.js +4 -4
  162. package/esm/layer/layer.js +4 -4
  163. package/esm/list/list-item.js +5 -1
  164. package/esm/list/menu-adapter.js +4 -0
  165. package/esm/locale/index.js +0 -7
  166. package/esm/menu/stateful-container.js +0 -1
  167. package/esm/menu/styled-components.js +1 -1
  168. package/esm/modal/index.js +1 -1
  169. package/esm/modal/modal.js +28 -71
  170. package/esm/modal/styled-components.js +6 -38
  171. package/esm/phone-input/default-props.js +1 -1
  172. package/esm/phone-input/index.js +0 -4
  173. package/esm/phone-input/phone-input-lite.js +60 -37
  174. package/esm/radio/radio.js +1 -7
  175. package/esm/radio/radiogroup.js +3 -28
  176. package/esm/radio/styled-components.js +4 -5
  177. package/esm/rating/styled-components.js +3 -3
  178. package/esm/select/index.js +1 -2
  179. package/esm/select/select-component.js +20 -20
  180. package/esm/select/styled-components.js +21 -14
  181. package/esm/snackbar/snackbar-context.js +1 -1
  182. package/esm/snackbar/styled-components.js +2 -2
  183. package/esm/spinner/index.js +3 -9
  184. package/esm/spinner/styled-components.js +2 -40
  185. package/esm/table/filter.js +3 -3
  186. package/esm/tag/styled-components.js +1 -1
  187. package/esm/themes/dark-theme/color-component-tokens.js +0 -38
  188. package/esm/themes/dark-theme/color-tokens.js +0 -2
  189. package/esm/themes/dark-theme/create-dark-theme.js +1 -2
  190. package/esm/themes/dark-theme/dark-theme.js +1 -2
  191. package/esm/themes/light-theme/color-component-tokens.js +0 -38
  192. package/esm/themes/light-theme/color-tokens.js +0 -2
  193. package/esm/themes/light-theme/create-light-theme.js +1 -2
  194. package/esm/themes/light-theme/light-theme.js +1 -2
  195. package/esm/timepicker/timepicker.js +1 -8
  196. package/esm/typography/index.js +1 -35
  197. package/file-uploader/file-uploader.js +3 -3
  198. package/file-uploader/file-uploader.js.flow +4 -4
  199. package/form-control/index.d.ts +9 -0
  200. package/form-control/styled-components.js +0 -1
  201. package/form-control/styled-components.js.flow +0 -1
  202. package/header-navigation/styled-components.js +3 -3
  203. package/header-navigation/styled-components.js.flow +3 -3
  204. package/helpers/overrides.js +1 -2
  205. package/helpers/overrides.js.flow +1 -1
  206. package/input/index.d.ts +5 -9
  207. package/input/styled-components.js +4 -4
  208. package/input/styled-components.js.flow +4 -4
  209. package/layer/layer.js +4 -4
  210. package/layer/layer.js.flow +4 -3
  211. package/list/list-item.js +5 -1
  212. package/list/list-item.js.flow +4 -0
  213. package/list/menu-adapter.js +4 -0
  214. package/list/menu-adapter.js.flow +4 -0
  215. package/list/types.js.flow +4 -0
  216. package/locale/index.js +0 -7
  217. package/locale/index.js.flow +0 -7
  218. package/locale.ts +0 -1
  219. package/menu/index.d.ts +1 -3
  220. package/menu/stateful-container.js +0 -1
  221. package/menu/stateful-container.js.flow +0 -1
  222. package/menu/styled-components.js +1 -1
  223. package/menu/styled-components.js.flow +1 -1
  224. package/modal/index.d.ts +4 -6
  225. package/modal/index.js +0 -6
  226. package/modal/index.js.flow +0 -1
  227. package/modal/modal.js +27 -70
  228. package/modal/modal.js.flow +17 -83
  229. package/modal/styled-components.js +7 -40
  230. package/modal/styled-components.js.flow +12 -44
  231. package/modal/types.js.flow +1 -10
  232. package/package.json +3 -2
  233. package/phone-input/default-props.js +1 -1
  234. package/phone-input/default-props.js.flow +1 -1
  235. package/phone-input/index.d.ts +0 -1
  236. package/phone-input/index.js +0 -36
  237. package/phone-input/index.js.flow +0 -4
  238. package/phone-input/phone-input-lite.js +63 -38
  239. package/phone-input/phone-input-lite.js.flow +66 -44
  240. package/radio/index.d.ts +4 -9
  241. package/radio/radio.js +1 -7
  242. package/radio/radio.js.flow +1 -8
  243. package/radio/radiogroup.js +3 -28
  244. package/radio/radiogroup.js.flow +2 -26
  245. package/radio/styled-components.js +4 -5
  246. package/radio/styled-components.js.flow +3 -4
  247. package/radio/types.js.flow +4 -15
  248. package/rating/styled-components.js +3 -3
  249. package/rating/styled-components.js.flow +3 -3
  250. package/select/index.d.ts +0 -2
  251. package/select/index.js +0 -6
  252. package/select/index.js.flow +0 -2
  253. package/select/select-component.js +23 -24
  254. package/select/select-component.js.flow +25 -14
  255. package/select/styled-components.js +23 -17
  256. package/select/styled-components.js.flow +17 -12
  257. package/snackbar/snackbar-context.js +1 -1
  258. package/snackbar/snackbar-context.js.flow +1 -1
  259. package/snackbar/styled-components.js +1 -1
  260. package/snackbar/styled-components.js.flow +11 -11
  261. package/spinner/index.d.ts +5 -18
  262. package/spinner/index.js +2 -68
  263. package/spinner/index.js.flow +2 -27
  264. package/spinner/styled-components.js +9 -45
  265. package/spinner/styled-components.js.flow +2 -34
  266. package/spinner/types.js.flow +1 -19
  267. package/styles/types.js.flow +0 -2
  268. package/table/filter.js +3 -3
  269. package/table/filter.js.flow +3 -3
  270. package/tag/styled-components.js +1 -1
  271. package/tag/styled-components.js.flow +1 -1
  272. package/tag/types.js.flow +1 -1
  273. package/theme.ts +0 -81
  274. package/themes/dark-theme/color-component-tokens.js +0 -38
  275. package/themes/dark-theme/color-component-tokens.js.flow +0 -42
  276. package/themes/dark-theme/color-tokens.js +0 -2
  277. package/themes/dark-theme/color-tokens.js.flow +0 -2
  278. package/themes/dark-theme/create-dark-theme.js +1 -3
  279. package/themes/dark-theme/create-dark-theme.js.flow +0 -2
  280. package/themes/dark-theme/dark-theme.js +1 -3
  281. package/themes/dark-theme/dark-theme.js.flow +0 -2
  282. package/themes/light-theme/color-component-tokens.js +0 -38
  283. package/themes/light-theme/color-component-tokens.js.flow +0 -43
  284. package/themes/light-theme/color-tokens.js +0 -2
  285. package/themes/light-theme/color-tokens.js.flow +0 -2
  286. package/themes/light-theme/create-light-theme.js +1 -3
  287. package/themes/light-theme/create-light-theme.js.flow +0 -2
  288. package/themes/light-theme/light-theme.js +1 -3
  289. package/themes/light-theme/light-theme.js.flow +0 -2
  290. package/themes/types.js.flow +0 -68
  291. package/timepicker/timepicker.js +1 -8
  292. package/timepicker/timepicker.js.flow +4 -10
  293. package/typography/index.d.ts +0 -23
  294. package/typography/index.js +2 -57
  295. package/typography/index.js.flow +0 -31
  296. package/es/spinner/spinner.js +0 -68
  297. package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
  298. package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
  299. package/esm/spinner/spinner.js +0 -125
  300. package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
  301. package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
  302. package/spinner/spinner.js +0 -136
  303. package/spinner/spinner.js.flow +0 -75
  304. package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
  305. package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
  306. package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
  307. package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
@@ -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
@@ -4,14 +4,12 @@ Copyright (c) Uber Technologies, Inc.
4
4
  This source code is licensed under the MIT license found in the
5
5
  LICENSE file in the root directory of this source tree.
6
6
  */
7
- import { styled, expandBorderStyles } from '../styles/index.js';
8
- import { STYLE_TYPE } from './constants.js';
7
+ import { styled } from '../styles/index.js';
9
8
 
10
9
  function getBorderColor(props) {
11
10
  const {
12
11
  $disabled,
13
12
  $checked,
14
- $isError,
15
13
  $error,
16
14
  $isIndeterminate,
17
15
  $theme,
@@ -25,8 +23,8 @@ function getBorderColor(props) {
25
23
  return colors.tickFillDisabled;
26
24
  } else if ($checked || $isIndeterminate) {
27
25
  return 'transparent';
28
- } else if ($error || $isError) {
29
- return colors.borderError;
26
+ } else if ($error) {
27
+ return colors.borderNegative;
30
28
  } else if ($isFocusVisible) {
31
29
  return colors.borderSelected;
32
30
  } else {
@@ -82,29 +80,22 @@ function getBackgroundColor(props) {
82
80
  $disabled,
83
81
  $checked,
84
82
  $isIndeterminate,
85
- $isError,
86
83
  $error,
87
84
  $isHovered,
88
85
  $isActive,
89
- $theme,
90
- $checkmarkType
86
+ $theme
91
87
  } = props;
92
- const isToggle = $checkmarkType === STYLE_TYPE.toggle;
93
88
  const {
94
89
  colors
95
90
  } = $theme;
96
91
 
97
92
  if ($disabled) {
98
- if (isToggle) {
99
- return colors.toggleFillDisabled;
100
- }
101
-
102
93
  if ($checked || $isIndeterminate) {
103
94
  return colors.tickFillDisabled;
104
95
  } else {
105
96
  return colors.tickFill;
106
97
  }
107
- } else if (($error || $isError) && ($isIndeterminate || $checked)) {
98
+ } else if ($error && ($isIndeterminate || $checked)) {
108
99
  if ($isActive) {
109
100
  return colors.tickFillErrorSelectedHoverActive;
110
101
  } else if ($isHovered) {
@@ -112,7 +103,7 @@ function getBackgroundColor(props) {
112
103
  } else {
113
104
  return colors.tickFillErrorSelected;
114
105
  }
115
- } else if ($error || $isError) {
106
+ } else if ($error) {
116
107
  if ($isActive) {
117
108
  return colors.tickFillErrorHoverActive;
118
109
  } else if ($isHovered) {
@@ -130,11 +121,11 @@ function getBackgroundColor(props) {
130
121
  }
131
122
  } else {
132
123
  if ($isActive) {
133
- return isToggle ? colors.sliderTrackFillActive : colors.tickFillActive;
124
+ return colors.tickFillActive;
134
125
  } else if ($isHovered) {
135
- return isToggle ? colors.sliderTrackFillHover : colors.tickFillHover;
126
+ return colors.tickFillHover;
136
127
  } else {
137
- return isToggle ? colors.toggleTrackFill : colors.tickFill;
128
+ return colors.tickFill;
138
129
  }
139
130
  }
140
131
  }
@@ -168,7 +159,6 @@ export const Checkmark = styled('span', props => {
168
159
  const {
169
160
  $checked,
170
161
  $disabled,
171
- $isError,
172
162
  $error,
173
163
  $isIndeterminate,
174
164
  $theme,
@@ -178,7 +168,7 @@ export const Checkmark = styled('span', props => {
178
168
  sizing,
179
169
  animation
180
170
  } = $theme;
181
- const tickColor = $disabled ? $theme.colors.tickMarkFillDisabled : $isError || $error ? $theme.colors.tickMarkFillError : $theme.colors.tickMarkFill;
171
+ const tickColor = $disabled ? $theme.colors.tickMarkFillDisabled : $error ? $theme.colors.tickMarkFillError : $theme.colors.tickMarkFill;
182
172
  const indeterminate = encodeURIComponent(`
183
173
  <svg width="14" height="4" viewBox="0 0 14 4" fill="none" xmlns="http://www.w3.org/2000/svg">
184
174
  <path d="M14 0.5H0V3.5H14V0.5Z" fill="${tickColor}"/>
@@ -234,14 +224,12 @@ export const Checkmark = styled('span', props => {
234
224
  Checkmark.displayName = "Checkmark";
235
225
  export const Label = styled('div', props => {
236
226
  const {
237
- $theme,
238
- $checkmarkType
227
+ $theme
239
228
  } = props;
240
229
  const {
241
230
  typography
242
231
  } = $theme;
243
232
  return {
244
- flex: $checkmarkType === STYLE_TYPE.toggle ? 'auto' : null,
245
233
  verticalAlign: 'middle',
246
234
  ...getLabelPadding(props),
247
235
  color: getLabelColor(props),
@@ -262,137 +250,54 @@ export const Input = styled('input', {
262
250
  });
263
251
  Input.displayName = "Input";
264
252
  export const Toggle = styled('div', props => {
265
- if (props.$checkmarkType === STYLE_TYPE.toggle) {
266
- const borderRadius = props.$theme.borders.useRoundedCorners ? props.$theme.borders.radius200 : null;
267
- return { ...expandBorderStyles(props.$theme.borders.border300),
268
- alignItems: 'center',
269
- backgroundColor: props.$theme.colors.mono100,
270
- borderTopLeftRadius: borderRadius,
271
- borderTopRightRadius: borderRadius,
272
- borderBottomRightRadius: borderRadius,
273
- borderBottomLeftRadius: borderRadius,
274
- boxShadow: props.$isFocusVisible ? `0 0 0 3px ${props.$theme.colors.accent}` : props.$theme.lighting.shadow400,
275
- outline: 'none',
276
- display: 'flex',
277
- justifyContent: 'center',
278
- height: props.$theme.sizing.scale800,
279
- width: props.$theme.sizing.scale800
280
- };
281
- }
253
+ let backgroundColor = props.$theme.colors.toggleFill;
282
254
 
283
- if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
284
- let backgroundColor = props.$theme.colors.toggleFill;
285
-
286
- if (props.$disabled) {
287
- backgroundColor = props.$theme.colors.toggleFillDisabled;
288
- } else if (props.$checked && (props.$error || props.$isError)) {
289
- backgroundColor = props.$theme.colors.borderError;
290
- } else if (props.$checked) {
291
- backgroundColor = props.$theme.colors.toggleFillChecked;
292
- }
293
-
294
- return {
295
- backgroundColor,
296
- borderTopLeftRadius: '50%',
297
- borderTopRightRadius: '50%',
298
- borderBottomRightRadius: '50%',
299
- borderBottomLeftRadius: '50%',
300
- boxShadow: props.$isFocusVisible ? `0 0 0 3px ${props.$theme.colors.accent}` : props.$isHovered && !props.$disabled ? props.$theme.lighting.shadow500 : props.$theme.lighting.shadow400,
301
- outline: 'none',
302
- height: props.$theme.sizing.scale700,
303
- width: props.$theme.sizing.scale700,
304
- transform: props.$checked ? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})` : null,
305
- transition: `transform ${props.$theme.animation.timing200}`
306
- };
255
+ if (props.$disabled) {
256
+ backgroundColor = props.$theme.colors.toggleFillDisabled;
257
+ } else if (props.$checked && props.$error) {
258
+ backgroundColor = props.$theme.colors.tickFillErrorSelected;
259
+ } else if (props.$checked) {
260
+ backgroundColor = props.$theme.colors.toggleFillChecked;
307
261
  }
308
262
 
309
- return {};
263
+ return {
264
+ backgroundColor,
265
+ borderTopLeftRadius: '50%',
266
+ borderTopRightRadius: '50%',
267
+ borderBottomRightRadius: '50%',
268
+ borderBottomLeftRadius: '50%',
269
+ boxShadow: props.$isFocusVisible ? `0 0 0 3px ${props.$theme.colors.accent}` : props.$isHovered && !props.$disabled ? props.$theme.lighting.shadow500 : props.$theme.lighting.shadow400,
270
+ outline: 'none',
271
+ height: props.$theme.sizing.scale700,
272
+ width: props.$theme.sizing.scale700,
273
+ transform: props.$checked ? `translateX(${props.$theme.direction === 'rtl' ? '-100%' : '100%'})` : null,
274
+ transition: `transform ${props.$theme.animation.timing200}`
275
+ };
310
276
  });
311
277
  Toggle.displayName = "Toggle";
312
- export const ToggleInner = styled('div', props => {
313
- if (props.$checkmarkType === STYLE_TYPE.toggle) {
314
- // eslint-disable-next-line no-inner-declarations
315
- const backgroundColor = () => {
316
- if (props.$disabled) {
317
- return props.$theme.colors.sliderHandleInnerFillDisabled;
318
- }
319
-
320
- if (props.$isActive && props.$checked) {
321
- return props.$theme.colors.sliderHandleInnerFillSelectedActive;
322
- }
323
-
324
- if (props.$isHovered && props.$checked) {
325
- return props.$theme.colors.sliderHandleInnerFillSelectedHover;
326
- }
327
-
328
- return props.$theme.colors.toggleTrackFill;
329
- };
330
-
331
- return {
332
- height: props.$theme.sizing.scale300,
333
- width: props.$theme.sizing.scale0,
334
- borderTopLeftRadius: props.$theme.borders.radius100,
335
- borderTopRightRadius: props.$theme.borders.radius100,
336
- borderBottomRightRadius: props.$theme.borders.radius100,
337
- borderBottomLeftRadius: props.$theme.borders.radius100,
338
- backgroundColor: backgroundColor()
339
- };
340
- }
341
-
342
- if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
343
- return {};
344
- }
345
-
346
- return {};
347
- });
348
- ToggleInner.displayName = "ToggleInner";
349
278
  export const ToggleTrack = styled('div', props => {
350
- if (props.$checkmarkType === STYLE_TYPE.toggle) {
351
- const borderRadius = props.$theme.borders.useRoundedCorners ? props.$theme.borders.radius200 : null;
352
- return {
353
- alignItems: 'center',
354
- backgroundColor: getBackgroundColor(props),
355
- borderTopLeftRadius: borderRadius,
356
- borderTopRightRadius: borderRadius,
357
- borderBottomRightRadius: borderRadius,
358
- borderBottomLeftRadius: borderRadius,
359
- display: 'flex',
360
- height: props.$theme.sizing.scale600,
361
- justifyContent: props.$checked ? 'flex-end' : 'flex-start',
362
- marginTop: props.$theme.sizing.scale100,
363
- marginBottom: props.$theme.sizing.scale100,
364
- marginLeft: props.$theme.sizing.scale100,
365
- marginRight: props.$theme.sizing.scale100,
366
- width: props.$theme.sizing.scale1000
367
- };
368
- }
369
-
370
- if (props.$checkmarkType === STYLE_TYPE.toggle_round) {
371
- let backgroundColor = props.$theme.colors.toggleTrackFill;
372
-
373
- if (props.$disabled) {
374
- backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
375
- } else if ((props.$error || props.$isError) && props.$checked) {
376
- backgroundColor = props.$theme.colors.tickFillError;
377
- }
279
+ let backgroundColor = props.$theme.colors.toggleTrackFill;
378
280
 
379
- return {
380
- alignItems: 'center',
381
- backgroundColor,
382
- borderTopLeftRadius: '7px',
383
- borderTopRightRadius: '7px',
384
- borderBottomRightRadius: '7px',
385
- borderBottomLeftRadius: '7px',
386
- display: 'flex',
387
- height: props.$theme.sizing.scale550,
388
- marginTop: props.$theme.sizing.scale200,
389
- marginBottom: props.$theme.sizing.scale100,
390
- marginLeft: props.$theme.sizing.scale200,
391
- marginRight: props.$theme.sizing.scale100,
392
- width: props.$theme.sizing.scale1000
393
- };
281
+ if (props.$disabled) {
282
+ backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
283
+ } else if (props.$error && props.$checked) {
284
+ backgroundColor = props.$theme.colors.tickFillError;
394
285
  }
395
286
 
396
- return {};
287
+ return {
288
+ alignItems: 'center',
289
+ backgroundColor,
290
+ borderTopLeftRadius: '7px',
291
+ borderTopRightRadius: '7px',
292
+ borderBottomRightRadius: '7px',
293
+ borderBottomLeftRadius: '7px',
294
+ display: 'flex',
295
+ height: props.$theme.sizing.scale550,
296
+ marginTop: props.$theme.sizing.scale200,
297
+ marginBottom: props.$theme.sizing.scale100,
298
+ marginLeft: props.$theme.sizing.scale200,
299
+ marginRight: props.$theme.sizing.scale100,
300
+ width: props.$theme.sizing.scale1000
301
+ };
397
302
  });
398
303
  ToggleTrack.displayName = "ToggleTrack";
@@ -37,7 +37,7 @@ function FilterQuickControls(props) {
37
37
  const locale = React.useContext(LocaleContext);
38
38
  return /*#__PURE__*/React.createElement(ButtonGroup, {
39
39
  size: SIZE.mini,
40
- kind: KIND.minimal
40
+ kind: KIND.tertiary
41
41
  }, /*#__PURE__*/React.createElement(Button, {
42
42
  type: "button",
43
43
  onClick: props.onSelectAll
@@ -322,7 +322,7 @@ function DatetimeFilter(props) {
322
322
  }) => {
323
323
  if (Array.isArray(date)) {
324
324
  if (!date.length) return;
325
- const nextDates = date.map((d, i) => applyDateToTime(rangeDates[i], d));
325
+ const nextDates = date.map((d, i) => d ? applyDateToTime(rangeDates[i], d) : null);
326
326
  setRangeDates(nextDates);
327
327
  }
328
328
  },
@@ -49,7 +49,11 @@ function Column(options) {
49
49
  display: 'flex',
50
50
  height: '100%'
51
51
  })
52
- }, Boolean(props.onSelect) && /*#__PURE__*/React.createElement(Checkbox, {
52
+ }, Boolean(props.onSelect) && /*#__PURE__*/React.createElement("span", {
53
+ className: css({
54
+ paddingRight: theme.sizing.scale300
55
+ })
56
+ }, /*#__PURE__*/React.createElement(Checkbox, {
53
57
  onChange: props.onSelect,
54
58
  checked: props.isSelected,
55
59
  overrides: {
@@ -60,7 +64,7 @@ function Column(options) {
60
64
  }
61
65
  }
62
66
  }
63
- }), /*#__PURE__*/React.createElement(ProvidedCell, props)));
67
+ })), /*#__PURE__*/React.createElement(ProvidedCell, props)));
64
68
  }),
65
69
  renderFilter: options.renderFilter || (() => null),
66
70
  sortable: Boolean(options.sortable) && Boolean(options.sortFn),
@@ -396,7 +396,7 @@ const InnerTableElement = /*#__PURE__*/React.forwardRef((props, ref) => {
396
396
  row: ctx.rows[ctx.rowHighlightIndex - 1]
397
397
  }),
398
398
  size: BUTTON_SIZES.compact,
399
- kind: BUTTON_KINDS.minimal,
399
+ kind: BUTTON_KINDS.tertiary,
400
400
  shape: BUTTON_SHAPES.round,
401
401
  overrides: {
402
402
  BaseButton: {
@@ -459,7 +459,8 @@ export function DataTable({
459
459
  selectedRowIds,
460
460
  sortIndex,
461
461
  sortDirection,
462
- textQuery = ''
462
+ textQuery = '',
463
+ controlRef
463
464
  }) {
464
465
  const [, theme] = useStyletron();
465
466
  const locale = React.useContext(LocaleContext);
@@ -596,6 +597,9 @@ export function DataTable({
596
597
 
597
598
  return result;
598
599
  }, [sortedIndices, filteredIndices, onIncludedRowsChange, allRows]);
600
+ React.useImperativeHandle(controlRef, () => ({
601
+ getRows: () => rows
602
+ }), [rows]);
599
603
  const [browserScrollbarWidth, setBrowserScrollbarWidth] = React.useState(0);
600
604
  const normalizedWidths = React.useMemo(() => {
601
605
  const resizedWidths = measuredWidths.map((w, i) => Math.floor(w) + Math.floor(resizeDeltas[i]));
@@ -69,6 +69,9 @@ const HeaderCell = /*#__PURE__*/React.forwardRef((props, ref) => {
69
69
  onFocus: handleFocus,
70
70
  onBlur: handleBlur
71
71
  }, props.isSelectable && /*#__PURE__*/React.createElement("span", {
72
+ className: css({
73
+ paddingRight: theme.sizing.scale300
74
+ }),
72
75
  ref: checkboxRef
73
76
  }, /*#__PURE__*/React.createElement(Checkbox, {
74
77
  onChange: e => {
@@ -258,6 +258,7 @@ export function StatefulDataTable(props) {
258
258
  selectedRowIds: selectedRowIds,
259
259
  sortDirection: sortDirection,
260
260
  sortIndex: sortIndex,
261
- textQuery: textQuery
261
+ textQuery: textQuery,
262
+ controlRef: props.controlRef
262
263
  }))));
263
264
  }
@@ -252,24 +252,35 @@ export default class Calendar extends React.Component {
252
252
  const {
253
253
  onChange = params => {}
254
254
  } = this.props;
255
- let updatedDate = data.date; // We'll need to update the date in time values of internal state
256
-
257
- const newTimeState = [...this.state.time]; // Apply the currently selected time values (saved in state) to the updated date
255
+ let updatedDate = data.date; // Apply the currently selected time values (saved in state) to the updated date
258
256
 
259
257
  if (Array.isArray(data.date)) {
260
- updatedDate = data.date.map((date, index) => {
261
- newTimeState[index] = this.dateHelpers.applyDateToTime(newTimeState[index], date);
262
- return newTimeState[index];
258
+ // We'll need to update the date in time values of internal state
259
+ const newTimeState = [...this.state.time];
260
+ const start = data.date[0] ? this.dateHelpers.applyDateToTime(newTimeState[0], data.date[0]) : null;
261
+ const end = data.date[1] ? this.dateHelpers.applyDateToTime(newTimeState[1], data.date[1]) : null;
262
+ newTimeState[0] = start;
263
+
264
+ if (end) {
265
+ updatedDate = [start, end];
266
+ newTimeState[1] = end;
267
+ } else {
268
+ updatedDate = [start];
269
+ } // Update the date in time values of internal state
270
+
271
+
272
+ this.setState({
273
+ time: newTimeState
263
274
  });
264
275
  } else if (!Array.isArray(this.props.value) && data.date) {
265
- newTimeState[0] = this.dateHelpers.applyDateToTime(newTimeState[0], data.date);
266
- updatedDate = newTimeState[0];
267
- } // Update the date in time values of internal state
276
+ const newTimeState = this.dateHelpers.applyDateToTime(this.state.time[0], data.date);
277
+ updatedDate = newTimeState; // Update the date in time values of internal state
268
278
 
279
+ this.setState({
280
+ time: [newTimeState]
281
+ });
282
+ }
269
283
 
270
- this.setState({
271
- time: newTimeState
272
- });
273
284
  onChange({
274
285
  date: updatedDate
275
286
  });
@@ -289,14 +300,14 @@ export default class Calendar extends React.Component {
289
300
 
290
301
  if (Array.isArray(this.props.value)) {
291
302
  const dates = this.props.value.map((date, i) => {
292
- if (index === i) {
303
+ if (date && index === i) {
293
304
  return this.dateHelpers.applyTimeToDate(date, time);
294
305
  }
295
306
 
296
307
  return date;
297
308
  });
298
309
  onChange({
299
- date: dates
310
+ date: [dates[0], dates[1]]
300
311
  });
301
312
  } else {
302
313
  const date = this.dateHelpers.applyTimeToDate(this.props.value, time);
@@ -355,7 +366,9 @@ export default class Calendar extends React.Component {
355
366
  overrides: overrides,
356
367
  value: this.props.value,
357
368
  peekNextMonth: this.props.peekNextMonth,
358
- fixedHeight: this.props.fixedHeight
369
+ fixedHeight: this.props.fixedHeight,
370
+ hasLockedBehavior: !!this.props.hasLockedBehavior,
371
+ selectedInput: this.props.selectedInput
359
372
  })));
360
373
  monthList.push( /*#__PURE__*/React.createElement("div", {
361
374
  key: `month-component-${i}`
@@ -25,4 +25,12 @@ export const DEFAULT_MONTHS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
25
25
  export const DENSITY = {
26
26
  high: 'high',
27
27
  default: 'default'
28
+ };
29
+ export const INPUT_ROLE = {
30
+ startDate: 'startDate',
31
+ endDate: 'endDate'
32
+ };
33
+ export const RANGED_CALENDAR_BEHAVIOR = {
34
+ default: 'default',
35
+ locked: 'locked'
28
36
  };