@mirohq/design-system-icon-button 1.3.20 → 2.0.0-icon-button-without-tooltip.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 +16 -48
- package/dist/main.js.map +1 -1
- package/dist/module.js +17 -49
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +5 -119
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var designSystemTooltip = require('@mirohq/design-system-tooltip');
|
|
8
7
|
var designSystemBadge = require('@mirohq/design-system-badge');
|
|
9
8
|
var designSystemUtils = require('@mirohq/design-system-utils');
|
|
10
9
|
var designSystemBaseIcon = require('@mirohq/design-system-base-icon');
|
|
@@ -134,17 +133,8 @@ const IconButton = React__default["default"].forwardRef(
|
|
|
134
133
|
children,
|
|
135
134
|
showBadge = false,
|
|
136
135
|
badgeContent,
|
|
137
|
-
label,
|
|
138
|
-
tooltipOpen,
|
|
139
|
-
tooltipOnOpen,
|
|
140
|
-
tooltipOnClose,
|
|
141
|
-
tooltipDelayDuration,
|
|
142
|
-
tooltipSkipDelayDuration,
|
|
143
|
-
tooltipAlign = "center",
|
|
144
|
-
tooltipSide = "bottom",
|
|
145
136
|
variant = "ghost",
|
|
146
137
|
size = "large",
|
|
147
|
-
"aria-label": ariaLabel,
|
|
148
138
|
...restProps
|
|
149
139
|
}, forwardRef) => {
|
|
150
140
|
const isIcon = designSystemBaseIcon.isIconComponent(children);
|
|
@@ -161,45 +151,23 @@ const IconButton = React__default["default"].forwardRef(
|
|
|
161
151
|
if (size === "medium") {
|
|
162
152
|
badgeOffset = badgeContent !== void 0 && badgeContent !== "" ? { offsetX: -7, offsetY: -5 } : { offsetX: 3, offsetY: -3 };
|
|
163
153
|
}
|
|
164
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
165
|
-
|
|
154
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
155
|
+
StyledIconButton,
|
|
166
156
|
{
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
182
|
-
designSystemBadge.Badge,
|
|
183
|
-
{
|
|
184
|
-
...badgeOffset,
|
|
185
|
-
show: showBadge,
|
|
186
|
-
content: badgeContent,
|
|
187
|
-
inverted: variant === "solid-prominent",
|
|
188
|
-
children: formattedChildren
|
|
189
|
-
}
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
) }),
|
|
193
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
194
|
-
designSystemTooltip.Tooltip.Content,
|
|
195
|
-
{
|
|
196
|
-
align: tooltipAlign,
|
|
197
|
-
side: tooltipSide,
|
|
198
|
-
hideWhenDetached: true,
|
|
199
|
-
children: label
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
]
|
|
157
|
+
...restProps,
|
|
158
|
+
variant,
|
|
159
|
+
size,
|
|
160
|
+
ref: forwardRef,
|
|
161
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
162
|
+
designSystemBadge.Badge,
|
|
163
|
+
{
|
|
164
|
+
...badgeOffset,
|
|
165
|
+
show: showBadge,
|
|
166
|
+
content: badgeContent,
|
|
167
|
+
inverted: variant === "solid-prominent",
|
|
168
|
+
children: formattedChildren
|
|
169
|
+
}
|
|
170
|
+
)
|
|
203
171
|
}
|
|
204
172
|
);
|
|
205
173
|
}
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/icon-buttons.styled.ts","../src/icon-button.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport { BaseButton, sizes } from '@mirohq/design-system-base-button'\nimport { styles as baseIconStyles } from '@mirohq/design-system-base-icon'\nimport type { ComponentPropsWithRef } from 'react'\nimport { focus } from '@mirohq/design-system-styles'\n\nconst activeSelector = '&:active, &[data-pressed]'\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\nconst externalIconSelector =\n '& svg:not([data-icon-component]), & img:not([data-icon-component])'\n\nexport const StyledIconButton = styled(BaseButton, {\n justifyContent: 'center',\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$icon-primary-inverted',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n [disabledSelector]: {\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\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\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 ...focus.css({\n boxShadow: '$focus-small-outline',\n borderColor: '$blue-500 !important',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n borderColor: '$border-neutrals-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n borderColor: '$border-neutrals-active',\n },\n [disabledSelector]: {\n backgroundColor: '$background-neutrals',\n color: '$icon-neutrals-disabled',\n borderColor: '$border-neutrals-disabled',\n },\n },\n ghost: {\n color: '$icon-neutrals',\n backgroundColor: 'transparent',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\n color: '$icon-neutrals-disabled',\n backgroundColor: '$transparent',\n },\n },\n },\n size: {\n medium: {\n height: sizes.medium,\n width: sizes.medium,\n paddingX: '$50',\n [externalIconSelector]: {\n ...baseIconStyles.size.small,\n ...baseIconStyles.weight.thin,\n },\n },\n large: {\n height: sizes.large,\n width: sizes.large,\n paddingX: '$100',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n 'x-large': {\n height: sizes.xLarge,\n width: sizes.xLarge,\n paddingX: '$150',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n },\n },\n})\n\nexport type StyledIconButtonProps = ComponentPropsWithRef<\n typeof StyledIconButton\n>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport type { TooltipContentProps } from '@mirohq/design-system-tooltip'\nimport { Tooltip } from '@mirohq/design-system-tooltip'\nimport { Badge } from '@mirohq/design-system-badge'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\nimport type { IconReactElement } from '@mirohq/design-system-base-icon'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\n\nimport type { StyledIconButtonProps } from './icon-buttons.styled'\nimport { StyledIconButton } from './icon-buttons.styled'\n\nexport type IconButtonProps = {\n /**\n * Change the Icon button style\n */\n variant?: StyledIconButtonProps['variant']\n\n /**\n * Change the Icon button size\n */\n size?: StyledIconButtonProps['size']\n\n /**\n * Icon button label used to provide a description.\n */\n label: string\n\n /**\n * The duration of a the delay before a tooltip is shown.\n */\n tooltipOpen?: boolean\n\n /**\n * Event handler called when the tooltip opens.\n */\n tooltipOnOpen?: () => void\n\n /**\n * Event handler called when the tooltip closes.\n */\n tooltipOnClose?: () => void\n\n /**\n * The duration of a the delay before a tooltip is shown.\n */\n tooltipDelayDuration?: number\n\n /**\n * \tHow much time a user has to enter another trigger without incurring a\n * \tdelay again.\n */\n tooltipSkipDelayDuration?: number\n\n /**\n * The preferred side of the trigger to render against when open. Will be\n * reversed when collisions occur and avoidCollisions is enabled.\n */\n tooltipSide?: TooltipContentProps['side']\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n */\n tooltipAlign?: TooltipContentProps['align']\n\n /**\n * Wraps the Icon button with a badge.\n */\n showBadge?: boolean\n\n /**\n * The content to be displayed inside of the badge.\n */\n badgeContent?: string\n} & BaseButtonProps\n\nexport const IconButton = React.forwardRef<\n ElementRef<typeof StyledIconButton>,\n IconButtonProps\n>(\n (\n {\n children,\n showBadge = false,\n badgeContent,\n label,\n tooltipOpen,\n tooltipOnOpen,\n tooltipOnClose,\n tooltipDelayDuration,\n tooltipSkipDelayDuration,\n tooltipAlign = 'center',\n tooltipSide = 'bottom',\n variant = 'ghost',\n size = 'large',\n 'aria-label': ariaLabel,\n ...restProps\n },\n forwardRef\n ) => {\n const isIcon = isIconComponent(children as IconReactElement)\n const iconComponentProps = {\n 'data-icon-component': '',\n size: size === 'medium' ? 'small' : 'medium',\n weight: size === 'medium' ? 'thin' : 'normal',\n }\n\n const formattedChildren = addPropsToChildren(children, () => true, {\n 'aria-hidden': 'true',\n ...(isIcon && iconComponentProps),\n })\n\n let badgeOffset = {}\n if (size === 'medium') {\n badgeOffset =\n badgeContent !== undefined && badgeContent !== ''\n ? { offsetX: -7, offsetY: -5 }\n : { offsetX: 3, offsetY: -3 }\n }\n\n return (\n <Tooltip\n open={tooltipOpen}\n onOpen={tooltipOnOpen}\n onClose={tooltipOnClose}\n delayDuration={tooltipDelayDuration}\n skipDelayDuration={tooltipSkipDelayDuration}\n >\n <Tooltip.Trigger asChild>\n <StyledIconButton\n {...restProps}\n variant={variant}\n size={size}\n ref={forwardRef}\n aria-label={ariaLabel ?? label}\n >\n <Badge\n {...badgeOffset}\n show={showBadge}\n content={badgeContent}\n inverted={variant === 'solid-prominent'}\n >\n {formattedChildren}\n </Badge>\n </StyledIconButton>\n </Tooltip.Trigger>\n <Tooltip.Content\n align={tooltipAlign}\n side={tooltipSide}\n hideWhenDetached\n >\n {label}\n </Tooltip.Content>\n </Tooltip>\n )\n }\n)\n"],"names":["styled","BaseButton","focus","sizes","baseIconStyles","React","isIconComponent","addPropsToChildren","jsxs","Tooltip","jsx","Badge"],"mappings":";;;;;;;;;;;;;;;;;;AAMA,MAAM,cAAiB,GAAA,2BAAA,CAAA;AACvB,MAAM,gBAAmB,GAAA,sCAAA,CAAA;AACzB,MAAM,oBACJ,GAAA,oEAAA,CAAA;AAEW,MAAA,gBAAA,GAAmBA,4BAAOC,iCAAY,EAAA;AAAA,EACjD,cAAgB,EAAA,QAAA;AAAA,EAChB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,iBAAmB,EAAA;AAAA,QACjB,eAAiB,EAAA,+BAAA;AAAA,QACjB,KAAO,EAAA,wBAAA;AAAA,QAEP,GAAGC,yBAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAc,GAAG;AAAA,UAChB,eAAiB,EAAA,sCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAgB,GAAG;AAAA,UAClB,eAAiB,EAAA,+BAAA;AAAA,UACjB,KAAO,EAAA,yBAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,cAAgB,EAAA;AAAA,QACd,eAAiB,EAAA,6BAAA;AAAA,QACjB,KAAO,EAAA,gBAAA;AAAA,QAEP,GAAGA,yBAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA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,IAAA;AAAA,cACA,GAAK,EAAA,UAAA;AAAA,cACL,cAAY,SAAa,IAAA,IAAA,GAAA,SAAA,GAAA,KAAA;AAAA,cAEzB,QAAA,kBAAAA,cAAA;AAAA,gBAACC,uBAAA;AAAA,gBAAA;AAAA,kBACE,GAAG,WAAA;AAAA,kBACJ,IAAM,EAAA,SAAA;AAAA,kBACN,OAAS,EAAA,YAAA;AAAA,kBACT,UAAU,OAAY,KAAA,iBAAA;AAAA,kBAErB,QAAA,EAAA,iBAAA;AAAA,iBAAA;AAAA,eACH;AAAA,aAAA;AAAA,WAEJ,EAAA,CAAA;AAAA,0BACAD,cAAA;AAAA,YAACD,2BAAQ,CAAA,OAAA;AAAA,YAAR;AAAA,cACC,KAAO,EAAA,YAAA;AAAA,cACP,IAAM,EAAA,WAAA;AAAA,cACN,gBAAgB,EAAA,IAAA;AAAA,cAEf,QAAA,EAAA,KAAA;AAAA,aAAA;AAAA,WACH;AAAA,SAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/icon-buttons.styled.ts","../src/icon-button.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport { BaseButton, sizes } from '@mirohq/design-system-base-button'\nimport { styles as baseIconStyles } from '@mirohq/design-system-base-icon'\nimport type { ComponentPropsWithRef } from 'react'\nimport { focus } from '@mirohq/design-system-styles'\n\nconst activeSelector = '&:active, &[data-pressed]'\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\nconst externalIconSelector =\n '& svg:not([data-icon-component]), & img:not([data-icon-component])'\n\nexport const StyledIconButton = styled(BaseButton, {\n justifyContent: 'center',\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$icon-primary-inverted',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n [disabledSelector]: {\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\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\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 ...focus.css({\n boxShadow: '$focus-small-outline',\n borderColor: '$blue-500 !important',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n borderColor: '$border-neutrals-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n borderColor: '$border-neutrals-active',\n },\n [disabledSelector]: {\n backgroundColor: '$background-neutrals',\n color: '$icon-neutrals-disabled',\n borderColor: '$border-neutrals-disabled',\n },\n },\n ghost: {\n color: '$icon-neutrals',\n backgroundColor: 'transparent',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\n color: '$icon-neutrals-disabled',\n backgroundColor: '$transparent',\n },\n },\n },\n size: {\n medium: {\n height: sizes.medium,\n width: sizes.medium,\n paddingX: '$50',\n [externalIconSelector]: {\n ...baseIconStyles.size.small,\n ...baseIconStyles.weight.thin,\n },\n },\n large: {\n height: sizes.large,\n width: sizes.large,\n paddingX: '$100',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n 'x-large': {\n height: sizes.xLarge,\n width: sizes.xLarge,\n paddingX: '$150',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n },\n },\n})\n\nexport type StyledIconButtonProps = ComponentPropsWithRef<\n typeof StyledIconButton\n>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Badge } from '@mirohq/design-system-badge'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\nimport type { IconReactElement } from '@mirohq/design-system-base-icon'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\n\nimport type { StyledIconButtonProps } from './icon-buttons.styled'\nimport { StyledIconButton } from './icon-buttons.styled'\n\nexport type IconButtonProps = {\n /**\n * Change the Icon button style\n */\n variant?: StyledIconButtonProps['variant']\n\n /**\n * Change the Icon button size\n */\n size?: StyledIconButtonProps['size']\n\n /**\n * Wraps the Icon button with a badge.\n */\n showBadge?: boolean\n\n /**\n * The content to be displayed inside of the badge.\n */\n badgeContent?: string\n} & BaseButtonProps\n\nexport const IconButton = React.forwardRef<\n ElementRef<typeof StyledIconButton>,\n IconButtonProps\n>(\n (\n {\n children,\n showBadge = false,\n badgeContent,\n variant = 'ghost',\n size = 'large',\n ...restProps\n },\n forwardRef\n ) => {\n const isIcon = isIconComponent(children as IconReactElement)\n const iconComponentProps = {\n 'data-icon-component': '',\n size: size === 'medium' ? 'small' : 'medium',\n weight: size === 'medium' ? 'thin' : 'normal',\n }\n\n const formattedChildren = addPropsToChildren(children, () => true, {\n 'aria-hidden': 'true',\n ...(isIcon && iconComponentProps),\n })\n\n let badgeOffset = {}\n if (size === 'medium') {\n badgeOffset =\n badgeContent !== undefined && badgeContent !== ''\n ? { offsetX: -7, offsetY: -5 }\n : { offsetX: 3, offsetY: -3 }\n }\n\n return (\n <StyledIconButton\n {...restProps}\n variant={variant}\n size={size}\n ref={forwardRef}\n >\n <Badge\n {...badgeOffset}\n show={showBadge}\n content={badgeContent}\n inverted={variant === 'solid-prominent'}\n >\n {formattedChildren}\n </Badge>\n </StyledIconButton>\n )\n }\n)\n"],"names":["styled","BaseButton","focus","sizes","baseIconStyles","React","isIconComponent","addPropsToChildren","jsx","Badge"],"mappings":";;;;;;;;;;;;;;;;;AAMA,MAAM,cAAiB,GAAA,2BAAA,CAAA;AACvB,MAAM,gBAAmB,GAAA,sCAAA,CAAA;AACzB,MAAM,oBACJ,GAAA,oEAAA,CAAA;AAEW,MAAA,gBAAA,GAAmBA,4BAAOC,iCAAY,EAAA;AAAA,EACjD,cAAgB,EAAA,QAAA;AAAA,EAChB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,iBAAmB,EAAA;AAAA,QACjB,eAAiB,EAAA,+BAAA;AAAA,QACjB,KAAO,EAAA,wBAAA;AAAA,QAEP,GAAGC,yBAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAc,GAAG;AAAA,UAChB,eAAiB,EAAA,sCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAgB,GAAG;AAAA,UAClB,eAAiB,EAAA,+BAAA;AAAA,UACjB,KAAO,EAAA,yBAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,cAAgB,EAAA;AAAA,QACd,eAAiB,EAAA,6BAAA;AAAA,QACjB,KAAO,EAAA,gBAAA;AAAA,QAEP,GAAGA,yBAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,mCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAc,GAAG;AAAA,UAChB,eAAiB,EAAA,oCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAgB,GAAG;AAAA,UAClB,eAAiB,EAAA,+BAAA;AAAA,UACjB,KAAO,EAAA,yBAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,OAAS,EAA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,EAAA,MAAA;AAAA,MACf,GAAI,MAAU,IAAA,kBAAA;AAAA,KACf,CAAA,CAAA;AAED,IAAA,IAAI,cAAc,EAAC,CAAA;AACnB,IAAA,IAAI,SAAS,QAAU,EAAA;AACrB,MAAA,WAAA,GACE,YAAiB,KAAA,KAAA,CAAA,IAAa,YAAiB,KAAA,EAAA,GAC3C,EAAE,OAAS,EAAA,CAAA,CAAA,EAAI,OAAS,EAAA,CAAA,CAAA,EACxB,GAAA,EAAE,OAAS,EAAA,CAAA,EAAG,SAAS,CAAG,CAAA,EAAA,CAAA;AAAA,KAClC;AAEA,IACE,uBAAAC,cAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACE,GAAG,SAAA;AAAA,QACJ,OAAA;AAAA,QACA,IAAA;AAAA,QACA,GAAK,EAAA,UAAA;AAAA,QAEL,QAAA,kBAAAA,cAAA;AAAA,UAACC,uBAAA;AAAA,UAAA;AAAA,YACE,GAAG,WAAA;AAAA,YACJ,IAAM,EAAA,SAAA;AAAA,YACN,OAAS,EAAA,YAAA;AAAA,YACT,UAAU,OAAY,KAAA,iBAAA;AAAA,YAErB,QAAA,EAAA,iBAAA;AAAA,WAAA;AAAA,SACH;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEJ;AACF;;;;"}
|
package/dist/module.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Tooltip } from '@mirohq/design-system-tooltip';
|
|
4
3
|
import { Badge } from '@mirohq/design-system-badge';
|
|
5
4
|
import { addPropsToChildren } from '@mirohq/design-system-utils';
|
|
6
5
|
import { styles, isIconComponent } from '@mirohq/design-system-base-icon';
|
|
@@ -126,17 +125,8 @@ const IconButton = React.forwardRef(
|
|
|
126
125
|
children,
|
|
127
126
|
showBadge = false,
|
|
128
127
|
badgeContent,
|
|
129
|
-
label,
|
|
130
|
-
tooltipOpen,
|
|
131
|
-
tooltipOnOpen,
|
|
132
|
-
tooltipOnClose,
|
|
133
|
-
tooltipDelayDuration,
|
|
134
|
-
tooltipSkipDelayDuration,
|
|
135
|
-
tooltipAlign = "center",
|
|
136
|
-
tooltipSide = "bottom",
|
|
137
128
|
variant = "ghost",
|
|
138
129
|
size = "large",
|
|
139
|
-
"aria-label": ariaLabel,
|
|
140
130
|
...restProps
|
|
141
131
|
}, forwardRef) => {
|
|
142
132
|
const isIcon = isIconComponent(children);
|
|
@@ -153,45 +143,23 @@ const IconButton = React.forwardRef(
|
|
|
153
143
|
if (size === "medium") {
|
|
154
144
|
badgeOffset = badgeContent !== void 0 && badgeContent !== "" ? { offsetX: -7, offsetY: -5 } : { offsetX: 3, offsetY: -3 };
|
|
155
145
|
}
|
|
156
|
-
return /* @__PURE__ */
|
|
157
|
-
|
|
146
|
+
return /* @__PURE__ */ jsx(
|
|
147
|
+
StyledIconButton,
|
|
158
148
|
{
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
children: /* @__PURE__ */ jsx(
|
|
174
|
-
Badge,
|
|
175
|
-
{
|
|
176
|
-
...badgeOffset,
|
|
177
|
-
show: showBadge,
|
|
178
|
-
content: badgeContent,
|
|
179
|
-
inverted: variant === "solid-prominent",
|
|
180
|
-
children: formattedChildren
|
|
181
|
-
}
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
|
-
) }),
|
|
185
|
-
/* @__PURE__ */ jsx(
|
|
186
|
-
Tooltip.Content,
|
|
187
|
-
{
|
|
188
|
-
align: tooltipAlign,
|
|
189
|
-
side: tooltipSide,
|
|
190
|
-
hideWhenDetached: true,
|
|
191
|
-
children: label
|
|
192
|
-
}
|
|
193
|
-
)
|
|
194
|
-
]
|
|
149
|
+
...restProps,
|
|
150
|
+
variant,
|
|
151
|
+
size,
|
|
152
|
+
ref: forwardRef,
|
|
153
|
+
children: /* @__PURE__ */ jsx(
|
|
154
|
+
Badge,
|
|
155
|
+
{
|
|
156
|
+
...badgeOffset,
|
|
157
|
+
show: showBadge,
|
|
158
|
+
content: badgeContent,
|
|
159
|
+
inverted: variant === "solid-prominent",
|
|
160
|
+
children: formattedChildren
|
|
161
|
+
}
|
|
162
|
+
)
|
|
195
163
|
}
|
|
196
164
|
);
|
|
197
165
|
}
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/icon-buttons.styled.ts","../src/icon-button.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport { BaseButton, sizes } from '@mirohq/design-system-base-button'\nimport { styles as baseIconStyles } from '@mirohq/design-system-base-icon'\nimport type { ComponentPropsWithRef } from 'react'\nimport { focus } from '@mirohq/design-system-styles'\n\nconst activeSelector = '&:active, &[data-pressed]'\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\nconst externalIconSelector =\n '& svg:not([data-icon-component]), & img:not([data-icon-component])'\n\nexport const StyledIconButton = styled(BaseButton, {\n justifyContent: 'center',\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$icon-primary-inverted',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n [disabledSelector]: {\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\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\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 ...focus.css({\n boxShadow: '$focus-small-outline',\n borderColor: '$blue-500 !important',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n borderColor: '$border-neutrals-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n borderColor: '$border-neutrals-active',\n },\n [disabledSelector]: {\n backgroundColor: '$background-neutrals',\n color: '$icon-neutrals-disabled',\n borderColor: '$border-neutrals-disabled',\n },\n },\n ghost: {\n color: '$icon-neutrals',\n backgroundColor: 'transparent',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\n color: '$icon-neutrals-disabled',\n backgroundColor: '$transparent',\n },\n },\n },\n size: {\n medium: {\n height: sizes.medium,\n width: sizes.medium,\n paddingX: '$50',\n [externalIconSelector]: {\n ...baseIconStyles.size.small,\n ...baseIconStyles.weight.thin,\n },\n },\n large: {\n height: sizes.large,\n width: sizes.large,\n paddingX: '$100',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n 'x-large': {\n height: sizes.xLarge,\n width: sizes.xLarge,\n paddingX: '$150',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n },\n },\n})\n\nexport type StyledIconButtonProps = ComponentPropsWithRef<\n typeof StyledIconButton\n>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport type { TooltipContentProps } from '@mirohq/design-system-tooltip'\nimport { Tooltip } from '@mirohq/design-system-tooltip'\nimport { Badge } from '@mirohq/design-system-badge'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\nimport type { IconReactElement } from '@mirohq/design-system-base-icon'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\n\nimport type { StyledIconButtonProps } from './icon-buttons.styled'\nimport { StyledIconButton } from './icon-buttons.styled'\n\nexport type IconButtonProps = {\n /**\n * Change the Icon button style\n */\n variant?: StyledIconButtonProps['variant']\n\n /**\n * Change the Icon button size\n */\n size?: StyledIconButtonProps['size']\n\n /**\n * Icon button label used to provide a description.\n */\n label: string\n\n /**\n * The duration of a the delay before a tooltip is shown.\n */\n tooltipOpen?: boolean\n\n /**\n * Event handler called when the tooltip opens.\n */\n tooltipOnOpen?: () => void\n\n /**\n * Event handler called when the tooltip closes.\n */\n tooltipOnClose?: () => void\n\n /**\n * The duration of a the delay before a tooltip is shown.\n */\n tooltipDelayDuration?: number\n\n /**\n * \tHow much time a user has to enter another trigger without incurring a\n * \tdelay again.\n */\n tooltipSkipDelayDuration?: number\n\n /**\n * The preferred side of the trigger to render against when open. Will be\n * reversed when collisions occur and avoidCollisions is enabled.\n */\n tooltipSide?: TooltipContentProps['side']\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n */\n tooltipAlign?: TooltipContentProps['align']\n\n /**\n * Wraps the Icon button with a badge.\n */\n showBadge?: boolean\n\n /**\n * The content to be displayed inside of the badge.\n */\n badgeContent?: string\n} & BaseButtonProps\n\nexport const IconButton = React.forwardRef<\n ElementRef<typeof StyledIconButton>,\n IconButtonProps\n>(\n (\n {\n children,\n showBadge = false,\n badgeContent,\n label,\n tooltipOpen,\n tooltipOnOpen,\n tooltipOnClose,\n tooltipDelayDuration,\n tooltipSkipDelayDuration,\n tooltipAlign = 'center',\n tooltipSide = 'bottom',\n variant = 'ghost',\n size = 'large',\n 'aria-label': ariaLabel,\n ...restProps\n },\n forwardRef\n ) => {\n const isIcon = isIconComponent(children as IconReactElement)\n const iconComponentProps = {\n 'data-icon-component': '',\n size: size === 'medium' ? 'small' : 'medium',\n weight: size === 'medium' ? 'thin' : 'normal',\n }\n\n const formattedChildren = addPropsToChildren(children, () => true, {\n 'aria-hidden': 'true',\n ...(isIcon && iconComponentProps),\n })\n\n let badgeOffset = {}\n if (size === 'medium') {\n badgeOffset =\n badgeContent !== undefined && badgeContent !== ''\n ? { offsetX: -7, offsetY: -5 }\n : { offsetX: 3, offsetY: -3 }\n }\n\n return (\n <Tooltip\n open={tooltipOpen}\n onOpen={tooltipOnOpen}\n onClose={tooltipOnClose}\n delayDuration={tooltipDelayDuration}\n skipDelayDuration={tooltipSkipDelayDuration}\n >\n <Tooltip.Trigger asChild>\n <StyledIconButton\n {...restProps}\n variant={variant}\n size={size}\n ref={forwardRef}\n aria-label={ariaLabel ?? label}\n >\n <Badge\n {...badgeOffset}\n show={showBadge}\n content={badgeContent}\n inverted={variant === 'solid-prominent'}\n >\n {formattedChildren}\n </Badge>\n </StyledIconButton>\n </Tooltip.Trigger>\n <Tooltip.Content\n align={tooltipAlign}\n side={tooltipSide}\n hideWhenDetached\n >\n {label}\n </Tooltip.Content>\n </Tooltip>\n )\n }\n)\n"],"names":["baseIconStyles"],"mappings":";;;;;;;;;;AAMA,MAAM,cAAiB,GAAA,2BAAA,CAAA;AACvB,MAAM,gBAAmB,GAAA,sCAAA,CAAA;AACzB,MAAM,oBACJ,GAAA,oEAAA,CAAA;AAEW,MAAA,gBAAA,GAAmB,OAAO,UAAY,EAAA;AAAA,EACjD,cAAgB,EAAA,QAAA;AAAA,EAChB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,iBAAmB,EAAA;AAAA,QACjB,eAAiB,EAAA,+BAAA;AAAA,QACjB,KAAO,EAAA,wBAAA;AAAA,QAEP,GAAG,MAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAc,GAAG;AAAA,UAChB,eAA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AAA;AAAA,QACR,OAAS,EAAA,cAAA;AAAA,QACT,aAAe,EAAA,oBAAA;AAAA,QACf,iBAAmB,EAAA,wBAAA;AAAA,QAEnB,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,OAAQ,CAAA,OAAA,EAAR,EAAgB,OAAA,EAAO,IACtB,EAAA,QAAA,kBAAA,GAAA;AAAA,YAAC,gBAAA;AAAA,YAAA;AAAA,cACE,GAAG,SAAA;AAAA,cACJ,OAAA;AAAA,cACA,IAAA;AAAA,cACA,GAAK,EAAA,UAAA;AAAA,cACL,cAAY,SAAa,IAAA,IAAA,GAAA,SAAA,GAAA,KAAA;AAAA,cAEzB,QAAA,kBAAA,GAAA;AAAA,gBAAC,KAAA;AAAA,gBAAA;AAAA,kBACE,GAAG,WAAA;AAAA,kBACJ,IAAM,EAAA,SAAA;AAAA,kBACN,OAAS,EAAA,YAAA;AAAA,kBACT,UAAU,OAAY,KAAA,iBAAA;AAAA,kBAErB,QAAA,EAAA,iBAAA;AAAA,iBAAA;AAAA,eACH;AAAA,aAAA;AAAA,WAEJ,EAAA,CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,OAAQ,CAAA,OAAA;AAAA,YAAR;AAAA,cACC,KAAO,EAAA,YAAA;AAAA,cACP,IAAM,EAAA,WAAA;AAAA,cACN,gBAAgB,EAAA,IAAA;AAAA,cAEf,QAAA,EAAA,KAAA;AAAA,aAAA;AAAA,WACH;AAAA,SAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/icon-buttons.styled.ts","../src/icon-button.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport { BaseButton, sizes } from '@mirohq/design-system-base-button'\nimport { styles as baseIconStyles } from '@mirohq/design-system-base-icon'\nimport type { ComponentPropsWithRef } from 'react'\nimport { focus } from '@mirohq/design-system-styles'\n\nconst activeSelector = '&:active, &[data-pressed]'\nconst disabledSelector = '&[disabled], &[aria-disabled=\"true\"]'\nconst externalIconSelector =\n '& svg:not([data-icon-component]), & img:not([data-icon-component])'\n\nexport const StyledIconButton = styled(BaseButton, {\n justifyContent: 'center',\n variants: {\n variant: {\n 'solid-prominent': {\n backgroundColor: '$background-primary-prominent',\n color: '$icon-primary-inverted',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-primary-prominent-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-primary-prominent-active',\n },\n [disabledSelector]: {\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\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\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 ...focus.css({\n boxShadow: '$focus-small-outline',\n borderColor: '$blue-500 !important',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n borderColor: '$border-neutrals-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n borderColor: '$border-neutrals-active',\n },\n [disabledSelector]: {\n backgroundColor: '$background-neutrals',\n color: '$icon-neutrals-disabled',\n borderColor: '$border-neutrals-disabled',\n },\n },\n ghost: {\n color: '$icon-neutrals',\n backgroundColor: 'transparent',\n\n ...focus.css({\n boxShadow: '$focus-small',\n }),\n\n '&:hover': {\n backgroundColor: '$background-neutrals-subtle-hover',\n },\n [activeSelector]: {\n backgroundColor: '$background-neutrals-subtle-active',\n },\n [disabledSelector]: {\n color: '$icon-neutrals-disabled',\n backgroundColor: '$transparent',\n },\n },\n },\n size: {\n medium: {\n height: sizes.medium,\n width: sizes.medium,\n paddingX: '$50',\n [externalIconSelector]: {\n ...baseIconStyles.size.small,\n ...baseIconStyles.weight.thin,\n },\n },\n large: {\n height: sizes.large,\n width: sizes.large,\n paddingX: '$100',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n 'x-large': {\n height: sizes.xLarge,\n width: sizes.xLarge,\n paddingX: '$150',\n [externalIconSelector]: {\n ...baseIconStyles.size.medium,\n ...baseIconStyles.weight.normal,\n },\n },\n },\n },\n})\n\nexport type StyledIconButtonProps = ComponentPropsWithRef<\n typeof StyledIconButton\n>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Badge } from '@mirohq/design-system-badge'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\nimport type { IconReactElement } from '@mirohq/design-system-base-icon'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\n\nimport type { StyledIconButtonProps } from './icon-buttons.styled'\nimport { StyledIconButton } from './icon-buttons.styled'\n\nexport type IconButtonProps = {\n /**\n * Change the Icon button style\n */\n variant?: StyledIconButtonProps['variant']\n\n /**\n * Change the Icon button size\n */\n size?: StyledIconButtonProps['size']\n\n /**\n * Wraps the Icon button with a badge.\n */\n showBadge?: boolean\n\n /**\n * The content to be displayed inside of the badge.\n */\n badgeContent?: string\n} & BaseButtonProps\n\nexport const IconButton = React.forwardRef<\n ElementRef<typeof StyledIconButton>,\n IconButtonProps\n>(\n (\n {\n children,\n showBadge = false,\n badgeContent,\n variant = 'ghost',\n size = 'large',\n ...restProps\n },\n forwardRef\n ) => {\n const isIcon = isIconComponent(children as IconReactElement)\n const iconComponentProps = {\n 'data-icon-component': '',\n size: size === 'medium' ? 'small' : 'medium',\n weight: size === 'medium' ? 'thin' : 'normal',\n }\n\n const formattedChildren = addPropsToChildren(children, () => true, {\n 'aria-hidden': 'true',\n ...(isIcon && iconComponentProps),\n })\n\n let badgeOffset = {}\n if (size === 'medium') {\n badgeOffset =\n badgeContent !== undefined && badgeContent !== ''\n ? { offsetX: -7, offsetY: -5 }\n : { offsetX: 3, offsetY: -3 }\n }\n\n return (\n <StyledIconButton\n {...restProps}\n variant={variant}\n size={size}\n ref={forwardRef}\n >\n <Badge\n {...badgeOffset}\n show={showBadge}\n content={badgeContent}\n inverted={variant === 'solid-prominent'}\n >\n {formattedChildren}\n </Badge>\n </StyledIconButton>\n )\n }\n)\n"],"names":["baseIconStyles"],"mappings":";;;;;;;;;AAMA,MAAM,cAAiB,GAAA,2BAAA,CAAA;AACvB,MAAM,gBAAmB,GAAA,sCAAA,CAAA;AACzB,MAAM,oBACJ,GAAA,oEAAA,CAAA;AAEW,MAAA,gBAAA,GAAmB,OAAO,UAAY,EAAA;AAAA,EACjD,cAAgB,EAAA,QAAA;AAAA,EAChB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,iBAAmB,EAAA;AAAA,QACjB,eAAiB,EAAA,+BAAA;AAAA,QACjB,KAAO,EAAA,wBAAA;AAAA,QAEP,GAAG,MAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAc,GAAG;AAAA,UAChB,eAAiB,EAAA,sCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAgB,GAAG;AAAA,UAClB,eAAiB,EAAA,+BAAA;AAAA,UACjB,KAAO,EAAA,yBAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,cAAgB,EAAA;AAAA,QACd,eAAiB,EAAA,6BAAA;AAAA,QACjB,KAAO,EAAA,gBAAA;AAAA,QAEP,GAAG,MAAM,GAAI,CAAA;AAAA,UACX,SAAW,EAAA,cAAA;AAAA,SACZ,CAAA;AAAA,QAED,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,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GAAW,OAAU,GAAA,QAAA;AAAA,MACpC,MAAA,EAAQ,IAAS,KAAA,QAAA,GAAW,MAAS,GAAA,QAAA;AAAA,KACvC,CAAA;AAEA,IAAA,MAAM,iBAAoB,GAAA,kBAAA,CAAmB,QAAU,EAAA,MAAM,IAAM,EAAA;AAAA,MACjE,aAAe,EAAA,MAAA;AAAA,MACf,GAAI,MAAU,IAAA,kBAAA;AAAA,KACf,CAAA,CAAA;AAED,IAAA,IAAI,cAAc,EAAC,CAAA;AACnB,IAAA,IAAI,SAAS,QAAU,EAAA;AACrB,MAAA,WAAA,GACE,YAAiB,KAAA,KAAA,CAAA,IAAa,YAAiB,KAAA,EAAA,GAC3C,EAAE,OAAS,EAAA,CAAA,CAAA,EAAI,OAAS,EAAA,CAAA,CAAA,EACxB,GAAA,EAAE,OAAS,EAAA,CAAA,EAAG,SAAS,CAAG,CAAA,EAAA,CAAA;AAAA,KAClC;AAEA,IACE,uBAAA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACE,GAAG,SAAA;AAAA,QACJ,OAAA;AAAA,QACA,IAAA;AAAA,QACA,GAAK,EAAA,UAAA;AAAA,QAEL,QAAA,kBAAA,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACE,GAAG,WAAA;AAAA,YACJ,IAAM,EAAA,SAAA;AAAA,YACN,OAAS,EAAA,YAAA;AAAA,YACT,UAAU,OAAY,KAAA,iBAAA;AAAA,YAErB,QAAA,EAAA,iBAAA;AAAA,WAAA;AAAA,SACH;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GAEJ;AACF;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import * as _stitches_react_types_css_util from '@stitches/react/types/css-util'
|
|
|
5
5
|
import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
|
|
6
6
|
import * as react from 'react';
|
|
7
7
|
import react__default, { ComponentPropsWithRef } from 'react';
|
|
8
|
-
import { TooltipContentProps } from '@mirohq/design-system-tooltip';
|
|
9
8
|
import { BaseButtonProps } from '@mirohq/design-system-base-button';
|
|
10
9
|
|
|
11
10
|
declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
@@ -350,7 +349,6 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
350
349
|
readonly borderRightColor: "colors";
|
|
351
350
|
readonly borderRightStyle: "border-styles";
|
|
352
351
|
readonly borderRightWidth: "border-widths";
|
|
353
|
-
readonly borderSpacing: "space-offset";
|
|
354
352
|
readonly borderStyle: "border-styles";
|
|
355
353
|
readonly borderTop: "colors";
|
|
356
354
|
readonly borderTopColor: "colors";
|
|
@@ -506,7 +504,7 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
506
504
|
}> | undefined;
|
|
507
505
|
}> & {
|
|
508
506
|
children?: react.ReactNode;
|
|
509
|
-
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement> & _mirohq_design_system_hooks_use_press.PressProps & packages_components_internal_base_button_src_base_button.HoverEvents, "ref"> & react.RefAttributes<
|
|
507
|
+
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement> & _mirohq_design_system_hooks_use_press.PressProps & packages_components_internal_base_button_src_base_button.HoverEvents, "ref"> & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>, "css"> & _stitches_react_types_styled_component.TransformProps<{}, {}> & {
|
|
510
508
|
css?: _stitches_react_types_css_util.CSS<{}, {
|
|
511
509
|
'border-widths': {
|
|
512
510
|
readonly none: 0;
|
|
@@ -838,7 +836,6 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
838
836
|
readonly borderRightColor: "colors";
|
|
839
837
|
readonly borderRightStyle: "border-styles";
|
|
840
838
|
readonly borderRightWidth: "border-widths";
|
|
841
|
-
readonly borderSpacing: "space-offset";
|
|
842
839
|
readonly borderStyle: "border-styles";
|
|
843
840
|
readonly borderTop: "colors";
|
|
844
841
|
readonly borderTopColor: "colors";
|
|
@@ -1328,7 +1325,6 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
1328
1325
|
readonly borderRightColor: "colors";
|
|
1329
1326
|
readonly borderRightStyle: "border-styles";
|
|
1330
1327
|
readonly borderRightWidth: "border-widths";
|
|
1331
|
-
readonly borderSpacing: "space-offset";
|
|
1332
1328
|
readonly borderStyle: "border-styles";
|
|
1333
1329
|
readonly borderTop: "colors";
|
|
1334
1330
|
readonly borderTopColor: "colors";
|
|
@@ -1486,7 +1482,7 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
1486
1482
|
children?: react.ReactNode;
|
|
1487
1483
|
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement> & _mirohq_design_system_hooks_use_press.PressProps & packages_components_internal_base_button_src_base_button.HoverEvents & react.AnchorHTMLAttributes<"a"> & {
|
|
1488
1484
|
href: string;
|
|
1489
|
-
}, "ref"> & react.RefAttributes<
|
|
1485
|
+
}, "ref"> & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>, "css"> & _stitches_react_types_styled_component.TransformProps<{}, {}> & {
|
|
1490
1486
|
css?: _stitches_react_types_css_util.CSS<{}, {
|
|
1491
1487
|
'border-widths': {
|
|
1492
1488
|
readonly none: 0;
|
|
@@ -1818,7 +1814,6 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
1818
1814
|
readonly borderRightColor: "colors";
|
|
1819
1815
|
readonly borderRightStyle: "border-styles";
|
|
1820
1816
|
readonly borderRightWidth: "border-widths";
|
|
1821
|
-
readonly borderSpacing: "space-offset";
|
|
1822
1817
|
readonly borderStyle: "border-styles";
|
|
1823
1818
|
readonly borderTop: "colors";
|
|
1824
1819
|
readonly borderTopColor: "colors";
|
|
@@ -1974,7 +1969,7 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
1974
1969
|
}> | undefined;
|
|
1975
1970
|
})> & {
|
|
1976
1971
|
children?: react.ReactNode;
|
|
1977
|
-
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<
|
|
1972
|
+
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<(Omit<Omit<Omit<{}, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.SafeProps<Omit<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
1978
1973
|
ref?: ((instance: HTMLButtonElement | null) => void) | react.RefObject<HTMLButtonElement> | null | undefined;
|
|
1979
1974
|
} & {
|
|
1980
1975
|
asChild?: boolean | undefined;
|
|
@@ -2310,7 +2305,6 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
2310
2305
|
readonly borderRightColor: "colors";
|
|
2311
2306
|
readonly borderRightStyle: "border-styles";
|
|
2312
2307
|
readonly borderRightWidth: "border-widths";
|
|
2313
|
-
readonly borderSpacing: "space-offset";
|
|
2314
2308
|
readonly borderStyle: "border-styles";
|
|
2315
2309
|
readonly borderTop: "colors";
|
|
2316
2310
|
readonly borderTopColor: "colors";
|
|
@@ -2802,7 +2796,6 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
2802
2796
|
readonly borderRightColor: "colors";
|
|
2803
2797
|
readonly borderRightStyle: "border-styles";
|
|
2804
2798
|
readonly borderRightWidth: "border-widths";
|
|
2805
|
-
readonly borderSpacing: "space-offset";
|
|
2806
2799
|
readonly borderStyle: "border-styles";
|
|
2807
2800
|
readonly borderTop: "colors";
|
|
2808
2801
|
readonly borderTopColor: "colors";
|
|
@@ -2960,7 +2953,7 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
2960
2953
|
children?: react.ReactNode;
|
|
2961
2954
|
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement> & _mirohq_design_system_hooks_use_press.PressProps & packages_components_internal_base_button_src_base_button.HoverEvents & react.AnchorHTMLAttributes<"a"> & {
|
|
2962
2955
|
href: string;
|
|
2963
|
-
}, "ref">) & react.RefAttributes<
|
|
2956
|
+
}, "ref">) & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>, {
|
|
2964
2957
|
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
2965
2958
|
size?: "medium" | "large" | "x-large" | undefined;
|
|
2966
2959
|
}, {}>;
|
|
@@ -2975,41 +2968,6 @@ declare type IconButtonProps = {
|
|
|
2975
2968
|
* Change the Icon button size
|
|
2976
2969
|
*/
|
|
2977
2970
|
size?: StyledIconButtonProps['size'];
|
|
2978
|
-
/**
|
|
2979
|
-
* Icon button label used to provide a description.
|
|
2980
|
-
*/
|
|
2981
|
-
label: string;
|
|
2982
|
-
/**
|
|
2983
|
-
* The duration of a the delay before a tooltip is shown.
|
|
2984
|
-
*/
|
|
2985
|
-
tooltipOpen?: boolean;
|
|
2986
|
-
/**
|
|
2987
|
-
* Event handler called when the tooltip opens.
|
|
2988
|
-
*/
|
|
2989
|
-
tooltipOnOpen?: () => void;
|
|
2990
|
-
/**
|
|
2991
|
-
* Event handler called when the tooltip closes.
|
|
2992
|
-
*/
|
|
2993
|
-
tooltipOnClose?: () => void;
|
|
2994
|
-
/**
|
|
2995
|
-
* The duration of a the delay before a tooltip is shown.
|
|
2996
|
-
*/
|
|
2997
|
-
tooltipDelayDuration?: number;
|
|
2998
|
-
/**
|
|
2999
|
-
* How much time a user has to enter another trigger without incurring a
|
|
3000
|
-
* delay again.
|
|
3001
|
-
*/
|
|
3002
|
-
tooltipSkipDelayDuration?: number;
|
|
3003
|
-
/**
|
|
3004
|
-
* The preferred side of the trigger to render against when open. Will be
|
|
3005
|
-
* reversed when collisions occur and avoidCollisions is enabled.
|
|
3006
|
-
*/
|
|
3007
|
-
tooltipSide?: TooltipContentProps['side'];
|
|
3008
|
-
/**
|
|
3009
|
-
* The preferred alignment against the trigger. May change when collisions
|
|
3010
|
-
* occur.
|
|
3011
|
-
*/
|
|
3012
|
-
tooltipAlign?: TooltipContentProps['align'];
|
|
3013
2971
|
/**
|
|
3014
2972
|
* Wraps the Icon button with a badge.
|
|
3015
2973
|
*/
|
|
@@ -3028,41 +2986,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3028
2986
|
* Change the Icon button size
|
|
3029
2987
|
*/
|
|
3030
2988
|
size?: StyledIconButtonProps['size'];
|
|
3031
|
-
/**
|
|
3032
|
-
* Icon button label used to provide a description.
|
|
3033
|
-
*/
|
|
3034
|
-
label: string;
|
|
3035
|
-
/**
|
|
3036
|
-
* The duration of a the delay before a tooltip is shown.
|
|
3037
|
-
*/
|
|
3038
|
-
tooltipOpen?: boolean | undefined;
|
|
3039
|
-
/**
|
|
3040
|
-
* Event handler called when the tooltip opens.
|
|
3041
|
-
*/
|
|
3042
|
-
tooltipOnOpen?: (() => void) | undefined;
|
|
3043
|
-
/**
|
|
3044
|
-
* Event handler called when the tooltip closes.
|
|
3045
|
-
*/
|
|
3046
|
-
tooltipOnClose?: (() => void) | undefined;
|
|
3047
|
-
/**
|
|
3048
|
-
* The duration of a the delay before a tooltip is shown.
|
|
3049
|
-
*/
|
|
3050
|
-
tooltipDelayDuration?: number | undefined;
|
|
3051
|
-
/**
|
|
3052
|
-
* How much time a user has to enter another trigger without incurring a
|
|
3053
|
-
* delay again.
|
|
3054
|
-
*/
|
|
3055
|
-
tooltipSkipDelayDuration?: number | undefined;
|
|
3056
|
-
/**
|
|
3057
|
-
* The preferred side of the trigger to render against when open. Will be
|
|
3058
|
-
* reversed when collisions occur and avoidCollisions is enabled.
|
|
3059
|
-
*/
|
|
3060
|
-
tooltipSide?: TooltipContentProps['side'];
|
|
3061
|
-
/**
|
|
3062
|
-
* The preferred alignment against the trigger. May change when collisions
|
|
3063
|
-
* occur.
|
|
3064
|
-
*/
|
|
3065
|
-
tooltipAlign?: TooltipContentProps['align'];
|
|
3066
2989
|
/**
|
|
3067
2990
|
* Wraps the Icon button with a badge.
|
|
3068
2991
|
*/
|
|
@@ -3407,7 +3330,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3407
3330
|
readonly borderRightColor: "colors";
|
|
3408
3331
|
readonly borderRightStyle: "border-styles";
|
|
3409
3332
|
readonly borderRightWidth: "border-widths";
|
|
3410
|
-
readonly borderSpacing: "space-offset";
|
|
3411
3333
|
readonly borderStyle: "border-styles";
|
|
3412
3334
|
readonly borderTop: "colors";
|
|
3413
3335
|
readonly borderTopColor: "colors";
|
|
@@ -3572,41 +3494,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3572
3494
|
* Change the Icon button size
|
|
3573
3495
|
*/
|
|
3574
3496
|
size?: StyledIconButtonProps['size'];
|
|
3575
|
-
/**
|
|
3576
|
-
* Icon button label used to provide a description.
|
|
3577
|
-
*/
|
|
3578
|
-
label: string;
|
|
3579
|
-
/**
|
|
3580
|
-
* The duration of a the delay before a tooltip is shown.
|
|
3581
|
-
*/
|
|
3582
|
-
tooltipOpen?: boolean | undefined;
|
|
3583
|
-
/**
|
|
3584
|
-
* Event handler called when the tooltip opens.
|
|
3585
|
-
*/
|
|
3586
|
-
tooltipOnOpen?: (() => void) | undefined;
|
|
3587
|
-
/**
|
|
3588
|
-
* Event handler called when the tooltip closes.
|
|
3589
|
-
*/
|
|
3590
|
-
tooltipOnClose?: (() => void) | undefined;
|
|
3591
|
-
/**
|
|
3592
|
-
* The duration of a the delay before a tooltip is shown.
|
|
3593
|
-
*/
|
|
3594
|
-
tooltipDelayDuration?: number | undefined;
|
|
3595
|
-
/**
|
|
3596
|
-
* How much time a user has to enter another trigger without incurring a
|
|
3597
|
-
* delay again.
|
|
3598
|
-
*/
|
|
3599
|
-
tooltipSkipDelayDuration?: number | undefined;
|
|
3600
|
-
/**
|
|
3601
|
-
* The preferred side of the trigger to render against when open. Will be
|
|
3602
|
-
* reversed when collisions occur and avoidCollisions is enabled.
|
|
3603
|
-
*/
|
|
3604
|
-
tooltipSide?: TooltipContentProps['side'];
|
|
3605
|
-
/**
|
|
3606
|
-
* The preferred alignment against the trigger. May change when collisions
|
|
3607
|
-
* occur.
|
|
3608
|
-
*/
|
|
3609
|
-
tooltipAlign?: TooltipContentProps['align'];
|
|
3610
3497
|
/**
|
|
3611
3498
|
* Wraps the Icon button with a badge.
|
|
3612
3499
|
*/
|
|
@@ -3951,7 +3838,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3951
3838
|
readonly borderRightColor: "colors";
|
|
3952
3839
|
readonly borderRightStyle: "border-styles";
|
|
3953
3840
|
readonly borderRightWidth: "border-widths";
|
|
3954
|
-
readonly borderSpacing: "space-offset";
|
|
3955
3841
|
readonly borderStyle: "border-styles";
|
|
3956
3842
|
readonly borderTop: "colors";
|
|
3957
3843
|
readonly borderTopColor: "colors";
|
|
@@ -4109,6 +3995,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
4109
3995
|
children?: react__default.ReactNode;
|
|
4110
3996
|
} & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react__default.RefAttributes<HTMLButtonElement> & _mirohq_design_system_hooks_use_press.PressProps & packages_components_internal_base_button_src_base_button.HoverEvents & react__default.AnchorHTMLAttributes<"a"> & {
|
|
4111
3997
|
href: string;
|
|
4112
|
-
}, "ref">) & react__default.RefAttributes<
|
|
3998
|
+
}, "ref">) & react__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
4113
3999
|
|
|
4114
4000
|
export { IconButton, IconButtonProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-icon-button",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-icon-button-without-tooltip.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"react": "^16.14 || ^17 || ^18"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@mirohq/design-system-badge": "^0.3.
|
|
30
|
-
"@mirohq/design-system-base-button": "^0.4.
|
|
31
|
-
"@mirohq/design-system-stitches": "^2.
|
|
32
|
-
"@mirohq/design-system-tooltip": "^3.2.
|
|
29
|
+
"@mirohq/design-system-badge": "^0.3.24",
|
|
30
|
+
"@mirohq/design-system-base-button": "^0.4.26",
|
|
31
|
+
"@mirohq/design-system-stitches": "^2.3.16",
|
|
32
|
+
"@mirohq/design-system-tooltip": "^3.2.31"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rollup -c ../../../rollup.config.js",
|