baseui 11.0.3 → 11.1.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.
- package/a11y/index.d.ts +1 -1
- package/accordion/index.d.ts +25 -28
- package/app-nav-bar/app-nav-bar.js +33 -40
- package/app-nav-bar/app-nav-bar.js.flow +46 -62
- package/app-nav-bar/index.d.ts +9 -8
- package/app-nav-bar/styled-components.js +83 -29
- package/app-nav-bar/styled-components.js.flow +59 -9
- package/app-nav-bar/types.js.flow +2 -0
- package/aspect-ratio-box/index.d.ts +2 -4
- package/avatar/index.d.ts +6 -12
- package/badge/badge.js +109 -0
- package/badge/badge.js.flow +91 -0
- package/badge/constants.js +54 -0
- package/badge/constants.js.flow +52 -0
- package/badge/hint-dot.js +96 -0
- package/badge/hint-dot.js.flow +68 -0
- package/badge/index.d.ts +97 -0
- package/badge/index.js +80 -0
- package/badge/index.js.flow +20 -0
- package/badge/notification-circle.js +103 -0
- package/badge/notification-circle.js.flow +81 -0
- package/badge/package.json +4 -0
- package/badge/styled-components.js +242 -0
- package/badge/styled-components.js.flow +325 -0
- package/badge/types.js +11 -0
- package/badge/types.js.flow +59 -0
- package/badge/utils.js +33 -0
- package/badge/utils.js.flow +23 -0
- package/banner/banner.js +283 -0
- package/banner/banner.js.flow +253 -0
- package/banner/constants.js +35 -0
- package/banner/constants.js.flow +33 -0
- package/banner/index.d.ts +75 -0
- package/banner/index.js +44 -0
- package/banner/index.js.flow +16 -0
- package/banner/package.json +4 -0
- package/banner/styled-components.js +131 -0
- package/banner/styled-components.js.flow +119 -0
- package/banner/types.js +11 -0
- package/banner/types.js.flow +66 -0
- package/block/index.d.ts +4 -4
- package/breadcrumbs/breadcrumbs.js +5 -1
- package/breadcrumbs/breadcrumbs.js.flow +2 -2
- package/breadcrumbs/index.d.ts +5 -5
- package/button/button.js +2 -1
- package/button/button.js.flow +1 -0
- package/button/index.d.ts +19 -29
- package/button-group/index.d.ts +18 -24
- package/card/index.d.ts +16 -14
- package/checkbox/index.d.ts +17 -21
- package/combobox/index.d.ts +7 -11
- package/data-table/index.d.ts +7 -10
- package/datepicker/index.d.ts +42 -63
- package/datepicker/utils/date-helpers.js +1 -1
- package/datepicker/utils/date-helpers.js.flow +1 -1
- package/dnd-list/index.d.ts +22 -35
- package/drawer/index.d.ts +22 -27
- package/es/app-nav-bar/app-nav-bar.js +9 -19
- package/es/app-nav-bar/styled-components.js +64 -13
- package/es/badge/badge.js +70 -0
- package/es/badge/constants.js +42 -0
- package/es/badge/hint-dot.js +55 -0
- package/es/badge/index.js +11 -0
- package/es/badge/notification-circle.js +65 -0
- package/es/badge/styled-components.js +296 -0
- package/es/badge/types.js +8 -0
- package/es/badge/utils.js +17 -0
- package/es/banner/banner.js +213 -0
- package/es/banner/constants.js +24 -0
- package/es/banner/index.js +9 -0
- package/es/banner/styled-components.js +122 -0
- package/es/banner/types.js +8 -0
- package/es/breadcrumbs/breadcrumbs.js +5 -1
- package/es/button/button.js +1 -0
- package/es/datepicker/utils/date-helpers.js +1 -1
- package/es/file-uploader/file-uploader.js +8 -5
- package/es/helper/helper-steps.js +3 -1
- package/es/input/base-input.js +18 -11
- package/es/input/input.js +15 -10
- package/es/input/masked-input.js +5 -2
- package/es/input/utils.js +4 -2
- package/es/locale/tr_TR.js +115 -0
- package/es/notification/notification.js +16 -1
- package/es/payment-card/custom-cards.config.js +22 -0
- package/es/payment-card/icons/uatp.js +52 -0
- package/es/payment-card/payment-card.js +8 -3
- package/es/popover/popover.js +2 -1
- package/es/popover/stateful-container.js +2 -0
- package/es/popover/styled-components.js +2 -1
- package/es/progress-steps/numbered-step.js +2 -2
- package/es/select/select-component.js +38 -21
- package/es/table-semantic/styled-components.js +14 -0
- package/es/table-semantic/table-builder.js +12 -5
- package/es/textarea/textarea.js +15 -9
- package/es/themes/dark-theme/color-component-tokens.js +8 -0
- package/es/themes/light-theme/color-component-tokens.js +8 -0
- package/es/tree-view/tree-label.js +9 -1
- package/esm/app-nav-bar/app-nav-bar.js +32 -38
- package/esm/app-nav-bar/styled-components.js +79 -28
- package/esm/badge/badge.js +97 -0
- package/esm/badge/constants.js +42 -0
- package/esm/badge/hint-dot.js +83 -0
- package/esm/badge/index.js +11 -0
- package/esm/badge/notification-circle.js +91 -0
- package/esm/badge/styled-components.js +235 -0
- package/esm/badge/types.js +8 -0
- package/esm/badge/utils.js +17 -0
- package/esm/banner/banner.js +271 -0
- package/esm/banner/constants.js +24 -0
- package/esm/banner/index.js +9 -0
- package/esm/banner/styled-components.js +113 -0
- package/esm/banner/types.js +8 -0
- package/esm/breadcrumbs/breadcrumbs.js +5 -1
- package/esm/button/button.js +2 -1
- package/esm/datepicker/utils/date-helpers.js +1 -1
- package/esm/file-uploader/file-uploader.js +23 -8
- package/esm/helper/helper-steps.js +3 -1
- package/esm/input/base-input.js +18 -11
- package/esm/input/input.js +15 -10
- package/esm/input/masked-input.js +6 -3
- package/esm/input/utils.js +4 -2
- package/esm/locale/tr_TR.js +115 -0
- package/esm/notification/notification.js +17 -1
- package/esm/payment-card/custom-cards.config.js +22 -0
- package/esm/payment-card/icons/uatp.js +53 -0
- package/esm/payment-card/payment-card.js +9 -7
- package/esm/popover/popover.js +2 -1
- package/esm/popover/stateful-container.js +2 -0
- package/esm/popover/styled-components.js +3 -2
- package/esm/progress-steps/numbered-step.js +2 -2
- package/esm/select/select-component.js +75 -57
- package/esm/table-semantic/styled-components.js +31 -18
- package/esm/table-semantic/table-builder.js +34 -23
- package/esm/textarea/textarea.js +15 -9
- package/esm/themes/dark-theme/color-component-tokens.js +8 -0
- package/esm/themes/light-theme/color-component-tokens.js +8 -0
- package/esm/tree-view/tree-label.js +10 -2
- package/file-uploader/file-uploader.js +23 -8
- package/file-uploader/file-uploader.js.flow +18 -5
- package/file-uploader/index.d.ts +11 -11
- package/file-uploader/types.js.flow +3 -0
- package/flex-grid/index.d.ts +3 -3
- package/form-control/index.d.ts +7 -19
- package/header-navigation/index.d.ts +8 -9
- package/heading/index.d.ts +3 -4
- package/helper/helper-steps.js +19 -13
- package/helper/helper-steps.js.flow +3 -1
- package/helper/index.d.ts +7 -7
- package/helpers/base-provider.d.ts +16 -0
- package/helpers/overrides.d.ts +23 -0
- package/icon/index.d.ts +32 -32
- package/index.d.ts +34 -99
- package/input/base-input.js +18 -11
- package/input/base-input.js.flow +18 -6
- package/input/index.d.ts +29 -32
- package/input/input.js +15 -10
- package/input/input.js.flow +10 -5
- package/input/masked-input.js +6 -3
- package/input/masked-input.js.flow +3 -0
- package/input/types.js.flow +4 -0
- package/input/utils.js +4 -2
- package/input/utils.js.flow +2 -1
- package/layer/index.d.ts +6 -11
- package/layout-grid/index.d.ts +25 -7
- package/link/index.d.ts +2 -2
- package/list/index.d.ts +26 -31
- package/{locale.ts → locale/index.d.ts} +8 -0
- package/locale/tr_TR.js +123 -0
- package/locale/tr_TR.js.flow +124 -0
- package/map-marker/index.d.ts +41 -47
- package/menu/index.d.ts +27 -37
- package/modal/index.d.ts +28 -38
- package/notification/index.d.ts +2 -3
- package/notification/notification.js +18 -1
- package/notification/notification.js.flow +15 -1
- package/overrides.ts +2 -22
- package/package.json +26 -17
- package/pagination/index.d.ts +22 -26
- package/payment-card/custom-cards.config.js +30 -0
- package/payment-card/custom-cards.config.js.flow +29 -0
- package/payment-card/icons/uatp.js +67 -0
- package/payment-card/icons/uatp.js.flow +62 -0
- package/payment-card/index.d.ts +8 -8
- package/payment-card/payment-card.js +12 -7
- package/payment-card/payment-card.js.flow +12 -0
- package/phone-input/index.d.ts +261 -269
- package/pin-code/index.d.ts +11 -18
- package/popover/index.d.ts +39 -55
- package/popover/popover.js +2 -1
- package/popover/popover.js.flow +2 -1
- package/popover/stateful-container.js +2 -0
- package/popover/stateful-container.js.flow +2 -0
- package/popover/styled-components.js +3 -2
- package/popover/styled-components.js.flow +2 -1
- package/popover/types.js.flow +1 -0
- package/progress-bar/index.d.ts +11 -12
- package/progress-steps/index.d.ts +16 -16
- package/progress-steps/numbered-step.js.flow +2 -2
- package/radio/index.d.ts +12 -15
- package/rating/index.d.ts +9 -12
- package/select/index.d.ts +33 -36
- package/select/select-component.js +72 -54
- package/select/select-component.js.flow +35 -30
- package/side-navigation/index.d.ts +11 -13
- package/skeleton/index.d.ts +1 -1
- package/slider/index.d.ts +17 -26
- package/snackbar/index.d.ts +8 -8
- package/spinner/index.d.ts +2 -2
- package/styles/index.d.ts +82 -2
- package/table/index.d.ts +16 -16
- package/table-grid/index.d.ts +6 -8
- package/table-semantic/index.d.ts +26 -32
- package/table-semantic/styled-components.js +33 -19
- package/table-semantic/styled-components.js.flow +12 -0
- package/table-semantic/table-builder.js +38 -22
- package/table-semantic/table-builder.js.flow +32 -17
- package/table-semantic/types.js.flow +1 -0
- package/tabs/index.d.ts +20 -23
- package/tabs-motion/index.d.ts +23 -23
- package/tag/index.d.ts +14 -18
- package/textarea/index.d.ts +11 -14
- package/textarea/textarea.js +15 -9
- package/textarea/textarea.js.flow +11 -5
- package/textarea/types.js.flow +1 -0
- package/theme.ts +36 -777
- package/themes/dark-theme/color-component-tokens.js +8 -0
- package/themes/dark-theme/color-component-tokens.js.flow +9 -0
- package/themes/index.d.ts +765 -0
- package/themes/light-theme/color-component-tokens.js +8 -0
- package/themes/light-theme/color-component-tokens.js.flow +9 -0
- package/themes/types.js.flow +9 -0
- package/timepicker/index.d.ts +5 -8
- package/timezonepicker/index.d.ts +5 -8
- package/toast/index.d.ts +26 -40
- package/tokens/index.d.ts +1 -1
- package/tooltip/index.d.ts +7 -9
- package/tree-view/index.d.ts +15 -19
- package/tree-view/tree-label.js +10 -2
- package/tree-view/tree-label.js.flow +4 -4
- package/typography/index.d.ts +37 -37
package/index.d.ts
CHANGED
|
@@ -1,99 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
C extends keyof JSX.IntrinsicElements | React.ComponentType<any>,
|
|
36
|
-
T = Theme
|
|
37
|
-
>(
|
|
38
|
-
component: C,
|
|
39
|
-
styledFn: StyleObject | ((props: { $theme: T } & P) => StyleObject)
|
|
40
|
-
): StyletronComponent<
|
|
41
|
-
Pick<React.ComponentProps<C>, Exclude<keyof React.ComponentProps<C>, { className: string }>> & P
|
|
42
|
-
>;
|
|
43
|
-
export function withStyle<C extends StyletronComponent<any>, P extends object, T = Theme>(
|
|
44
|
-
component: C,
|
|
45
|
-
styledFn: StyleObject | ((props: { $theme: T } & P) => StyleObject)
|
|
46
|
-
): StyletronComponent<React.ComponentProps<C> & P>;
|
|
47
|
-
|
|
48
|
-
export { Theme } from 'baseui/theme';
|
|
49
|
-
export const LightTheme: Theme;
|
|
50
|
-
export const LightThemeMove: Theme;
|
|
51
|
-
export const lightThemePrimitives: ThemePrimitives;
|
|
52
|
-
export const DarkTheme: Theme;
|
|
53
|
-
export const DarkThemeMove: Theme;
|
|
54
|
-
export const darkThemePrimitives: ThemePrimitives;
|
|
55
|
-
|
|
56
|
-
export interface BaseProviderOverrides {
|
|
57
|
-
AppContainer?: Override<any>;
|
|
58
|
-
LayersContainer?: Override<any>;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface BaseProviderProps {
|
|
62
|
-
children: React.ReactNode;
|
|
63
|
-
theme: Theme;
|
|
64
|
-
overrides?: BaseProviderOverrides;
|
|
65
|
-
zIndex?: number;
|
|
66
|
-
}
|
|
67
|
-
export const BaseProvider: React.FC<BaseProviderProps>;
|
|
68
|
-
|
|
69
|
-
export interface LocaleProviderProps {
|
|
70
|
-
locale: Partial<Locale>;
|
|
71
|
-
children?: React.ReactNode;
|
|
72
|
-
}
|
|
73
|
-
export const LocaleProvider: React.FC<LocaleProviderProps>;
|
|
74
|
-
|
|
75
|
-
export interface ThemeProviderProps {
|
|
76
|
-
theme: Theme;
|
|
77
|
-
children?: React.ReactNode;
|
|
78
|
-
}
|
|
79
|
-
export const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
80
|
-
|
|
81
|
-
export interface StyledFn<T> extends StyletronStyledFn {
|
|
82
|
-
<C extends keyof JSX.IntrinsicElements | React.ComponentType<any>, P extends object>(
|
|
83
|
-
component: C,
|
|
84
|
-
style: (props: { $theme: T } & P) => StyleObject
|
|
85
|
-
): StyletronComponent<
|
|
86
|
-
Pick<React.ComponentProps<C>, Exclude<keyof React.ComponentProps<C>, { className: string }>> & P
|
|
87
|
-
>;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function createThemedStyled<Theme>(): StyledFn<Theme>;
|
|
91
|
-
|
|
92
|
-
export interface WithStyleFn<T = Theme> extends StyletronWithStyleFn {
|
|
93
|
-
<C extends StyletronComponent<any>, P extends object, T1 = T>(
|
|
94
|
-
component: C,
|
|
95
|
-
style: (props: P & { $theme: T1 }) => StyleObject
|
|
96
|
-
): StyletronComponent<React.ComponentProps<C> & P>;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function createThemedWithStyle<Theme>(): WithStyleFn<Theme>;
|
|
1
|
+
export {
|
|
2
|
+
createThemedUseStyletron,
|
|
3
|
+
useStyletron,
|
|
4
|
+
withWrapper,
|
|
5
|
+
styled,
|
|
6
|
+
withStyle,
|
|
7
|
+
createThemedStyled,
|
|
8
|
+
createThemedWithStyle,
|
|
9
|
+
type StyledFn,
|
|
10
|
+
type WithStyleFn,
|
|
11
|
+
type ThemeProviderProps,
|
|
12
|
+
ThemeProvider,
|
|
13
|
+
type Theme,
|
|
14
|
+
} from './styles';
|
|
15
|
+
|
|
16
|
+
export { type LocaleProviderProps, LocaleProvider } from './locale';
|
|
17
|
+
export { createTheme, createLightTheme, createDarkTheme } from './themes';
|
|
18
|
+
|
|
19
|
+
export { mergeOverrides } from './helpers/overrides';
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
LightTheme,
|
|
23
|
+
LightThemeMove,
|
|
24
|
+
lightThemePrimitives,
|
|
25
|
+
DarkTheme,
|
|
26
|
+
DarkThemeMove,
|
|
27
|
+
darkThemePrimitives,
|
|
28
|
+
} from './themes';
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
type BaseProviderOverrides,
|
|
32
|
+
type BaseProviderProps,
|
|
33
|
+
BaseProvider,
|
|
34
|
+
} from './helpers/base-provider';
|
package/input/base-input.js
CHANGED
|
@@ -98,7 +98,7 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
_defineProperty(_assertThisInitialized(_this), "onInputKeyDown", function (e) {
|
|
101
|
-
if (_this.props.clearOnEscape && e.key === 'Escape' && _this.inputRef.current) {
|
|
101
|
+
if (_this.props.clearOnEscape && e.key === 'Escape' && _this.inputRef.current && !_this.props.readOnly) {
|
|
102
102
|
_this.clearValue(); // prevent event from closing modal or doing something unexpected
|
|
103
103
|
|
|
104
104
|
|
|
@@ -113,19 +113,23 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
_defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
|
|
116
|
-
_this.
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
if (!_this.props.readOnly) {
|
|
117
|
+
_this.setState({
|
|
118
|
+
isFocused: true
|
|
119
|
+
});
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
_this.props.onFocus(e);
|
|
122
|
+
}
|
|
121
123
|
});
|
|
122
124
|
|
|
123
125
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
|
|
124
|
-
_this.
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
if (!_this.props.readOnly) {
|
|
127
|
+
_this.setState({
|
|
128
|
+
isFocused: false
|
|
129
|
+
});
|
|
127
130
|
|
|
128
|
-
|
|
131
|
+
_this.props.onBlur(e);
|
|
132
|
+
}
|
|
129
133
|
});
|
|
130
134
|
|
|
131
135
|
_defineProperty(_assertThisInitialized(_this), "handleFocusForMaskToggle", function (event) {
|
|
@@ -280,10 +284,11 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
280
284
|
clearable = _this$props2.clearable,
|
|
281
285
|
value = _this$props2.value,
|
|
282
286
|
disabled = _this$props2.disabled,
|
|
287
|
+
readOnly = _this$props2.readOnly,
|
|
283
288
|
_this$props2$override = _this$props2.overrides,
|
|
284
289
|
overrides = _this$props2$override === void 0 ? {} : _this$props2$override;
|
|
285
290
|
|
|
286
|
-
if (disabled || !clearable || value == null || typeof value === 'string' && value.length === 0) {
|
|
291
|
+
if (disabled || readOnly || !clearable || value == null || typeof value === 'string' && value.length === 0) {
|
|
287
292
|
return null;
|
|
288
293
|
}
|
|
289
294
|
|
|
@@ -373,6 +378,7 @@ var BaseInput = /*#__PURE__*/function (_React$Component) {
|
|
|
373
378
|
"aria-required": this.props.required,
|
|
374
379
|
autoComplete: autoComplete,
|
|
375
380
|
disabled: this.props.disabled,
|
|
381
|
+
readOnly: this.props.readOnly,
|
|
376
382
|
id: this.props.id,
|
|
377
383
|
inputMode: this.props.inputMode,
|
|
378
384
|
maxLength: this.props.maxLength,
|
|
@@ -432,7 +438,8 @@ _defineProperty(BaseInput, "defaultProps", {
|
|
|
432
438
|
required: false,
|
|
433
439
|
role: null,
|
|
434
440
|
size: _constants.SIZE.default,
|
|
435
|
-
type: 'text'
|
|
441
|
+
type: 'text',
|
|
442
|
+
readOnly: false
|
|
436
443
|
});
|
|
437
444
|
|
|
438
445
|
var _default = BaseInput;
|
package/input/base-input.js.flow
CHANGED
|
@@ -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 (
|
|
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.
|
|
135
|
-
|
|
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.
|
|
140
|
-
|
|
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
|
|
5
|
+
export declare const STATE_CHANGE_TYPE: {
|
|
6
6
|
change: 'change';
|
|
7
|
-
}
|
|
8
|
-
export
|
|
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
|
|
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
|
|
21
|
+
export declare const CUSTOM_INPUT_TYPE: {
|
|
22
22
|
textarea: 'textarea';
|
|
23
|
-
}
|
|
23
|
+
};
|
|
24
24
|
|
|
25
|
-
export
|
|
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.
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
if (!_this.props.readOnly) {
|
|
90
|
+
_this.setState({
|
|
91
|
+
isFocused: true
|
|
92
|
+
});
|
|
92
93
|
|
|
93
|
-
|
|
94
|
+
_this.props.onFocus(e);
|
|
95
|
+
}
|
|
94
96
|
});
|
|
95
97
|
|
|
96
98
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (e) {
|
|
97
|
-
_this.
|
|
98
|
-
|
|
99
|
-
|
|
99
|
+
if (!_this.props.readOnly) {
|
|
100
|
+
_this.setState({
|
|
101
|
+
isFocused: false
|
|
102
|
+
});
|
|
100
103
|
|
|
101
|
-
|
|
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) {
|
package/input/input.js.flow
CHANGED
|
@@ -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.
|
|
43
|
-
|
|
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.
|
|
48
|
-
|
|
50
|
+
if (!this.props.readOnly) {
|
|
51
|
+
this.setState({ isFocused: false });
|
|
52
|
+
this.props.onBlur(e);
|
|
53
|
+
}
|
|
49
54
|
};
|
|
50
55
|
|
|
51
56
|
render() {
|
package/input/masked-input.js
CHANGED
|
@@ -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
|
-
|
|
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
|
)}
|
package/input/types.js.flow
CHANGED
|
@@ -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
|
}
|
package/input/utils.js.flow
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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>;
|
package/layout-grid/index.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {StyletronComponent} from 'styletron-react';
|
|
3
|
-
import {
|
|
4
|
-
|
|
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>;
|