@mirohq/design-system-button 3.2.0-icon-types.0 → 4.0.0-button.1

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/module.js CHANGED
@@ -1,28 +1,58 @@
1
- import React from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import React, { createContext, useContext } from 'react';
3
+ import { addPropsToChildren, booleanify } from '@mirohq/design-system-utils';
2
4
  import { Spinner } from '@mirohq/design-system-spinner';
3
5
  import { Primitive } from '@mirohq/design-system-primitive';
4
6
  import { styled } from '@mirohq/design-system-stitches';
5
7
  import { BaseButton, sizes } from '@mirohq/design-system-base-button';
6
- import { IconTypeSymbol } from '@mirohq/design-system-icons';
8
+ import { isIconComponent, styles } from '@mirohq/design-system-base-icon';
9
+ import { focus } from '@mirohq/design-system-styles';
10
+
11
+ const ButtonContext = createContext({});
12
+ const ButtonProvider = ({
13
+ children,
14
+ ...restProps
15
+ }) => /* @__PURE__ */ jsx(
16
+ ButtonContext.Provider,
17
+ {
18
+ value: {
19
+ ...restProps
20
+ },
21
+ children
22
+ }
23
+ );
24
+ const useButtonContext = () => useContext(ButtonContext);
7
25
 
8
26
  const StyledIconSlot = styled(Primitive.div, {});
9
- const isIcon = (child) => child.type.__Type === IconTypeSymbol;
27
+ const buttonIconSizes = {
28
+ small: "small",
29
+ medium: "small",
30
+ large: "medium",
31
+ "x-large": "medium"
32
+ };
33
+ const buttonIconWeights = {
34
+ small: "thin",
35
+ medium: "thin",
36
+ large: "normal",
37
+ "x-large": "normal"
38
+ };
10
39
  const IconSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
11
- const child = React.Children.only(children);
12
- const isDsIcon = isIcon(child);
13
- const iconElement = isDsIcon ? React.cloneElement(child, { size: "small" }) : child;
14
- return /* @__PURE__ */ React.createElement(StyledIconSlot, {
15
- ...restProps,
16
- ref: forwardRef,
17
- "aria-hidden": true,
18
- asChild: true,
19
- "data-icon": isDsIcon ? "" : void 0
20
- }, iconElement);
40
+ const { size } = useButtonContext();
41
+ const formattedChildren = addPropsToChildren(
42
+ children,
43
+ (child) => isIconComponent(child),
44
+ {
45
+ "data-icon-component": "",
46
+ size: buttonIconSizes[size],
47
+ weight: buttonIconWeights[size]
48
+ }
49
+ );
50
+ return /* @__PURE__ */ jsx(StyledIconSlot, { ...restProps, ref: forwardRef, "aria-hidden": true, asChild: true, children: formattedChildren });
21
51
  });
22
52
 
23
- const activeSelector = "&:active, &[data-pressed]";
24
53
  const disabledSelector = '&[disabled], &[aria-disabled="true"]';
25
- const iconSlotSelector = `& ${StyledIconSlot}`;
54
+ const iconSlotSelector = "& ".concat(StyledIconSlot);
55
+ const externalIconSelector = "& svg:not([data-icon-component]), & img:not([data-icon-component])";
26
56
  const solidDisabled = {
27
57
  [disabledSelector]: {
28
58
  backgroundColor: "$background-neutrals-disabled",
@@ -53,51 +83,67 @@ const ghostDisabled = {
53
83
  };
54
84
  const LABEL_OFFSET = 2;
55
85
  const StyledButton = styled(BaseButton, {
56
- userSelect: "none",
57
86
  whiteSpace: "nowrap",
58
87
  textOverflow: "ellipsis",
59
88
  textAlign: "center",
60
89
  position: "relative",
61
90
  width: "fit-content",
62
91
  maxWidth: "100%",
63
- lineHeight: 1.5,
92
+ lineHeight: 1,
93
+ fontWeight: "$semibold",
64
94
  border: "1px solid transparent",
65
- "&[data-focused]": {
66
- boxShadow: "$focus-small-outline",
67
- borderColor: "$blue-500 !important"
68
- },
69
- [`& ${StyledIconSlot}:first-child`]: {
95
+ // to make outline and solid/ghost variants the same width
96
+ ...focus.css({
97
+ // TODO https://miro.atlassian.net/browse/MDS-1284 use `$focus-small` token after updating themes/web/local/shadows.ts :oliver.l 2024-09-05
98
+ boxShadow: "0px 0px 0px 2px $colors$border-focus-inner, 0px 0px 0px 4px $colors$focus-keyboard"
99
+ }),
100
+ ["& ".concat(StyledIconSlot, ":first-child")]: {
70
101
  marginLeft: -LABEL_OFFSET,
71
- marginRight: `calc($50 + ${LABEL_OFFSET}px)`
102
+ marginRight: "calc($50 + ".concat(LABEL_OFFSET, "px)")
72
103
  },
73
- [`& ${StyledIconSlot}:last-child`]: {
104
+ ["& ".concat(StyledIconSlot, ":last-child")]: {
74
105
  marginRight: -LABEL_OFFSET,
75
- marginLeft: `calc($50 + ${LABEL_OFFSET}px)`
106
+ marginLeft: "calc($50 + ".concat(LABEL_OFFSET, "px)")
76
107
  },
77
108
  variants: {
78
109
  variant: {
79
- "solid-prominent": {
110
+ primary: {
80
111
  backgroundColor: "$background-primary-prominent",
81
- color: "$text-primary-inverted",
112
+ color: "$text-neutrals-inverted",
82
113
  [iconSlotSelector]: {
83
114
  color: "$icon-primary-inverted"
84
115
  },
85
- "&:hover": {
116
+ "&[data-hovered]": {
86
117
  backgroundColor: "$background-primary-prominent-hover"
87
118
  },
88
- [activeSelector]: {
119
+ "&[data-pressed]": {
89
120
  backgroundColor: "$background-primary-prominent-active"
90
121
  },
91
122
  ...solidDisabled
92
123
  },
93
- "outline-prominent": {
94
- backgroundColor: "$background-neutrals",
124
+ secondary: {
125
+ backgroundColor: "$button-background-secondary",
126
+ color: "$text-neutrals",
127
+ [iconSlotSelector]: {
128
+ color: "$icon-neutrals"
129
+ },
130
+ "&[data-hovered]": {
131
+ color: "$text-neutrals-hover",
132
+ backgroundColor: "$button-background-secondary-hover"
133
+ },
134
+ "&[data-pressed]": {
135
+ color: "$text-neutrals-active",
136
+ backgroundColor: "$button-background-secondary-pressed"
137
+ },
138
+ ...solidDisabled
139
+ },
140
+ tertiary: {
95
141
  borderColor: "$border-primary",
96
142
  color: "$text-primary",
97
143
  [iconSlotSelector]: {
98
144
  color: "$icon-primary"
99
145
  },
100
- "&:hover": {
146
+ "&[data-hovered]": {
101
147
  backgroundColor: "$background-primary-subtle-hover",
102
148
  borderColor: "$border-primary-hover",
103
149
  color: "$text-primary-hover",
@@ -105,7 +151,7 @@ const StyledButton = styled(BaseButton, {
105
151
  color: "$icon-primary-hover"
106
152
  }
107
153
  },
108
- [activeSelector]: {
154
+ "&[data-pressed]": {
109
155
  backgroundColor: "$background-primary-subtle-active",
110
156
  borderColor: "$border-primary-active",
111
157
  color: "$text-primary-active",
@@ -115,100 +161,68 @@ const StyledButton = styled(BaseButton, {
115
161
  },
116
162
  ...outlineDisabled
117
163
  },
118
- "ghost-prominent": {
164
+ ghost: {
119
165
  backgroundColor: "transparent",
120
- color: "$text-primary",
121
- "&:hover": {
122
- backgroundColor: "$background-primary-subtle-hover",
123
- color: "$text-primary-hover",
166
+ color: "$text-neutrals",
167
+ "&[data-hovered]": {
168
+ backgroundColor: "$button-background-secondary-hover",
169
+ color: "$text-neutrals-hover",
124
170
  [iconSlotSelector]: {
125
171
  color: "$icon-primary-hover"
126
172
  }
127
173
  },
128
- [activeSelector]: {
129
- backgroundColor: "$background-primary-subtle-active",
130
- color: "$text-primary-active",
174
+ "&[data-pressed]": {
175
+ backgroundColor: "$button-background-secondary-pressed",
176
+ color: "$text-neutrals-active",
131
177
  [iconSlotSelector]: {
132
178
  color: "$icon-primary-active"
133
179
  }
134
180
  },
135
181
  ...ghostDisabled
136
182
  },
137
- "solid-subtle": {
138
- backgroundColor: "$background-neutrals-subtle",
139
- color: "$text-neutrals",
140
- [iconSlotSelector]: {
141
- color: "$icon-neutrals"
142
- },
143
- "&:hover": {
144
- backgroundColor: "$background-neutrals-subtle-hover"
145
- },
146
- [activeSelector]: {
147
- backgroundColor: "$background-neutrals-subtle-active"
148
- },
149
- ...solidDisabled
150
- },
151
- "outline-subtle": {
152
- backgroundColor: "$background-neutrals",
153
- border: "1px solid $border-neutrals",
154
- color: "$text-neutrals",
155
- [iconSlotSelector]: {
156
- color: "$icon-neutrals"
157
- },
158
- "&:hover": {
159
- backgroundColor: "$background-neutrals-subtle-hover",
160
- borderColor: "$border-neutrals-hover"
161
- },
162
- [activeSelector]: {
163
- backgroundColor: "$background-neutrals-subtle-active",
164
- borderColor: "$border-neutrals-active"
165
- },
166
- ...outlineDisabled
167
- },
168
183
  "ghost-subtle": {
169
184
  backgroundColor: "transparent",
170
185
  color: "$text-neutrals",
171
186
  [iconSlotSelector]: {
172
187
  color: "$icon-neutrals"
173
188
  },
174
- "&:hover": {
189
+ "&[data-hovered]": {
175
190
  backgroundColor: "$background-neutrals-subtle-hover"
176
191
  },
177
- [activeSelector]: {
192
+ "&[data-pressed]": {
178
193
  backgroundColor: "$background-neutrals-subtle-active"
179
194
  },
180
195
  ...ghostDisabled
181
196
  },
182
- "solid-danger": {
197
+ danger: {
183
198
  backgroundColor: "$background-danger-prominent",
184
199
  color: "$text-danger-inverted",
185
200
  [iconSlotSelector]: {
186
201
  color: "$icon-danger-inverted"
187
202
  },
188
- "&:hover": {
203
+ "&[data-hovered]": {
189
204
  backgroundColor: "$background-danger-prominent-hover"
190
205
  },
191
- [activeSelector]: {
206
+ "&[data-pressed]": {
192
207
  backgroundColor: "$background-danger-prominent-active"
193
208
  },
194
209
  ...solidDisabled
195
210
  },
196
- "outline-danger": {
197
- backgroundColor: "$background-neutrals",
211
+ "danger-secondary": {
198
212
  borderColor: "$border-danger",
199
213
  color: "$text-danger",
200
214
  [iconSlotSelector]: {
201
215
  color: "$icon-danger"
202
216
  },
203
- "&:hover": {
204
- backgroundColor: "$background-danger",
217
+ "&[data-hovered]": {
218
+ backgroundColor: "$background-danger-subtle-hover",
205
219
  color: "$text-danger-hover",
206
220
  [iconSlotSelector]: {
207
221
  color: "$icon-danger-hover"
208
222
  }
209
223
  },
210
- [activeSelector]: {
211
- backgroundColor: "$background-danger-hover",
224
+ "&[data-pressed]": {
225
+ backgroundColor: "$background-danger-subtle-active",
212
226
  color: "$text-danger-active",
213
227
  [iconSlotSelector]: {
214
228
  color: "$icon-danger-active"
@@ -222,15 +236,15 @@ const StyledButton = styled(BaseButton, {
222
236
  [iconSlotSelector]: {
223
237
  color: "$icon-danger"
224
238
  },
225
- "&:hover": {
226
- backgroundColor: "$background-danger",
239
+ "&[data-hovered]": {
240
+ backgroundColor: "$background-danger-subtle",
227
241
  color: "$text-danger-hover",
228
242
  [iconSlotSelector]: {
229
243
  color: "$icon-danger-hover"
230
244
  }
231
245
  },
232
- [activeSelector]: {
233
- backgroundColor: "$background-danger-hover",
246
+ "&[data-pressed]": {
247
+ backgroundColor: "$background-danger-subtle-hover",
234
248
  color: "$text-danger-active",
235
249
  [iconSlotSelector]: {
236
250
  color: "$icon-danger-active"
@@ -243,45 +257,43 @@ const StyledButton = styled(BaseButton, {
243
257
  "x-large": {
244
258
  height: sizes.xLarge,
245
259
  fontSize: "$200",
246
- paddingX: `calc($200 + ${LABEL_OFFSET}px)`,
247
- [iconSlotSelector]: {
248
- width: "$icon-300",
249
- height: "$icon-300"
260
+ paddingX: "calc($200 + ".concat(LABEL_OFFSET, "px)"),
261
+ [externalIconSelector]: {
262
+ ...styles.size.medium,
263
+ ...styles.weight.normal
250
264
  }
251
265
  },
252
266
  large: {
253
267
  height: sizes.large,
254
268
  fontSize: "$200",
255
- paddingX: `calc($150 + ${LABEL_OFFSET}px)`,
256
- [iconSlotSelector]: {
257
- width: "$icon-300",
258
- height: "$icon-300"
269
+ paddingX: "calc($150 + ".concat(LABEL_OFFSET, "px)"),
270
+ [externalIconSelector]: {
271
+ ...styles.size.medium,
272
+ ...styles.weight.normal
259
273
  }
260
274
  },
261
275
  medium: {
262
276
  height: sizes.medium,
263
277
  fontSize: "$175",
264
- paddingX: `calc($100 + ${LABEL_OFFSET}px)`,
265
- [iconSlotSelector]: {
266
- width: "$icon-200",
267
- height: "$icon-200",
268
- "--svg-stroke-width": "$stroke-width$thin"
278
+ paddingX: "calc($100 + ".concat(LABEL_OFFSET, "px)"),
279
+ [externalIconSelector]: {
280
+ ...styles.size.small,
281
+ ...styles.weight.thin
269
282
  }
270
283
  },
271
284
  small: {
272
285
  fontSize: "$175",
273
286
  height: "$6",
274
- paddingX: `calc($100 + ${LABEL_OFFSET}px)`,
275
- [iconSlotSelector]: {
276
- width: "$icon-200",
277
- height: "$icon-200",
278
- "--svg-stroke-width": "$stroke-width$thin"
287
+ paddingX: "calc($100 + ".concat(LABEL_OFFSET, "px)"),
288
+ [externalIconSelector]: {
289
+ ...styles.size.small,
290
+ ...styles.weight.thin
279
291
  }
280
292
  }
281
293
  },
282
294
  rounded: {
283
295
  true: {
284
- borderRadius: "$half"
296
+ borderRadius: "$round"
285
297
  }
286
298
  },
287
299
  fluid: {
@@ -314,12 +326,13 @@ Label.displayName = "Label";
314
326
 
315
327
  const Button = React.forwardRef(
316
328
  ({
317
- variant = "solid-prominent",
329
+ variant = "primary",
318
330
  size = "large",
319
331
  loading = false,
320
332
  rounded = false,
321
333
  fluid = false,
322
334
  "aria-disabled": ariaDisabled,
335
+ asChild = false,
323
336
  children,
324
337
  ...restProps
325
338
  }, forwardRef) => {
@@ -327,19 +340,41 @@ const Button = React.forwardRef(
327
340
  if (typeof size === "string" && ["small", "medium"].includes(size)) {
328
341
  spinnerSize = "small";
329
342
  }
330
- const shouldHaveAriaDisabled = ariaDisabled === "true" || ariaDisabled === true || loading;
331
- const Content = loading ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(StyledSpinnerBox, null, /* @__PURE__ */ React.createElement(Spinner, {
332
- size: spinnerSize
333
- })), /* @__PURE__ */ React.createElement(StyledHiddenContent, null, children)) : children;
334
- return /* @__PURE__ */ React.createElement(StyledButton, {
335
- ...restProps,
336
- variant,
337
- rounded,
338
- fluid,
339
- size,
340
- "aria-disabled": shouldHaveAriaDisabled ? true : void 0,
341
- ref: forwardRef
342
- }, Content);
343
+ const shouldHaveAriaDisabled = booleanify(ariaDisabled) || loading;
344
+ let formattedChildren = children;
345
+ if (loading) {
346
+ const spinnerTestId = process.env.NODE_ENV === "test" ? "button-spinner" : void 0;
347
+ if (asChild && React.Children.toArray(children).length === 1 && React.isValidElement(children)) {
348
+ const firstLevelChild = React.Children.only(children);
349
+ const { children: secondLevelChildren, ...childProps } = firstLevelChild.props;
350
+ formattedChildren = React.cloneElement(firstLevelChild, {
351
+ ...childProps,
352
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [
353
+ /* @__PURE__ */ jsx(StyledSpinnerBox, { "data-testid": spinnerTestId, children: /* @__PURE__ */ jsx(Spinner, { size: spinnerSize }) }),
354
+ /* @__PURE__ */ jsx(StyledHiddenContent, { children: secondLevelChildren })
355
+ ] })
356
+ });
357
+ } else {
358
+ formattedChildren = /* @__PURE__ */ jsxs(Fragment, { children: [
359
+ /* @__PURE__ */ jsx(StyledSpinnerBox, { "data-testid": spinnerTestId, children: /* @__PURE__ */ jsx(Spinner, { size: spinnerSize }) }),
360
+ /* @__PURE__ */ jsx(StyledHiddenContent, { children })
361
+ ] });
362
+ }
363
+ }
364
+ return /* @__PURE__ */ jsx(ButtonProvider, { size, children: /* @__PURE__ */ jsx(
365
+ StyledButton,
366
+ {
367
+ ...restProps,
368
+ asChild,
369
+ variant,
370
+ rounded,
371
+ fluid,
372
+ size,
373
+ "aria-disabled": shouldHaveAriaDisabled ? true : void 0,
374
+ ref: forwardRef,
375
+ children: formattedChildren
376
+ }
377
+ ) });
343
378
  }
344
379
  );
345
380
  Button.IconSlot = IconSlot;
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../src/partials/icon-slot.tsx","../src/button.styled.ts","../src/partials/label.ts","../src/button.tsx"],"sourcesContent":["import React from 'react'\nimport type { ElementRef, ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { IconTypeSymbol } from '@mirohq/design-system-icons'\n\nexport const StyledIconSlot = styled(Primitive.div, {})\nexport type StyledIconSlotProps = ComponentPropsWithRef<typeof StyledIconSlot>\n\nexport interface IconSlotProps extends StyledIconSlotProps {\n /**\n * The icon.\n */\n children: React.ReactNode\n}\n\nconst isIcon = (child: React.ReactElement): boolean =>\n // @ts-expect-error\n child.type.__Type === IconTypeSymbol\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof StyledIconSlot>,\n IconSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const child = React.Children.only(children) as React.ReactElement\n\n const isDsIcon = isIcon(child)\n\n const iconElement = isDsIcon\n ? React.cloneElement(child, { size: 'small' })\n : child\n\n return (\n <StyledIconSlot\n {...restProps}\n ref={forwardRef}\n aria-hidden\n asChild\n data-icon={isDsIcon ? '' : undefined}\n >\n {iconElement}\n </StyledIconSlot>\n )\n})\n","import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport type { CSS } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { BaseButton, sizes } from '@mirohq/design-system-base-button'\n\nimport { StyledIconSlot } from './partials/icon-slot'\n\nconst activeSelector = '&:active, &[data-pressed]'\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\n\n// we might face className collision because of empty CSS in StyledIconSlot\n// https://github.com/stitchesjs/stitches/issues/976\nconst iconSlotSelector = `& ${StyledIconSlot}`\n\nconst solidDisabled: CSS = {\n [disabledSelector]: {\n backgroundColor: '$background-neutrals-disabled',\n color: '$text-neutrals-disabled',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals-disabled',\n },\n },\n}\n\nconst outlineDisabled: CSS = {\n [disabledSelector]: {\n backgroundColor: '$background-neutrals',\n borderColor: '$border-neutrals-disabled',\n color: '$text-neutrals-disabled',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals-disabled',\n },\n },\n}\n\nconst ghostDisabled: CSS = {\n [disabledSelector]: {\n color: '$text-neutrals-disabled',\n backgroundColor: '$transparent',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals-disabled',\n },\n },\n}\n\nconst LABEL_OFFSET = 2\n\nexport const StyledButton = styled(BaseButton, {\n userSelect: 'none',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n textAlign: 'center',\n position: 'relative',\n width: 'fit-content',\n maxWidth: '100%',\n\n lineHeight: 1.5,\n border: '1px solid transparent', // to make outline and solid/ghost variants the same width\n\n '&[data-focused]': {\n boxShadow: '$focus-small-outline',\n borderColor: '$blue-500 !important',\n },\n\n [`& ${StyledIconSlot}:first-child`]: {\n marginLeft: -LABEL_OFFSET,\n marginRight: `calc($50 + ${LABEL_OFFSET}px)`,\n },\n [`& ${StyledIconSlot}:last-child`]: {\n marginRight: -LABEL_OFFSET,\n marginLeft: `calc($50 + ${LABEL_OFFSET}px)`,\n },\n\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$text-primary-inverted',\n\n [iconSlotSelector]: {\n color: '$icon-primary-inverted',\n },\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n\n ...solidDisabled,\n },\n 'outline-prominent': {\n backgroundColor: '$background-neutrals',\n borderColor: '$border-primary',\n color: '$text-primary',\n\n [iconSlotSelector]: {\n color: '$icon-primary',\n },\n\n '&:hover': {\n backgroundColor: '$background-primary-subtle-hover',\n borderColor: '$border-primary-hover',\n color: '$text-primary-hover',\n\n [iconSlotSelector]: {\n color: '$icon-primary-hover',\n },\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-subtle-active',\n borderColor: '$border-primary-active',\n color: '$text-primary-active',\n\n [iconSlotSelector]: {\n color: '$icon-primary-active',\n },\n },\n ...outlineDisabled,\n },\n 'ghost-prominent': {\n backgroundColor: 'transparent',\n color: '$text-primary',\n\n '&:hover': {\n backgroundColor: '$background-primary-subtle-hover',\n color: '$text-primary-hover',\n\n [iconSlotSelector]: {\n color: '$icon-primary-hover',\n },\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-subtle-active',\n color: '$text-primary-active',\n\n [iconSlotSelector]: {\n color: '$icon-primary-active',\n },\n },\n ...ghostDisabled,\n },\n 'solid-subtle': {\n backgroundColor: '$background-neutrals-subtle',\n color: '$text-neutrals',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals',\n },\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n ...solidDisabled,\n },\n\n 'outline-subtle': {\n backgroundColor: '$background-neutrals',\n border: '1px solid $border-neutrals',\n color: '$text-neutrals',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals',\n },\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n borderColor: '$border-neutrals-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n borderColor: '$border-neutrals-active',\n },\n ...outlineDisabled,\n },\n 'ghost-subtle': {\n backgroundColor: 'transparent',\n color: '$text-neutrals',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals',\n },\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n ...ghostDisabled,\n },\n 'solid-danger': {\n backgroundColor: '$background-danger-prominent',\n color: '$text-danger-inverted',\n\n [iconSlotSelector]: {\n color: '$icon-danger-inverted',\n },\n\n '&:hover': {\n backgroundColor: '$background-danger-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-danger-prominent-active',\n },\n ...solidDisabled,\n },\n 'outline-danger': {\n backgroundColor: '$background-neutrals',\n borderColor: '$border-danger',\n color: '$text-danger',\n\n [iconSlotSelector]: {\n color: '$icon-danger',\n },\n\n '&:hover': {\n backgroundColor: '$background-danger',\n color: '$text-danger-hover',\n\n [iconSlotSelector]: {\n color: '$icon-danger-hover',\n },\n },\n [activeSelector]: {\n backgroundColor: '$background-danger-hover',\n color: '$text-danger-active',\n\n [iconSlotSelector]: {\n color: '$icon-danger-active',\n },\n },\n ...outlineDisabled,\n },\n 'ghost-danger': {\n backgroundColor: 'transparent',\n color: '$text-danger',\n\n [iconSlotSelector]: {\n color: '$icon-danger',\n },\n\n '&:hover': {\n backgroundColor: '$background-danger',\n color: '$text-danger-hover',\n\n [iconSlotSelector]: {\n color: '$icon-danger-hover',\n },\n },\n [activeSelector]: {\n backgroundColor: '$background-danger-hover',\n color: '$text-danger-active',\n\n [iconSlotSelector]: {\n color: '$icon-danger-active',\n },\n },\n ...ghostDisabled,\n },\n },\n size: {\n 'x-large': {\n height: sizes.xLarge,\n fontSize: '$200',\n paddingX: `calc($200 + ${LABEL_OFFSET}px)`,\n\n [iconSlotSelector]: {\n width: '$icon-300',\n height: '$icon-300',\n },\n },\n large: {\n height: sizes.large,\n fontSize: '$200',\n paddingX: `calc($150 + ${LABEL_OFFSET}px)`,\n\n [iconSlotSelector]: {\n width: '$icon-300',\n height: '$icon-300',\n },\n },\n medium: {\n height: sizes.medium,\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n\n [iconSlotSelector]: {\n width: '$icon-200',\n height: '$icon-200',\n '--svg-stroke-width': '$stroke-width$thin',\n },\n },\n small: {\n fontSize: '$175',\n height: '$6',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n\n [iconSlotSelector]: {\n width: '$icon-200',\n height: '$icon-200',\n '--svg-stroke-width': '$stroke-width$thin',\n },\n },\n },\n rounded: {\n true: {\n borderRadius: '$half',\n },\n },\n fluid: {\n true: {\n display: 'flex',\n justifyContent: 'center',\n maxWidth: '100%',\n width: '100%',\n },\n },\n },\n})\n\nexport const StyledHiddenContent = styled(Primitive.span, {\n visibility: 'hidden',\n})\n\nexport const StyledSpinnerBox = styled(Primitive.div, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n margin: 'auto',\n})\n\nexport type StyledButtonProps = ComponentPropsWithRef<typeof StyledButton>\n","import { Primitive } from '@mirohq/design-system-primitive'\n\nexport const Label = Primitive.span\n\nLabel.displayName = 'Label'\n","import React from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\nimport type { SpinnerProps } from '@mirohq/design-system-spinner'\nimport { Spinner } from '@mirohq/design-system-spinner'\n\nimport type { StyledButtonProps } from './button.styled'\nimport {\n StyledButton,\n StyledHiddenContent,\n StyledSpinnerBox,\n} from './button.styled'\nimport { IconSlot } from './partials/icon-slot'\nimport { Label } from './partials/label'\n\nexport interface ButtonProps extends StyledButtonProps {\n /**\n * Change the button style.\n */\n variant?: StyledButtonProps['variant']\n\n /**\n * Change the button size.\n */\n size?: StyledButtonProps['size']\n\n /**\n * Make button border rounded.\n */\n rounded?: StyledButtonProps['rounded']\n\n /**\n * Add spinner and disable.\n */\n loading?: boolean\n\n /**\n * Make width 100%.\n */\n fluid?: StyledButtonProps['fluid']\n}\n\nexport const Button = React.forwardRef<\n ElementRef<typeof StyledButton>,\n ButtonProps\n>(\n (\n {\n variant = 'solid-prominent',\n size = 'large',\n loading = false,\n rounded = false,\n fluid = false,\n 'aria-disabled': ariaDisabled,\n children,\n ...restProps\n },\n forwardRef\n ) => {\n let spinnerSize: SpinnerProps['size'] = 'medium'\n\n if (typeof size === 'string' && ['small', 'medium'].includes(size)) {\n spinnerSize = 'small'\n }\n\n const shouldHaveAriaDisabled =\n ariaDisabled === 'true' || ariaDisabled === true || loading\n\n const Content = loading ? (\n <>\n <StyledSpinnerBox>\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n <StyledHiddenContent>{children}</StyledHiddenContent>\n </>\n ) : (\n children\n )\n\n return (\n <StyledButton\n {...restProps}\n variant={variant}\n rounded={rounded}\n fluid={fluid}\n size={size}\n // without undefined it will be aria-disabled=\"false\" in html\n aria-disabled={shouldHaveAriaDisabled ? true : undefined}\n ref={forwardRef}\n >\n {Content}\n </StyledButton>\n )\n }\n) as ForwardRefExoticComponent<ButtonProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\ninterface Partials {\n IconSlot: typeof IconSlot\n Label: typeof Label\n}\n\nButton.IconSlot = IconSlot\nButton.Label = Label\n"],"names":[],"mappings":";;;;;;;AAMO,MAAM,cAAiB,GAAA,MAAA,CAAO,SAAU,CAAA,GAAA,EAAK,EAAE,CAAA,CAAA;A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B,EAAA,YAAA;AAAA,IACjB,QAAA;AAAA,IACG,GAAA,SAAA;AAAA,KAEL,UACG,KAAA;AACH,IAAA,IAAI,WAAoC,GAAA,QAAA,CAAA;AAExC,IAAI,IAAA,OAAO,SAAS,QAAY,IAAA,CAAC,SAAS,QAAQ,CAAA,CAAE,QAAS,CAAA,IAAI,CAAG,EAAA;AAClE,MAAc,WAAA,GAAA,OAAA,CAAA;AAAA,KAChB;AAEA,IAAA,MAAM,sBACJ,GAAA,YAAA,KAAiB,MAAU,IAAA,YAAA,KAAiB,IAAQ,IAAA,OAAA,CAAA;AAEtD,IAAA,MAAM,OAAU,GAAA,OAAA,mBAEZ,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,wCACE,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,MAAQ,IAAM,EAAA,WAAA;AAAA,KAAa,CAC9B,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,mBAAqB,EAAA,IAAA,EAAA,QAAS,CACjC,CAEA,GAAA,QAAA,CAAA;AAGF,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA;AAAA,MACE,GAAG,SAAA;AAAA,MACJ,OAAA;AAAA,MACA,OAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MAEA,eAAA,EAAe,yBAAyB,IAAO,GAAA,KAAA,CAAA;AAAA,MAC/C,GAAK,EAAA,UAAA;AAAA,KAAA,EAEJ,OACH,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAUA,MAAA,CAAO,QAAW,GAAA,QAAA,CAAA;AAClB,MAAA,CAAO,KAAQ,GAAA,KAAA;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../src/hooks/use-button-context.tsx","../src/partials/icon-slot.tsx","../src/button.styled.ts","../src/partials/label.ts","../src/button.tsx"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { PropsWithChildren } from 'react'\n\nimport type { StyledButtonProps } from '../button.styled'\n\ninterface ButtonProps {\n size?: StyledButtonProps['size']\n}\n\ninterface ButtonContextProps extends ButtonProps {}\n\nexport type ButtonProviderProps = ButtonProps\n\nconst ButtonContext = createContext<ButtonContextProps>({} as any)\n\nexport const ButtonProvider = ({\n children,\n ...restProps\n}: PropsWithChildren<ButtonProviderProps>): JSX.Element => (\n <ButtonContext.Provider\n value={{\n ...restProps,\n }}\n >\n {children}\n </ButtonContext.Provider>\n)\n\nexport const useButtonContext = (): ButtonContextProps =>\n useContext(ButtonContext)\n","import React from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport type { ElementRef, ComponentPropsWithRef } from 'react'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport type {\n IconReactElement,\n IconSizes,\n IconWeights,\n} from '@mirohq/design-system-base-icon'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\nimport type { ExtractValidKeys } from '@mirohq/design-system-types'\n\nimport { useButtonContext } from '../hooks/use-button-context'\nimport type { StyledButtonProps } from '../button.styled'\n\nexport const StyledIconSlot = styled(Primitive.div, {})\nexport type StyledIconSlotProps = ComponentPropsWithRef<typeof StyledIconSlot>\n\ntype ButtonSize = ExtractValidKeys<StyledButtonProps['size']>\n\nconst buttonIconSizes: { [key in ButtonSize]: IconSizes } = {\n small: 'small',\n medium: 'small',\n large: 'medium',\n 'x-large': 'medium',\n}\n\nconst buttonIconWeights: { [key in ButtonSize]: IconWeights } = {\n small: 'thin',\n medium: 'thin',\n large: 'normal',\n 'x-large': 'normal',\n}\n\nexport interface IconSlotProps extends StyledIconSlotProps {\n /**\n * The icon.\n */\n children: React.ReactNode\n}\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof StyledIconSlot>,\n IconSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const { size } = useButtonContext()\n\n const formattedChildren = addPropsToChildren(\n children,\n child => isIconComponent(child as IconReactElement),\n {\n 'data-icon-component': '',\n size: buttonIconSizes[size as ButtonSize],\n weight: buttonIconWeights[size as ButtonSize],\n }\n )\n\n return (\n <StyledIconSlot {...restProps} ref={forwardRef} aria-hidden asChild>\n {formattedChildren}\n </StyledIconSlot>\n )\n})\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { BaseButton, sizes } from '@mirohq/design-system-base-button'\nimport { styles as baseIconStyles } from '@mirohq/design-system-base-icon'\nimport type { ComponentPropsWithRef } from 'react'\nimport type { CSS } from '@mirohq/design-system-stitches'\nimport { focus } from '@mirohq/design-system-styles'\n\nimport { StyledIconSlot } from './partials/icon-slot'\n\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\n\n// we might face className collision because of empty CSS in StyledIconSlot\n// https://github.com/stitchesjs/stitches/issues/976\nconst iconSlotSelector = `& ${StyledIconSlot}`\nconst externalIconSelector =\n '& svg:not([data-icon-component]), & img:not([data-icon-component])'\n\nconst solidDisabled: CSS = {\n [disabledSelector]: {\n backgroundColor: '$background-neutrals-disabled',\n color: '$text-neutrals-disabled',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals-disabled',\n },\n },\n}\n\nconst outlineDisabled: CSS = {\n [disabledSelector]: {\n backgroundColor: '$background-neutrals',\n borderColor: '$border-neutrals-disabled',\n color: '$text-neutrals-disabled',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals-disabled',\n },\n },\n}\n\nconst ghostDisabled: CSS = {\n [disabledSelector]: {\n color: '$text-neutrals-disabled',\n backgroundColor: '$transparent',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals-disabled',\n },\n },\n}\n\nconst LABEL_OFFSET = 2\n\nexport const StyledButton = styled(BaseButton, {\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n textAlign: 'center',\n position: 'relative',\n width: 'fit-content',\n maxWidth: '100%',\n\n lineHeight: 1,\n fontWeight: '$semibold',\n border: '1px solid transparent', // to make outline and solid/ghost variants the same width\n\n ...focus.css({\n // TODO https://miro.atlassian.net/browse/MDS-1284 use `$focus-small` token after updating themes/web/local/shadows.ts :oliver.l 2024-09-05\n boxShadow:\n '0px 0px 0px 2px $colors$border-focus-inner, 0px 0px 0px 4px $colors$focus-keyboard',\n }),\n\n [`& ${StyledIconSlot}:first-child`]: {\n marginLeft: -LABEL_OFFSET,\n marginRight: `calc($50 + ${LABEL_OFFSET}px)`,\n },\n [`& ${StyledIconSlot}:last-child`]: {\n marginRight: -LABEL_OFFSET,\n marginLeft: `calc($50 + ${LABEL_OFFSET}px)`,\n },\n\n variants: {\n variant: {\n primary: {\n backgroundColor: '$background-primary-prominent',\n color: '$text-neutrals-inverted',\n\n [iconSlotSelector]: {\n color: '$icon-primary-inverted',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n '&[data-pressed]': {\n backgroundColor: '$background-primary-prominent-active',\n },\n\n ...solidDisabled,\n },\n secondary: {\n backgroundColor: '$button-background-secondary',\n color: '$text-neutrals',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals',\n },\n\n '&[data-hovered]': {\n color: '$text-neutrals-hover',\n backgroundColor: '$button-background-secondary-hover',\n },\n '&[data-pressed]': {\n color: '$text-neutrals-active',\n backgroundColor: '$button-background-secondary-pressed',\n },\n ...solidDisabled,\n },\n tertiary: {\n borderColor: '$border-primary',\n color: '$text-primary',\n\n [iconSlotSelector]: {\n color: '$icon-primary',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-primary-subtle-hover',\n borderColor: '$border-primary-hover',\n color: '$text-primary-hover',\n\n [iconSlotSelector]: {\n color: '$icon-primary-hover',\n },\n },\n '&[data-pressed]': {\n backgroundColor: '$background-primary-subtle-active',\n borderColor: '$border-primary-active',\n color: '$text-primary-active',\n\n [iconSlotSelector]: {\n color: '$icon-primary-active',\n },\n },\n ...outlineDisabled,\n },\n ghost: {\n backgroundColor: 'transparent',\n color: '$text-neutrals',\n\n '&[data-hovered]': {\n backgroundColor: '$button-background-secondary-hover',\n color: '$text-neutrals-hover',\n\n [iconSlotSelector]: {\n color: '$icon-primary-hover',\n },\n },\n '&[data-pressed]': {\n backgroundColor: '$button-background-secondary-pressed',\n color: '$text-neutrals-active',\n\n [iconSlotSelector]: {\n color: '$icon-primary-active',\n },\n },\n ...ghostDisabled,\n },\n 'ghost-subtle': {\n backgroundColor: 'transparent',\n color: '$text-neutrals',\n\n [iconSlotSelector]: {\n color: '$icon-neutrals',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n '&[data-pressed]': {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n ...ghostDisabled,\n },\n danger: {\n backgroundColor: '$background-danger-prominent',\n color: '$text-danger-inverted',\n\n [iconSlotSelector]: {\n color: '$icon-danger-inverted',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-danger-prominent-hover',\n },\n '&[data-pressed]': {\n backgroundColor: '$background-danger-prominent-active',\n },\n ...solidDisabled,\n },\n 'danger-secondary': {\n borderColor: '$border-danger',\n color: '$text-danger',\n\n [iconSlotSelector]: {\n color: '$icon-danger',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-danger-subtle-hover',\n color: '$text-danger-hover',\n\n [iconSlotSelector]: {\n color: '$icon-danger-hover',\n },\n },\n '&[data-pressed]': {\n backgroundColor: '$background-danger-subtle-active',\n color: '$text-danger-active',\n\n [iconSlotSelector]: {\n color: '$icon-danger-active',\n },\n },\n ...outlineDisabled,\n },\n 'ghost-danger': {\n backgroundColor: 'transparent',\n color: '$text-danger',\n\n [iconSlotSelector]: {\n color: '$icon-danger',\n },\n\n '&[data-hovered]': {\n backgroundColor: '$background-danger-subtle',\n color: '$text-danger-hover',\n\n [iconSlotSelector]: {\n color: '$icon-danger-hover',\n },\n },\n '&[data-pressed]': {\n backgroundColor: '$background-danger-subtle-hover',\n color: '$text-danger-active',\n\n [iconSlotSelector]: {\n color: '$icon-danger-active',\n },\n },\n ...ghostDisabled,\n },\n },\n size: {\n 'x-large': {\n height: sizes.xLarge,\n fontSize: '$200',\n paddingX: `calc($200 + ${LABEL_OFFSET}px)`,\n\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n large: {\n height: sizes.large,\n fontSize: '$200',\n paddingX: `calc($150 + ${LABEL_OFFSET}px)`,\n\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n medium: {\n height: sizes.medium,\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n\n [externalIconSelector]: {\n ...baseIconStyles.size.small,\n ...baseIconStyles.weight.thin,\n },\n },\n small: {\n fontSize: '$175',\n height: '$6',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n\n [externalIconSelector]: {\n ...baseIconStyles.size.small,\n ...baseIconStyles.weight.thin,\n },\n },\n },\n rounded: {\n true: {\n borderRadius: '$round',\n },\n },\n fluid: {\n true: {\n display: 'flex',\n justifyContent: 'center',\n maxWidth: '100%',\n width: '100%',\n },\n },\n },\n})\n\nexport const StyledHiddenContent = styled(Primitive.span, {\n visibility: 'hidden',\n})\n\nexport const StyledSpinnerBox = styled(Primitive.div, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n margin: 'auto',\n})\n\nexport type StyledButtonProps = ComponentPropsWithRef<typeof StyledButton>\n","import { Primitive } from '@mirohq/design-system-primitive'\n\nexport const Label = Primitive.span\n\nLabel.displayName = 'Label'\n","import React from 'react'\nimport { booleanify } from '@mirohq/design-system-utils'\nimport { Spinner } from '@mirohq/design-system-spinner'\nimport type { SpinnerProps } from '@mirohq/design-system-spinner'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\n\nimport type { StyledButtonProps } from './button.styled'\nimport {\n StyledHiddenContent,\n StyledSpinnerBox,\n StyledButton,\n} from './button.styled'\nimport { IconSlot } from './partials/icon-slot'\nimport { Label } from './partials/label'\nimport { ButtonProvider } from './hooks/use-button-context'\n\nexport type ButtonProps = {\n /**\n * Change the button style.\n * @default 'primary'\n */\n variant?: StyledButtonProps['variant']\n\n /**\n * Change the button size.\n * @default 'large'\n */\n size?: StyledButtonProps['size']\n\n /**\n * Make button border rounded.\n * @default false\n */\n rounded?: StyledButtonProps['rounded']\n\n /**\n * Add spinner and disable.\n * @default false\n */\n loading?: boolean\n\n /**\n * Make width 100%.\n * @default false\n */\n fluid?: StyledButtonProps['fluid']\n} & BaseButtonProps\n\nexport const Button = React.forwardRef<ElementRef<'button' | 'a'>, ButtonProps>(\n (\n {\n variant = 'primary',\n size = 'large',\n loading = false,\n rounded = false,\n fluid = false,\n 'aria-disabled': ariaDisabled,\n asChild = false,\n children,\n ...restProps\n },\n forwardRef\n ) => {\n let spinnerSize: SpinnerProps['size'] = 'medium'\n\n if (typeof size === 'string' && ['small', 'medium'].includes(size)) {\n spinnerSize = 'small'\n }\n\n const shouldHaveAriaDisabled = booleanify(ariaDisabled) || loading\n\n let formattedChildren = children\n\n if (loading) {\n const spinnerTestId =\n process.env.NODE_ENV === 'test' ? 'button-spinner' : undefined\n\n if (\n asChild &&\n React.Children.toArray(children).length === 1 &&\n React.isValidElement(children)\n ) {\n // when using asChild we need to render element to merge props with first,\n // and spinner wrapper should be rendered between the element and its content\n const firstLevelChild = React.Children.only(children)\n\n const { children: secondLevelChildren, ...childProps } =\n firstLevelChild.props\n\n formattedChildren = React.cloneElement(firstLevelChild, {\n ...childProps,\n children: (\n <>\n <StyledSpinnerBox data-testid={spinnerTestId}>\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n <StyledHiddenContent>{secondLevelChildren}</StyledHiddenContent>\n </>\n ),\n })\n } else {\n formattedChildren = (\n <>\n <StyledSpinnerBox data-testid={spinnerTestId}>\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n <StyledHiddenContent>{children}</StyledHiddenContent>\n </>\n )\n }\n }\n\n return (\n <ButtonProvider size={size}>\n <StyledButton\n {...restProps}\n asChild={asChild}\n variant={variant}\n rounded={rounded}\n fluid={fluid}\n size={size}\n // without undefined it will be aria-disabled=\"false\" in html\n aria-disabled={shouldHaveAriaDisabled ? true : undefined}\n ref={forwardRef}\n >\n {formattedChildren}\n </StyledButton>\n </ButtonProvider>\n )\n }\n) as ForwardRefExoticComponent<ButtonProps> & Partials\n\n// Partials\n// -----------------------------------------------------------------------------\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n Label: typeof Label\n}\n\nButton.IconSlot = IconSlot\nButton.Label = Label\n"],"names":["baseIconStyles"],"mappings":";;;;;;;;;;AAaA,MAAM,aAAA,GAAgB,aAAkC,CAAA,EAAS,CAAA,CAAA;AAE1D,MAAM,iBAAiB,CAAC;AAAA,EAC7B,QAAA;AAAA,EACA,GAAG,SAAA;AACL,CACE,qBAAA,GAAA;AAAA,EAAC,aAAc,CAAA,QAAA;AAAA,EAAd;AAAA,IACC,KAAO,EAAA;AAAA,MACL,GAAG,SAAA;AAAA,KACL;AAAA,IAEC,QAAA;AAAA,GAAA;AACH,CAAA,CAAA;AAGW,MAAA,gBAAA,GAAmB,MAC9B,UAAA,CAAW,aAAa,CAAA;;ACbnB,MAAM,cAAiB,GAAA,MAAA,CAAO,SAAU,CAAA,GAAA,EAAK,EAAE,CAAA,CAAA;AAKtD,MAAM,eAAsD,GAAA;AAAA,EAC1D,KAAO,EAAA,OAAA;AAAA,EACP,MAAQ,EAAA,OAAA;AAAA,EACR,KAAO,EAAA,QAAA;AAAA,EACP,SAAW,EAAA,QAAA;AACb,CAAA,CAAA;AAEA,MAAM,iBAA0D,GAAA;AAAA,EAC9D,KAAO,EAAA,MAAA;AAAA,EACP,MAAQ,EAAA,MAAA;AAAA,EACR,KAAO,EAAA,QAAA;AAAA,EACP,SAAW,EAAA,QAAA;AACb,CAAA,CAAA;AASa,MAAA,QAAA,GAAW,MAAM,UAG5B,CAAA,CAAC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