@mirohq/design-system-base-button 0.3.0-button.1 → 0.3.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/main.js +102 -21
- package/dist/main.js.map +1 -1
- package/dist/module.js +103 -21
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +24 -9
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -15,11 +15,20 @@ 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
|
-
|
|
18
|
+
const focusFilled = {
|
|
19
|
+
"&[data-focused]": {
|
|
20
|
+
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)`,
|
|
21
|
+
outline: "none"
|
|
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
|
+
}
|
|
22
30
|
};
|
|
31
|
+
const activeSelector = "&:active, &[data-pressed]";
|
|
23
32
|
const StyledBaseButton = designSystemStitches.styled(designSystemPrimitive.Primitive.button, {
|
|
24
33
|
all: "unset",
|
|
25
34
|
display: "inline-flex",
|
|
@@ -30,21 +39,94 @@ const StyledBaseButton = designSystemStitches.styled(designSystemPrimitive.Primi
|
|
|
30
39
|
"&[disabled]": {
|
|
31
40
|
pointerEvents: "none"
|
|
32
41
|
},
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
variants: {
|
|
43
|
+
variant: {
|
|
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
|
+
}
|
|
35
122
|
}
|
|
36
123
|
});
|
|
37
124
|
|
|
38
|
-
function eventHandler(callback, allowEvent) {
|
|
39
|
-
if (allowEvent) {
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
|
-
return callback;
|
|
43
|
-
}
|
|
44
125
|
const BaseButton = React__default["default"].forwardRef(
|
|
45
126
|
({
|
|
127
|
+
variant,
|
|
128
|
+
size,
|
|
46
129
|
disabled = false,
|
|
47
|
-
"aria-disabled": ariaDisabled,
|
|
48
130
|
href,
|
|
49
131
|
target,
|
|
50
132
|
rel,
|
|
@@ -66,14 +148,13 @@ const BaseButton = React__default["default"].forwardRef(
|
|
|
66
148
|
const asLink = href != null;
|
|
67
149
|
const ref = React.useRef(null);
|
|
68
150
|
const refWithFallback = forwardRef != null ? forwardRef : ref;
|
|
69
|
-
const allowPressEvents = ariaDisabled === "true" || ariaDisabled === true;
|
|
70
151
|
const commonProps = {
|
|
71
152
|
isDisabled: disabled,
|
|
72
|
-
onPress:
|
|
73
|
-
onPressStart
|
|
74
|
-
onPressEnd
|
|
75
|
-
onPressChange
|
|
76
|
-
onFocusChange
|
|
153
|
+
onPress: onPress != null ? onPress : onClick,
|
|
154
|
+
onPressStart,
|
|
155
|
+
onPressEnd,
|
|
156
|
+
onPressChange,
|
|
157
|
+
onFocusChange,
|
|
77
158
|
onFocus,
|
|
78
159
|
onBlur
|
|
79
160
|
};
|
|
@@ -107,13 +188,14 @@ const BaseButton = React__default["default"].forwardRef(
|
|
|
107
188
|
);
|
|
108
189
|
return /* @__PURE__ */ React__default["default"].createElement(StyledBaseButton, {
|
|
109
190
|
...elementProps,
|
|
191
|
+
variant,
|
|
192
|
+
size,
|
|
110
193
|
disabled,
|
|
111
194
|
asChild: asLink || asChild,
|
|
112
195
|
...tabIndexProp,
|
|
113
196
|
"data-pressed": isPressed ? "" : void 0,
|
|
114
197
|
"data-focused": isFocusVisible ? "" : void 0,
|
|
115
198
|
"data-hovered": isHovered ? "" : void 0,
|
|
116
|
-
"aria-disabled": ariaDisabled,
|
|
117
199
|
ref: refWithFallback
|
|
118
200
|
}, asLink ? /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
119
201
|
href,
|
|
@@ -124,5 +206,4 @@ const BaseButton = React__default["default"].forwardRef(
|
|
|
124
206
|
);
|
|
125
207
|
|
|
126
208
|
exports.BaseButton = BaseButton;
|
|
127
|
-
exports.sizes = sizes;
|
|
128
209
|
//# 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\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>,\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,UACA,UAC8B,EAAA;AAC9B,EAAA,IAAI,UAAY,EAAA;AACd,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEO,MAAM,aAAaC,yBAAM,CAAA,UAAA;AAAA,EAI9B,CACE;AAAA,IACE,QAAW,GAAA,KAAA;AAAA,IACX,eAAiB,EAAA,YAAA;AAAA,IACjB,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA,aAAA;AAAA,IACG,GAAA,SAAA;AAAA,KAEL,UACG,KAAA;AACH,IAAA,MAAM,SA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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","useButton","useLink","useFocusRing","useHover","mergeProps"],"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,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,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,EAAA;AAAA,UACb,eAAiB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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,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,11 +7,20 @@ 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
|
-
|
|
10
|
+
const focusFilled = {
|
|
11
|
+
"&[data-focused]": {
|
|
12
|
+
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)`,
|
|
13
|
+
outline: "none"
|
|
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
|
+
}
|
|
14
22
|
};
|
|
23
|
+
const activeSelector = "&:active, &[data-pressed]";
|
|
15
24
|
const StyledBaseButton = styled(Primitive.button, {
|
|
16
25
|
all: "unset",
|
|
17
26
|
display: "inline-flex",
|
|
@@ -22,21 +31,94 @@ const StyledBaseButton = styled(Primitive.button, {
|
|
|
22
31
|
"&[disabled]": {
|
|
23
32
|
pointerEvents: "none"
|
|
24
33
|
},
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
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
|
+
}
|
|
27
114
|
}
|
|
28
115
|
});
|
|
29
116
|
|
|
30
|
-
function eventHandler(callback, allowEvent) {
|
|
31
|
-
if (allowEvent) {
|
|
32
|
-
return void 0;
|
|
33
|
-
}
|
|
34
|
-
return callback;
|
|
35
|
-
}
|
|
36
117
|
const BaseButton = React.forwardRef(
|
|
37
118
|
({
|
|
119
|
+
variant,
|
|
120
|
+
size,
|
|
38
121
|
disabled = false,
|
|
39
|
-
"aria-disabled": ariaDisabled,
|
|
40
122
|
href,
|
|
41
123
|
target,
|
|
42
124
|
rel,
|
|
@@ -58,14 +140,13 @@ const BaseButton = React.forwardRef(
|
|
|
58
140
|
const asLink = href != null;
|
|
59
141
|
const ref = useRef(null);
|
|
60
142
|
const refWithFallback = forwardRef != null ? forwardRef : ref;
|
|
61
|
-
const allowPressEvents = ariaDisabled === "true" || ariaDisabled === true;
|
|
62
143
|
const commonProps = {
|
|
63
144
|
isDisabled: disabled,
|
|
64
|
-
onPress:
|
|
65
|
-
onPressStart
|
|
66
|
-
onPressEnd
|
|
67
|
-
onPressChange
|
|
68
|
-
onFocusChange
|
|
145
|
+
onPress: onPress != null ? onPress : onClick,
|
|
146
|
+
onPressStart,
|
|
147
|
+
onPressEnd,
|
|
148
|
+
onPressChange,
|
|
149
|
+
onFocusChange,
|
|
69
150
|
onFocus,
|
|
70
151
|
onBlur
|
|
71
152
|
};
|
|
@@ -99,13 +180,14 @@ const BaseButton = React.forwardRef(
|
|
|
99
180
|
);
|
|
100
181
|
return /* @__PURE__ */ React.createElement(StyledBaseButton, {
|
|
101
182
|
...elementProps,
|
|
183
|
+
variant,
|
|
184
|
+
size,
|
|
102
185
|
disabled,
|
|
103
186
|
asChild: asLink || asChild,
|
|
104
187
|
...tabIndexProp,
|
|
105
188
|
"data-pressed": isPressed ? "" : void 0,
|
|
106
189
|
"data-focused": isFocusVisible ? "" : void 0,
|
|
107
190
|
"data-hovered": isHovered ? "" : void 0,
|
|
108
|
-
"aria-disabled": ariaDisabled,
|
|
109
191
|
ref: refWithFallback
|
|
110
192
|
}, asLink ? /* @__PURE__ */ React.createElement("a", {
|
|
111
193
|
href,
|
|
@@ -115,5 +197,5 @@ const BaseButton = React.forwardRef(
|
|
|
115
197
|
}
|
|
116
198
|
);
|
|
117
199
|
|
|
118
|
-
export { BaseButton
|
|
200
|
+
export { BaseButton };
|
|
119
201
|
//# 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\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>,\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,EAEA,yBAA2B,EAAA;AAAA,IACzB,MAAQ,EAAA,SAAA;AAAA,GACV;AACF,CAAC,CAAA;;ACiCD,SAAS,YAAA,CACP,UACA,UAC8B,EAAA;AAC9B,EAAA,IAAI,UAAY,EAAA;AACd,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAO,OAAA,QAAA,CAAA;AACT,CAAA;AAEO,MAAM,aAAa,KAAM,CAAA,UAAA;AAAA,EAI9B,CACE;AAAA,IACE,QAAW,GAAA,KAAA;AAAA,IACX,eAAiB,EAAA,YAAA;AAAA,IACjB,IAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,aAAA;AAAA,IACA,OAAA;AAAA,IACA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AAA,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\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,EAAA;AAAA,U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AAc,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;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -7,12 +7,13 @@ 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
|
-
large
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
declare const StyledBaseButton: react.ForwardRefExoticComponent<Pick<Omit<{
|
|
11
|
+
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
12
|
+
size?: "medium" | "large" | "x-large" | undefined;
|
|
13
|
+
}, "size" | "variant"> & _stitches_react_types_styled_component.TransformProps<{
|
|
14
|
+
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
15
|
+
size?: "medium" | "large" | "x-large" | undefined;
|
|
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<{}, {
|
|
16
17
|
'border-widths': {
|
|
17
18
|
readonly none: 0;
|
|
18
19
|
readonly sm: "1px";
|
|
@@ -186,6 +187,9 @@ declare const StyledBaseButton: react.ForwardRefExoticComponent<Pick<Omit<{}, ne
|
|
|
186
187
|
shadows: {
|
|
187
188
|
readonly 50: "0 4px 16px #05003812";
|
|
188
189
|
readonly 100: "0 8px 32px #05003808";
|
|
190
|
+
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";
|
|
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
|
+
readonly 'focus-controls': "0 0 0 1px $colors$white, 0 0 0 3px $colors$blue-500, 0 0 0 5px $colors$blue-200";
|
|
189
193
|
};
|
|
190
194
|
sizes: {
|
|
191
195
|
readonly number: string;
|
|
@@ -422,7 +426,10 @@ declare const StyledBaseButton: react.ForwardRefExoticComponent<Pick<Omit<{}, ne
|
|
|
422
426
|
readonly [$$PropertyValue]: "margin";
|
|
423
427
|
};
|
|
424
428
|
};
|
|
425
|
-
}>>> & _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">>, {
|
|
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" | "size" | "asChild" | keyof _mirohq_design_system_stitches.CustomStylesProps | "variant"> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"button">>, {
|
|
430
|
+
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
431
|
+
size?: "medium" | "large" | "x-large" | undefined;
|
|
432
|
+
}, {}>;
|
|
426
433
|
declare type StyledBaseButtonProps = ComponentPropsWithRef<typeof StyledBaseButton>;
|
|
427
434
|
|
|
428
435
|
declare type ButtonPropsA11y = StyledBaseButtonProps & AriaButtonProps<'button'>;
|
|
@@ -431,6 +438,14 @@ interface BaseButtonProps extends FocusEvents, HoverEvents, Omit<ButtonPropsA11y
|
|
|
431
438
|
* The content
|
|
432
439
|
*/
|
|
433
440
|
children: ReactNode;
|
|
441
|
+
/**
|
|
442
|
+
* Change the button style
|
|
443
|
+
*/
|
|
444
|
+
variant?: StyledBaseButtonProps['variant'];
|
|
445
|
+
/**
|
|
446
|
+
* Change the button size
|
|
447
|
+
*/
|
|
448
|
+
size?: StyledBaseButtonProps['size'];
|
|
434
449
|
/**
|
|
435
450
|
* Prevent pointer events
|
|
436
451
|
*/
|
|
@@ -452,6 +467,6 @@ interface BaseButtonProps extends FocusEvents, HoverEvents, Omit<ButtonPropsA11y
|
|
|
452
467
|
*/
|
|
453
468
|
onClick?: AriaButtonProps['onPress'];
|
|
454
469
|
}
|
|
455
|
-
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>>;
|
|
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" | "size" | "target" | "href" | "rel" | "asChild" | "css" | "UNSAFE_style" | "variant" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onFocusChange" | "excludeFromTabOrder" | "onHoverStart" | "onHoverEnd" | "onHoverChange"> & react__default.RefAttributes<HTMLButtonElement>>;
|
|
456
471
|
|
|
457
|
-
export { BaseButton, BaseButtonProps
|
|
472
|
+
export { BaseButton, BaseButtonProps };
|
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.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@stitches/react": "^1.2.8",
|
|
26
|
-
"react": "^16.14 || ^17"
|
|
26
|
+
"react": "^16.14 || ^17 || ^18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@react-aria/button": "^3.5.0",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@react-aria/utils": "^3.13.0",
|
|
34
34
|
"@react-types/button": "^3.5.0",
|
|
35
35
|
"@react-types/shared": "^3.16.0",
|
|
36
|
-
"@mirohq/design-system-primitive": "^1.0
|
|
37
|
-
"@mirohq/design-system-stitches": "^2.
|
|
36
|
+
"@mirohq/design-system-primitive": "^1.1.0",
|
|
37
|
+
"@mirohq/design-system-stitches": "^2.1.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@mirohq/design-system-icons": "^0.
|
|
40
|
+
"@mirohq/design-system-icons": "^0.10.1"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "rollup -c ../../../../rollup.config.js",
|