baseui 10.12.1 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +3 -3
  2. package/accordion/accordion.js +60 -13
  3. package/accordion/accordion.js.flow +49 -12
  4. package/accordion/index.d.ts +0 -3
  5. package/accordion/panel.js +7 -6
  6. package/accordion/panel.js.flow +20 -20
  7. package/accordion/stateless-accordion.js +2 -4
  8. package/accordion/stateless-accordion.js.flow +0 -2
  9. package/accordion/types.js.flow +0 -5
  10. package/button/constants.js +1 -2
  11. package/button/constants.js.flow +0 -1
  12. package/button/index.d.ts +0 -1
  13. package/button/styled-components.js +2 -29
  14. package/button/styled-components.js.flow +2 -30
  15. package/checkbox/checkbox.js +6 -30
  16. package/checkbox/checkbox.js.flow +7 -38
  17. package/checkbox/constants.js +2 -1
  18. package/checkbox/constants.js.flow +2 -1
  19. package/checkbox/index.d.ts +4 -6
  20. package/checkbox/index.js +0 -6
  21. package/checkbox/index.js.flow +0 -1
  22. package/checkbox/styled-components.js +52 -149
  23. package/checkbox/styled-components.js.flow +59 -165
  24. package/checkbox/types.js.flow +0 -5
  25. package/data-table/column-categorical.js +1 -1
  26. package/data-table/column-categorical.js.flow +1 -1
  27. package/data-table/column-datetime.js +1 -1
  28. package/data-table/column-datetime.js.flow +3 -1
  29. package/data-table/column.js +6 -2
  30. package/data-table/column.js.flow +9 -7
  31. package/data-table/data-table.js +1 -1
  32. package/data-table/data-table.js.flow +1 -1
  33. package/data-table/header-cell.js +3 -0
  34. package/data-table/header-cell.js.flow +1 -1
  35. package/datepicker/calendar.js +15 -7
  36. package/datepicker/calendar.js.flow +23 -9
  37. package/datepicker/constants.js +12 -2
  38. package/datepicker/constants.js.flow +10 -0
  39. package/datepicker/datepicker.js +61 -30
  40. package/datepicker/datepicker.js.flow +77 -37
  41. package/datepicker/day.js +85 -34
  42. package/datepicker/day.js.flow +118 -54
  43. package/datepicker/locale.js.flow +0 -1
  44. package/datepicker/month.js +3 -1
  45. package/datepicker/month.js.flow +2 -0
  46. package/datepicker/stateful-container.js.flow +2 -1
  47. package/datepicker/styled-components.js +23 -1
  48. package/datepicker/styled-components.js.flow +12 -2
  49. package/datepicker/types.js.flow +35 -10
  50. package/datepicker/utils/date-helpers.js +30 -0
  51. package/datepicker/utils/date-helpers.js.flow +12 -0
  52. package/datepicker/week.js +3 -1
  53. package/datepicker/week.js.flow +2 -0
  54. package/es/accordion/accordion.js +52 -12
  55. package/es/accordion/panel.js +7 -5
  56. package/es/accordion/stateless-accordion.js +2 -4
  57. package/es/button/constants.js +1 -2
  58. package/es/button/styled-components.js +2 -29
  59. package/es/checkbox/checkbox.js +7 -32
  60. package/es/checkbox/constants.js +2 -1
  61. package/es/checkbox/index.js +1 -1
  62. package/es/checkbox/styled-components.js +51 -146
  63. package/es/data-table/column-categorical.js +1 -1
  64. package/es/data-table/column-datetime.js +1 -1
  65. package/es/data-table/column.js +6 -2
  66. package/es/data-table/data-table.js +1 -1
  67. package/es/data-table/header-cell.js +3 -0
  68. package/es/datepicker/calendar.js +15 -7
  69. package/es/datepicker/constants.js +8 -0
  70. package/es/datepicker/datepicker.js +56 -29
  71. package/es/datepicker/day.js +77 -34
  72. package/es/datepicker/month.js +3 -1
  73. package/es/datepicker/styled-components.js +8 -2
  74. package/es/datepicker/types.js +1 -1
  75. package/es/datepicker/utils/date-helpers.js +16 -0
  76. package/es/datepicker/week.js +3 -1
  77. package/es/file-uploader/file-uploader.js +4 -4
  78. package/es/header-navigation/styled-components.js +3 -3
  79. package/es/helpers/overrides.js +1 -2
  80. package/es/input/styled-components.js +4 -4
  81. package/es/layer/layer.js +4 -4
  82. package/es/locale/index.js +0 -7
  83. package/es/menu/stateful-container.js +0 -1
  84. package/es/menu/styled-components.js +1 -1
  85. package/es/modal/index.js +1 -1
  86. package/es/modal/modal.js +19 -65
  87. package/es/modal/styled-components.js +12 -48
  88. package/es/phone-input/default-props.js +1 -1
  89. package/es/phone-input/index.js +0 -4
  90. package/es/phone-input/phone-input-lite.js +55 -31
  91. package/es/radio/radio.js +1 -7
  92. package/es/radio/radiogroup.js +3 -28
  93. package/es/radio/styled-components.js +4 -5
  94. package/es/rating/styled-components.js +3 -3
  95. package/es/select/index.js +1 -2
  96. package/es/select/select-component.js +4 -8
  97. package/es/select/styled-components.js +4 -4
  98. package/es/snackbar/styled-components.js +2 -2
  99. package/es/spinner/index.js +3 -9
  100. package/es/spinner/styled-components.js +2 -32
  101. package/es/table/filter.js +3 -3
  102. package/es/tag/styled-components.js +1 -1
  103. package/es/themes/dark-theme/color-component-tokens.js +0 -38
  104. package/es/themes/dark-theme/color-tokens.js +0 -2
  105. package/es/themes/dark-theme/create-dark-theme.js +0 -2
  106. package/es/themes/dark-theme/dark-theme.js +0 -2
  107. package/es/themes/light-theme/color-component-tokens.js +0 -38
  108. package/es/themes/light-theme/color-tokens.js +0 -2
  109. package/es/themes/light-theme/create-light-theme.js +0 -2
  110. package/es/themes/light-theme/light-theme.js +0 -2
  111. package/es/timepicker/timepicker.js +1 -8
  112. package/es/typography/index.js +1 -31
  113. package/esm/accordion/accordion.js +60 -13
  114. package/esm/accordion/panel.js +7 -6
  115. package/esm/accordion/stateless-accordion.js +2 -4
  116. package/esm/button/constants.js +1 -2
  117. package/esm/button/styled-components.js +2 -29
  118. package/esm/checkbox/checkbox.js +7 -30
  119. package/esm/checkbox/constants.js +2 -1
  120. package/esm/checkbox/index.js +1 -1
  121. package/esm/checkbox/styled-components.js +52 -147
  122. package/esm/data-table/column-categorical.js +1 -1
  123. package/esm/data-table/column-datetime.js +1 -1
  124. package/esm/data-table/column.js +6 -2
  125. package/esm/data-table/data-table.js +1 -1
  126. package/esm/data-table/header-cell.js +3 -0
  127. package/esm/datepicker/calendar.js +15 -7
  128. package/esm/datepicker/constants.js +8 -0
  129. package/esm/datepicker/datepicker.js +60 -30
  130. package/esm/datepicker/day.js +84 -34
  131. package/esm/datepicker/month.js +3 -1
  132. package/esm/datepicker/styled-components.js +24 -2
  133. package/esm/datepicker/types.js +1 -1
  134. package/esm/datepicker/utils/date-helpers.js +30 -0
  135. package/esm/datepicker/week.js +3 -1
  136. package/esm/file-uploader/file-uploader.js +4 -4
  137. package/esm/header-navigation/styled-components.js +3 -3
  138. package/esm/helpers/overrides.js +1 -2
  139. package/esm/input/styled-components.js +4 -4
  140. package/esm/layer/layer.js +4 -4
  141. package/esm/locale/index.js +0 -7
  142. package/esm/menu/stateful-container.js +0 -1
  143. package/esm/menu/styled-components.js +1 -1
  144. package/esm/modal/index.js +1 -1
  145. package/esm/modal/modal.js +28 -71
  146. package/esm/modal/styled-components.js +6 -38
  147. package/esm/phone-input/default-props.js +1 -1
  148. package/esm/phone-input/index.js +0 -4
  149. package/esm/phone-input/phone-input-lite.js +60 -37
  150. package/esm/radio/radio.js +1 -7
  151. package/esm/radio/radiogroup.js +3 -28
  152. package/esm/radio/styled-components.js +4 -5
  153. package/esm/rating/styled-components.js +3 -3
  154. package/esm/select/index.js +1 -2
  155. package/esm/select/select-component.js +4 -8
  156. package/esm/select/styled-components.js +4 -4
  157. package/esm/snackbar/styled-components.js +2 -2
  158. package/esm/spinner/index.js +3 -9
  159. package/esm/spinner/styled-components.js +2 -40
  160. package/esm/table/filter.js +3 -3
  161. package/esm/tag/styled-components.js +1 -1
  162. package/esm/themes/dark-theme/color-component-tokens.js +0 -38
  163. package/esm/themes/dark-theme/color-tokens.js +0 -2
  164. package/esm/themes/dark-theme/create-dark-theme.js +1 -2
  165. package/esm/themes/dark-theme/dark-theme.js +1 -2
  166. package/esm/themes/light-theme/color-component-tokens.js +0 -38
  167. package/esm/themes/light-theme/color-tokens.js +0 -2
  168. package/esm/themes/light-theme/create-light-theme.js +1 -2
  169. package/esm/themes/light-theme/light-theme.js +1 -2
  170. package/esm/timepicker/timepicker.js +1 -8
  171. package/esm/typography/index.js +1 -35
  172. package/file-uploader/file-uploader.js +3 -3
  173. package/file-uploader/file-uploader.js.flow +4 -4
  174. package/header-navigation/styled-components.js +3 -3
  175. package/header-navigation/styled-components.js.flow +3 -3
  176. package/helpers/overrides.js +1 -2
  177. package/helpers/overrides.js.flow +1 -1
  178. package/input/index.d.ts +5 -9
  179. package/input/styled-components.js +4 -4
  180. package/input/styled-components.js.flow +4 -4
  181. package/layer/layer.js +4 -4
  182. package/layer/layer.js.flow +4 -3
  183. package/locale/index.js +0 -7
  184. package/locale/index.js.flow +0 -7
  185. package/locale.ts +0 -1
  186. package/menu/index.d.ts +1 -3
  187. package/menu/stateful-container.js +0 -1
  188. package/menu/stateful-container.js.flow +0 -1
  189. package/menu/styled-components.js +1 -1
  190. package/menu/styled-components.js.flow +1 -1
  191. package/modal/index.d.ts +4 -6
  192. package/modal/index.js +0 -6
  193. package/modal/index.js.flow +0 -1
  194. package/modal/modal.js +27 -70
  195. package/modal/modal.js.flow +17 -83
  196. package/modal/styled-components.js +7 -40
  197. package/modal/styled-components.js.flow +12 -44
  198. package/modal/types.js.flow +1 -10
  199. package/package.json +2 -2
  200. package/phone-input/default-props.js +1 -1
  201. package/phone-input/default-props.js.flow +1 -1
  202. package/phone-input/index.d.ts +0 -1
  203. package/phone-input/index.js +0 -36
  204. package/phone-input/index.js.flow +0 -4
  205. package/phone-input/phone-input-lite.js +63 -38
  206. package/phone-input/phone-input-lite.js.flow +66 -44
  207. package/radio/index.d.ts +4 -9
  208. package/radio/radio.js +1 -7
  209. package/radio/radio.js.flow +1 -8
  210. package/radio/radiogroup.js +3 -28
  211. package/radio/radiogroup.js.flow +2 -26
  212. package/radio/styled-components.js +4 -5
  213. package/radio/styled-components.js.flow +3 -4
  214. package/radio/types.js.flow +4 -15
  215. package/rating/styled-components.js +3 -3
  216. package/rating/styled-components.js.flow +3 -3
  217. package/select/index.d.ts +0 -2
  218. package/select/index.js +0 -6
  219. package/select/index.js.flow +0 -2
  220. package/select/select-component.js +4 -8
  221. package/select/select-component.js.flow +2 -3
  222. package/select/styled-components.js +4 -4
  223. package/select/styled-components.js.flow +4 -4
  224. package/snackbar/styled-components.js +1 -1
  225. package/snackbar/styled-components.js.flow +11 -11
  226. package/spinner/index.d.ts +5 -18
  227. package/spinner/index.js +2 -68
  228. package/spinner/index.js.flow +2 -27
  229. package/spinner/styled-components.js +9 -45
  230. package/spinner/styled-components.js.flow +2 -34
  231. package/spinner/types.js.flow +1 -19
  232. package/styles/types.js.flow +0 -2
  233. package/table/filter.js +3 -3
  234. package/table/filter.js.flow +3 -3
  235. package/tag/styled-components.js +1 -1
  236. package/tag/styled-components.js.flow +1 -1
  237. package/theme.ts +0 -81
  238. package/themes/dark-theme/color-component-tokens.js +0 -38
  239. package/themes/dark-theme/color-component-tokens.js.flow +0 -42
  240. package/themes/dark-theme/color-tokens.js +0 -2
  241. package/themes/dark-theme/color-tokens.js.flow +0 -2
  242. package/themes/dark-theme/create-dark-theme.js +1 -3
  243. package/themes/dark-theme/create-dark-theme.js.flow +0 -2
  244. package/themes/dark-theme/dark-theme.js +1 -3
  245. package/themes/dark-theme/dark-theme.js.flow +0 -2
  246. package/themes/light-theme/color-component-tokens.js +0 -38
  247. package/themes/light-theme/color-component-tokens.js.flow +0 -43
  248. package/themes/light-theme/color-tokens.js +0 -2
  249. package/themes/light-theme/color-tokens.js.flow +0 -2
  250. package/themes/light-theme/create-light-theme.js +1 -3
  251. package/themes/light-theme/create-light-theme.js.flow +0 -2
  252. package/themes/light-theme/light-theme.js +1 -3
  253. package/themes/light-theme/light-theme.js.flow +0 -2
  254. package/themes/types.js.flow +0 -68
  255. package/timepicker/timepicker.js +1 -8
  256. package/timepicker/timepicker.js.flow +4 -10
  257. package/typography/index.d.ts +0 -23
  258. package/typography/index.js +2 -57
  259. package/typography/index.js.flow +0 -31
  260. package/es/spinner/spinner.js +0 -68
  261. package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
  262. package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
  263. package/esm/spinner/spinner.js +0 -125
  264. package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
  265. package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
  266. package/spinner/spinner.js +0 -136
  267. package/spinner/spinner.js.flow +0 -75
  268. package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
  269. package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
  270. package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
  271. package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
@@ -16,27 +16,18 @@ import { Layer } from '../layer/index.js';
16
16
  import { SIZE, ROLE, CLOSE_SOURCE } from './constants.js';
17
17
  import {
18
18
  Root as StyledRoot,
19
- Backdrop as StyledBackdrop,
20
19
  Dialog as StyledDialog,
21
20
  DialogContainer as StyledDialogContainer,
22
21
  Close as StyledClose,
23
22
  } from './styled-components.js';
24
23
  import { CloseIcon } from './close-icon.js';
25
24
 
26
- import type {
27
- ModalPropsT,
28
- ModalStateT,
29
- SharedStylePropsArgT,
30
- CloseSourceT,
31
- ElementRefT,
32
- } from './types.js';
25
+ import type { ModalPropsT, ModalStateT, SharedStylePropsArgT, CloseSourceT } from './types.js';
33
26
  import { isFocusVisible, forkFocus, forkBlur } from '../utils/focusVisible.js';
34
27
 
35
28
  class Modal extends React.Component<ModalPropsT, ModalStateT> {
36
29
  static defaultProps: $Shape<ModalPropsT> = {
37
30
  animate: true,
38
- // TODO(v11): remove
39
- autofocus: null,
40
31
  autoFocus: true,
41
32
  focusLock: true,
42
33
  returnFocus: true,
@@ -46,14 +37,14 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
46
37
  overrides: {},
47
38
  role: ROLE.dialog,
48
39
  size: SIZE.default,
49
- unstable_ModalBackdropScroll: false,
50
40
  };
51
41
 
52
42
  animateOutTimer: ?TimeoutID;
53
43
  animateStartTimer: ?AnimationFrameID;
44
+ dialogContainerRef = React.createRef<HTMLElement>();
54
45
  lastFocus: ?HTMLElement = null;
55
46
  lastMountNodeOverflowStyle: ?string = null;
56
- _refs: { [string]: ElementRefT } = {};
47
+ rootRef = React.createRef<HTMLElement>();
57
48
 
58
49
  state = {
59
50
  isVisible: false,
@@ -63,21 +54,7 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
63
54
 
64
55
  componentDidMount() {
65
56
  this.setState({ mounted: true });
66
- // TODO(v11)
67
57
  if (__DEV__) {
68
- if (!this.props.unstable_ModalBackdropScroll) {
69
- console.warn(`Consider setting 'unstable_ModalBackdropScroll' prop to true
70
- to prepare for the next major version upgrade. 'unstable_ModalBackdropScroll'
71
- prop will be removed in the next major version but implemented as the default behavior.`);
72
- }
73
- if (this.props.overrides && this.props.overrides.Backdrop) {
74
- console.warn(`Backdrop element will be removed in the next major version in favor of
75
- DialogContainer element that will have the backdrop styles and backdrop click handle.
76
- Consider setting 'unstable_ModalBackdropScroll' prop to true that will apply backdrop
77
- styles to DialogContainer enable modal scrolling while cursor in over the backdrop.
78
- Then pass backdrop overrides to DialogContainer instead. Tha will help you with
79
- the next major version upgrade.`);
80
- }
81
58
  // $FlowFixMe: flow complains that this prop doesn't exist
82
59
  if (this.props.closable) {
83
60
  console.warn(
@@ -149,11 +126,7 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
149
126
  if (
150
127
  e.target &&
151
128
  e.target instanceof HTMLElement &&
152
- // Handles modal closure when unstable_ModalBackdropScroll is set to true
153
- (e.target.contains(this.getRef('DialogContainer').current) ||
154
- // Handles modal closure when unstable_ModalBackdropScroll is set to false
155
- // $FlowFixMe
156
- e.target.contains(this.getRef('DeprecatedBackdrop').current))
129
+ e.target.contains(this.dialogContainerRef.current)
157
130
  ) {
158
131
  this.onBackdropClick();
159
132
  }
@@ -183,7 +156,7 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
183
156
  didOpen() {
184
157
  // Sometimes scroll starts past zero, possibly due to animation
185
158
  // Reset scroll to 0 (other libraries do this as well)
186
- const rootRef = this.getRef('Root').current;
159
+ const rootRef = this.rootRef.current;
187
160
  if (rootRef) {
188
161
  rootRef.scrollTop = 0;
189
162
  }
@@ -220,7 +193,7 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
220
193
  };
221
194
 
222
195
  getSharedProps(): $Diff<SharedStylePropsArgT, { children?: React.Node }> {
223
- const { animate, isOpen, size, role, closeable, unstable_ModalBackdropScroll } = this.props;
196
+ const { animate, isOpen, size, role, closeable } = this.props;
224
197
  return {
225
198
  $animate: animate,
226
199
  $isVisible: this.state.isVisible,
@@ -228,7 +201,6 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
228
201
  $size: size,
229
202
  $role: role,
230
203
  $closeable: !!closeable,
231
- $unstable_ModalBackdropScroll: unstable_ModalBackdropScroll,
232
204
  $isFocusVisible: this.state.isFocusVisible,
233
205
  };
234
206
  }
@@ -248,35 +220,17 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
248
220
  return typeof children === 'function' ? children() : children;
249
221
  }
250
222
 
251
- getRef(component: string): ElementRefT {
252
- if (!this._refs[component]) {
253
- this._refs[component] = React.createRef();
254
- }
255
- return this._refs[component];
256
- }
257
-
258
223
  renderModal() {
259
- const {
260
- overrides = {},
261
- closeable,
262
- role,
263
- unstable_ModalBackdropScroll,
264
- autofocus,
265
- autoFocus,
266
- focusLock,
267
- returnFocus,
268
- } = this.props;
224
+ const { overrides = {}, closeable, role, autoFocus, focusLock, returnFocus } = this.props;
269
225
 
270
226
  const {
271
227
  Root: RootOverride,
272
228
  Dialog: DialogOverride,
273
229
  DialogContainer: DialogContainerOverride,
274
- Backdrop: BackdropOverride,
275
230
  Close: CloseOverride,
276
231
  } = overrides;
277
232
 
278
233
  const [Root, rootProps] = getOverrides(RootOverride, StyledRoot);
279
- const [Backdrop, backdropProps] = getOverrides(BackdropOverride, StyledBackdrop);
280
234
  const [DialogContainer, dialogContainerProps] = getOverrides(
281
235
  DialogContainerOverride,
282
236
  StyledDialogContainer
@@ -287,23 +241,6 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
287
241
  const sharedProps = this.getSharedProps();
288
242
  const children = this.getChildren();
289
243
 
290
- if (autofocus === false && __DEV__) {
291
- console.warn(
292
- `The prop "autofocus" is deprecated in favor of "autoFocus" to be consistent across the project.
293
- The property "autofocus" will be removed in a future major version.`
294
- );
295
- }
296
-
297
- // Handles backdrop click when `unstable_ModalBackdropScroll` is set to true
298
- if (dialogContainerProps.ref) {
299
- this._refs.DialogContainer = dialogContainerProps.ref;
300
- }
301
- const dialogContainerConditionalProps = unstable_ModalBackdropScroll
302
- ? {
303
- ref: this.getRef('DialogContainer'),
304
- }
305
- : {};
306
-
307
244
  return (
308
245
  <LocaleContext.Consumer>
309
246
  {(locale) => (
@@ -312,20 +249,18 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
312
249
  // Allow focus to escape when UI is within an iframe
313
250
  crossFrame={false}
314
251
  returnFocus={returnFocus}
315
- autoFocus={autofocus !== null ? autofocus : autoFocus}
252
+ autoFocus={autoFocus}
316
253
  >
317
- <Root data-baseweb="modal" ref={this.getRef('Root')} {...sharedProps} {...rootProps}>
318
- <Backdrop
319
- {...(unstable_ModalBackdropScroll
320
- ? {}
321
- : {
322
- ref: this.getRef('DeprecatedBackdrop'),
323
- })}
324
- {...sharedProps}
325
- {...backdropProps}
326
- />
254
+ <Root
255
+ data-baseweb="modal"
256
+ // flowlint-next-line unclear-type:off
257
+ ref={(this.rootRef: any)}
258
+ {...sharedProps}
259
+ {...rootProps}
260
+ >
327
261
  <DialogContainer
328
- {...dialogContainerConditionalProps}
262
+ // flowlint-next-line unclear-type:off
263
+ ref={(this.dialogContainerRef: any)}
329
264
  {...sharedProps}
330
265
  {...dialogContainerProps}
331
266
  >
@@ -334,7 +269,6 @@ class Modal extends React.Component<ModalPropsT, ModalStateT> {
334
269
  aria-modal
335
270
  aria-label="dialog"
336
271
  role={role}
337
- ref={this.getRef('Dialog')}
338
272
  {...sharedProps}
339
273
  {...dialogProps}
340
274
  >
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ModalFooter = exports.ModalBody = exports.ModalHeader = exports.Close = exports.Dialog = exports.DialogContainer = exports.Backdrop = exports.Root = void 0;
6
+ exports.ModalFooter = exports.ModalBody = exports.ModalHeader = exports.Close = exports.Dialog = exports.DialogContainer = exports.Root = void 0;
7
7
 
8
8
  var _index = require("../styles/index.js");
9
9
 
@@ -50,62 +50,29 @@ var Root = (0, _index.styled)('div', function (props) {
50
50
  });
51
51
  exports.Root = Root;
52
52
  Root.displayName = "Root";
53
- var Backdrop = (0, _index.styled)('div', function (props) {
53
+ var DialogContainer = (0, _index.styled)('div', function (props) {
54
54
  var $animate = props.$animate,
55
55
  $isOpen = props.$isOpen,
56
56
  $isVisible = props.$isVisible,
57
- $theme = props.$theme,
58
- $unstable_ModalBackdropScroll = props.$unstable_ModalBackdropScroll;
59
-
60
- if ($unstable_ModalBackdropScroll) {
61
- return {};
62
- }
63
-
64
- return _objectSpread({
65
- position: 'fixed',
66
- right: 0,
67
- bottom: 0,
68
- top: 0,
69
- left: 0,
70
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
71
- // Remove grey highlight
72
- WebkitTapHighlightColor: 'transparent',
73
- // Disable scroll capabilities.
74
- touchAction: 'none',
75
- opacity: $isVisible && $isOpen ? 1 : 0
76
- }, $animate ? {
57
+ $theme = props.$theme;
58
+ var animationRules = {
77
59
  transitionProperty: 'opacity',
78
60
  transitionDuration: $theme.animation.timing400,
79
61
  transitionTimingFunction: $theme.animation.easeOutCurve
80
- } : null);
81
- });
82
- exports.Backdrop = Backdrop;
83
- Backdrop.displayName = "Backdrop";
84
- var DialogContainer = (0, _index.styled)('div', function (props) {
85
- var $animate = props.$animate,
86
- $isOpen = props.$isOpen,
87
- $isVisible = props.$isVisible,
88
- $theme = props.$theme,
89
- $unstable_ModalBackdropScroll = props.$unstable_ModalBackdropScroll;
62
+ };
90
63
  return _objectSpread({
91
64
  display: 'flex',
92
65
  alignItems: 'center',
93
66
  justifyContent: 'center',
94
67
  width: '100%',
95
68
  minHeight: '100%',
96
- pointerEvents: 'none',
97
- userSelect: 'none'
98
- }, $unstable_ModalBackdropScroll ? _objectSpread({
69
+ userSelect: 'none',
99
70
  pointerEvents: 'auto',
100
71
  backgroundColor: 'rgba(0, 0, 0, 0.5)',
101
72
  // Remove grey highlight
102
73
  WebkitTapHighlightColor: 'transparent',
103
74
  opacity: $isVisible && $isOpen ? 1 : 0
104
- }, $animate ? {
105
- transitionProperty: 'opacity',
106
- transitionDuration: $theme.animation.timing400,
107
- transitionTimingFunction: $theme.animation.easeOutCurve
108
- } : null) : {});
75
+ }, $animate ? animationRules : null);
109
76
  });
110
77
  exports.DialogContainer = DialogContainer;
111
78
  DialogContainer.displayName = "DialogContainer";
@@ -47,59 +47,27 @@ export const Root = styled<SharedStylePropsArgT>('div', (props) => {
47
47
  };
48
48
  });
49
49
 
50
- export const Backdrop = styled<SharedStylePropsArgT>('div', (props) => {
51
- const { $animate, $isOpen, $isVisible, $theme, $unstable_ModalBackdropScroll } = props;
52
- if ($unstable_ModalBackdropScroll) {
53
- return {};
54
- }
55
- return {
56
- position: 'fixed',
57
- right: 0,
58
- bottom: 0,
59
- top: 0,
60
- left: 0,
61
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
62
- // Remove grey highlight
63
- WebkitTapHighlightColor: 'transparent',
64
- // Disable scroll capabilities.
65
- touchAction: 'none',
66
- opacity: $isVisible && $isOpen ? 1 : 0,
67
- ...($animate
68
- ? {
69
- transitionProperty: 'opacity',
70
- transitionDuration: $theme.animation.timing400,
71
- transitionTimingFunction: $theme.animation.easeOutCurve,
72
- }
73
- : null),
50
+ export const DialogContainer = styled<SharedStylePropsArgT>('div', (props) => {
51
+ const { $animate, $isOpen, $isVisible, $theme } = props;
52
+ const animationRules = {
53
+ transitionProperty: 'opacity',
54
+ transitionDuration: $theme.animation.timing400,
55
+ transitionTimingFunction: $theme.animation.easeOutCurve,
74
56
  };
75
- });
76
57
 
77
- export const DialogContainer = styled<SharedStylePropsArgT>('div', (props) => {
78
- const { $animate, $isOpen, $isVisible, $theme, $unstable_ModalBackdropScroll } = props;
79
58
  return {
80
59
  display: 'flex',
81
60
  alignItems: 'center',
82
61
  justifyContent: 'center',
83
62
  width: '100%',
84
63
  minHeight: '100%',
85
- pointerEvents: 'none',
86
64
  userSelect: 'none',
87
- ...($unstable_ModalBackdropScroll
88
- ? {
89
- pointerEvents: 'auto',
90
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
91
- // Remove grey highlight
92
- WebkitTapHighlightColor: 'transparent',
93
- opacity: $isVisible && $isOpen ? 1 : 0,
94
- ...($animate
95
- ? {
96
- transitionProperty: 'opacity',
97
- transitionDuration: $theme.animation.timing400,
98
- transitionTimingFunction: $theme.animation.easeOutCurve,
99
- }
100
- : null),
101
- }
102
- : {}),
65
+ pointerEvents: 'auto',
66
+ backgroundColor: 'rgba(0, 0, 0, 0.5)',
67
+ // Remove grey highlight
68
+ WebkitTapHighlightColor: 'transparent',
69
+ opacity: $isVisible && $isOpen ? 1 : 0,
70
+ ...($animate ? animationRules : null),
103
71
  };
104
72
  });
105
73
 
@@ -20,15 +20,11 @@ export type CloseSourceT = $Keys<typeof CLOSE_SOURCE>;
20
20
 
21
21
  export type OverridesT = {
22
22
  Root?: OverrideT,
23
- Backdrop?: OverrideT,
24
23
  Dialog?: OverrideT,
25
24
  DialogContainer?: OverrideT,
26
25
  Close?: OverrideT,
27
26
  };
28
27
 
29
- // flowlint-next-line unclear-type:off
30
- export type ElementRefT = { current: React.ElementRef<any> | null };
31
-
32
28
  // Props shared by all flavors of modal
33
29
  export type ModalPropsT = {
34
30
  /** Sets whether the Modal should be displayed by easing in and out */
@@ -37,7 +33,6 @@ export type ModalPropsT = {
37
33
  * If false, the modal container itself will receive focus.
38
34
  * Moving focus into a newly opened modal is important for accessibility purposes, so please be careful!
39
35
  */
40
- autofocus: boolean | null,
41
36
  autoFocus: boolean,
42
37
  /** If true, focus will be locked to elements within the modal.
43
38
  */
@@ -53,7 +48,7 @@ export type ModalPropsT = {
53
48
  * for performance reasons (wont render until opened) */
54
49
  children?: React.Node | (() => React.Node),
55
50
  /** Whether the modal should be closeable by the user
56
- * (either via escape, backdrop click, etc). You can set this to
51
+ * (either via escape, dialog container click, etc). You can set this to
57
52
  * false if your modal has an action that the user must take before closing.*/
58
53
  closeable: boolean,
59
54
  isOpen: boolean,
@@ -70,9 +65,6 @@ export type ModalPropsT = {
70
65
  /** Controls the size of the modal (primarily width).
71
66
  * Can be a SIZE constant or css width property value. */
72
67
  size: SizePropT,
73
- /** Make modal scrollable while cursor is over the modal's backdrop.
74
- * Will be removed and implemented as the default behavior in the next major version */
75
- unstable_ModalBackdropScroll?: boolean,
76
68
  };
77
69
 
78
70
  export type ModalPropsWithoutChildrenT = $Diff<ModalPropsT, { children: ?React.Node }>;
@@ -90,7 +82,6 @@ export type SharedStylePropsArgT = {
90
82
  $size: SizePropT,
91
83
  $role: RolePropT,
92
84
  $closeable: boolean,
93
- $unstable_ModalBackdropScroll?: boolean,
94
85
  $isFocusVisible: boolean,
95
86
  };
96
87
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "10.12.1",
3
+ "version": "11.0.0",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -14,7 +14,7 @@
14
14
  "module": "./esm/index.js",
15
15
  "repository": "uber/baseweb",
16
16
  "scripts": {
17
- "lint:code": "eslint ./ --fix --cache",
17
+ "lint:code": "eslint ./ --cache",
18
18
  "lint:markdown": "markdownlint -c ./.markdownlint.json proposals",
19
19
  "lint": "yarn lint:code && yarn lint:markdown",
20
20
  "pretest": "yarn build:documentation-site-files",
@@ -17,7 +17,7 @@ var defaultProps = {
17
17
  'aria-label': 'Please enter a phone number without the country dial code.',
18
18
  'aria-describedby': null,
19
19
  'aria-labelledby': null,
20
- clearable: false,
20
+ clearable: true,
21
21
  focusLock: false,
22
22
  country: {
23
23
  label: 'United States',
@@ -11,7 +11,7 @@ const defaultProps = {
11
11
  'aria-label': 'Please enter a phone number without the country dial code.',
12
12
  'aria-describedby': null,
13
13
  'aria-labelledby': null,
14
- clearable: false,
14
+ clearable: true,
15
15
  focusLock: false,
16
16
  country: { label: 'United States', id: 'US', dialCode: '+1' },
17
17
  disabled: false,
@@ -335,7 +335,6 @@ export interface PhoneInputProps extends InputProps {
335
335
  overrides?: PhoneInputOverrides;
336
336
  }
337
337
  export const PhoneInput: React.FC<PhoneInputProps>;
338
- export const PhoneInputNext: React.FC<PhoneInputProps>;
339
338
 
340
339
  export interface PhoneInputLiteProps extends PhoneInputProps {
341
340
  countries: {[key: string]: Country};
@@ -8,13 +8,9 @@ Object.defineProperty(exports, "__esModule", {
8
8
  var _exportNames = {
9
9
  PhoneInput: true,
10
10
  PhoneInputLite: true,
11
- PhoneInputNext: true,
12
11
  StatefulPhoneInput: true,
13
- StatefulPhoneInputNext: true,
14
12
  StatefulPhoneInputContainer: true,
15
13
  CountryPicker: true,
16
- CountrySelect: true,
17
- CountrySelectDropdown: true,
18
14
  Flag: true,
19
15
  StyledFlag: true
20
16
  };
@@ -30,24 +26,12 @@ Object.defineProperty(exports, "PhoneInputLite", {
30
26
  return _phoneInputLite.default;
31
27
  }
32
28
  });
33
- Object.defineProperty(exports, "PhoneInputNext", {
34
- enumerable: true,
35
- get: function get() {
36
- return _phoneInputNext.default;
37
- }
38
- });
39
29
  Object.defineProperty(exports, "StatefulPhoneInput", {
40
30
  enumerable: true,
41
31
  get: function get() {
42
32
  return _statefulPhoneInput.default;
43
33
  }
44
34
  });
45
- Object.defineProperty(exports, "StatefulPhoneInputNext", {
46
- enumerable: true,
47
- get: function get() {
48
- return _statefulPhoneInputNext.default;
49
- }
50
- });
51
35
  Object.defineProperty(exports, "StatefulPhoneInputContainer", {
52
36
  enumerable: true,
53
37
  get: function get() {
@@ -60,18 +44,6 @@ Object.defineProperty(exports, "CountryPicker", {
60
44
  return _countryPicker.default;
61
45
  }
62
46
  });
63
- Object.defineProperty(exports, "CountrySelect", {
64
- enumerable: true,
65
- get: function get() {
66
- return _countrySelect.default;
67
- }
68
- });
69
- Object.defineProperty(exports, "CountrySelectDropdown", {
70
- enumerable: true,
71
- get: function get() {
72
- return _countrySelectDropdown.default;
73
- }
74
- });
75
47
  Object.defineProperty(exports, "Flag", {
76
48
  enumerable: true,
77
49
  get: function get() {
@@ -89,20 +61,12 @@ var _phoneInput = _interopRequireDefault(require("./phone-input.js"));
89
61
 
90
62
  var _phoneInputLite = _interopRequireDefault(require("./phone-input-lite.js"));
91
63
 
92
- var _phoneInputNext = _interopRequireDefault(require("./phone-input-next.js"));
93
-
94
64
  var _statefulPhoneInput = _interopRequireDefault(require("./stateful-phone-input.js"));
95
65
 
96
- var _statefulPhoneInputNext = _interopRequireDefault(require("./stateful-phone-input-next.js"));
97
-
98
66
  var _statefulPhoneInputContainer = _interopRequireDefault(require("./stateful-phone-input-container.js"));
99
67
 
100
68
  var _countryPicker = _interopRequireDefault(require("./country-picker.js"));
101
69
 
102
- var _countrySelect = _interopRequireDefault(require("./country-select.js"));
103
-
104
- var _countrySelectDropdown = _interopRequireDefault(require("./country-select-dropdown.js"));
105
-
106
70
  var _flag = _interopRequireWildcard(require("./flag.js"));
107
71
 
108
72
  var _constants = require("./constants.js");
@@ -8,13 +8,9 @@ LICENSE file in the root directory of this source tree.
8
8
 
9
9
  export { default as PhoneInput } from './phone-input.js';
10
10
  export { default as PhoneInputLite } from './phone-input-lite.js';
11
- export { default as PhoneInputNext } from './phone-input-next.js';
12
11
  export { default as StatefulPhoneInput } from './stateful-phone-input.js';
13
- export { default as StatefulPhoneInputNext } from './stateful-phone-input-next.js';
14
12
  export { default as StatefulPhoneInputContainer } from './stateful-phone-input-container.js';
15
13
  export { default as CountryPicker } from './country-picker.js';
16
- export { default as CountrySelect } from './country-select.js';
17
- export { default as CountrySelectDropdown } from './country-select-dropdown.js';
18
14
  export { default as Flag, StyledFlag } from './flag.js';
19
15
  export * from './constants.js';
20
16
  export type * from './types.js';