@mirohq/design-system-base-button 0.3.1 → 0.3.2-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 +21 -102
- package/dist/main.js.map +1 -1
- package/dist/module.js +21 -103
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +10 -21
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -15,20 +15,11 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
15
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
const focusOutline = {
|
|
25
|
-
"&[data-focused]": {
|
|
26
|
-
boxShadow: `0 0 0 2px var(--colors-blue-200), inset 0 0 0 1px var(--colors-blue-500), inset 0 0 0 2px var(--colors-white)`,
|
|
27
|
-
outline: "none",
|
|
28
|
-
borderColor: "$blue-500"
|
|
29
|
-
}
|
|
18
|
+
const sizes = {
|
|
19
|
+
medium: "$8",
|
|
20
|
+
large: "$10",
|
|
21
|
+
xLarge: "$12"
|
|
30
22
|
};
|
|
31
|
-
const activeSelector = "&:active, &[data-pressed]";
|
|
32
23
|
const StyledBaseButton = designSystemStitches.styled(designSystemPrimitive.Primitive.button, {
|
|
33
24
|
all: "unset",
|
|
34
25
|
display: "inline-flex",
|
|
@@ -39,94 +30,21 @@ const StyledBaseButton = designSystemStitches.styled(designSystemPrimitive.Primi
|
|
|
39
30
|
"&[disabled]": {
|
|
40
31
|
pointerEvents: "none"
|
|
41
32
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"solid-prominent": {
|
|
45
|
-
backgroundColor: "$background-primary-prominent",
|
|
46
|
-
color: "$icon-primary-inverted",
|
|
47
|
-
...focusFilled,
|
|
48
|
-
"&:hover": {
|
|
49
|
-
backgroundColor: "$background-primary-prominent-hover"
|
|
50
|
-
},
|
|
51
|
-
[activeSelector]: {
|
|
52
|
-
backgroundColor: "$background-primary-prominent-active"
|
|
53
|
-
},
|
|
54
|
-
"&[disabled]": {
|
|
55
|
-
backgroundColor: "$background-neutrals-disabled",
|
|
56
|
-
color: "$icon-neutrals-disabled"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"solid-subtle": {
|
|
60
|
-
backgroundColor: "$background-neutrals-subtle",
|
|
61
|
-
color: "$icon-neutrals",
|
|
62
|
-
...focusFilled,
|
|
63
|
-
"&:hover": {
|
|
64
|
-
backgroundColor: "$background-neutrals-subtle-hover"
|
|
65
|
-
},
|
|
66
|
-
[activeSelector]: {
|
|
67
|
-
backgroundColor: "$background-neutrals-subtle-active"
|
|
68
|
-
},
|
|
69
|
-
"&[disabled]": {
|
|
70
|
-
backgroundColor: "$background-neutrals-disabled",
|
|
71
|
-
color: "$icon-neutrals-disabled"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
outline: {
|
|
75
|
-
backgroundColor: "$background-neutrals",
|
|
76
|
-
color: "$icon-neutrals",
|
|
77
|
-
border: "1px solid $border-neutrals",
|
|
78
|
-
"&:hover": {
|
|
79
|
-
backgroundColor: "$background-neutrals-subtle-hover",
|
|
80
|
-
borderColor: "$border-neutrals-hover"
|
|
81
|
-
},
|
|
82
|
-
[activeSelector]: {
|
|
83
|
-
backgroundColor: "$background-neutrals-subtle-active",
|
|
84
|
-
borderColor: "$border-neutrals-active"
|
|
85
|
-
},
|
|
86
|
-
"&[disabled]": {
|
|
87
|
-
backgroundColor: "$background-neutrals-disabled",
|
|
88
|
-
color: "$icon-neutrals-disabled",
|
|
89
|
-
borderColor: "$border-neutrals-disabled"
|
|
90
|
-
},
|
|
91
|
-
...focusOutline
|
|
92
|
-
},
|
|
93
|
-
ghost: {
|
|
94
|
-
color: "$icon-neutrals",
|
|
95
|
-
backgroundColor: "transparent",
|
|
96
|
-
...focusFilled,
|
|
97
|
-
"&:hover": {
|
|
98
|
-
backgroundColor: "$background-neutrals-subtle-hover"
|
|
99
|
-
},
|
|
100
|
-
[activeSelector]: {
|
|
101
|
-
backgroundColor: "$background-neutrals-subtle-active"
|
|
102
|
-
},
|
|
103
|
-
"&[disabled]": {
|
|
104
|
-
color: "$icon-neutrals-disabled"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
size: {
|
|
109
|
-
medium: {
|
|
110
|
-
height: "$8",
|
|
111
|
-
paddingX: "$50"
|
|
112
|
-
},
|
|
113
|
-
large: {
|
|
114
|
-
height: "$10",
|
|
115
|
-
paddingX: "$100"
|
|
116
|
-
},
|
|
117
|
-
"x-large": {
|
|
118
|
-
height: "$12",
|
|
119
|
-
paddingX: "$150"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
33
|
+
'&[aria-disabled="true"]': {
|
|
34
|
+
cursor: "default"
|
|
122
35
|
}
|
|
123
36
|
});
|
|
124
37
|
|
|
38
|
+
function eventHandler(callback, allowEvent) {
|
|
39
|
+
if (allowEvent) {
|
|
40
|
+
return void 0;
|
|
41
|
+
}
|
|
42
|
+
return callback;
|
|
43
|
+
}
|
|
125
44
|
const BaseButton = React__default["default"].forwardRef(
|
|
126
45
|
({
|
|
127
|
-
variant,
|
|
128
|
-
size,
|
|
129
46
|
disabled = false,
|
|
47
|
+
"aria-disabled": ariaDisabled,
|
|
130
48
|
href,
|
|
131
49
|
target,
|
|
132
50
|
rel,
|
|
@@ -148,13 +66,14 @@ const BaseButton = React__default["default"].forwardRef(
|
|
|
148
66
|
const asLink = href != null;
|
|
149
67
|
const ref = React.useRef(null);
|
|
150
68
|
const refWithFallback = forwardRef != null ? forwardRef : ref;
|
|
69
|
+
const allowPressEvents = ariaDisabled === "true" || ariaDisabled === true;
|
|
151
70
|
const commonProps = {
|
|
152
71
|
isDisabled: disabled,
|
|
153
|
-
onPress: onPress != null ? onPress : onClick,
|
|
154
|
-
onPressStart,
|
|
155
|
-
onPressEnd,
|
|
156
|
-
onPressChange,
|
|
157
|
-
onFocusChange,
|
|
72
|
+
onPress: eventHandler(onPress != null ? onPress : onClick, allowPressEvents),
|
|
73
|
+
onPressStart: eventHandler(onPressStart, allowPressEvents),
|
|
74
|
+
onPressEnd: eventHandler(onPressEnd, allowPressEvents),
|
|
75
|
+
onPressChange: eventHandler(onPressChange, allowPressEvents),
|
|
76
|
+
onFocusChange: eventHandler(onFocusChange, allowPressEvents),
|
|
158
77
|
onFocus,
|
|
159
78
|
onBlur
|
|
160
79
|
};
|
|
@@ -188,14 +107,13 @@ const BaseButton = React__default["default"].forwardRef(
|
|
|
188
107
|
);
|
|
189
108
|
return /* @__PURE__ */ React__default["default"].createElement(StyledBaseButton, {
|
|
190
109
|
...elementProps,
|
|
191
|
-
variant,
|
|
192
|
-
size,
|
|
193
110
|
disabled,
|
|
194
111
|
asChild: asLink || asChild,
|
|
195
112
|
...tabIndexProp,
|
|
196
113
|
"data-pressed": isPressed ? "" : void 0,
|
|
197
114
|
"data-focused": isFocusVisible ? "" : void 0,
|
|
198
115
|
"data-hovered": isHovered ? "" : void 0,
|
|
116
|
+
"aria-disabled": ariaDisabled,
|
|
199
117
|
ref: refWithFallback
|
|
200
118
|
}, asLink ? /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
201
119
|
href,
|
|
@@ -206,4 +124,5 @@ const BaseButton = React__default["default"].forwardRef(
|
|
|
206
124
|
);
|
|
207
125
|
|
|
208
126
|
exports.BaseButton = BaseButton;
|
|
127
|
+
exports.sizes = sizes;
|
|
209
128
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/base-button.styled.ts","../src/base-button.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\n// todo move to general focus styles (focus-small)\nconst focusFilled = {\n '&[data-focused]': {\n boxShadow: `0 0 0 2px var(--colors-blue-200), inset 0 0 0 2px var(--colors-blue-500), inset 0 0 0 3px var(--colors-white)`,\n outline: 'none',\n },\n}\n\nconst focusOutline = {\n '&[data-focused]': {\n boxShadow: `0 0 0 2px var(--colors-blue-200), inset 0 0 0 1px var(--colors-blue-500), inset 0 0 0 2px var(--colors-white)`,\n outline: 'none',\n borderColor: '$blue-500',\n },\n}\n\nconst activeSelector = '&:active, &[data-pressed]'\n\nexport const StyledBaseButton = styled(Primitive.button, {\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n boxSizing: 'border-box',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&[disabled]': {\n pointerEvents: 'none',\n },\n\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$icon-primary-inverted',\n ...focusFilled,\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n '&[disabled]': {\n backgroundColor: '$background-neutrals-disabled',\n color: '$icon-neutrals-disabled',\n },\n },\n 'solid-subtle': {\n backgroundColor: '$background-neutrals-subtle',\n color: '$icon-neutrals',\n ...focusFilled,\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n '&[disabled]': {\n backgroundColor: '$background-neutrals-disabled',\n color: '$icon-neutrals-disabled',\n },\n },\n outline: {\n backgroundColor: '$background-neutrals',\n color: '$icon-neutrals',\n border: '1px solid $border-neutrals',\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 '&[disabled]': {\n backgroundColor: '$background-neutrals-disabled',\n color: '$icon-neutrals-disabled',\n borderColor: '$border-neutrals-disabled',\n },\n\n // order is important because of borderColor\n ...focusOutline,\n },\n ghost: {\n color: '$icon-neutrals',\n backgroundColor: 'transparent',\n ...focusFilled,\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n '&[disabled]': {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n size: {\n medium: {\n height: '$8',\n paddingX: '$50',\n },\n large: {\n height: '$10',\n paddingX: '$100',\n },\n 'x-large': {\n height: '$12',\n paddingX: '$150',\n },\n },\n },\n})\n\nexport type StyledBaseButtonProps = ComponentPropsWithRef<\n typeof StyledBaseButton\n>\n","import React, { useRef } from 'react'\nimport type { ElementRef, ReactNode } from 'react'\nimport { useButton } from '@react-aria/button'\nimport { useHover } from '@react-aria/interactions'\nimport { mergeProps } from '@react-aria/utils'\nimport { useLink } from '@react-aria/link'\nimport { useFocusRing } from '@react-aria/focus'\nimport type { HoverEvents, FocusEvents } from '@react-types/shared'\nimport type { AriaButtonProps } from '@react-types/button'\n\nimport { StyledBaseButton } from './base-button.styled'\nimport type { StyledBaseButtonProps } from './base-button.styled'\n\ntype ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>\n\nexport interface BaseButtonProps\n extends FocusEvents,\n HoverEvents,\n Omit<\n ButtonPropsA11y,\n | 'onClick'\n | 'isDisabled'\n | 'elementType'\n | 'onBlur'\n | 'onFocus'\n | 'onPressUp'\n > {\n /**\n * The content\n */\n children: ReactNode\n\n /**\n * Change the button style\n */\n variant?: StyledBaseButtonProps['variant']\n\n /**\n * Change the button size\n */\n size?: StyledBaseButtonProps['size']\n\n /**\n * Prevent pointer events\n */\n disabled?: boolean\n\n /**\n * A URL to link when using the button as a link\n */\n href?: string\n\n /**\n * The target window using the button as a link\n */\n target?: string\n\n /**\n * The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel)\n */\n rel?: string\n\n /**\n * Alias for onPress\n */\n onClick?: AriaButtonProps['onPress']\n}\n\nexport const BaseButton = React.forwardRef<\n ElementRef<typeof StyledBaseButton>,\n BaseButtonProps\n>(\n (\n {\n variant,\n size,\n disabled = false,\n href,\n target,\n rel,\n children,\n onClick,\n asChild,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n onFocus,\n onBlur,\n onFocusChange,\n ...restProps\n },\n forwardRef\n ) => {\n const asLink = href != null\n\n const ref = useRef<HTMLButtonElement | HTMLAnchorElement>(null)\n const refWithFallback = forwardRef ?? ref\n\n const commonProps = {\n isDisabled: disabled,\n onPress: onPress ?? onClick,\n onPressStart,\n onPressEnd,\n onPressChange,\n onFocusChange,\n onFocus,\n onBlur,\n }\n\n const { buttonProps, isPressed } = useButton(\n {\n href,\n // @ts-expect-error\n allowFocusWhenDisabled: false,\n ...commonProps,\n ...restProps,\n },\n refWithFallback\n )\n\n const { linkProps } = useLink(\n { ...commonProps, ...restProps },\n // @ts-expect-error\n refWithFallback\n )\n const tabIndexProp = disabled && {\n tabIndex: -1,\n }\n\n const { isFocusVisible, focusProps: focusPropsRing } = useFocusRing()\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart: e => onHoverStart?.(e),\n onHoverEnd: e => onHoverEnd?.(e),\n onHoverChange: e => onHoverChange?.(e),\n })\n\n const elementProps = mergeProps(\n restProps,\n asLink ? linkProps : buttonProps,\n hoverProps,\n focusPropsRing\n )\n\n return (\n <StyledBaseButton\n {...elementProps}\n variant={variant}\n size={size}\n disabled={disabled}\n asChild={asLink || asChild}\n {...tabIndexProp}\n data-pressed={isPressed ? '' : undefined}\n data-focused={isFocusVisible ? '' : undefined}\n data-hovered={isHovered ? '' : undefined}\n // @ts-expect-error\n ref={refWithFallback}\n >\n {asLink ? (\n <a\n href={href}\n target={target}\n rel={target === '_blank' ? `noopener noreferrer ${rel}` : rel}\n >\n {children}\n </a>\n ) : (\n children\n )}\n </StyledBaseButton>\n )\n }\n)\n"],"names":["styled","Primitive","React","useRef","useBut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,MAE/B,GAAK,EAAA,eAAA;AAAA,KAAA,EAEJ,yBACEA,yBAAA,CAAA,aAAA,CAAA,GAAA,EAAA;AAAA,MACC,IAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAK,EAAA,MAAA,KAAW,QAAW,GAAA,CAAA,oBAAA,EAAuB,GAAQ,CAAA,CAAA,GAAA,GAAA;AAAA,KAEzD,EAAA,QACH,IAEA,QAEJ,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/base-button.styled.ts","../src/base-button.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const sizes = {\n medium: '$8',\n large: '$10',\n xLarge: '$12',\n}\n\nexport const StyledBaseButton = styled(Primitive.button, {\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n boxSizing: 'border-box',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&[disabled]': {\n pointerEvents: 'none',\n },\n\n '&[aria-disabled=\"true\"]': {\n cursor: 'default',\n },\n})\n\nexport type StyledBaseButtonProps = ComponentPropsWithRef<\n typeof StyledBaseButton\n>\n","import React, { useRef } from 'react'\nimport type { ElementRef, ReactNode } from 'react'\nimport { useButton } from '@react-aria/button'\nimport { useHover } from '@react-aria/interactions'\nimport { mergeProps } from '@react-aria/utils'\nimport { useLink } from '@react-aria/link'\nimport { useFocusRing } from '@react-aria/focus'\nimport type { HoverEvents, FocusEvents } from '@react-types/shared'\nimport type { AriaButtonProps } from '@react-types/button'\n\nimport { StyledBaseButton } from './base-button.styled'\nimport type { StyledBaseButtonProps } from './base-button.styled'\n\ntype ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>\n\nexport interface BaseButtonProps\n extends FocusEvents,\n HoverEvents,\n Omit<\n ButtonPropsA11y,\n | 'onClick'\n | 'isDisabled'\n | 'elementType'\n | 'onBlur'\n | 'onFocus'\n | 'onPressUp'\n > {\n /**\n * The content\n */\n children: ReactNode\n\n /**\n * Prevent pointer events\n */\n disabled?: boolean\n\n /**\n * A URL to link when using the button as a link\n */\n href?: string\n\n /**\n * The target window using the button as a link\n */\n target?: string\n\n /**\n * The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel)\n */\n rel?: string\n\n /**\n * Alias for onPress\n */\n onClick?: AriaButtonProps['onPress']\n}\n\nfunction eventHandler<T>(\n callback: ((e: T) => void) | undefined,\n allowEvent: boolean\n): ((e: T) => void) | undefined {\n if (allowEvent) {\n return undefined\n }\n\n return callback\n}\n\nexport const BaseButton = React.forwardRef<\n ElementRef<typeof StyledBaseButton | 'a'>,\n BaseButtonProps\n>(\n (\n {\n disabled = false,\n 'aria-disabled': ariaDisabled,\n href,\n target,\n rel,\n children,\n onClick,\n asChild,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n onFocus,\n onBlur,\n onFocusChange,\n ...restProps\n },\n forwardRef\n ) => {\n const asLink = href != null\n\n const ref = useRef<HTMLButtonElement | HTMLAnchorElement>(null)\n const refWithFallback = forwardRef ?? ref\n\n // we cannot rely on useButton with ariaDisabled, because it doesn't support onFocus when isDisabled\n const allowPressEvents = ariaDisabled === 'true' || ariaDisabled === true\n\n const commonProps = {\n isDisabled: disabled,\n onPress: eventHandler(onPress ?? onClick, allowPressEvents),\n onPressStart: eventHandler(onPressStart, allowPressEvents),\n onPressEnd: eventHandler(onPressEnd, allowPressEvents),\n onPressChange: eventHandler(onPressChange, allowPressEvents),\n onFocusChange: eventHandler(onFocusChange, allowPressEvents),\n onFocus,\n onBlur,\n }\n\n const { buttonProps, isPressed } = useButton(\n {\n href,\n // @ts-expect-error\n allowFocusWhenDisabled: false,\n ...commonProps,\n ...restProps,\n },\n refWithFallback\n )\n\n const { linkProps } = useLink(\n { ...commonProps, ...restProps },\n // @ts-expect-error\n refWithFallback\n )\n const tabIndexProp = disabled && {\n tabIndex: -1,\n }\n\n const { isFocusVisible, focusProps: focusPropsRing } = useFocusRing()\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart: e => onHoverStart?.(e),\n onHoverEnd: e => onHoverEnd?.(e),\n onHoverChange: e => onHoverChange?.(e),\n })\n\n const elementProps = mergeProps(\n restProps,\n asLink ? linkProps : buttonProps,\n hoverProps,\n focusPropsRing\n )\n\n return (\n <StyledBaseButton\n {...elementProps}\n disabled={disabled}\n asChild={asLink || asChild}\n {...tabIndexProp}\n data-pressed={isPressed ? '' : undefined}\n data-focused={isFocusVisible ? '' : undefined}\n data-hovered={isHovered ? '' : undefined}\n aria-disabled={ariaDisabled}\n // @ts-expect-error\n ref={refWithFallback}\n >\n {asLink ? (\n <a\n href={href}\n target={target}\n rel={target === '_blank' ? `noopener noreferrer ${rel}` : rel}\n >\n {children}\n </a>\n ) : (\n children\n )}\n </StyledBaseButton>\n )\n }\n)\n"],"names":["styled","Primitive","React","useRef","useButton","useLink","useFocusRing","useHover","mergeProps"],"mappings":";;;;;;;;;;;;;;;;;AAIO,MAAM,KAAQ,GAAA;AAAA,EACnB,MAAQ,EAAA,IAAA;AAAA,EACR,KAAO,EAAA,KAAA;AAAA,EACP,MAAQ,EAAA,KAAA;AACV,EAAA;AAEa,MAAA,gBAAA,GAAmBA,2BAAO,CAAAC,+BAAA,CAAU,MAAQ,EAAA;AAAA,EACvD,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,aAAA;AAAA,EACT,UAAY,EAAA,QAAA;AAAA,EACZ,SAAW,EAAA,YAAA;AAAA,EACX,YAAc,EAAA,KAAA;AAAA,EACd,MAAQ,EAAA,SAAA;AAAA,EAER,aAAe,EAAA;AAAA,IACb,aAAe,EAAA,MAAA;AAAA,GACjB;AAAA,EAEA,yBAA2B,EAAA;AAAA,IACzB,MAAQ,EAAA,SAAA;AAAA,GACV;AACF,CAAC,CAAA;;ACiCD,SAAS,YAAA,CACP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MAAU,IAAA,OAAA;AAAA,MAClB,GAAG,YAAA;AAAA,MACJ,cAAA,EAAc,YAAY,EAAK,GAAA,KAAA,CAAA;AAAA,MAC/B,cAAA,EAAc,iBAAiB,EAAK,GAAA,KAAA,CAAA;AAAA,MACpC,cAAA,EAAc,YAAY,EAAK,GAAA,KAAA,CAAA;AAAA,MAC/B,eAAe,EAAA,YAAA;AAAA,MAEf,GAAK,EAAA,eAAA;AAAA,KAAA,EAEJ,yBACEA,yBAAA,CAAA,aAAA,CAAA,GAAA,EAAA;AAAA,MACC,IAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAK,EAAA,MAAA,KAAW,QAAW,GAAA,CAAA,oBAAA,EAAuB,GAAQ,CAAA,CAAA,GAAA,GAAA;AAAA,KAEzD,EAAA,QACH,IAEA,QAEJ,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;"}
|
package/dist/module.js
CHANGED
|
@@ -7,20 +7,11 @@ import { useFocusRing } from '@react-aria/focus';
|
|
|
7
7
|
import { Primitive } from '@mirohq/design-system-primitive';
|
|
8
8
|
import { styled } from '@mirohq/design-system-stitches';
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const focusOutline = {
|
|
17
|
-
"&[data-focused]": {
|
|
18
|
-
boxShadow: `0 0 0 2px var(--colors-blue-200), inset 0 0 0 1px var(--colors-blue-500), inset 0 0 0 2px var(--colors-white)`,
|
|
19
|
-
outline: "none",
|
|
20
|
-
borderColor: "$blue-500"
|
|
21
|
-
}
|
|
10
|
+
const sizes = {
|
|
11
|
+
medium: "$8",
|
|
12
|
+
large: "$10",
|
|
13
|
+
xLarge: "$12"
|
|
22
14
|
};
|
|
23
|
-
const activeSelector = "&:active, &[data-pressed]";
|
|
24
15
|
const StyledBaseButton = styled(Primitive.button, {
|
|
25
16
|
all: "unset",
|
|
26
17
|
display: "inline-flex",
|
|
@@ -31,94 +22,21 @@ const StyledBaseButton = styled(Primitive.button, {
|
|
|
31
22
|
"&[disabled]": {
|
|
32
23
|
pointerEvents: "none"
|
|
33
24
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"solid-prominent": {
|
|
37
|
-
backgroundColor: "$background-primary-prominent",
|
|
38
|
-
color: "$icon-primary-inverted",
|
|
39
|
-
...focusFilled,
|
|
40
|
-
"&:hover": {
|
|
41
|
-
backgroundColor: "$background-primary-prominent-hover"
|
|
42
|
-
},
|
|
43
|
-
[activeSelector]: {
|
|
44
|
-
backgroundColor: "$background-primary-prominent-active"
|
|
45
|
-
},
|
|
46
|
-
"&[disabled]": {
|
|
47
|
-
backgroundColor: "$background-neutrals-disabled",
|
|
48
|
-
color: "$icon-neutrals-disabled"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"solid-subtle": {
|
|
52
|
-
backgroundColor: "$background-neutrals-subtle",
|
|
53
|
-
color: "$icon-neutrals",
|
|
54
|
-
...focusFilled,
|
|
55
|
-
"&:hover": {
|
|
56
|
-
backgroundColor: "$background-neutrals-subtle-hover"
|
|
57
|
-
},
|
|
58
|
-
[activeSelector]: {
|
|
59
|
-
backgroundColor: "$background-neutrals-subtle-active"
|
|
60
|
-
},
|
|
61
|
-
"&[disabled]": {
|
|
62
|
-
backgroundColor: "$background-neutrals-disabled",
|
|
63
|
-
color: "$icon-neutrals-disabled"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
outline: {
|
|
67
|
-
backgroundColor: "$background-neutrals",
|
|
68
|
-
color: "$icon-neutrals",
|
|
69
|
-
border: "1px solid $border-neutrals",
|
|
70
|
-
"&:hover": {
|
|
71
|
-
backgroundColor: "$background-neutrals-subtle-hover",
|
|
72
|
-
borderColor: "$border-neutrals-hover"
|
|
73
|
-
},
|
|
74
|
-
[activeSelector]: {
|
|
75
|
-
backgroundColor: "$background-neutrals-subtle-active",
|
|
76
|
-
borderColor: "$border-neutrals-active"
|
|
77
|
-
},
|
|
78
|
-
"&[disabled]": {
|
|
79
|
-
backgroundColor: "$background-neutrals-disabled",
|
|
80
|
-
color: "$icon-neutrals-disabled",
|
|
81
|
-
borderColor: "$border-neutrals-disabled"
|
|
82
|
-
},
|
|
83
|
-
...focusOutline
|
|
84
|
-
},
|
|
85
|
-
ghost: {
|
|
86
|
-
color: "$icon-neutrals",
|
|
87
|
-
backgroundColor: "transparent",
|
|
88
|
-
...focusFilled,
|
|
89
|
-
"&:hover": {
|
|
90
|
-
backgroundColor: "$background-neutrals-subtle-hover"
|
|
91
|
-
},
|
|
92
|
-
[activeSelector]: {
|
|
93
|
-
backgroundColor: "$background-neutrals-subtle-active"
|
|
94
|
-
},
|
|
95
|
-
"&[disabled]": {
|
|
96
|
-
color: "$icon-neutrals-disabled"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
size: {
|
|
101
|
-
medium: {
|
|
102
|
-
height: "$8",
|
|
103
|
-
paddingX: "$50"
|
|
104
|
-
},
|
|
105
|
-
large: {
|
|
106
|
-
height: "$10",
|
|
107
|
-
paddingX: "$100"
|
|
108
|
-
},
|
|
109
|
-
"x-large": {
|
|
110
|
-
height: "$12",
|
|
111
|
-
paddingX: "$150"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
25
|
+
'&[aria-disabled="true"]': {
|
|
26
|
+
cursor: "default"
|
|
114
27
|
}
|
|
115
28
|
});
|
|
116
29
|
|
|
30
|
+
function eventHandler(callback, allowEvent) {
|
|
31
|
+
if (allowEvent) {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
return callback;
|
|
35
|
+
}
|
|
117
36
|
const BaseButton = React.forwardRef(
|
|
118
37
|
({
|
|
119
|
-
variant,
|
|
120
|
-
size,
|
|
121
38
|
disabled = false,
|
|
39
|
+
"aria-disabled": ariaDisabled,
|
|
122
40
|
href,
|
|
123
41
|
target,
|
|
124
42
|
rel,
|
|
@@ -140,13 +58,14 @@ const BaseButton = React.forwardRef(
|
|
|
140
58
|
const asLink = href != null;
|
|
141
59
|
const ref = useRef(null);
|
|
142
60
|
const refWithFallback = forwardRef != null ? forwardRef : ref;
|
|
61
|
+
const allowPressEvents = ariaDisabled === "true" || ariaDisabled === true;
|
|
143
62
|
const commonProps = {
|
|
144
63
|
isDisabled: disabled,
|
|
145
|
-
onPress: onPress != null ? onPress : onClick,
|
|
146
|
-
onPressStart,
|
|
147
|
-
onPressEnd,
|
|
148
|
-
onPressChange,
|
|
149
|
-
onFocusChange,
|
|
64
|
+
onPress: eventHandler(onPress != null ? onPress : onClick, allowPressEvents),
|
|
65
|
+
onPressStart: eventHandler(onPressStart, allowPressEvents),
|
|
66
|
+
onPressEnd: eventHandler(onPressEnd, allowPressEvents),
|
|
67
|
+
onPressChange: eventHandler(onPressChange, allowPressEvents),
|
|
68
|
+
onFocusChange: eventHandler(onFocusChange, allowPressEvents),
|
|
150
69
|
onFocus,
|
|
151
70
|
onBlur
|
|
152
71
|
};
|
|
@@ -180,14 +99,13 @@ const BaseButton = React.forwardRef(
|
|
|
180
99
|
);
|
|
181
100
|
return /* @__PURE__ */ React.createElement(StyledBaseButton, {
|
|
182
101
|
...elementProps,
|
|
183
|
-
variant,
|
|
184
|
-
size,
|
|
185
102
|
disabled,
|
|
186
103
|
asChild: asLink || asChild,
|
|
187
104
|
...tabIndexProp,
|
|
188
105
|
"data-pressed": isPressed ? "" : void 0,
|
|
189
106
|
"data-focused": isFocusVisible ? "" : void 0,
|
|
190
107
|
"data-hovered": isHovered ? "" : void 0,
|
|
108
|
+
"aria-disabled": ariaDisabled,
|
|
191
109
|
ref: refWithFallback
|
|
192
110
|
}, asLink ? /* @__PURE__ */ React.createElement("a", {
|
|
193
111
|
href,
|
|
@@ -197,5 +115,5 @@ const BaseButton = React.forwardRef(
|
|
|
197
115
|
}
|
|
198
116
|
);
|
|
199
117
|
|
|
200
|
-
export { BaseButton };
|
|
118
|
+
export { BaseButton, sizes };
|
|
201
119
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/base-button.styled.ts","../src/base-button.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\n// todo move to general focus styles (focus-small)\nconst focusFilled = {\n '&[data-focused]': {\n boxShadow: `0 0 0 2px var(--colors-blue-200), inset 0 0 0 2px var(--colors-blue-500), inset 0 0 0 3px var(--colors-white)`,\n outline: 'none',\n },\n}\n\nconst focusOutline = {\n '&[data-focused]': {\n boxShadow: `0 0 0 2px var(--colors-blue-200), inset 0 0 0 1px var(--colors-blue-500), inset 0 0 0 2px var(--colors-white)`,\n outline: 'none',\n borderColor: '$blue-500',\n },\n}\n\nconst activeSelector = '&:active, &[data-pressed]'\n\nexport const StyledBaseButton = styled(Primitive.button, {\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n boxSizing: 'border-box',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&[disabled]': {\n pointerEvents: 'none',\n },\n\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$icon-primary-inverted',\n ...focusFilled,\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n '&[disabled]': {\n backgroundColor: '$background-neutrals-disabled',\n color: '$icon-neutrals-disabled',\n },\n },\n 'solid-subtle': {\n backgroundColor: '$background-neutrals-subtle',\n color: '$icon-neutrals',\n ...focusFilled,\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n '&[disabled]': {\n backgroundColor: '$background-neutrals-disabled',\n color: '$icon-neutrals-disabled',\n },\n },\n outline: {\n backgroundColor: '$background-neutrals',\n color: '$icon-neutrals',\n border: '1px solid $border-neutrals',\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 '&[disabled]': {\n backgroundColor: '$background-neutrals-disabled',\n color: '$icon-neutrals-disabled',\n borderColor: '$border-neutrals-disabled',\n },\n\n // order is important because of borderColor\n ...focusOutline,\n },\n ghost: {\n color: '$icon-neutrals',\n backgroundColor: 'transparent',\n ...focusFilled,\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n '&[disabled]': {\n color: '$icon-neutrals-disabled',\n },\n },\n },\n size: {\n medium: {\n height: '$8',\n paddingX: '$50',\n },\n large: {\n height: '$10',\n paddingX: '$100',\n },\n 'x-large': {\n height: '$12',\n paddingX: '$150',\n },\n },\n },\n})\n\nexport type StyledBaseButtonProps = ComponentPropsWithRef<\n typeof StyledBaseButton\n>\n","import React, { useRef } from 'react'\nimport type { ElementRef, ReactNode } from 'react'\nimport { useButton } from '@react-aria/button'\nimport { useHover } from '@react-aria/interactions'\nimport { mergeProps } from '@react-aria/utils'\nimport { useLink } from '@react-aria/link'\nimport { useFocusRing } from '@react-aria/focus'\nimport type { HoverEvents, FocusEvents } from '@react-types/shared'\nimport type { AriaButtonProps } from '@react-types/button'\n\nimport { StyledBaseButton } from './base-button.styled'\nimport type { StyledBaseButtonProps } from './base-button.styled'\n\ntype ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>\n\nexport interface BaseButtonProps\n extends FocusEvents,\n HoverEvents,\n Omit<\n ButtonPropsA11y,\n | 'onClick'\n | 'isDisabled'\n | 'elementType'\n | 'onBlur'\n | 'onFocus'\n | 'onPressUp'\n > {\n /**\n * The content\n */\n children: ReactNode\n\n /**\n * Change the button style\n */\n variant?: StyledBaseButtonProps['variant']\n\n /**\n * Change the button size\n */\n size?: StyledBaseButtonProps['size']\n\n /**\n * Prevent pointer events\n */\n disabled?: boolean\n\n /**\n * A URL to link when using the button as a link\n */\n href?: string\n\n /**\n * The target window using the button as a link\n */\n target?: string\n\n /**\n * The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel)\n */\n rel?: string\n\n /**\n * Alias for onPress\n */\n onClick?: AriaButtonProps['onPress']\n}\n\nexport const BaseButton = React.forwardRef<\n ElementRef<typeof StyledBaseButton>,\n BaseButtonProps\n>(\n (\n {\n variant,\n size,\n disabled = false,\n href,\n target,\n rel,\n children,\n onClick,\n asChild,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n onFocus,\n onBlur,\n onFocusChange,\n ...restProps\n },\n forwardRef\n ) => {\n const asLink = href != null\n\n const ref = useRef<HTMLButtonElement | HTMLAnchorElement>(null)\n const refWithFallback = forwardRef ?? ref\n\n const commonProps = {\n isDisabled: disabled,\n onPress: onPress ?? onClick,\n onPressStart,\n onPressEnd,\n onPressChange,\n onFocusChange,\n onFocus,\n onBlur,\n }\n\n const { buttonProps, isPressed } = useButton(\n {\n href,\n // @ts-expect-error\n allowFocusWhenDisabled: false,\n ...commonProps,\n ...restProps,\n },\n refWithFallback\n )\n\n const { linkProps } = useLink(\n { ...commonProps, ...restProps },\n // @ts-expect-error\n refWithFallback\n )\n const tabIndexProp = disabled && {\n tabIndex: -1,\n }\n\n const { isFocusVisible, focusProps: focusPropsRing } = useFocusRing()\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart: e => onHoverStart?.(e),\n onHoverEnd: e => onHoverEnd?.(e),\n onHoverChange: e => onHoverChange?.(e),\n })\n\n const elementProps = mergeProps(\n restProps,\n asLink ? linkProps : buttonProps,\n hoverProps,\n focusPropsRing\n )\n\n return (\n <StyledBaseButton\n {...elementProps}\n variant={variant}\n size={size}\n disabled={disabled}\n asChild={asLink || asChild}\n {...tabIndexProp}\n data-pressed={isPressed ? '' : undefined}\n data-focused={isFocusVisible ? '' : undefined}\n data-hovered={isHovered ? '' : undefined}\n // @ts-expect-error\n ref={refWithFallback}\n >\n {asLink ? (\n <a\n href={href}\n target={target}\n rel={target === '_blank' ? `noopener noreferrer ${rel}` : rel}\n >\n {children}\n </a>\n ) : (\n children\n )}\n </StyledBaseButton>\n )\n }\n)\n"],"names":[],"mappings":";;;;;;;;;AAKA,MAAM,WAAc,GAAA;AAAA,EAClB,iBAAmB,EAAA;AAAA,IACjB,SAAW,EAAA,CAAA,6GAAA,CAAA;AAAA,IACX,OAAS,EAAA,MAAA;AAAA,GACX;AACF,CAAA,CAAA;AAEA,MAAM,YAAe,GAAA;AAAA,EACnB,iBAAmB,EAAA;AAAA,IACjB,SAAW,EAAA,CAAA,6GAAA,CAAA;AAAA,IACX,OAAS,EAAA,MAAA;AAAA,IACT,WAAa,EAAA,WAAA;AAAA,GACf;AACF,CAAA,CAAA;AAEA,MAAM,cAAiB,GAAA,2BAAA,CAAA;AAEV,MAAA,gBAAA,GAAmB,MAAO,CAAA,SAAA,CAAU,MAAQ,EAAA;AAAA,EACvD,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,aAAA;AAAA,EACT,UAAY,EAAA,QAAA;AAAA,EACZ,SAAW,EAAA,YAAA;AAAA,EACX,YAAc,EAAA,KAAA;AAAA,EACd,MAAQ,EAAA,SAAA;AAAA,EAER,aAAe,EAAA;AAAA,IACb,aAAe,EAAA,MAAA;AAAA,GACjB;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,iBAAmB,EAAA;AAAA,QACjB,eAAiB,EAAA,+BAAA;AAAA,QACjB,KAAO,EAAA,wBAAA;AAAA,QACP,GAAG,WAAA;AAAA,QAEH,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAiB,GAAA;AAAA,UAChB,eAAiB,EAAA,sCAAA;AAAA,SACnB;AAAA,QACA,aAAe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,MACJ,cAAA,EAAc,YAAY,EAAK,GAAA,KAAA,CAAA;AAAA,MAC/B,cAAA,EAAc,iBAAiB,EAAK,GAAA,KAAA,CAAA;AAAA,MACpC,cAAA,EAAc,YAAY,EAAK,GAAA,KAAA,CAAA;AAAA,MAE/B,GAAK,EAAA,eAAA;AAAA,KAAA,EAEJ,yBACE,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA;AAAA,MACC,IAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAK,EAAA,MAAA,KAAW,QAAW,GAAA,CAAA,oBAAA,EAAuB,GAAQ,CAAA,CAAA,GAAA,GAAA;AAAA,KAEzD,EAAA,QACH,IAEA,QAEJ,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/base-button.styled.ts","../src/base-button.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const sizes = {\n medium: '$8',\n large: '$10',\n xLarge: '$12',\n}\n\nexport const StyledBaseButton = styled(Primitive.button, {\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n boxSizing: 'border-box',\n borderRadius: '$50',\n cursor: 'pointer',\n\n '&[disabled]': {\n pointerEvents: 'none',\n },\n\n '&[aria-disabled=\"true\"]': {\n cursor: 'default',\n },\n})\n\nexport type StyledBaseButtonProps = ComponentPropsWithRef<\n typeof StyledBaseButton\n>\n","import React, { useRef } from 'react'\nimport type { ElementRef, ReactNode } from 'react'\nimport { useButton } from '@react-aria/button'\nimport { useHover } from '@react-aria/interactions'\nimport { mergeProps } from '@react-aria/utils'\nimport { useLink } from '@react-aria/link'\nimport { useFocusRing } from '@react-aria/focus'\nimport type { HoverEvents, FocusEvents } from '@react-types/shared'\nimport type { AriaButtonProps } from '@react-types/button'\n\nimport { StyledBaseButton } from './base-button.styled'\nimport type { StyledBaseButtonProps } from './base-button.styled'\n\ntype ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>\n\nexport interface BaseButtonProps\n extends FocusEvents,\n HoverEvents,\n Omit<\n ButtonPropsA11y,\n | 'onClick'\n | 'isDisabled'\n | 'elementType'\n | 'onBlur'\n | 'onFocus'\n | 'onPressUp'\n > {\n /**\n * The content\n */\n children: ReactNode\n\n /**\n * Prevent pointer events\n */\n disabled?: boolean\n\n /**\n * A URL to link when using the button as a link\n */\n href?: string\n\n /**\n * The target window using the button as a link\n */\n target?: string\n\n /**\n * The relationship between the linked resource and the current page. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel)\n */\n rel?: string\n\n /**\n * Alias for onPress\n */\n onClick?: AriaButtonProps['onPress']\n}\n\nfunction eventHandler<T>(\n callback: ((e: T) => void) | undefined,\n allowEvent: boolean\n): ((e: T) => void) | undefined {\n if (allowEvent) {\n return undefined\n }\n\n return callback\n}\n\nexport const BaseButton = React.forwardRef<\n ElementRef<typeof StyledBaseButton | 'a'>,\n BaseButtonProps\n>(\n (\n {\n disabled = false,\n 'aria-disabled': ariaDisabled,\n href,\n target,\n rel,\n children,\n onClick,\n asChild,\n onHoverStart,\n onHoverEnd,\n onHoverChange,\n onPress,\n onPressStart,\n onPressEnd,\n onPressChange,\n onFocus,\n onBlur,\n onFocusChange,\n ...restProps\n },\n forwardRef\n ) => {\n const asLink = href != null\n\n const ref = useRef<HTMLButtonElement | HTMLAnchorElement>(null)\n const refWithFallback = forwardRef ?? ref\n\n // we cannot rely on useButton with ariaDisabled, because it doesn't support onFocus when isDisabled\n const allowPressEvents = ariaDisabled === 'true' || ariaDisabled === true\n\n const commonProps = {\n isDisabled: disabled,\n onPress: eventHandler(onPress ?? onClick, allowPressEvents),\n onPressStart: eventHandler(onPressStart, allowPressEvents),\n onPressEnd: eventHandler(onPressEnd, allowPressEvents),\n onPressChange: eventHandler(onPressChange, allowPressEvents),\n onFocusChange: eventHandler(onFocusChange, allowPressEvents),\n onFocus,\n onBlur,\n }\n\n const { buttonProps, isPressed } = useButton(\n {\n href,\n // @ts-expect-error\n allowFocusWhenDisabled: false,\n ...commonProps,\n ...restProps,\n },\n refWithFallback\n )\n\n const { linkProps } = useLink(\n { ...commonProps, ...restProps },\n // @ts-expect-error\n refWithFallback\n )\n const tabIndexProp = disabled && {\n tabIndex: -1,\n }\n\n const { isFocusVisible, focusProps: focusPropsRing } = useFocusRing()\n\n const { hoverProps, isHovered } = useHover({\n onHoverStart: e => onHoverStart?.(e),\n onHoverEnd: e => onHoverEnd?.(e),\n onHoverChange: e => onHoverChange?.(e),\n })\n\n const elementProps = mergeProps(\n restProps,\n asLink ? linkProps : buttonProps,\n hoverProps,\n focusPropsRing\n )\n\n return (\n <StyledBaseButton\n {...elementProps}\n disabled={disabled}\n asChild={asLink || asChild}\n {...tabIndexProp}\n data-pressed={isPressed ? '' : undefined}\n data-focused={isFocusVisible ? '' : undefined}\n data-hovered={isHovered ? '' : undefined}\n aria-disabled={ariaDisabled}\n // @ts-expect-error\n ref={refWithFallback}\n >\n {asLink ? (\n <a\n href={href}\n target={target}\n rel={target === '_blank' ? `noopener noreferrer ${rel}` : rel}\n >\n {children}\n </a>\n ) : (\n children\n )}\n </StyledBaseButton>\n )\n }\n)\n"],"names":[],"mappings":";;;;;;;;;AAIO,MAAM,KAAQ,GAAA;AAAA,EACnB,MAAQ,EAAA,IAAA;AAAA,EACR,KAAO,EAAA,KAAA;AAAA,EACP,MAAQ,EAAA,KAAA;AACV,EAAA;AAEa,MAAA,gBAAA,GAAmB,MAAO,CAAA,SAAA,CAAU,MAAQ,EAAA;AAAA,EACvD,GAAK,EAAA,OAAA;AAAA,EACL,OAAS,EAAA,aAAA;AAAA,EACT,UAAY,EAAA,QAAA;AAAA,EACZ,SAAW,EAAA,YAAA;AAAA,EACX,YAAc,EAAA,KAAA;AAAA,EACd,MAAQ,EAAA,SAAA;AAAA,EAER,aAAe,EAAA;AAAA,IACb,aAAe,EAAA,MAAA;AAAA,GACjB;AAAA,E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A,aAAA,CAAA,gBAAA,EAAA;AAAA,MACE,GAAG,YAAA;AAAA,MACJ,QAAA;AAAA,MACA,SAAS,MAAU,IAAA,OAAA;AAAA,MAClB,GAAG,YAAA;AAAA,MACJ,cAAA,EAAc,YAAY,EAAK,GAAA,KAAA,CAAA;AAAA,MAC/B,cAAA,EAAc,iBAAiB,EAAK,GAAA,KAAA,CAAA;AAAA,MACpC,cAAA,EAAc,YAAY,EAAK,GAAA,KAAA,CAAA;AAAA,MAC/B,eAAe,EAAA,YAAA;AAAA,MAEf,GAAK,EAAA,eAAA;AAAA,KAAA,EAEJ,yBACE,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA;AAAA,MACC,IAAA;AAAA,MACA,MAAA;AAAA,MACA,GAAK,EAAA,MAAA,KAAW,QAAW,GAAA,CAAA,oBAAA,EAAuB,GAAQ,CAAA,CAAA,GAAA,GAAA;AAAA,KAEzD,EAAA,QACH,IAEA,QAEJ,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -7,13 +7,12 @@ import * as _stitches_react_types_css_util from '@stitches/react/types/css-util'
|
|
|
7
7
|
import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';
|
|
8
8
|
import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
|
|
9
9
|
|
|
10
|
-
declare const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, {}> & _mirohq_design_system_stitches.StyledComponentProps<_stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"button">>, {}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
10
|
+
declare const sizes: {
|
|
11
|
+
medium: string;
|
|
12
|
+
large: string;
|
|
13
|
+
xLarge: string;
|
|
14
|
+
};
|
|
15
|
+
declare const StyledBaseButton: react.ForwardRefExoticComponent<Pick<Omit<{}, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.StyledComponentProps<_stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"button">>, {}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
17
16
|
'border-widths': {
|
|
18
17
|
readonly none: 0;
|
|
19
18
|
readonly sm: "1px";
|
|
@@ -188,6 +187,7 @@ declare const StyledBaseButton: react.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
188
187
|
readonly 50: "0 4px 16px #05003812";
|
|
189
188
|
readonly 100: "0 8px 32px #05003808";
|
|
190
189
|
readonly 'focus-small': "0 0 0 2px $colors$blue-200, inset 0 0 0 2px $colors$blue-500, inset 0 0 0 3px $colors$white";
|
|
190
|
+
readonly 'focus-small-outline': "0 0 0 2px $colors$blue-200, inset 0 0 0 1px $colors$blue-500, inset 0 0 0 2px $colors$white";
|
|
191
191
|
readonly 'focus-large': "0 0 0 4px $colors$blue-200, inset 0 0 0 2px $colors$blue-500, inset 0 0 0 3px $colors$white";
|
|
192
192
|
readonly 'focus-controls': "0 0 0 1px $colors$white, 0 0 0 3px $colors$blue-500, 0 0 0 5px $colors$blue-200";
|
|
193
193
|
};
|
|
@@ -426,10 +426,7 @@ declare const StyledBaseButton: react.ForwardRefExoticComponent<Pick<Omit<{
|
|
|
426
426
|
readonly [$$PropertyValue]: "margin";
|
|
427
427
|
};
|
|
428
428
|
};
|
|
429
|
-
}>>> & _mirohq_design_system_stitches.CustomStylesProps, "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "
|
|
430
|
-
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
431
|
-
size?: "medium" | "large" | "x-large" | undefined;
|
|
432
|
-
}, {}>;
|
|
429
|
+
}>>> & _mirohq_design_system_stitches.CustomStylesProps, "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "asChild" | keyof _mirohq_design_system_stitches.CustomStylesProps> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"button">>, {}, {}>;
|
|
433
430
|
declare type StyledBaseButtonProps = ComponentPropsWithRef<typeof StyledBaseButton>;
|
|
434
431
|
|
|
435
432
|
declare type ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>;
|
|
@@ -438,14 +435,6 @@ interface BaseButtonProps extends FocusEvents, HoverEvents, Omit<ButtonPropsA11y
|
|
|
438
435
|
* The content
|
|
439
436
|
*/
|
|
440
437
|
children: ReactNode;
|
|
441
|
-
/**
|
|
442
|
-
* Change the button style
|
|
443
|
-
*/
|
|
444
|
-
variant?: StyledBaseButtonProps['variant'];
|
|
445
|
-
/**
|
|
446
|
-
* Change the button size
|
|
447
|
-
*/
|
|
448
|
-
size?: StyledBaseButtonProps['size'];
|
|
449
438
|
/**
|
|
450
439
|
* Prevent pointer events
|
|
451
440
|
*/
|
|
@@ -467,6 +456,6 @@ interface BaseButtonProps extends FocusEvents, HoverEvents, Omit<ButtonPropsA11y
|
|
|
467
456
|
*/
|
|
468
457
|
onClick?: AriaButtonProps['onPress'];
|
|
469
458
|
}
|
|
470
|
-
declare const BaseButton: react__default.ForwardRefExoticComponent<Pick<BaseButtonProps, "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "
|
|
459
|
+
declare const BaseButton: react__default.ForwardRefExoticComponent<Pick<BaseButtonProps, "form" | "slot" | "title" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "target" | "href" | "rel" | "asChild" | "css" | "UNSAFE_style" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onFocusChange" | "excludeFromTabOrder" | "onHoverStart" | "onHoverEnd" | "onHoverChange"> & react__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
471
460
|
|
|
472
|
-
export { BaseButton, BaseButtonProps };
|
|
461
|
+
export { BaseButton, BaseButtonProps, sizes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-base-button",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2-button.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"@react-types/button": "^3.5.0",
|
|
35
35
|
"@react-types/shared": "^3.16.0",
|
|
36
36
|
"@mirohq/design-system-primitive": "^1.1.0",
|
|
37
|
-
"@mirohq/design-system-stitches": "^2.1.
|
|
37
|
+
"@mirohq/design-system-stitches": "^2.1.2-button.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@mirohq/design-system-icons": "^0.10.
|
|
40
|
+
"@mirohq/design-system-icons": "^0.10.2-button.0"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "rollup -c ../../../../rollup.config.js",
|