@mirohq/design-system-icon-button 1.3.25 → 2.0.0-icon-button-without-tooltip.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 +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 +16 -110
- package/package.json +3 -3
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,MAAQ,EAAA;AAAA,UACN,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,MAAQ,EAAA;AAAA,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A;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 * Icon button label used to provide a description.\n */\n 'aria-label': string\n\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,MAAQ,EAAA;AAAA,UACN,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,MAAQ,EAAA;AAAA,UACN,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;AA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M,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,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,MAAQ,EAAA;AAAA,UACN,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAc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;AAAA,QACN,MAAQ,EAAA,aAAA;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 * Icon button label used to provide a description.\n */\n 'aria-label': string\n\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,MAAQ,EAAA;AAAA,UACN,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,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qBAAuB,EAAA,EAAA;AAAA,MACvB,IAAA,EAAM,IAAS,KAAA,QAAA,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
|
@@ -6,7 +6,6 @@ import * as _stitches_react_types_css_util from '@stitches/react/types/css-util'
|
|
|
6
6
|
import * as _mirohq_design_system_components_primitive from '@mirohq/design-system-components/primitive';
|
|
7
7
|
import * as react from 'react';
|
|
8
8
|
import react__default, { ComponentPropsWithRef } from 'react';
|
|
9
|
-
import { TooltipContentProps } from '@mirohq/design-system-tooltip';
|
|
10
9
|
import { BaseButtonProps } from '@mirohq/design-system-base-button';
|
|
11
10
|
|
|
12
11
|
declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<_stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<(Omit<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<_stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<_mirohq_design_system_components_primitive.PrimitiveProps<"button">>, {}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
@@ -987,7 +986,7 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<_miroh
|
|
|
987
986
|
};
|
|
988
987
|
}>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _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"> & {
|
|
989
988
|
href: string;
|
|
990
|
-
}, "ref">) & react.RefAttributes<
|
|
989
|
+
}, "ref">) & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>, {}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
991
990
|
'border-widths': {
|
|
992
991
|
readonly none: 0;
|
|
993
992
|
readonly sm: "1px";
|
|
@@ -1478,7 +1477,7 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<_miroh
|
|
|
1478
1477
|
}>>>, "size" | "variant"> & _stitches_react_types_styled_component.TransformProps<{
|
|
1479
1478
|
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
1480
1479
|
size?: "medium" | "large" | "x-large" | undefined;
|
|
1481
|
-
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<
|
|
1480
|
+
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<(Omit<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<_stitches_react_types_styled_component.StyledComponent<react.ForwardRefExoticComponent<_mirohq_design_system_components_primitive.PrimitiveProps<"button">>, {}, {}, _stitches_react_types_css_util.CSS<{}, {
|
|
1482
1481
|
'border-widths': {
|
|
1483
1482
|
readonly none: 0;
|
|
1484
1483
|
readonly sm: "1px";
|
|
@@ -2456,13 +2455,17 @@ declare const StyledIconButton: react.ForwardRefExoticComponent<Omit<Omit<_miroh
|
|
|
2456
2455
|
};
|
|
2457
2456
|
}>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _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"> & {
|
|
2458
2457
|
href: string;
|
|
2459
|
-
}, "ref">) & react.RefAttributes<
|
|
2458
|
+
}, "ref">) & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>, {
|
|
2460
2459
|
variant?: "outline" | "solid-prominent" | "solid-subtle" | "ghost" | undefined;
|
|
2461
2460
|
size?: "medium" | "large" | "x-large" | undefined;
|
|
2462
2461
|
}, {}>;
|
|
2463
2462
|
declare type StyledIconButtonProps = ComponentPropsWithRef<typeof StyledIconButton>;
|
|
2464
2463
|
|
|
2465
2464
|
declare type IconButtonProps = {
|
|
2465
|
+
/**
|
|
2466
|
+
* Icon button label used to provide a description.
|
|
2467
|
+
*/
|
|
2468
|
+
'aria-label': string;
|
|
2466
2469
|
/**
|
|
2467
2470
|
* Change the Icon button style
|
|
2468
2471
|
*/
|
|
@@ -2471,41 +2474,6 @@ declare type IconButtonProps = {
|
|
|
2471
2474
|
* Change the Icon button size
|
|
2472
2475
|
*/
|
|
2473
2476
|
size?: StyledIconButtonProps['size'];
|
|
2474
|
-
/**
|
|
2475
|
-
* Icon button label used to provide a description.
|
|
2476
|
-
*/
|
|
2477
|
-
label: string;
|
|
2478
|
-
/**
|
|
2479
|
-
* The duration of a the delay before a tooltip is shown.
|
|
2480
|
-
*/
|
|
2481
|
-
tooltipOpen?: boolean;
|
|
2482
|
-
/**
|
|
2483
|
-
* Event handler called when the tooltip opens.
|
|
2484
|
-
*/
|
|
2485
|
-
tooltipOnOpen?: () => void;
|
|
2486
|
-
/**
|
|
2487
|
-
* Event handler called when the tooltip closes.
|
|
2488
|
-
*/
|
|
2489
|
-
tooltipOnClose?: () => void;
|
|
2490
|
-
/**
|
|
2491
|
-
* The duration of a the delay before a tooltip is shown.
|
|
2492
|
-
*/
|
|
2493
|
-
tooltipDelayDuration?: number;
|
|
2494
|
-
/**
|
|
2495
|
-
* How much time a user has to enter another trigger without incurring a
|
|
2496
|
-
* delay again.
|
|
2497
|
-
*/
|
|
2498
|
-
tooltipSkipDelayDuration?: number;
|
|
2499
|
-
/**
|
|
2500
|
-
* The preferred side of the trigger to render against when open. Will be
|
|
2501
|
-
* reversed when collisions occur and avoidCollisions is enabled.
|
|
2502
|
-
*/
|
|
2503
|
-
tooltipSide?: TooltipContentProps['side'];
|
|
2504
|
-
/**
|
|
2505
|
-
* The preferred alignment against the trigger. May change when collisions
|
|
2506
|
-
* occur.
|
|
2507
|
-
*/
|
|
2508
|
-
tooltipAlign?: TooltipContentProps['align'];
|
|
2509
2477
|
/**
|
|
2510
2478
|
* Wraps the Icon button with a badge.
|
|
2511
2479
|
*/
|
|
@@ -2516,6 +2484,10 @@ declare type IconButtonProps = {
|
|
|
2516
2484
|
badgeContent?: string;
|
|
2517
2485
|
} & BaseButtonProps;
|
|
2518
2486
|
declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
2487
|
+
/**
|
|
2488
|
+
* Icon button label used to provide a description.
|
|
2489
|
+
*/
|
|
2490
|
+
'aria-label': string;
|
|
2519
2491
|
/**
|
|
2520
2492
|
* Change the Icon button style
|
|
2521
2493
|
*/
|
|
@@ -2524,41 +2496,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
2524
2496
|
* Change the Icon button size
|
|
2525
2497
|
*/
|
|
2526
2498
|
size?: StyledIconButtonProps['size'];
|
|
2527
|
-
/**
|
|
2528
|
-
* Icon button label used to provide a description.
|
|
2529
|
-
*/
|
|
2530
|
-
label: string;
|
|
2531
|
-
/**
|
|
2532
|
-
* The duration of a the delay before a tooltip is shown.
|
|
2533
|
-
*/
|
|
2534
|
-
tooltipOpen?: boolean | undefined;
|
|
2535
|
-
/**
|
|
2536
|
-
* Event handler called when the tooltip opens.
|
|
2537
|
-
*/
|
|
2538
|
-
tooltipOnOpen?: (() => void) | undefined;
|
|
2539
|
-
/**
|
|
2540
|
-
* Event handler called when the tooltip closes.
|
|
2541
|
-
*/
|
|
2542
|
-
tooltipOnClose?: (() => void) | undefined;
|
|
2543
|
-
/**
|
|
2544
|
-
* The duration of a the delay before a tooltip is shown.
|
|
2545
|
-
*/
|
|
2546
|
-
tooltipDelayDuration?: number | undefined;
|
|
2547
|
-
/**
|
|
2548
|
-
* How much time a user has to enter another trigger without incurring a
|
|
2549
|
-
* delay again.
|
|
2550
|
-
*/
|
|
2551
|
-
tooltipSkipDelayDuration?: number | undefined;
|
|
2552
|
-
/**
|
|
2553
|
-
* The preferred side of the trigger to render against when open. Will be
|
|
2554
|
-
* reversed when collisions occur and avoidCollisions is enabled.
|
|
2555
|
-
*/
|
|
2556
|
-
tooltipSide?: TooltipContentProps['side'];
|
|
2557
|
-
/**
|
|
2558
|
-
* The preferred alignment against the trigger. May change when collisions
|
|
2559
|
-
* occur.
|
|
2560
|
-
*/
|
|
2561
|
-
tooltipAlign?: TooltipContentProps['align'];
|
|
2562
2499
|
/**
|
|
2563
2500
|
* Wraps the Icon button with a badge.
|
|
2564
2501
|
*/
|
|
@@ -3056,6 +2993,10 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3056
2993
|
'&:hover, &[data-hovered]': _stitches_react_types_css_util.CSSProperties;
|
|
3057
2994
|
};
|
|
3058
2995
|
}>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _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, "ref"> | Omit<{
|
|
2996
|
+
/**
|
|
2997
|
+
* Icon button label used to provide a description.
|
|
2998
|
+
*/
|
|
2999
|
+
'aria-label': string;
|
|
3059
3000
|
/**
|
|
3060
3001
|
* Change the Icon button style
|
|
3061
3002
|
*/
|
|
@@ -3064,41 +3005,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3064
3005
|
* Change the Icon button size
|
|
3065
3006
|
*/
|
|
3066
3007
|
size?: StyledIconButtonProps['size'];
|
|
3067
|
-
/**
|
|
3068
|
-
* Icon button label used to provide a description.
|
|
3069
|
-
*/
|
|
3070
|
-
label: string;
|
|
3071
|
-
/**
|
|
3072
|
-
* The duration of a the delay before a tooltip is shown.
|
|
3073
|
-
*/
|
|
3074
|
-
tooltipOpen?: boolean | undefined;
|
|
3075
|
-
/**
|
|
3076
|
-
* Event handler called when the tooltip opens.
|
|
3077
|
-
*/
|
|
3078
|
-
tooltipOnOpen?: (() => void) | undefined;
|
|
3079
|
-
/**
|
|
3080
|
-
* Event handler called when the tooltip closes.
|
|
3081
|
-
*/
|
|
3082
|
-
tooltipOnClose?: (() => void) | undefined;
|
|
3083
|
-
/**
|
|
3084
|
-
* The duration of a the delay before a tooltip is shown.
|
|
3085
|
-
*/
|
|
3086
|
-
tooltipDelayDuration?: number | undefined;
|
|
3087
|
-
/**
|
|
3088
|
-
* How much time a user has to enter another trigger without incurring a
|
|
3089
|
-
* delay again.
|
|
3090
|
-
*/
|
|
3091
|
-
tooltipSkipDelayDuration?: number | undefined;
|
|
3092
|
-
/**
|
|
3093
|
-
* The preferred side of the trigger to render against when open. Will be
|
|
3094
|
-
* reversed when collisions occur and avoidCollisions is enabled.
|
|
3095
|
-
*/
|
|
3096
|
-
tooltipSide?: TooltipContentProps['side'];
|
|
3097
|
-
/**
|
|
3098
|
-
* The preferred alignment against the trigger. May change when collisions
|
|
3099
|
-
* occur.
|
|
3100
|
-
*/
|
|
3101
|
-
tooltipAlign?: TooltipContentProps['align'];
|
|
3102
3008
|
/**
|
|
3103
3009
|
* Wraps the Icon button with a badge.
|
|
3104
3010
|
*/
|
|
@@ -3597,6 +3503,6 @@ declare const IconButton: react__default.ForwardRefExoticComponent<(Omit<{
|
|
|
3597
3503
|
};
|
|
3598
3504
|
}>>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _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"> & {
|
|
3599
3505
|
href: string;
|
|
3600
|
-
}, "ref">) & react__default.RefAttributes<
|
|
3506
|
+
}, "ref">) & react__default.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
3601
3507
|
|
|
3602
3508
|
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.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@mirohq/design-system-badge": "^0.3.28",
|
|
30
|
-
"@mirohq/design-system-
|
|
30
|
+
"@mirohq/design-system-base-button": "^0.4.31",
|
|
31
31
|
"@mirohq/design-system-stitches": "^2.5.1",
|
|
32
|
-
"@mirohq/design-system-
|
|
32
|
+
"@mirohq/design-system-tooltip": "^3.2.36"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "rollup -c ../../../rollup.config.js",
|