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.
- package/README.md +3 -3
- package/accordion/accordion.js +60 -13
- package/accordion/accordion.js.flow +49 -12
- package/accordion/index.d.ts +0 -3
- package/accordion/panel.js +7 -6
- package/accordion/panel.js.flow +20 -20
- package/accordion/stateless-accordion.js +2 -4
- package/accordion/stateless-accordion.js.flow +0 -2
- package/accordion/types.js.flow +0 -5
- package/button/constants.js +1 -2
- package/button/constants.js.flow +0 -1
- package/button/index.d.ts +0 -1
- package/button/styled-components.js +2 -29
- package/button/styled-components.js.flow +2 -30
- package/checkbox/checkbox.js +6 -30
- package/checkbox/checkbox.js.flow +7 -38
- package/checkbox/constants.js +2 -1
- package/checkbox/constants.js.flow +2 -1
- package/checkbox/index.d.ts +4 -6
- package/checkbox/index.js +0 -6
- package/checkbox/index.js.flow +0 -1
- package/checkbox/styled-components.js +52 -149
- package/checkbox/styled-components.js.flow +59 -165
- package/checkbox/types.js.flow +0 -5
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +1 -1
- package/data-table/column-datetime.js +1 -1
- package/data-table/column-datetime.js.flow +3 -1
- package/data-table/column.js +6 -2
- package/data-table/column.js.flow +9 -7
- package/data-table/data-table.js +1 -1
- package/data-table/data-table.js.flow +1 -1
- package/data-table/header-cell.js +3 -0
- package/data-table/header-cell.js.flow +1 -1
- package/datepicker/calendar.js +15 -7
- package/datepicker/calendar.js.flow +23 -9
- package/datepicker/constants.js +12 -2
- package/datepicker/constants.js.flow +10 -0
- package/datepicker/datepicker.js +61 -30
- package/datepicker/datepicker.js.flow +77 -37
- package/datepicker/day.js +85 -34
- package/datepicker/day.js.flow +118 -54
- package/datepicker/locale.js.flow +0 -1
- package/datepicker/month.js +3 -1
- package/datepicker/month.js.flow +2 -0
- package/datepicker/stateful-container.js.flow +2 -1
- package/datepicker/styled-components.js +23 -1
- package/datepicker/styled-components.js.flow +12 -2
- package/datepicker/types.js.flow +35 -10
- package/datepicker/utils/date-helpers.js +30 -0
- package/datepicker/utils/date-helpers.js.flow +12 -0
- package/datepicker/week.js +3 -1
- package/datepicker/week.js.flow +2 -0
- package/es/accordion/accordion.js +52 -12
- package/es/accordion/panel.js +7 -5
- package/es/accordion/stateless-accordion.js +2 -4
- package/es/button/constants.js +1 -2
- package/es/button/styled-components.js +2 -29
- package/es/checkbox/checkbox.js +7 -32
- package/es/checkbox/constants.js +2 -1
- package/es/checkbox/index.js +1 -1
- package/es/checkbox/styled-components.js +51 -146
- package/es/data-table/column-categorical.js +1 -1
- package/es/data-table/column-datetime.js +1 -1
- package/es/data-table/column.js +6 -2
- package/es/data-table/data-table.js +1 -1
- package/es/data-table/header-cell.js +3 -0
- package/es/datepicker/calendar.js +15 -7
- package/es/datepicker/constants.js +8 -0
- package/es/datepicker/datepicker.js +56 -29
- package/es/datepicker/day.js +77 -34
- package/es/datepicker/month.js +3 -1
- package/es/datepicker/styled-components.js +8 -2
- package/es/datepicker/types.js +1 -1
- package/es/datepicker/utils/date-helpers.js +16 -0
- package/es/datepicker/week.js +3 -1
- package/es/file-uploader/file-uploader.js +4 -4
- package/es/header-navigation/styled-components.js +3 -3
- package/es/helpers/overrides.js +1 -2
- package/es/input/styled-components.js +4 -4
- package/es/layer/layer.js +4 -4
- package/es/locale/index.js +0 -7
- package/es/menu/stateful-container.js +0 -1
- package/es/menu/styled-components.js +1 -1
- package/es/modal/index.js +1 -1
- package/es/modal/modal.js +19 -65
- package/es/modal/styled-components.js +12 -48
- package/es/phone-input/default-props.js +1 -1
- package/es/phone-input/index.js +0 -4
- package/es/phone-input/phone-input-lite.js +55 -31
- package/es/radio/radio.js +1 -7
- package/es/radio/radiogroup.js +3 -28
- package/es/radio/styled-components.js +4 -5
- package/es/rating/styled-components.js +3 -3
- package/es/select/index.js +1 -2
- package/es/select/select-component.js +4 -8
- package/es/select/styled-components.js +4 -4
- package/es/snackbar/styled-components.js +2 -2
- package/es/spinner/index.js +3 -9
- package/es/spinner/styled-components.js +2 -32
- package/es/table/filter.js +3 -3
- package/es/tag/styled-components.js +1 -1
- package/es/themes/dark-theme/color-component-tokens.js +0 -38
- package/es/themes/dark-theme/color-tokens.js +0 -2
- package/es/themes/dark-theme/create-dark-theme.js +0 -2
- package/es/themes/dark-theme/dark-theme.js +0 -2
- package/es/themes/light-theme/color-component-tokens.js +0 -38
- package/es/themes/light-theme/color-tokens.js +0 -2
- package/es/themes/light-theme/create-light-theme.js +0 -2
- package/es/themes/light-theme/light-theme.js +0 -2
- package/es/timepicker/timepicker.js +1 -8
- package/es/typography/index.js +1 -31
- package/esm/accordion/accordion.js +60 -13
- package/esm/accordion/panel.js +7 -6
- package/esm/accordion/stateless-accordion.js +2 -4
- package/esm/button/constants.js +1 -2
- package/esm/button/styled-components.js +2 -29
- package/esm/checkbox/checkbox.js +7 -30
- package/esm/checkbox/constants.js +2 -1
- package/esm/checkbox/index.js +1 -1
- package/esm/checkbox/styled-components.js +52 -147
- package/esm/data-table/column-categorical.js +1 -1
- package/esm/data-table/column-datetime.js +1 -1
- package/esm/data-table/column.js +6 -2
- package/esm/data-table/data-table.js +1 -1
- package/esm/data-table/header-cell.js +3 -0
- package/esm/datepicker/calendar.js +15 -7
- package/esm/datepicker/constants.js +8 -0
- package/esm/datepicker/datepicker.js +60 -30
- package/esm/datepicker/day.js +84 -34
- package/esm/datepicker/month.js +3 -1
- package/esm/datepicker/styled-components.js +24 -2
- package/esm/datepicker/types.js +1 -1
- package/esm/datepicker/utils/date-helpers.js +30 -0
- package/esm/datepicker/week.js +3 -1
- package/esm/file-uploader/file-uploader.js +4 -4
- package/esm/header-navigation/styled-components.js +3 -3
- package/esm/helpers/overrides.js +1 -2
- package/esm/input/styled-components.js +4 -4
- package/esm/layer/layer.js +4 -4
- package/esm/locale/index.js +0 -7
- package/esm/menu/stateful-container.js +0 -1
- package/esm/menu/styled-components.js +1 -1
- package/esm/modal/index.js +1 -1
- package/esm/modal/modal.js +28 -71
- package/esm/modal/styled-components.js +6 -38
- package/esm/phone-input/default-props.js +1 -1
- package/esm/phone-input/index.js +0 -4
- package/esm/phone-input/phone-input-lite.js +60 -37
- package/esm/radio/radio.js +1 -7
- package/esm/radio/radiogroup.js +3 -28
- package/esm/radio/styled-components.js +4 -5
- package/esm/rating/styled-components.js +3 -3
- package/esm/select/index.js +1 -2
- package/esm/select/select-component.js +4 -8
- package/esm/select/styled-components.js +4 -4
- package/esm/snackbar/styled-components.js +2 -2
- package/esm/spinner/index.js +3 -9
- package/esm/spinner/styled-components.js +2 -40
- package/esm/table/filter.js +3 -3
- package/esm/tag/styled-components.js +1 -1
- package/esm/themes/dark-theme/color-component-tokens.js +0 -38
- package/esm/themes/dark-theme/color-tokens.js +0 -2
- package/esm/themes/dark-theme/create-dark-theme.js +1 -2
- package/esm/themes/dark-theme/dark-theme.js +1 -2
- package/esm/themes/light-theme/color-component-tokens.js +0 -38
- package/esm/themes/light-theme/color-tokens.js +0 -2
- package/esm/themes/light-theme/create-light-theme.js +1 -2
- package/esm/themes/light-theme/light-theme.js +1 -2
- package/esm/timepicker/timepicker.js +1 -8
- package/esm/typography/index.js +1 -35
- package/file-uploader/file-uploader.js +3 -3
- package/file-uploader/file-uploader.js.flow +4 -4
- package/header-navigation/styled-components.js +3 -3
- package/header-navigation/styled-components.js.flow +3 -3
- package/helpers/overrides.js +1 -2
- package/helpers/overrides.js.flow +1 -1
- package/input/index.d.ts +5 -9
- package/input/styled-components.js +4 -4
- package/input/styled-components.js.flow +4 -4
- package/layer/layer.js +4 -4
- package/layer/layer.js.flow +4 -3
- package/locale/index.js +0 -7
- package/locale/index.js.flow +0 -7
- package/locale.ts +0 -1
- package/menu/index.d.ts +1 -3
- package/menu/stateful-container.js +0 -1
- package/menu/stateful-container.js.flow +0 -1
- package/menu/styled-components.js +1 -1
- package/menu/styled-components.js.flow +1 -1
- package/modal/index.d.ts +4 -6
- package/modal/index.js +0 -6
- package/modal/index.js.flow +0 -1
- package/modal/modal.js +27 -70
- package/modal/modal.js.flow +17 -83
- package/modal/styled-components.js +7 -40
- package/modal/styled-components.js.flow +12 -44
- package/modal/types.js.flow +1 -10
- package/package.json +2 -2
- package/phone-input/default-props.js +1 -1
- package/phone-input/default-props.js.flow +1 -1
- package/phone-input/index.d.ts +0 -1
- package/phone-input/index.js +0 -36
- package/phone-input/index.js.flow +0 -4
- package/phone-input/phone-input-lite.js +63 -38
- package/phone-input/phone-input-lite.js.flow +66 -44
- package/radio/index.d.ts +4 -9
- package/radio/radio.js +1 -7
- package/radio/radio.js.flow +1 -8
- package/radio/radiogroup.js +3 -28
- package/radio/radiogroup.js.flow +2 -26
- package/radio/styled-components.js +4 -5
- package/radio/styled-components.js.flow +3 -4
- package/radio/types.js.flow +4 -15
- package/rating/styled-components.js +3 -3
- package/rating/styled-components.js.flow +3 -3
- package/select/index.d.ts +0 -2
- package/select/index.js +0 -6
- package/select/index.js.flow +0 -2
- package/select/select-component.js +4 -8
- package/select/select-component.js.flow +2 -3
- package/select/styled-components.js +4 -4
- package/select/styled-components.js.flow +4 -4
- package/snackbar/styled-components.js +1 -1
- package/snackbar/styled-components.js.flow +11 -11
- package/spinner/index.d.ts +5 -18
- package/spinner/index.js +2 -68
- package/spinner/index.js.flow +2 -27
- package/spinner/styled-components.js +9 -45
- package/spinner/styled-components.js.flow +2 -34
- package/spinner/types.js.flow +1 -19
- package/styles/types.js.flow +0 -2
- package/table/filter.js +3 -3
- package/table/filter.js.flow +3 -3
- package/tag/styled-components.js +1 -1
- package/tag/styled-components.js.flow +1 -1
- package/theme.ts +0 -81
- package/themes/dark-theme/color-component-tokens.js +0 -38
- package/themes/dark-theme/color-component-tokens.js.flow +0 -42
- package/themes/dark-theme/color-tokens.js +0 -2
- package/themes/dark-theme/color-tokens.js.flow +0 -2
- package/themes/dark-theme/create-dark-theme.js +1 -3
- package/themes/dark-theme/create-dark-theme.js.flow +0 -2
- package/themes/dark-theme/dark-theme.js +1 -3
- package/themes/dark-theme/dark-theme.js.flow +0 -2
- package/themes/light-theme/color-component-tokens.js +0 -38
- package/themes/light-theme/color-component-tokens.js.flow +0 -43
- package/themes/light-theme/color-tokens.js +0 -2
- package/themes/light-theme/color-tokens.js.flow +0 -2
- package/themes/light-theme/create-light-theme.js +1 -3
- package/themes/light-theme/create-light-theme.js.flow +0 -2
- package/themes/light-theme/light-theme.js +1 -3
- package/themes/light-theme/light-theme.js.flow +0 -2
- package/themes/types.js.flow +0 -68
- package/timepicker/timepicker.js +1 -8
- package/timepicker/timepicker.js.flow +4 -10
- package/typography/index.d.ts +0 -23
- package/typography/index.js +2 -57
- package/typography/index.js.flow +0 -31
- package/es/spinner/spinner.js +0 -68
- package/es/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -35
- package/es/themes/light-theme/color-deprecated-semantic-tokens.js +0 -35
- package/esm/spinner/spinner.js +0 -125
- package/esm/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -38
- package/esm/themes/light-theme/color-deprecated-semantic-tokens.js +0 -38
- package/spinner/spinner.js +0 -136
- package/spinner/spinner.js.flow +0 -75
- package/themes/dark-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/dark-theme/color-deprecated-semantic-tokens.js.flow +0 -42
- package/themes/light-theme/color-deprecated-semantic-tokens.js +0 -50
- package/themes/light-theme/color-deprecated-semantic-tokens.js.flow +0 -42
package/esm/layer/layer.js
CHANGED
|
@@ -198,10 +198,10 @@ var LayerComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
198
198
|
}, children) : children;
|
|
199
199
|
|
|
200
200
|
if (typeof document !== 'undefined') {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
if (
|
|
204
|
-
return /*#__PURE__*/ReactDOM.createPortal(childrenToRender,
|
|
201
|
+
if (mountNode) {
|
|
202
|
+
return /*#__PURE__*/ReactDOM.createPortal(childrenToRender, mountNode);
|
|
203
|
+
} else if (container) {
|
|
204
|
+
return /*#__PURE__*/ReactDOM.createPortal(childrenToRender, container);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
return null;
|
package/esm/locale/index.js
CHANGED
|
@@ -12,13 +12,6 @@ export var LocaleContext = /*#__PURE__*/React.createContext(en_US);
|
|
|
12
12
|
var LocaleProvider = function LocaleProvider(props) {
|
|
13
13
|
var locale = props.locale,
|
|
14
14
|
children = props.children;
|
|
15
|
-
|
|
16
|
-
if (process.env.NODE_ENV !== "production") {
|
|
17
|
-
if (locale.datepicker && locale.datepicker.timePickerAriaLabel) {
|
|
18
|
-
console.warn('`timePickerAriaLabel` will be removed in v11 - please use timePickerAriaLabel12Hour and timePickerAriaLabel24Hour instead');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
15
|
return /*#__PURE__*/React.createElement(LocaleContext.Provider, {
|
|
23
16
|
value: extend({}, en_US, locale)
|
|
24
17
|
}, children);
|
|
@@ -94,7 +94,7 @@ export var StyledOptgroupHeader = styled('li', function (props) {
|
|
|
94
94
|
var paddingX = props.$theme.sizing.scale300;
|
|
95
95
|
var paddingY = props.$theme.sizing.scale200;
|
|
96
96
|
return _objectSpread(_objectSpread({}, props.$theme.typography.font250), {}, {
|
|
97
|
-
color: props.$theme.colors.
|
|
97
|
+
color: props.$theme.colors.contentPrimary,
|
|
98
98
|
paddingTop: paddingY,
|
|
99
99
|
paddingBottom: paddingY,
|
|
100
100
|
paddingRight: paddingX,
|
package/esm/modal/index.js
CHANGED
|
@@ -8,4 +8,4 @@ export { default as Modal } from './modal.js';
|
|
|
8
8
|
export { default as ModalButton } from './modal-button.js';
|
|
9
9
|
export { default as FocusOnce } from './focus-once.js';
|
|
10
10
|
export { SIZE, ROLE, CLOSE_SOURCE } from './constants.js';
|
|
11
|
-
export { Root as StyledRoot,
|
|
11
|
+
export { Root as StyledRoot, Dialog as StyledDialog, DialogContainer as StyledDialogContainer, Close as StyledClose, ModalHeader, ModalBody, ModalFooter } from './styled-components.js';
|
package/esm/modal/modal.js
CHANGED
|
@@ -52,7 +52,7 @@ import { LocaleContext } from '../locale/index.js';
|
|
|
52
52
|
import { getOverrides } from '../helpers/overrides.js';
|
|
53
53
|
import { Layer } from '../layer/index.js';
|
|
54
54
|
import { SIZE, ROLE, CLOSE_SOURCE } from './constants.js';
|
|
55
|
-
import { Root as StyledRoot,
|
|
55
|
+
import { Root as StyledRoot, Dialog as StyledDialog, DialogContainer as StyledDialogContainer, Close as StyledClose } from './styled-components.js';
|
|
56
56
|
import { CloseIcon } from './close-icon.js';
|
|
57
57
|
import { isFocusVisible, forkFocus, forkBlur } from '../utils/focusVisible.js';
|
|
58
58
|
|
|
@@ -76,11 +76,13 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
76
76
|
|
|
77
77
|
_defineProperty(_assertThisInitialized(_this), "animateStartTimer", void 0);
|
|
78
78
|
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "dialogContainerRef", /*#__PURE__*/React.createRef());
|
|
80
|
+
|
|
79
81
|
_defineProperty(_assertThisInitialized(_this), "lastFocus", null);
|
|
80
82
|
|
|
81
83
|
_defineProperty(_assertThisInitialized(_this), "lastMountNodeOverflowStyle", null);
|
|
82
84
|
|
|
83
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
85
|
+
_defineProperty(_assertThisInitialized(_this), "rootRef", /*#__PURE__*/React.createRef());
|
|
84
86
|
|
|
85
87
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
86
88
|
isVisible: false,
|
|
@@ -113,10 +115,7 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
113
115
|
});
|
|
114
116
|
|
|
115
117
|
_defineProperty(_assertThisInitialized(_this), "onDocumentClick", function (e) {
|
|
116
|
-
if (e.target && e.target instanceof HTMLElement && (
|
|
117
|
-
e.target.contains(_this.getRef('DialogContainer').current) || // Handles modal closure when unstable_ModalBackdropScroll is set to false
|
|
118
|
-
// $FlowFixMe
|
|
119
|
-
e.target.contains(_this.getRef('DeprecatedBackdrop').current))) {
|
|
118
|
+
if (e.target && e.target instanceof HTMLElement && e.target.contains(_this.dialogContainerRef.current)) {
|
|
120
119
|
_this.onBackdropClick();
|
|
121
120
|
}
|
|
122
121
|
});
|
|
@@ -147,18 +146,10 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
147
146
|
value: function componentDidMount() {
|
|
148
147
|
this.setState({
|
|
149
148
|
mounted: true
|
|
150
|
-
});
|
|
149
|
+
});
|
|
151
150
|
|
|
152
151
|
if (process.env.NODE_ENV !== "production") {
|
|
153
|
-
|
|
154
|
-
console.warn("Consider setting 'unstable_ModalBackdropScroll' prop to true\n to prepare for the next major version upgrade. 'unstable_ModalBackdropScroll'\n prop will be removed in the next major version but implemented as the default behavior.");
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (this.props.overrides && this.props.overrides.Backdrop) {
|
|
158
|
-
console.warn("Backdrop element will be removed in the next major version in favor of\n DialogContainer element that will have the backdrop styles and backdrop click handle.\n Consider setting 'unstable_ModalBackdropScroll' prop to true that will apply backdrop\n styles to DialogContainer enable modal scrolling while cursor in over the backdrop.\n Then pass backdrop overrides to DialogContainer instead. Tha will help you with\n the next major version upgrade.");
|
|
159
|
-
} // $FlowFixMe: flow complains that this prop doesn't exist
|
|
160
|
-
|
|
161
|
-
|
|
152
|
+
// $FlowFixMe: flow complains that this prop doesn't exist
|
|
162
153
|
if (this.props.closable) {
|
|
163
154
|
console.warn('The property `closable` is not supported on the Modal. Did you mean `closeable`?');
|
|
164
155
|
}
|
|
@@ -226,7 +217,7 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
226
217
|
|
|
227
218
|
// Sometimes scroll starts past zero, possibly due to animation
|
|
228
219
|
// Reset scroll to 0 (other libraries do this as well)
|
|
229
|
-
var rootRef = this.
|
|
220
|
+
var rootRef = this.rootRef.current;
|
|
230
221
|
|
|
231
222
|
if (rootRef) {
|
|
232
223
|
rootRef.scrollTop = 0;
|
|
@@ -266,8 +257,7 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
266
257
|
isOpen = _this$props.isOpen,
|
|
267
258
|
size = _this$props.size,
|
|
268
259
|
role = _this$props.role,
|
|
269
|
-
closeable = _this$props.closeable
|
|
270
|
-
unstable_ModalBackdropScroll = _this$props.unstable_ModalBackdropScroll;
|
|
260
|
+
closeable = _this$props.closeable;
|
|
271
261
|
return {
|
|
272
262
|
$animate: animate,
|
|
273
263
|
$isVisible: this.state.isVisible,
|
|
@@ -275,7 +265,6 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
275
265
|
$size: size,
|
|
276
266
|
$role: role,
|
|
277
267
|
$closeable: !!closeable,
|
|
278
|
-
$unstable_ModalBackdropScroll: unstable_ModalBackdropScroll,
|
|
279
268
|
$isFocusVisible: this.state.isFocusVisible
|
|
280
269
|
};
|
|
281
270
|
}
|
|
@@ -298,15 +287,6 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
298
287
|
var children = this.props.children;
|
|
299
288
|
return typeof children === 'function' ? children() : children;
|
|
300
289
|
}
|
|
301
|
-
}, {
|
|
302
|
-
key: "getRef",
|
|
303
|
-
value: function getRef(component) {
|
|
304
|
-
if (!this._refs[component]) {
|
|
305
|
-
this._refs[component] = /*#__PURE__*/React.createRef();
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
return this._refs[component];
|
|
309
|
-
}
|
|
310
290
|
}, {
|
|
311
291
|
key: "renderModal",
|
|
312
292
|
value: function renderModal() {
|
|
@@ -317,15 +297,12 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
317
297
|
overrides = _this$props2$override === void 0 ? {} : _this$props2$override,
|
|
318
298
|
closeable = _this$props2.closeable,
|
|
319
299
|
role = _this$props2.role,
|
|
320
|
-
unstable_ModalBackdropScroll = _this$props2.unstable_ModalBackdropScroll,
|
|
321
|
-
autofocus = _this$props2.autofocus,
|
|
322
300
|
autoFocus = _this$props2.autoFocus,
|
|
323
301
|
focusLock = _this$props2.focusLock,
|
|
324
302
|
returnFocus = _this$props2.returnFocus;
|
|
325
303
|
var RootOverride = overrides.Root,
|
|
326
304
|
DialogOverride = overrides.Dialog,
|
|
327
305
|
DialogContainerOverride = overrides.DialogContainer,
|
|
328
|
-
BackdropOverride = overrides.Backdrop,
|
|
329
306
|
CloseOverride = overrides.Close;
|
|
330
307
|
|
|
331
308
|
var _getOverrides = getOverrides(RootOverride, StyledRoot),
|
|
@@ -333,59 +310,42 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
333
310
|
Root = _getOverrides2[0],
|
|
334
311
|
rootProps = _getOverrides2[1];
|
|
335
312
|
|
|
336
|
-
var _getOverrides3 = getOverrides(
|
|
313
|
+
var _getOverrides3 = getOverrides(DialogContainerOverride, StyledDialogContainer),
|
|
337
314
|
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
338
|
-
|
|
339
|
-
|
|
315
|
+
DialogContainer = _getOverrides4[0],
|
|
316
|
+
dialogContainerProps = _getOverrides4[1];
|
|
340
317
|
|
|
341
|
-
var _getOverrides5 = getOverrides(
|
|
318
|
+
var _getOverrides5 = getOverrides(DialogOverride, StyledDialog),
|
|
342
319
|
_getOverrides6 = _slicedToArray(_getOverrides5, 2),
|
|
343
|
-
|
|
344
|
-
|
|
320
|
+
Dialog = _getOverrides6[0],
|
|
321
|
+
dialogProps = _getOverrides6[1];
|
|
345
322
|
|
|
346
|
-
var _getOverrides7 = getOverrides(
|
|
323
|
+
var _getOverrides7 = getOverrides(CloseOverride, StyledClose),
|
|
347
324
|
_getOverrides8 = _slicedToArray(_getOverrides7, 2),
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
var _getOverrides9 = getOverrides(CloseOverride, StyledClose),
|
|
352
|
-
_getOverrides10 = _slicedToArray(_getOverrides9, 2),
|
|
353
|
-
Close = _getOverrides10[0],
|
|
354
|
-
closeProps = _getOverrides10[1];
|
|
325
|
+
Close = _getOverrides8[0],
|
|
326
|
+
closeProps = _getOverrides8[1];
|
|
355
327
|
|
|
356
328
|
var sharedProps = this.getSharedProps();
|
|
357
329
|
var children = this.getChildren();
|
|
358
|
-
|
|
359
|
-
if (autofocus === false && process.env.NODE_ENV !== "production") {
|
|
360
|
-
console.warn("The prop \"autofocus\" is deprecated in favor of \"autoFocus\" to be consistent across the project.\n The property \"autofocus\" will be removed in a future major version.");
|
|
361
|
-
} // Handles backdrop click when `unstable_ModalBackdropScroll` is set to true
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
if (dialogContainerProps.ref) {
|
|
365
|
-
this._refs.DialogContainer = dialogContainerProps.ref;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
var dialogContainerConditionalProps = unstable_ModalBackdropScroll ? {
|
|
369
|
-
ref: this.getRef('DialogContainer')
|
|
370
|
-
} : {};
|
|
371
330
|
return /*#__PURE__*/React.createElement(LocaleContext.Consumer, null, function (locale) {
|
|
372
331
|
return /*#__PURE__*/React.createElement(FocusLock, {
|
|
373
332
|
disabled: !focusLock // Allow focus to escape when UI is within an iframe
|
|
374
333
|
,
|
|
375
334
|
crossFrame: false,
|
|
376
335
|
returnFocus: returnFocus,
|
|
377
|
-
autoFocus:
|
|
336
|
+
autoFocus: autoFocus
|
|
378
337
|
}, /*#__PURE__*/React.createElement(Root, _extends({
|
|
379
|
-
"data-baseweb": "modal"
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
338
|
+
"data-baseweb": "modal" // flowlint-next-line unclear-type:off
|
|
339
|
+
,
|
|
340
|
+
ref: _this3.rootRef
|
|
341
|
+
}, sharedProps, rootProps), /*#__PURE__*/React.createElement(DialogContainer // flowlint-next-line unclear-type:off
|
|
342
|
+
, _extends({
|
|
343
|
+
ref: _this3.dialogContainerRef
|
|
344
|
+
}, sharedProps, dialogContainerProps), /*#__PURE__*/React.createElement(Dialog, _extends({
|
|
384
345
|
tabIndex: -1,
|
|
385
346
|
"aria-modal": true,
|
|
386
347
|
"aria-label": "dialog",
|
|
387
|
-
role: role
|
|
388
|
-
ref: _this3.getRef('Dialog')
|
|
348
|
+
role: role
|
|
389
349
|
}, sharedProps, dialogProps), children, closeable ? /*#__PURE__*/React.createElement(Close, _extends({
|
|
390
350
|
"aria-label": locale.modal.close,
|
|
391
351
|
onClick: _this3.onCloseClick
|
|
@@ -421,8 +381,6 @@ var Modal = /*#__PURE__*/function (_React$Component) {
|
|
|
421
381
|
|
|
422
382
|
_defineProperty(Modal, "defaultProps", {
|
|
423
383
|
animate: true,
|
|
424
|
-
// TODO(v11): remove
|
|
425
|
-
autofocus: null,
|
|
426
384
|
autoFocus: true,
|
|
427
385
|
focusLock: true,
|
|
428
386
|
returnFocus: true,
|
|
@@ -431,8 +389,7 @@ _defineProperty(Modal, "defaultProps", {
|
|
|
431
389
|
isOpen: false,
|
|
432
390
|
overrides: {},
|
|
433
391
|
role: ROLE.dialog,
|
|
434
|
-
size: SIZE.default
|
|
435
|
-
unstable_ModalBackdropScroll: false
|
|
392
|
+
size: SIZE.default
|
|
436
393
|
});
|
|
437
394
|
|
|
438
395
|
export default Modal;
|
|
@@ -47,61 +47,29 @@ export var Root = styled('div', function (props) {
|
|
|
47
47
|
};
|
|
48
48
|
});
|
|
49
49
|
Root.displayName = "Root";
|
|
50
|
-
export var
|
|
50
|
+
export var DialogContainer = styled('div', function (props) {
|
|
51
51
|
var $animate = props.$animate,
|
|
52
52
|
$isOpen = props.$isOpen,
|
|
53
53
|
$isVisible = props.$isVisible,
|
|
54
|
-
$theme = props.$theme
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if ($unstable_ModalBackdropScroll) {
|
|
58
|
-
return {};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return _objectSpread({
|
|
62
|
-
position: 'fixed',
|
|
63
|
-
right: 0,
|
|
64
|
-
bottom: 0,
|
|
65
|
-
top: 0,
|
|
66
|
-
left: 0,
|
|
67
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
68
|
-
// Remove grey highlight
|
|
69
|
-
WebkitTapHighlightColor: 'transparent',
|
|
70
|
-
// Disable scroll capabilities.
|
|
71
|
-
touchAction: 'none',
|
|
72
|
-
opacity: $isVisible && $isOpen ? 1 : 0
|
|
73
|
-
}, $animate ? {
|
|
54
|
+
$theme = props.$theme;
|
|
55
|
+
var animationRules = {
|
|
74
56
|
transitionProperty: 'opacity',
|
|
75
57
|
transitionDuration: $theme.animation.timing400,
|
|
76
58
|
transitionTimingFunction: $theme.animation.easeOutCurve
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
Backdrop.displayName = "Backdrop";
|
|
80
|
-
export var DialogContainer = styled('div', function (props) {
|
|
81
|
-
var $animate = props.$animate,
|
|
82
|
-
$isOpen = props.$isOpen,
|
|
83
|
-
$isVisible = props.$isVisible,
|
|
84
|
-
$theme = props.$theme,
|
|
85
|
-
$unstable_ModalBackdropScroll = props.$unstable_ModalBackdropScroll;
|
|
59
|
+
};
|
|
86
60
|
return _objectSpread({
|
|
87
61
|
display: 'flex',
|
|
88
62
|
alignItems: 'center',
|
|
89
63
|
justifyContent: 'center',
|
|
90
64
|
width: '100%',
|
|
91
65
|
minHeight: '100%',
|
|
92
|
-
|
|
93
|
-
userSelect: 'none'
|
|
94
|
-
}, $unstable_ModalBackdropScroll ? _objectSpread({
|
|
66
|
+
userSelect: 'none',
|
|
95
67
|
pointerEvents: 'auto',
|
|
96
68
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
97
69
|
// Remove grey highlight
|
|
98
70
|
WebkitTapHighlightColor: 'transparent',
|
|
99
71
|
opacity: $isVisible && $isOpen ? 1 : 0
|
|
100
|
-
}, $animate ?
|
|
101
|
-
transitionProperty: 'opacity',
|
|
102
|
-
transitionDuration: $theme.animation.timing400,
|
|
103
|
-
transitionTimingFunction: $theme.animation.easeOutCurve
|
|
104
|
-
} : null) : {});
|
|
72
|
+
}, $animate ? animationRules : null);
|
|
105
73
|
});
|
|
106
74
|
DialogContainer.displayName = "DialogContainer";
|
|
107
75
|
export var Dialog = styled('div', function (props) {
|
package/esm/phone-input/index.js
CHANGED
|
@@ -6,13 +6,9 @@ LICENSE file in the root directory of this source tree.
|
|
|
6
6
|
*/
|
|
7
7
|
export { default as PhoneInput } from './phone-input.js';
|
|
8
8
|
export { default as PhoneInputLite } from './phone-input-lite.js';
|
|
9
|
-
export { default as PhoneInputNext } from './phone-input-next.js';
|
|
10
9
|
export { default as StatefulPhoneInput } from './stateful-phone-input.js';
|
|
11
|
-
export { default as StatefulPhoneInputNext } from './stateful-phone-input-next.js';
|
|
12
10
|
export { default as StatefulPhoneInputContainer } from './stateful-phone-input-container.js';
|
|
13
11
|
export { default as CountryPicker } from './country-picker.js';
|
|
14
|
-
export { default as CountrySelect } from './country-select.js';
|
|
15
|
-
export { default as CountrySelectDropdown } from './country-select-dropdown.js';
|
|
16
12
|
export { default as Flag, StyledFlag } from './flag.js';
|
|
17
13
|
export * from './constants.js';
|
|
18
14
|
export * from './styled-components.js';
|
|
@@ -12,6 +12,8 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
12
12
|
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
|
|
15
|
+
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; }
|
|
16
|
+
|
|
15
17
|
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; }
|
|
16
18
|
|
|
17
19
|
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; }
|
|
@@ -23,19 +25,17 @@ This source code is licensed under the MIT license found in the
|
|
|
23
25
|
LICENSE file in the root directory of this source tree.
|
|
24
26
|
*/
|
|
25
27
|
import React, { useRef } from 'react';
|
|
28
|
+
import CountryPicker from './country-picker.js';
|
|
29
|
+
import defaultProps from './default-props.js';
|
|
30
|
+
import { StyledPhoneInputRoot, StyledDialCode } from './styled-components.js';
|
|
26
31
|
import { Input as DefaultInput } from '../input/index.js';
|
|
27
|
-
import CountrySelect from './country-select.js';
|
|
28
32
|
import { getOverrides, mergeOverrides } from '../helpers/overrides.js';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
var country = defaultProps.country,
|
|
32
|
-
lightDefaultProps = _objectWithoutProperties(defaultProps, ["country"]);
|
|
33
|
-
|
|
34
|
-
PhoneInputLite.defaultProps = lightDefaultProps;
|
|
33
|
+
PhoneInputLite.defaultProps = defaultProps;
|
|
35
34
|
export default function PhoneInputLite(props) {
|
|
36
35
|
var ariaLabel = props['aria-label'],
|
|
37
36
|
ariaLabelledBy = props['aria-labelledby'],
|
|
38
37
|
ariaDescribedBy = props['aria-describedby'],
|
|
38
|
+
clearable = props.clearable,
|
|
39
39
|
countries = props.countries,
|
|
40
40
|
country = props.country,
|
|
41
41
|
disabled = props.disabled,
|
|
@@ -53,45 +53,67 @@ export default function PhoneInputLite(props) {
|
|
|
53
53
|
required = props.required,
|
|
54
54
|
size = props.size,
|
|
55
55
|
text = props.text,
|
|
56
|
-
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"]);
|
|
56
|
+
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"]);
|
|
57
57
|
|
|
58
58
|
var inputRef = useRef(null);
|
|
59
|
+
var baseDialCodeOverride = {
|
|
60
|
+
component: StyledDialCode,
|
|
61
|
+
style: function style(_ref) {
|
|
62
|
+
var _ref$$theme = _ref.$theme,
|
|
63
|
+
direction = _ref$$theme.direction,
|
|
64
|
+
sizing = _ref$$theme.sizing;
|
|
65
|
+
var marginDir = direction === 'rtl' ? 'marginRight' : 'marginLeft';
|
|
66
|
+
return _defineProperty({}, marginDir, sizing.scale600);
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
children: country.dialCode
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var mergedDialCodeOverride = mergeOverrides({
|
|
73
|
+
DialCode: baseDialCodeOverride
|
|
74
|
+
}, {
|
|
75
|
+
DialCode: overrides.DialCode || {}
|
|
76
|
+
});
|
|
59
77
|
var baseOverrides = {
|
|
60
78
|
Input: {
|
|
61
|
-
style: function style(
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
style: function style(_ref3) {
|
|
80
|
+
var _ref3$$theme = _ref3.$theme,
|
|
81
|
+
direction = _ref3$$theme.direction,
|
|
82
|
+
sizing = _ref3$$theme.sizing;
|
|
83
|
+
var paddingDir = direction === 'rtl' ? 'paddingRight' : 'paddingLeft';
|
|
84
|
+
return _defineProperty({}, paddingDir, sizing.scale100);
|
|
66
85
|
}
|
|
67
86
|
},
|
|
68
|
-
Before:
|
|
69
|
-
component: CountrySelect,
|
|
70
|
-
props: {
|
|
71
|
-
countries: countries,
|
|
72
|
-
country: country,
|
|
73
|
-
disabled: disabled,
|
|
74
|
-
error: error,
|
|
75
|
-
inputRef: inputRef,
|
|
76
|
-
mapIsoToLabel: mapIsoToLabel,
|
|
77
|
-
maxDropdownHeight: maxDropdownHeight,
|
|
78
|
-
maxDropdownWidth: maxDropdownWidth,
|
|
79
|
-
onCountryChange: onCountryChange,
|
|
80
|
-
overrides: overrides,
|
|
81
|
-
positive: positive,
|
|
82
|
-
required: required,
|
|
83
|
-
size: size
|
|
84
|
-
}
|
|
85
|
-
}
|
|
87
|
+
Before: mergedDialCodeOverride.DialCode
|
|
86
88
|
};
|
|
87
89
|
|
|
88
|
-
var _getOverrides = getOverrides(overrides.
|
|
90
|
+
var _getOverrides = getOverrides(overrides.Root, StyledPhoneInputRoot),
|
|
89
91
|
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
Root = _getOverrides2[0],
|
|
93
|
+
rootProps = _getOverrides2[1];
|
|
94
|
+
|
|
95
|
+
var _getOverrides3 = getOverrides(overrides.Input, DefaultInput),
|
|
96
|
+
_getOverrides4 = _slicedToArray(_getOverrides3, 2),
|
|
97
|
+
Input = _getOverrides4[0],
|
|
98
|
+
inputProps = _getOverrides4[1];
|
|
92
99
|
|
|
93
100
|
inputProps.overrides = mergeOverrides(baseOverrides, inputProps.overrides);
|
|
94
|
-
return /*#__PURE__*/React.createElement(
|
|
101
|
+
return /*#__PURE__*/React.createElement(Root, _extends({}, rootProps, {
|
|
102
|
+
"data-baseweb": "phone-input"
|
|
103
|
+
}), /*#__PURE__*/React.createElement(CountryPicker, {
|
|
104
|
+
country: country,
|
|
105
|
+
countries: countries,
|
|
106
|
+
disabled: disabled,
|
|
107
|
+
error: error,
|
|
108
|
+
mapIsoToLabel: mapIsoToLabel,
|
|
109
|
+
maxDropdownHeight: maxDropdownHeight,
|
|
110
|
+
maxDropdownWidth: maxDropdownWidth,
|
|
111
|
+
onCountryChange: onCountryChange,
|
|
112
|
+
overrides: overrides,
|
|
113
|
+
positive: positive,
|
|
114
|
+
required: required,
|
|
115
|
+
size: size
|
|
116
|
+
}), /*#__PURE__*/React.createElement(Input, _extends({
|
|
95
117
|
"aria-label": ariaLabel,
|
|
96
118
|
"aria-labelledby": ariaLabelledBy,
|
|
97
119
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -108,6 +130,7 @@ export default function PhoneInputLite(props) {
|
|
|
108
130
|
placeholder: placeholder,
|
|
109
131
|
size: size,
|
|
110
132
|
type: "text",
|
|
111
|
-
value: text
|
|
112
|
-
|
|
133
|
+
value: text,
|
|
134
|
+
clearable: clearable
|
|
135
|
+
}, restProps, inputProps)));
|
|
113
136
|
}
|
package/esm/radio/radio.js
CHANGED
|
@@ -122,10 +122,6 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
122
122
|
if (this.props.autoFocus && (_this$props$inputRef = this.props.inputRef) !== null && _this$props$inputRef !== void 0 && _this$props$inputRef.current) {
|
|
123
123
|
this.props.inputRef.current.focus();
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
if (process.env.NODE_ENV !== "production" && this.props.isError) {
|
|
127
|
-
console.warn('baseui:Radio Property "isError" will be removed in the next major version. Use "error" property instead.');
|
|
128
|
-
}
|
|
129
125
|
}
|
|
130
126
|
}, {
|
|
131
127
|
key: "render",
|
|
@@ -169,7 +165,6 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
169
165
|
$disabled: this.props.disabled,
|
|
170
166
|
$hasDescription: !!this.props.description,
|
|
171
167
|
$isActive: this.state.isActive,
|
|
172
|
-
$isError: this.props.isError,
|
|
173
168
|
$error: this.props.error,
|
|
174
169
|
$isFocused: this.props.isFocused,
|
|
175
170
|
$isFocusVisible: this.props.isFocused && this.props.isFocusVisible,
|
|
@@ -194,7 +189,7 @@ var Radio = /*#__PURE__*/function (_React$Component) {
|
|
|
194
189
|
onMouseDown: this.onMouseDown,
|
|
195
190
|
onMouseUp: this.onMouseUp
|
|
196
191
|
}, sharedProps, rootProps), isLabelTopLeft(this.props.labelPlacement) && label, /*#__PURE__*/React.createElement(RadioMarkOuter, _extends({}, sharedProps, radioMarkOuterProps), /*#__PURE__*/React.createElement(RadioMarkInner, _extends({}, sharedProps, radioMarkInnerProps))), /*#__PURE__*/React.createElement(Input, _extends({
|
|
197
|
-
"aria-invalid": this.props.error ||
|
|
192
|
+
"aria-invalid": this.props.error || null,
|
|
198
193
|
checked: this.props.checked,
|
|
199
194
|
disabled: this.props.disabled,
|
|
200
195
|
name: this.props.name,
|
|
@@ -224,7 +219,6 @@ _defineProperty(Radio, "defaultProps", {
|
|
|
224
219
|
autoFocus: false,
|
|
225
220
|
inputRef: /*#__PURE__*/React.createRef(),
|
|
226
221
|
align: 'vertical',
|
|
227
|
-
isError: false,
|
|
228
222
|
error: false,
|
|
229
223
|
onChange: function onChange() {},
|
|
230
224
|
onMouseEnter: function onMouseEnter() {},
|
package/esm/radio/radiogroup.js
CHANGED
|
@@ -2,10 +2,6 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
-
|
|
7
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
-
|
|
9
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
6
|
|
|
11
7
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -104,13 +100,6 @@ var StatelessRadioGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
_createClass(StatelessRadioGroup, [{
|
|
107
|
-
key: "componentDidMount",
|
|
108
|
-
value: function componentDidMount() {
|
|
109
|
-
if (process.env.NODE_ENV !== "production" && this.props.isError) {
|
|
110
|
-
console.warn('baseui:Radio Property "isError" will be removed in the next major version. Use "error" property instead.');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, {
|
|
114
103
|
key: "render",
|
|
115
104
|
value: function render() {
|
|
116
105
|
var _this2 = this;
|
|
@@ -123,27 +112,17 @@ var StatelessRadioGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
123
112
|
RadioGroupRoot = _getOverrides2[0],
|
|
124
113
|
radioGroupRootProps = _getOverrides2[1];
|
|
125
114
|
|
|
126
|
-
if (process.env.NODE_ENV !== "production") {
|
|
127
|
-
var overrideKeys = Object.keys(overrides); // TODO(v11)
|
|
128
|
-
|
|
129
|
-
if (Boolean(overrideKeys.length) && !overrideKeys.includes('RadioGroupRoot')) {
|
|
130
|
-
// eslint-disable-next-line no-console
|
|
131
|
-
console.warn("All overrides beside 'RadioGroupRoot' will be deprecated in the next major version update.\n Pass other overrides to the 'Radio' children instead.\n ");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
115
|
return /*#__PURE__*/React.createElement(RadioGroupRoot, _extends({
|
|
136
116
|
id: this.props.id,
|
|
137
117
|
role: "radiogroup",
|
|
138
118
|
"aria-describedby": this.props['aria-describedby'],
|
|
139
119
|
"aria-errormessage": this.props['aria-errormessage'],
|
|
140
|
-
"aria-invalid": this.props.error ||
|
|
120
|
+
"aria-invalid": this.props.error || null,
|
|
141
121
|
"aria-label": this.props['aria-label'],
|
|
142
122
|
"aria-labelledby": this.props['aria-labelledby'],
|
|
143
123
|
$align: this.props.align,
|
|
144
124
|
$disabled: this.props.disabled,
|
|
145
|
-
$
|
|
146
|
-
$error: this.props.error || this.props.isError,
|
|
125
|
+
$error: this.props.error,
|
|
147
126
|
$required: this.props.required
|
|
148
127
|
}, radioGroupRootProps), React.Children.map(this.props.children, function (child, index) {
|
|
149
128
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
@@ -156,7 +135,6 @@ var StatelessRadioGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
156
135
|
autoFocus: _this2.props.autoFocus,
|
|
157
136
|
checked: checked,
|
|
158
137
|
disabled: _this2.props.disabled || child.props.disabled,
|
|
159
|
-
isError: _this2.props.isError,
|
|
160
138
|
error: _this2.props.error,
|
|
161
139
|
isFocused: _this2.state.focusedRadioIndex === index,
|
|
162
140
|
isFocusVisible: _this2.state.isFocusVisible,
|
|
@@ -171,9 +149,7 @@ var StatelessRadioGroup = /*#__PURE__*/function (_React$Component) {
|
|
|
171
149
|
},
|
|
172
150
|
onChange: _this2.props.onChange,
|
|
173
151
|
onMouseEnter: _this2.props.onMouseEnter,
|
|
174
|
-
onMouseLeave: _this2.props.onMouseLeave
|
|
175
|
-
// will need to remove overrides pass-through on next major version
|
|
176
|
-
overrides: _objectSpread(_objectSpread({}, _this2.props.overrides), child.props.overrides)
|
|
152
|
+
onMouseLeave: _this2.props.onMouseLeave
|
|
177
153
|
});
|
|
178
154
|
}));
|
|
179
155
|
}
|
|
@@ -189,7 +165,6 @@ _defineProperty(StatelessRadioGroup, "defaultProps", {
|
|
|
189
165
|
autoFocus: false,
|
|
190
166
|
labelPlacement: 'right',
|
|
191
167
|
align: 'vertical',
|
|
192
|
-
isError: false,
|
|
193
168
|
error: false,
|
|
194
169
|
required: false,
|
|
195
170
|
onChange: function onChange() {},
|
|
@@ -26,16 +26,15 @@ function getOuterColor(props) {
|
|
|
26
26
|
$disabled = props.$disabled,
|
|
27
27
|
$checked = props.$checked,
|
|
28
28
|
$isFocusVisible = props.$isFocusVisible,
|
|
29
|
-
$error = props.$error
|
|
30
|
-
$isError = props.$isError;
|
|
29
|
+
$error = props.$error;
|
|
31
30
|
if ($disabled) return colors.tickFillDisabled;
|
|
32
31
|
|
|
33
32
|
if (!$checked) {
|
|
34
33
|
if ($isFocusVisible) return colors.borderSelected;
|
|
35
|
-
if ($error
|
|
34
|
+
if ($error) return colors.tickBorderError;
|
|
36
35
|
return colors.tickBorder;
|
|
37
36
|
} else {
|
|
38
|
-
if ($error
|
|
37
|
+
if ($error) {
|
|
39
38
|
switch (getState(props)) {
|
|
40
39
|
case DEFAULT:
|
|
41
40
|
return colors.tickFillErrorSelected;
|
|
@@ -71,7 +70,7 @@ function getInnerColor(props) {
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
if (!props.$checked) {
|
|
74
|
-
if (props.$error
|
|
73
|
+
if (props.$error) {
|
|
75
74
|
switch (getState(props)) {
|
|
76
75
|
case DEFAULT:
|
|
77
76
|
return colors.tickFillError;
|