baseui 0.0.0-alpha-fd35cbd → 0.0.0-alpha-3a96a5e
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/combobox/combobox.js +6 -3
- package/combobox/combobox.js.flow +4 -2
- package/combobox/types.js.flow +2 -0
- package/datepicker/styled-components.js +1 -1
- package/datepicker/styled-components.js.flow +4 -1
- package/es/combobox/combobox.js +6 -3
- package/es/datepicker/styled-components.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/popover/popover.js +4 -2
- package/es/progress-bar/progressbar.js +10 -3
- package/es/select/select-component.js +2 -10
- package/es/spinner/styled-components.js +34 -16
- package/es/themes/dark-theme/color-component-tokens.js +15 -10
- package/es/themes/light-theme/color-component-tokens.js +15 -10
- package/es/toast/styled-components.js +18 -7
- package/esm/combobox/combobox.js +6 -3
- package/esm/datepicker/styled-components.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/popover/popover.js +4 -2
- package/esm/progress-bar/progressbar.js +16 -3
- package/esm/select/select-component.js +2 -11
- package/esm/spinner/styled-components.js +35 -16
- package/esm/themes/dark-theme/color-component-tokens.js +15 -10
- package/esm/themes/light-theme/color-component-tokens.js +15 -10
- package/esm/toast/styled-components.js +13 -5
- 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/package.json +1 -1
- package/popover/popover.js +4 -2
- package/popover/popover.js.flow +21 -17
- package/progress-bar/progressbar.js +16 -3
- package/progress-bar/progressbar.js.flow +16 -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/themes/dark-theme/color-component-tokens.js +15 -10
- package/themes/dark-theme/color-component-tokens.js.flow +15 -10
- package/themes/light-theme/color-component-tokens.js +15 -10
- package/themes/light-theme/color-component-tokens.js.flow +15 -10
- package/themes/types.js.flow +5 -0
- package/toast/styled-components.js +13 -5
- package/toast/styled-components.js.flow +17 -7
package/combobox/combobox.js
CHANGED
|
@@ -60,6 +60,7 @@ function Combobox(props) {
|
|
|
60
60
|
onChange = props.onChange,
|
|
61
61
|
onFocus = props.onFocus,
|
|
62
62
|
onSubmit = props.onSubmit,
|
|
63
|
+
listBoxLabel = props.listBoxLabel,
|
|
63
64
|
mapOptionToNode = props.mapOptionToNode,
|
|
64
65
|
mapOptionToString = props.mapOptionToString,
|
|
65
66
|
id = props.id,
|
|
@@ -322,6 +323,7 @@ function Combobox(props) {
|
|
|
322
323
|
,
|
|
323
324
|
ref: listboxRef,
|
|
324
325
|
role: "listbox",
|
|
326
|
+
"aria-label": listBoxLabel,
|
|
325
327
|
$width: listboxWidth
|
|
326
328
|
}, listBoxProps), options.map(function (option, index) {
|
|
327
329
|
var isSelected = selectionIndex === index;
|
|
@@ -360,9 +362,8 @@ function Combobox(props) {
|
|
|
360
362
|
role: "combobox"
|
|
361
363
|
}, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
|
|
362
364
|
inputRef: handleInputRef,
|
|
363
|
-
"aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
|
|
365
|
+
"aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
|
|
364
366
|
"aria-autocomplete": "list",
|
|
365
|
-
"aria-controls": listboxId,
|
|
366
367
|
disabled: disabled,
|
|
367
368
|
error: error,
|
|
368
369
|
name: name,
|
|
@@ -375,7 +376,9 @@ function Combobox(props) {
|
|
|
375
376
|
positive: positive,
|
|
376
377
|
size: size,
|
|
377
378
|
value: tempValue ? tempValue : value
|
|
378
|
-
},
|
|
379
|
+
}, isOpen ? {
|
|
380
|
+
'aria-controls': listboxId
|
|
381
|
+
} : {}, restInputProps)))));
|
|
379
382
|
}
|
|
380
383
|
|
|
381
384
|
var _default = Combobox;
|
|
@@ -38,6 +38,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
38
38
|
onChange,
|
|
39
39
|
onFocus,
|
|
40
40
|
onSubmit,
|
|
41
|
+
listBoxLabel,
|
|
41
42
|
mapOptionToNode,
|
|
42
43
|
mapOptionToString,
|
|
43
44
|
id,
|
|
@@ -274,6 +275,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
274
275
|
// eslint-disable-next-line flowtype/no-weak-types
|
|
275
276
|
ref={(listboxRef: any)}
|
|
276
277
|
role="listbox"
|
|
278
|
+
aria-label={listBoxLabel}
|
|
277
279
|
$width={listboxWidth}
|
|
278
280
|
{...listBoxProps}
|
|
279
281
|
>
|
|
@@ -322,10 +324,9 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
322
324
|
<OverriddenInput
|
|
323
325
|
inputRef={handleInputRef}
|
|
324
326
|
aria-activedescendant={
|
|
325
|
-
selectionIndex >= 0 ? activeDescendantId : undefined
|
|
327
|
+
isOpen && selectionIndex >= 0 ? activeDescendantId : undefined
|
|
326
328
|
}
|
|
327
329
|
aria-autocomplete="list"
|
|
328
|
-
aria-controls={listboxId}
|
|
329
330
|
disabled={disabled}
|
|
330
331
|
error={error}
|
|
331
332
|
name={name}
|
|
@@ -338,6 +339,7 @@ function Combobox<OptionT>(props: PropsT<OptionT>) {
|
|
|
338
339
|
positive={positive}
|
|
339
340
|
size={size}
|
|
340
341
|
value={tempValue ? tempValue : value}
|
|
342
|
+
{...(isOpen ? {'aria-controls': listboxId} : {})}
|
|
341
343
|
{...restInputProps}
|
|
342
344
|
/>
|
|
343
345
|
</InputContainer>
|
package/combobox/types.js.flow
CHANGED
|
@@ -18,6 +18,8 @@ export type PropsT<OptionT = mixed> = {|
|
|
|
18
18
|
disabled?: boolean,
|
|
19
19
|
// Proxies value through to Input component.
|
|
20
20
|
error?: boolean,
|
|
21
|
+
// Label used for the listbox/popup with options
|
|
22
|
+
listBoxLabel?: string,
|
|
21
23
|
// Used to render a custom node besides the default.
|
|
22
24
|
mapOptionToNode?: React.AbstractComponent<{|
|
|
23
25
|
isSelected: boolean,
|
|
@@ -502,7 +502,7 @@ var StyledDay = (0, _index.styled)('div', function (props) {
|
|
|
502
502
|
content: '""',
|
|
503
503
|
boxSizing: 'border-box',
|
|
504
504
|
display: 'inline-block',
|
|
505
|
-
boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
505
|
+
boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
506
506
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
507
507
|
height: $hasDateLabel ? '100%' : $density === _constants.DENSITY.high ? '42px' : '50px',
|
|
508
508
|
width: '100%',
|
|
@@ -496,7 +496,10 @@ export const StyledDay = styled<SharedStylePropsT>('div', props => {
|
|
|
496
496
|
content: '""',
|
|
497
497
|
boxSizing: 'border-box',
|
|
498
498
|
display: 'inline-block',
|
|
499
|
-
boxShadow:
|
|
499
|
+
boxShadow:
|
|
500
|
+
$isFocusVisible && (!$outsideMonth || $peekNextMonth)
|
|
501
|
+
? `0 0 0 3px ${colors.accent}`
|
|
502
|
+
: 'none',
|
|
500
503
|
backgroundColor: $selected
|
|
501
504
|
? colors.calendarDayBackgroundSelectedHighlighted
|
|
502
505
|
: $pseudoSelected && $isHighlighted
|
package/es/combobox/combobox.js
CHANGED
|
@@ -28,6 +28,7 @@ function Combobox(props) {
|
|
|
28
28
|
onChange,
|
|
29
29
|
onFocus,
|
|
30
30
|
onSubmit,
|
|
31
|
+
listBoxLabel,
|
|
31
32
|
mapOptionToNode,
|
|
32
33
|
mapOptionToString,
|
|
33
34
|
id,
|
|
@@ -251,6 +252,7 @@ function Combobox(props) {
|
|
|
251
252
|
,
|
|
252
253
|
ref: listboxRef,
|
|
253
254
|
role: "listbox",
|
|
255
|
+
"aria-label": listBoxLabel,
|
|
254
256
|
$width: listboxWidth
|
|
255
257
|
}, listBoxProps), options.map((option, index) => {
|
|
256
258
|
const isSelected = selectionIndex === index;
|
|
@@ -287,9 +289,8 @@ function Combobox(props) {
|
|
|
287
289
|
role: "combobox"
|
|
288
290
|
}, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
|
|
289
291
|
inputRef: handleInputRef,
|
|
290
|
-
"aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
|
|
292
|
+
"aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
|
|
291
293
|
"aria-autocomplete": "list",
|
|
292
|
-
"aria-controls": listboxId,
|
|
293
294
|
disabled: disabled,
|
|
294
295
|
error: error,
|
|
295
296
|
name: name,
|
|
@@ -302,7 +303,9 @@ function Combobox(props) {
|
|
|
302
303
|
positive: positive,
|
|
303
304
|
size: size,
|
|
304
305
|
value: tempValue ? tempValue : value
|
|
305
|
-
},
|
|
306
|
+
}, isOpen ? {
|
|
307
|
+
'aria-controls': listboxId
|
|
308
|
+
} : {}, restInputProps)))));
|
|
306
309
|
}
|
|
307
310
|
|
|
308
311
|
export default Combobox;
|
|
@@ -503,7 +503,7 @@ export const StyledDay = styled('div', props => {
|
|
|
503
503
|
content: '""',
|
|
504
504
|
boxSizing: 'border-box',
|
|
505
505
|
display: 'inline-block',
|
|
506
|
-
boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
|
|
506
|
+
boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? `0 0 0 3px ${colors.accent}` : 'none',
|
|
507
507
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
508
508
|
height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
|
|
509
509
|
width: '100%',
|
|
@@ -43,8 +43,6 @@ export default function MaybeChildMenu(props) {
|
|
|
43
43
|
overrides: mergeOverrides({
|
|
44
44
|
Body: {
|
|
45
45
|
props: {
|
|
46
|
-
// Adds mouseleave to popover body so that child menu closes when user mouses out.
|
|
47
|
-
onMouseLeave: props.resetParentMenu,
|
|
48
46
|
// Trap tabbing when focused on a child menu. Popover mounts the element at the end of
|
|
49
47
|
// the html body by default. If a user was to tab to the next element it would navigate
|
|
50
48
|
// to elements not within the immediate area surrounding the menu.
|
package/es/menu/nested-menus.js
CHANGED
|
@@ -12,6 +12,8 @@ export const NestedMenuContext = /*#__PURE__*/React.createContext({
|
|
|
12
12
|
removeMenuFromNesting: () => {},
|
|
13
13
|
getParentMenu: () => {},
|
|
14
14
|
getChildMenu: () => {},
|
|
15
|
+
nestedMenuHoverIndex: -1,
|
|
16
|
+
isNestedMenuVisible: () => false,
|
|
15
17
|
mountRef: {
|
|
16
18
|
current: null
|
|
17
19
|
}
|
|
@@ -30,16 +32,43 @@ export default class NestedMenus extends React.Component {
|
|
|
30
32
|
super(...args);
|
|
31
33
|
|
|
32
34
|
_defineProperty(this, "state", {
|
|
33
|
-
menus: []
|
|
35
|
+
menus: [],
|
|
36
|
+
nestedMenuHoverIndex: -1
|
|
34
37
|
});
|
|
35
38
|
|
|
36
39
|
_defineProperty(this, "mountRef", /*#__PURE__*/React.createRef());
|
|
37
40
|
|
|
41
|
+
_defineProperty(this, "mouseLeaveTimeoueId", null);
|
|
42
|
+
|
|
43
|
+
_defineProperty(this, "handleMenuMouseLeave", event => {
|
|
44
|
+
this.mouseLeaveTimeoueId = setTimeout(() => {
|
|
45
|
+
this.setState({
|
|
46
|
+
nestedMenuHoverIndex: -1
|
|
47
|
+
});
|
|
48
|
+
}, 200);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "handleMenuMouseEnter", event => {
|
|
52
|
+
if (typeof document !== 'undefined') {
|
|
53
|
+
clearTimeout(this.mouseLeaveTimeoueId);
|
|
54
|
+
const index = this.state.menus.findIndex(m => {
|
|
55
|
+
return m.current && event.currentTarget instanceof Node && m.current.contains(event.currentTarget);
|
|
56
|
+
});
|
|
57
|
+
this.setState({
|
|
58
|
+
nestedMenuHoverIndex: index
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
38
63
|
_defineProperty(this, "addMenuToNesting", ref => {
|
|
39
64
|
// check offsetHeight to determine if component is visible in the dom (0 means hidden)
|
|
40
65
|
// we need to do this so that when we renderAll, the hidden seo-only child-menus don't
|
|
41
66
|
// register themselves which would break the nesting logic
|
|
42
|
-
|
|
67
|
+
const element = ref.current;
|
|
68
|
+
|
|
69
|
+
if (element && element.offsetHeight) {
|
|
70
|
+
element.addEventListener('mouseenter', this.handleMenuMouseEnter);
|
|
71
|
+
element.addEventListener('mouseleave', this.handleMenuMouseLeave);
|
|
43
72
|
this.setState(state => {
|
|
44
73
|
return {
|
|
45
74
|
menus: [...state.menus, ref]
|
|
@@ -50,7 +79,17 @@ export default class NestedMenus extends React.Component {
|
|
|
50
79
|
|
|
51
80
|
_defineProperty(this, "removeMenuFromNesting", ref => {
|
|
52
81
|
this.setState(state => {
|
|
53
|
-
const
|
|
82
|
+
for (const r of this.state.menus) {
|
|
83
|
+
if (r.current && isSame(r.current, ref.current)) {
|
|
84
|
+
const element = r.current;
|
|
85
|
+
element.removeEventListener('mouseenter', this.handleMenuMouseEnter);
|
|
86
|
+
element.removeEventListener('mouseleave', this.handleMenuMouseLeave);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const nextMenus = state.menus.filter(r => {
|
|
91
|
+
return r.current && !isSame(r.current, ref.current);
|
|
92
|
+
});
|
|
54
93
|
return {
|
|
55
94
|
menus: nextMenus
|
|
56
95
|
};
|
|
@@ -70,6 +109,11 @@ export default class NestedMenus extends React.Component {
|
|
|
70
109
|
const index = this.findMenuIndexByRef(ref) + 1;
|
|
71
110
|
return this.state.menus[index];
|
|
72
111
|
});
|
|
112
|
+
|
|
113
|
+
_defineProperty(this, "isNestedMenuVisible", ref => {
|
|
114
|
+
const index = this.findMenuIndexByRef(ref);
|
|
115
|
+
return index <= this.state.nestedMenuHoverIndex;
|
|
116
|
+
});
|
|
73
117
|
}
|
|
74
118
|
|
|
75
119
|
render() {
|
|
@@ -79,6 +123,8 @@ export default class NestedMenus extends React.Component {
|
|
|
79
123
|
removeMenuFromNesting: this.removeMenuFromNesting,
|
|
80
124
|
getParentMenu: this.getParentMenu,
|
|
81
125
|
getChildMenu: this.getChildMenu,
|
|
126
|
+
isNestedMenuVisible: this.isNestedMenuVisible,
|
|
127
|
+
nestedMenuHoverIndex: this.state.nestedMenuHoverIndex,
|
|
82
128
|
mountRef: this.mountRef
|
|
83
129
|
}
|
|
84
130
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children, /*#__PURE__*/React.createElement("span", {
|
|
@@ -34,6 +34,8 @@ const DEFAULT_PROPS = {
|
|
|
34
34
|
removeMenuFromNesting: () => {},
|
|
35
35
|
getParentMenu: () => {},
|
|
36
36
|
getChildMenu: () => {},
|
|
37
|
+
nestedMenuHoverIndex: -1,
|
|
38
|
+
isNestedMenuVisible: () => false,
|
|
37
39
|
forceHighlight: false
|
|
38
40
|
};
|
|
39
41
|
|
|
@@ -223,16 +225,7 @@ class MenuStatefulContainerInner extends React.Component {
|
|
|
223
225
|
});
|
|
224
226
|
});
|
|
225
227
|
|
|
226
|
-
_defineProperty(this, "handleMouseLeave",
|
|
227
|
-
const rootRef = this.props.rootRef ? this.props.rootRef : this.rootRef;
|
|
228
|
-
const childMenu = this.props.getChildMenu && this.props.getChildMenu(rootRef);
|
|
229
|
-
|
|
230
|
-
if (!this.props.forceHighlight && !childMenu) {
|
|
231
|
-
this.internalSetState(STATE_CHANGE_TYPES.mouseLeave, {
|
|
232
|
-
highlightedIndex: -1
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
});
|
|
228
|
+
_defineProperty(this, "handleMouseLeave", event => {});
|
|
236
229
|
|
|
237
230
|
_defineProperty(this, "getRequiredItemProps", (item, index) => {
|
|
238
231
|
let itemRef = this.refList[index];
|
|
@@ -339,10 +332,12 @@ class MenuStatefulContainerInner extends React.Component {
|
|
|
339
332
|
if (this.keyboardControlNode) this.keyboardControlNode.removeEventListener('keydown', this.onKeyDown);
|
|
340
333
|
}
|
|
341
334
|
|
|
342
|
-
|
|
335
|
+
if (this.props.removeMenuFromNesting) {
|
|
336
|
+
this.props.removeMenuFromNesting(rootRef);
|
|
337
|
+
}
|
|
343
338
|
}
|
|
344
339
|
|
|
345
|
-
componentDidUpdate(
|
|
340
|
+
componentDidUpdate(prevProps, prevState) {
|
|
346
341
|
if (typeof document !== 'undefined') {
|
|
347
342
|
if (!prevState.isFocused && this.state.isFocused) {
|
|
348
343
|
if (this.keyboardControlNode) this.keyboardControlNode.addEventListener('keydown', this.onKeyDown);
|
|
@@ -368,6 +363,12 @@ class MenuStatefulContainerInner extends React.Component {
|
|
|
368
363
|
highlightedIndex: 0
|
|
369
364
|
});
|
|
370
365
|
}
|
|
366
|
+
|
|
367
|
+
if (this.props.isNestedMenuVisible && this.props.nestedMenuHoverIndex !== prevProps.nestedMenuHoverIndex && !this.props.isNestedMenuVisible(this.rootRef) && !this.props.forceHighlight) {
|
|
368
|
+
this.setState({
|
|
369
|
+
highlightedIndex: -1
|
|
370
|
+
});
|
|
371
|
+
}
|
|
371
372
|
} // One array to hold all of list item refs
|
|
372
373
|
|
|
373
374
|
|
package/es/popover/popover.js
CHANGED
|
@@ -447,14 +447,16 @@ class PopoverInner extends React.Component {
|
|
|
447
447
|
},
|
|
448
448
|
onPopperUpdate: this.onPopperUpdate,
|
|
449
449
|
placement: this.state.placement
|
|
450
|
-
}, /*#__PURE__*/React.createElement(FocusLock, {
|
|
450
|
+
}, this.props.focusLock ? /*#__PURE__*/React.createElement(FocusLock, {
|
|
451
451
|
disabled: !this.props.focusLock,
|
|
452
452
|
noFocusGuards: false // see popover-focus-loop.scenario.js for why hover cannot return focus
|
|
453
453
|
,
|
|
454
454
|
returnFocus: !this.isHoverTrigger() && this.props.returnFocus,
|
|
455
455
|
autoFocus: this.state.autoFocusAfterPositioning,
|
|
456
456
|
focusOptions: this.props.focusOptions
|
|
457
|
-
},
|
|
457
|
+
}, this.renderPopover(renderedContent)) : /*#__PURE__*/React.createElement(MoveFocusInside, {
|
|
458
|
+
disabled: !this.props.autoFocus && !this.state.autoFocusAfterPositioning
|
|
459
|
+
}, this.renderPopover(renderedContent)))));
|
|
458
460
|
} else {
|
|
459
461
|
rendered.push( /*#__PURE__*/React.createElement(Hidden, {
|
|
460
462
|
key: "hidden-layer"
|
|
@@ -34,7 +34,9 @@ class ProgressBar extends React.Component {
|
|
|
34
34
|
successValue,
|
|
35
35
|
showLabel,
|
|
36
36
|
infinite,
|
|
37
|
-
errorMessage
|
|
37
|
+
errorMessage,
|
|
38
|
+
forwardedRef,
|
|
39
|
+
...restProps
|
|
38
40
|
} = this.props;
|
|
39
41
|
const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
|
|
40
42
|
const [BarContainer, barContainerProps] = getOverrides(overrides.BarContainer, StyledBarContainer);
|
|
@@ -68,6 +70,7 @@ class ProgressBar extends React.Component {
|
|
|
68
70
|
/*#__PURE__*/
|
|
69
71
|
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
70
72
|
React.createElement(Root, _extends({
|
|
73
|
+
ref: forwardedRef,
|
|
71
74
|
"data-baseweb": "progress-bar",
|
|
72
75
|
role: "progressbar",
|
|
73
76
|
"aria-label": ariaLabel || getProgressLabel(value, successValue),
|
|
@@ -76,7 +79,7 @@ class ProgressBar extends React.Component {
|
|
|
76
79
|
"aria-valuemax": infinite ? null : successValue,
|
|
77
80
|
"aria-invalid": errorMessage ? true : null,
|
|
78
81
|
"aria-errormessage": errorMessage
|
|
79
|
-
}, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
82
|
+
}, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
80
83
|
$isLeft: true,
|
|
81
84
|
$size: sharedProps.$size
|
|
82
85
|
}, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
|
|
@@ -98,4 +101,8 @@ _defineProperty(ProgressBar, "defaultProps", {
|
|
|
98
101
|
value: 0
|
|
99
102
|
});
|
|
100
103
|
|
|
101
|
-
|
|
104
|
+
const ForwardedProgressBar = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(ProgressBar, _extends({
|
|
105
|
+
forwardedRef: ref
|
|
106
|
+
}, props)));
|
|
107
|
+
ForwardedProgressBar.displayName = 'ProgressBar';
|
|
108
|
+
export default ForwardedProgressBar;
|
|
@@ -124,11 +124,6 @@ class Select extends React.Component {
|
|
|
124
124
|
this.handleClick(event);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
_defineProperty(this, "handleTouchEndClearValue", event => {
|
|
128
|
-
if (this.dragging) return;
|
|
129
|
-
this.clearValue(event);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
127
|
_defineProperty(this, "handleClick", event => {
|
|
133
128
|
if (this.props.disabled || !isClick(event) && !isLeftClick(event)) {
|
|
134
129
|
return;
|
|
@@ -741,7 +736,7 @@ class Select extends React.Component {
|
|
|
741
736
|
"aria-required": this.props.required || null,
|
|
742
737
|
onFocus: this.handleInputFocus,
|
|
743
738
|
tabIndex: 0
|
|
744
|
-
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", {
|
|
739
|
+
}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement("input", _extends({
|
|
745
740
|
"aria-hidden": true,
|
|
746
741
|
id: this.props.id || null,
|
|
747
742
|
ref: this.handleInputRef,
|
|
@@ -753,7 +748,7 @@ class Select extends React.Component {
|
|
|
753
748
|
padding: 0
|
|
754
749
|
},
|
|
755
750
|
tabIndex: -1
|
|
756
|
-
}));
|
|
751
|
+
}, overrides.Input ? overrides.Input.props ? overrides.Input.props : {} : {})));
|
|
757
752
|
}
|
|
758
753
|
|
|
759
754
|
return /*#__PURE__*/React.createElement(InputContainer, _extends({}, sharedProps, inputContainerProps), /*#__PURE__*/React.createElement(AutosizeInput, _extends({
|
|
@@ -800,9 +795,6 @@ class Select extends React.Component {
|
|
|
800
795
|
title: ariaLabel,
|
|
801
796
|
"aria-label": ariaLabel,
|
|
802
797
|
onClick: this.clearValue,
|
|
803
|
-
onTouchEnd: this.handleTouchEndClearValue,
|
|
804
|
-
onTouchMove: this.handleTouchMove,
|
|
805
|
-
onTouchStart: this.handleTouchStart,
|
|
806
798
|
role: "button",
|
|
807
799
|
overrides: {
|
|
808
800
|
Svg: {
|
|
@@ -46,13 +46,39 @@ export const StyledActivePath = styled('path', props => ({
|
|
|
46
46
|
StyledActivePath.displayName = "StyledActivePath";
|
|
47
47
|
export const StyledSpinnerNext = styled('i', ({
|
|
48
48
|
$theme,
|
|
49
|
+
$color = $theme.colors.contentAccent,
|
|
50
|
+
$borderWidth,
|
|
49
51
|
$size = SIZE.medium
|
|
50
52
|
}) => {
|
|
51
|
-
|
|
53
|
+
//$FlowFixMe
|
|
54
|
+
let borderSize = {
|
|
52
55
|
large: $theme.sizing.scale300,
|
|
53
56
|
medium: $theme.sizing.scale100,
|
|
54
57
|
small: $theme.sizing.scale0
|
|
58
|
+
}[$borderWidth || $size];
|
|
59
|
+
let boxSize = {
|
|
60
|
+
large: $theme.sizing.scale1000,
|
|
61
|
+
medium: $theme.sizing.scale900,
|
|
62
|
+
small: $theme.sizing.scale800
|
|
55
63
|
}[$size];
|
|
64
|
+
|
|
65
|
+
if (!borderSize) {
|
|
66
|
+
borderSize = $theme.sizing[$borderWidth];
|
|
67
|
+
|
|
68
|
+
if (!borderSize) {
|
|
69
|
+
borderSize = `${parseInt($borderWidth)}px`;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!boxSize) {
|
|
74
|
+
//$FlowFixMe
|
|
75
|
+
boxSize = $theme.sizing[$size];
|
|
76
|
+
|
|
77
|
+
if (!boxSize) {
|
|
78
|
+
boxSize = `${parseInt($size)}px`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
56
82
|
return {
|
|
57
83
|
display: 'block',
|
|
58
84
|
animationName: spin,
|
|
@@ -64,24 +90,16 @@ export const StyledSpinnerNext = styled('i', ({
|
|
|
64
90
|
borderTopStyle: 'solid',
|
|
65
91
|
borderBottomStyle: 'solid',
|
|
66
92
|
borderRadius: '50%',
|
|
67
|
-
borderTopColor: $
|
|
93
|
+
borderTopColor: $color,
|
|
68
94
|
borderRightColor: $theme.colors.backgroundTertiary,
|
|
69
95
|
borderBottomColor: $theme.colors.backgroundTertiary,
|
|
70
96
|
borderLeftColor: $theme.colors.backgroundTertiary,
|
|
71
|
-
borderLeftWidth:
|
|
72
|
-
borderRightWidth:
|
|
73
|
-
borderTopWidth:
|
|
74
|
-
borderBottomWidth:
|
|
75
|
-
width:
|
|
76
|
-
|
|
77
|
-
medium: $theme.sizing.scale900,
|
|
78
|
-
small: $theme.sizing.scale800
|
|
79
|
-
}[$size],
|
|
80
|
-
height: {
|
|
81
|
-
large: $theme.sizing.scale1000,
|
|
82
|
-
medium: $theme.sizing.scale900,
|
|
83
|
-
small: $theme.sizing.scale800
|
|
84
|
-
}[$size],
|
|
97
|
+
borderLeftWidth: borderSize,
|
|
98
|
+
borderRightWidth: borderSize,
|
|
99
|
+
borderTopWidth: borderSize,
|
|
100
|
+
borderBottomWidth: borderSize,
|
|
101
|
+
width: boxSize,
|
|
102
|
+
height: boxSize,
|
|
85
103
|
cursor: 'wait'
|
|
86
104
|
};
|
|
87
105
|
});
|
|
@@ -106,15 +106,15 @@ export default ((themePrimitives = colorTokens) => ({
|
|
|
106
106
|
modalCloseColorFocus: themePrimitives.mono400,
|
|
107
107
|
// Notification
|
|
108
108
|
notificationPrimaryBackground: themePrimitives.primary700,
|
|
109
|
-
notificationPrimaryText: themePrimitives.
|
|
109
|
+
notificationPrimaryText: themePrimitives.primaryA,
|
|
110
110
|
notificationInfoBackground: themePrimitives.accent700,
|
|
111
|
-
notificationInfoText: themePrimitives.
|
|
111
|
+
notificationInfoText: themePrimitives.primaryA,
|
|
112
112
|
notificationPositiveBackground: themePrimitives.positive700,
|
|
113
|
-
notificationPositiveText: themePrimitives.
|
|
113
|
+
notificationPositiveText: themePrimitives.primaryA,
|
|
114
114
|
notificationWarningBackground: themePrimitives.warning700,
|
|
115
|
-
notificationWarningText: themePrimitives.
|
|
115
|
+
notificationWarningText: themePrimitives.primaryA,
|
|
116
116
|
notificationNegativeBackground: themePrimitives.negative700,
|
|
117
|
-
notificationNegativeText: themePrimitives.
|
|
117
|
+
notificationNegativeText: themePrimitives.primaryA,
|
|
118
118
|
// Tag
|
|
119
119
|
// Custom ramps
|
|
120
120
|
tagFontDisabledRampUnit: '600',
|
|
@@ -274,11 +274,16 @@ export default ((themePrimitives = colorTokens) => ({
|
|
|
274
274
|
tableFilterFooterBackground: themePrimitives.mono800,
|
|
275
275
|
// Toast
|
|
276
276
|
toastText: themePrimitives.white,
|
|
277
|
-
toastPrimaryBackground: themePrimitives.
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
277
|
+
toastPrimaryBackground: themePrimitives.primary400,
|
|
278
|
+
toastPrimaryText: themePrimitives.white,
|
|
279
|
+
toastInfoBackground: themePrimitives.accent400,
|
|
280
|
+
toastInfoText: themePrimitives.white,
|
|
281
|
+
toastPositiveBackground: themePrimitives.positive400,
|
|
282
|
+
toastPositiveText: themePrimitives.white,
|
|
283
|
+
toastWarningBackground: themePrimitives.warning400,
|
|
284
|
+
toastWarningText: themePrimitives.black,
|
|
285
|
+
toastNegativeBackground: themePrimitives.negative400,
|
|
286
|
+
toastNegativeText: themePrimitives.white,
|
|
282
287
|
// Toggle
|
|
283
288
|
toggleFill: themePrimitives.mono300,
|
|
284
289
|
toggleFillChecked: themePrimitives.primary,
|
|
@@ -182,15 +182,15 @@ export default ((themePrimitives = colorTokens) => ({
|
|
|
182
182
|
tabColor: themePrimitives.mono800,
|
|
183
183
|
// Notification
|
|
184
184
|
notificationPrimaryBackground: themePrimitives.primary50,
|
|
185
|
-
notificationPrimaryText: themePrimitives.
|
|
185
|
+
notificationPrimaryText: themePrimitives.primaryA,
|
|
186
186
|
notificationInfoBackground: themePrimitives.accent50,
|
|
187
|
-
notificationInfoText: themePrimitives.
|
|
187
|
+
notificationInfoText: themePrimitives.primaryA,
|
|
188
188
|
notificationPositiveBackground: themePrimitives.positive50,
|
|
189
|
-
notificationPositiveText: themePrimitives.
|
|
189
|
+
notificationPositiveText: themePrimitives.primaryA,
|
|
190
190
|
notificationWarningBackground: themePrimitives.warning50,
|
|
191
|
-
notificationWarningText: themePrimitives.
|
|
191
|
+
notificationWarningText: themePrimitives.primaryA,
|
|
192
192
|
notificationNegativeBackground: themePrimitives.negative50,
|
|
193
|
-
notificationNegativeText: themePrimitives.
|
|
193
|
+
notificationNegativeText: themePrimitives.primaryA,
|
|
194
194
|
// Tag
|
|
195
195
|
// Custom ramps
|
|
196
196
|
tagFontDisabledRampUnit: '100',
|
|
@@ -349,11 +349,16 @@ export default ((themePrimitives = colorTokens) => ({
|
|
|
349
349
|
tableFilterFooterBackground: themePrimitives.mono200,
|
|
350
350
|
// Toast
|
|
351
351
|
toastText: themePrimitives.white,
|
|
352
|
-
toastPrimaryBackground: themePrimitives.
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
352
|
+
toastPrimaryBackground: themePrimitives.primary400,
|
|
353
|
+
toastPrimaryText: themePrimitives.white,
|
|
354
|
+
toastInfoBackground: themePrimitives.accent400,
|
|
355
|
+
toastInfoText: themePrimitives.white,
|
|
356
|
+
toastPositiveBackground: themePrimitives.positive400,
|
|
357
|
+
toastPositiveText: themePrimitives.white,
|
|
358
|
+
toastWarningBackground: themePrimitives.warning400,
|
|
359
|
+
toastWarningText: themePrimitives.black,
|
|
360
|
+
toastNegativeBackground: themePrimitives.negative400,
|
|
361
|
+
toastNegativeText: themePrimitives.white,
|
|
357
362
|
// Spinner
|
|
358
363
|
spinnerTrackFill: themePrimitives.mono900,
|
|
359
364
|
// Progress bar
|
|
@@ -18,12 +18,23 @@ function getBackgroundColor(kind, type, theme) {
|
|
|
18
18
|
}[kind];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
function getFontColor(kind, theme) {
|
|
21
|
+
function getFontColor(kind, type, theme) {
|
|
22
|
+
const isInline = type === TYPE.inline;
|
|
23
|
+
|
|
24
|
+
if (isInline) {
|
|
25
|
+
return {
|
|
26
|
+
[KIND.info]: theme.colors.notificationInfoText,
|
|
27
|
+
[KIND.positive]: theme.colors.notificationPositiveText,
|
|
28
|
+
[KIND.warning]: theme.colors.notificationWarningText,
|
|
29
|
+
[KIND.negative]: theme.colors.notificationNegativeText
|
|
30
|
+
}[kind];
|
|
31
|
+
}
|
|
32
|
+
|
|
22
33
|
return {
|
|
23
|
-
[KIND.info]: theme.colors.
|
|
24
|
-
[KIND.positive]: theme.colors.
|
|
25
|
-
[KIND.warning]: theme.colors.
|
|
26
|
-
[KIND.negative]: theme.colors.
|
|
34
|
+
[KIND.info]: theme.colors.toastInfoText,
|
|
35
|
+
[KIND.positive]: theme.colors.toastPositiveText,
|
|
36
|
+
[KIND.warning]: theme.colors.toastWarningText,
|
|
37
|
+
[KIND.negative]: theme.colors.toastNegativeText
|
|
27
38
|
}[kind];
|
|
28
39
|
}
|
|
29
40
|
|
|
@@ -99,9 +110,9 @@ export const Body = styled('div', props => {
|
|
|
99
110
|
$theme
|
|
100
111
|
} = props;
|
|
101
112
|
const isInline = $type === TYPE.inline;
|
|
102
|
-
return { ...$theme.typography.
|
|
113
|
+
return { ...$theme.typography.font300,
|
|
103
114
|
pointerEvents: 'auto',
|
|
104
|
-
color:
|
|
115
|
+
color: getFontColor($kind, $type, $theme),
|
|
105
116
|
height: 'auto',
|
|
106
117
|
width: '288px',
|
|
107
118
|
paddingTop: $theme.sizing.scale600,
|
package/esm/combobox/combobox.js
CHANGED
|
@@ -46,6 +46,7 @@ function Combobox(props) {
|
|
|
46
46
|
onChange = props.onChange,
|
|
47
47
|
onFocus = props.onFocus,
|
|
48
48
|
onSubmit = props.onSubmit,
|
|
49
|
+
listBoxLabel = props.listBoxLabel,
|
|
49
50
|
mapOptionToNode = props.mapOptionToNode,
|
|
50
51
|
mapOptionToString = props.mapOptionToString,
|
|
51
52
|
id = props.id,
|
|
@@ -308,6 +309,7 @@ function Combobox(props) {
|
|
|
308
309
|
,
|
|
309
310
|
ref: listboxRef,
|
|
310
311
|
role: "listbox",
|
|
312
|
+
"aria-label": listBoxLabel,
|
|
311
313
|
$width: listboxWidth
|
|
312
314
|
}, listBoxProps), options.map(function (option, index) {
|
|
313
315
|
var isSelected = selectionIndex === index;
|
|
@@ -346,9 +348,8 @@ function Combobox(props) {
|
|
|
346
348
|
role: "combobox"
|
|
347
349
|
}, inputContainerProps), /*#__PURE__*/React.createElement(OverriddenInput, _extends({
|
|
348
350
|
inputRef: handleInputRef,
|
|
349
|
-
"aria-activedescendant": selectionIndex >= 0 ? activeDescendantId : undefined,
|
|
351
|
+
"aria-activedescendant": isOpen && selectionIndex >= 0 ? activeDescendantId : undefined,
|
|
350
352
|
"aria-autocomplete": "list",
|
|
351
|
-
"aria-controls": listboxId,
|
|
352
353
|
disabled: disabled,
|
|
353
354
|
error: error,
|
|
354
355
|
name: name,
|
|
@@ -361,7 +362,9 @@ function Combobox(props) {
|
|
|
361
362
|
positive: positive,
|
|
362
363
|
size: size,
|
|
363
364
|
value: tempValue ? tempValue : value
|
|
364
|
-
},
|
|
365
|
+
}, isOpen ? {
|
|
366
|
+
'aria-controls': listboxId
|
|
367
|
+
} : {}, restInputProps)))));
|
|
365
368
|
}
|
|
366
369
|
|
|
367
370
|
export default Combobox;
|
|
@@ -481,7 +481,7 @@ export var StyledDay = styled('div', function (props) {
|
|
|
481
481
|
content: '""',
|
|
482
482
|
boxSizing: 'border-box',
|
|
483
483
|
display: 'inline-block',
|
|
484
|
-
boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
484
|
+
boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? "0 0 0 3px ".concat(colors.accent) : 'none',
|
|
485
485
|
backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
|
|
486
486
|
height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
|
|
487
487
|
width: '100%',
|