@mirohq/design-system-icon-button 1.2.13-use-press.0 → 1.2.13-use-press.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 CHANGED
@@ -24,9 +24,6 @@ const StyledIconButton = designSystemStitches.styled(designSystemBaseButton.Base
24
24
  "solid-prominent": {
25
25
  backgroundColor: "$background-primary-prominent",
26
26
  color: "$icon-primary-inverted",
27
- "&[data-focused]": {
28
- boxShadow: "$focus-small"
29
- },
30
27
  "&:hover": {
31
28
  backgroundColor: "$background-primary-prominent-hover"
32
29
  },
@@ -41,9 +38,6 @@ const StyledIconButton = designSystemStitches.styled(designSystemBaseButton.Base
41
38
  "solid-subtle": {
42
39
  backgroundColor: "$background-neutrals-subtle",
43
40
  color: "$icon-neutrals",
44
- "&[data-focused]": {
45
- boxShadow: "$focus-small"
46
- },
47
41
  "&:hover": {
48
42
  backgroundColor: "$background-neutrals-subtle-hover"
49
43
  },
@@ -59,10 +53,6 @@ const StyledIconButton = designSystemStitches.styled(designSystemBaseButton.Base
59
53
  backgroundColor: "$background-neutrals",
60
54
  color: "$icon-neutrals",
61
55
  border: "1px solid $border-neutrals",
62
- "&[data-focused]": {
63
- boxShadow: "$focus-small-outline",
64
- borderColor: "$blue-500 !important"
65
- },
66
56
  "&:hover": {
67
57
  backgroundColor: "$background-neutrals-subtle-hover",
68
58
  borderColor: "$border-neutrals-hover"
@@ -80,9 +70,6 @@ const StyledIconButton = designSystemStitches.styled(designSystemBaseButton.Base
80
70
  ghost: {
81
71
  color: "$icon-neutrals",
82
72
  backgroundColor: "transparent",
83
- "&[data-focused]": {
84
- boxShadow: "$focus-small"
85
- },
86
73
  "&:hover": {
87
74
  backgroundColor: "$background-neutrals-subtle-hover"
88
75
  },
@@ -154,7 +141,7 @@ const IconButton = React__default["default"].forwardRef(
154
141
  });
155
142
  let badgeOffset = {};
156
143
  if (size === "medium") {
157
- badgeOffset = typeof badgeContent !== "undefined" && badgeContent !== "" ? { offsetX: -7, offsetY: -5 } : { offsetX: 3, offsetY: -3 };
144
+ badgeOffset = badgeContent !== void 0 && badgeContent !== "" ? { offsetX: -7, offsetY: -5 } : { offsetX: 3, offsetY: -3 };
158
145
  }
159
146
  return /* @__PURE__ */ React__default["default"].createElement(designSystemTooltip.Tooltip, {
160
147
  delayDuration: tooltipDelayDuration,
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'\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 '&[data-focused]': {\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 '&[data-focused]': {\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 '&[data-focused]': {\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 '&[data-focused]': {\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'\n\nimport type { StyledIconButtonProps } from './icon-buttons.styled'\nimport { StyledIconButton } from './icon-buttons.styled'\n\nexport interface IconButtonProps extends StyledIconButtonProps {\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 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}\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 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 typeof badgeContent !== 'undefined' && badgeContent !== ''\n ? { offsetX: -7, offsetY: -5 }\n : { offsetX: 3, offsetY: -3 }\n }\n\n return (\n <Tooltip\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","sizes","baseIconStyles","React","isIconComponent","addPropsToChildren","Tooltip","Badge"],"mappings":";;;;;;;;;;;;;;;;AAKA,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,iBAAmB,EAAA;AAAA,UACjB,SAAW,EAAA,cAAA;AAAA,SACb;AAAA,QAEA,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAiB,GAAA;AAAA,UAChB,eAAiB,EAAA,sCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAmB,GAAA;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,iBAAmB,EAAA;AAAA,UACjB,SAAW,EAAA,cAAA;AAAA,SACb;AAAA,QAEA,SAAW,EAAA;AAAA,UACT,eAAiB,EA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AA,MACN,OAAS,EAAA,YAAA;AAAA,MACT,UAAU,OAAY,KAAA,iBAAA;AAAA,KAAA,EAErB,iBACH,CACF,CACF,CACA,kBAAAJ,yBAAA,CAAA,aAAA,CAACG,4BAAQ,OAAR,EAAA;AAAA,MACC,KAAO,EAAA,YAAA;AAAA,MACP,IAAM,EAAA,WAAA;AAAA,MACN,gBAAgB,EAAA,IAAA;AAAA,KAAA,EAEf,KACH,CACF,CAAA,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'\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 '&: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 '&: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 '&: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 '&: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 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 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 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","sizes","baseIconStyles","React","isIconComponent","addPropsToChildren","Tooltip","Badge"],"mappings":";;;;;;;;;;;;;;;;AAKA,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,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,qCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAiB,GAAA;AAAA,UAChB,eAAiB,EAAA,sCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAmB,GAAA;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,SAAW,EAAA;AAAA,UACT,eAAiB,EAAA,mCAAA;AAAA,SACnB;AAAA,QACA,CAAC,cAAiB,GAAA;AAAA,UAChB,eAAiB,EAAA,oCAAA;AAAA,SACnB;AAAA,QACA,CAAC,gBAAmB,GAAA;AAAA,UAClB,eAAiB,EAAA,+BAAA;AAAA,UACjB,KAAO,EAAA,yBAAA;AAAA,SACT;AAAA,OACF;AAAA,MACA,OAAS,EAAA;AAAA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
17
17
  backgroundColor: "$background-primary-prominent",
18
18
  color: "$icon-primary-inverted",
19
- "&[data-focused]": {
20
- boxShadow: "$focus-small"
21
- },
22
19
  "&:hover": {
23
20
  backgroundColor: "$background-primary-prominent-hover"
24
21
  },
@@ -33,9 +30,6 @@ const StyledIconButton = styled(BaseButton, {
33
30
  "solid-subtle": {
34
31
  backgroundColor: "$background-neutrals-subtle",
35
32
  color: "$icon-neutrals",
36
- "&[data-focused]": {
37
- boxShadow: "$focus-small"
38
- },
39
33
  "&:hover": {
40
34
  backgroundColor: "$background-neutrals-subtle-hover"
41
35
  },
@@ -51,10 +45,6 @@ const StyledIconButton = styled(BaseButton, {
51
45
  backgroundColor: "$background-neutrals",
52
46
  color: "$icon-neutrals",
53
47
  border: "1px solid $border-neutrals",
54
- "&[data-focused]": {
55
- boxShadow: "$focus-small-outline",
56
- borderColor: "$blue-500 !important"
57
- },
58
48
  "&:hover": {
59
49
  backgroundColor: "$background-neutrals-subtle-hover",
60
50
  borderColor: "$border-neutrals-hover"
@@ -72,9 +62,6 @@ const StyledIconButton = styled(BaseButton, {
72
62
  ghost: {
73
63
  color: "$icon-neutrals",
74
64
  backgroundColor: "transparent",
75
- "&[data-focused]": {
76
- boxShadow: "$focus-small"
77
- },
78
65
  "&:hover": {
79
66
  backgroundColor: "$background-neutrals-subtle-hover"
80
67
  },
@@ -146,7 +133,7 @@ const IconButton = React.forwardRef(
146
133
  });
147
134
  let badgeOffset = {};
148
135
  if (size === "medium") {
149
- badgeOffset = typeof badgeContent !== "undefined" && badgeContent !== "" ? { offsetX: -7, offsetY: -5 } : { offsetX: 3, offsetY: -3 };
136
+ badgeOffset = badgeContent !== void 0 && badgeContent !== "" ? { offsetX: -7, offsetY: -5 } : { offsetX: 3, offsetY: -3 };
150
137
  }
151
138
  return /* @__PURE__ */ React.createElement(Tooltip, {
152
139
  delayDuration: tooltipDelayDuration,
@@ -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'\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 '&[data-focused]': {\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 '&[data-focused]': {\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 '&[data-focused]': {\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 '&[data-focused]': {\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'\n\nimport type { StyledIconButtonProps } from './icon-buttons.styled'\nimport { StyledIconButton } from './icon-buttons.styled'\n\nexport interface IconButtonProps extends StyledIconButtonProps {\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 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}\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 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 typeof badgeContent !== 'undefined' && badgeContent !== ''\n ? { offsetX: -7, offsetY: -5 }\n : { offsetX: 3, offsetY: -3 }\n }\n\n return (\n <Tooltip\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":";;;;;;;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ACf,CAAA,CAAA;AAED,IAAA,IAAI,cAAc,EAAC,CAAA;AACnB,IAAA,IAAI,SAAS,QAAU,EAAA;AACrB,MAAA,WAAA,GACE,OAAO,YAAA,KAAiB,WAAe,IAAA,YAAA,KAAiB,KACpD,EAAE,OAAA,EAAS,CAAI,CAAA,EAAA,OAAA,EAAS,IACxB,GAAA,EAAE,OAAS,EAAA,CAAA,EAAG,SAAS,CAAG,CAAA,EAAA,CAAA;AAAA,KAClC;AAEA,IAAA,uBACG,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,MACC,aAAe,EAAA,oBAAA;AAAA,MACf,iBAAmB,EAAA,wBAAA;AAAA,KAEnB,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,OAAR,EAAA;AAAA,MAAgB,OAAO,EAAA,IAAA;AAAA,KAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA;AAAA,MACE,GAAG,SAAA;AAAA,MACJ,OAAA;AAAA,MACA,IAAA;AAAA,MACA,GAAK,EAAA,UAAA;AAAA,MACL,cAAY,SAAa,IAAA,IAAA,GAAA,SAAA,GAAA,KAAA;AAAA,KAAA,kBAExB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MACE,GAAG,WAAA;AAAA,MACJ,IAAM,EAAA,SAAA;AAAA,MACN,OAAS,EAAA,YAAA;AAAA,MACT,UAAU,OAAY,KAAA,iBAAA;AAAA,KAAA,EAErB,iBACH,CACF,CACF,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,OAAR,EAAA;AAAA,MACC,KAAO,EAAA,YAAA;AAAA,MACP,IAAM,EAAA,WAAA;AAAA,MACN,gBAAgB,EAAA,IAAA;AAAA,KAAA,EAEf,KACH,CACF,CAAA,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'\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 '&: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 '&: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 '&: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 '&: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 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 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 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":";;;;;;;;AAKA,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,E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