baseui 15.0.1 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/button/button-internals.d.ts +2 -2
- package/button/button-internals.js +56 -7
- package/button/button.d.ts +2 -2
- package/button/button.js +80 -8
- package/button/constants.d.ts +22 -0
- package/button/constants.js +31 -3
- package/button/default-props.d.ts +5 -3
- package/button/default-props.js +5 -3
- package/button/index.d.ts +1 -1
- package/button/index.js +21 -0
- package/button/styled-components.d.ts +7 -0
- package/button/styled-components.js +476 -66
- package/button/types.d.ts +39 -3
- package/button/utils.d.ts +2 -2
- package/button/utils.js +9 -3
- package/button-group/button-group.d.ts +1 -0
- package/button-group/button-group.js +22 -33
- package/button-group/constants.d.ts +5 -0
- package/button-group/constants.js +6 -1
- package/button-group/index.d.ts +10 -1
- package/button-group/index.js +33 -4
- package/button-group/styled-components.d.ts +5 -2
- package/button-group/styled-components.js +47 -6
- package/button-group/types.d.ts +9 -2
- package/checkbox/styled-components.js +2 -6
- package/modal/modal-button.d.ts +8 -1
- package/package.json +1 -1
- package/tag/constants.d.ts +31 -5
- package/tag/constants.js +18 -11
- package/tag/deprecated-styles.d.ts +119 -0
- package/tag/deprecated-styles.js +179 -0
- package/tag/index.d.ts +1 -1
- package/tag/index.js +15 -1
- package/tag/styled-components.js +199 -230
- package/tag/tag.js +10 -4
- package/tag/types.d.ts +16 -11
- package/tag-group/index.d.ts +5 -0
- package/tag-group/index.js +51 -0
- package/tag-group/styled-components.d.ts +3 -0
- package/tag-group/styled-components.js +46 -0
- package/tag-group/tag-group.d.ts +4 -0
- package/tag-group/tag-group.js +65 -0
- package/tag-group/types.d.ts +18 -0
- package/tag-group/types.js +1 -0
- package/themes/dark-theme/color-component-tokens.js +56 -3
- package/themes/dark-theme/color-semantic-tokens.js +104 -0
- package/themes/light-theme/color-component-tokens.js +55 -2
- package/themes/light-theme/color-semantic-tokens.js +104 -0
- package/themes/shared/animation.js +30 -5
- package/themes/types.d.ts +76 -1
package/button/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import type { KIND, SIZE, SHAPE } from './constants';
|
|
2
|
+
import type { KIND, SIZE, SHAPE, MIN_HIT_AREA, WIDTH_TYPE } from './constants';
|
|
3
3
|
import type { Override } from '../helpers/overrides';
|
|
4
4
|
export type ButtonOverrides = {
|
|
5
5
|
Root?: Override;
|
|
@@ -8,17 +8,27 @@ export type ButtonOverrides = {
|
|
|
8
8
|
EndEnhancer?: Override;
|
|
9
9
|
LoadingSpinnerContainer?: Override;
|
|
10
10
|
LoadingSpinner?: Override;
|
|
11
|
+
StartEnhancerButtonContentContainer?: Override;
|
|
11
12
|
};
|
|
12
13
|
export type CustomColors = {
|
|
13
14
|
backgroundColor: string;
|
|
14
15
|
color: string;
|
|
15
16
|
};
|
|
16
|
-
interface
|
|
17
|
+
interface BaseButtonSharedProps {
|
|
18
|
+
/** Sets a11y attributes */
|
|
19
|
+
/** For icon only buttons, aria-label is mandatory; aria-hidden needs to be true on svg elements */
|
|
20
|
+
'aria-label'?: string;
|
|
21
|
+
'aria-labelledby'?: string;
|
|
22
|
+
'aria-describedby'?: string;
|
|
23
|
+
/** floating action button */
|
|
24
|
+
backgroundSafe?: boolean;
|
|
17
25
|
children?: React.ReactNode;
|
|
18
26
|
colors?: CustomColors;
|
|
19
27
|
disabled?: boolean;
|
|
20
28
|
/** A helper rendered at the end of the button. */
|
|
21
29
|
endEnhancer?: React.ReactNode | React.ComponentType<any>;
|
|
30
|
+
/** Defines the minimum height of the hit target area */
|
|
31
|
+
minHitArea?: keyof typeof MIN_HIT_AREA;
|
|
22
32
|
/** Show loading button style and spinner. */
|
|
23
33
|
isLoading?: boolean;
|
|
24
34
|
/** Indicates that the button is selected */
|
|
@@ -34,6 +44,12 @@ interface BaseButtonProps {
|
|
|
34
44
|
/** A helper rendered at the start of the button. */
|
|
35
45
|
startEnhancer?: React.ReactNode | React.ComponentType<any>;
|
|
36
46
|
type?: 'submit' | 'reset' | 'button';
|
|
47
|
+
/**
|
|
48
|
+
* Controls the button’s width behavior.
|
|
49
|
+
* "hug" allows the button to adjust its width based on the content (hug),
|
|
50
|
+
* while "fill" lets the button maintain a specified, filled or fixed width (parent container will provide the width or developer can use overrides to set the width)
|
|
51
|
+
*/
|
|
52
|
+
widthType?: keyof typeof WIDTH_TYPE;
|
|
37
53
|
}
|
|
38
54
|
export interface LinkButtonProps {
|
|
39
55
|
/** Convert button to <a> tag allowing for opening links directly.
|
|
@@ -43,10 +59,25 @@ export interface LinkButtonProps {
|
|
|
43
59
|
href?: string | null;
|
|
44
60
|
target?: string;
|
|
45
61
|
}
|
|
46
|
-
export interface ButtonProps extends
|
|
62
|
+
export interface ButtonProps extends BaseButtonSharedProps, LinkButtonProps {
|
|
47
63
|
}
|
|
64
|
+
export type BaseButtonProps = Omit<ButtonProps, 'children'> & {
|
|
65
|
+
/** Children can be either React nodes or a function that returns React nodes */
|
|
66
|
+
children?: React.ReactNode | ((props: {
|
|
67
|
+
isHovered: boolean;
|
|
68
|
+
isPressed: boolean;
|
|
69
|
+
isFocused: boolean;
|
|
70
|
+
artworkSize: string;
|
|
71
|
+
}) => React.ReactNode);
|
|
72
|
+
};
|
|
73
|
+
export type ButtonInternalsProps = BaseButtonProps & {
|
|
74
|
+
isHovered?: boolean;
|
|
75
|
+
isPressed?: boolean;
|
|
76
|
+
isFocused?: boolean;
|
|
77
|
+
};
|
|
48
78
|
export type SharedStyleProps<AS = React.ComponentType<any> | keyof JSX.IntrinsicElements> = {
|
|
49
79
|
$colors?: CustomColors;
|
|
80
|
+
$minHitArea?: keyof typeof MIN_HIT_AREA;
|
|
50
81
|
$kind?: keyof typeof KIND;
|
|
51
82
|
$isSelected?: boolean;
|
|
52
83
|
$shape?: keyof typeof SHAPE;
|
|
@@ -54,6 +85,11 @@ export type SharedStyleProps<AS = React.ComponentType<any> | keyof JSX.Intrinsic
|
|
|
54
85
|
$isLoading?: boolean;
|
|
55
86
|
$disabled?: boolean;
|
|
56
87
|
$isFocusVisible?: boolean;
|
|
88
|
+
$isHovered?: boolean;
|
|
89
|
+
$isPressed?: boolean;
|
|
90
|
+
$isFocused?: boolean;
|
|
57
91
|
$as?: AS;
|
|
92
|
+
$backgroundSafe?: boolean;
|
|
93
|
+
$widthType?: keyof typeof WIDTH_TYPE;
|
|
58
94
|
};
|
|
59
95
|
export {};
|
package/button/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function getSharedProps({ colors, disabled, isLoading, isSelected, kind, shape, size, }:
|
|
1
|
+
import type { BaseButtonProps, SharedStyleProps } from './types';
|
|
2
|
+
export declare function getSharedProps({ colors, disabled, minHitArea, isLoading, isSelected, kind, shape, size, backgroundSafe, widthType, }: BaseButtonProps): Partial<SharedStyleProps>;
|
package/button/utils.js
CHANGED
|
@@ -14,19 +14,25 @@ LICENSE file in the root directory of this source tree.
|
|
|
14
14
|
function getSharedProps({
|
|
15
15
|
colors,
|
|
16
16
|
disabled,
|
|
17
|
+
minHitArea,
|
|
17
18
|
isLoading,
|
|
18
19
|
isSelected,
|
|
19
20
|
kind,
|
|
20
21
|
shape,
|
|
21
|
-
size
|
|
22
|
+
size,
|
|
23
|
+
backgroundSafe,
|
|
24
|
+
widthType
|
|
22
25
|
}) {
|
|
23
26
|
return {
|
|
24
27
|
$colors: colors,
|
|
25
28
|
$disabled: disabled,
|
|
29
|
+
$minHitArea: minHitArea,
|
|
26
30
|
$isLoading: isLoading,
|
|
27
|
-
$isSelected: isSelected,
|
|
31
|
+
$isSelected: Boolean(isSelected),
|
|
28
32
|
$kind: kind,
|
|
29
33
|
$shape: shape,
|
|
30
|
-
$size: size
|
|
34
|
+
$size: size,
|
|
35
|
+
$backgroundSafe: backgroundSafe,
|
|
36
|
+
$widthType: widthType
|
|
31
37
|
};
|
|
32
38
|
}
|
|
@@ -39,40 +39,46 @@ class ButtonGroup extends React.Component {
|
|
|
39
39
|
render() {
|
|
40
40
|
const {
|
|
41
41
|
overrides = {},
|
|
42
|
-
mode
|
|
42
|
+
mode,
|
|
43
43
|
children,
|
|
44
44
|
selected,
|
|
45
45
|
disabled,
|
|
46
46
|
onClick,
|
|
47
47
|
kind,
|
|
48
48
|
shape,
|
|
49
|
-
size
|
|
49
|
+
size,
|
|
50
|
+
wrap,
|
|
51
|
+
padding
|
|
50
52
|
} = this.props;
|
|
51
53
|
const [Root, rootProps] = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledRoot);
|
|
52
54
|
const ariaLabel = this.props['aria-label'] || this.props.ariaLabel;
|
|
53
55
|
const isRadio = mode === _constants.MODE.radio;
|
|
56
|
+
const isSimpleClickableBtnGroup = (!mode || Object.values(_constants.MODE).every(val => val !== mode)) && typeof selected === 'undefined'; // button group for simple clickable buttons(not checkbox or radio buttons)
|
|
57
|
+
|
|
54
58
|
const numItems = React.Children.count(children);
|
|
55
59
|
return /*#__PURE__*/React.createElement(_locale.LocaleContext.Consumer, null, locale => /*#__PURE__*/React.createElement(Root, _extends({
|
|
56
60
|
"aria-label": ariaLabel || locale.buttongroup.ariaLabel,
|
|
61
|
+
"aria-labelledby": this.props['aria-labelledby'],
|
|
62
|
+
"aria-describedby": this.props['aria-describedby'],
|
|
57
63
|
"data-baseweb": "button-group",
|
|
58
64
|
role: isRadio ? 'radiogroup' : 'group',
|
|
59
|
-
$
|
|
60
|
-
$
|
|
65
|
+
$size: size,
|
|
66
|
+
$padding: padding,
|
|
67
|
+
$wrap: wrap
|
|
61
68
|
}, rootProps), React.Children.map(children, (child, index) => {
|
|
62
69
|
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
63
70
|
return null;
|
|
64
71
|
}
|
|
65
|
-
const isSelected = child.props.isSelected ? child.props.isSelected :
|
|
72
|
+
const isSelected = child.props.isSelected ? child.props.isSelected : isSimpleClickableBtnGroup ? undefined // avoid adding aria-pressed to buttons in actionable button group
|
|
73
|
+
: isIndexSelected(selected, index);
|
|
66
74
|
if (isRadio) {
|
|
67
75
|
this.childRefs[index] = /*#__PURE__*/React.createRef();
|
|
68
76
|
}
|
|
69
77
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
70
|
-
// @ts-ignore
|
|
71
78
|
disabled: disabled || child.props.disabled,
|
|
72
79
|
isSelected,
|
|
73
80
|
ref: isRadio ? this.childRefs[index] : undefined,
|
|
74
|
-
tabIndex: !isRadio || isSelected || isRadio && (!selected || selected === -1) && index === 0 ? 0 : -1,
|
|
75
|
-
// @ts-ignore
|
|
81
|
+
tabIndex: !isRadio || isSelected || isRadio && (!selected || selected === -1 || Array.isArray(selected) && selected.length === 0) && index === 0 ? 0 : -1,
|
|
76
82
|
onKeyDown: e => {
|
|
77
83
|
if (!isRadio) return;
|
|
78
84
|
const value = Number(selected) ? Number(selected) : 0;
|
|
@@ -90,7 +96,6 @@ class ButtonGroup extends React.Component {
|
|
|
90
96
|
}
|
|
91
97
|
},
|
|
92
98
|
kind,
|
|
93
|
-
// @ts-ignore
|
|
94
99
|
onClick: event => {
|
|
95
100
|
if (disabled) {
|
|
96
101
|
return;
|
|
@@ -106,30 +111,13 @@ class ButtonGroup extends React.Component {
|
|
|
106
111
|
size,
|
|
107
112
|
overrides: {
|
|
108
113
|
BaseButton: {
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
style: ({
|
|
111
|
-
$theme
|
|
112
|
-
}) => {
|
|
113
|
-
// Even though baseui's buttons have square corners, some applications override to
|
|
114
|
-
// rounded. Maintaining corner radius in this circumstance is ideal to avoid further
|
|
115
|
-
// customization.
|
|
116
|
-
if (children.length === 1) {
|
|
117
|
-
return {};
|
|
118
|
-
}
|
|
119
|
-
if (shape !== _button.SHAPE.default) {
|
|
120
|
-
return {
|
|
121
|
-
marginLeft: $theme.sizing.scale100,
|
|
122
|
-
marginRight: $theme.sizing.scale100
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
marginLeft: '0.5px',
|
|
127
|
-
marginRight: '0.5px'
|
|
128
|
-
};
|
|
129
|
-
},
|
|
130
114
|
props: {
|
|
131
|
-
'aria-checked'
|
|
132
|
-
|
|
115
|
+
...(typeof child.props['aria-checked'] === 'boolean' ? {
|
|
116
|
+
'aria-checked': child.props['aria-checked']
|
|
117
|
+
} : isSimpleClickableBtnGroup ? {} : {
|
|
118
|
+
'aria-checked': isSelected
|
|
119
|
+
}),
|
|
120
|
+
role: child.props.role || isRadio ? 'radio' : !isSimpleClickableBtnGroup ? 'checkbox' : undefined
|
|
133
121
|
}
|
|
134
122
|
},
|
|
135
123
|
...child.props.overrides
|
|
@@ -144,5 +132,6 @@ _defineProperty(ButtonGroup, "defaultProps", {
|
|
|
144
132
|
onClick: () => {},
|
|
145
133
|
shape: _button.SHAPE.default,
|
|
146
134
|
size: _button.SIZE.default,
|
|
147
|
-
kind: _button.KIND.secondary
|
|
135
|
+
kind: _button.KIND.secondary,
|
|
136
|
+
padding: _constants.PADDING.none
|
|
148
137
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.STATE_CHANGE_TYPE = exports.MODE = void 0;
|
|
6
|
+
exports.STATE_CHANGE_TYPE = exports.PADDING = exports.MODE = void 0;
|
|
7
7
|
/*
|
|
8
8
|
Copyright (c) Uber Technologies, Inc.
|
|
9
9
|
|
|
@@ -16,4 +16,9 @@ const MODE = exports.MODE = Object.freeze({
|
|
|
16
16
|
});
|
|
17
17
|
const STATE_CHANGE_TYPE = exports.STATE_CHANGE_TYPE = Object.freeze({
|
|
18
18
|
change: 'change'
|
|
19
|
+
});
|
|
20
|
+
const PADDING = exports.PADDING = Object.freeze({
|
|
21
|
+
default: 'default',
|
|
22
|
+
none: 'none',
|
|
23
|
+
custom: 'custom' // expect custom padding from developer
|
|
19
24
|
});
|
package/button-group/index.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
export declare const KIND: {
|
|
2
|
+
readonly outline: "outline";
|
|
3
|
+
readonly primary: "primary";
|
|
4
|
+
readonly secondary: "secondary";
|
|
5
|
+
readonly tertiary: "tertiary";
|
|
6
|
+
readonly dangerPrimary: "dangerPrimary";
|
|
7
|
+
readonly dangerSecondary: "dangerSecondary";
|
|
8
|
+
readonly dangerTertiary: "dangerTertiary";
|
|
9
|
+
};
|
|
1
10
|
export { default as ButtonGroup } from './button-group';
|
|
2
11
|
export { default as StatefulButtonGroup } from './stateful-button-group';
|
|
3
12
|
export { default as StatefulContainer } from './stateful-container';
|
|
4
13
|
export { SIZE, SHAPE } from '../button';
|
|
5
|
-
export { MODE, STATE_CHANGE_TYPE } from './constants';
|
|
14
|
+
export { MODE, STATE_CHANGE_TYPE, PADDING } from './constants';
|
|
6
15
|
export { StyledRoot } from './styled-components';
|
|
7
16
|
export * from './types';
|
|
8
17
|
export type { ButtonGroupLocale } from './locale';
|
package/button-group/index.js
CHANGED
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
KIND: true,
|
|
8
|
+
SIZE: true,
|
|
9
|
+
SHAPE: true,
|
|
7
10
|
ButtonGroup: true,
|
|
8
11
|
StatefulButtonGroup: true,
|
|
9
12
|
StatefulContainer: true,
|
|
10
|
-
SIZE: true,
|
|
11
|
-
SHAPE: true,
|
|
12
13
|
MODE: true,
|
|
13
14
|
STATE_CHANGE_TYPE: true,
|
|
15
|
+
PADDING: true,
|
|
14
16
|
StyledRoot: true
|
|
15
17
|
};
|
|
16
18
|
Object.defineProperty(exports, "ButtonGroup", {
|
|
@@ -19,12 +21,19 @@ Object.defineProperty(exports, "ButtonGroup", {
|
|
|
19
21
|
return _buttonGroup.default;
|
|
20
22
|
}
|
|
21
23
|
});
|
|
24
|
+
exports.KIND = void 0;
|
|
22
25
|
Object.defineProperty(exports, "MODE", {
|
|
23
26
|
enumerable: true,
|
|
24
27
|
get: function () {
|
|
25
28
|
return _constants.MODE;
|
|
26
29
|
}
|
|
27
30
|
});
|
|
31
|
+
Object.defineProperty(exports, "PADDING", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () {
|
|
34
|
+
return _constants.PADDING;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
28
37
|
Object.defineProperty(exports, "SHAPE", {
|
|
29
38
|
enumerable: true,
|
|
30
39
|
get: function () {
|
|
@@ -61,10 +70,10 @@ Object.defineProperty(exports, "StyledRoot", {
|
|
|
61
70
|
return _styledComponents.StyledRoot;
|
|
62
71
|
}
|
|
63
72
|
});
|
|
73
|
+
var _button = require("../button");
|
|
64
74
|
var _buttonGroup = _interopRequireDefault(require("./button-group"));
|
|
65
75
|
var _statefulButtonGroup = _interopRequireDefault(require("./stateful-button-group"));
|
|
66
76
|
var _statefulContainer = _interopRequireDefault(require("./stateful-container"));
|
|
67
|
-
var _button = require("../button");
|
|
68
77
|
var _constants = require("./constants");
|
|
69
78
|
var _styledComponents = require("./styled-components");
|
|
70
79
|
var _types = require("./types");
|
|
@@ -79,4 +88,24 @@ Object.keys(_types).forEach(function (key) {
|
|
|
79
88
|
}
|
|
80
89
|
});
|
|
81
90
|
});
|
|
82
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
91
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
92
|
+
/*
|
|
93
|
+
Copyright (c) Uber Technologies, Inc.
|
|
94
|
+
|
|
95
|
+
This source code is licensed under the MIT license found in the
|
|
96
|
+
LICENSE file in the root directory of this source tree.
|
|
97
|
+
*/
|
|
98
|
+
|
|
99
|
+
const KIND = exports.KIND = {
|
|
100
|
+
..._button.KIND,
|
|
101
|
+
..._button.BUTTON_GROUP_EXCLUSIVE_KINDS
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Constants
|
|
105
|
+
|
|
106
|
+
// Styled elements
|
|
107
|
+
|
|
108
|
+
// Types
|
|
109
|
+
|
|
110
|
+
/** @deprecated To be removed in future versions */
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { SIZE } from '../button';
|
|
2
|
+
import { PADDING } from './constants';
|
|
1
3
|
export declare const StyledRoot: import("styletron-react").StyletronComponent<"div", {
|
|
2
|
-
$
|
|
3
|
-
$
|
|
4
|
+
$padding: (typeof PADDING)[keyof typeof PADDING];
|
|
5
|
+
$wrap?: boolean;
|
|
6
|
+
$size: (typeof SIZE)[keyof typeof SIZE];
|
|
4
7
|
}>;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.StyledRoot = void 0;
|
|
7
7
|
var _styles = require("../styles");
|
|
8
8
|
var _button = require("../button");
|
|
9
|
+
var _constants = require("./constants");
|
|
9
10
|
/*
|
|
10
11
|
Copyright (c) Uber Technologies, Inc.
|
|
11
12
|
|
|
@@ -14,16 +15,56 @@ LICENSE file in the root directory of this source tree.
|
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
const StyledRoot = exports.StyledRoot = (0, _styles.styled)('div', ({
|
|
17
|
-
$
|
|
18
|
-
$
|
|
18
|
+
$padding,
|
|
19
|
+
$wrap,
|
|
20
|
+
$size,
|
|
19
21
|
$theme
|
|
20
22
|
}) => {
|
|
21
|
-
const margin = $length === 1 ? undefined : $shape !== _button.SHAPE.default ? `-${$theme.sizing.scale100}` : '-0.5px';
|
|
22
23
|
return {
|
|
23
24
|
display: 'flex',
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
columnGap: $theme.sizing.scale300,
|
|
26
|
+
rowGap: $size === _button.SIZE.xSmall || $size === _button.SIZE.mini ? $theme.sizing.scale500 : $theme.sizing.scale300,
|
|
27
|
+
...getWrapStyles({
|
|
28
|
+
$wrap
|
|
29
|
+
}),
|
|
30
|
+
...getPaddingStyles({
|
|
31
|
+
$padding,
|
|
32
|
+
$theme
|
|
33
|
+
})
|
|
26
34
|
};
|
|
27
35
|
});
|
|
28
36
|
StyledRoot.displayName = "StyledRoot";
|
|
29
|
-
StyledRoot.displayName = 'StyledRoot';
|
|
37
|
+
StyledRoot.displayName = 'StyledRoot';
|
|
38
|
+
const getWrapStyles = ({
|
|
39
|
+
$wrap
|
|
40
|
+
}) => {
|
|
41
|
+
if (typeof $wrap === 'boolean') {
|
|
42
|
+
return $wrap ? {
|
|
43
|
+
flexWrap: 'wrap'
|
|
44
|
+
} : {
|
|
45
|
+
overflowX: 'auto',
|
|
46
|
+
scrollbarWidth: 'none'
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {};
|
|
50
|
+
};
|
|
51
|
+
const getPaddingStyles = ({
|
|
52
|
+
$padding,
|
|
53
|
+
$theme
|
|
54
|
+
}) => {
|
|
55
|
+
switch ($padding) {
|
|
56
|
+
case _constants.PADDING.default:
|
|
57
|
+
return {
|
|
58
|
+
paddingLeft: $theme.sizing.scale600,
|
|
59
|
+
paddingRight: $theme.sizing.scale600
|
|
60
|
+
};
|
|
61
|
+
case _constants.PADDING.none:
|
|
62
|
+
return {
|
|
63
|
+
paddingLeft: 0,
|
|
64
|
+
paddingRight: 0
|
|
65
|
+
};
|
|
66
|
+
case _constants.PADDING.custom:
|
|
67
|
+
default:
|
|
68
|
+
return Object.freeze({});
|
|
69
|
+
}
|
|
70
|
+
};
|
package/button-group/types.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import type { SIZE, SHAPE
|
|
2
|
+
import type { SIZE, SHAPE } from '../button';
|
|
3
|
+
import type { KIND } from './index';
|
|
3
4
|
import type { Override } from '../helpers/overrides';
|
|
4
|
-
import type { MODE, STATE_CHANGE_TYPE } from './constants';
|
|
5
|
+
import type { MODE, STATE_CHANGE_TYPE, PADDING } from './constants';
|
|
5
6
|
export type ButtonGroupProps = {
|
|
6
7
|
/** Accessible label. */
|
|
7
8
|
ariaLabel?: string;
|
|
8
9
|
'aria-label'?: string;
|
|
10
|
+
'aria-labelledby'?: string;
|
|
11
|
+
'aria-describedby'?: string;
|
|
9
12
|
/** Set of more than one `Button` components */
|
|
10
13
|
children: Array<React.ReactNode>;
|
|
11
14
|
/** Defines if the button group is disabled. */
|
|
@@ -34,6 +37,10 @@ export type ButtonGroupProps = {
|
|
|
34
37
|
size?: (typeof SIZE)[keyof typeof SIZE];
|
|
35
38
|
/** Defines the `kind` of the buttons in the group */
|
|
36
39
|
kind?: (typeof KIND)[keyof typeof KIND];
|
|
40
|
+
/** Defines if the button group should wrap. (when it's set to false, the button group will be displayed in a single line and overflow if necessary)*/
|
|
41
|
+
wrap?: boolean;
|
|
42
|
+
/** Defines the padding of the buttons in the button group. 'none' by default - no padding, 'default' - 8px horizontal padding, 'custom' - expect custom padding from developer */
|
|
43
|
+
padding?: (typeof PADDING)[keyof typeof PADDING];
|
|
37
44
|
};
|
|
38
45
|
type ButtonGroupOverrides = {
|
|
39
46
|
Root?: Override;
|
|
@@ -285,13 +285,9 @@ const Toggle = exports.Toggle = (0, _styles.styled)('div', props => {
|
|
|
285
285
|
Toggle.displayName = "Toggle";
|
|
286
286
|
Toggle.displayName = 'Toggle';
|
|
287
287
|
const ToggleTrack = exports.ToggleTrack = (0, _styles.styled)('div', props => {
|
|
288
|
-
|
|
289
|
-
if (props.$disabled) {
|
|
290
|
-
backgroundColor = props.$theme.colors.toggleTrackFillDisabled;
|
|
291
|
-
} else if (props.$error && props.$checked) {
|
|
292
|
-
backgroundColor = props.$theme.colors.tickFillError;
|
|
293
|
-
}
|
|
288
|
+
const backgroundColor = props.$disabled ? props.$theme.colors.toggleTrackFillDisabled : props.$theme.colors.toggleTrackFill;
|
|
294
289
|
return {
|
|
290
|
+
flex: '0 0 auto',
|
|
295
291
|
alignItems: 'center',
|
|
296
292
|
backgroundColor,
|
|
297
293
|
borderTopLeftRadius: '7px',
|
package/modal/modal-button.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
declare const ModalButton: React.ForwardRefExoticComponent<Omit<
|
|
2
|
+
declare const ModalButton: React.ForwardRefExoticComponent<Omit<Omit<import("../button").ButtonProps, "children"> & {
|
|
3
|
+
children?: React.ReactNode | ((props: {
|
|
4
|
+
isHovered: boolean;
|
|
5
|
+
isPressed: boolean;
|
|
6
|
+
isFocused: boolean;
|
|
7
|
+
artworkSize: string;
|
|
8
|
+
}) => React.ReactNode);
|
|
9
|
+
} & Omit<any, "size" | "disabled" | "target" | "type" | "href" | "aria-describedby" | "aria-label" | "aria-labelledby" | "children" | "onClick" | "overrides" | "colors" | "startEnhancer" | "endEnhancer" | "isLoading" | "kind" | "backgroundSafe" | "minHitArea" | "isSelected" | "shape" | "widthType" | keyof import("../button").SharedStyleProps> & import("../button").SharedStyleProps<"symbol" | "object" | React.ComponentClass<any, any> | React.FunctionComponent<any> | "progress" | "text" | "ruby" | "table" | "small" | "embed" | "pre" | "caption" | "menu" | "center" | "clipPath" | "filter" | "mask" | "marker" | "button" | "meter" | "textarea" | "style" | "sub" | "circle" | "menuitem" | "svg" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "big" | "blockquote" | "body" | "br" | "canvas" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "keygen" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "meta" | "nav" | "noindex" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "q" | "rp" | "rt" | "s" | "samp" | "search" | "slot" | "script" | "section" | "select" | "source" | "span" | "strong" | "summary" | "sup" | "template" | "tbody" | "td" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "webview" | "animate" | "animateMotion" | "animateTransform" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feDropShadow" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "metadata" | "mpath" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "switch" | "textPath" | "tspan" | "use" | "view">, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
3
10
|
export default ModalButton;
|
package/package.json
CHANGED
package/tag/constants.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const SIZE: {
|
|
2
|
+
readonly xSmall: "xSmall";
|
|
2
3
|
readonly small: "small";
|
|
3
4
|
readonly medium: "medium";
|
|
4
5
|
readonly large: "large";
|
|
@@ -7,8 +8,7 @@ export declare const HIERARCHY: Readonly<{
|
|
|
7
8
|
readonly primary: "primary";
|
|
8
9
|
readonly secondary: "secondary";
|
|
9
10
|
}>;
|
|
10
|
-
export declare const
|
|
11
|
-
readonly custom: "custom";
|
|
11
|
+
export declare const DEPRECATED_KIND: Readonly<{
|
|
12
12
|
readonly neutral: "neutral";
|
|
13
13
|
readonly primary: "primary";
|
|
14
14
|
readonly accent: "accent";
|
|
@@ -16,13 +16,39 @@ export declare const KIND: {
|
|
|
16
16
|
readonly warning: "warning";
|
|
17
17
|
readonly negative: "negative";
|
|
18
18
|
readonly black: "black";
|
|
19
|
-
readonly
|
|
20
|
-
|
|
19
|
+
readonly brown: "brown";
|
|
20
|
+
}>;
|
|
21
|
+
export declare const SUPPORTED_KIND: Readonly<{
|
|
22
|
+
readonly custom: "custom";
|
|
23
|
+
readonly gray: "gray";
|
|
21
24
|
readonly red: "red";
|
|
25
|
+
readonly orange: "orange";
|
|
22
26
|
readonly yellow: "yellow";
|
|
27
|
+
readonly green: "green";
|
|
28
|
+
readonly blue: "blue";
|
|
29
|
+
readonly purple: "purple";
|
|
30
|
+
readonly magenta: "magenta";
|
|
31
|
+
readonly teal: "teal";
|
|
32
|
+
readonly lime: "lime";
|
|
33
|
+
}>;
|
|
34
|
+
export declare const KIND: {
|
|
35
|
+
readonly custom: "custom";
|
|
36
|
+
readonly gray: "gray";
|
|
37
|
+
readonly red: "red";
|
|
23
38
|
readonly orange: "orange";
|
|
39
|
+
readonly yellow: "yellow";
|
|
40
|
+
readonly green: "green";
|
|
41
|
+
readonly blue: "blue";
|
|
24
42
|
readonly purple: "purple";
|
|
25
|
-
readonly
|
|
43
|
+
readonly magenta: "magenta";
|
|
26
44
|
readonly teal: "teal";
|
|
27
45
|
readonly lime: "lime";
|
|
46
|
+
readonly neutral: "neutral";
|
|
47
|
+
readonly primary: "primary";
|
|
48
|
+
readonly accent: "accent";
|
|
49
|
+
readonly positive: "positive";
|
|
50
|
+
readonly warning: "warning";
|
|
51
|
+
readonly negative: "negative";
|
|
52
|
+
readonly black: "black";
|
|
53
|
+
readonly brown: "brown";
|
|
28
54
|
};
|
package/tag/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SIZE = exports.KIND = exports.HIERARCHY = void 0;
|
|
6
|
+
exports.SUPPORTED_KIND = exports.SIZE = exports.KIND = exports.HIERARCHY = exports.DEPRECATED_KIND = void 0;
|
|
7
7
|
/*
|
|
8
8
|
Copyright (c) Uber Technologies, Inc.
|
|
9
9
|
|
|
@@ -11,6 +11,7 @@ This source code is licensed under the MIT license found in the
|
|
|
11
11
|
LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
13
|
const SIZE = exports.SIZE = {
|
|
14
|
+
xSmall: 'xSmall',
|
|
14
15
|
small: 'small',
|
|
15
16
|
medium: 'medium',
|
|
16
17
|
large: 'large'
|
|
@@ -19,26 +20,32 @@ const HIERARCHY = exports.HIERARCHY = Object.freeze({
|
|
|
19
20
|
primary: 'primary',
|
|
20
21
|
secondary: 'secondary'
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
-
// todo: dynamic identity map generation
|
|
24
|
-
const KIND = exports.KIND = {
|
|
25
|
-
custom: 'custom',
|
|
26
|
-
// semantic
|
|
23
|
+
const DEPRECATED_KIND = exports.DEPRECATED_KIND = Object.freeze({
|
|
27
24
|
neutral: 'neutral',
|
|
28
25
|
primary: 'primary',
|
|
29
26
|
accent: 'accent',
|
|
30
27
|
positive: 'positive',
|
|
31
28
|
warning: 'warning',
|
|
32
29
|
negative: 'negative',
|
|
33
|
-
// primitive
|
|
34
30
|
black: 'black',
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
brown: 'brown'
|
|
32
|
+
});
|
|
33
|
+
const SUPPORTED_KIND = exports.SUPPORTED_KIND = Object.freeze({
|
|
34
|
+
custom: 'custom',
|
|
35
|
+
gray: 'gray',
|
|
37
36
|
red: 'red',
|
|
38
|
-
yellow: 'yellow',
|
|
39
37
|
orange: 'orange',
|
|
38
|
+
yellow: 'yellow',
|
|
39
|
+
green: 'green',
|
|
40
|
+
blue: 'blue',
|
|
40
41
|
purple: 'purple',
|
|
41
|
-
|
|
42
|
+
magenta: 'magenta',
|
|
42
43
|
teal: 'teal',
|
|
43
44
|
lime: 'lime'
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// todo: dynamic identity map generation
|
|
48
|
+
const KIND = exports.KIND = {
|
|
49
|
+
...DEPRECATED_KIND,
|
|
50
|
+
...SUPPORTED_KIND
|
|
44
51
|
};
|