@mirohq/design-system-button 2.0.17 → 3.0.0-button.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/dist/main.js +264 -315
- package/dist/main.js.map +1 -1
- package/dist/module.js +265 -316
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +441 -53
- package/package.json +5 -4
package/dist/main.js
CHANGED
|
@@ -3,303 +3,292 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var button = require('@react-aria/button');
|
|
7
|
-
var utils = require('@react-aria/utils');
|
|
8
6
|
var designSystemSpinner = require('@mirohq/design-system-spinner');
|
|
9
|
-
var link = require('@react-aria/link');
|
|
10
|
-
var focus = require('@react-aria/focus');
|
|
11
7
|
var designSystemPrimitive = require('@mirohq/design-system-primitive');
|
|
12
8
|
var designSystemStitches = require('@mirohq/design-system-stitches');
|
|
9
|
+
var designSystemBaseButton = require('@mirohq/design-system-base-button');
|
|
13
10
|
var designSystemStyles = require('@mirohq/design-system-styles');
|
|
14
11
|
|
|
15
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
13
|
|
|
17
14
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
15
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const StyledIconSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.svg, {});
|
|
17
|
+
const IconSlot = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => /* @__PURE__ */ React__default["default"].createElement(StyledIconSlot, {
|
|
18
|
+
...restProps,
|
|
19
|
+
ref: forwardRef,
|
|
20
|
+
asChild: true
|
|
21
|
+
}, children));
|
|
22
|
+
|
|
23
|
+
const activeSelector = "&:active, &[data-pressed]";
|
|
24
|
+
const disabledSelector = '&[disabled], &[aria-disabled="true"]';
|
|
25
|
+
const iconSlotSelector = `& ${StyledIconSlot}`;
|
|
26
|
+
const solidDisabled = {
|
|
27
|
+
[disabledSelector]: {
|
|
28
|
+
backgroundColor: "$background-neutrals-disabled",
|
|
29
|
+
color: "$text-neutrals-disabled",
|
|
30
|
+
[iconSlotSelector]: {
|
|
31
|
+
color: "$icon-neutrals-disabled"
|
|
32
|
+
}
|
|
22
33
|
}
|
|
23
34
|
};
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
borderColor: "
|
|
35
|
+
const outlineDisabled = {
|
|
36
|
+
[disabledSelector]: {
|
|
37
|
+
backgroundColor: "$background-neutrals",
|
|
38
|
+
borderColor: "$border-neutrals-disabled",
|
|
39
|
+
color: "$text-neutrals-disabled",
|
|
40
|
+
[iconSlotSelector]: {
|
|
41
|
+
color: "$icon-neutrals-disabled"
|
|
42
|
+
}
|
|
28
43
|
}
|
|
29
44
|
};
|
|
30
|
-
const
|
|
31
|
-
|
|
45
|
+
const ghostDisabled = {
|
|
46
|
+
[disabledSelector]: {
|
|
47
|
+
color: "$text-neutrals-disabled",
|
|
48
|
+
backgroundColor: "$transparent",
|
|
49
|
+
[iconSlotSelector]: {
|
|
50
|
+
color: "$icon-neutrals-disabled"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
32
53
|
};
|
|
33
|
-
const
|
|
34
|
-
const StyledButton = designSystemStitches.styled(
|
|
35
|
-
|
|
36
|
-
display: "inline-block",
|
|
37
|
-
outline: "none",
|
|
54
|
+
const LABEL_OFFSET = 2;
|
|
55
|
+
const StyledButton = designSystemStitches.styled(designSystemBaseButton.BaseButton, {
|
|
56
|
+
userSelect: "none",
|
|
38
57
|
whiteSpace: "nowrap",
|
|
39
58
|
textOverflow: "ellipsis",
|
|
40
59
|
textAlign: "center",
|
|
41
|
-
verticalAlign: "middle",
|
|
42
|
-
userSelect: "none",
|
|
43
|
-
fontFamily: "inherit",
|
|
44
|
-
fontStyle: "normal",
|
|
45
|
-
fontStretch: "normal",
|
|
46
|
-
letterSpacing: "normal",
|
|
47
|
-
fontWeight: "normal",
|
|
48
60
|
position: "relative",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"&[
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
width: "fit-content",
|
|
62
|
+
maxWidth: "100%",
|
|
63
|
+
lineHeight: 1.5,
|
|
64
|
+
border: "1px solid transparent",
|
|
65
|
+
"&[data-focused]": designSystemStyles.focus.smallOutlineStyle,
|
|
66
|
+
[`& ${StyledIconSlot}:first-child`]: {
|
|
67
|
+
marginLeft: -LABEL_OFFSET,
|
|
68
|
+
marginRight: `calc($50 + ${LABEL_OFFSET}px)`
|
|
69
|
+
},
|
|
70
|
+
[`& ${StyledIconSlot}:last-child`]: {
|
|
71
|
+
marginRight: -LABEL_OFFSET,
|
|
72
|
+
marginLeft: `calc($50 + ${LABEL_OFFSET}px)`
|
|
56
73
|
},
|
|
57
74
|
variants: {
|
|
58
75
|
variant: {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
lineHeight: "28px",
|
|
73
|
-
height: "60px"
|
|
76
|
+
"solid-prominent": {
|
|
77
|
+
backgroundColor: "$background-primary-prominent",
|
|
78
|
+
color: "$text-primary-inverted",
|
|
79
|
+
[iconSlotSelector]: {
|
|
80
|
+
color: "$icon-primary-inverted"
|
|
81
|
+
},
|
|
82
|
+
"&:hover": {
|
|
83
|
+
backgroundColor: "$background-primary-prominent-hover"
|
|
84
|
+
},
|
|
85
|
+
[activeSelector]: {
|
|
86
|
+
backgroundColor: "$background-primary-prominent-active"
|
|
87
|
+
},
|
|
88
|
+
...solidDisabled
|
|
74
89
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
90
|
+
"outline-prominent": {
|
|
91
|
+
backgroundColor: "$background-neutrals",
|
|
92
|
+
borderColor: "$border-primary",
|
|
93
|
+
color: "$text-primary",
|
|
94
|
+
[iconSlotSelector]: {
|
|
95
|
+
color: "$icon-primary"
|
|
96
|
+
},
|
|
97
|
+
"&:hover": {
|
|
98
|
+
backgroundColor: "$background-primary-subtle-hover",
|
|
99
|
+
borderColor: "$border-primary-hover",
|
|
100
|
+
color: "$text-primary-hover",
|
|
101
|
+
[iconSlotSelector]: {
|
|
102
|
+
color: "$icon-primary-hover"
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
[activeSelector]: {
|
|
106
|
+
backgroundColor: "$background-primary-subtle-active",
|
|
107
|
+
borderColor: "$border-primary-active",
|
|
108
|
+
color: "$text-primary-active",
|
|
109
|
+
[iconSlotSelector]: {
|
|
110
|
+
color: "$icon-primary-active"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
...outlineDisabled
|
|
80
114
|
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
115
|
+
"ghost-prominent": {
|
|
116
|
+
backgroundColor: "transparent",
|
|
117
|
+
color: "$text-primary",
|
|
118
|
+
"&:hover": {
|
|
119
|
+
backgroundColor: "$background-primary-subtle-hover",
|
|
120
|
+
color: "$text-primary-hover",
|
|
121
|
+
[iconSlotSelector]: {
|
|
122
|
+
color: "$icon-primary-hover"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
[activeSelector]: {
|
|
126
|
+
backgroundColor: "$background-primary-subtle-active",
|
|
127
|
+
color: "$text-primary-active",
|
|
128
|
+
[iconSlotSelector]: {
|
|
129
|
+
color: "$icon-primary-active"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
...ghostDisabled
|
|
86
133
|
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
134
|
+
"solid-subtle": {
|
|
135
|
+
backgroundColor: "$background-neutrals-subtle",
|
|
136
|
+
color: "$text-neutrals",
|
|
137
|
+
[iconSlotSelector]: {
|
|
138
|
+
color: "$icon-neutrals"
|
|
139
|
+
},
|
|
140
|
+
"&:hover": {
|
|
141
|
+
backgroundColor: "$background-neutrals-subtle-hover"
|
|
142
|
+
},
|
|
143
|
+
[activeSelector]: {
|
|
144
|
+
backgroundColor: "$background-neutrals-subtle-active"
|
|
145
|
+
},
|
|
146
|
+
...solidDisabled
|
|
92
147
|
},
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
rounded: {
|
|
101
|
-
true: {
|
|
102
|
-
borderRadius: "$half"
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
loading: {
|
|
106
|
-
true: {
|
|
107
|
-
"&[disabled]": {
|
|
108
|
-
cursor: "default",
|
|
109
|
-
opacity: 1,
|
|
110
|
-
pointerEvents: "none",
|
|
111
|
-
"& > span": {
|
|
112
|
-
visibility: "hidden"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
fluid: {
|
|
118
|
-
true: {
|
|
119
|
-
width: "100%",
|
|
120
|
-
display: "block"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
compoundVariants: [
|
|
125
|
-
{
|
|
126
|
-
size: "small",
|
|
127
|
-
rounded: true,
|
|
128
|
-
css: {
|
|
129
|
-
padding: "10px 16px",
|
|
130
|
-
height: "40px"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
size: "large",
|
|
135
|
-
rounded: false,
|
|
136
|
-
css: {
|
|
137
|
-
borderRadius: "$50"
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
size: "medium",
|
|
142
|
-
rounded: false,
|
|
143
|
-
css: {
|
|
144
|
-
borderRadius: "$50"
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
size: "small",
|
|
149
|
-
rounded: false,
|
|
150
|
-
css: {
|
|
151
|
-
borderRadius: "$50"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
size: "x-small",
|
|
156
|
-
rounded: false,
|
|
157
|
-
css: {
|
|
158
|
-
borderRadius: "$50"
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
size: "xx-small",
|
|
163
|
-
rounded: false,
|
|
164
|
-
css: {
|
|
165
|
-
borderRadius: "$25"
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
variant: "primary",
|
|
170
|
-
appearance: "filled",
|
|
171
|
-
css: {
|
|
172
|
-
color: "$white",
|
|
173
|
-
backgroundColor: "$blue-600",
|
|
174
|
-
...focusFilled,
|
|
148
|
+
"outline-subtle": {
|
|
149
|
+
backgroundColor: "$background-neutrals",
|
|
150
|
+
border: "1px solid $border-neutrals",
|
|
151
|
+
color: "$text-neutrals",
|
|
152
|
+
[iconSlotSelector]: {
|
|
153
|
+
color: "$icon-neutrals"
|
|
154
|
+
},
|
|
175
155
|
"&:hover": {
|
|
176
|
-
|
|
177
|
-
|
|
156
|
+
backgroundColor: "$background-neutrals-subtle-hover",
|
|
157
|
+
borderColor: "$border-neutrals-hover"
|
|
158
|
+
},
|
|
159
|
+
[activeSelector]: {
|
|
160
|
+
backgroundColor: "$background-neutrals-subtle-active",
|
|
161
|
+
borderColor: "$border-neutrals-active"
|
|
162
|
+
},
|
|
163
|
+
...outlineDisabled
|
|
164
|
+
},
|
|
165
|
+
"ghost-subtle": {
|
|
166
|
+
backgroundColor: "transparent",
|
|
167
|
+
color: "$text-neutrals",
|
|
168
|
+
[iconSlotSelector]: {
|
|
169
|
+
color: "$icon-neutrals"
|
|
178
170
|
},
|
|
179
|
-
[pressedSelector]: {
|
|
180
|
-
backgroundColor: "$blue-900"
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
variant: "primary",
|
|
186
|
-
appearance: "outlined",
|
|
187
|
-
css: {
|
|
188
|
-
color: "rgba(66, 98, 255, 1)",
|
|
189
|
-
border: "1px solid rgba(66, 98, 255, 1)",
|
|
190
|
-
...focusOutline,
|
|
191
171
|
"&:hover": {
|
|
192
|
-
|
|
193
|
-
|
|
172
|
+
backgroundColor: "$background-neutrals-subtle-hover"
|
|
173
|
+
},
|
|
174
|
+
[activeSelector]: {
|
|
175
|
+
backgroundColor: "$background-neutrals-subtle-active"
|
|
176
|
+
},
|
|
177
|
+
...ghostDisabled
|
|
178
|
+
},
|
|
179
|
+
"solid-danger": {
|
|
180
|
+
backgroundColor: "$background-danger-prominent",
|
|
181
|
+
color: "$text-danger-inverted",
|
|
182
|
+
[iconSlotSelector]: {
|
|
183
|
+
color: "$icon-danger-inverted"
|
|
194
184
|
},
|
|
195
|
-
[pressedSelector]: {
|
|
196
|
-
backgroundColor: "rgba(240, 242, 255, 1)"
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
variant: "primary",
|
|
202
|
-
appearance: "flat",
|
|
203
|
-
css: {
|
|
204
|
-
color: "rgba(66, 98, 255, 1)",
|
|
205
|
-
...focusDefault,
|
|
206
185
|
"&:hover": {
|
|
207
|
-
|
|
208
|
-
|
|
186
|
+
backgroundColor: "$background-danger-prominent-hover"
|
|
187
|
+
},
|
|
188
|
+
[activeSelector]: {
|
|
189
|
+
backgroundColor: "$background-danger-prominent-active"
|
|
190
|
+
},
|
|
191
|
+
...solidDisabled
|
|
192
|
+
},
|
|
193
|
+
"outline-danger": {
|
|
194
|
+
backgroundColor: "$background-neutrals",
|
|
195
|
+
borderColor: "$border-danger",
|
|
196
|
+
color: "$text-danger",
|
|
197
|
+
[iconSlotSelector]: {
|
|
198
|
+
color: "$icon-danger"
|
|
209
199
|
},
|
|
210
|
-
[pressedSelector]: {
|
|
211
|
-
color: "rgba(61, 81, 212, 1)"
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
variant: "secondary",
|
|
217
|
-
appearance: "filled",
|
|
218
|
-
css: {
|
|
219
|
-
color: "rgba(5, 0, 56, 1)",
|
|
220
|
-
backgroundColor: "rgba(245, 245, 247, 1)",
|
|
221
|
-
...focusFilled,
|
|
222
200
|
"&:hover": {
|
|
223
|
-
|
|
224
|
-
|
|
201
|
+
backgroundColor: "$background-danger",
|
|
202
|
+
color: "$text-danger-hover",
|
|
203
|
+
[iconSlotSelector]: {
|
|
204
|
+
color: "$icon-danger-hover"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[activeSelector]: {
|
|
208
|
+
backgroundColor: "$background-danger-hover",
|
|
209
|
+
color: "$text-danger-active",
|
|
210
|
+
[iconSlotSelector]: {
|
|
211
|
+
color: "$icon-danger-active"
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
...outlineDisabled
|
|
215
|
+
},
|
|
216
|
+
"ghost-danger": {
|
|
217
|
+
backgroundColor: "transparent",
|
|
218
|
+
color: "$text-danger",
|
|
219
|
+
[iconSlotSelector]: {
|
|
220
|
+
color: "$icon-danger"
|
|
225
221
|
},
|
|
226
|
-
[pressedSelector]: {
|
|
227
|
-
backgroundColor: "rgba(235, 235, 239, 1)"
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
variant: "secondary",
|
|
233
|
-
appearance: "outlined",
|
|
234
|
-
css: {
|
|
235
|
-
color: "rgba(5, 0, 56, 1)",
|
|
236
|
-
border: "1px solid rgba(205, 204, 215, 1)",
|
|
237
|
-
...focusOutline,
|
|
238
222
|
"&:hover": {
|
|
239
|
-
|
|
240
|
-
|
|
223
|
+
backgroundColor: "$background-danger",
|
|
224
|
+
color: "$text-danger-hover",
|
|
225
|
+
[iconSlotSelector]: {
|
|
226
|
+
color: "$icon-danger-hover"
|
|
227
|
+
}
|
|
241
228
|
},
|
|
242
|
-
[
|
|
243
|
-
backgroundColor: "
|
|
244
|
-
|
|
229
|
+
[activeSelector]: {
|
|
230
|
+
backgroundColor: "$background-danger-hover",
|
|
231
|
+
color: "$text-danger-active",
|
|
232
|
+
[iconSlotSelector]: {
|
|
233
|
+
color: "$icon-danger-active"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
...ghostDisabled
|
|
245
237
|
}
|
|
246
238
|
},
|
|
247
|
-
{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
backgroundColor: "rgba(245, 245, 247, 1)"
|
|
239
|
+
size: {
|
|
240
|
+
"x-large": {
|
|
241
|
+
height: designSystemBaseButton.sizes.xLarge,
|
|
242
|
+
fontSize: "$200",
|
|
243
|
+
paddingX: `calc($200 + ${LABEL_OFFSET}px)`,
|
|
244
|
+
[iconSlotSelector]: {
|
|
245
|
+
width: "$icon-300",
|
|
246
|
+
height: "$icon-300"
|
|
256
247
|
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
248
|
+
},
|
|
249
|
+
large: {
|
|
250
|
+
height: designSystemBaseButton.sizes.large,
|
|
251
|
+
fontSize: "$200",
|
|
252
|
+
paddingX: `calc($150 + ${LABEL_OFFSET}px)`,
|
|
253
|
+
[iconSlotSelector]: {
|
|
254
|
+
width: "$icon-300",
|
|
255
|
+
height: "$icon-300"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
medium: {
|
|
259
|
+
height: designSystemBaseButton.sizes.medium,
|
|
260
|
+
fontSize: "$175",
|
|
261
|
+
paddingX: `calc($100 + ${LABEL_OFFSET}px)`,
|
|
262
|
+
[iconSlotSelector]: {
|
|
263
|
+
width: "$icon-200",
|
|
264
|
+
height: "$icon-200"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
small: {
|
|
268
|
+
fontSize: "$175",
|
|
269
|
+
height: "$6",
|
|
270
|
+
paddingX: `calc($100 + ${LABEL_OFFSET}px)`,
|
|
271
|
+
[iconSlotSelector]: {
|
|
272
|
+
width: "$icon-200",
|
|
273
|
+
height: "$icon-200"
|
|
271
274
|
}
|
|
272
275
|
}
|
|
273
276
|
},
|
|
274
|
-
{
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
css: {
|
|
278
|
-
color: "rgba(217, 41, 41, 1)",
|
|
279
|
-
border: "1px solid rgba(217, 41, 41, 1)",
|
|
280
|
-
...focusOutline,
|
|
281
|
-
"&:hover": {
|
|
282
|
-
color: "rgba(217, 41, 41, 1)",
|
|
283
|
-
backgroundColor: "rgba(254, 247, 247, 1)"
|
|
284
|
-
},
|
|
285
|
-
[pressedSelector]: {
|
|
286
|
-
backgroundColor: "rgba(253, 242, 242, 1)"
|
|
287
|
-
}
|
|
277
|
+
rounded: {
|
|
278
|
+
true: {
|
|
279
|
+
borderRadius: "$half"
|
|
288
280
|
}
|
|
289
281
|
},
|
|
290
|
-
{
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
color: "rgba(217, 41, 41, 1)",
|
|
295
|
-
...focusDefault,
|
|
296
|
-
"&:hover": {
|
|
297
|
-
color: "rgba(217, 41, 41, 1)",
|
|
298
|
-
backgroundColor: "rgba(245, 245, 247, 1)"
|
|
299
|
-
}
|
|
282
|
+
fluid: {
|
|
283
|
+
true: {
|
|
284
|
+
width: "100%",
|
|
285
|
+
display: "block"
|
|
300
286
|
}
|
|
301
287
|
}
|
|
302
|
-
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
const StyledHiddenContent = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
|
|
291
|
+
visibility: "hidden"
|
|
303
292
|
});
|
|
304
293
|
const StyledSpinnerBox = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
305
294
|
display: "flex",
|
|
@@ -315,84 +304,44 @@ const StyledSpinnerBox = designSystemStitches.styled(designSystemPrimitive.Primi
|
|
|
315
304
|
|
|
316
305
|
const Button = React__default["default"].forwardRef(
|
|
317
306
|
({
|
|
318
|
-
variant = "
|
|
319
|
-
|
|
320
|
-
size = "medium",
|
|
307
|
+
variant = "solid-prominent",
|
|
308
|
+
size = "large",
|
|
321
309
|
loading = false,
|
|
322
310
|
rounded = false,
|
|
323
311
|
fluid = false,
|
|
324
|
-
disabled
|
|
325
|
-
href,
|
|
326
|
-
target,
|
|
327
|
-
rel,
|
|
312
|
+
"aria-disabled": ariaDisabled,
|
|
328
313
|
children,
|
|
329
|
-
onPress,
|
|
330
|
-
onClick,
|
|
331
|
-
asChild,
|
|
332
314
|
...restProps
|
|
333
315
|
}, forwardRef) => {
|
|
334
|
-
let spinnerSize;
|
|
335
|
-
if (typeof size === "string") {
|
|
336
|
-
spinnerSize =
|
|
337
|
-
} else {
|
|
338
|
-
spinnerSize = "medium";
|
|
316
|
+
let spinnerSize = "medium";
|
|
317
|
+
if (typeof size === "string" && ["small", "medium"].includes(size)) {
|
|
318
|
+
spinnerSize = "small";
|
|
339
319
|
}
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
onPress: onPress != null ? onPress : onClick,
|
|
350
|
-
allowFocusWhenDisabled: false,
|
|
351
|
-
...restProps
|
|
352
|
-
},
|
|
353
|
-
refWithFallback
|
|
354
|
-
);
|
|
355
|
-
const { linkProps } = link.useLink(
|
|
356
|
-
{
|
|
357
|
-
isDisabled: disabled,
|
|
358
|
-
onPress: onPress != null ? onPress : onClick,
|
|
359
|
-
...restProps
|
|
360
|
-
},
|
|
361
|
-
refWithFallback
|
|
320
|
+
const shouldHaveAriaDisabled = ariaDisabled === "true" || ariaDisabled === true || loading;
|
|
321
|
+
const formattedChildren = React.Children.map(
|
|
322
|
+
React.Children.toArray(children),
|
|
323
|
+
(child) => {
|
|
324
|
+
if (typeof child === "string" || typeof child === "boolean" || typeof child === "number") {
|
|
325
|
+
return /* @__PURE__ */ React__default["default"].createElement(designSystemPrimitive.Primitive.span, null, child);
|
|
326
|
+
}
|
|
327
|
+
return child;
|
|
328
|
+
}
|
|
362
329
|
);
|
|
363
|
-
const Content = /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
330
|
+
const Content = loading ? /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(StyledSpinnerBox, null, /* @__PURE__ */ React__default["default"].createElement(designSystemSpinner.Spinner, {
|
|
364
331
|
size: spinnerSize
|
|
365
|
-
})), /* @__PURE__ */ React__default["default"].createElement(
|
|
366
|
-
const tabIndexProp = shouldBeDisabled && {
|
|
367
|
-
tabIndex: -1
|
|
368
|
-
};
|
|
369
|
-
const { isFocusVisible, focusProps } = focus.useFocusRing();
|
|
370
|
-
const elementProps = utils.mergeProps(
|
|
371
|
-
restProps,
|
|
372
|
-
asLink ? linkProps : buttonProps,
|
|
373
|
-
focusProps
|
|
374
|
-
);
|
|
332
|
+
})), /* @__PURE__ */ React__default["default"].createElement(StyledHiddenContent, null, formattedChildren)) : formattedChildren;
|
|
375
333
|
return /* @__PURE__ */ React__default["default"].createElement(StyledButton, {
|
|
376
|
-
...
|
|
334
|
+
...restProps,
|
|
377
335
|
variant,
|
|
378
|
-
appearance,
|
|
379
|
-
size,
|
|
380
|
-
loading,
|
|
381
336
|
rounded,
|
|
382
337
|
fluid,
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
"data-focused": isFocusVisible ? "" : void 0,
|
|
388
|
-
ref: refWithFallback
|
|
389
|
-
}, asLink ? /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
390
|
-
href,
|
|
391
|
-
target,
|
|
392
|
-
rel: target === "_blank" ? `noopener noreferrer ${rel}` : rel
|
|
393
|
-
}, Content) : Content);
|
|
338
|
+
size,
|
|
339
|
+
"aria-disabled": shouldHaveAriaDisabled ? true : void 0,
|
|
340
|
+
ref: forwardRef
|
|
341
|
+
}, Content);
|
|
394
342
|
}
|
|
395
343
|
);
|
|
344
|
+
Button.IconSlot = IconSlot;
|
|
396
345
|
|
|
397
346
|
exports.Button = Button;
|
|
398
347
|
//# sourceMappingURL=main.js.map
|