baseui 11.0.1 → 11.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/a11y/index.d.ts +1 -1
  2. package/accordion/index.d.ts +25 -28
  3. package/app-nav-bar/app-nav-bar.js +33 -40
  4. package/app-nav-bar/app-nav-bar.js.flow +46 -62
  5. package/app-nav-bar/index.d.ts +9 -8
  6. package/app-nav-bar/styled-components.js +49 -29
  7. package/app-nav-bar/styled-components.js.flow +25 -8
  8. package/app-nav-bar/types.js.flow +2 -0
  9. package/aspect-ratio-box/index.d.ts +2 -4
  10. package/avatar/index.d.ts +6 -12
  11. package/badge/badge.js +109 -0
  12. package/badge/badge.js.flow +91 -0
  13. package/badge/constants.js +54 -0
  14. package/badge/constants.js.flow +52 -0
  15. package/badge/hint-dot.js +96 -0
  16. package/badge/hint-dot.js.flow +68 -0
  17. package/badge/index.d.ts +97 -0
  18. package/badge/index.js +80 -0
  19. package/badge/index.js.flow +20 -0
  20. package/badge/notification-circle.js +103 -0
  21. package/badge/notification-circle.js.flow +81 -0
  22. package/badge/package.json +4 -0
  23. package/badge/styled-components.js +242 -0
  24. package/badge/styled-components.js.flow +325 -0
  25. package/badge/types.js +11 -0
  26. package/badge/types.js.flow +59 -0
  27. package/badge/utils.js +33 -0
  28. package/badge/utils.js.flow +23 -0
  29. package/banner/banner.js +283 -0
  30. package/banner/banner.js.flow +253 -0
  31. package/banner/constants.js +35 -0
  32. package/banner/constants.js.flow +33 -0
  33. package/banner/index.d.ts +75 -0
  34. package/banner/index.js +44 -0
  35. package/banner/index.js.flow +16 -0
  36. package/banner/package.json +4 -0
  37. package/banner/styled-components.js +131 -0
  38. package/banner/styled-components.js.flow +119 -0
  39. package/banner/types.js +11 -0
  40. package/banner/types.js.flow +66 -0
  41. package/block/index.d.ts +4 -4
  42. package/breadcrumbs/breadcrumbs.js +5 -1
  43. package/breadcrumbs/breadcrumbs.js.flow +2 -2
  44. package/breadcrumbs/index.d.ts +5 -5
  45. package/button/button.js +2 -1
  46. package/button/button.js.flow +1 -0
  47. package/button/index.d.ts +19 -29
  48. package/button-group/index.d.ts +18 -24
  49. package/card/index.d.ts +16 -14
  50. package/checkbox/index.d.ts +17 -21
  51. package/combobox/index.d.ts +7 -11
  52. package/data-table/index.d.ts +7 -10
  53. package/datepicker/calendar.js +16 -11
  54. package/datepicker/calendar.js.flow +12 -9
  55. package/datepicker/datepicker.js +58 -58
  56. package/datepicker/datepicker.js.flow +51 -34
  57. package/datepicker/index.d.ts +42 -63
  58. package/datepicker/stateful-calendar.js +6 -1
  59. package/datepicker/stateful-calendar.js.flow +8 -1
  60. package/datepicker/stateful-container.js +23 -2
  61. package/datepicker/stateful-container.js.flow +17 -4
  62. package/datepicker/stateful-datepicker.js +6 -1
  63. package/datepicker/stateful-datepicker.js.flow +7 -1
  64. package/datepicker/types.js.flow +21 -43
  65. package/datepicker/utils/date-helpers.js +1 -1
  66. package/datepicker/utils/date-helpers.js.flow +1 -1
  67. package/dnd-list/index.d.ts +22 -35
  68. package/drawer/index.d.ts +22 -27
  69. package/es/app-nav-bar/app-nav-bar.js +9 -19
  70. package/es/app-nav-bar/styled-components.js +32 -13
  71. package/es/badge/badge.js +70 -0
  72. package/es/badge/constants.js +42 -0
  73. package/es/badge/hint-dot.js +55 -0
  74. package/es/badge/index.js +11 -0
  75. package/es/badge/notification-circle.js +65 -0
  76. package/es/badge/styled-components.js +296 -0
  77. package/es/badge/types.js +8 -0
  78. package/es/badge/utils.js +17 -0
  79. package/es/banner/banner.js +213 -0
  80. package/es/banner/constants.js +24 -0
  81. package/es/banner/index.js +9 -0
  82. package/es/banner/styled-components.js +122 -0
  83. package/es/banner/types.js +8 -0
  84. package/es/breadcrumbs/breadcrumbs.js +5 -1
  85. package/es/button/button.js +1 -0
  86. package/es/datepicker/calendar.js +15 -10
  87. package/es/datepicker/datepicker.js +52 -52
  88. package/es/datepicker/stateful-calendar.js +6 -1
  89. package/es/datepicker/stateful-container.js +22 -2
  90. package/es/datepicker/stateful-datepicker.js +6 -1
  91. package/es/datepicker/utils/date-helpers.js +1 -1
  92. package/es/helper/helper-steps.js +3 -1
  93. package/es/input/base-input.js +18 -11
  94. package/es/input/input.js +15 -10
  95. package/es/input/masked-input.js +5 -2
  96. package/es/input/utils.js +4 -2
  97. package/es/locale/tr_TR.js +115 -0
  98. package/es/notification/notification.js +16 -1
  99. package/es/payment-card/custom-cards.config.js +22 -0
  100. package/es/payment-card/icons/uatp.js +52 -0
  101. package/es/payment-card/payment-card.js +8 -3
  102. package/es/popover/popover.js +2 -1
  103. package/es/popover/stateful-container.js +2 -0
  104. package/es/popover/styled-components.js +2 -1
  105. package/es/progress-steps/numbered-step.js +2 -2
  106. package/es/select/select-component.js +48 -23
  107. package/es/select/utils/default-filter-options.js +1 -1
  108. package/es/snackbar/snackbar-context.js +1 -1
  109. package/es/table-semantic/styled-components.js +14 -0
  110. package/es/table-semantic/table-builder.js +12 -5
  111. package/es/textarea/textarea.js +15 -9
  112. package/es/themes/dark-theme/color-component-tokens.js +8 -0
  113. package/es/themes/light-theme/color-component-tokens.js +8 -0
  114. package/es/tree-view/tree-label.js +9 -1
  115. package/esm/app-nav-bar/app-nav-bar.js +32 -38
  116. package/esm/app-nav-bar/styled-components.js +46 -28
  117. package/esm/badge/badge.js +97 -0
  118. package/esm/badge/constants.js +42 -0
  119. package/esm/badge/hint-dot.js +83 -0
  120. package/esm/badge/index.js +11 -0
  121. package/esm/badge/notification-circle.js +91 -0
  122. package/esm/badge/styled-components.js +235 -0
  123. package/esm/badge/types.js +8 -0
  124. package/esm/badge/utils.js +17 -0
  125. package/esm/banner/banner.js +271 -0
  126. package/esm/banner/constants.js +24 -0
  127. package/esm/banner/index.js +9 -0
  128. package/esm/banner/styled-components.js +113 -0
  129. package/esm/banner/types.js +8 -0
  130. package/esm/breadcrumbs/breadcrumbs.js +5 -1
  131. package/esm/button/button.js +2 -1
  132. package/esm/datepicker/calendar.js +16 -11
  133. package/esm/datepicker/datepicker.js +58 -58
  134. package/esm/datepicker/stateful-calendar.js +6 -1
  135. package/esm/datepicker/stateful-container.js +23 -2
  136. package/esm/datepicker/stateful-datepicker.js +6 -1
  137. package/esm/datepicker/utils/date-helpers.js +1 -1
  138. package/esm/helper/helper-steps.js +3 -1
  139. package/esm/input/base-input.js +18 -11
  140. package/esm/input/input.js +15 -10
  141. package/esm/input/masked-input.js +6 -3
  142. package/esm/input/utils.js +4 -2
  143. package/esm/locale/tr_TR.js +115 -0
  144. package/esm/notification/notification.js +17 -1
  145. package/esm/payment-card/custom-cards.config.js +22 -0
  146. package/esm/payment-card/icons/uatp.js +53 -0
  147. package/esm/payment-card/payment-card.js +9 -7
  148. package/esm/popover/popover.js +2 -1
  149. package/esm/popover/stateful-container.js +2 -0
  150. package/esm/popover/styled-components.js +3 -2
  151. package/esm/progress-steps/numbered-step.js +2 -2
  152. package/esm/select/select-component.js +85 -59
  153. package/esm/select/utils/default-filter-options.js +1 -1
  154. package/esm/snackbar/snackbar-context.js +1 -1
  155. package/esm/table-semantic/styled-components.js +31 -18
  156. package/esm/table-semantic/table-builder.js +34 -23
  157. package/esm/textarea/textarea.js +15 -9
  158. package/esm/themes/dark-theme/color-component-tokens.js +8 -0
  159. package/esm/themes/light-theme/color-component-tokens.js +8 -0
  160. package/esm/tree-view/tree-label.js +10 -2
  161. package/file-uploader/index.d.ts +11 -11
  162. package/flex-grid/index.d.ts +3 -3
  163. package/form-control/index.d.ts +7 -19
  164. package/header-navigation/index.d.ts +8 -9
  165. package/heading/index.d.ts +3 -4
  166. package/helper/helper-steps.js +19 -13
  167. package/helper/helper-steps.js.flow +3 -1
  168. package/helper/index.d.ts +7 -7
  169. package/helpers/base-provider.d.ts +16 -0
  170. package/helpers/overrides.d.ts +23 -0
  171. package/icon/index.d.ts +32 -32
  172. package/index.d.ts +34 -114
  173. package/input/base-input.js +18 -11
  174. package/input/base-input.js.flow +18 -6
  175. package/input/index.d.ts +29 -32
  176. package/input/input.js +15 -10
  177. package/input/input.js.flow +10 -5
  178. package/input/masked-input.js +6 -3
  179. package/input/masked-input.js.flow +3 -0
  180. package/input/types.js.flow +4 -0
  181. package/input/utils.js +4 -2
  182. package/input/utils.js.flow +2 -1
  183. package/layer/index.d.ts +6 -11
  184. package/layout-grid/index.d.ts +25 -7
  185. package/link/index.d.ts +2 -2
  186. package/list/index.d.ts +26 -31
  187. package/{locale.ts → locale/index.d.ts} +8 -0
  188. package/locale/tr_TR.js +123 -0
  189. package/locale/tr_TR.js.flow +124 -0
  190. package/map-marker/index.d.ts +41 -47
  191. package/menu/index.d.ts +27 -37
  192. package/modal/index.d.ts +28 -38
  193. package/notification/index.d.ts +2 -3
  194. package/notification/notification.js +18 -1
  195. package/notification/notification.js.flow +15 -1
  196. package/overrides.ts +2 -22
  197. package/package.json +26 -17
  198. package/pagination/index.d.ts +22 -26
  199. package/payment-card/custom-cards.config.js +30 -0
  200. package/payment-card/custom-cards.config.js.flow +29 -0
  201. package/payment-card/icons/uatp.js +67 -0
  202. package/payment-card/icons/uatp.js.flow +62 -0
  203. package/payment-card/index.d.ts +8 -8
  204. package/payment-card/payment-card.js +12 -7
  205. package/payment-card/payment-card.js.flow +12 -0
  206. package/phone-input/index.d.ts +261 -269
  207. package/pin-code/index.d.ts +11 -18
  208. package/popover/index.d.ts +39 -55
  209. package/popover/popover.js +2 -1
  210. package/popover/popover.js.flow +2 -1
  211. package/popover/stateful-container.js +2 -0
  212. package/popover/stateful-container.js.flow +2 -0
  213. package/popover/styled-components.js +3 -2
  214. package/popover/styled-components.js.flow +2 -1
  215. package/popover/types.js.flow +1 -0
  216. package/progress-bar/index.d.ts +11 -12
  217. package/progress-steps/index.d.ts +16 -16
  218. package/progress-steps/numbered-step.js.flow +2 -2
  219. package/radio/index.d.ts +12 -15
  220. package/rating/index.d.ts +9 -12
  221. package/select/index.d.ts +34 -36
  222. package/select/select-component.js +82 -56
  223. package/select/select-component.js.flow +46 -34
  224. package/select/types.js.flow +1 -0
  225. package/select/utils/default-filter-options.js +1 -1
  226. package/select/utils/default-filter-options.js.flow +1 -1
  227. package/side-navigation/index.d.ts +11 -13
  228. package/skeleton/index.d.ts +1 -1
  229. package/slider/index.d.ts +17 -26
  230. package/snackbar/index.d.ts +8 -8
  231. package/snackbar/snackbar-context.js +1 -1
  232. package/snackbar/snackbar-context.js.flow +1 -1
  233. package/spinner/index.d.ts +4 -3
  234. package/styles/index.d.ts +82 -2
  235. package/table/index.d.ts +16 -16
  236. package/table-grid/index.d.ts +6 -8
  237. package/table-semantic/index.d.ts +26 -32
  238. package/table-semantic/styled-components.js +33 -19
  239. package/table-semantic/styled-components.js.flow +12 -0
  240. package/table-semantic/table-builder.js +38 -22
  241. package/table-semantic/table-builder.js.flow +32 -17
  242. package/table-semantic/types.js.flow +1 -0
  243. package/tabs/index.d.ts +20 -23
  244. package/tabs-motion/index.d.ts +23 -23
  245. package/tag/index.d.ts +14 -18
  246. package/tag/types.js.flow +1 -1
  247. package/textarea/index.d.ts +11 -14
  248. package/textarea/textarea.js +15 -9
  249. package/textarea/textarea.js.flow +11 -5
  250. package/textarea/types.js.flow +1 -0
  251. package/theme.ts +36 -777
  252. package/themes/dark-theme/color-component-tokens.js +8 -0
  253. package/themes/dark-theme/color-component-tokens.js.flow +9 -0
  254. package/themes/index.d.ts +765 -0
  255. package/themes/light-theme/color-component-tokens.js +8 -0
  256. package/themes/light-theme/color-component-tokens.js.flow +9 -0
  257. package/themes/types.js.flow +9 -0
  258. package/timepicker/index.d.ts +5 -8
  259. package/timezonepicker/index.d.ts +5 -8
  260. package/toast/index.d.ts +26 -40
  261. package/tokens/index.d.ts +1 -1
  262. package/tooltip/index.d.ts +7 -9
  263. package/tree-view/index.d.ts +15 -19
  264. package/tree-view/tree-label.js +10 -2
  265. package/tree-view/tree-label.js.flow +4 -4
  266. package/typography/index.d.ts +37 -37
@@ -64,6 +64,7 @@ class BaseInput<T: HTMLInputElement | HTMLTextAreaElement> extends React.Compone
64
64
  role: null,
65
65
  size: SIZE.default,
66
66
  type: 'text',
67
+ readOnly: false,
67
68
  };
68
69
 
69
70
  inputRef = this.props.inputRef || React.createRef<T>();
@@ -117,7 +118,12 @@ class BaseInput<T: HTMLInputElement | HTMLTextAreaElement> extends React.Compone
117
118
  }
118
119
 
119
120
  onInputKeyDown = (e: KeyboardEvent) => {
120
- if (this.props.clearOnEscape && e.key === 'Escape' && this.inputRef.current) {
121
+ if (
122
+ this.props.clearOnEscape &&
123
+ e.key === 'Escape' &&
124
+ this.inputRef.current &&
125
+ !this.props.readOnly
126
+ ) {
121
127
  this.clearValue();
122
128
  // prevent event from closing modal or doing something unexpected
123
129
  e.stopPropagation();
@@ -131,13 +137,17 @@ class BaseInput<T: HTMLInputElement | HTMLTextAreaElement> extends React.Compone
131
137
  };
132
138
 
133
139
  onFocus = (e: SyntheticFocusEvent<T>) => {
134
- this.setState({ isFocused: true });
135
- this.props.onFocus(e);
140
+ if (!this.props.readOnly) {
141
+ this.setState({ isFocused: true });
142
+ this.props.onFocus(e);
143
+ }
136
144
  };
137
145
 
138
146
  onBlur = (e: SyntheticFocusEvent<T>) => {
139
- this.setState({ isFocused: false });
140
- this.props.onBlur(e);
147
+ if (!this.props.readOnly) {
148
+ this.setState({ isFocused: false });
149
+ this.props.onBlur(e);
150
+ }
141
151
  };
142
152
 
143
153
  getInputType() {
@@ -219,9 +229,10 @@ class BaseInput<T: HTMLInputElement | HTMLTextAreaElement> extends React.Compone
219
229
  };
220
230
 
221
231
  renderClear() {
222
- const { clearable, value, disabled, overrides = {} } = this.props;
232
+ const { clearable, value, disabled, readOnly, overrides = {} } = this.props;
223
233
  if (
224
234
  disabled ||
235
+ readOnly ||
225
236
  !clearable ||
226
237
  value == null ||
227
238
  (typeof value === 'string' && value.length === 0)
@@ -320,6 +331,7 @@ class BaseInput<T: HTMLInputElement | HTMLTextAreaElement> extends React.Compone
320
331
  aria-required={this.props.required}
321
332
  autoComplete={autoComplete}
322
333
  disabled={this.props.disabled}
334
+ readOnly={this.props.readOnly}
323
335
  id={this.props.id}
324
336
  inputMode={this.props.inputMode}
325
337
  maxLength={this.props.maxLength}
package/input/index.d.ts CHANGED
@@ -2,30 +2,30 @@ import * as React from 'react';
2
2
  import { StyletronComponent } from 'styletron-react';
3
3
  import { Override } from '../overrides';
4
4
 
5
- export interface STATE_CHANGE_TYPE {
5
+ export declare const STATE_CHANGE_TYPE: {
6
6
  change: 'change';
7
- }
8
- export interface ADJOINED {
7
+ };
8
+ export declare const ADJOINED: {
9
9
  none: 'none';
10
10
  left: 'left';
11
11
  right: 'right';
12
12
  both: 'both';
13
- }
14
- export interface SIZE {
13
+ };
14
+ export declare const SIZE: {
15
15
  mini: 'mini';
16
16
  default: 'default';
17
17
  compact: 'compact';
18
18
  large: 'large';
19
- }
19
+ };
20
20
 
21
- export interface CUSTOM_INPUT_TYPE {
21
+ export declare const CUSTOM_INPUT_TYPE: {
22
22
  textarea: 'textarea';
23
- }
23
+ };
24
24
 
25
- export interface ENHANCER_POSITION {
25
+ export declare const ENHANCER_POSITION: {
26
26
  start: 'start';
27
27
  end: 'end';
28
- }
28
+ };
29
29
 
30
30
  export interface BaseInputOverrides<T> {
31
31
  InputContainer?: Override<T>;
@@ -39,7 +39,7 @@ export interface BaseInputProps<T> {
39
39
  'aria-label'?: string;
40
40
  'aria-labelledby'?: string;
41
41
  'aria-describedby'?: string;
42
- adjoined?: ADJOINED[keyof ADJOINED];
42
+ adjoined?: typeof ADJOINED[keyof typeof ADJOINED];
43
43
  autoComplete?: string;
44
44
  autoFocus?: boolean;
45
45
  clearable?: boolean;
@@ -63,13 +63,14 @@ export interface BaseInputProps<T> {
63
63
  overrides?: BaseInputOverrides<SharedProps>;
64
64
  placeholder?: string;
65
65
  required?: boolean;
66
- size?: SIZE[keyof SIZE];
66
+ size?: typeof SIZE[keyof typeof SIZE];
67
67
  type?: string;
68
68
  value?: string | number;
69
69
  rows?: number;
70
70
  min?: number;
71
71
  max?: number;
72
72
  step?: number | 'any';
73
+ readOnly?: boolean;
73
74
  }
74
75
 
75
76
  export interface State {
@@ -90,6 +91,8 @@ export type InputOverrides = BaseInputOverrides<SharedProps> & {
90
91
  export type SharedProps = {
91
92
  /** Renders UI in 'focus' state */
92
93
  $isFocused: boolean;
94
+ /** Renders UI in 'readOnly' state */
95
+ $isReadOnly: boolean;
93
96
  /** Renders UI in 'disabled' state */
94
97
  $disabled: boolean;
95
98
  /** Renders UI in 'error' state */
@@ -97,12 +100,12 @@ export type SharedProps = {
97
100
  /** Renders UI in 'positive' state */
98
101
  $positive: boolean;
99
102
  /** Defines styles for inputs that are grouped with other controls. */
100
- $adjoined: keyof ADJOINED;
103
+ $adjoined: typeof ADJOINED[keyof typeof ADJOINED];
101
104
  /** Renders UI in provided size. */
102
- $size: keyof SIZE;
105
+ $size: typeof SIZE[keyof typeof SIZE];
103
106
  /** Renders UI in 'required' state */
104
107
  $required: boolean;
105
- $position: keyof ENHANCER_POSITION;
108
+ $position: typeof ENHANCER_POSITION[keyof typeof ENHANCER_POSITION];
106
109
  /** Defines if has a clearable or MaskToggleButton at the end */
107
110
  $hasIconTrailing: boolean;
108
111
  };
@@ -133,13 +136,13 @@ export interface MaskedInputProps extends InputProps {
133
136
  maskChar?: string;
134
137
  }
135
138
 
136
- export const MaskedInput: React.FC<MaskedInputProps>;
139
+ export declare const MaskedInput: React.FC<MaskedInputProps>;
137
140
 
138
141
  export interface StatefulContainerProps {
139
142
  children?: React.ReactNode;
140
143
  initialState?: State;
141
144
  stateReducer?: (
142
- stateType: STATE_CHANGE_TYPE[keyof STATE_CHANGE_TYPE],
145
+ stateType: typeof STATE_CHANGE_TYPE[keyof typeof STATE_CHANGE_TYPE],
143
146
  nextState: State,
144
147
  currentState: State
145
148
  ) => State;
@@ -148,18 +151,12 @@ export interface StatefulContainerProps {
148
151
 
149
152
  export type StatefulInputProps = InputProps & StatefulContainerProps & { children?: never };
150
153
 
151
- export const StatefulInput: React.FC<StatefulInputProps>;
152
- export const StatefulContainer: React.FC<StatefulContainerProps>;
153
-
154
- export const StyledRoot: StyletronComponent<any>;
155
- export const StyledInputEnhancer: StyletronComponent<any>;
156
- export const StyledStartEnhancer: StyletronComponent<any>;
157
- export const StyledEndEnhancer: StyletronComponent<any>;
158
- export const StyledInputContainer: StyletronComponent<any>;
159
- export const StyledInput: StyletronComponent<any>;
160
-
161
- export const STATE_CHANGE_TYPE: STATE_CHANGE_TYPE;
162
- export const CUSTOM_INPUT_TYPE: CUSTOM_INPUT_TYPE;
163
- export const ADJOINED: ADJOINED;
164
- export const SIZE: SIZE;
165
- export const ENHANCER_POSITION: ENHANCER_POSITION;
154
+ export declare const StatefulInput: React.FC<StatefulInputProps>;
155
+ export declare const StatefulContainer: React.FC<StatefulContainerProps>;
156
+
157
+ export declare const StyledRoot: StyletronComponent<any>;
158
+ export declare const StyledInputEnhancer: StyletronComponent<any>;
159
+ export declare const StyledStartEnhancer: StyletronComponent<any>;
160
+ export declare const StyledEndEnhancer: StyletronComponent<any>;
161
+ export declare const StyledInputContainer: StyletronComponent<any>;
162
+ export declare const StyledInput: StyletronComponent<any>;
package/input/input.js CHANGED
@@ -82,23 +82,27 @@ var Input = /*#__PURE__*/function (_React$Component) {
82
82
  _this = _super.call.apply(_super, [this].concat(args));
83
83
 
84
84
  _defineProperty(_assertThisInitialized(_this), "state", {
85
- isFocused: _this.props.autoFocus || false
85
+ isFocused: _this.props.autoFocus && !_this.props.readOnly || false
86
86
  });
87
87
 
88
88
  _defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
89
- _this.setState({
90
- isFocused: true
91
- });
89
+ if (!_this.props.readOnly) {
90
+ _this.setState({
91
+ isFocused: true
92
+ });
92
93
 
93
- _this.props.onFocus(e);
94
+ _this.props.onFocus(e);
95
+ }
94
96
  });
95
97
 
96
98
  _defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
97
- _this.setState({
98
- isFocused: false
99
- });
99
+ if (!_this.props.readOnly) {
100
+ _this.setState({
101
+ isFocused: false
102
+ });
100
103
 
101
- _this.props.onBlur(e);
104
+ _this.props.onBlur(e);
105
+ }
102
106
  });
103
107
 
104
108
  return _this;
@@ -175,7 +179,8 @@ _defineProperty(Input, "defaultProps", {
175
179
  startEnhancer: null,
176
180
  endEnhancer: null,
177
181
  clearable: false,
178
- type: 'text'
182
+ type: 'text',
183
+ readOnly: false
179
184
  });
180
185
 
181
186
  function getAdjoinedProp(startEnhancer, endEnhancer) {
@@ -28,6 +28,7 @@ class Input extends React.Component<InputPropsT, InternalStateT> {
28
28
  endEnhancer: null,
29
29
  clearable: false,
30
30
  type: 'text',
31
+ readOnly: false,
31
32
  };
32
33
 
33
34
  /**
@@ -35,17 +36,21 @@ class Input extends React.Component<InputPropsT, InternalStateT> {
35
36
  * customers shouldn't have to manage themselves, such as input's focus state.
36
37
  */
37
38
  state = {
38
- isFocused: this.props.autoFocus || false,
39
+ isFocused: (this.props.autoFocus && !this.props.readOnly) || false,
39
40
  };
40
41
 
41
42
  onFocus = (e: SyntheticFocusEvent<HTMLInputElement>) => {
42
- this.setState({ isFocused: true });
43
- this.props.onFocus(e);
43
+ if (!this.props.readOnly) {
44
+ this.setState({ isFocused: true });
45
+ this.props.onFocus(e);
46
+ }
44
47
  };
45
48
 
46
49
  onBlur = (e: SyntheticFocusEvent<HTMLInputElement>) => {
47
- this.setState({ isFocused: false });
48
- this.props.onBlur(e);
50
+ if (!this.props.readOnly) {
51
+ this.setState({ isFocused: false });
52
+ this.props.onBlur(e);
53
+ }
49
54
  };
50
55
 
51
56
  render() {
@@ -43,14 +43,16 @@ var MaskOverride = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
43
43
  onBlur = _ref.onBlur,
44
44
  value = _ref.value,
45
45
  disabled = _ref.disabled,
46
- restProps = _objectWithoutProperties(_ref, ["startEnhancer", "endEnhancer", "error", "positive", "onChange", "onFocus", "onBlur", "value", "disabled"]);
46
+ readOnly = _ref.readOnly,
47
+ restProps = _objectWithoutProperties(_ref, ["startEnhancer", "endEnhancer", "error", "positive", "onChange", "onFocus", "onBlur", "value", "disabled", "readOnly"]);
47
48
 
48
49
  return /*#__PURE__*/React.createElement(_reactInputMask.default, _extends({
49
50
  onChange: onChange,
50
51
  onFocus: onFocus,
51
52
  onBlur: onBlur,
52
53
  value: value,
53
- disabled: disabled
54
+ disabled: disabled,
55
+ readOnly: readOnly
54
56
  }, restProps), function (props) {
55
57
  return /*#__PURE__*/React.createElement(_styledComponents.Input, _extends({
56
58
  ref: ref,
@@ -58,7 +60,8 @@ var MaskOverride = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
58
60
  onFocus: onFocus,
59
61
  onBlur: onBlur,
60
62
  value: value,
61
- disabled: disabled
63
+ disabled: disabled,
64
+ readOnly: readOnly
62
65
  }, props));
63
66
  });
64
67
  });
@@ -28,6 +28,7 @@ const MaskOverride = React.forwardRef<MaskedInputPropsT, HTMLInputElement>(
28
28
  onBlur,
29
29
  value,
30
30
  disabled,
31
+ readOnly,
31
32
  ...restProps
32
33
  }: MaskedInputPropsT,
33
34
  ref
@@ -39,6 +40,7 @@ const MaskOverride = React.forwardRef<MaskedInputPropsT, HTMLInputElement>(
39
40
  onBlur={onBlur}
40
41
  value={value}
41
42
  disabled={disabled}
43
+ readOnly={readOnly}
42
44
  {...restProps}
43
45
  >
44
46
  {(props) => (
@@ -49,6 +51,7 @@ const MaskOverride = React.forwardRef<MaskedInputPropsT, HTMLInputElement>(
49
51
  onBlur={onBlur}
50
52
  value={value}
51
53
  disabled={disabled}
54
+ readOnly={readOnly}
52
55
  {...props}
53
56
  />
54
57
  )}
@@ -38,6 +38,8 @@ export type StateReducerT = (
38
38
  export type SharedPropsT = {|
39
39
  /** Renders UI in 'focus' state */
40
40
  $isFocused: boolean,
41
+ /** Renders UI in 'readOnly' state */
42
+ $isReadOnly: boolean,
41
43
  /** Renders UI in 'disabled' state */
42
44
  $disabled: boolean,
43
45
  /** Renders UI in 'error' state */
@@ -141,6 +143,8 @@ export type BaseInputPropsT<T> = {|
141
143
  max?: number,
142
144
  /** step value when used as input type=number */
143
145
  step?: number | 'any',
146
+ /** Renders component in 'readOnly' state. */
147
+ readOnly?: boolean,
144
148
  |};
145
149
 
146
150
  export type InputPropsT = {|
package/input/utils.js CHANGED
@@ -17,7 +17,8 @@ function getSharedProps(props, state) {
17
17
  positive = props.positive,
18
18
  adjoined = props.adjoined,
19
19
  size = props.size,
20
- required = props.required;
20
+ required = props.required,
21
+ readOnly = props.readOnly;
21
22
  var isFocused = state.isFocused;
22
23
  return {
23
24
  $isFocused: isFocused,
@@ -26,6 +27,7 @@ function getSharedProps(props, state) {
26
27
  $positive: positive,
27
28
  $adjoined: adjoined,
28
29
  $size: size,
29
- $required: required
30
+ $required: required,
31
+ $isReadOnly: readOnly
30
32
  };
31
33
  }
@@ -11,7 +11,7 @@ export function getSharedProps<T>(
11
11
  props: BaseInputPropsT<T> | InputPropsT,
12
12
  state: InternalStateT
13
13
  ): $Shape<SharedPropsT> {
14
- const { disabled, error, positive, adjoined, size, required } = props;
14
+ const { disabled, error, positive, adjoined, size, required, readOnly } = props;
15
15
  const { isFocused } = state;
16
16
  return {
17
17
  $isFocused: isFocused,
@@ -21,6 +21,7 @@ export function getSharedProps<T>(
21
21
  $adjoined: adjoined,
22
22
  $size: size,
23
23
  $required: required,
24
+ $isReadOnly: readOnly,
24
25
  };
25
26
  }
26
27
 
package/layer/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
 
3
- export interface TETHER_PLACEMENT {
3
+ export declare const TETHER_PLACEMENT: {
4
4
  auto: 'auto';
5
5
  topLeft: 'topLeft';
6
6
  top: 'top';
@@ -14,9 +14,9 @@ export interface TETHER_PLACEMENT {
14
14
  leftBottom: 'leftBottom';
15
15
  left: 'left';
16
16
  leftTop: 'leftTop';
17
- }
17
+ };
18
18
 
19
- export type TetherPlacement = TETHER_PLACEMENT;
19
+ export type TetherPlacement = typeof TETHER_PLACEMENT[keyof typeof TETHER_PLACEMENT];
20
20
 
21
21
  export interface NormalizedOffset {
22
22
  top: number;
@@ -46,11 +46,8 @@ export interface TetherProps {
46
46
  arrowRef?: React.Ref<HTMLElement>;
47
47
  popperRef?: React.Ref<HTMLElement>;
48
48
  children: React.ReactNode;
49
- onPopperUpdate?: (
50
- offsets: NormalizedOffsets,
51
- popper: PopperDataObject,
52
- ) => any;
53
- placement?: TETHER_PLACEMENT[keyof TETHER_PLACEMENT];
49
+ onPopperUpdate?: (offsets: NormalizedOffsets, popper: PopperDataObject) => any;
50
+ placement?: typeof TETHER_PLACEMENT[keyof typeof TETHER_PLACEMENT];
54
51
  popperOptions?: any;
55
52
  }
56
53
  export interface TetherState {
@@ -81,6 +78,4 @@ export interface LayerProps {
81
78
  export class LayersManager extends React.Component<LayersManagerProps> {
82
79
  host: React.Ref<HTMLElement>;
83
80
  }
84
- export const Layer: React.FC<LayerProps>;
85
-
86
- export const TETHER_PLACEMENT: TETHER_PLACEMENT;
81
+ export declare const Layer: React.FC<LayerProps>;
@@ -1,7 +1,25 @@
1
1
  import * as React from 'react';
2
- import {StyletronComponent} from 'styletron-react';
3
- import {CSSLengthUnitT} from '../theme';
4
- import {Override} from '../overrides';
2
+ import { StyletronComponent } from 'styletron-react';
3
+ import { Override } from '../overrides';
4
+
5
+ export type CSSLengthUnitT =
6
+ | 'cm'
7
+ | 'mm'
8
+ | 'Q'
9
+ | 'in'
10
+ | 'pc'
11
+ | 'px'
12
+ | 'pt'
13
+ | 'em'
14
+ | 'ex'
15
+ | 'ch'
16
+ | 'rem'
17
+ | 'lh'
18
+ | 'vw'
19
+ | 'vh'
20
+ | 'vmin'
21
+ | 'vmax'
22
+ | '%';
5
23
 
6
24
  export enum ALIGNMENT {
7
25
  start = 'flex-start',
@@ -74,7 +92,7 @@ export type StyledCellProps = {
74
92
  $span?: Responsive<number>;
75
93
  };
76
94
 
77
- export const Grid: React.FunctionComponent<GridProps>;
78
- export const Cell: React.FunctionComponent<CellProps>;
79
- export const StyledGrid: StyletronComponent<StyledGridProps>;
80
- export const StyledCell: StyletronComponent<StyledCellProps>;
95
+ export declare const Grid: React.FunctionComponent<GridProps>;
96
+ export declare const Cell: React.FunctionComponent<CellProps>;
97
+ export declare const StyledGrid: StyletronComponent<StyledGridProps>;
98
+ export declare const StyledCell: StyletronComponent<StyledCellProps>;
package/link/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {StyletronComponent} from 'styletron-react';
2
+ import { StyletronComponent } from 'styletron-react';
3
3
 
4
4
  export interface LinkProps
5
5
  extends React.DetailedHTMLProps<
@@ -10,4 +10,4 @@ export interface LinkProps
10
10
  target?: '_self' | '_blank' | '_parent' | '_top';
11
11
  }
12
12
 
13
- export const StyledLink: StyletronComponent<LinkProps>;
13
+ export declare const StyledLink: StyletronComponent<LinkProps>;
package/list/index.d.ts CHANGED
@@ -1,25 +1,20 @@
1
- import {HeaderNavigationOverrides} from 'baseui/header-navigation';
1
+ import { HeaderNavigationOverrides } from '../header-navigation';
2
2
  import * as React from 'react';
3
- import {StyletronComponent} from 'styletron-react';
4
- import {Override} from '../overrides';
3
+ import { StyletronComponent } from 'styletron-react';
4
+ import { Override } from '../overrides';
5
5
 
6
- export interface ARTWORK_SIZES {
6
+ export declare const ARTWORK_SIZES: {
7
7
  SMALL: 'SMALL';
8
8
  MEDIUM: 'MEDIUM';
9
9
  LARGE: 'LARGE';
10
- }
11
- export const ARTWORK_SIZES: ARTWORK_SIZES;
12
- export type ArtworkSizesT =
13
- | ARTWORK_SIZES['SMALL']
14
- | ARTWORK_SIZES['MEDIUM']
15
- | ARTWORK_SIZES['LARGE'];
10
+ };
11
+ export type ArtworkSizesT = typeof ARTWORK_SIZES[keyof typeof ARTWORK_SIZES];
16
12
 
17
- export interface SHAPE {
13
+ export declare const SHAPE: {
18
14
  DEFAULT: 'DEFAULT';
19
15
  ROUND: 'ROUND';
20
- }
21
- export const SHAPE: SHAPE;
22
- export type ShapeT = SHAPE['DEFAULT'] | SHAPE['ROUND'];
16
+ };
17
+ export type ShapeT = typeof SHAPE[keyof typeof SHAPE];
23
18
 
24
19
  export interface StyledRootPropsT {
25
20
  $shape: ShapeT;
@@ -47,11 +42,11 @@ export interface LabelOverrides {
47
42
  }
48
43
 
49
44
  export interface PropsT {
50
- artwork?: React.ReactNode;
45
+ artwork?: (args: { size: number }) => React.ReactNode;
51
46
  artworkSize?: ArtworkSizesT | number;
52
47
  shape?: ShapeT;
53
48
  children: React.ReactNode;
54
- endEnhancer?: React.ReactNode;
49
+ endEnhancer?: () => React.ReactNode;
55
50
  overrides?: ListOverrides;
56
51
  sublist?: boolean;
57
52
  }
@@ -72,16 +67,16 @@ export interface MenuAdapterPropsT extends PropsT {
72
67
  $disabled: boolean;
73
68
  }
74
69
 
75
- export const ListItem: React.ForwardRefExoticComponent<
70
+ export declare const ListItem: React.ForwardRefExoticComponent<
76
71
  PropsT & React.RefAttributes<HTMLLIElement>
77
72
  >;
78
- export const ListItemLabel: React.FC<LabelPropsT>;
79
- export const MenuAdapter: React.FC<MenuAdapterPropsT>;
73
+ export declare const ListItemLabel: React.FC<LabelPropsT>;
74
+ export declare const MenuAdapter: React.FC<MenuAdapterPropsT>;
80
75
 
81
- export const StyledRoot: StyletronComponent<{}>;
82
- export const StyledContent: StyletronComponent<StyledContentPropsT>;
83
- export const StyledEndEnhancerContainer: StyletronComponent<{}>;
84
- export const StyledArtworkContainer: StyletronComponent<StyledArtworkContainerPropsT>;
76
+ export declare const StyledRoot: StyletronComponent<{}>;
77
+ export declare const StyledContent: StyletronComponent<StyledContentPropsT>;
78
+ export declare const StyledEndEnhancerContainer: StyletronComponent<{}>;
79
+ export declare const StyledArtworkContainer: StyletronComponent<StyledArtworkContainerPropsT>;
85
80
 
86
81
  export interface HeadingPropsT {
87
82
  heading: React.ReactNode;
@@ -100,14 +95,14 @@ export type StyledHeadingHeadingPropsT = {
100
95
  $maxLines: 1 | 2;
101
96
  };
102
97
 
103
- export const ListHeading: React.ForwardRefExoticComponent<
98
+ export declare const ListHeading: React.ForwardRefExoticComponent<
104
99
  HeadingPropsT & React.RefAttributes<HTMLLIElement>
105
100
  >;
106
101
 
107
- export const StyledHeadingRoot: StyletronComponent<{}>;
108
- export const StyledHeadingContent: StyletronComponent<{}>;
109
- export const StyledHeadingContentRow: StyletronComponent<{}>;
110
- export const StyledHeadingMainHeading: StyletronComponent<StyledHeadingHeadingPropsT>;
111
- export const StyledHeadingSubHeading: StyletronComponent<StyledHeadingHeadingPropsT>;
112
- export const StyledHeadingEndEnhancerContainer: StyletronComponent<StyledHeadingEndEnhancerContainerPropsT>;
113
- export const StyledHeadingEndEnhancerDescriptionContainer: StyletronComponent<{}>;
102
+ export declare const StyledHeadingRoot: StyletronComponent<{}>;
103
+ export declare const StyledHeadingContent: StyletronComponent<{}>;
104
+ export declare const StyledHeadingContentRow: StyletronComponent<{}>;
105
+ export declare const StyledHeadingMainHeading: StyletronComponent<StyledHeadingHeadingPropsT>;
106
+ export declare const StyledHeadingSubHeading: StyletronComponent<StyledHeadingHeadingPropsT>;
107
+ export declare const StyledHeadingEndEnhancerContainer: StyletronComponent<StyledHeadingEndEnhancerContainerPropsT>;
108
+ export declare const StyledHeadingEndEnhancerDescriptionContainer: StyletronComponent<{}>;
@@ -1,3 +1,5 @@
1
+ import * as React from 'react';
2
+
1
3
  interface AccordionLocale {
2
4
  collapse: string;
3
5
  expand: string;
@@ -101,3 +103,9 @@ export interface Locale {
101
103
  select: SelectLocale;
102
104
  toast: ToastLocale;
103
105
  }
106
+
107
+ export interface LocaleProviderProps {
108
+ locale: Partial<Locale>;
109
+ children?: React.ReactNode;
110
+ }
111
+ export declare const LocaleProvider: React.FC<LocaleProviderProps>;