baseui 15.0.2 → 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/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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
export default function ButtonInternals(props:
|
|
2
|
+
import type { ButtonInternalsProps } from './types';
|
|
3
|
+
export default function ButtonInternals(props: ButtonInternalsProps): React.JSX.Element;
|
|
@@ -9,6 +9,8 @@ var ReactIs = _interopRequireWildcard(require("react-is"));
|
|
|
9
9
|
var _styledComponents = require("./styled-components");
|
|
10
10
|
var _utils = require("./utils");
|
|
11
11
|
var _overrides = require("../helpers/overrides");
|
|
12
|
+
var _styles = require("../styles");
|
|
13
|
+
var _constants = require("./constants");
|
|
12
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } /*
|
|
@@ -21,13 +23,27 @@ LICENSE file in the root directory of this source tree.
|
|
|
21
23
|
function RenderEnhancer(props) {
|
|
22
24
|
const {
|
|
23
25
|
Enhancer,
|
|
26
|
+
$isHovered,
|
|
27
|
+
$isPressed,
|
|
28
|
+
$isFocused,
|
|
29
|
+
$artworkSize,
|
|
24
30
|
...restProps
|
|
25
31
|
} = props;
|
|
26
32
|
if (typeof Enhancer === 'string') {
|
|
27
33
|
return Enhancer;
|
|
28
34
|
}
|
|
35
|
+
if (typeof Enhancer === 'function') {
|
|
36
|
+
return Enhancer({
|
|
37
|
+
isHovered: $isHovered,
|
|
38
|
+
isPressed: $isPressed,
|
|
39
|
+
isFocused: $isFocused,
|
|
40
|
+
artworkSize: $artworkSize
|
|
41
|
+
});
|
|
42
|
+
}
|
|
29
43
|
if (ReactIs.isValidElementType(Enhancer)) {
|
|
30
|
-
return /*#__PURE__*/React.createElement(Enhancer, restProps
|
|
44
|
+
return /*#__PURE__*/React.createElement(Enhancer, _extends({}, restProps, {
|
|
45
|
+
size: $artworkSize
|
|
46
|
+
}));
|
|
31
47
|
}
|
|
32
48
|
return Enhancer;
|
|
33
49
|
}
|
|
@@ -35,16 +51,49 @@ function ButtonInternals(props) {
|
|
|
35
51
|
const {
|
|
36
52
|
children,
|
|
37
53
|
overrides = {},
|
|
54
|
+
isHovered = false,
|
|
55
|
+
isPressed = false,
|
|
56
|
+
isFocused = false,
|
|
38
57
|
startEnhancer,
|
|
39
|
-
endEnhancer
|
|
58
|
+
endEnhancer,
|
|
59
|
+
widthType
|
|
40
60
|
} = props;
|
|
61
|
+
const [, theme] = (0, _styles.useStyletron)();
|
|
41
62
|
const [StartEnhancer, startEnhancerProps] = (0, _overrides.getOverrides)(overrides.StartEnhancer, _styledComponents.StartEnhancer);
|
|
42
63
|
const [EndEnhancer, endEnhancerProps] = (0, _overrides.getOverrides)(overrides.EndEnhancer, _styledComponents.EndEnhancer);
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
const [StartEnhancerButtonContentContainer, startEnhancerButtonContentContainerProps] = (0, _overrides.getOverrides)(overrides.StartEnhancerButtonContentContainer, _styledComponents.StartEnhancerButtonContentContainer);
|
|
65
|
+
const sharedProps = {
|
|
66
|
+
...(0, _utils.getSharedProps)(props),
|
|
67
|
+
$isHovered: isHovered,
|
|
68
|
+
$isPressed: isPressed,
|
|
69
|
+
$isFocused: isFocused
|
|
70
|
+
};
|
|
71
|
+
const artworkSize = (0, _styledComponents.getArtworkSize)({
|
|
72
|
+
$theme: theme,
|
|
73
|
+
$size: sharedProps.$size
|
|
74
|
+
});
|
|
75
|
+
const startEnhancerButtonContent = /*#__PURE__*/React.createElement(React.Fragment, null, startEnhancer !== null && startEnhancer !== undefined && /*#__PURE__*/React.createElement(StartEnhancer, _extends({}, sharedProps, startEnhancerProps, {
|
|
76
|
+
"aria-hidden": Boolean(children)
|
|
77
|
+
}), /*#__PURE__*/React.createElement(RenderEnhancer, {
|
|
78
|
+
Enhancer: startEnhancer,
|
|
79
|
+
$isHovered: isHovered,
|
|
80
|
+
$isPressed: isPressed,
|
|
81
|
+
$isFocused: isFocused,
|
|
82
|
+
$artworkSize: artworkSize
|
|
83
|
+
})), typeof children === 'function' ? children({
|
|
84
|
+
isHovered,
|
|
85
|
+
isPressed,
|
|
86
|
+
isFocused,
|
|
87
|
+
artworkSize
|
|
88
|
+
}) : children);
|
|
89
|
+
const content = /*#__PURE__*/React.createElement(React.Fragment, null, widthType === _constants.WIDTH_TYPE.fill ? /*#__PURE__*/React.createElement(StartEnhancerButtonContentContainer, _extends({}, sharedProps, startEnhancerButtonContentContainerProps), startEnhancerButtonContent) : /*#__PURE__*/React.createElement(React.Fragment, null, startEnhancerButtonContent), endEnhancer !== null && endEnhancer !== undefined && /*#__PURE__*/React.createElement(EndEnhancer, _extends({}, sharedProps, endEnhancerProps, {
|
|
90
|
+
"aria-hidden": Boolean(children)
|
|
91
|
+
}), /*#__PURE__*/React.createElement(RenderEnhancer, {
|
|
92
|
+
Enhancer: endEnhancer,
|
|
93
|
+
$isHovered: isHovered,
|
|
94
|
+
$isPressed: isPressed,
|
|
95
|
+
$isFocused: isFocused,
|
|
96
|
+
$artworkSize: artworkSize
|
|
48
97
|
})));
|
|
49
98
|
if (props.isLoading) {
|
|
50
99
|
const hiddenStyle = {
|
package/button/button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { BaseButtonProps, SharedStyleProps } from './types';
|
|
3
3
|
export interface ButtonComponentType {
|
|
4
|
-
<C extends React.ElementType = 'button'>(props:
|
|
4
|
+
<C extends React.ElementType = 'button'>(props: BaseButtonProps & Omit<React.ComponentProps<C>, keyof BaseButtonProps | keyof SharedStyleProps> & SharedStyleProps<C | React.ComponentType<any> | keyof JSX.IntrinsicElements>): JSX.Element;
|
|
5
5
|
displayName?: string;
|
|
6
6
|
}
|
|
7
7
|
declare const ForwardedButton: ButtonComponentType;
|
package/button/button.js
CHANGED
|
@@ -27,7 +27,9 @@ class Button extends React.Component {
|
|
|
27
27
|
constructor(..._args) {
|
|
28
28
|
super(..._args);
|
|
29
29
|
_defineProperty(this, "state", {
|
|
30
|
-
isFocusVisible: false
|
|
30
|
+
isFocusVisible: false,
|
|
31
|
+
isHovered: false,
|
|
32
|
+
isPressed: false
|
|
31
33
|
});
|
|
32
34
|
// @ts-ignore
|
|
33
35
|
_defineProperty(this, "internalOnClick", (...args) => {
|
|
@@ -57,6 +59,42 @@ class Button extends React.Component {
|
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
});
|
|
62
|
+
_defineProperty(this, "handleHovered", event => {
|
|
63
|
+
this.setState({
|
|
64
|
+
isHovered: true
|
|
65
|
+
});
|
|
66
|
+
// Forward the mouse enter event to user handler if provided
|
|
67
|
+
if (this.props.onMouseEnter) {
|
|
68
|
+
this.props.onMouseEnter(event);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
_defineProperty(this, "handleNotHovered", event => {
|
|
72
|
+
this.setState({
|
|
73
|
+
isHovered: false
|
|
74
|
+
});
|
|
75
|
+
// Forward the mouse leave event to user handler if provided
|
|
76
|
+
if (this.props.onMouseLeave) {
|
|
77
|
+
this.props.onMouseLeave(event);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
_defineProperty(this, "handlePressed", event => {
|
|
81
|
+
this.setState({
|
|
82
|
+
isPressed: true
|
|
83
|
+
});
|
|
84
|
+
// Forward the mouse down event to user handler if provided
|
|
85
|
+
if (this.props.onMouseDown) {
|
|
86
|
+
this.props.onMouseDown(event);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
_defineProperty(this, "handleNotPressed", event => {
|
|
90
|
+
this.setState({
|
|
91
|
+
isPressed: false
|
|
92
|
+
});
|
|
93
|
+
// Forward the mouse up event to user handler if provided
|
|
94
|
+
if (this.props.onMouseUp) {
|
|
95
|
+
this.props.onMouseUp(event);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
60
98
|
}
|
|
61
99
|
render() {
|
|
62
100
|
const {
|
|
@@ -67,6 +105,8 @@ class Button extends React.Component {
|
|
|
67
105
|
kind,
|
|
68
106
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
107
|
shape,
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
|
+
minHitArea,
|
|
70
110
|
isLoading,
|
|
71
111
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
72
112
|
isSelected,
|
|
@@ -75,14 +115,19 @@ class Button extends React.Component {
|
|
|
75
115
|
startEnhancer,
|
|
76
116
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
77
117
|
endEnhancer,
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
118
|
children,
|
|
80
119
|
forwardedRef,
|
|
81
120
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
82
121
|
colors,
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
123
|
+
backgroundSafe,
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
125
|
+
widthType,
|
|
126
|
+
'aria-label': ariaLabel,
|
|
83
127
|
...restProps
|
|
84
128
|
} = this.props;
|
|
85
|
-
|
|
129
|
+
|
|
130
|
+
// Get overrides.
|
|
86
131
|
const isAnchor = 'href' in restProps && Boolean(restProps?.href);
|
|
87
132
|
const [BaseButton, baseButtonProps] = (0, _overrides.getOverrides)(
|
|
88
133
|
// adding both (1) BaseButton and (2) Root
|
|
@@ -93,20 +138,33 @@ class Button extends React.Component {
|
|
|
93
138
|
const [LoadingSpinnerContainer, loadingSpinnerContainerProps] = (0, _overrides.getOverrides)(overrides.LoadingSpinnerContainer, _styledComponents.LoadingSpinnerContainer);
|
|
94
139
|
const sharedProps = {
|
|
95
140
|
...(0, _utils.getSharedProps)(this.props),
|
|
96
|
-
$isFocusVisible: this.state.isFocusVisible
|
|
141
|
+
$isFocusVisible: this.state.isFocusVisible,
|
|
142
|
+
$isHovered: this.state.isHovered,
|
|
143
|
+
$isPressed: this.state.isPressed
|
|
97
144
|
};
|
|
98
145
|
const ariaLoadingElements = isLoading ? {
|
|
99
|
-
['aria-label']: typeof
|
|
146
|
+
['aria-label']: ariaLabel ? ariaLabel : typeof children === 'string' ? `loading ${children}` : 'content is loading',
|
|
100
147
|
['aria-busy']: 'true',
|
|
101
148
|
['aria-live']: 'polite'
|
|
102
149
|
} : {};
|
|
103
150
|
const ariaDisabledProps = restProps?.disabled && isAnchor ? {
|
|
104
151
|
['aria-disabled']: true
|
|
105
152
|
} : {};
|
|
153
|
+
const ariaLabelProps = isLoading ? {} : ariaLabel ? {
|
|
154
|
+
['aria-label']: ariaLabel
|
|
155
|
+
} : typeof children === 'string' ? {
|
|
156
|
+
['aria-label']: children
|
|
157
|
+
} : {};
|
|
158
|
+
// Only need to apply aria-pressed if it's a standalone button with isSelected prop
|
|
159
|
+
const ariaPressedProps =
|
|
160
|
+
// Button group component will pass aria-checked prop
|
|
161
|
+
typeof baseButtonProps['aria-checked'] === 'undefined' && typeof isSelected === 'boolean' ? {
|
|
162
|
+
['aria-pressed']: isSelected
|
|
163
|
+
} : {};
|
|
106
164
|
return /*#__PURE__*/React.createElement(BaseButton, _extends({
|
|
107
165
|
ref: forwardedRef,
|
|
108
166
|
"data-baseweb": "button"
|
|
109
|
-
}, ariaLoadingElements, ariaDisabledProps, sharedProps, restProps, baseButtonProps, {
|
|
167
|
+
}, ariaLoadingElements, ariaDisabledProps, ariaLabelProps, ariaPressedProps, sharedProps, restProps, baseButtonProps, {
|
|
110
168
|
// Applies last to override passed in onClick
|
|
111
169
|
onClick: this.internalOnClick,
|
|
112
170
|
onFocus: (0, _focusVisible.forkFocus)({
|
|
@@ -116,8 +174,22 @@ class Button extends React.Component {
|
|
|
116
174
|
onBlur: (0, _focusVisible.forkBlur)({
|
|
117
175
|
...restProps,
|
|
118
176
|
...baseButtonProps
|
|
119
|
-
}, this.handleBlur)
|
|
120
|
-
|
|
177
|
+
}, this.handleBlur),
|
|
178
|
+
onMouseEnter: this.handleHovered,
|
|
179
|
+
onMouseLeave: this.handleNotHovered,
|
|
180
|
+
onMouseDown: this.handlePressed,
|
|
181
|
+
onMouseUp: this.handleNotPressed
|
|
182
|
+
}), isLoading ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_buttonInternals.default, _extends({}, this.props, {
|
|
183
|
+
isHovered: this.state.isHovered,
|
|
184
|
+
isPressed: this.state.isPressed,
|
|
185
|
+
isFocused: this.state.isFocusVisible
|
|
186
|
+
})), /*#__PURE__*/React.createElement(LoadingSpinnerContainer, _extends({}, sharedProps, loadingSpinnerContainerProps, {
|
|
187
|
+
"aria-hidden": true
|
|
188
|
+
}), /*#__PURE__*/React.createElement(LoadingSpinner, _extends({}, sharedProps, loadingSpinnerProps)))) : /*#__PURE__*/React.createElement(_buttonInternals.default, _extends({}, this.props, {
|
|
189
|
+
isHovered: this.state.isHovered,
|
|
190
|
+
isPressed: this.state.isPressed,
|
|
191
|
+
isFocused: this.state.isFocusVisible
|
|
192
|
+
})));
|
|
121
193
|
}
|
|
122
194
|
}
|
|
123
195
|
_defineProperty(Button, "defaultProps", _defaultProps.defaultProps);
|
package/button/constants.d.ts
CHANGED
|
@@ -2,10 +2,21 @@ export declare const KIND: {
|
|
|
2
2
|
readonly primary: "primary";
|
|
3
3
|
readonly secondary: "secondary";
|
|
4
4
|
readonly tertiary: "tertiary";
|
|
5
|
+
readonly dangerPrimary: "dangerPrimary";
|
|
6
|
+
readonly dangerSecondary: "dangerSecondary";
|
|
7
|
+
readonly dangerTertiary: "dangerTertiary";
|
|
5
8
|
};
|
|
9
|
+
export declare const BUTTON_GROUP_EXCLUSIVE_KINDS: Readonly<{
|
|
10
|
+
readonly outline: "outline";
|
|
11
|
+
}>;
|
|
6
12
|
export declare const SHAPE: {
|
|
7
13
|
readonly default: "default";
|
|
14
|
+
readonly rectangular: "rectangular";
|
|
15
|
+
readonly rounded: "rounded";
|
|
8
16
|
readonly pill: "pill";
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use 'circle' or 'square' instead for icon-only buttons
|
|
19
|
+
*/
|
|
9
20
|
readonly round: "round";
|
|
10
21
|
readonly circle: "circle";
|
|
11
22
|
readonly square: "square";
|
|
@@ -15,4 +26,15 @@ export declare const SIZE: {
|
|
|
15
26
|
readonly default: "default";
|
|
16
27
|
readonly compact: "compact";
|
|
17
28
|
readonly large: "large";
|
|
29
|
+
readonly xSmall: "xSmall";
|
|
30
|
+
readonly small: "small";
|
|
31
|
+
readonly medium: "medium";
|
|
32
|
+
};
|
|
33
|
+
export declare const MIN_HIT_AREA: {
|
|
34
|
+
readonly tap: "tap";
|
|
35
|
+
readonly click: "click";
|
|
36
|
+
};
|
|
37
|
+
export declare const WIDTH_TYPE: {
|
|
38
|
+
readonly hug: "hug";
|
|
39
|
+
readonly fill: "fill";
|
|
18
40
|
};
|
package/button/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SIZE = exports.SHAPE = exports.KIND = void 0;
|
|
6
|
+
exports.WIDTH_TYPE = exports.SIZE = exports.SHAPE = exports.MIN_HIT_AREA = exports.KIND = exports.BUTTON_GROUP_EXCLUSIVE_KINDS = void 0;
|
|
7
7
|
/*
|
|
8
8
|
Copyright (c) Uber Technologies, Inc.
|
|
9
9
|
|
|
@@ -13,18 +13,46 @@ LICENSE file in the root directory of this source tree.
|
|
|
13
13
|
const KIND = exports.KIND = {
|
|
14
14
|
primary: 'primary',
|
|
15
15
|
secondary: 'secondary',
|
|
16
|
-
tertiary: 'tertiary'
|
|
16
|
+
tertiary: 'tertiary',
|
|
17
|
+
dangerPrimary: 'dangerPrimary',
|
|
18
|
+
dangerSecondary: 'dangerSecondary',
|
|
19
|
+
dangerTertiary: 'dangerTertiary'
|
|
17
20
|
};
|
|
21
|
+
const BUTTON_GROUP_EXCLUSIVE_KINDS = exports.BUTTON_GROUP_EXCLUSIVE_KINDS = Object.freeze({
|
|
22
|
+
outline: 'outline'
|
|
23
|
+
});
|
|
18
24
|
const SHAPE = exports.SHAPE = {
|
|
19
25
|
default: 'default',
|
|
26
|
+
rectangular: 'rectangular',
|
|
27
|
+
// same as default
|
|
28
|
+
rounded: 'rounded',
|
|
29
|
+
// same as pill
|
|
20
30
|
pill: 'pill',
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use 'circle' or 'square' instead for icon-only buttons
|
|
33
|
+
*/
|
|
21
34
|
round: 'round',
|
|
22
35
|
circle: 'circle',
|
|
23
36
|
square: 'square'
|
|
24
37
|
};
|
|
25
38
|
const SIZE = exports.SIZE = {
|
|
26
39
|
mini: 'mini',
|
|
40
|
+
// 'xSmall'
|
|
27
41
|
default: 'default',
|
|
42
|
+
// 'medium'
|
|
28
43
|
compact: 'compact',
|
|
29
|
-
|
|
44
|
+
// 'small'
|
|
45
|
+
large: 'large',
|
|
46
|
+
// 'large'
|
|
47
|
+
xSmall: 'xSmall',
|
|
48
|
+
small: 'small',
|
|
49
|
+
medium: 'medium'
|
|
50
|
+
};
|
|
51
|
+
const MIN_HIT_AREA = exports.MIN_HIT_AREA = {
|
|
52
|
+
tap: 'tap',
|
|
53
|
+
click: 'click'
|
|
54
|
+
};
|
|
55
|
+
const WIDTH_TYPE = exports.WIDTH_TYPE = {
|
|
56
|
+
hug: 'hug',
|
|
57
|
+
fill: 'fill'
|
|
30
58
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare const defaultProps: {
|
|
2
|
+
backgroundSafe: boolean;
|
|
2
3
|
disabled: boolean;
|
|
4
|
+
minHitArea: "click";
|
|
3
5
|
isLoading: boolean;
|
|
4
|
-
isSelected: boolean;
|
|
5
6
|
kind: "primary";
|
|
6
7
|
overrides: {};
|
|
7
|
-
shape: "
|
|
8
|
-
size: "
|
|
8
|
+
shape: "rectangular";
|
|
9
|
+
size: "medium";
|
|
10
|
+
widthType: "hug";
|
|
9
11
|
};
|
package/button/default-props.js
CHANGED
|
@@ -13,11 +13,13 @@ LICENSE file in the root directory of this source tree.
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const defaultProps = exports.defaultProps = {
|
|
16
|
+
backgroundSafe: false,
|
|
16
17
|
disabled: false,
|
|
18
|
+
minHitArea: _constants.MIN_HIT_AREA.click,
|
|
17
19
|
isLoading: false,
|
|
18
|
-
isSelected: false,
|
|
19
20
|
kind: _constants.KIND.primary,
|
|
20
21
|
overrides: {},
|
|
21
|
-
shape: _constants.SHAPE.
|
|
22
|
-
size: _constants.SIZE.
|
|
22
|
+
shape: _constants.SHAPE.rectangular,
|
|
23
|
+
size: _constants.SIZE.medium,
|
|
24
|
+
widthType: _constants.WIDTH_TYPE.hug
|
|
23
25
|
};
|
package/button/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CustomColors } from './types';
|
|
2
2
|
export { default as Button } from './button';
|
|
3
|
-
export { KIND, SIZE, SHAPE } from './constants';
|
|
3
|
+
export { KIND, SIZE, SHAPE, MIN_HIT_AREA, WIDTH_TYPE, BUTTON_GROUP_EXCLUSIVE_KINDS, } from './constants';
|
|
4
4
|
export { BaseButton as StyledBaseButton, StartEnhancer as StyledStartEnhancer, EndEnhancer as StyledEndEnhancer, LoadingSpinner as StyledLoadingSpinner, LoadingSpinnerContainer as StyledLoadingSpinnerContainer, } from './styled-components';
|
|
5
5
|
export * from './types';
|
|
6
6
|
/** @deprecated use CustomColors instead. To be removed in future versions.*/
|
package/button/index.js
CHANGED
|
@@ -8,12 +8,21 @@ var _exportNames = {
|
|
|
8
8
|
KIND: true,
|
|
9
9
|
SIZE: true,
|
|
10
10
|
SHAPE: true,
|
|
11
|
+
MIN_HIT_AREA: true,
|
|
12
|
+
WIDTH_TYPE: true,
|
|
13
|
+
BUTTON_GROUP_EXCLUSIVE_KINDS: true,
|
|
11
14
|
StyledBaseButton: true,
|
|
12
15
|
StyledStartEnhancer: true,
|
|
13
16
|
StyledEndEnhancer: true,
|
|
14
17
|
StyledLoadingSpinner: true,
|
|
15
18
|
StyledLoadingSpinnerContainer: true
|
|
16
19
|
};
|
|
20
|
+
Object.defineProperty(exports, "BUTTON_GROUP_EXCLUSIVE_KINDS", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _constants.BUTTON_GROUP_EXCLUSIVE_KINDS;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
17
26
|
Object.defineProperty(exports, "Button", {
|
|
18
27
|
enumerable: true,
|
|
19
28
|
get: function () {
|
|
@@ -26,6 +35,12 @@ Object.defineProperty(exports, "KIND", {
|
|
|
26
35
|
return _constants.KIND;
|
|
27
36
|
}
|
|
28
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "MIN_HIT_AREA", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _constants.MIN_HIT_AREA;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
29
44
|
Object.defineProperty(exports, "SHAPE", {
|
|
30
45
|
enumerable: true,
|
|
31
46
|
get: function () {
|
|
@@ -68,6 +83,12 @@ Object.defineProperty(exports, "StyledStartEnhancer", {
|
|
|
68
83
|
return _styledComponents.StartEnhancer;
|
|
69
84
|
}
|
|
70
85
|
});
|
|
86
|
+
Object.defineProperty(exports, "WIDTH_TYPE", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: function () {
|
|
89
|
+
return _constants.WIDTH_TYPE;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
71
92
|
var _button = _interopRequireDefault(require("./button"));
|
|
72
93
|
var _constants = require("./constants");
|
|
73
94
|
var _styledComponents = require("./styled-components");
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import { type Theme } from '../styles';
|
|
2
|
+
import { SIZE } from './constants';
|
|
1
3
|
import type { SharedStyleProps } from './types';
|
|
2
4
|
export declare const BaseButton: import("styletron-react").StyletronComponent<"button", SharedStyleProps>;
|
|
3
5
|
export declare const AnchorBaseButton: import("styletron-react").StyletronComponent<"a", SharedStyleProps>;
|
|
4
6
|
export declare const EndEnhancer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
|
|
5
7
|
export declare const StartEnhancer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
|
|
8
|
+
export declare const StartEnhancerButtonContentContainer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
|
|
6
9
|
export declare const LoadingSpinnerContainer: import("styletron-react").StyletronComponent<"div", SharedStyleProps>;
|
|
7
10
|
export declare const LoadingSpinner: import("styletron-react").StyletronComponent<"span", SharedStyleProps>;
|
|
11
|
+
export declare const getArtworkSize: ({ $theme, $size }: {
|
|
12
|
+
$theme: Theme;
|
|
13
|
+
$size?: keyof typeof SIZE;
|
|
14
|
+
}) => string;
|