@mirohq/design-system-chip 1.3.0 → 1.3.2
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 +4 -3
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -3
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +7 -6
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -25,6 +25,7 @@ const StyledIconSlot = designSystemStitches.styled(designSystemPrimitive.Primiti
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
const LABEL_OFFSET = 2;
|
|
28
|
+
const DEFAULT_SIZE = "small";
|
|
28
29
|
const iconSlotImg = (size) => ({
|
|
29
30
|
["& ".concat(StyledIconSlot, " img")]: {
|
|
30
31
|
square: size
|
|
@@ -157,7 +158,7 @@ const StyledChip = designSystemStitches.styled(designSystemPrimitive.Primitive.d
|
|
|
157
158
|
],
|
|
158
159
|
defaultVariants: {
|
|
159
160
|
variant: "default",
|
|
160
|
-
size:
|
|
161
|
+
size: DEFAULT_SIZE
|
|
161
162
|
}
|
|
162
163
|
});
|
|
163
164
|
const StyledPressableChip = designSystemStitches.styled(designSystemBaseButton.BaseButton, {
|
|
@@ -181,7 +182,7 @@ const StyledPressableChip = designSystemStitches.styled(designSystemBaseButton.B
|
|
|
181
182
|
},
|
|
182
183
|
defaultVariants: {
|
|
183
184
|
variant: "default",
|
|
184
|
-
size:
|
|
185
|
+
size: DEFAULT_SIZE
|
|
185
186
|
}
|
|
186
187
|
});
|
|
187
188
|
const StyledChipContent = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
|
|
@@ -236,7 +237,7 @@ const Chip = React.forwardRef(
|
|
|
236
237
|
onRemove,
|
|
237
238
|
removeAriaLabel,
|
|
238
239
|
loading = false,
|
|
239
|
-
size =
|
|
240
|
+
size = DEFAULT_SIZE,
|
|
240
241
|
variant = "default",
|
|
241
242
|
disabled,
|
|
242
243
|
...restProps
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["../src/partials/icon-slot.styled.tsx","../src/chip.styled.tsx","../src/partials/icon-slot.tsx","../src/chip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledIconSlot = styled(Primitive.span, {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n verticalAlign: 'middle',\n paddingInline: '$50',\n '& img': {\n display: 'block',\n square: 16,\n borderRadius: '$round',\n objectFit: 'cover',\n },\n})\n\nexport type StyledIconSlotProps = StrictComponentProps<typeof StyledIconSlot>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { CSS, StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { BaseButton } from '@mirohq/design-system-base-button'\nimport { focus } from '@mirohq/design-system-styles'\n\nimport { StyledIconSlot } from './partials/icon-slot.styled'\n\n// Same offset Button uses so paddingX matches that scale without importing it.\nconst LABEL_OFFSET = 2\n\nconst iconSlotImg = (size: string): CSS => ({\n [`& ${StyledIconSlot} img`]: {\n square: size,\n },\n})\n\nconst chipLayout = {\n borderRadius: '$round',\n display: 'inline-flex',\n alignItems: 'center',\n // Gap, not close-button padding — padding sits inside the focus ring.\n gap: '$100',\n width: 'fit-content',\n maxWidth: '100%',\n flexShrink: 0,\n boxSizing: 'border-box',\n border: '1px solid transparent',\n lineHeight: 1.3,\n // Chip labels are regular. Pressable uses BaseButton; don't keep Button's\n // semibold from that shell.\n fontWeight: '$regular',\n}\n\n// Copied from Button's size variant (same tokens and padding formula), not\n// imported — Chip owns this scale so Button can change independently.\nconst chipSizes = {\n 'x-large': {\n height: '$12',\n fontSize: '$200',\n paddingX: `calc($200 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$8'),\n },\n large: {\n height: '$10',\n fontSize: '$200',\n paddingX: `calc($150 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$6'),\n },\n medium: {\n height: '$8',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$5'),\n },\n small: {\n height: '$6',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$4'),\n },\n}\n\n// Hover and pressed only belong on the pressable shell.\nconst defaultIdle = {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default',\n borderColor: '$chip-border-default',\n}\n\nconst outlineIdle = {\n color: '$chip-text-on-outline',\n backgroundColor: '$transparent',\n borderColor: '$chip-border-outline',\n}\n\nconst defaultInteractive = {\n ...defaultIdle,\n _hover: {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-hover',\n borderColor: '$chip-border-default-hover',\n },\n '&[data-pressed]': {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-pressed',\n borderColor: '$chip-border-default',\n },\n // Attribute selector so `disabled` reaches BaseButton / usePress.\n '&[disabled]': {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n },\n}\n\nconst outlineInteractive = {\n ...outlineIdle,\n _hover: {\n backgroundColor: '$chip-background-outline-hover',\n borderColor: '$chip-border-outline-hover',\n color: '$chip-text-on-outline',\n },\n '&[data-pressed]': {\n backgroundColor: '$chip-background-outline-pressed',\n borderColor: '$chip-border-outline-pressed',\n color: '$chip-text-on-outline',\n },\n '&[disabled]': {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n },\n}\n\nexport const StyledChip = styled(Primitive.div, {\n ...chipLayout,\n variants: {\n variant: {\n default: defaultIdle,\n outline: outlineIdle,\n },\n disabled: {\n true: {},\n },\n size: chipSizes,\n },\n compoundVariants: [\n {\n variant: 'default',\n disabled: true,\n css: {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n '& button': {\n color: '$icon-on-disabled',\n },\n },\n },\n {\n variant: 'outline',\n disabled: true,\n css: {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n '& button': {\n color: '$icon-disabled',\n },\n },\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: 'medium',\n },\n})\n\nexport const StyledPressableChip = styled(BaseButton, {\n ...chipLayout,\n position: 'relative',\n ...focus.css({\n boxShadow: '$focus',\n }),\n // Loading stays visually idle — only the wait cursor signals it. Don't reuse\n // the disabled mute; that made loading look broken.\n '&[aria-busy=\"true\"]': {\n cursor: 'wait',\n pointerEvents: 'none',\n },\n variants: {\n variant: {\n default: defaultInteractive,\n outline: outlineInteractive,\n },\n size: chipSizes,\n },\n defaultVariants: {\n variant: 'default',\n size: 'medium',\n },\n})\n\nexport const StyledChipContent = styled(Primitive.div, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n // Taller than the em box so descenders (g, y) aren't clipped by overflow.\n lineHeight: 1.3,\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n variants: {\n loading: {\n true: {\n opacity: 0,\n },\n },\n },\n})\n\nexport const StyledSpinnerBox = styled(Primitive.div, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n margin: 'auto',\n zIndex: 1,\n})\n\nexport const StyledChipButton = styled(BaseButton, {\n flexShrink: 0,\n color: '$icon-secondary',\n ...focus.css({\n boxShadow: '$focus',\n }),\n})\n\nexport type StyledChipProps = StrictComponentProps<typeof StyledChip>\n","import type { StyledIconSlotProps } from './icon-slot.styled'\nimport { StyledIconSlot } from './icon-slot.styled'\n\nexport interface IconSlotProps extends StyledIconSlotProps {}\n\nexport const IconSlot = StyledIconSlot\n","import React from 'react'\nimport type {\n ElementRef,\n ForwardRefExoticComponent,\n RefAttributes,\n} from 'react'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport { Spinner } from '@mirohq/design-system-spinner'\nimport type { SpinnerProps } from '@mirohq/design-system-spinner'\n\nimport {\n StyledChip,\n StyledChipButton,\n StyledChipContent,\n StyledPressableChip,\n StyledSpinnerBox,\n} from './chip.styled'\nimport type { StyledChipProps } from './chip.styled'\nimport { IconSlot } from './partials/icon-slot'\n\nexport type ChipProps = Omit<\n StyledChipProps,\n 'ref' | 'size' | 'variant' | 'disabled'\n> &\n Pick<BaseButtonProps, 'onPress'> &\n RefAttributes<HTMLDivElement | HTMLButtonElement> & {\n /**\n * Change the chip size. Same scale as Button (`small`, `medium`, `large`,\n * `x-large`).\n * @default 'medium'\n */\n size?: StyledChipProps['size']\n /**\n * Change the chip style. `default` is filled; `outline` is bordered.\n * @default 'default'\n */\n variant?: StyledChipProps['variant']\n /**\n * Disable the chip. When removable, the close control is disabled too.\n */\n disabled?: boolean\n /**\n * Show a button to remove the Chip\n * @default true\n */\n removable?: boolean\n /**\n * Show a spinner overlay and keep the chip non-interactive without the\n * disabled look. Pressable only.\n * @default false\n */\n loading?: boolean\n } & (\n | {\n /**\n * Event handler called when the chip's remove button is clicked.\n */\n onRemove: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void\n /**\n * Remove button label to make the button recognizable by the screen readers.\n */\n removeAriaLabel: string\n }\n | { removable: false; removeAriaLabel?: never; onRemove?: never }\n )\n\nconst hasPressEvent = (props: object): boolean => {\n if ('onClick' in props && props.onClick != null) return true\n if ('onPress' in props && props.onPress != null) return true\n\n return false\n}\n\nexport const Chip = React.forwardRef<ElementRef<'div' | 'button'>, ChipProps>(\n (props, forwardRef) => {\n const {\n children,\n removable = true,\n onRemove,\n removeAriaLabel,\n loading = false,\n size = 'medium',\n variant = 'default',\n disabled,\n ...restProps\n } = props\n\n const pressable = hasPressEvent(restProps)\n const isLoading = pressable && loading\n\n let spinnerSize: SpinnerProps['size'] = 'medium'\n\n if (typeof size === 'string' && ['small', 'medium'].includes(size)) {\n spinnerSize = 'small'\n }\n\n const content = (\n <>\n {isLoading && (\n <StyledSpinnerBox\n aria-hidden\n data-testid={\n process.env.NODE_ENV === 'test' ? 'chip-spinner' : undefined\n }\n >\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n )}\n <StyledChipContent\n data-chip-content=''\n loading={isLoading || undefined}\n >\n {children}\n </StyledChipContent>\n {!pressable && removable && (\n <StyledChipButton\n type='button'\n disabled={disabled === true || undefined}\n onClick={onRemove}\n aria-label={removeAriaLabel}\n >\n <IconCross size='small' />\n </StyledChipButton>\n )}\n </>\n )\n\n if (pressable) {\n return (\n <StyledPressableChip\n type='button'\n {...(restProps as BaseButtonProps)}\n size={size}\n variant={variant}\n disabled={disabled === true || undefined}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledPressableChip>>}\n aria-busy={isLoading || undefined}\n aria-disabled={isLoading || undefined}\n >\n {content}\n </StyledPressableChip>\n )\n }\n\n return (\n <StyledChip\n {...(restProps as StyledChipProps)}\n size={size}\n variant={variant}\n disabled={disabled}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledChip>>}\n >\n {content}\n </StyledChip>\n )\n }\n) as ForwardRefExoticComponent<ChipProps> & Partials\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n}\n\nChip.IconSlot = IconSlot\n"],"names":["styled","Primitive","BaseButton","focus","jsxs","Fragment","jsx","Spinner","IconCross"],"mappings":";;;;;;;;;;;AAIO,MAAM,cAAA,GAAiBA,2BAAA,CAAOC,+BAAA,CAAU,IAAA,EAAM;AAAA,EACnD,OAAA,EAAS,aAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,cAAA,EAAgB,QAAA;AAAA,EAChB,UAAA,EAAY,CAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,aAAA,EAAe,KAAA;AAAA,EACf,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,OAAA;AAAA,IACT,MAAA,EAAQ,EAAA;AAAA,IACR,YAAA,EAAc,QAAA;AAAA,IACd,SAAA,E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,SAAS,SAAA,IAAa,MAAA;AAAA,UAErB;AAAA;AAAA,OACH;AAAA,MACC,CAAC,aAAa,SAAA,oBACbA,cAAA;AAAA,QAAC,gBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACL,QAAA,EAAU,aAAa,IAAA,IAAQ,MAAA;AAAA,UAC/B,OAAA,EAAS,QAAA;AAAA,UACT,YAAA,EAAY,eAAA;AAAA,UAEZ,QAAA,kBAAAA,cAAA,CAACE,2BAAA,EAAA,EAAU,IAAA,EAAK,OAAA,EAAQ;AAAA;AAAA;AAC1B,KAAA,EAEJ,CAAA;AAGF,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,uBACEF,cAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,IAAA,EAAK,QAAA;AAAA,UACJ,GAAI,SAAA;AAAA,UACL,IAAA;AAAA,UACA,OAAA;AAAA,UACA,QAAA,EAAU,aAAa,IAAA,IAAQ,MAAA;AAAA,UAC/B,GAAA,EAAK,UAAA;AAAA,UACL,aAAW,SAAA,IAAa,MAAA;AAAA,UACxB,iBAAe,SAAA,IAAa,MAAA;AAAA,UAE3B,QAAA,EAAA;AAAA;AAAA,OACH;AAAA,IAEJ;AAEA,IAAA,uBACEA,cAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACE,GAAI,SAAA;AAAA,QACL,IAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA,GAAA,EAAK,UAAA;AAAA,QAEJ,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAMA,IAAA,CAAK,QAAA,GAAW,QAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"main.js","sources":["../src/partials/icon-slot.styled.tsx","../src/chip.styled.tsx","../src/partials/icon-slot.tsx","../src/chip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledIconSlot = styled(Primitive.span, {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n verticalAlign: 'middle',\n paddingInline: '$50',\n '& img': {\n display: 'block',\n square: 16,\n borderRadius: '$round',\n objectFit: 'cover',\n },\n})\n\nexport type StyledIconSlotProps = StrictComponentProps<typeof StyledIconSlot>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { CSS, StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { BaseButton } from '@mirohq/design-system-base-button'\nimport { focus } from '@mirohq/design-system-styles'\n\nimport { StyledIconSlot } from './partials/icon-slot.styled'\n\n// Same offset Button uses so paddingX matches that scale without importing it.\nconst LABEL_OFFSET = 2\n\n// Chip defaults to small where Button defaults to medium. 1.2.60 had no size\n// scale and computed to ~23.6px tall; small is 24px and medium is 32px, so\n// defaulting to medium made every existing consumer's chips ~36% taller without\n// them changing a line. The asymmetry with Button is deliberate and is the whole\n// point — read this before \"fixing\" it.\nexport const DEFAULT_SIZE = 'small' as const\n\nconst iconSlotImg = (size: string): CSS => ({\n [`& ${StyledIconSlot} img`]: {\n square: size,\n },\n})\n\nconst chipLayout = {\n borderRadius: '$round',\n display: 'inline-flex',\n alignItems: 'center',\n // Gap, not close-button padding — padding sits inside the focus ring.\n gap: '$100',\n width: 'fit-content',\n maxWidth: '100%',\n flexShrink: 0,\n boxSizing: 'border-box',\n border: '1px solid transparent',\n lineHeight: 1.3,\n // Chip labels are regular. Pressable uses BaseButton; don't keep Button's\n // semibold from that shell.\n fontWeight: '$regular',\n}\n\n// Copied from Button's size variant (same tokens and padding formula), not\n// imported — Chip owns this scale so Button can change independently.\nconst chipSizes = {\n 'x-large': {\n height: '$12',\n fontSize: '$200',\n paddingX: `calc($200 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$8'),\n },\n large: {\n height: '$10',\n fontSize: '$200',\n paddingX: `calc($150 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$6'),\n },\n medium: {\n height: '$8',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$5'),\n },\n small: {\n height: '$6',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$4'),\n },\n}\n\n// Hover and pressed only belong on the pressable shell.\nconst defaultIdle = {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default',\n borderColor: '$chip-border-default',\n}\n\nconst outlineIdle = {\n color: '$chip-text-on-outline',\n backgroundColor: '$transparent',\n borderColor: '$chip-border-outline',\n}\n\nconst defaultInteractive = {\n ...defaultIdle,\n _hover: {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-hover',\n borderColor: '$chip-border-default-hover',\n },\n '&[data-pressed]': {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-pressed',\n borderColor: '$chip-border-default',\n },\n // Attribute selector so `disabled` reaches BaseButton / usePress.\n '&[disabled]': {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n },\n}\n\nconst outlineInteractive = {\n ...outlineIdle,\n _hover: {\n backgroundColor: '$chip-background-outline-hover',\n borderColor: '$chip-border-outline-hover',\n color: '$chip-text-on-outline',\n },\n '&[data-pressed]': {\n backgroundColor: '$chip-background-outline-pressed',\n borderColor: '$chip-border-outline-pressed',\n color: '$chip-text-on-outline',\n },\n '&[disabled]': {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n },\n}\n\nexport const StyledChip = styled(Primitive.div, {\n ...chipLayout,\n variants: {\n variant: {\n default: defaultIdle,\n outline: outlineIdle,\n },\n disabled: {\n true: {},\n },\n size: chipSizes,\n },\n compoundVariants: [\n {\n variant: 'default',\n disabled: true,\n css: {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n '& button': {\n color: '$icon-on-disabled',\n },\n },\n },\n {\n variant: 'outline',\n disabled: true,\n css: {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n '& button': {\n color: '$icon-disabled',\n },\n },\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: DEFAULT_SIZE,\n },\n})\n\nexport const StyledPressableChip = styled(BaseButton, {\n ...chipLayout,\n position: 'relative',\n ...focus.css({\n boxShadow: '$focus',\n }),\n // Loading stays visually idle — only the wait cursor signals it. Don't reuse\n // the disabled mute; that made loading look broken.\n '&[aria-busy=\"true\"]': {\n cursor: 'wait',\n pointerEvents: 'none',\n },\n variants: {\n variant: {\n default: defaultInteractive,\n outline: outlineInteractive,\n },\n size: chipSizes,\n },\n defaultVariants: {\n variant: 'default',\n size: DEFAULT_SIZE,\n },\n})\n\nexport const StyledChipContent = styled(Primitive.div, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n // Taller than the em box so descenders (g, y) aren't clipped by overflow.\n lineHeight: 1.3,\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n variants: {\n loading: {\n true: {\n opacity: 0,\n },\n },\n },\n})\n\nexport const StyledSpinnerBox = styled(Primitive.div, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n margin: 'auto',\n zIndex: 1,\n})\n\nexport const StyledChipButton = styled(BaseButton, {\n flexShrink: 0,\n color: '$icon-secondary',\n ...focus.css({\n boxShadow: '$focus',\n }),\n})\n\nexport type StyledChipProps = StrictComponentProps<typeof StyledChip>\n","import type { StyledIconSlotProps } from './icon-slot.styled'\nimport { StyledIconSlot } from './icon-slot.styled'\n\nexport interface IconSlotProps extends StyledIconSlotProps {}\n\nexport const IconSlot = StyledIconSlot\n","import React from 'react'\nimport type {\n ElementRef,\n ForwardRefExoticComponent,\n RefAttributes,\n} from 'react'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport { Spinner } from '@mirohq/design-system-spinner'\nimport type { SpinnerProps } from '@mirohq/design-system-spinner'\n\nimport {\n DEFAULT_SIZE,\n StyledChip,\n StyledChipButton,\n StyledChipContent,\n StyledPressableChip,\n StyledSpinnerBox,\n} from './chip.styled'\nimport type { StyledChipProps } from './chip.styled'\nimport { IconSlot } from './partials/icon-slot'\n\nexport type ChipProps = Omit<\n StyledChipProps,\n 'ref' | 'size' | 'variant' | 'disabled'\n> &\n Pick<BaseButtonProps, 'onPress'> &\n RefAttributes<HTMLDivElement | HTMLButtonElement> & {\n /**\n * Change the chip size. Same scale as Button, but defaults to `small` where\n * Button defaults to `medium`, so chips written before the scale existed keep\n * their height.\n * @default 'small'\n */\n size?: StyledChipProps['size']\n /**\n * Change the chip style. `default` is filled; `outline` is bordered.\n * @default 'default'\n */\n variant?: StyledChipProps['variant']\n /**\n * Disable the chip. When removable, the close control is disabled too.\n */\n disabled?: boolean\n /**\n * Show a button to remove the Chip\n * @default true\n */\n removable?: boolean\n /**\n * Show a spinner overlay and keep the chip non-interactive without the\n * disabled look. Pressable only.\n * @default false\n */\n loading?: boolean\n } & (\n | {\n /**\n * Event handler called when the chip's remove button is clicked.\n */\n onRemove: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void\n /**\n * Remove button label to make the button recognizable by the screen readers.\n */\n removeAriaLabel: string\n }\n | { removable: false; removeAriaLabel?: never; onRemove?: never }\n )\n\nconst hasPressEvent = (props: object): boolean => {\n if ('onClick' in props && props.onClick != null) return true\n if ('onPress' in props && props.onPress != null) return true\n\n return false\n}\n\nexport const Chip = React.forwardRef<ElementRef<'div' | 'button'>, ChipProps>(\n (props, forwardRef) => {\n const {\n children,\n removable = true,\n onRemove,\n removeAriaLabel,\n loading = false,\n size = DEFAULT_SIZE,\n variant = 'default',\n disabled,\n ...restProps\n } = props\n\n const pressable = hasPressEvent(restProps)\n const isLoading = pressable && loading\n\n let spinnerSize: SpinnerProps['size'] = 'medium'\n\n if (typeof size === 'string' && ['small', 'medium'].includes(size)) {\n spinnerSize = 'small'\n }\n\n const content = (\n <>\n {isLoading && (\n <StyledSpinnerBox\n aria-hidden\n data-testid={\n process.env.NODE_ENV === 'test' ? 'chip-spinner' : undefined\n }\n >\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n )}\n <StyledChipContent\n data-chip-content=''\n loading={isLoading || undefined}\n >\n {children}\n </StyledChipContent>\n {!pressable && removable && (\n <StyledChipButton\n type='button'\n disabled={disabled === true || undefined}\n onClick={onRemove}\n aria-label={removeAriaLabel}\n >\n <IconCross size='small' />\n </StyledChipButton>\n )}\n </>\n )\n\n if (pressable) {\n return (\n <StyledPressableChip\n type='button'\n {...(restProps as BaseButtonProps)}\n size={size}\n variant={variant}\n disabled={disabled === true || undefined}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledPressableChip>>}\n aria-busy={isLoading || undefined}\n aria-disabled={isLoading || undefined}\n >\n {content}\n </StyledPressableChip>\n )\n }\n\n return (\n <StyledChip\n {...(restProps as StyledChipProps)}\n size={size}\n variant={variant}\n disabled={disabled}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledChip>>}\n >\n {content}\n </StyledChip>\n )\n }\n) as ForwardRefExoticComponent<ChipProps> & Partials\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n}\n\nChip.IconSlot = IconSlot\n"],"names":["styled","Primitive","BaseButton","focus","jsxs","Fragment","jsx","Spinner","IconCross"],"mappings":";;;;;;;;;;;AAIO,MAAM,cAAA,GAAiBA,2BAAA,CAAOC,+BAAA,CAAU,IAAA,EAAM;AAAA,EACnD,OAAA,EAAS,aAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,cAAA,EAAgB,QAAA;AAAA,EAChB,UAAA,EAAY,CAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,aAAA,EAAe,KAAA;AAAA,EACf,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,OAAA;AAAA,IACT,MAAA,EAAQ,EAAA;AAAA,IACR,YAAA,EAA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ULT_SIZE = "small";
|
|
26
27
|
const iconSlotImg = (size) => ({
|
|
27
28
|
["& ".concat(StyledIconSlot, " img")]: {
|
|
28
29
|
square: size
|
|
@@ -155,7 +156,7 @@ const StyledChip = styled(Primitive.div, {
|
|
|
155
156
|
],
|
|
156
157
|
defaultVariants: {
|
|
157
158
|
variant: "default",
|
|
158
|
-
size:
|
|
159
|
+
size: DEFAULT_SIZE
|
|
159
160
|
}
|
|
160
161
|
});
|
|
161
162
|
const StyledPressableChip = styled(BaseButton, {
|
|
@@ -179,7 +180,7 @@ const StyledPressableChip = styled(BaseButton, {
|
|
|
179
180
|
},
|
|
180
181
|
defaultVariants: {
|
|
181
182
|
variant: "default",
|
|
182
|
-
size:
|
|
183
|
+
size: DEFAULT_SIZE
|
|
183
184
|
}
|
|
184
185
|
});
|
|
185
186
|
const StyledChipContent = styled(Primitive.div, {
|
|
@@ -234,7 +235,7 @@ const Chip = React.forwardRef(
|
|
|
234
235
|
onRemove,
|
|
235
236
|
removeAriaLabel,
|
|
236
237
|
loading = false,
|
|
237
|
-
size =
|
|
238
|
+
size = DEFAULT_SIZE,
|
|
238
239
|
variant = "default",
|
|
239
240
|
disabled,
|
|
240
241
|
...restProps
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/partials/icon-slot.styled.tsx","../src/chip.styled.tsx","../src/partials/icon-slot.tsx","../src/chip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledIconSlot = styled(Primitive.span, {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n verticalAlign: 'middle',\n paddingInline: '$50',\n '& img': {\n display: 'block',\n square: 16,\n borderRadius: '$round',\n objectFit: 'cover',\n },\n})\n\nexport type StyledIconSlotProps = StrictComponentProps<typeof StyledIconSlot>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { CSS, StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { BaseButton } from '@mirohq/design-system-base-button'\nimport { focus } from '@mirohq/design-system-styles'\n\nimport { StyledIconSlot } from './partials/icon-slot.styled'\n\n// Same offset Button uses so paddingX matches that scale without importing it.\nconst LABEL_OFFSET = 2\n\nconst iconSlotImg = (size: string): CSS => ({\n [`& ${StyledIconSlot} img`]: {\n square: size,\n },\n})\n\nconst chipLayout = {\n borderRadius: '$round',\n display: 'inline-flex',\n alignItems: 'center',\n // Gap, not close-button padding — padding sits inside the focus ring.\n gap: '$100',\n width: 'fit-content',\n maxWidth: '100%',\n flexShrink: 0,\n boxSizing: 'border-box',\n border: '1px solid transparent',\n lineHeight: 1.3,\n // Chip labels are regular. Pressable uses BaseButton; don't keep Button's\n // semibold from that shell.\n fontWeight: '$regular',\n}\n\n// Copied from Button's size variant (same tokens and padding formula), not\n// imported — Chip owns this scale so Button can change independently.\nconst chipSizes = {\n 'x-large': {\n height: '$12',\n fontSize: '$200',\n paddingX: `calc($200 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$8'),\n },\n large: {\n height: '$10',\n fontSize: '$200',\n paddingX: `calc($150 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$6'),\n },\n medium: {\n height: '$8',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$5'),\n },\n small: {\n height: '$6',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$4'),\n },\n}\n\n// Hover and pressed only belong on the pressable shell.\nconst defaultIdle = {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default',\n borderColor: '$chip-border-default',\n}\n\nconst outlineIdle = {\n color: '$chip-text-on-outline',\n backgroundColor: '$transparent',\n borderColor: '$chip-border-outline',\n}\n\nconst defaultInteractive = {\n ...defaultIdle,\n _hover: {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-hover',\n borderColor: '$chip-border-default-hover',\n },\n '&[data-pressed]': {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-pressed',\n borderColor: '$chip-border-default',\n },\n // Attribute selector so `disabled` reaches BaseButton / usePress.\n '&[disabled]': {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n },\n}\n\nconst outlineInteractive = {\n ...outlineIdle,\n _hover: {\n backgroundColor: '$chip-background-outline-hover',\n borderColor: '$chip-border-outline-hover',\n color: '$chip-text-on-outline',\n },\n '&[data-pressed]': {\n backgroundColor: '$chip-background-outline-pressed',\n borderColor: '$chip-border-outline-pressed',\n color: '$chip-text-on-outline',\n },\n '&[disabled]': {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n },\n}\n\nexport const StyledChip = styled(Primitive.div, {\n ...chipLayout,\n variants: {\n variant: {\n default: defaultIdle,\n outline: outlineIdle,\n },\n disabled: {\n true: {},\n },\n size: chipSizes,\n },\n compoundVariants: [\n {\n variant: 'default',\n disabled: true,\n css: {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n '& button': {\n color: '$icon-on-disabled',\n },\n },\n },\n {\n variant: 'outline',\n disabled: true,\n css: {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n '& button': {\n color: '$icon-disabled',\n },\n },\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: 'medium',\n },\n})\n\nexport const StyledPressableChip = styled(BaseButton, {\n ...chipLayout,\n position: 'relative',\n ...focus.css({\n boxShadow: '$focus',\n }),\n // Loading stays visually idle — only the wait cursor signals it. Don't reuse\n // the disabled mute; that made loading look broken.\n '&[aria-busy=\"true\"]': {\n cursor: 'wait',\n pointerEvents: 'none',\n },\n variants: {\n variant: {\n default: defaultInteractive,\n outline: outlineInteractive,\n },\n size: chipSizes,\n },\n defaultVariants: {\n variant: 'default',\n size: 'medium',\n },\n})\n\nexport const StyledChipContent = styled(Primitive.div, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n // Taller than the em box so descenders (g, y) aren't clipped by overflow.\n lineHeight: 1.3,\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n variants: {\n loading: {\n true: {\n opacity: 0,\n },\n },\n },\n})\n\nexport const StyledSpinnerBox = styled(Primitive.div, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n margin: 'auto',\n zIndex: 1,\n})\n\nexport const StyledChipButton = styled(BaseButton, {\n flexShrink: 0,\n color: '$icon-secondary',\n ...focus.css({\n boxShadow: '$focus',\n }),\n})\n\nexport type StyledChipProps = StrictComponentProps<typeof StyledChip>\n","import type { StyledIconSlotProps } from './icon-slot.styled'\nimport { StyledIconSlot } from './icon-slot.styled'\n\nexport interface IconSlotProps extends StyledIconSlotProps {}\n\nexport const IconSlot = StyledIconSlot\n","import React from 'react'\nimport type {\n ElementRef,\n ForwardRefExoticComponent,\n RefAttributes,\n} from 'react'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport { Spinner } from '@mirohq/design-system-spinner'\nimport type { SpinnerProps } from '@mirohq/design-system-spinner'\n\nimport {\n StyledChip,\n StyledChipButton,\n StyledChipContent,\n StyledPressableChip,\n StyledSpinnerBox,\n} from './chip.styled'\nimport type { StyledChipProps } from './chip.styled'\nimport { IconSlot } from './partials/icon-slot'\n\nexport type ChipProps = Omit<\n StyledChipProps,\n 'ref' | 'size' | 'variant' | 'disabled'\n> &\n Pick<BaseButtonProps, 'onPress'> &\n RefAttributes<HTMLDivElement | HTMLButtonElement> & {\n /**\n * Change the chip size. Same scale as Button (`small`, `medium`, `large`,\n * `x-large`).\n * @default 'medium'\n */\n size?: StyledChipProps['size']\n /**\n * Change the chip style. `default` is filled; `outline` is bordered.\n * @default 'default'\n */\n variant?: StyledChipProps['variant']\n /**\n * Disable the chip. When removable, the close control is disabled too.\n */\n disabled?: boolean\n /**\n * Show a button to remove the Chip\n * @default true\n */\n removable?: boolean\n /**\n * Show a spinner overlay and keep the chip non-interactive without the\n * disabled look. Pressable only.\n * @default false\n */\n loading?: boolean\n } & (\n | {\n /**\n * Event handler called when the chip's remove button is clicked.\n */\n onRemove: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void\n /**\n * Remove button label to make the button recognizable by the screen readers.\n */\n removeAriaLabel: string\n }\n | { removable: false; removeAriaLabel?: never; onRemove?: never }\n )\n\nconst hasPressEvent = (props: object): boolean => {\n if ('onClick' in props && props.onClick != null) return true\n if ('onPress' in props && props.onPress != null) return true\n\n return false\n}\n\nexport const Chip = React.forwardRef<ElementRef<'div' | 'button'>, ChipProps>(\n (props, forwardRef) => {\n const {\n children,\n removable = true,\n onRemove,\n removeAriaLabel,\n loading = false,\n size = 'medium',\n variant = 'default',\n disabled,\n ...restProps\n } = props\n\n const pressable = hasPressEvent(restProps)\n const isLoading = pressable && loading\n\n let spinnerSize: SpinnerProps['size'] = 'medium'\n\n if (typeof size === 'string' && ['small', 'medium'].includes(size)) {\n spinnerSize = 'small'\n }\n\n const content = (\n <>\n {isLoading && (\n <StyledSpinnerBox\n aria-hidden\n data-testid={\n process.env.NODE_ENV === 'test' ? 'chip-spinner' : undefined\n }\n >\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n )}\n <StyledChipContent\n data-chip-content=''\n loading={isLoading || undefined}\n >\n {children}\n </StyledChipContent>\n {!pressable && removable && (\n <StyledChipButton\n type='button'\n disabled={disabled === true || undefined}\n onClick={onRemove}\n aria-label={removeAriaLabel}\n >\n <IconCross size='small' />\n </StyledChipButton>\n )}\n </>\n )\n\n if (pressable) {\n return (\n <StyledPressableChip\n type='button'\n {...(restProps as BaseButtonProps)}\n size={size}\n variant={variant}\n disabled={disabled === true || undefined}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledPressableChip>>}\n aria-busy={isLoading || undefined}\n aria-disabled={isLoading || undefined}\n >\n {content}\n </StyledPressableChip>\n )\n }\n\n return (\n <StyledChip\n {...(restProps as StyledChipProps)}\n size={size}\n variant={variant}\n disabled={disabled}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledChip>>}\n >\n {content}\n </StyledChip>\n )\n }\n) as ForwardRefExoticComponent<ChipProps> & Partials\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n}\n\nChip.IconSlot = IconSlot\n"],"names":[],"mappings":";;;;;;;;;AAIO,MAAM,cAAA,GAAiB,MAAA,CAAO,SAAA,CAAU,IAAA,EAAM;AAAA,EACnD,OAAA,EAAS,aAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,cAAA,EAAgB,QAAA;AAAA,EAChB,UAAA,EAAY,CAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,aAAA,EAAe,KAAA;AAAA,EACf,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,OAAA;AAAA,IACT,MAAA,EAAQ,EAAA;AAAA,IACR,YAAA,EAAc,QAAA;AAAA,IACd,SAAA,EAAW;AAAA;AAEf,CAAC,CAAA;;ACRD,MAAM,YAAA,GAAe,CAAA;AAErB,MAAM,WAAA,GAAc,CAAC,IAAA,MAAuB;AAAA,EAC1C,CAAC,IAAA,CAAK,MAAA,CAAA,cAAA,EAAc,MAAA,CAAM,GAAG;AAAA,IAC3B,MAAA,EAAQ;AAAA;AAEZ,CAAA,CAAA;AAEA,MAAM,UAAA,GAAa;AAAA,EACjB,YAAA,EAAc,QAAA;AAAA,EACd,OAAA,EAAS,aAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA;AAAA,EAEZ,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,aAAA;AAAA,EACP,QAAA,EAAU,MAAA;AAAA,EACV,UAAA,EAAY,CAAA;AAAA,EACZ,SAAA,EAAW,YAAA;AAAA,EACX,MAAA,EAAQ,uBAA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,UACA,QAAA,EAAU,aAAa,IAAA,IAAQ,MAAA;AAAA,UAC/B,GAAA,EAAK,UAAA;AAAA,UACL,aAAW,SAAA,IAAa,MAAA;AAAA,UACxB,iBAAe,SAAA,IAAa,MAAA;AAAA,UAE3B,QAAA,EAAA;AAAA;AAAA,OACH;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACE,GAAI,SAAA;AAAA,QACL,IAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA,GAAA,EAAK,UAAA;AAAA,QAEJ,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAMA,IAAA,CAAK,QAAA,GAAW,QAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/partials/icon-slot.styled.tsx","../src/chip.styled.tsx","../src/partials/icon-slot.tsx","../src/chip.tsx"],"sourcesContent":["import type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\n\nexport const StyledIconSlot = styled(Primitive.span, {\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n flexShrink: 0,\n verticalAlign: 'middle',\n paddingInline: '$50',\n '& img': {\n display: 'block',\n square: 16,\n borderRadius: '$round',\n objectFit: 'cover',\n },\n})\n\nexport type StyledIconSlotProps = StrictComponentProps<typeof StyledIconSlot>\n","import { styled } from '@mirohq/design-system-stitches'\nimport type { CSS, StrictComponentProps } from '@mirohq/design-system-stitches'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { BaseButton } from '@mirohq/design-system-base-button'\nimport { focus } from '@mirohq/design-system-styles'\n\nimport { StyledIconSlot } from './partials/icon-slot.styled'\n\n// Same offset Button uses so paddingX matches that scale without importing it.\nconst LABEL_OFFSET = 2\n\n// Chip defaults to small where Button defaults to medium. 1.2.60 had no size\n// scale and computed to ~23.6px tall; small is 24px and medium is 32px, so\n// defaulting to medium made every existing consumer's chips ~36% taller without\n// them changing a line. The asymmetry with Button is deliberate and is the whole\n// point — read this before \"fixing\" it.\nexport const DEFAULT_SIZE = 'small' as const\n\nconst iconSlotImg = (size: string): CSS => ({\n [`& ${StyledIconSlot} img`]: {\n square: size,\n },\n})\n\nconst chipLayout = {\n borderRadius: '$round',\n display: 'inline-flex',\n alignItems: 'center',\n // Gap, not close-button padding — padding sits inside the focus ring.\n gap: '$100',\n width: 'fit-content',\n maxWidth: '100%',\n flexShrink: 0,\n boxSizing: 'border-box',\n border: '1px solid transparent',\n lineHeight: 1.3,\n // Chip labels are regular. Pressable uses BaseButton; don't keep Button's\n // semibold from that shell.\n fontWeight: '$regular',\n}\n\n// Copied from Button's size variant (same tokens and padding formula), not\n// imported — Chip owns this scale so Button can change independently.\nconst chipSizes = {\n 'x-large': {\n height: '$12',\n fontSize: '$200',\n paddingX: `calc($200 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$8'),\n },\n large: {\n height: '$10',\n fontSize: '$200',\n paddingX: `calc($150 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$6'),\n },\n medium: {\n height: '$8',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$5'),\n },\n small: {\n height: '$6',\n fontSize: '$175',\n paddingX: `calc($100 + ${LABEL_OFFSET}px)`,\n ...iconSlotImg('$4'),\n },\n}\n\n// Hover and pressed only belong on the pressable shell.\nconst defaultIdle = {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default',\n borderColor: '$chip-border-default',\n}\n\nconst outlineIdle = {\n color: '$chip-text-on-outline',\n backgroundColor: '$transparent',\n borderColor: '$chip-border-outline',\n}\n\nconst defaultInteractive = {\n ...defaultIdle,\n _hover: {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-hover',\n borderColor: '$chip-border-default-hover',\n },\n '&[data-pressed]': {\n color: '$chip-text-on-default',\n backgroundColor: '$chip-background-default-pressed',\n borderColor: '$chip-border-default',\n },\n // Attribute selector so `disabled` reaches BaseButton / usePress.\n '&[disabled]': {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n },\n}\n\nconst outlineInteractive = {\n ...outlineIdle,\n _hover: {\n backgroundColor: '$chip-background-outline-hover',\n borderColor: '$chip-border-outline-hover',\n color: '$chip-text-on-outline',\n },\n '&[data-pressed]': {\n backgroundColor: '$chip-background-outline-pressed',\n borderColor: '$chip-border-outline-pressed',\n color: '$chip-text-on-outline',\n },\n '&[disabled]': {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n },\n}\n\nexport const StyledChip = styled(Primitive.div, {\n ...chipLayout,\n variants: {\n variant: {\n default: defaultIdle,\n outline: outlineIdle,\n },\n disabled: {\n true: {},\n },\n size: chipSizes,\n },\n compoundVariants: [\n {\n variant: 'default',\n disabled: true,\n css: {\n backgroundColor: '$background-disabled',\n color: '$text-on-disabled',\n '& button': {\n color: '$icon-on-disabled',\n },\n },\n },\n {\n variant: 'outline',\n disabled: true,\n css: {\n backgroundColor: '$transparent',\n borderColor: '$border-disabled',\n color: '$text-disabled',\n '& button': {\n color: '$icon-disabled',\n },\n },\n },\n ],\n defaultVariants: {\n variant: 'default',\n size: DEFAULT_SIZE,\n },\n})\n\nexport const StyledPressableChip = styled(BaseButton, {\n ...chipLayout,\n position: 'relative',\n ...focus.css({\n boxShadow: '$focus',\n }),\n // Loading stays visually idle — only the wait cursor signals it. Don't reuse\n // the disabled mute; that made loading look broken.\n '&[aria-busy=\"true\"]': {\n cursor: 'wait',\n pointerEvents: 'none',\n },\n variants: {\n variant: {\n default: defaultInteractive,\n outline: outlineInteractive,\n },\n size: chipSizes,\n },\n defaultVariants: {\n variant: 'default',\n size: DEFAULT_SIZE,\n },\n})\n\nexport const StyledChipContent = styled(Primitive.div, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n // Taller than the em box so descenders (g, y) aren't clipped by overflow.\n lineHeight: 1.3,\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n variants: {\n loading: {\n true: {\n opacity: 0,\n },\n },\n },\n})\n\nexport const StyledSpinnerBox = styled(Primitive.div, {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n margin: 'auto',\n zIndex: 1,\n})\n\nexport const StyledChipButton = styled(BaseButton, {\n flexShrink: 0,\n color: '$icon-secondary',\n ...focus.css({\n boxShadow: '$focus',\n }),\n})\n\nexport type StyledChipProps = StrictComponentProps<typeof StyledChip>\n","import type { StyledIconSlotProps } from './icon-slot.styled'\nimport { StyledIconSlot } from './icon-slot.styled'\n\nexport interface IconSlotProps extends StyledIconSlotProps {}\n\nexport const IconSlot = StyledIconSlot\n","import React from 'react'\nimport type {\n ElementRef,\n ForwardRefExoticComponent,\n RefAttributes,\n} from 'react'\nimport type { BaseButtonProps } from '@mirohq/design-system-base-button'\nimport { IconCross } from '@mirohq/design-system-icons'\nimport { Spinner } from '@mirohq/design-system-spinner'\nimport type { SpinnerProps } from '@mirohq/design-system-spinner'\n\nimport {\n DEFAULT_SIZE,\n StyledChip,\n StyledChipButton,\n StyledChipContent,\n StyledPressableChip,\n StyledSpinnerBox,\n} from './chip.styled'\nimport type { StyledChipProps } from './chip.styled'\nimport { IconSlot } from './partials/icon-slot'\n\nexport type ChipProps = Omit<\n StyledChipProps,\n 'ref' | 'size' | 'variant' | 'disabled'\n> &\n Pick<BaseButtonProps, 'onPress'> &\n RefAttributes<HTMLDivElement | HTMLButtonElement> & {\n /**\n * Change the chip size. Same scale as Button, but defaults to `small` where\n * Button defaults to `medium`, so chips written before the scale existed keep\n * their height.\n * @default 'small'\n */\n size?: StyledChipProps['size']\n /**\n * Change the chip style. `default` is filled; `outline` is bordered.\n * @default 'default'\n */\n variant?: StyledChipProps['variant']\n /**\n * Disable the chip. When removable, the close control is disabled too.\n */\n disabled?: boolean\n /**\n * Show a button to remove the Chip\n * @default true\n */\n removable?: boolean\n /**\n * Show a spinner overlay and keep the chip non-interactive without the\n * disabled look. Pressable only.\n * @default false\n */\n loading?: boolean\n } & (\n | {\n /**\n * Event handler called when the chip's remove button is clicked.\n */\n onRemove: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void\n /**\n * Remove button label to make the button recognizable by the screen readers.\n */\n removeAriaLabel: string\n }\n | { removable: false; removeAriaLabel?: never; onRemove?: never }\n )\n\nconst hasPressEvent = (props: object): boolean => {\n if ('onClick' in props && props.onClick != null) return true\n if ('onPress' in props && props.onPress != null) return true\n\n return false\n}\n\nexport const Chip = React.forwardRef<ElementRef<'div' | 'button'>, ChipProps>(\n (props, forwardRef) => {\n const {\n children,\n removable = true,\n onRemove,\n removeAriaLabel,\n loading = false,\n size = DEFAULT_SIZE,\n variant = 'default',\n disabled,\n ...restProps\n } = props\n\n const pressable = hasPressEvent(restProps)\n const isLoading = pressable && loading\n\n let spinnerSize: SpinnerProps['size'] = 'medium'\n\n if (typeof size === 'string' && ['small', 'medium'].includes(size)) {\n spinnerSize = 'small'\n }\n\n const content = (\n <>\n {isLoading && (\n <StyledSpinnerBox\n aria-hidden\n data-testid={\n process.env.NODE_ENV === 'test' ? 'chip-spinner' : undefined\n }\n >\n <Spinner size={spinnerSize} />\n </StyledSpinnerBox>\n )}\n <StyledChipContent\n data-chip-content=''\n loading={isLoading || undefined}\n >\n {children}\n </StyledChipContent>\n {!pressable && removable && (\n <StyledChipButton\n type='button'\n disabled={disabled === true || undefined}\n onClick={onRemove}\n aria-label={removeAriaLabel}\n >\n <IconCross size='small' />\n </StyledChipButton>\n )}\n </>\n )\n\n if (pressable) {\n return (\n <StyledPressableChip\n type='button'\n {...(restProps as BaseButtonProps)}\n size={size}\n variant={variant}\n disabled={disabled === true || undefined}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledPressableChip>>}\n aria-busy={isLoading || undefined}\n aria-disabled={isLoading || undefined}\n >\n {content}\n </StyledPressableChip>\n )\n }\n\n return (\n <StyledChip\n {...(restProps as StyledChipProps)}\n size={size}\n variant={variant}\n disabled={disabled}\n ref={forwardRef as React.Ref<ElementRef<typeof StyledChip>>}\n >\n {content}\n </StyledChip>\n )\n }\n) as ForwardRefExoticComponent<ChipProps> & Partials\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n}\n\nChip.IconSlot = IconSlot\n"],"names":[],"mappings":";;;;;;;;;AAIO,MAAM,cAAA,GAAiB,MAAA,CAAO,SAAA,CAAU,IAAA,EAAM;AAAA,EACnD,OAAA,EAAS,aAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA,EACZ,cAAA,EAAgB,QAAA;AAAA,EAChB,UAAA,EAAY,CAAA;AAAA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,aAAA,EAAe,KAAA;AAAA,EACf,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,OAAA;AAAA,IACT,MAAA,EAAQ,EAAA;AAAA,IACR,YAAA,EAAc,QAAA;AAAA,IACd,SAAA,EAAW;AAAA;AAEf,CAAC,CAAA;;ACRD,MAAM,YAAA,GAAe,CAAA;AAOd,MAAM,YAAA,GAAe,OAAA;AAE5B,MAAM,WAAA,GAAc,CAAC,IAAA,MAAuB;AAAA,EAC1C,CAAC,IAAA,CAAK,MAAA,CAAA,cAAA,EAAc,MAAA,CAAM,GAAG;AAAA,IAC3B,MAAA,EAAQ;AAAA;AAEZ,CAAA,CAAA;AAEA,MAAM,UAAA,GAAa;AAAA,EACjB,YAAA,EAAc,QAAA;AAAA,EACd,OAAA,EAAS,aAAA;AAAA,EACT,UAAA,EAAY,QAAA;AAAA;AAAA,EAEZ,GAAA,EAAK,MAAA;AAAA,EACL,KAAA,EAAO,aAAA;AAAA,EACP,QAAA,EAAU,MAAA;AAAA,EACV,UAAA,EAAY,CAAA;AAAA,EACZ,SAAA,EAAW,YAAA;AAAA,EACX,MAAA,EAAQ,uBAAA;AAAA,EACR,UAAA,EAAY,GAAA;AAAA;AAA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A;AAAA,UAC/B,GAAA,EAAK,UAAA;AAAA,UACL,aAAW,SAAA,IAAa,MAAA;AAAA,UACxB,iBAAe,SAAA,IAAa,MAAA;AAAA,UAE3B,QAAA,EAAA;AAAA;AAAA,OACH;AAAA,IAEJ;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACE,GAAI,SAAA;AAAA,QACL,IAAA;AAAA,QACA,OAAA;AAAA,QACA,QAAA;AAAA,QACA,GAAA,EAAK,UAAA;AAAA,QAEJ,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;AAMA,IAAA,CAAK,QAAA,GAAW,QAAA;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -26,12 +26,12 @@ type TransformProps<Props, Media> = {
|
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
declare const StyledChip: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, "
|
|
30
|
-
variant?: "
|
|
29
|
+
declare const StyledChip: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, "size" | "disabled" | "variant"> & TransformProps<{
|
|
30
|
+
variant?: "outline" | "default" | undefined;
|
|
31
31
|
disabled?: boolean | "true" | undefined;
|
|
32
32
|
size?: "small" | "medium" | "large" | "x-large" | undefined;
|
|
33
33
|
}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {
|
|
34
|
-
variant?: "
|
|
34
|
+
variant?: "outline" | "default" | undefined;
|
|
35
35
|
disabled?: boolean | "true" | undefined;
|
|
36
36
|
size?: "small" | "medium" | "large" | "x-large" | undefined;
|
|
37
37
|
}, {}>;
|
|
@@ -46,9 +46,10 @@ declare const IconSlot: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design
|
|
|
46
46
|
|
|
47
47
|
type ChipProps = Omit<StyledChipProps, 'ref' | 'size' | 'variant' | 'disabled'> & Pick<BaseButtonProps, 'onPress'> & RefAttributes<HTMLDivElement | HTMLButtonElement> & {
|
|
48
48
|
/**
|
|
49
|
-
* Change the chip size. Same scale as Button
|
|
50
|
-
* `
|
|
51
|
-
*
|
|
49
|
+
* Change the chip size. Same scale as Button, but defaults to `small` where
|
|
50
|
+
* Button defaults to `medium`, so chips written before the scale existed keep
|
|
51
|
+
* their height.
|
|
52
|
+
* @default 'small'
|
|
52
53
|
*/
|
|
53
54
|
size?: StyledChipProps['size'];
|
|
54
55
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirohq/design-system-chip",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Miro",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@mirohq/design-system-base-button": "^1.2.38",
|
|
30
|
-
"@mirohq/design-system-
|
|
31
|
-
"@mirohq/design-system-spinner": "^2.2.35",
|
|
30
|
+
"@mirohq/design-system-icons": "^1.47.0",
|
|
32
31
|
"@mirohq/design-system-primitive": "^2.2.1",
|
|
33
|
-
"@mirohq/design-system-
|
|
32
|
+
"@mirohq/design-system-spinner": "^2.2.35",
|
|
33
|
+
"@mirohq/design-system-stitches": "^3.3.33",
|
|
34
34
|
"@mirohq/design-system-styles": "^3.2.33"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|