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
@@ -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.2",
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",
@@ -29,6 +29,7 @@
29
29
  "build:esm": "cross-env NODE_ENV=production BABEL_ENV=esm babel ./src --out-dir ./dist/esm --ignore **.test.js,**/__tests__/**,**/e2e.js,**/template-component/**,**/test/**",
30
30
  "build:es": "cross-env NODE_ENV=production BABEL_ENV=es babel ./src --out-dir ./dist/es --ignore **.test.js,**/__tests__/**,**/e2e.js,**/template-component/**,**/test/**",
31
31
  "build": "yarn build:cjs && yarn build:esm && yarn build:es && yarn build:copy-files && yarn build:copy-flow-files && yarn build:copy-ts-files && yarn build:package-json",
32
+ "build:docs-and-ladle": "yarn documentation:build && yarn ladle build --base-url /ladle/ && mv build public/ladle",
32
33
  "build:documentation-site-files": "node ./scripts/build-documentation-site-files.js",
33
34
  "unit-test": "yarn jest --coverage",
34
35
  "e2e:build": "yarn ladle build --out build-ladle",
@@ -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';
@@ -9,13 +9,15 @@ exports.default = PhoneInputLite;
9
9
 
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
 
12
- var _index = require("../input/index.js");
12
+ var _countryPicker = _interopRequireDefault(require("./country-picker.js"));
13
13
 
14
- var _countrySelect = _interopRequireDefault(require("./country-select.js"));
14
+ var _defaultProps = _interopRequireDefault(require("./default-props.js"));
15
15
 
16
- var _overrides = require("../helpers/overrides.js");
16
+ var _styledComponents = require("./styled-components.js");
17
17
 
18
- var _defaultProps = _interopRequireDefault(require("./default-props.js"));
18
+ var _index = require("../input/index.js");
19
+
20
+ var _overrides = require("../helpers/overrides.js");
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
@@ -37,19 +39,19 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
37
39
 
38
40
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
41
 
42
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
43
+
40
44
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
41
45
 
42
46
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
43
47
 
44
- var country = _defaultProps.default.country,
45
- lightDefaultProps = _objectWithoutProperties(_defaultProps.default, ["country"]);
46
-
47
- PhoneInputLite.defaultProps = lightDefaultProps;
48
+ PhoneInputLite.defaultProps = _defaultProps.default;
48
49
 
49
50
  function PhoneInputLite(props) {
50
51
  var ariaLabel = props['aria-label'],
51
52
  ariaLabelledBy = props['aria-labelledby'],
52
53
  ariaDescribedBy = props['aria-describedby'],
54
+ clearable = props.clearable,
53
55
  countries = props.countries,
54
56
  country = props.country,
55
57
  disabled = props.disabled,
@@ -67,45 +69,67 @@ function PhoneInputLite(props) {
67
69
  required = props.required,
68
70
  size = props.size,
69
71
  text = props.text,
70
- restProps = _objectWithoutProperties(props, ["aria-label", "aria-labelledby", "aria-describedby", "countries", "country", "disabled", "error", "id", "mapIsoToLabel", "maxDropdownHeight", "maxDropdownWidth", "name", "onTextChange", "onCountryChange", "overrides", "placeholder", "positive", "required", "size", "text"]);
72
+ restProps = _objectWithoutProperties(props, ["aria-label", "aria-labelledby", "aria-describedby", "clearable", "countries", "country", "disabled", "error", "id", "mapIsoToLabel", "maxDropdownHeight", "maxDropdownWidth", "name", "onTextChange", "onCountryChange", "overrides", "placeholder", "positive", "required", "size", "text"]);
71
73
 
72
74
  var inputRef = (0, _react.useRef)(null);
75
+ var baseDialCodeOverride = {
76
+ component: _styledComponents.StyledDialCode,
77
+ style: function style(_ref) {
78
+ var _ref$$theme = _ref.$theme,
79
+ direction = _ref$$theme.direction,
80
+ sizing = _ref$$theme.sizing;
81
+ var marginDir = direction === 'rtl' ? 'marginRight' : 'marginLeft';
82
+ return _defineProperty({}, marginDir, sizing.scale600);
83
+ },
84
+ props: {
85
+ children: country.dialCode
86
+ }
87
+ };
88
+ var mergedDialCodeOverride = (0, _overrides.mergeOverrides)({
89
+ DialCode: baseDialCodeOverride
90
+ }, {
91
+ DialCode: overrides.DialCode || {}
92
+ });
73
93
  var baseOverrides = {
74
94
  Input: {
75
- style: function style(_ref) {
76
- var sizing = _ref.$theme.sizing;
77
- return {
78
- paddingLeft: sizing.scale100
79
- };
95
+ style: function style(_ref3) {
96
+ var _ref3$$theme = _ref3.$theme,
97
+ direction = _ref3$$theme.direction,
98
+ sizing = _ref3$$theme.sizing;
99
+ var paddingDir = direction === 'rtl' ? 'paddingRight' : 'paddingLeft';
100
+ return _defineProperty({}, paddingDir, sizing.scale100);
80
101
  }
81
102
  },
82
- Before: {
83
- component: _countrySelect.default,
84
- props: {
85
- countries: countries,
86
- country: country,
87
- disabled: disabled,
88
- error: error,
89
- inputRef: inputRef,
90
- mapIsoToLabel: mapIsoToLabel,
91
- maxDropdownHeight: maxDropdownHeight,
92
- maxDropdownWidth: maxDropdownWidth,
93
- onCountryChange: onCountryChange,
94
- overrides: overrides,
95
- positive: positive,
96
- required: required,
97
- size: size
98
- }
99
- }
103
+ Before: mergedDialCodeOverride.DialCode
100
104
  };
101
105
 
102
- var _getOverrides = (0, _overrides.getOverrides)(overrides.Input, _index.Input),
106
+ var _getOverrides = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledPhoneInputRoot),
103
107
  _getOverrides2 = _slicedToArray(_getOverrides, 2),
104
- Input = _getOverrides2[0],
105
- inputProps = _getOverrides2[1];
108
+ Root = _getOverrides2[0],
109
+ rootProps = _getOverrides2[1];
110
+
111
+ var _getOverrides3 = (0, _overrides.getOverrides)(overrides.Input, _index.Input),
112
+ _getOverrides4 = _slicedToArray(_getOverrides3, 2),
113
+ Input = _getOverrides4[0],
114
+ inputProps = _getOverrides4[1];
106
115
 
107
116
  inputProps.overrides = (0, _overrides.mergeOverrides)(baseOverrides, inputProps.overrides);
108
- return /*#__PURE__*/_react.default.createElement(Input, _extends({
117
+ return /*#__PURE__*/_react.default.createElement(Root, _extends({}, rootProps, {
118
+ "data-baseweb": "phone-input"
119
+ }), /*#__PURE__*/_react.default.createElement(_countryPicker.default, {
120
+ country: country,
121
+ countries: countries,
122
+ disabled: disabled,
123
+ error: error,
124
+ mapIsoToLabel: mapIsoToLabel,
125
+ maxDropdownHeight: maxDropdownHeight,
126
+ maxDropdownWidth: maxDropdownWidth,
127
+ onCountryChange: onCountryChange,
128
+ overrides: overrides,
129
+ positive: positive,
130
+ required: required,
131
+ size: size
132
+ }), /*#__PURE__*/_react.default.createElement(Input, _extends({
109
133
  "aria-label": ariaLabel,
110
134
  "aria-labelledby": ariaLabelledBy,
111
135
  "aria-describedby": ariaDescribedBy,
@@ -122,6 +146,7 @@ function PhoneInputLite(props) {
122
146
  placeholder: placeholder,
123
147
  size: size,
124
148
  type: "text",
125
- value: text
126
- }, restProps, inputProps));
149
+ value: text,
150
+ clearable: clearable
151
+ }, restProps, inputProps)));
127
152
  }
@@ -6,21 +6,21 @@ LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  // @flow
8
8
  import React, { useRef } from 'react';
9
+ import CountryPicker from './country-picker.js';
10
+ import defaultProps from './default-props.js';
11
+ import { StyledPhoneInputRoot, StyledDialCode } from './styled-components.js';
9
12
  import { Input as DefaultInput } from '../input/index.js';
10
- import CountrySelect from './country-select.js';
11
13
  import { getOverrides, mergeOverrides } from '../helpers/overrides.js';
12
- import defaultProps from './default-props.js';
13
14
  import type { LitePropsT } from './types.js';
14
15
 
15
- const { country, ...lightDefaultProps } = defaultProps;
16
-
17
- PhoneInputLite.defaultProps = lightDefaultProps;
16
+ PhoneInputLite.defaultProps = defaultProps;
18
17
 
19
18
  export default function PhoneInputLite(props: LitePropsT) {
20
19
  const {
21
20
  'aria-label': ariaLabel,
22
21
  'aria-labelledby': ariaLabelledBy,
23
22
  'aria-describedby': ariaDescribedBy,
23
+ clearable,
24
24
  countries,
25
25
  country,
26
26
  disabled,
@@ -41,53 +41,75 @@ export default function PhoneInputLite(props: LitePropsT) {
41
41
  ...restProps
42
42
  } = props;
43
43
  const inputRef = useRef(null);
44
+
45
+ const baseDialCodeOverride = {
46
+ component: StyledDialCode,
47
+ style: ({ $theme: { direction, sizing } }) => {
48
+ const marginDir: string = direction === 'rtl' ? 'marginRight' : 'marginLeft';
49
+ return {
50
+ [marginDir]: sizing.scale600,
51
+ };
52
+ },
53
+ props: { children: country.dialCode },
54
+ };
55
+ const mergedDialCodeOverride = mergeOverrides(
56
+ { DialCode: baseDialCodeOverride },
57
+ { DialCode: overrides.DialCode || {} }
58
+ );
59
+
44
60
  const baseOverrides = {
45
61
  Input: {
46
- style: ({ $theme: { sizing } }) => ({ paddingLeft: sizing.scale100 }),
47
- },
48
- Before: {
49
- component: CountrySelect,
50
- props: {
51
- countries,
52
- country,
53
- disabled,
54
- error,
55
- inputRef,
56
- mapIsoToLabel,
57
- maxDropdownHeight,
58
- maxDropdownWidth,
59
- onCountryChange,
60
- overrides,
61
- positive,
62
- required,
63
- size,
62
+ style: ({ $theme: { direction, sizing } }) => {
63
+ const paddingDir: string = direction === 'rtl' ? 'paddingRight' : 'paddingLeft';
64
+ return {
65
+ [paddingDir]: sizing.scale100,
66
+ };
64
67
  },
65
68
  },
69
+ Before: mergedDialCodeOverride.DialCode,
66
70
  };
71
+ const [Root, rootProps] = getOverrides(overrides.Root, StyledPhoneInputRoot);
67
72
  const [Input, inputProps] = getOverrides(overrides.Input, DefaultInput);
68
73
  inputProps.overrides = mergeOverrides(baseOverrides, inputProps.overrides);
69
74
  return (
70
- <Input
71
- aria-label={ariaLabel}
72
- aria-labelledby={ariaLabelledBy}
73
- aria-describedby={ariaDescribedBy}
74
- autoComplete="tel-national"
75
- data-baseweb="phone-input"
76
- disabled={disabled}
77
- error={error}
78
- id={id}
79
- inputMode="tel"
80
- inputRef={inputRef}
81
- name={name}
82
- onChange={onTextChange}
83
- positive={positive}
84
- placeholder={placeholder}
85
- size={size}
86
- type="text"
87
- value={text}
88
- {...restProps}
89
- {...inputProps}
90
- />
75
+ <Root {...rootProps} data-baseweb="phone-input">
76
+ <CountryPicker
77
+ country={country}
78
+ countries={countries}
79
+ disabled={disabled}
80
+ error={error}
81
+ mapIsoToLabel={mapIsoToLabel}
82
+ maxDropdownHeight={maxDropdownHeight}
83
+ maxDropdownWidth={maxDropdownWidth}
84
+ onCountryChange={onCountryChange}
85
+ overrides={overrides}
86
+ positive={positive}
87
+ required={required}
88
+ size={size}
89
+ />
90
+ <Input
91
+ aria-label={ariaLabel}
92
+ aria-labelledby={ariaLabelledBy}
93
+ aria-describedby={ariaDescribedBy}
94
+ autoComplete="tel-national"
95
+ data-baseweb="phone-input"
96
+ disabled={disabled}
97
+ error={error}
98
+ id={id}
99
+ inputMode="tel"
100
+ inputRef={inputRef}
101
+ name={name}
102
+ onChange={onTextChange}
103
+ positive={positive}
104
+ placeholder={placeholder}
105
+ size={size}
106
+ type="text"
107
+ value={text}
108
+ clearable={clearable}
109
+ {...restProps}
110
+ {...inputProps}
111
+ />
112
+ </Root>
91
113
  );
92
114
  }
93
115