@mirohq/design-system-patterns 1.3.15 → 1.4.0-filter-chip.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -7,6 +7,11 @@ var designSystemBox = require('@mirohq/design-system-box');
7
7
  var designSystemButton = require('@mirohq/design-system-button');
8
8
  var designSystemTypography = require('@mirohq/design-system-typography');
9
9
  var designSystemExperiments = require('@mirohq/design-system-experiments');
10
+ var designSystemChip = require('@mirohq/design-system-chip');
11
+ var designSystemIcons = require('@mirohq/design-system-icons');
12
+ var designSystemPrimitive = require('@mirohq/design-system-primitive');
13
+ var designSystemUtils = require('@mirohq/design-system-utils');
14
+ var designSystemBaseIcon = require('@mirohq/design-system-base-icon');
10
15
 
11
16
  const Container = designSystemStitches.styled(designSystemBox.Box, {
12
17
  background: "transparent",
@@ -59,5 +64,129 @@ const PatternEmptyState = React.forwardRef(({ heading, description, illustration
59
64
  ] });
60
65
  });
61
66
 
67
+ const activeShell = {
68
+ // Chip is filled; drop the fill so an applied filter reads as an
69
+ // outline (border + text carry the state).
70
+ backgroundColor: "transparent",
71
+ borderColor: "$border-primary",
72
+ color: "$text-primary"
73
+ };
74
+ const StyledFilterChip = designSystemStitches.styled(designSystemChip.Chip, {
75
+ position: "relative",
76
+ overflow: "visible",
77
+ boxSizing: "border-box",
78
+ borderStyle: "solid",
79
+ borderWidth: "$sm",
80
+ borderColor: "transparent",
81
+ marginTop: "$100",
82
+ // Chip truncates this box; open it so the floating label can poke out.
83
+ "& > [data-chip-content]": {
84
+ overflow: "visible"
85
+ },
86
+ variants: {
87
+ active: {
88
+ true: {
89
+ "&&": activeShell
90
+ }
91
+ }
92
+ }
93
+ });
94
+ const StyledFloatingLabel = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
95
+ position: "absolute",
96
+ top: "-$100",
97
+ left: "$100",
98
+ paddingInline: "2px",
99
+ fontSize: "$125",
100
+ fontWeight: "$regular",
101
+ lineHeight: 1.5,
102
+ color: "$text-primary",
103
+ // Mask the stroke with the surface the chip sits on so the name reads as a
104
+ // notch in the outline. Consumers can set `--filter-surface` on any ancestor
105
+ // (e.g. a gray filter bar) so the notch blends with it; otherwise it falls
106
+ // back to the theme surface (white in light, dark surface in dark mode).
107
+ backgroundColor: "var(--filter-surface, var(--colors-background-surface))",
108
+ borderRadius: "$round",
109
+ pointerEvents: "none",
110
+ whiteSpace: "nowrap"
111
+ });
112
+ const StyledLabel = designSystemStitches.styled(designSystemPrimitive.Primitive.span, {
113
+ overflow: "hidden",
114
+ whiteSpace: "nowrap",
115
+ textOverflow: "ellipsis",
116
+ paddingInline: "2px",
117
+ lineHeight: 1.5
118
+ });
119
+
120
+ const FilterChipContext = React.createContext({
121
+ activated: false,
122
+ value: void 0
123
+ });
124
+ const FilterChipProvider = ({
125
+ children,
126
+ activated,
127
+ value
128
+ }) => {
129
+ const context = React.useMemo(() => ({ activated, value }), [activated, value]);
130
+ return /* @__PURE__ */ jsxRuntime.jsx(FilterChipContext.Provider, { value: context, children });
131
+ };
132
+ const useFilterChipContext = () => React.useContext(FilterChipContext);
133
+
134
+ const IconSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
135
+ const formattedChildren = designSystemUtils.addPropsToChildren(
136
+ children,
137
+ (child) => designSystemBaseIcon.isIconComponent(child),
138
+ {
139
+ size: "small",
140
+ weight: "thin"
141
+ }
142
+ );
143
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystemChip.Chip.ImageSlot, { ...restProps, ref: forwardRef, children: formattedChildren });
144
+ });
145
+ IconSlot.displayName = "FilterChip.IconSlot";
146
+
147
+ const Label = React.forwardRef(({ children, ...restProps }, forwardRef) => {
148
+ const { activated, value } = useFilterChipContext();
149
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
150
+ activated && /* @__PURE__ */ jsxRuntime.jsx(StyledFloatingLabel, { children }),
151
+ /* @__PURE__ */ jsxRuntime.jsx(StyledLabel, { ...restProps, ref: forwardRef, children: activated && value != null ? value : children })
152
+ ] });
153
+ });
154
+ Label.displayName = "FilterChip.Label";
155
+
156
+ const noopPress = () => void 0;
157
+ const FilterChip = React.forwardRef(
158
+ ({
159
+ value,
160
+ active,
161
+ loading = false,
162
+ disabled = false,
163
+ onPress,
164
+ children,
165
+ ...restProps
166
+ }, forwardRef) => {
167
+ const isActive = active != null ? active : value !== void 0 && value !== null && value !== "";
168
+ return /* @__PURE__ */ jsxRuntime.jsx(FilterChipProvider, { activated: isActive, value, children: /* @__PURE__ */ jsxRuntime.jsxs(
169
+ StyledFilterChip,
170
+ {
171
+ ...restProps,
172
+ ref: forwardRef,
173
+ removable: false,
174
+ loading,
175
+ disabled,
176
+ active: isActive,
177
+ onPress: onPress != null ? onPress : noopPress,
178
+ children: [
179
+ children,
180
+ /* @__PURE__ */ jsxRuntime.jsx(designSystemChip.Chip.ImageSlot, { "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconChevronDown, { size: "small" }) })
181
+ ]
182
+ }
183
+ ) });
184
+ }
185
+ );
186
+ FilterChip.IconSlot = IconSlot;
187
+ FilterChip.Label = Label;
188
+ FilterChip.displayName = "FilterChip";
189
+
190
+ exports.FilterChip = FilterChip;
62
191
  exports.PatternEmptyState = PatternEmptyState;
63
192
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/empty-state/empty-state.tsx"],"sourcesContent":["import React from 'react'\nimport type { ReactNode, ElementRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Box } from '@mirohq/design-system-box'\nimport { Button } from '@mirohq/design-system-button'\nimport type { ButtonProps } from '@mirohq/design-system-button'\nimport type { BoxProps } from '@mirohq/design-system-box'\nimport { Heading } from '@mirohq/design-system-typography'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\n// Types\n// -----------------------------------------------------------------------------\nexport interface PatternEmptyStateProps extends Omit<BoxProps, 'children'> {\n heading?: ReactNode\n description?: ReactNode\n illustration?: string\n actions?: {\n primary: ActionButton & {\n variant?: 'primary' | 'secondary'\n }\n secondary?: ActionButton\n }\n}\n\ntype BaseActionButtonProps = Omit<ButtonProps, 'children'> & {\n label: ReactNode\n}\n\ntype ActionButton = Omit<BaseActionButtonProps, 'variant'>\n\n// Styled\n// -----------------------------------------------------------------------------\nconst Container = styled(Box, {\n background: 'transparent',\n padding: '$500',\n display: 'flex',\n flexDirection: 'column',\n minWidth: '304px',\n maxWidth: '480px',\n textAlign: 'center',\n alignItems: 'center',\n})\n\nconst Illustration = styled('img', {\n width: '72px',\n minHeight: '72px',\n display: 'block',\n marginBottom: '$150',\n})\n\nconst Description = styled(Box, {\n color: '$text-neutrals-subtle',\n marginTop: '$100',\n maxWidth: '304px',\n})\n\nconst Actions = styled(Box, {\n marginTop: '$150',\n paddingY: '$200',\n display: 'flex',\n flexDirection: 'column',\n gap: '$100',\n alignItems: 'center',\n})\n\nconst BaseActionButton = React.forwardRef<\n ElementRef<typeof Button>,\n BaseActionButtonProps\n>(({ label, ...actionProps }, ref) => (\n <Button ref={ref} {...actionProps}>\n {label}\n </Button>\n))\n\n// Component\n// -----------------------------------------------------------------------------\nexport const PatternEmptyState = React.forwardRef<\n ElementRef<typeof Box>,\n PatternEmptyStateProps\n>(({ heading, description, illustration, actions, ...restProps }, ref) => {\n const [isCanvas26] = useCanvas26()\n\n return (\n <Container ref={ref} {...restProps}>\n {illustration != null && !isCanvas26 && (\n <Illustration src={illustration} aria-hidden alt='' />\n )}\n {heading != null && (\n <Heading\n ref={ref}\n level={2}\n {...(isCanvas26\n ? { css: { fontFamily: '$display', fontSize: '$350' } }\n : { styledAs: 'h3' })}\n >\n {heading}\n </Heading>\n )}\n {description != null && (\n <Description css={{ color: '$text-neutrals-subtle' }}>\n {description}\n </Description>\n )}\n {actions != null && (\n <Actions>\n <BaseActionButton variant='primary' {...actions.primary} />\n\n {actions.secondary != null && (\n <BaseActionButton {...actions.secondary} variant='ghost' />\n )}\n </Actions>\n )}\n </Container>\n )\n})\n"],"names":["styled","Box","Button","useCanvas26","jsxs","jsx","Heading"],"mappings":";;;;;;;;;;AAgCA,MAAM,SAAA,GAAYA,4BAAOC,mBAAA,EAAK;AAAA,EAC5B,UAAA,EAAY,aAAA;AAAA,EACZ,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,QAAA,EAAU,OAAA;AAAA,EACV,QAAA,EAAU,OAAA;AAAA,EACV,SAAA,EAAW,QAAA;AAAA,EACX,UAAA,EAAY;AACd,CAAC,CAAA;AAED,MAAM,YAAA,GAAeD,4BAAO,KAAA,EAAO;AAAA,EACjC,KAAA,EAAO,MAAA;AAAA,EACP,SAAA,EAAW,MAAA;AAAA,EACX,OAAA,EAAS,OAAA;AAAA,EACT,YAAA,EAAc;AAChB,CAAC,CAAA;AAED,MAAM,WAAA,GAAcA,4BAAOC,mBAAA,EAAK;AAAA,EAC9B,KAAA,EAAO,uBAAA;AAAA,EACP,SAAA,EAAW,MAAA;AAAA,EACX,QAAA,EAAU;AACZ,CAAC,CAAA;AAED,MAAM,OAAA,GAAUD,4BAAOC,mBAAA,EAAK;AAAA,EAC1B,SAAA,EAAW,MAAA;AAAA,EACX,QAAA,EAAU,MAAA;AAAA,EACV,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,GAAA,EAAK,MAAA;AAAA,EACL,UAAA,EAAY;AACd,CAAC,CAAA;AAED,MAAM,mBAAmB,KAAA,CAAM,UAAA,CAG7B,CAAC,EAAE,OAAO,GAAG,WAAA,EAAY,EAAG,GAAA,oCAC3BC,yBAAA,EAAA,EAAO,GAAA,EAAW,GAAG,WAAA,EACnB,iBACH,CACD,CAAA;AAIM,MAAM,iBAAA,GAAoB,KAAA,CAAM,UAAA,CAGrC,CAAC,EAAE,OAAA,EAAS,WAAA,EAAa,YAAA,EA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../src/filter-chip/hooks/use-filter-chip-context.tsx","../src/filter-chip/partials/icon-slot.tsx","../src/filter-chip/partials/label.tsx","../src/filter-chip/filter-chip.tsx"],"sourcesContent":["import React from 'react'\nimport type { ReactNode, ElementRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Box } from '@mirohq/design-system-box'\nimport { Button } from '@mirohq/design-system-button'\nimport type { ButtonProps } from '@mirohq/design-system-button'\nimport type { BoxProps } from '@mirohq/design-system-box'\nimport { Heading } from '@mirohq/design-system-typography'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\n// Types\n// -----------------------------------------------------------------------------\nexport interface PatternEmptyStateProps extends Omit<BoxProps, 'children'> {\n heading?: ReactNode\n description?: ReactNode\n illustration?: string\n actions?: {\n primary: ActionButton & {\n variant?: 'primary' | 'secondary'\n }\n secondary?: ActionButton\n }\n}\n\ntype BaseActionButtonProps = Omit<ButtonProps, 'children'> & {\n label: ReactNode\n}\n\ntype ActionButton = Omit<BaseActionButtonProps, 'variant'>\n\n// Styled\n// -----------------------------------------------------------------------------\nconst Container = styled(Box, {\n background: 'transparent',\n padding: '$500',\n display: 'flex',\n flexDirection: 'column',\n minWidth: '304px',\n maxWidth: '480px',\n textAlign: 'center',\n alignItems: 'center',\n})\n\nconst Illustration = styled('img', {\n width: '72px',\n minHeight: '72px',\n display: 'block',\n marginBottom: '$150',\n})\n\nconst Description = styled(Box, {\n color: '$text-neutrals-subtle',\n marginTop: '$100',\n maxWidth: '304px',\n})\n\nconst Actions = styled(Box, {\n marginTop: '$150',\n paddingY: '$200',\n display: 'flex',\n flexDirection: 'column',\n gap: '$100',\n alignItems: 'center',\n})\n\nconst BaseActionButton = React.forwardRef<\n ElementRef<typeof Button>,\n BaseActionButtonProps\n>(({ label, ...actionProps }, ref) => (\n <Button ref={ref} {...actionProps}>\n {label}\n </Button>\n))\n\n// Component\n// -----------------------------------------------------------------------------\nexport const PatternEmptyState = React.forwardRef<\n ElementRef<typeof Box>,\n PatternEmptyStateProps\n>(({ heading, description, illustration, actions, ...restProps }, ref) => {\n const [isCanvas26] = useCanvas26()\n\n return (\n <Container ref={ref} {...restProps}>\n {illustration != null && !isCanvas26 && (\n <Illustration src={illustration} aria-hidden alt='' />\n )}\n {heading != null && (\n <Heading\n ref={ref}\n level={2}\n {...(isCanvas26\n ? { css: { fontFamily: '$display', fontSize: '$350' } }\n : { styledAs: 'h3' })}\n >\n {heading}\n </Heading>\n )}\n {description != null && (\n <Description css={{ color: '$text-neutrals-subtle' }}>\n {description}\n </Description>\n )}\n {actions != null && (\n <Actions>\n <BaseActionButton variant='primary' {...actions.primary} />\n\n {actions.secondary != null && (\n <BaseActionButton {...actions.secondary} variant='ghost' />\n )}\n </Actions>\n )}\n </Container>\n )\n})\n","import { Chip } from '@mirohq/design-system-chip'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nconst activeShell = {\n // Chip is filled; drop the fill so an applied filter reads as an\n // outline (border + text carry the state).\n backgroundColor: 'transparent',\n borderColor: '$border-primary',\n color: '$text-primary',\n}\n\nexport const StyledFilterChip = styled(Chip, {\n position: 'relative',\n overflow: 'visible',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: '$sm',\n borderColor: 'transparent',\n marginTop: '$100',\n // Chip truncates this box; open it so the floating label can poke out.\n '& > [data-chip-content]': {\n overflow: 'visible',\n },\n variants: {\n active: {\n true: {\n '&&': activeShell,\n },\n },\n },\n})\n\nexport const StyledFloatingLabel = styled(Primitive.span, {\n position: 'absolute',\n top: '-$100',\n left: '$100',\n paddingInline: '2px',\n fontSize: '$125',\n fontWeight: '$regular',\n lineHeight: 1.5,\n color: '$text-primary',\n // Mask the stroke with the surface the chip sits on so the name reads as a\n // notch in the outline. Consumers can set `--filter-surface` on any ancestor\n // (e.g. a gray filter bar) so the notch blends with it; otherwise it falls\n // back to the theme surface (white in light, dark surface in dark mode).\n backgroundColor: 'var(--filter-surface, var(--colors-background-surface))',\n borderRadius: '$round',\n pointerEvents: 'none',\n whiteSpace: 'nowrap',\n})\n\nexport const StyledLabel = styled(Primitive.span, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n paddingInline: '2px',\n lineHeight: 1.5,\n})\n\nexport type StyledLabelProps = StrictComponentProps<typeof StyledLabel>\n","import { createContext, useContext, useMemo } from 'react'\nimport type { ReactNode } from 'react'\n\ninterface FilterChipContextProps {\n activated: boolean\n value: ReactNode\n}\n\nexport interface FilterChipProviderProps extends FilterChipContextProps {\n children: ReactNode\n}\n\nconst FilterChipContext = createContext<FilterChipContextProps>({\n activated: false,\n value: undefined,\n})\n\nexport const FilterChipProvider = ({\n children,\n activated,\n value,\n}: FilterChipProviderProps): JSX.Element => {\n const context = useMemo(() => ({ activated, value }), [activated, value])\n\n return (\n <FilterChipContext.Provider value={context}>\n {children}\n </FilterChipContext.Provider>\n )\n}\n\nexport const useFilterChipContext = (): FilterChipContextProps =>\n useContext(FilterChipContext)\n","import type { ElementRef, ReactNode } from 'react'\nimport React from 'react'\nimport { Chip } from '@mirohq/design-system-chip'\nimport type { ChipImageSlotProps } from '@mirohq/design-system-chip'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport type { IconReactElement } from '@mirohq/design-system-base-icon'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\n\nexport interface IconSlotProps extends Omit<ChipImageSlotProps, 'children'> {\n /**\n * The leading icon.\n */\n children: ReactNode\n}\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof Chip.ImageSlot>,\n IconSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const formattedChildren = addPropsToChildren(\n children,\n child => isIconComponent(child as IconReactElement),\n {\n size: 'small',\n weight: 'thin',\n }\n )\n\n return (\n <Chip.ImageSlot {...restProps} ref={forwardRef}>\n {formattedChildren}\n </Chip.ImageSlot>\n )\n})\n\nIconSlot.displayName = 'FilterChip.IconSlot'\n","import type { ElementRef, ReactNode } from 'react'\nimport React from 'react'\n\nimport { StyledFloatingLabel, StyledLabel } from '../filter-chip.styled'\nimport type { StyledLabelProps } from '../filter-chip.styled'\nimport { useFilterChipContext } from '../hooks/use-filter-chip-context'\n\nexport interface LabelProps extends Omit<StyledLabelProps, 'children'> {\n /**\n * The filter's name, e.g. \"Board owner\".\n */\n children: ReactNode\n}\n\n/**\n * The filter's name. Shown as the chip's text when idle; once the filter is\n * activated it floats above the `value` summary, which takes its place in the\n * body.\n */\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(({ children, ...restProps }, forwardRef) => {\n const { activated, value } = useFilterChipContext()\n\n return (\n <>\n {activated && <StyledFloatingLabel>{children}</StyledFloatingLabel>}\n <StyledLabel {...restProps} ref={forwardRef}>\n {activated && value != null ? value : children}\n </StyledLabel>\n </>\n )\n})\n\nLabel.displayName = 'FilterChip.Label'\n","import React from 'react'\nimport type {\n ElementRef,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n} from 'react'\nimport { Chip } from '@mirohq/design-system-chip'\nimport type { ChipProps } from '@mirohq/design-system-chip'\nimport { IconChevronDown } from '@mirohq/design-system-icons'\n\nimport { StyledFilterChip } from './filter-chip.styled'\nimport { FilterChipProvider } from './hooks/use-filter-chip-context'\nimport { IconSlot } from './partials/icon-slot'\nimport { Label } from './partials/label'\n\n// Always-on press handler so Chip renders as a BaseButton even when the\n// consumer hasn't passed onPress (e.g. Combobox.Trigger asChild supplies it).\nconst noopPress = (): void => undefined\n\nexport type FilterChipProps = Omit<\n ChipProps,\n 'removable' | 'onRemove' | 'removeAriaLabel' | 'children' | 'value' | 'ref'\n> &\n RefAttributes<HTMLButtonElement> & {\n /**\n * The chip's anatomy: a `FilterChip.Label` with the filter's name, plus an\n * optional leading `FilterChip.IconSlot`.\n */\n children: ReactNode\n\n /**\n * A short summary of the current selection, e.g. \"Active +2\". When present\n * (or when `active` is set) the name floats above this summary.\n */\n value?: ReactNode\n\n /**\n * Force the active state. Defaults to whether `value` is set.\n */\n active?: boolean\n }\n\n/**\n * FilterChip is a Chip-based trigger for filters. The filter's name goes in a\n * `FilterChip.Label`, optionally alongside a `FilterChip.IconSlot`. It shows\n * the name when idle, and floats it above a `value` summary once active,\n * with a trailing chevron.\n *\n * It renders a single `<button>` (a pressable Chip) with no overlay of its own,\n * so it is meant to drive a `Combobox` (or any overlay) via\n * `Combobox.Trigger asChild`. `loading` is Chip's loading state.\n *\n * @experimental Beta — the API may still change while teams adopt it.\n */\nexport const FilterChip = React.forwardRef<\n ElementRef<'button'>,\n FilterChipProps\n>(\n (\n {\n value,\n active,\n loading = false,\n disabled = false,\n onPress,\n children,\n ...restProps\n },\n forwardRef\n ) => {\n const isActive =\n active ?? (value !== undefined && value !== null && value !== '')\n\n return (\n <FilterChipProvider activated={isActive} value={value}>\n <StyledFilterChip\n {...restProps}\n ref={forwardRef as React.Ref<HTMLDivElement | HTMLButtonElement>}\n removable={false}\n loading={loading}\n disabled={disabled}\n active={isActive}\n onPress={onPress ?? noopPress}\n >\n {children}\n\n <Chip.ImageSlot aria-hidden>\n <IconChevronDown size='small' />\n </Chip.ImageSlot>\n </StyledFilterChip>\n </FilterChipProvider>\n )\n }\n) as ForwardRefExoticComponent<FilterChipProps> & Partials\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n Label: typeof Label\n}\n\nFilterChip.IconSlot = IconSlot\nFilterChip.Label = Label\nFilterChip.displayName = 'FilterChip'\n"],"names":["styled","Box","Button","useCanvas26","jsxs","jsx","Heading","Chip","Primitive","createContext","useMemo","useContext","addPropsToChildren","isIconComponent","Fragment","IconChevronDown"],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAYA,4BAAOC,mBAAA,EAAK;AAAA,EAC5B,UAAA,EAAY,aAAA;AAAA,EACZ,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,Q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AA,EAI9B,CACE;AAAA,IACE,KAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA,GAAU,KAAA;AAAA,IACV,QAAA,GAAW,KAAA;AAAA,IACX,OAAA;AAAA,IACA,QAAA;AAAA,IACA,GAAG;AAAA,KAEL,UAAA,KACG;AACH,IAAA,MAAM,WACJ,MAAA,IAAA,IAAA,GAAA,MAAA,GAAW,KAAA,KAAU,MAAA,IAAa,KAAA,KAAU,QAAQ,KAAA,KAAU,EAAA;AAEhE,IAAA,uBACEA,cAAA,CAAC,kBAAA,EAAA,EAAmB,SAAA,EAAW,QAAA,EAAU,KAAA,EACvC,QAAA,kBAAAD,eAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACE,GAAG,SAAA;AAAA,QACJ,GAAA,EAAK,UAAA;AAAA,QACL,SAAA,EAAW,KAAA;AAAA,QACX,OAAA;AAAA,QACA,QAAA;AAAA,QACA,MAAA,EAAQ,QAAA;AAAA,QACR,SAAS,OAAA,IAAA,IAAA,GAAA,OAAA,GAAW,SAAA;AAAA,QAEnB,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,0BAEDC,cAAA,CAACE,qBAAA,CAAK,SAAA,EAAL,EAAe,aAAA,EAAW,MACzB,QAAA,kBAAAF,cAAA,CAACU,iCAAA,EAAA,EAAgB,IAAA,EAAK,OAAA,EAAQ,CAAA,EAChC;AAAA;AAAA;AAAA,KACF,EACF,CAAA;AAAA,EAEJ;AACF;AAOA,UAAA,CAAW,QAAA,GAAW,QAAA;AACtB,UAAA,CAAW,KAAA,GAAQ,KAAA;AACnB,UAAA,CAAW,WAAA,GAAc,YAAA;;;;;"}
package/dist/module.js CHANGED
@@ -1,10 +1,15 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import React from 'react';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import React, { createContext, useContext, useMemo } from 'react';
3
3
  import { styled } from '@mirohq/design-system-stitches';
4
4
  import { Box } from '@mirohq/design-system-box';
5
5
  import { Button } from '@mirohq/design-system-button';
6
6
  import { Heading } from '@mirohq/design-system-typography';
7
7
  import { useCanvas26 } from '@mirohq/design-system-experiments';
8
+ import { Chip } from '@mirohq/design-system-chip';
9
+ import { IconChevronDown } from '@mirohq/design-system-icons';
10
+ import { Primitive } from '@mirohq/design-system-primitive';
11
+ import { addPropsToChildren } from '@mirohq/design-system-utils';
12
+ import { isIconComponent } from '@mirohq/design-system-base-icon';
8
13
 
9
14
  const Container = styled(Box, {
10
15
  background: "transparent",
@@ -57,5 +62,128 @@ const PatternEmptyState = React.forwardRef(({ heading, description, illustration
57
62
  ] });
58
63
  });
59
64
 
60
- export { PatternEmptyState };
65
+ const activeShell = {
66
+ // Chip is filled; drop the fill so an applied filter reads as an
67
+ // outline (border + text carry the state).
68
+ backgroundColor: "transparent",
69
+ borderColor: "$border-primary",
70
+ color: "$text-primary"
71
+ };
72
+ const StyledFilterChip = styled(Chip, {
73
+ position: "relative",
74
+ overflow: "visible",
75
+ boxSizing: "border-box",
76
+ borderStyle: "solid",
77
+ borderWidth: "$sm",
78
+ borderColor: "transparent",
79
+ marginTop: "$100",
80
+ // Chip truncates this box; open it so the floating label can poke out.
81
+ "& > [data-chip-content]": {
82
+ overflow: "visible"
83
+ },
84
+ variants: {
85
+ active: {
86
+ true: {
87
+ "&&": activeShell
88
+ }
89
+ }
90
+ }
91
+ });
92
+ const StyledFloatingLabel = styled(Primitive.span, {
93
+ position: "absolute",
94
+ top: "-$100",
95
+ left: "$100",
96
+ paddingInline: "2px",
97
+ fontSize: "$125",
98
+ fontWeight: "$regular",
99
+ lineHeight: 1.5,
100
+ color: "$text-primary",
101
+ // Mask the stroke with the surface the chip sits on so the name reads as a
102
+ // notch in the outline. Consumers can set `--filter-surface` on any ancestor
103
+ // (e.g. a gray filter bar) so the notch blends with it; otherwise it falls
104
+ // back to the theme surface (white in light, dark surface in dark mode).
105
+ backgroundColor: "var(--filter-surface, var(--colors-background-surface))",
106
+ borderRadius: "$round",
107
+ pointerEvents: "none",
108
+ whiteSpace: "nowrap"
109
+ });
110
+ const StyledLabel = styled(Primitive.span, {
111
+ overflow: "hidden",
112
+ whiteSpace: "nowrap",
113
+ textOverflow: "ellipsis",
114
+ paddingInline: "2px",
115
+ lineHeight: 1.5
116
+ });
117
+
118
+ const FilterChipContext = createContext({
119
+ activated: false,
120
+ value: void 0
121
+ });
122
+ const FilterChipProvider = ({
123
+ children,
124
+ activated,
125
+ value
126
+ }) => {
127
+ const context = useMemo(() => ({ activated, value }), [activated, value]);
128
+ return /* @__PURE__ */ jsx(FilterChipContext.Provider, { value: context, children });
129
+ };
130
+ const useFilterChipContext = () => useContext(FilterChipContext);
131
+
132
+ const IconSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
133
+ const formattedChildren = addPropsToChildren(
134
+ children,
135
+ (child) => isIconComponent(child),
136
+ {
137
+ size: "small",
138
+ weight: "thin"
139
+ }
140
+ );
141
+ return /* @__PURE__ */ jsx(Chip.ImageSlot, { ...restProps, ref: forwardRef, children: formattedChildren });
142
+ });
143
+ IconSlot.displayName = "FilterChip.IconSlot";
144
+
145
+ const Label = React.forwardRef(({ children, ...restProps }, forwardRef) => {
146
+ const { activated, value } = useFilterChipContext();
147
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
148
+ activated && /* @__PURE__ */ jsx(StyledFloatingLabel, { children }),
149
+ /* @__PURE__ */ jsx(StyledLabel, { ...restProps, ref: forwardRef, children: activated && value != null ? value : children })
150
+ ] });
151
+ });
152
+ Label.displayName = "FilterChip.Label";
153
+
154
+ const noopPress = () => void 0;
155
+ const FilterChip = React.forwardRef(
156
+ ({
157
+ value,
158
+ active,
159
+ loading = false,
160
+ disabled = false,
161
+ onPress,
162
+ children,
163
+ ...restProps
164
+ }, forwardRef) => {
165
+ const isActive = active != null ? active : value !== void 0 && value !== null && value !== "";
166
+ return /* @__PURE__ */ jsx(FilterChipProvider, { activated: isActive, value, children: /* @__PURE__ */ jsxs(
167
+ StyledFilterChip,
168
+ {
169
+ ...restProps,
170
+ ref: forwardRef,
171
+ removable: false,
172
+ loading,
173
+ disabled,
174
+ active: isActive,
175
+ onPress: onPress != null ? onPress : noopPress,
176
+ children: [
177
+ children,
178
+ /* @__PURE__ */ jsx(Chip.ImageSlot, { "aria-hidden": true, children: /* @__PURE__ */ jsx(IconChevronDown, { size: "small" }) })
179
+ ]
180
+ }
181
+ ) });
182
+ }
183
+ );
184
+ FilterChip.IconSlot = IconSlot;
185
+ FilterChip.Label = Label;
186
+ FilterChip.displayName = "FilterChip";
187
+
188
+ export { FilterChip, PatternEmptyState };
61
189
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../src/empty-state/empty-state.tsx"],"sourcesContent":["import React from 'react'\nimport type { ReactNode, ElementRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Box } from '@mirohq/design-system-box'\nimport { Button } from '@mirohq/design-system-button'\nimport type { ButtonProps } from '@mirohq/design-system-button'\nimport type { BoxProps } from '@mirohq/design-system-box'\nimport { Heading } from '@mirohq/design-system-typography'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\n// Types\n// -----------------------------------------------------------------------------\nexport interface PatternEmptyStateProps extends Omit<BoxProps, 'children'> {\n heading?: ReactNode\n description?: ReactNode\n illustration?: string\n actions?: {\n primary: ActionButton & {\n variant?: 'primary' | 'secondary'\n }\n secondary?: ActionButton\n }\n}\n\ntype BaseActionButtonProps = Omit<ButtonProps, 'children'> & {\n label: ReactNode\n}\n\ntype ActionButton = Omit<BaseActionButtonProps, 'variant'>\n\n// Styled\n// -----------------------------------------------------------------------------\nconst Container = styled(Box, {\n background: 'transparent',\n padding: '$500',\n display: 'flex',\n flexDirection: 'column',\n minWidth: '304px',\n maxWidth: '480px',\n textAlign: 'center',\n alignItems: 'center',\n})\n\nconst Illustration = styled('img', {\n width: '72px',\n minHeight: '72px',\n display: 'block',\n marginBottom: '$150',\n})\n\nconst Description = styled(Box, {\n color: '$text-neutrals-subtle',\n marginTop: '$100',\n maxWidth: '304px',\n})\n\nconst Actions = styled(Box, {\n marginTop: '$150',\n paddingY: '$200',\n display: 'flex',\n flexDirection: 'column',\n gap: '$100',\n alignItems: 'center',\n})\n\nconst BaseActionButton = React.forwardRef<\n ElementRef<typeof Button>,\n BaseActionButtonProps\n>(({ label, ...actionProps }, ref) => (\n <Button ref={ref} {...actionProps}>\n {label}\n </Button>\n))\n\n// Component\n// -----------------------------------------------------------------------------\nexport const PatternEmptyState = React.forwardRef<\n ElementRef<typeof Box>,\n PatternEmptyStateProps\n>(({ heading, description, illustration, actions, ...restProps }, ref) => {\n const [isCanvas26] = useCanvas26()\n\n return (\n <Container ref={ref} {...restProps}>\n {illustration != null && !isCanvas26 && (\n <Illustration src={illustration} aria-hidden alt='' />\n )}\n {heading != null && (\n <Heading\n ref={ref}\n level={2}\n {...(isCanvas26\n ? { css: { fontFamily: '$display', fontSize: '$350' } }\n : { styledAs: 'h3' })}\n >\n {heading}\n </Heading>\n )}\n {description != null && (\n <Description css={{ color: '$text-neutrals-subtle' }}>\n {description}\n </Description>\n )}\n {actions != null && (\n <Actions>\n <BaseActionButton variant='primary' {...actions.primary} />\n\n {actions.secondary != null && (\n <BaseActionButton {...actions.secondary} variant='ghost' />\n )}\n </Actions>\n )}\n </Container>\n )\n})\n"],"names":[],"mappings":";;;;;;;;AAgCA,MAAM,SAAA,GAAY,OAAO,GAAA,EAAK;AAAA,EAC5B,UAAA,EAAY,aAAA;AAAA,EACZ,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,QAAA,EAAU,OAAA;AAAA,EACV,QAAA,EAAU,OAAA;AAAA,EACV,SAAA,EAAW,QAAA;AAAA,EACX,UAAA,EAAY;AACd,CAAC,CAAA;AAED,MAAM,YAAA,GAAe,OAAO,KAAA,EAAO;AAAA,EACjC,KAAA,EAAO,MAAA;AAAA,EACP,SAAA,E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AE,UAAA,EAAY,UAAA,EAAY,QAAA,EAAU,MAAA,EAAO,EAAE,GACpD,EAAE,UAAU,IAAA,EAAK;AAAA,QAEpB,QAAA,EAAA;AAAA;AAAA,KACH;AAAA,IAED,WAAA,IAAe,wBACd,GAAA,CAAC,WAAA,EAAA,EAAY,KAAK,EAAE,KAAA,EAAO,uBAAA,EAAwB,EAChD,QAAA,EAAA,WAAA,EACH,CAAA;AAAA,IAED,OAAA,IAAW,IAAA,oBACV,IAAA,CAAC,OAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAQ,SAAA,EAAW,GAAG,QAAQ,OAAA,EAAS,CAAA;AAAA,MAExD,OAAA,CAAQ,aAAa,IAAA,oBACpB,GAAA,CAAC,oBAAkB,GAAG,OAAA,CAAQ,SAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ;AAAA,KAAA,EAE7D;AAAA,GAAA,EAEJ,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../src/empty-state/empty-state.tsx","../src/filter-chip/filter-chip.styled.tsx","../src/filter-chip/hooks/use-filter-chip-context.tsx","../src/filter-chip/partials/icon-slot.tsx","../src/filter-chip/partials/label.tsx","../src/filter-chip/filter-chip.tsx"],"sourcesContent":["import React from 'react'\nimport type { ReactNode, ElementRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport { Box } from '@mirohq/design-system-box'\nimport { Button } from '@mirohq/design-system-button'\nimport type { ButtonProps } from '@mirohq/design-system-button'\nimport type { BoxProps } from '@mirohq/design-system-box'\nimport { Heading } from '@mirohq/design-system-typography'\nimport { useCanvas26 } from '@mirohq/design-system-experiments'\n\n// Types\n// -----------------------------------------------------------------------------\nexport interface PatternEmptyStateProps extends Omit<BoxProps, 'children'> {\n heading?: ReactNode\n description?: ReactNode\n illustration?: string\n actions?: {\n primary: ActionButton & {\n variant?: 'primary' | 'secondary'\n }\n secondary?: ActionButton\n }\n}\n\ntype BaseActionButtonProps = Omit<ButtonProps, 'children'> & {\n label: ReactNode\n}\n\ntype ActionButton = Omit<BaseActionButtonProps, 'variant'>\n\n// Styled\n// -----------------------------------------------------------------------------\nconst Container = styled(Box, {\n background: 'transparent',\n padding: '$500',\n display: 'flex',\n flexDirection: 'column',\n minWidth: '304px',\n maxWidth: '480px',\n textAlign: 'center',\n alignItems: 'center',\n})\n\nconst Illustration = styled('img', {\n width: '72px',\n minHeight: '72px',\n display: 'block',\n marginBottom: '$150',\n})\n\nconst Description = styled(Box, {\n color: '$text-neutrals-subtle',\n marginTop: '$100',\n maxWidth: '304px',\n})\n\nconst Actions = styled(Box, {\n marginTop: '$150',\n paddingY: '$200',\n display: 'flex',\n flexDirection: 'column',\n gap: '$100',\n alignItems: 'center',\n})\n\nconst BaseActionButton = React.forwardRef<\n ElementRef<typeof Button>,\n BaseActionButtonProps\n>(({ label, ...actionProps }, ref) => (\n <Button ref={ref} {...actionProps}>\n {label}\n </Button>\n))\n\n// Component\n// -----------------------------------------------------------------------------\nexport const PatternEmptyState = React.forwardRef<\n ElementRef<typeof Box>,\n PatternEmptyStateProps\n>(({ heading, description, illustration, actions, ...restProps }, ref) => {\n const [isCanvas26] = useCanvas26()\n\n return (\n <Container ref={ref} {...restProps}>\n {illustration != null && !isCanvas26 && (\n <Illustration src={illustration} aria-hidden alt='' />\n )}\n {heading != null && (\n <Heading\n ref={ref}\n level={2}\n {...(isCanvas26\n ? { css: { fontFamily: '$display', fontSize: '$350' } }\n : { styledAs: 'h3' })}\n >\n {heading}\n </Heading>\n )}\n {description != null && (\n <Description css={{ color: '$text-neutrals-subtle' }}>\n {description}\n </Description>\n )}\n {actions != null && (\n <Actions>\n <BaseActionButton variant='primary' {...actions.primary} />\n\n {actions.secondary != null && (\n <BaseActionButton {...actions.secondary} variant='ghost' />\n )}\n </Actions>\n )}\n </Container>\n )\n})\n","import { Chip } from '@mirohq/design-system-chip'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\n\nconst activeShell = {\n // Chip is filled; drop the fill so an applied filter reads as an\n // outline (border + text carry the state).\n backgroundColor: 'transparent',\n borderColor: '$border-primary',\n color: '$text-primary',\n}\n\nexport const StyledFilterChip = styled(Chip, {\n position: 'relative',\n overflow: 'visible',\n boxSizing: 'border-box',\n borderStyle: 'solid',\n borderWidth: '$sm',\n borderColor: 'transparent',\n marginTop: '$100',\n // Chip truncates this box; open it so the floating label can poke out.\n '& > [data-chip-content]': {\n overflow: 'visible',\n },\n variants: {\n active: {\n true: {\n '&&': activeShell,\n },\n },\n },\n})\n\nexport const StyledFloatingLabel = styled(Primitive.span, {\n position: 'absolute',\n top: '-$100',\n left: '$100',\n paddingInline: '2px',\n fontSize: '$125',\n fontWeight: '$regular',\n lineHeight: 1.5,\n color: '$text-primary',\n // Mask the stroke with the surface the chip sits on so the name reads as a\n // notch in the outline. Consumers can set `--filter-surface` on any ancestor\n // (e.g. a gray filter bar) so the notch blends with it; otherwise it falls\n // back to the theme surface (white in light, dark surface in dark mode).\n backgroundColor: 'var(--filter-surface, var(--colors-background-surface))',\n borderRadius: '$round',\n pointerEvents: 'none',\n whiteSpace: 'nowrap',\n})\n\nexport const StyledLabel = styled(Primitive.span, {\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n textOverflow: 'ellipsis',\n paddingInline: '2px',\n lineHeight: 1.5,\n})\n\nexport type StyledLabelProps = StrictComponentProps<typeof StyledLabel>\n","import { createContext, useContext, useMemo } from 'react'\nimport type { ReactNode } from 'react'\n\ninterface FilterChipContextProps {\n activated: boolean\n value: ReactNode\n}\n\nexport interface FilterChipProviderProps extends FilterChipContextProps {\n children: ReactNode\n}\n\nconst FilterChipContext = createContext<FilterChipContextProps>({\n activated: false,\n value: undefined,\n})\n\nexport const FilterChipProvider = ({\n children,\n activated,\n value,\n}: FilterChipProviderProps): JSX.Element => {\n const context = useMemo(() => ({ activated, value }), [activated, value])\n\n return (\n <FilterChipContext.Provider value={context}>\n {children}\n </FilterChipContext.Provider>\n )\n}\n\nexport const useFilterChipContext = (): FilterChipContextProps =>\n useContext(FilterChipContext)\n","import type { ElementRef, ReactNode } from 'react'\nimport React from 'react'\nimport { Chip } from '@mirohq/design-system-chip'\nimport type { ChipImageSlotProps } from '@mirohq/design-system-chip'\nimport { addPropsToChildren } from '@mirohq/design-system-utils'\nimport type { IconReactElement } from '@mirohq/design-system-base-icon'\nimport { isIconComponent } from '@mirohq/design-system-base-icon'\n\nexport interface IconSlotProps extends Omit<ChipImageSlotProps, 'children'> {\n /**\n * The leading icon.\n */\n children: ReactNode\n}\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof Chip.ImageSlot>,\n IconSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const formattedChildren = addPropsToChildren(\n children,\n child => isIconComponent(child as IconReactElement),\n {\n size: 'small',\n weight: 'thin',\n }\n )\n\n return (\n <Chip.ImageSlot {...restProps} ref={forwardRef}>\n {formattedChildren}\n </Chip.ImageSlot>\n )\n})\n\nIconSlot.displayName = 'FilterChip.IconSlot'\n","import type { ElementRef, ReactNode } from 'react'\nimport React from 'react'\n\nimport { StyledFloatingLabel, StyledLabel } from '../filter-chip.styled'\nimport type { StyledLabelProps } from '../filter-chip.styled'\nimport { useFilterChipContext } from '../hooks/use-filter-chip-context'\n\nexport interface LabelProps extends Omit<StyledLabelProps, 'children'> {\n /**\n * The filter's name, e.g. \"Board owner\".\n */\n children: ReactNode\n}\n\n/**\n * The filter's name. Shown as the chip's text when idle; once the filter is\n * activated it floats above the `value` summary, which takes its place in the\n * body.\n */\nexport const Label = React.forwardRef<\n ElementRef<typeof StyledLabel>,\n LabelProps\n>(({ children, ...restProps }, forwardRef) => {\n const { activated, value } = useFilterChipContext()\n\n return (\n <>\n {activated && <StyledFloatingLabel>{children}</StyledFloatingLabel>}\n <StyledLabel {...restProps} ref={forwardRef}>\n {activated && value != null ? value : children}\n </StyledLabel>\n </>\n )\n})\n\nLabel.displayName = 'FilterChip.Label'\n","import React from 'react'\nimport type {\n ElementRef,\n ForwardRefExoticComponent,\n ReactNode,\n RefAttributes,\n} from 'react'\nimport { Chip } from '@mirohq/design-system-chip'\nimport type { ChipProps } from '@mirohq/design-system-chip'\nimport { IconChevronDown } from '@mirohq/design-system-icons'\n\nimport { StyledFilterChip } from './filter-chip.styled'\nimport { FilterChipProvider } from './hooks/use-filter-chip-context'\nimport { IconSlot } from './partials/icon-slot'\nimport { Label } from './partials/label'\n\n// Always-on press handler so Chip renders as a BaseButton even when the\n// consumer hasn't passed onPress (e.g. Combobox.Trigger asChild supplies it).\nconst noopPress = (): void => undefined\n\nexport type FilterChipProps = Omit<\n ChipProps,\n 'removable' | 'onRemove' | 'removeAriaLabel' | 'children' | 'value' | 'ref'\n> &\n RefAttributes<HTMLButtonElement> & {\n /**\n * The chip's anatomy: a `FilterChip.Label` with the filter's name, plus an\n * optional leading `FilterChip.IconSlot`.\n */\n children: ReactNode\n\n /**\n * A short summary of the current selection, e.g. \"Active +2\". When present\n * (or when `active` is set) the name floats above this summary.\n */\n value?: ReactNode\n\n /**\n * Force the active state. Defaults to whether `value` is set.\n */\n active?: boolean\n }\n\n/**\n * FilterChip is a Chip-based trigger for filters. The filter's name goes in a\n * `FilterChip.Label`, optionally alongside a `FilterChip.IconSlot`. It shows\n * the name when idle, and floats it above a `value` summary once active,\n * with a trailing chevron.\n *\n * It renders a single `<button>` (a pressable Chip) with no overlay of its own,\n * so it is meant to drive a `Combobox` (or any overlay) via\n * `Combobox.Trigger asChild`. `loading` is Chip's loading state.\n *\n * @experimental Beta — the API may still change while teams adopt it.\n */\nexport const FilterChip = React.forwardRef<\n ElementRef<'button'>,\n FilterChipProps\n>(\n (\n {\n value,\n active,\n loading = false,\n disabled = false,\n onPress,\n children,\n ...restProps\n },\n forwardRef\n ) => {\n const isActive =\n active ?? (value !== undefined && value !== null && value !== '')\n\n return (\n <FilterChipProvider activated={isActive} value={value}>\n <StyledFilterChip\n {...restProps}\n ref={forwardRef as React.Ref<HTMLDivElement | HTMLButtonElement>}\n removable={false}\n loading={loading}\n disabled={disabled}\n active={isActive}\n onPress={onPress ?? noopPress}\n >\n {children}\n\n <Chip.ImageSlot aria-hidden>\n <IconChevronDown size='small' />\n </Chip.ImageSlot>\n </StyledFilterChip>\n </FilterChipProvider>\n )\n }\n) as ForwardRefExoticComponent<FilterChipProps> & Partials\n\nexport interface Partials {\n IconSlot: typeof IconSlot\n Label: typeof Label\n}\n\nFilterChip.IconSlot = IconSlot\nFilterChip.Label = Label\nFilterChip.displayName = 'FilterChip'\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,OAAO,GAAA,EAAK;AAAA,EAC5B,UAAA,EAAY,aAAA;AAAA,EACZ,OAAA,EAAS,MAAA;AAAA,EACT,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,QAAA,EAAU,OAAA;AAAA,EACV,QAAA,EAAU,OAAA;AAAA,EACV,SAAA,EAAW,QAAA;AAAA,EACX,UAAA,EAAY;AACd,CAAC,CAAA;AAED,MAAM,YAAA,GAAe,OAAO,KAAA,EAAO;AAAA,EACjC,KAAA,EAAO,MAAA;AAAA,EACP,SAAA,EAAW,MAAA;AAAA,EACX,OAAA,EAAS,OAAA;AAAA,EACT,YAAA,EAAc;AAChB,CAAC,CAAA;AAED,MAAM,WAAA,GAAc,OAAO,GAAA,EAAK;AAAA,EAC9B,KAAA,EAAO,uBAAA;AAAA,EACP,SAAA,EAAW,MAAA;AAAA,EACX,QAAA,EAAU;AACZ,CAAC,CAAA;AAED,MAAM,OAAA,GAAU,OAAO,GAAA,EAAK;AAAA,EAC1B,SAAA,EAAW,MAAA;AAAA,EACX,QAAA,EAAU,MAAA;AAAA,EACV,OAAA,EAAS,MAAA;AAAA,EACT,aAAA,EAAe,QAAA;AAAA,EACf,GAAA,EAAK,MAAA;AAAA,EACL,UAAA,EA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,0BAED,GAAA,CAAC,IAAA,CAAK,SAAA,EAAL,EAAe,aAAA,EAAW,MACzB,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,IAAA,EAAK,OAAA,EAAQ,CAAA,EAChC;AAAA;AAAA;AAAA,KACF,EACF,CAAA;AAAA,EAEJ;AACF;AAOA,UAAA,CAAW,QAAA,GAAW,QAAA;AACtB,UAAA,CAAW,KAAA,GAAQ,KAAA;AACnB,UAAA,CAAW,WAAA,GAAc,YAAA;;;;"}
package/dist/types.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- import React, { ReactNode } from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode, ForwardRefExoticComponent, RefAttributes } from 'react';
2
3
  import { ButtonProps } from '@mirohq/design-system-button';
3
4
  import { BoxProps } from '@mirohq/design-system-box';
5
+ import { ChipImageSlotProps, ChipProps } from '@mirohq/design-system-chip';
6
+ import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';
7
+ import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
8
+ import { StrictComponentProps } from '@mirohq/design-system-stitches';
4
9
 
5
10
  interface PatternEmptyStateProps extends Omit<BoxProps, 'children'> {
6
11
  heading?: ReactNode;
@@ -17,7 +22,85 @@ type BaseActionButtonProps = Omit<ButtonProps, 'children'> & {
17
22
  label: ReactNode;
18
23
  };
19
24
  type ActionButton = Omit<BaseActionButtonProps, 'variant'>;
20
- declare const PatternEmptyState: React.ForwardRefExoticComponent<Omit<PatternEmptyStateProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
25
+ declare const PatternEmptyState: React__default.ForwardRefExoticComponent<Omit<PatternEmptyStateProps, "ref"> & React__default.RefAttributes<HTMLDivElement>>;
21
26
 
22
- export { PatternEmptyState };
23
- export type { PatternEmptyStateProps };
27
+ interface IconSlotProps extends Omit<ChipImageSlotProps, 'children'> {
28
+ /**
29
+ * The leading icon.
30
+ */
31
+ children: ReactNode;
32
+ }
33
+ declare const IconSlot: React__default.ForwardRefExoticComponent<Omit<IconSlotProps, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
34
+
35
+ /* Utilities */
36
+ /* ========================================================================== */
37
+
38
+ /** Returns a string with the given prefix followed by the given values. */
39
+ type Prefixed<K extends string, T> = `${K}${Extract<T, boolean | number | string>}`
40
+
41
+ type TransformProps<Props, Media> = {
42
+ [K in keyof Props]: (
43
+ | Props[K]
44
+ | (
45
+ & {
46
+ [KMedia in Prefixed<'@', 'initial' | keyof Media>]?: Props[K]
47
+ }
48
+ & {
49
+ [KMedia in string]: Props[K]
50
+ }
51
+ )
52
+ )
53
+ }
54
+
55
+ declare const StyledLabel: React.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<React.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"span">>>, never> & TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & React.RefAttributes<HTMLSpanElement>> & _mirohq_design_system_stitches.StitchesInternals<React.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"span">>, {}, {}>;
56
+ type StyledLabelProps = StrictComponentProps<typeof StyledLabel>;
57
+
58
+ interface LabelProps extends Omit<StyledLabelProps, 'children'> {
59
+ /**
60
+ * The filter's name, e.g. "Board owner".
61
+ */
62
+ children: ReactNode;
63
+ }
64
+ /**
65
+ * The filter's name. Shown as the chip's text when idle; once the filter is
66
+ * activated it floats above the `value` summary, which takes its place in the
67
+ * body.
68
+ */
69
+ declare const Label: React__default.ForwardRefExoticComponent<Omit<LabelProps, "ref"> & React__default.RefAttributes<HTMLSpanElement>>;
70
+
71
+ type FilterChipProps = Omit<ChipProps, 'removable' | 'onRemove' | 'removeAriaLabel' | 'children' | 'value' | 'ref'> & RefAttributes<HTMLButtonElement> & {
72
+ /**
73
+ * The chip's anatomy: a `FilterChip.Label` with the filter's name, plus an
74
+ * optional leading `FilterChip.IconSlot`.
75
+ */
76
+ children: ReactNode;
77
+ /**
78
+ * A short summary of the current selection, e.g. "Active +2". When present
79
+ * (or when `active` is set) the name floats above this summary.
80
+ */
81
+ value?: ReactNode;
82
+ /**
83
+ * Force the active state. Defaults to whether `value` is set.
84
+ */
85
+ active?: boolean;
86
+ };
87
+ /**
88
+ * FilterChip is a Chip-based trigger for filters. The filter's name goes in a
89
+ * `FilterChip.Label`, optionally alongside a `FilterChip.IconSlot`. It shows
90
+ * the name when idle, and floats it above a `value` summary once active,
91
+ * with a trailing chevron.
92
+ *
93
+ * It renders a single `<button>` (a pressable Chip) with no overlay of its own,
94
+ * so it is meant to drive a `Combobox` (or any overlay) via
95
+ * `Combobox.Trigger asChild`. `loading` is Chip's loading state.
96
+ *
97
+ * @experimental Beta — the API may still change while teams adopt it.
98
+ */
99
+ declare const FilterChip: ForwardRefExoticComponent<FilterChipProps> & Partials;
100
+ interface Partials {
101
+ IconSlot: typeof IconSlot;
102
+ Label: typeof Label;
103
+ }
104
+
105
+ export { FilterChip, PatternEmptyState };
106
+ export type { IconSlotProps as FilterChipIconSlotProps, LabelProps as FilterChipLabelProps, FilterChipProps, PatternEmptyStateProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-patterns",
3
- "version": "1.3.15",
3
+ "version": "1.4.0-filter-chip.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -26,11 +26,16 @@
26
26
  "react": "^16.14 || ^17 || ^18 || ^19"
27
27
  },
28
28
  "dependencies": {
29
+ "@mirohq/design-system-base-icon": "^1.3.0",
29
30
  "@mirohq/design-system-box": "^3.2.34",
30
31
  "@mirohq/design-system-button": "^5.3.14",
31
- "@mirohq/design-system-typography": "^1.3.34",
32
+ "@mirohq/design-system-chip": "^1.3.0-filter-chip.0",
32
33
  "@mirohq/design-system-experiments": "^1.1.0",
33
- "@mirohq/design-system-stitches": "^3.3.32"
34
+ "@mirohq/design-system-icons": "^1.46.0",
35
+ "@mirohq/design-system-primitive": "^2.2.1",
36
+ "@mirohq/design-system-stitches": "^3.3.32",
37
+ "@mirohq/design-system-typography": "^1.3.34",
38
+ "@mirohq/design-system-utils": "^1.3.0"
34
39
  },
35
40
  "devDependencies": {
36
41
  "@mirohq/brand-assets": "^1.1.1"