baseui 10.7.2 → 10.9.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/a11y/a11y.js +2 -2
- package/a11y/a11y.js.flow +3 -3
- package/button/styled-components.js +47 -18
- package/button/styled-components.js.flow +25 -5
- package/combobox/combobox.js +6 -3
- package/combobox/combobox.js.flow +4 -2
- package/combobox/types.js.flow +2 -0
- package/data-table/column-categorical.js +1 -1
- package/data-table/column-categorical.js.flow +2 -2
- package/data-table/column-numerical.js +307 -355
- package/data-table/column-numerical.js.flow +273 -287
- package/data-table/constants.js +17 -11
- package/data-table/constants.js.flow +11 -8
- package/data-table/data-table.js +53 -50
- package/data-table/data-table.js.flow +18 -13
- package/data-table/filter-shell.js +27 -4
- package/data-table/filter-shell.js.flow +33 -9
- package/data-table/locale.js +4 -2
- package/data-table/locale.js.flow +6 -2
- package/data-table/measure-column-widths.js +83 -121
- package/data-table/measure-column-widths.js.flow +87 -109
- package/datepicker/styled-components.js +1 -1
- package/datepicker/styled-components.js.flow +4 -1
- package/drawer/drawer.js +3 -1
- package/drawer/drawer.js.flow +7 -1
- package/es/a11y/a11y.js +2 -2
- package/es/button/styled-components.js +32 -2
- package/es/combobox/combobox.js +6 -3
- package/es/data-table/column-categorical.js +2 -2
- package/es/data-table/column-numerical.js +245 -317
- package/es/data-table/constants.js +12 -8
- package/es/data-table/data-table.js +18 -16
- package/es/data-table/filter-shell.js +26 -4
- package/es/data-table/locale.js +4 -2
- package/es/data-table/measure-column-widths.js +75 -86
- package/es/datepicker/styled-components.js +1 -1
- package/es/drawer/drawer.js +3 -1
- package/es/index.js +1 -1
- package/es/map-marker/badge-enhancer.js +61 -0
- package/es/map-marker/constants.js +146 -2
- package/es/map-marker/drag-shadow.js +32 -0
- package/es/map-marker/fixed-marker.js +54 -48
- package/es/map-marker/floating-marker.js +21 -12
- package/es/map-marker/index.js +1 -1
- package/es/map-marker/label-enhancer.js +39 -0
- package/es/map-marker/needle.js +26 -0
- package/es/map-marker/pin-head.js +42 -40
- package/es/map-marker/styled-components.js +177 -32
- package/es/map-marker/types.js +1 -1
- package/es/menu/maybe-child-menu.js +0 -2
- package/es/menu/nested-menus.js +49 -3
- package/es/menu/stateful-container.js +13 -12
- package/es/modal/modal.js +3 -1
- package/es/popover/popover.js +7 -3
- package/es/progress-bar/index.js +1 -1
- package/es/progress-bar/progressbar.js +25 -10
- package/es/progress-bar/styled-components.js +9 -5
- package/es/select/select-component.js +2 -10
- package/es/spinner/styled-components.js +34 -16
- package/es/table/filter.js +3 -1
- package/es/themes/dark-theme/color-component-tokens.js +19 -10
- package/es/themes/light-theme/color-component-tokens.js +19 -10
- package/es/timezonepicker/timezone-picker.js +53 -36
- package/es/timezonepicker/tzdata.js +2 -0
- package/es/timezonepicker/update-tzdata.js +69 -0
- package/es/toast/styled-components.js +18 -7
- package/esm/a11y/a11y.js +3 -3
- package/esm/button/styled-components.js +47 -18
- package/esm/combobox/combobox.js +6 -3
- package/esm/data-table/column-categorical.js +2 -2
- package/esm/data-table/column-numerical.js +304 -353
- package/esm/data-table/constants.js +12 -8
- package/esm/data-table/data-table.js +53 -50
- package/esm/data-table/filter-shell.js +26 -4
- package/esm/data-table/locale.js +4 -2
- package/esm/data-table/measure-column-widths.js +83 -121
- package/esm/datepicker/styled-components.js +1 -1
- package/esm/drawer/drawer.js +3 -1
- package/esm/index.js +1 -1
- package/esm/map-marker/badge-enhancer.js +79 -0
- package/esm/map-marker/constants.js +94 -4
- package/esm/map-marker/drag-shadow.js +53 -0
- package/esm/map-marker/fixed-marker.js +84 -80
- package/esm/map-marker/floating-marker.js +22 -13
- package/esm/map-marker/index.js +1 -1
- package/esm/map-marker/label-enhancer.js +60 -0
- package/esm/map-marker/needle.js +43 -0
- package/esm/map-marker/pin-head.js +77 -66
- package/esm/map-marker/styled-components.js +182 -51
- package/esm/map-marker/types.js +1 -1
- package/esm/menu/maybe-child-menu.js +0 -2
- package/esm/menu/nested-menus.js +66 -5
- package/esm/menu/stateful-container.js +15 -13
- package/esm/modal/modal.js +3 -1
- package/esm/popover/popover.js +7 -3
- package/esm/progress-bar/index.js +1 -1
- package/esm/progress-bar/progressbar.js +32 -10
- package/esm/progress-bar/styled-components.js +9 -4
- package/esm/select/select-component.js +2 -11
- package/esm/spinner/styled-components.js +35 -16
- package/esm/table/filter.js +3 -1
- package/esm/themes/dark-theme/color-component-tokens.js +19 -10
- package/esm/themes/light-theme/color-component-tokens.js +19 -10
- package/esm/timezonepicker/timezone-picker.js +64 -36
- package/esm/timezonepicker/tzdata.js +2 -0
- package/esm/timezonepicker/update-tzdata.js +160 -0
- package/esm/toast/styled-components.js +13 -5
- package/index.js +6 -0
- package/index.js.flow +1 -1
- package/map-marker/badge-enhancer.js +90 -0
- package/map-marker/badge-enhancer.js.flow +86 -0
- package/map-marker/constants.js +103 -5
- package/map-marker/constants.js.flow +152 -0
- package/map-marker/drag-shadow.js +64 -0
- package/map-marker/drag-shadow.js.flow +52 -0
- package/map-marker/fixed-marker.js +84 -78
- package/map-marker/fixed-marker.js.flow +78 -66
- package/map-marker/floating-marker.js +22 -13
- package/map-marker/floating-marker.js.flow +30 -17
- package/map-marker/index.d.ts +125 -24
- package/map-marker/index.js +18 -0
- package/map-marker/index.js.flow +3 -0
- package/map-marker/label-enhancer.js +71 -0
- package/map-marker/label-enhancer.js.flow +63 -0
- package/map-marker/needle.js +54 -0
- package/map-marker/needle.js.flow +29 -0
- package/map-marker/pin-head.js +80 -69
- package/map-marker/pin-head.js.flow +122 -84
- package/map-marker/styled-components.js +200 -62
- package/map-marker/styled-components.js.flow +172 -22
- package/map-marker/types.js.flow +69 -20
- package/menu/index.d.ts +9 -4
- package/menu/maybe-child-menu.js +0 -2
- package/menu/maybe-child-menu.js.flow +0 -2
- package/menu/nested-menus.js +66 -5
- package/menu/nested-menus.js.flow +50 -5
- package/menu/stateful-container.js +15 -13
- package/menu/stateful-container.js.flow +19 -13
- package/menu/types.js.flow +7 -1
- package/modal/modal.js +3 -1
- package/modal/modal.js.flow +2 -0
- package/package.json +5 -4
- package/popover/popover.js +7 -3
- package/popover/popover.js.flow +23 -17
- package/progress-bar/index.d.ts +2 -0
- package/progress-bar/index.js +6 -0
- package/progress-bar/index.js.flow +1 -0
- package/progress-bar/progressbar.js +32 -10
- package/progress-bar/progressbar.js.flow +35 -9
- package/progress-bar/styled-components.js +9 -4
- package/progress-bar/styled-components.js.flow +15 -4
- package/progress-bar/types.js.flow +12 -2
- package/select/select-component.js +2 -11
- package/select/select-component.js.flow +5 -7
- package/spinner/styled-components.js +35 -16
- package/spinner/styled-components.js.flow +37 -19
- package/spinner/types.js.flow +10 -0
- package/styles/index.js.flow +1 -1
- package/table/filter.js +3 -1
- package/table/filter.js.flow +5 -1
- package/themes/dark-theme/color-component-tokens.js +19 -10
- package/themes/dark-theme/color-component-tokens.js.flow +19 -10
- package/themes/light-theme/color-component-tokens.js +19 -10
- package/themes/light-theme/color-component-tokens.js.flow +19 -10
- package/themes/types.js.flow +9 -0
- package/timezonepicker/timezone-picker.js +69 -41
- package/timezonepicker/timezone-picker.js.flow +52 -46
- package/timezonepicker/types.js.flow +1 -1
- package/timezonepicker/tzdata.js +10 -0
- package/timezonepicker/tzdata.js.flow +347 -0
- package/timezonepicker/update-tzdata.js +164 -0
- package/timezonepicker/update-tzdata.js.flow +70 -0
- package/toast/styled-components.js +13 -5
- package/toast/styled-components.js.flow +17 -7
package/popover/popover.js.flow
CHANGED
|
@@ -470,23 +470,29 @@ class PopoverInner extends React.Component<
|
|
|
470
470
|
onPopperUpdate={this.onPopperUpdate}
|
|
471
471
|
placement={this.state.placement}
|
|
472
472
|
>
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
473
|
+
{this.props.focusLock ? (
|
|
474
|
+
<FocusLock
|
|
475
|
+
disabled={!this.props.focusLock}
|
|
476
|
+
noFocusGuards={false}
|
|
477
|
+
// see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
478
|
+
returnFocus={!this.isHoverTrigger() && this.props.returnFocus}
|
|
479
|
+
autoFocus={this.state.autoFocusAfterPositioning}
|
|
480
|
+
// Allow focus to escape when UI is within an iframe
|
|
481
|
+
crossFrame={false}
|
|
482
|
+
focusOptions={this.props.focusOptions}
|
|
483
|
+
>
|
|
484
|
+
{this.renderPopover(renderedContent)}
|
|
485
|
+
</FocusLock>
|
|
486
|
+
) : (
|
|
487
|
+
<MoveFocusInside
|
|
488
|
+
disabled={
|
|
489
|
+
!this.props.autoFocus &&
|
|
490
|
+
!this.state.autoFocusAfterPositioning
|
|
491
|
+
}
|
|
492
|
+
>
|
|
493
|
+
{this.renderPopover(renderedContent)}
|
|
494
|
+
</MoveFocusInside>
|
|
495
|
+
)}
|
|
490
496
|
</TetherBehavior>
|
|
491
497
|
</Layer>,
|
|
492
498
|
);
|
package/progress-bar/index.d.ts
CHANGED
package/progress-bar/index.js
CHANGED
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "StyledBarProgress", {
|
|
|
45
45
|
return _styledComponents.StyledBarProgress;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "StyledInfiniteBar", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _styledComponents.StyledInfiniteBar;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "StyledLabel", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function get() {
|
|
@@ -33,6 +33,10 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
33
33
|
|
|
34
34
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
35
35
|
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
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; }
|
|
39
|
+
|
|
36
40
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
41
|
|
|
38
42
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -88,9 +92,16 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
88
92
|
size = _this$props.size,
|
|
89
93
|
steps = _this$props.steps,
|
|
90
94
|
successValue = _this$props.successValue,
|
|
95
|
+
minValue = _this$props.minValue,
|
|
96
|
+
maxValue = _this$props.maxValue,
|
|
91
97
|
showLabel = _this$props.showLabel,
|
|
92
98
|
infinite = _this$props.infinite,
|
|
93
|
-
errorMessage = _this$props.errorMessage
|
|
99
|
+
errorMessage = _this$props.errorMessage,
|
|
100
|
+
forwardedRef = _this$props.forwardedRef,
|
|
101
|
+
restProps = _objectWithoutProperties(_this$props, ["ariaLabel", "overrides", "getProgressLabel", "value", "size", "steps", "successValue", "minValue", "maxValue", "showLabel", "infinite", "errorMessage", "forwardedRef"]); // fallback on successValue (and it's default) if maxValue is not set by user
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var maximumValue = maxValue !== 100 ? maxValue : successValue;
|
|
94
105
|
|
|
95
106
|
var _getOverrides = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledRoot),
|
|
96
107
|
_getOverrides2 = _slicedToArray(_getOverrides, 2),
|
|
@@ -126,7 +137,9 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
126
137
|
$infinite: infinite,
|
|
127
138
|
$size: size,
|
|
128
139
|
$steps: steps,
|
|
129
|
-
$successValue:
|
|
140
|
+
$successValue: maximumValue,
|
|
141
|
+
$minValue: minValue,
|
|
142
|
+
$maxValue: maximumValue,
|
|
130
143
|
$value: value
|
|
131
144
|
};
|
|
132
145
|
|
|
@@ -148,20 +161,21 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
148
161
|
/*#__PURE__*/
|
|
149
162
|
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
150
163
|
React.createElement(Root, _extends({
|
|
164
|
+
ref: forwardedRef,
|
|
151
165
|
"data-baseweb": "progress-bar",
|
|
152
166
|
role: "progressbar",
|
|
153
|
-
"aria-label": ariaLabel || getProgressLabel(value,
|
|
167
|
+
"aria-label": ariaLabel || getProgressLabel(value, maximumValue, minValue),
|
|
154
168
|
"aria-valuenow": infinite ? null : value,
|
|
155
|
-
"aria-valuemin": infinite ? null :
|
|
156
|
-
"aria-valuemax": infinite ? null :
|
|
169
|
+
"aria-valuemin": infinite ? null : minValue,
|
|
170
|
+
"aria-valuemax": infinite ? null : maximumValue,
|
|
157
171
|
"aria-invalid": errorMessage ? true : null,
|
|
158
172
|
"aria-errormessage": errorMessage
|
|
159
|
-
}, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
173
|
+
}, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
160
174
|
$isLeft: true,
|
|
161
175
|
$size: sharedProps.$size
|
|
162
176
|
}, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
163
177
|
$size: sharedProps.$size
|
|
164
|
-
}, infiniteBarProps))) : renderProgressBar()), showLabel && /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), getProgressLabel(value,
|
|
178
|
+
}, infiniteBarProps))) : renderProgressBar()), showLabel && /*#__PURE__*/React.createElement(Label, _extends({}, sharedProps, labelProps), getProgressLabel(value, maximumValue, minValue)))
|
|
165
179
|
);
|
|
166
180
|
}
|
|
167
181
|
}]);
|
|
@@ -170,8 +184,8 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
|
|
|
170
184
|
}(React.Component);
|
|
171
185
|
|
|
172
186
|
_defineProperty(ProgressBar, "defaultProps", {
|
|
173
|
-
getProgressLabel: function getProgressLabel(value,
|
|
174
|
-
return "".concat(Math.round(value /
|
|
187
|
+
getProgressLabel: function getProgressLabel(value, maxValue, minValue) {
|
|
188
|
+
return "".concat(Math.round((value - minValue) / (maxValue - minValue) * 100), "% Loaded");
|
|
175
189
|
},
|
|
176
190
|
infinite: false,
|
|
177
191
|
overrides: {},
|
|
@@ -179,8 +193,16 @@ _defineProperty(ProgressBar, "defaultProps", {
|
|
|
179
193
|
size: _constants.SIZE.medium,
|
|
180
194
|
steps: 1,
|
|
181
195
|
successValue: 100,
|
|
196
|
+
minValue: 0,
|
|
197
|
+
maxValue: 100,
|
|
182
198
|
value: 0
|
|
183
199
|
});
|
|
184
200
|
|
|
185
|
-
var
|
|
201
|
+
var ForwardedProgressBar = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
202
|
+
return /*#__PURE__*/React.createElement(ProgressBar, _extends({
|
|
203
|
+
forwardedRef: ref
|
|
204
|
+
}, props));
|
|
205
|
+
});
|
|
206
|
+
ForwardedProgressBar.displayName = 'ProgressBar';
|
|
207
|
+
var _default = ForwardedProgressBar;
|
|
186
208
|
exports.default = _default;
|
|
@@ -19,16 +19,23 @@ import {
|
|
|
19
19
|
|
|
20
20
|
import type {ProgressBarPropsT} from './types.js';
|
|
21
21
|
|
|
22
|
-
class ProgressBar extends React.Component<
|
|
22
|
+
class ProgressBar extends React.Component<
|
|
23
|
+
// eslint-disable-next-line flowtype/no-weak-types
|
|
24
|
+
ProgressBarPropsT & {forwardedRef: any},
|
|
25
|
+
> {
|
|
23
26
|
static defaultProps = {
|
|
24
|
-
getProgressLabel: (value: number,
|
|
25
|
-
`${Math.round(
|
|
27
|
+
getProgressLabel: (value: number, maxValue: number, minValue: number) =>
|
|
28
|
+
`${Math.round(
|
|
29
|
+
((value - minValue) / (maxValue - minValue)) * 100,
|
|
30
|
+
)}% Loaded`,
|
|
26
31
|
infinite: false,
|
|
27
32
|
overrides: {},
|
|
28
33
|
showLabel: false,
|
|
29
34
|
size: SIZE.medium,
|
|
30
35
|
steps: 1,
|
|
31
36
|
successValue: 100,
|
|
37
|
+
minValue: 0,
|
|
38
|
+
maxValue: 100,
|
|
32
39
|
value: 0,
|
|
33
40
|
};
|
|
34
41
|
|
|
@@ -52,10 +59,16 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
|
|
|
52
59
|
size,
|
|
53
60
|
steps,
|
|
54
61
|
successValue,
|
|
62
|
+
minValue,
|
|
63
|
+
maxValue,
|
|
55
64
|
showLabel,
|
|
56
65
|
infinite,
|
|
57
66
|
errorMessage,
|
|
67
|
+
forwardedRef,
|
|
68
|
+
...restProps
|
|
58
69
|
} = this.props;
|
|
70
|
+
// fallback on successValue (and it's default) if maxValue is not set by user
|
|
71
|
+
const maximumValue = maxValue !== 100 ? maxValue : successValue;
|
|
59
72
|
const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
|
|
60
73
|
const [BarContainer, barContainerProps] = getOverrides(
|
|
61
74
|
overrides.BarContainer,
|
|
@@ -75,7 +88,9 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
|
|
|
75
88
|
$infinite: infinite,
|
|
76
89
|
$size: size,
|
|
77
90
|
$steps: steps,
|
|
78
|
-
$successValue:
|
|
91
|
+
$successValue: maximumValue,
|
|
92
|
+
$minValue: minValue,
|
|
93
|
+
$maxValue: maximumValue,
|
|
79
94
|
$value: value,
|
|
80
95
|
};
|
|
81
96
|
function renderProgressBar() {
|
|
@@ -92,14 +107,18 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
|
|
|
92
107
|
return (
|
|
93
108
|
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
94
109
|
<Root
|
|
110
|
+
ref={forwardedRef}
|
|
95
111
|
data-baseweb="progress-bar"
|
|
96
112
|
role="progressbar"
|
|
97
|
-
aria-label={
|
|
113
|
+
aria-label={
|
|
114
|
+
ariaLabel || getProgressLabel(value, maximumValue, minValue)
|
|
115
|
+
}
|
|
98
116
|
aria-valuenow={infinite ? null : value}
|
|
99
|
-
aria-valuemin={infinite ? null :
|
|
100
|
-
aria-valuemax={infinite ? null :
|
|
117
|
+
aria-valuemin={infinite ? null : minValue}
|
|
118
|
+
aria-valuemax={infinite ? null : maximumValue}
|
|
101
119
|
aria-invalid={errorMessage ? true : null}
|
|
102
120
|
aria-errormessage={errorMessage}
|
|
121
|
+
{...restProps}
|
|
103
122
|
{...sharedProps}
|
|
104
123
|
{...rootProps}
|
|
105
124
|
>
|
|
@@ -119,7 +138,7 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
|
|
|
119
138
|
</BarContainer>
|
|
120
139
|
{showLabel && (
|
|
121
140
|
<Label {...sharedProps} {...labelProps}>
|
|
122
|
-
{getProgressLabel(value,
|
|
141
|
+
{getProgressLabel(value, maximumValue, minValue)}
|
|
123
142
|
</Label>
|
|
124
143
|
)}
|
|
125
144
|
</Root>
|
|
@@ -127,7 +146,14 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
|
|
|
127
146
|
}
|
|
128
147
|
}
|
|
129
148
|
|
|
130
|
-
|
|
149
|
+
const ForwardedProgressBar = React.forwardRef<
|
|
150
|
+
$Shape<ProgressBarPropsT>,
|
|
151
|
+
HTMLDivElement,
|
|
152
|
+
>((props: ProgressBarPropsT, ref) => (
|
|
153
|
+
<ProgressBar forwardedRef={ref} {...props} />
|
|
154
|
+
));
|
|
155
|
+
ForwardedProgressBar.displayName = 'ProgressBar';
|
|
156
|
+
export default ForwardedProgressBar;
|
|
131
157
|
|
|
132
158
|
declare var __DEV__: boolean;
|
|
133
159
|
declare var __NODE__: boolean;
|
|
@@ -80,11 +80,16 @@ var StyledBarProgress = (0, _index.styled)('div', function (props) {
|
|
|
80
80
|
$value = props.$value,
|
|
81
81
|
$successValue = props.$successValue,
|
|
82
82
|
$steps = props.$steps,
|
|
83
|
-
$index = props.$index
|
|
83
|
+
$index = props.$index,
|
|
84
|
+
$maxValue = props.$maxValue,
|
|
85
|
+
_props$$minValue = props.$minValue,
|
|
86
|
+
$minValue = _props$$minValue === void 0 ? 0 : _props$$minValue; // making sure this doesn't break existing use that use StyledBarProgress directly
|
|
87
|
+
|
|
88
|
+
var maxValue = $maxValue ? $maxValue : $successValue;
|
|
84
89
|
var colors = $theme.colors,
|
|
85
90
|
sizing = $theme.sizing,
|
|
86
91
|
borders = $theme.borders;
|
|
87
|
-
var width = "".concat(100 - $value
|
|
92
|
+
var width = "".concat(100 - ($value - $minValue) * 100 / (maxValue - $minValue), "%");
|
|
88
93
|
var stepStates = {
|
|
89
94
|
default: 'default',
|
|
90
95
|
awaits: 'awaits',
|
|
@@ -94,8 +99,8 @@ var StyledBarProgress = (0, _index.styled)('div', function (props) {
|
|
|
94
99
|
var stepState = stepStates.default;
|
|
95
100
|
|
|
96
101
|
if ($steps > 1) {
|
|
97
|
-
var stepValue = $
|
|
98
|
-
var currentValue = $value / $
|
|
102
|
+
var stepValue = (maxValue - $minValue) / $steps;
|
|
103
|
+
var currentValue = ($value - $minValue) / (maxValue - $minValue) * 100;
|
|
99
104
|
var completedSteps = Math.floor(currentValue / stepValue);
|
|
100
105
|
|
|
101
106
|
if ($index < completedSteps) {
|
|
@@ -62,9 +62,20 @@ export const StyledBar = styled<StylePropsT>('div', props => {
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
export const StyledBarProgress = styled<StylePropsT>('div', props => {
|
|
65
|
-
const {
|
|
65
|
+
const {
|
|
66
|
+
$theme,
|
|
67
|
+
$value,
|
|
68
|
+
$successValue,
|
|
69
|
+
$steps,
|
|
70
|
+
$index,
|
|
71
|
+
$maxValue,
|
|
72
|
+
$minValue = 0,
|
|
73
|
+
} = props;
|
|
74
|
+
// making sure this doesn't break existing use that use StyledBarProgress directly
|
|
75
|
+
const maxValue = $maxValue ? $maxValue : $successValue;
|
|
66
76
|
const {colors, sizing, borders} = $theme;
|
|
67
|
-
const width = `${100 -
|
|
77
|
+
const width = `${100 -
|
|
78
|
+
(($value - $minValue) * 100) / (maxValue - $minValue)}%`;
|
|
68
79
|
|
|
69
80
|
const stepStates = {
|
|
70
81
|
default: 'default',
|
|
@@ -74,8 +85,8 @@ export const StyledBarProgress = styled<StylePropsT>('div', props => {
|
|
|
74
85
|
};
|
|
75
86
|
let stepState = stepStates.default;
|
|
76
87
|
if ($steps > 1) {
|
|
77
|
-
const stepValue = $
|
|
78
|
-
const currentValue = ($value / $
|
|
88
|
+
const stepValue = (maxValue - $minValue) / $steps;
|
|
89
|
+
const currentValue = (($value - $minValue) / (maxValue - $minValue)) * 100;
|
|
79
90
|
const completedSteps = Math.floor(currentValue / stepValue);
|
|
80
91
|
if ($index < completedSteps) {
|
|
81
92
|
stepState = stepStates.completed;
|
|
@@ -27,7 +27,11 @@ export type ProgressBarPropsT = {
|
|
|
27
27
|
/** Error message for screen-reader users**/
|
|
28
28
|
errorMessage?: string,
|
|
29
29
|
/** The function that returns a progress bar label to display. */
|
|
30
|
-
getProgressLabel: (
|
|
30
|
+
getProgressLabel: (
|
|
31
|
+
value: number,
|
|
32
|
+
maxValue: number,
|
|
33
|
+
minValue: number,
|
|
34
|
+
) => React.Node,
|
|
31
35
|
/** If set to true, there’s and infinite loading animation. */
|
|
32
36
|
infinite: boolean,
|
|
33
37
|
overrides?: OverridesT,
|
|
@@ -37,8 +41,12 @@ export type ProgressBarPropsT = {
|
|
|
37
41
|
size: SizeT,
|
|
38
42
|
/** Renders a sectional progress bar. Value should be set to a positive number larger than one. */
|
|
39
43
|
steps: number,
|
|
40
|
-
/** A custom completion value. Should be
|
|
44
|
+
/** A custom completion value. Should be replaced by maxValue prop. */
|
|
41
45
|
successValue: number,
|
|
46
|
+
/** Maximum possible value. */
|
|
47
|
+
maxValue: number,
|
|
48
|
+
/** Minimum possible value. */
|
|
49
|
+
minValue: number,
|
|
42
50
|
/** The value between `0` and `100 | successValue` of the progress indicator. */
|
|
43
51
|
value: number,
|
|
44
52
|
};
|
|
@@ -49,6 +57,8 @@ export type StylePropsT = {
|
|
|
49
57
|
$size: SizeT,
|
|
50
58
|
$steps: number,
|
|
51
59
|
$successValue: number,
|
|
60
|
+
$minValue: number,
|
|
61
|
+
$maxValue: number,
|
|
52
62
|
$value: number,
|
|
53
63
|
};
|
|
54
64
|
|
|
@@ -204,12 +204,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
204
204
|
_this.handleClick(event);
|
|
205
205
|
});
|
|
206
206
|
|
|
207
|
-
_defineProperty(_assertThisInitialized(_this), "handleTouchEndClearValue", function (event) {
|
|
208
|
-
if (_this.dragging) return;
|
|
209
|
-
|
|
210
|
-
_this.clearValue(event);
|
|
211
|
-
});
|
|
212
|
-
|
|
213
207
|
_defineProperty(_assertThisInitialized(_this), "handleClick", function (event) {
|
|
214
208
|
if (_this.props.disabled || !isClick(event) && !isLeftClick(event)) {
|
|
215
209
|
return;
|
|
@@ -886,7 +880,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
886
880
|
"aria-required": this.props.required || null,
|
|
887
881
|
onFocus: this.handleInputFocus,
|
|
888
882
|
tabIndex: 0
|
|
889
|
-
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", {
|
|
883
|
+
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", _extends({
|
|
890
884
|
"aria-hidden": true,
|
|
891
885
|
id: this.props.id || null,
|
|
892
886
|
ref: this.handleInputRef,
|
|
@@ -898,7 +892,7 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
898
892
|
padding: 0
|
|
899
893
|
},
|
|
900
894
|
tabIndex: -1
|
|
901
|
-
}));
|
|
895
|
+
}, overrides.Input ? overrides.Input.props ? overrides.Input.props : {} : {})));
|
|
902
896
|
}
|
|
903
897
|
|
|
904
898
|
return /*#__PURE__*/React.createElement(InputContainer, _extends({}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement(_autosizeInput.default, _extends({
|
|
@@ -950,9 +944,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
|
|
|
950
944
|
title: ariaLabel,
|
|
951
945
|
"aria-label": ariaLabel,
|
|
952
946
|
onClick: this.clearValue,
|
|
953
|
-
onTouchEnd: this.handleTouchEndClearValue,
|
|
954
|
-
onTouchMove: this.handleTouchMove,
|
|
955
|
-
onTouchStart: this.handleTouchStart,
|
|
956
947
|
role: "button",
|
|
957
948
|
overrides: {
|
|
958
949
|
Svg: {
|
|
@@ -188,10 +188,6 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
188
188
|
if (this.dragging) return;
|
|
189
189
|
this.handleClick(event);
|
|
190
190
|
};
|
|
191
|
-
handleTouchEndClearValue = (event: TouchEvent) => {
|
|
192
|
-
if (this.dragging) return;
|
|
193
|
-
this.clearValue(event);
|
|
194
|
-
};
|
|
195
191
|
|
|
196
192
|
handleClick = (event: MouseEvent | TouchEvent) => {
|
|
197
193
|
if (this.props.disabled || (!isClick(event) && !isLeftClick(event))) {
|
|
@@ -734,6 +730,11 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
734
730
|
padding: 0,
|
|
735
731
|
}}
|
|
736
732
|
tabIndex={-1}
|
|
733
|
+
{...(overrides.Input
|
|
734
|
+
? overrides.Input.props
|
|
735
|
+
? overrides.Input.props
|
|
736
|
+
: {}
|
|
737
|
+
: {})}
|
|
737
738
|
/>
|
|
738
739
|
</InputContainer>
|
|
739
740
|
);
|
|
@@ -796,9 +797,6 @@ class Select extends React.Component<PropsT, SelectStateT> {
|
|
|
796
797
|
title={ariaLabel}
|
|
797
798
|
aria-label={ariaLabel}
|
|
798
799
|
onClick={this.clearValue}
|
|
799
|
-
onTouchEnd={this.handleTouchEndClearValue}
|
|
800
|
-
onTouchMove={this.handleTouchMove}
|
|
801
|
-
onTouchStart={this.handleTouchStart}
|
|
802
800
|
role="button"
|
|
803
801
|
overrides={{
|
|
804
802
|
Svg: {
|
|
@@ -61,13 +61,40 @@ exports.StyledActivePath = StyledActivePath;
|
|
|
61
61
|
StyledActivePath.displayName = "StyledActivePath";
|
|
62
62
|
var StyledSpinnerNext = (0, _index.styled)('i', function (_ref) {
|
|
63
63
|
var $theme = _ref.$theme,
|
|
64
|
+
_ref$$color = _ref.$color,
|
|
65
|
+
$color = _ref$$color === void 0 ? $theme.colors.contentAccent : _ref$$color,
|
|
66
|
+
$borderWidth = _ref.$borderWidth,
|
|
64
67
|
_ref$$size = _ref.$size,
|
|
65
68
|
$size = _ref$$size === void 0 ? _constants.SIZE.medium : _ref$$size;
|
|
66
|
-
|
|
69
|
+
//$FlowFixMe
|
|
70
|
+
var borderSize = {
|
|
67
71
|
large: $theme.sizing.scale300,
|
|
68
72
|
medium: $theme.sizing.scale100,
|
|
69
73
|
small: $theme.sizing.scale0
|
|
74
|
+
}[$borderWidth || $size];
|
|
75
|
+
var boxSize = {
|
|
76
|
+
large: $theme.sizing.scale1000,
|
|
77
|
+
medium: $theme.sizing.scale900,
|
|
78
|
+
small: $theme.sizing.scale800
|
|
70
79
|
}[$size];
|
|
80
|
+
|
|
81
|
+
if (!borderSize) {
|
|
82
|
+
borderSize = $theme.sizing[$borderWidth];
|
|
83
|
+
|
|
84
|
+
if (!borderSize) {
|
|
85
|
+
borderSize = "".concat(parseInt($borderWidth), "px");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!boxSize) {
|
|
90
|
+
//$FlowFixMe
|
|
91
|
+
boxSize = $theme.sizing[$size];
|
|
92
|
+
|
|
93
|
+
if (!boxSize) {
|
|
94
|
+
boxSize = "".concat(parseInt($size), "px");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
71
98
|
return {
|
|
72
99
|
display: 'block',
|
|
73
100
|
animationName: spin,
|
|
@@ -79,24 +106,16 @@ var StyledSpinnerNext = (0, _index.styled)('i', function (_ref) {
|
|
|
79
106
|
borderTopStyle: 'solid',
|
|
80
107
|
borderBottomStyle: 'solid',
|
|
81
108
|
borderRadius: '50%',
|
|
82
|
-
borderTopColor: $
|
|
109
|
+
borderTopColor: $color,
|
|
83
110
|
borderRightColor: $theme.colors.backgroundTertiary,
|
|
84
111
|
borderBottomColor: $theme.colors.backgroundTertiary,
|
|
85
112
|
borderLeftColor: $theme.colors.backgroundTertiary,
|
|
86
|
-
borderLeftWidth:
|
|
87
|
-
borderRightWidth:
|
|
88
|
-
borderTopWidth:
|
|
89
|
-
borderBottomWidth:
|
|
90
|
-
width:
|
|
91
|
-
|
|
92
|
-
medium: $theme.sizing.scale900,
|
|
93
|
-
small: $theme.sizing.scale800
|
|
94
|
-
}[$size],
|
|
95
|
-
height: {
|
|
96
|
-
large: $theme.sizing.scale1000,
|
|
97
|
-
medium: $theme.sizing.scale900,
|
|
98
|
-
small: $theme.sizing.scale800
|
|
99
|
-
}[$size],
|
|
113
|
+
borderLeftWidth: borderSize,
|
|
114
|
+
borderRightWidth: borderSize,
|
|
115
|
+
borderTopWidth: borderSize,
|
|
116
|
+
borderBottomWidth: borderSize,
|
|
117
|
+
width: boxSize,
|
|
118
|
+
height: boxSize,
|
|
100
119
|
cursor: 'wait'
|
|
101
120
|
};
|
|
102
121
|
});
|
|
@@ -7,8 +7,8 @@ LICENSE file in the root directory of this source tree.
|
|
|
7
7
|
// @flow
|
|
8
8
|
import {styled} from '../styles/index.js';
|
|
9
9
|
import {getSvgStyles} from '../icon/styled-components.js';
|
|
10
|
-
import type {SizeT} from './types.js';
|
|
11
10
|
import {SIZE} from './constants.js';
|
|
11
|
+
import type {StyledSpinnerNextPropsT} from './types.js';
|
|
12
12
|
|
|
13
13
|
type StylePropsT = {
|
|
14
14
|
$size?: number | string,
|
|
@@ -50,14 +50,40 @@ export const StyledActivePath = styled<StylePropsT>('path', props => ({
|
|
|
50
50
|
}));
|
|
51
51
|
|
|
52
52
|
// TODO(v11): Replace Spinner with SpinnerNext
|
|
53
|
-
export const StyledSpinnerNext = styled<
|
|
53
|
+
export const StyledSpinnerNext = styled<StyledSpinnerNextPropsT>(
|
|
54
54
|
'i',
|
|
55
|
-
({
|
|
56
|
-
|
|
55
|
+
({
|
|
56
|
+
$theme,
|
|
57
|
+
$color = $theme.colors.contentAccent,
|
|
58
|
+
$borderWidth,
|
|
59
|
+
$size = SIZE.medium,
|
|
60
|
+
}) => {
|
|
61
|
+
//$FlowFixMe
|
|
62
|
+
let borderSize = {
|
|
57
63
|
large: $theme.sizing.scale300,
|
|
58
64
|
medium: $theme.sizing.scale100,
|
|
59
65
|
small: $theme.sizing.scale0,
|
|
66
|
+
}[$borderWidth || $size];
|
|
67
|
+
let boxSize = {
|
|
68
|
+
large: $theme.sizing.scale1000,
|
|
69
|
+
medium: $theme.sizing.scale900,
|
|
70
|
+
small: $theme.sizing.scale800,
|
|
60
71
|
}[$size];
|
|
72
|
+
|
|
73
|
+
if (!borderSize) {
|
|
74
|
+
borderSize = $theme.sizing[$borderWidth];
|
|
75
|
+
if (!borderSize) {
|
|
76
|
+
borderSize = `${parseInt($borderWidth)}px`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (!boxSize) {
|
|
80
|
+
//$FlowFixMe
|
|
81
|
+
boxSize = $theme.sizing[$size];
|
|
82
|
+
if (!boxSize) {
|
|
83
|
+
boxSize = `${parseInt($size)}px`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
61
87
|
return {
|
|
62
88
|
display: 'block',
|
|
63
89
|
animationName: spin,
|
|
@@ -69,24 +95,16 @@ export const StyledSpinnerNext = styled<{$size?: SizeT}>(
|
|
|
69
95
|
borderTopStyle: 'solid',
|
|
70
96
|
borderBottomStyle: 'solid',
|
|
71
97
|
borderRadius: '50%',
|
|
72
|
-
borderTopColor: $
|
|
98
|
+
borderTopColor: $color,
|
|
73
99
|
borderRightColor: $theme.colors.backgroundTertiary,
|
|
74
100
|
borderBottomColor: $theme.colors.backgroundTertiary,
|
|
75
101
|
borderLeftColor: $theme.colors.backgroundTertiary,
|
|
76
|
-
borderLeftWidth:
|
|
77
|
-
borderRightWidth:
|
|
78
|
-
borderTopWidth:
|
|
79
|
-
borderBottomWidth:
|
|
80
|
-
width:
|
|
81
|
-
|
|
82
|
-
medium: $theme.sizing.scale900,
|
|
83
|
-
small: $theme.sizing.scale800,
|
|
84
|
-
}[$size],
|
|
85
|
-
height: {
|
|
86
|
-
large: $theme.sizing.scale1000,
|
|
87
|
-
medium: $theme.sizing.scale900,
|
|
88
|
-
small: $theme.sizing.scale800,
|
|
89
|
-
}[$size],
|
|
102
|
+
borderLeftWidth: borderSize,
|
|
103
|
+
borderRightWidth: borderSize,
|
|
104
|
+
borderTopWidth: borderSize,
|
|
105
|
+
borderBottomWidth: borderSize,
|
|
106
|
+
width: boxSize,
|
|
107
|
+
height: boxSize,
|
|
90
108
|
cursor: 'wait',
|
|
91
109
|
};
|
|
92
110
|
},
|
package/spinner/types.js.flow
CHANGED
|
@@ -8,6 +8,7 @@ LICENSE file in the root directory of this source tree.
|
|
|
8
8
|
|
|
9
9
|
import {SIZE} from './constants.js';
|
|
10
10
|
import type {OverrideT} from '../helpers/overrides.js';
|
|
11
|
+
import type {SizingT} from '../themes/types.js';
|
|
11
12
|
|
|
12
13
|
export type SizeT = $Keys<typeof SIZE>;
|
|
13
14
|
export type SpinnerPropsT = {
|
|
@@ -28,6 +29,15 @@ export type SpinnerPropsT = {
|
|
|
28
29
|
},
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
export type StyledSpinnerNextPropsT = {
|
|
33
|
+
/** Color of progress indicator */
|
|
34
|
+
$color?: string,
|
|
35
|
+
/** Width of the progress indicator "stroke". */
|
|
36
|
+
$borderWidth?: number | string | $Keys<SizingT> | SizeT,
|
|
37
|
+
/** Height/width of the box the indicator will appear in. */
|
|
38
|
+
$size?: number | string | $Keys<SizingT> | SizeT,
|
|
39
|
+
};
|
|
40
|
+
|
|
31
41
|
declare var __DEV__: boolean;
|
|
32
42
|
declare var __NODE__: boolean;
|
|
33
43
|
declare var __BROWSER__: boolean;
|
package/styles/index.js.flow
CHANGED
|
@@ -20,7 +20,7 @@ export {
|
|
|
20
20
|
export {hexToRgb, expandBorderStyles} from './util.js';
|
|
21
21
|
export {default as ThemeProvider} from './theme-provider.js';
|
|
22
22
|
export const ThemeConsumer = ThemeContext.Consumer;
|
|
23
|
-
export type
|
|
23
|
+
export type * from './types.js';
|
|
24
24
|
|
|
25
25
|
declare var __DEV__: boolean;
|
|
26
26
|
declare var __NODE__: boolean;
|
package/table/filter.js
CHANGED
|
@@ -91,7 +91,9 @@ function Filter(props) {
|
|
|
91
91
|
content: function content(_ref) {
|
|
92
92
|
var close = _ref.close;
|
|
93
93
|
return /*#__PURE__*/React.createElement(_reactFocusLock.default, {
|
|
94
|
-
autoFocus: false
|
|
94
|
+
autoFocus: false // Allow focus to escape when UI is within an iframe
|
|
95
|
+
,
|
|
96
|
+
crossFrame: false
|
|
95
97
|
}, /*#__PURE__*/React.createElement(Heading, headingProps, "Filter Column"), /*#__PURE__*/React.createElement(Content, contentProps, props.children), /*#__PURE__*/React.createElement(Footer, footerProps, /*#__PURE__*/React.createElement(_index.Button, {
|
|
96
98
|
kind: _index.KIND.minimal,
|
|
97
99
|
size: _index.SIZE.compact,
|