@mirohq/design-system-callout 0.1.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 ADDED
@@ -0,0 +1,188 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var designSystemPrimitive = require('@mirohq/design-system-primitive');
8
+ var designSystemStitches = require('@mirohq/design-system-stitches');
9
+ var designSystemIcons = require('@mirohq/design-system-icons');
10
+ var designSystemTypography = require('@mirohq/design-system-typography');
11
+ var designSystemIconButton = require('@mirohq/design-system-icon-button');
12
+
13
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
14
+
15
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
16
+
17
+ const StyledCallout = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
18
+ columnGap: "$150",
19
+ rowGap: "$150",
20
+ padding: "$200",
21
+ borderWidth: "$sm",
22
+ borderStyle: "solid",
23
+ borderRadius: "$75",
24
+ display: "grid",
25
+ justifyContent: "center",
26
+ gridTemplateColumns: "auto 1fr $8",
27
+ gridTemplateAreas: "'icon content close'\n 'icon actions close'",
28
+ variants: {
29
+ variant: {
30
+ information: {
31
+ backgroundColor: "$background-primary-subtle",
32
+ borderColor: "$border-primary-subtle"
33
+ },
34
+ warning: {
35
+ backgroundColor: "$background-warning-subtle",
36
+ borderColor: "$border-warning-subtle"
37
+ },
38
+ danger: {
39
+ backgroundColor: "$background-danger-subtle",
40
+ borderColor: "$border-danger-subtle"
41
+ },
42
+ success: {
43
+ backgroundColor: "$background-success-subtle",
44
+ borderColor: "$border-success-subtle"
45
+ }
46
+ }
47
+ }
48
+ });
49
+
50
+ const Content = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
51
+ display: "grid",
52
+ gap: "$25",
53
+ maxWidth: "48em",
54
+ gridArea: "content",
55
+ gridTemplateRows: "auto 1fr",
56
+ gridTemplateAreas: "'title'\n 'description'"
57
+ });
58
+ Content.displayName = "Callout.Content";
59
+
60
+ const Description = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
61
+ gridArea: "description",
62
+ color: "$text-neutrals-subtle",
63
+ fontSize: "$175",
64
+ lineHeight: "$400"
65
+ });
66
+ Description.displayName = "Callout.Description";
67
+
68
+ const CalloutContext = React.createContext({});
69
+ const CalloutProvider = ({
70
+ children,
71
+ ...restProps
72
+ }) => /* @__PURE__ */ jsxRuntime.jsx(
73
+ CalloutContext.Provider,
74
+ {
75
+ value: {
76
+ ...restProps
77
+ },
78
+ children
79
+ }
80
+ );
81
+ const useCalloutContext = () => React.useContext(CalloutContext);
82
+
83
+ const StyledIconSlot = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
84
+ variants: {
85
+ variant: {
86
+ information: {
87
+ color: "$icon-primary"
88
+ },
89
+ warning: {
90
+ color: "$icon-warning"
91
+ },
92
+ danger: {
93
+ color: "$icon-danger"
94
+ },
95
+ success: {
96
+ color: "$icon-success"
97
+ }
98
+ }
99
+ }
100
+ });
101
+
102
+ const iconVariant = {
103
+ success: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCheckMark, {}),
104
+ warning: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconExclamationPointCircle, {}),
105
+ danger: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconExclamationPointCircle, {}),
106
+ information: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconInformationMarkCircle, {}),
107
+ default: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCheckMark, {})
108
+ };
109
+ const IconSlot = React__default["default"].forwardRef(({ children, ...restProps }, forwardRef) => {
110
+ var _a;
111
+ const { variant } = useCalloutContext();
112
+ let formattedChildren = children;
113
+ if (React__default["default"].Children.count(children) < 1) {
114
+ formattedChildren = (_a = iconVariant[variant]) != null ? _a : iconVariant.default;
115
+ }
116
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledIconSlot, { ...restProps, ref: forwardRef, variant, children: formattedChildren });
117
+ });
118
+
119
+ const Title = React__default["default"].forwardRef((props, forwardRef) => /* @__PURE__ */ jsxRuntime.jsx(designSystemTypography.Heading, { ...props, ref: forwardRef, level: 4 }));
120
+
121
+ const Actions = designSystemStitches.styled(designSystemPrimitive.Primitive.div, {
122
+ gridArea: "actions",
123
+ display: "flex",
124
+ gap: "$100"
125
+ });
126
+ Actions.displayName = "Callout.Actions";
127
+
128
+ const DismissButton = (props) => /* @__PURE__ */ jsxRuntime.jsx(
129
+ designSystemIconButton.IconButton,
130
+ {
131
+ css: { gridArea: "close" },
132
+ variant: "ghost",
133
+ size: "medium",
134
+ "data-testid": "dismiss-button",
135
+ ...props,
136
+ children: /* @__PURE__ */ jsxRuntime.jsx(designSystemIcons.IconCross, {})
137
+ }
138
+ );
139
+
140
+ const Callout = React__default["default"].forwardRef(
141
+ ({
142
+ dismissed,
143
+ dismissible = true,
144
+ onDismiss,
145
+ dismissLabel,
146
+ children,
147
+ variant,
148
+ ...props
149
+ }, forwardRef) => {
150
+ const [internalDismissed, setInternalDismissed] = React.useState(
151
+ dismissed != null ? dismissed : false
152
+ );
153
+ if (dismissed != null ? dismissed : internalDismissed) {
154
+ return null;
155
+ }
156
+ const handleDismissed = () => {
157
+ setInternalDismissed(true);
158
+ onDismiss == null ? void 0 : onDismiss();
159
+ };
160
+ return /* @__PURE__ */ jsxRuntime.jsx(CalloutProvider, { variant, children: /* @__PURE__ */ jsxRuntime.jsxs(
161
+ StyledCallout,
162
+ {
163
+ ...props,
164
+ ref: forwardRef,
165
+ variant,
166
+ role: "alert",
167
+ children: [
168
+ children,
169
+ dismissible && onDismiss != null && (dismissLabel == null ? void 0 : dismissLabel.length) > 0 && /* @__PURE__ */ jsxRuntime.jsx(
170
+ DismissButton,
171
+ {
172
+ "aria-label": dismissLabel,
173
+ onPress: handleDismissed
174
+ }
175
+ )
176
+ ]
177
+ }
178
+ ) });
179
+ }
180
+ );
181
+ Callout.Content = Content;
182
+ Callout.Description = Description;
183
+ Callout.IconSlot = IconSlot;
184
+ Callout.Title = Title;
185
+ Callout.Actions = Actions;
186
+
187
+ exports.Callout = Callout;
188
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sources":["../src/callout.styled.tsx","../src/partials/content.tsx","../src/partials/description.tsx","../src/hooks/use-callout-context.tsx","../src/partials/icon-slot.styled.ts","../src/partials/icon-slot.tsx","../src/partials/title.tsx","../src/partials/actions.tsx","../src/partials/dismiss-button.tsx","../src/callout.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledCallout = styled(Primitive.div, {\n columnGap: '$150',\n rowGap: '$150',\n padding: '$200',\n borderWidth: '$sm',\n borderStyle: 'solid',\n borderRadius: '$75',\n display: 'grid',\n justifyContent: 'center',\n gridTemplateColumns: 'auto 1fr $8',\n gridTemplateAreas: `'icon content close'\n 'icon actions close'`,\n variants: {\n variant: {\n information: {\n backgroundColor: '$background-primary-subtle',\n borderColor: '$border-primary-subtle',\n },\n warning: {\n backgroundColor: '$background-warning-subtle',\n borderColor: '$border-warning-subtle',\n },\n danger: {\n backgroundColor: '$background-danger-subtle',\n borderColor: '$border-danger-subtle',\n },\n success: {\n backgroundColor: '$background-success-subtle',\n borderColor: '$border-success-subtle',\n },\n },\n },\n})\n\nexport type StyledCalloutProps = ComponentPropsWithRef<typeof StyledCallout>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const Content = styled(Primitive.div, {\n display: 'grid',\n gap: '$25',\n maxWidth: '48em',\n gridArea: 'content',\n gridTemplateRows: 'auto 1fr',\n gridTemplateAreas: `'title'\n 'description'`,\n})\n\nContent.displayName = 'Callout.Content'\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const Description = styled(Primitive.div, {\n gridArea: 'description',\n color: '$text-neutrals-subtle',\n fontSize: '$175',\n lineHeight: '$400',\n})\n\nDescription.displayName = 'Callout.Description'\n","import { createContext, useContext } from 'react'\nimport type { PropsWithChildren } from 'react'\n\nimport type { StyledCalloutProps } from '../callout.styled'\n\ninterface CalloutProps {\n variant?: StyledCalloutProps['variant']\n}\n\ninterface CalloutContextProps extends CalloutProps {}\n\nexport type CalloutProviderProps = CalloutContextProps\n\nconst CalloutContext = createContext<CalloutContextProps>({} as any)\n\nexport const CalloutProvider = ({\n children,\n ...restProps\n}: PropsWithChildren<CalloutProviderProps>): JSX.Element => (\n <CalloutContext.Provider\n value={{\n ...restProps,\n }}\n >\n {children}\n </CalloutContext.Provider>\n)\n\nexport const useCalloutContext = (): CalloutContextProps =>\n useContext(CalloutContext)\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledIconSlot = styled(Primitive.div, {\n variants: {\n variant: {\n information: {\n color: '$icon-primary',\n },\n warning: {\n color: '$icon-warning',\n },\n danger: {\n color: '$icon-danger',\n },\n success: {\n color: '$icon-success',\n },\n },\n },\n})\n","import React from 'react'\nimport type { ElementRef, ComponentPropsWithRef } from 'react'\nimport {\n IconCheckMark,\n IconExclamationPointCircle,\n IconInformationMarkCircle,\n} from '@mirohq/design-system-icons'\n\nimport { useCalloutContext } from '../hooks/use-callout-context'\nimport { StyledIconSlot } from './icon-slot.styled'\n\nexport type StyledIconSlotProps = ComponentPropsWithRef<typeof StyledIconSlot>\n\nexport interface IconSlotProps extends StyledIconSlotProps {\n /**\n * The icon.\n */\n children?: React.ReactNode\n}\n\nconst iconVariant = {\n success: <IconCheckMark />,\n warning: <IconExclamationPointCircle />,\n danger: <IconExclamationPointCircle />,\n information: <IconInformationMarkCircle />,\n default: <IconCheckMark />,\n}\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof StyledIconSlot>,\n IconSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const { variant } = useCalloutContext()\n\n let formattedChildren = children\n if (React.Children.count(children) < 1) {\n formattedChildren =\n iconVariant[variant as keyof typeof iconVariant] ?? iconVariant.default\n }\n\n return (\n <StyledIconSlot {...restProps} ref={forwardRef} variant={variant}>\n {formattedChildren}\n </StyledIconSlot>\n )\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Heading } from '@mirohq/design-system-typography'\nimport type { HeadingProps } from '@mirohq/design-system-typography'\n\nexport interface GroupLabelProps extends Omit<HeadingProps, 'level'> {}\n\nexport const Title = React.forwardRef<\n ElementRef<typeof Heading>,\n GroupLabelProps\n>((props, forwardRef) => <Heading {...props} ref={forwardRef} level={4} />)\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const Actions = styled(Primitive.div, {\n gridArea: 'actions',\n display: 'flex',\n gap: '$100',\n})\n\nActions.displayName = 'Callout.Actions'\n","import { IconButton } from '@mirohq/design-system-icon-button'\nimport type { IconButtonProps } from '@mirohq/design-system-icon-button'\nimport { IconCross } from '@mirohq/design-system-icons'\n\nexport const DismissButton: React.FC<IconButtonProps> = props => (\n <IconButton\n css={{ gridArea: 'close' }}\n variant='ghost'\n size='medium'\n data-testid='dismiss-button'\n {...props}\n >\n <IconCross />\n </IconButton>\n)\n","import React, { useState } from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\n\nimport { StyledCallout } from './callout.styled'\nimport type { StyledCalloutProps } from './callout.styled'\nimport { Content } from './partials/content'\nimport { Description } from './partials/description'\nimport { IconSlot } from './partials/icon-slot'\nimport { Title } from './partials/title'\nimport { Actions } from './partials/actions'\nimport { DismissButton } from './partials/dismiss-button'\nimport { CalloutProvider } from './hooks/use-callout-context'\n\ninterface DismissibleProps {\n /**\n * Whether or not the component is dismissed (hidden)\n */\n dismissed?: boolean\n\n /**\n * Callback invoked once dismiss button is clicked\n */\n onDismiss?: () => void\n\n /**\n * aria-label for the dismiss button\n */\n dismissLabel: string\n}\n\nexport type CalloutProps = (StyledCalloutProps & {\n /**\n * Change the component style.\n */\n variant: StyledCalloutProps['variant']\n\n /**\n * Whether or not the component should display dismiss button\n * @default true\n */\n dismissible?: boolean\n}) &\n (\n | DismissibleProps // uncontrolled\n | Required<DismissibleProps> // controlled\n | ({ dismissible?: false } & { [K in keyof DismissibleProps]?: never })\n )\n\nexport const Callout = React.forwardRef<\n ElementRef<typeof StyledCallout>,\n CalloutProps\n>(\n (\n {\n dismissed,\n dismissible = true,\n onDismiss,\n dismissLabel,\n children,\n variant,\n ...props\n },\n forwardRef\n ) => {\n const [internalDismissed, setInternalDismissed] = useState<boolean>(\n dismissed ?? false\n )\n\n if (dismissed ?? internalDismissed) {\n return null\n }\n\n const handleDismissed = (): void => {\n setInternalDismissed(true)\n onDismiss?.()\n }\n\n return (\n <CalloutProvider variant={variant}>\n <StyledCallout\n {...props}\n ref={forwardRef}\n variant={variant}\n role='alert'\n >\n {children}\n {dismissible && onDismiss != null && dismissLabel?.length > 0 && (\n <DismissButton\n aria-label={dismissLabel}\n onPress={handleDismissed}\n />\n )}\n </StyledCallout>\n </CalloutProvider>\n )\n }\n) as ForwardRefExoticComponent<CalloutProps> & Partials\n\nexport interface Partials {\n Content: typeof Content\n Description: typeof Description\n IconSlot: typeof IconSlot\n Title: typeof Title\n Actions: typeof Actions\n}\n\nCallout.Content = Content\nCallout.Description = Description\nCallout.IconSlot = IconSlot\nCallout.Title = Title\nCallout.Actions = Actions\n"],"names":["styled","Primitive","createContext","jsx","useContext","IconCheckMark","IconExclamationPointCircle","IconInformationMarkCircle","React","Heading","IconButton","IconCross","useState","jsxs"],"mappings":";;;;;;;;;;;;;;;;AAIa,MAAA,aAAA,GAAgBA,2BAAO,CAAAC,+BAAA,CAAU,GAAK,EAAA;AAAA,EACjD,SAAW,EAAA,MAAA;AAAA,EACX,MAAQ,EAAA,MAAA;AAAA,EACR,OAAS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,GAAA,QAAA,CAAA;AACnB,OAAA,CAAQ,KAAQ,GAAA,KAAA,CAAA;AAChB,OAAA,CAAQ,OAAU,GAAA,OAAA;;;;"}
package/dist/module.js ADDED
@@ -0,0 +1,180 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import React, { createContext, useContext, useState } from 'react';
3
+ import { Primitive } from '@mirohq/design-system-primitive';
4
+ import { styled } from '@mirohq/design-system-stitches';
5
+ import { IconCheckMark, IconExclamationPointCircle, IconInformationMarkCircle, IconCross } from '@mirohq/design-system-icons';
6
+ import { Heading } from '@mirohq/design-system-typography';
7
+ import { IconButton } from '@mirohq/design-system-icon-button';
8
+
9
+ const StyledCallout = styled(Primitive.div, {
10
+ columnGap: "$150",
11
+ rowGap: "$150",
12
+ padding: "$200",
13
+ borderWidth: "$sm",
14
+ borderStyle: "solid",
15
+ borderRadius: "$75",
16
+ display: "grid",
17
+ justifyContent: "center",
18
+ gridTemplateColumns: "auto 1fr $8",
19
+ gridTemplateAreas: "'icon content close'\n 'icon actions close'",
20
+ variants: {
21
+ variant: {
22
+ information: {
23
+ backgroundColor: "$background-primary-subtle",
24
+ borderColor: "$border-primary-subtle"
25
+ },
26
+ warning: {
27
+ backgroundColor: "$background-warning-subtle",
28
+ borderColor: "$border-warning-subtle"
29
+ },
30
+ danger: {
31
+ backgroundColor: "$background-danger-subtle",
32
+ borderColor: "$border-danger-subtle"
33
+ },
34
+ success: {
35
+ backgroundColor: "$background-success-subtle",
36
+ borderColor: "$border-success-subtle"
37
+ }
38
+ }
39
+ }
40
+ });
41
+
42
+ const Content = styled(Primitive.div, {
43
+ display: "grid",
44
+ gap: "$25",
45
+ maxWidth: "48em",
46
+ gridArea: "content",
47
+ gridTemplateRows: "auto 1fr",
48
+ gridTemplateAreas: "'title'\n 'description'"
49
+ });
50
+ Content.displayName = "Callout.Content";
51
+
52
+ const Description = styled(Primitive.div, {
53
+ gridArea: "description",
54
+ color: "$text-neutrals-subtle",
55
+ fontSize: "$175",
56
+ lineHeight: "$400"
57
+ });
58
+ Description.displayName = "Callout.Description";
59
+
60
+ const CalloutContext = createContext({});
61
+ const CalloutProvider = ({
62
+ children,
63
+ ...restProps
64
+ }) => /* @__PURE__ */ jsx(
65
+ CalloutContext.Provider,
66
+ {
67
+ value: {
68
+ ...restProps
69
+ },
70
+ children
71
+ }
72
+ );
73
+ const useCalloutContext = () => useContext(CalloutContext);
74
+
75
+ const StyledIconSlot = styled(Primitive.div, {
76
+ variants: {
77
+ variant: {
78
+ information: {
79
+ color: "$icon-primary"
80
+ },
81
+ warning: {
82
+ color: "$icon-warning"
83
+ },
84
+ danger: {
85
+ color: "$icon-danger"
86
+ },
87
+ success: {
88
+ color: "$icon-success"
89
+ }
90
+ }
91
+ }
92
+ });
93
+
94
+ const iconVariant = {
95
+ success: /* @__PURE__ */ jsx(IconCheckMark, {}),
96
+ warning: /* @__PURE__ */ jsx(IconExclamationPointCircle, {}),
97
+ danger: /* @__PURE__ */ jsx(IconExclamationPointCircle, {}),
98
+ information: /* @__PURE__ */ jsx(IconInformationMarkCircle, {}),
99
+ default: /* @__PURE__ */ jsx(IconCheckMark, {})
100
+ };
101
+ const IconSlot = React.forwardRef(({ children, ...restProps }, forwardRef) => {
102
+ var _a;
103
+ const { variant } = useCalloutContext();
104
+ let formattedChildren = children;
105
+ if (React.Children.count(children) < 1) {
106
+ formattedChildren = (_a = iconVariant[variant]) != null ? _a : iconVariant.default;
107
+ }
108
+ return /* @__PURE__ */ jsx(StyledIconSlot, { ...restProps, ref: forwardRef, variant, children: formattedChildren });
109
+ });
110
+
111
+ const Title = React.forwardRef((props, forwardRef) => /* @__PURE__ */ jsx(Heading, { ...props, ref: forwardRef, level: 4 }));
112
+
113
+ const Actions = styled(Primitive.div, {
114
+ gridArea: "actions",
115
+ display: "flex",
116
+ gap: "$100"
117
+ });
118
+ Actions.displayName = "Callout.Actions";
119
+
120
+ const DismissButton = (props) => /* @__PURE__ */ jsx(
121
+ IconButton,
122
+ {
123
+ css: { gridArea: "close" },
124
+ variant: "ghost",
125
+ size: "medium",
126
+ "data-testid": "dismiss-button",
127
+ ...props,
128
+ children: /* @__PURE__ */ jsx(IconCross, {})
129
+ }
130
+ );
131
+
132
+ const Callout = React.forwardRef(
133
+ ({
134
+ dismissed,
135
+ dismissible = true,
136
+ onDismiss,
137
+ dismissLabel,
138
+ children,
139
+ variant,
140
+ ...props
141
+ }, forwardRef) => {
142
+ const [internalDismissed, setInternalDismissed] = useState(
143
+ dismissed != null ? dismissed : false
144
+ );
145
+ if (dismissed != null ? dismissed : internalDismissed) {
146
+ return null;
147
+ }
148
+ const handleDismissed = () => {
149
+ setInternalDismissed(true);
150
+ onDismiss == null ? void 0 : onDismiss();
151
+ };
152
+ return /* @__PURE__ */ jsx(CalloutProvider, { variant, children: /* @__PURE__ */ jsxs(
153
+ StyledCallout,
154
+ {
155
+ ...props,
156
+ ref: forwardRef,
157
+ variant,
158
+ role: "alert",
159
+ children: [
160
+ children,
161
+ dismissible && onDismiss != null && (dismissLabel == null ? void 0 : dismissLabel.length) > 0 && /* @__PURE__ */ jsx(
162
+ DismissButton,
163
+ {
164
+ "aria-label": dismissLabel,
165
+ onPress: handleDismissed
166
+ }
167
+ )
168
+ ]
169
+ }
170
+ ) });
171
+ }
172
+ );
173
+ Callout.Content = Content;
174
+ Callout.Description = Description;
175
+ Callout.IconSlot = IconSlot;
176
+ Callout.Title = Title;
177
+ Callout.Actions = Actions;
178
+
179
+ export { Callout };
180
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sources":["../src/callout.styled.tsx","../src/partials/content.tsx","../src/partials/description.tsx","../src/hooks/use-callout-context.tsx","../src/partials/icon-slot.styled.ts","../src/partials/icon-slot.tsx","../src/partials/title.tsx","../src/partials/actions.tsx","../src/partials/dismiss-button.tsx","../src/callout.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledCallout = styled(Primitive.div, {\n columnGap: '$150',\n rowGap: '$150',\n padding: '$200',\n borderWidth: '$sm',\n borderStyle: 'solid',\n borderRadius: '$75',\n display: 'grid',\n justifyContent: 'center',\n gridTemplateColumns: 'auto 1fr $8',\n gridTemplateAreas: `'icon content close'\n 'icon actions close'`,\n variants: {\n variant: {\n information: {\n backgroundColor: '$background-primary-subtle',\n borderColor: '$border-primary-subtle',\n },\n warning: {\n backgroundColor: '$background-warning-subtle',\n borderColor: '$border-warning-subtle',\n },\n danger: {\n backgroundColor: '$background-danger-subtle',\n borderColor: '$border-danger-subtle',\n },\n success: {\n backgroundColor: '$background-success-subtle',\n borderColor: '$border-success-subtle',\n },\n },\n },\n})\n\nexport type StyledCalloutProps = ComponentPropsWithRef<typeof StyledCallout>\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const Content = styled(Primitive.div, {\n display: 'grid',\n gap: '$25',\n maxWidth: '48em',\n gridArea: 'content',\n gridTemplateRows: 'auto 1fr',\n gridTemplateAreas: `'title'\n 'description'`,\n})\n\nContent.displayName = 'Callout.Content'\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const Description = styled(Primitive.div, {\n gridArea: 'description',\n color: '$text-neutrals-subtle',\n fontSize: '$175',\n lineHeight: '$400',\n})\n\nDescription.displayName = 'Callout.Description'\n","import { createContext, useContext } from 'react'\nimport type { PropsWithChildren } from 'react'\n\nimport type { StyledCalloutProps } from '../callout.styled'\n\ninterface CalloutProps {\n variant?: StyledCalloutProps['variant']\n}\n\ninterface CalloutContextProps extends CalloutProps {}\n\nexport type CalloutProviderProps = CalloutContextProps\n\nconst CalloutContext = createContext<CalloutContextProps>({} as any)\n\nexport const CalloutProvider = ({\n children,\n ...restProps\n}: PropsWithChildren<CalloutProviderProps>): JSX.Element => (\n <CalloutContext.Provider\n value={{\n ...restProps,\n }}\n >\n {children}\n </CalloutContext.Provider>\n)\n\nexport const useCalloutContext = (): CalloutContextProps =>\n useContext(CalloutContext)\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const StyledIconSlot = styled(Primitive.div, {\n variants: {\n variant: {\n information: {\n color: '$icon-primary',\n },\n warning: {\n color: '$icon-warning',\n },\n danger: {\n color: '$icon-danger',\n },\n success: {\n color: '$icon-success',\n },\n },\n },\n})\n","import React from 'react'\nimport type { ElementRef, ComponentPropsWithRef } from 'react'\nimport {\n IconCheckMark,\n IconExclamationPointCircle,\n IconInformationMarkCircle,\n} from '@mirohq/design-system-icons'\n\nimport { useCalloutContext } from '../hooks/use-callout-context'\nimport { StyledIconSlot } from './icon-slot.styled'\n\nexport type StyledIconSlotProps = ComponentPropsWithRef<typeof StyledIconSlot>\n\nexport interface IconSlotProps extends StyledIconSlotProps {\n /**\n * The icon.\n */\n children?: React.ReactNode\n}\n\nconst iconVariant = {\n success: <IconCheckMark />,\n warning: <IconExclamationPointCircle />,\n danger: <IconExclamationPointCircle />,\n information: <IconInformationMarkCircle />,\n default: <IconCheckMark />,\n}\n\nexport const IconSlot = React.forwardRef<\n ElementRef<typeof StyledIconSlot>,\n IconSlotProps\n>(({ children, ...restProps }, forwardRef) => {\n const { variant } = useCalloutContext()\n\n let formattedChildren = children\n if (React.Children.count(children) < 1) {\n formattedChildren =\n iconVariant[variant as keyof typeof iconVariant] ?? iconVariant.default\n }\n\n return (\n <StyledIconSlot {...restProps} ref={forwardRef} variant={variant}>\n {formattedChildren}\n </StyledIconSlot>\n )\n})\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport { Heading } from '@mirohq/design-system-typography'\nimport type { HeadingProps } from '@mirohq/design-system-typography'\n\nexport interface GroupLabelProps extends Omit<HeadingProps, 'level'> {}\n\nexport const Title = React.forwardRef<\n ElementRef<typeof Heading>,\n GroupLabelProps\n>((props, forwardRef) => <Heading {...props} ref={forwardRef} level={4} />)\n","import { Primitive } from '@mirohq/design-system-primitive'\nimport { styled } from '@mirohq/design-system-stitches'\n\nexport const Actions = styled(Primitive.div, {\n gridArea: 'actions',\n display: 'flex',\n gap: '$100',\n})\n\nActions.displayName = 'Callout.Actions'\n","import { IconButton } from '@mirohq/design-system-icon-button'\nimport type { IconButtonProps } from '@mirohq/design-system-icon-button'\nimport { IconCross } from '@mirohq/design-system-icons'\n\nexport const DismissButton: React.FC<IconButtonProps> = props => (\n <IconButton\n css={{ gridArea: 'close' }}\n variant='ghost'\n size='medium'\n data-testid='dismiss-button'\n {...props}\n >\n <IconCross />\n </IconButton>\n)\n","import React, { useState } from 'react'\nimport type { ElementRef, ForwardRefExoticComponent } from 'react'\n\nimport { StyledCallout } from './callout.styled'\nimport type { StyledCalloutProps } from './callout.styled'\nimport { Content } from './partials/content'\nimport { Description } from './partials/description'\nimport { IconSlot } from './partials/icon-slot'\nimport { Title } from './partials/title'\nimport { Actions } from './partials/actions'\nimport { DismissButton } from './partials/dismiss-button'\nimport { CalloutProvider } from './hooks/use-callout-context'\n\ninterface DismissibleProps {\n /**\n * Whether or not the component is dismissed (hidden)\n */\n dismissed?: boolean\n\n /**\n * Callback invoked once dismiss button is clicked\n */\n onDismiss?: () => void\n\n /**\n * aria-label for the dismiss button\n */\n dismissLabel: string\n}\n\nexport type CalloutProps = (StyledCalloutProps & {\n /**\n * Change the component style.\n */\n variant: StyledCalloutProps['variant']\n\n /**\n * Whether or not the component should display dismiss button\n * @default true\n */\n dismissible?: boolean\n}) &\n (\n | DismissibleProps // uncontrolled\n | Required<DismissibleProps> // controlled\n | ({ dismissible?: false } & { [K in keyof DismissibleProps]?: never })\n )\n\nexport const Callout = React.forwardRef<\n ElementRef<typeof StyledCallout>,\n CalloutProps\n>(\n (\n {\n dismissed,\n dismissible = true,\n onDismiss,\n dismissLabel,\n children,\n variant,\n ...props\n },\n forwardRef\n ) => {\n const [internalDismissed, setInternalDismissed] = useState<boolean>(\n dismissed ?? false\n )\n\n if (dismissed ?? internalDismissed) {\n return null\n }\n\n const handleDismissed = (): void => {\n setInternalDismissed(true)\n onDismiss?.()\n }\n\n return (\n <CalloutProvider variant={variant}>\n <StyledCallout\n {...props}\n ref={forwardRef}\n variant={variant}\n role='alert'\n >\n {children}\n {dismissible && onDismiss != null && dismissLabel?.length > 0 && (\n <DismissButton\n aria-label={dismissLabel}\n onPress={handleDismissed}\n />\n )}\n </StyledCallout>\n </CalloutProvider>\n )\n }\n) as ForwardRefExoticComponent<CalloutProps> & Partials\n\nexport interface Partials {\n Content: typeof Content\n Description: typeof Description\n IconSlot: typeof IconSlot\n Title: typeof Title\n Actions: typeof Actions\n}\n\nCallout.Content = Content\nCallout.Description = Description\nCallout.IconSlot = IconSlot\nCallout.Title = Title\nCallout.Actions = Actions\n"],"names":[],"mappings":";;;;;;;;AAIa,MAAA,aAAA,GAAgB,MAAO,CAAA,SAAA,CAAU,GAAK,EAAA;AAAA,EACjD,SAAW,EAAA,MAAA;AAAA,EACX,MAAQ,EAAA,MAAA;AAAA,EACR,OAAS,EAAA,MAAA;AAAA,EACT,WAAa,EAAA,KAAA;AAAA,EACb,WAAa,EAAA,OAAA;AAAA,EACb,YAAc,EAAA,KAAA;AAAA,EACd,OAAS,EAAA,MAAA;AAAA,EACT,cAAgB,EAAA,QAAA;AAAA,EAChB,mBAAqB,EAAA,aAAA;AAAA,EACrB,iBAAmB,EAAA,gDAAA;AAAA,EAEnB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA;AAAA,MACP,WAAa,EAAA;AAAA,QACX,eAAiB,EAAA,4BAAA;AAAA,QACjB,WAAa,EAAA,wBAAA;AAAA,OACf;AAAA,MACA,OAAS,EAAA;AAAA,QACP,eAAiB,EAAA,4BAAA;AAAA,QACjB,WAAa,EAAA,wBAAA;AAAA,OACf;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,eAAiB,EAAA,2BAAA;AAAA,QACjB,WAAa,EAAA,uBAAA;AAAA,OACf;AAAA,MACA,OAAS,EAAA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AA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,GAAK,EAAA,UAAA;AAAA,QACL,OAAA;AAAA,QACA,IAAK,EAAA,OAAA;AAAA,QAEJ,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,UACA,WAAe,IAAA,SAAA,IAAa,IAAQ,IAAA,CAAA,YAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,YAAA,CAAc,UAAS,CAC1D,oBAAA,GAAA;AAAA,YAAC,aAAA;AAAA,YAAA;AAAA,cACC,YAAY,EAAA,YAAA;AAAA,cACZ,OAAS,EAAA,eAAA;AAAA,aAAA;AAAA,WACX;AAAA,SAAA;AAAA,OAAA;AAAA,KAGN,EAAA,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAUA,OAAA,CAAQ,OAAU,GAAA,OAAA,CAAA;AAClB,OAAA,CAAQ,WAAc,GAAA,WAAA,CAAA;AACtB,OAAA,CAAQ,QAAW,GAAA,QAAA,CAAA;AACnB,OAAA,CAAQ,KAAQ,GAAA,KAAA,CAAA;AAChB,OAAA,CAAQ,OAAU,GAAA,OAAA;;;;"}
@@ -0,0 +1,78 @@
1
+ import * as react from 'react';
2
+ import react__default, { ComponentPropsWithRef } from 'react';
3
+ import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
4
+ import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
5
+ import * as _mirohq_design_system_primitive from '@mirohq/design-system-primitive';
6
+ import { HeadingProps } from '@mirohq/design-system-typography';
7
+
8
+ declare const StyledCallout: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, "variant"> & _stitches_react_types_styled_component.TransformProps<{
9
+ variant?: "information" | "warning" | "danger" | "success" | undefined;
10
+ }, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {
11
+ variant?: "information" | "warning" | "danger" | "success" | undefined;
12
+ }, {}>;
13
+ declare type StyledCalloutProps = ComponentPropsWithRef<typeof StyledCallout>;
14
+
15
+ declare const Content: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
16
+
17
+ declare const Description: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
18
+
19
+ declare const StyledIconSlot: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, "variant"> & _stitches_react_types_styled_component.TransformProps<{
20
+ variant?: "information" | "warning" | "danger" | "success" | undefined;
21
+ }, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {
22
+ variant?: "information" | "warning" | "danger" | "success" | undefined;
23
+ }, {}>;
24
+
25
+ declare type StyledIconSlotProps = ComponentPropsWithRef<typeof StyledIconSlot>;
26
+ interface IconSlotProps extends StyledIconSlotProps {
27
+ /**
28
+ * The icon.
29
+ */
30
+ children?: react__default.ReactNode;
31
+ }
32
+ declare const IconSlot: react__default.ForwardRefExoticComponent<Omit<IconSlotProps, "ref"> & react__default.RefAttributes<HTMLDivElement>>;
33
+
34
+ interface GroupLabelProps extends Omit<HeadingProps, 'level'> {
35
+ }
36
+ declare const Title: react__default.ForwardRefExoticComponent<Omit<GroupLabelProps, "ref"> & react__default.RefAttributes<HTMLHeadingElement>>;
37
+
38
+ declare const Actions: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>>, never> & _stitches_react_types_styled_component.TransformProps<{}, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLDivElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<_mirohq_design_system_primitive.PrimitiveProps<"div">>, {}, {}>;
39
+
40
+ interface DismissibleProps {
41
+ /**
42
+ * Whether or not the component is dismissed (hidden)
43
+ */
44
+ dismissed?: boolean;
45
+ /**
46
+ * Callback invoked once dismiss button is clicked
47
+ */
48
+ onDismiss?: () => void;
49
+ /**
50
+ * aria-label for the dismiss button
51
+ */
52
+ dismissLabel: string;
53
+ }
54
+ declare type CalloutProps = (StyledCalloutProps & {
55
+ /**
56
+ * Change the component style.
57
+ */
58
+ variant: StyledCalloutProps['variant'];
59
+ /**
60
+ * Whether or not the component should display dismiss button
61
+ * @default true
62
+ */
63
+ dismissible?: boolean;
64
+ }) & (DismissibleProps | Required<DismissibleProps> | ({
65
+ dismissible?: false;
66
+ } & {
67
+ [K in keyof DismissibleProps]?: never;
68
+ }));
69
+ declare const Callout: react__default.ForwardRefExoticComponent<CalloutProps> & Partials;
70
+ interface Partials {
71
+ Content: typeof Content;
72
+ Description: typeof Description;
73
+ IconSlot: typeof IconSlot;
74
+ Title: typeof Title;
75
+ Actions: typeof Actions;
76
+ }
77
+
78
+ export { Callout, CalloutProps };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@mirohq/design-system-callout",
3
+ "version": "0.1.0",
4
+ "description": "",
5
+ "author": "Miro",
6
+ "source": "src/index.ts",
7
+ "main": "dist/main.js",
8
+ "module": "dist/module.js",
9
+ "types": "dist/types.d.ts",
10
+ "sideEffects": false,
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/main.js",
14
+ "import": "./dist/module.js",
15
+ "types": "./dist/types.d.ts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "@stitches/react": "^1.2.8",
26
+ "react": "^16.14 || ^17 || ^18"
27
+ },
28
+ "dependencies": {
29
+ "@mirohq/design-system-icon-button": "^3.2.0",
30
+ "@mirohq/design-system-primitive": "^1.1.2",
31
+ "@mirohq/design-system-stitches": "^2.6.25",
32
+ "@mirohq/design-system-icons": "^0.57.0",
33
+ "@mirohq/design-system-typography": "^0.6.3"
34
+ },
35
+ "scripts": {
36
+ "build": "rollup -c ../../../rollup.config.js",
37
+ "clean": "rm -rf dist",
38
+ "prebuild": "pnpm clean"
39
+ }
40
+ }