@cerberus-design/react 0.16.0-next-7f1fa64 → 0.16.0-next-d049636

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.
Files changed (85) hide show
  1. package/build/legacy/_tsup-dts-rollup.d.cts +94 -48
  2. package/build/legacy/components/admonition/admonition.cjs +314 -0
  3. package/build/legacy/components/admonition/admonition.cjs.map +1 -0
  4. package/build/legacy/components/admonition/index.cjs +326 -0
  5. package/build/legacy/components/admonition/index.cjs.map +1 -0
  6. package/build/legacy/components/{Admonition.client.cjs → admonition/match-avatar.cjs} +61 -65
  7. package/build/legacy/components/admonition/match-avatar.cjs.map +1 -0
  8. package/build/legacy/components/admonition/parts.cjs +88 -0
  9. package/build/legacy/components/admonition/parts.cjs.map +1 -0
  10. package/build/legacy/components/admonition/primitives.cjs +85 -0
  11. package/build/legacy/components/admonition/primitives.cjs.map +1 -0
  12. package/build/legacy/index.cjs +749 -718
  13. package/build/legacy/index.cjs.map +1 -1
  14. package/build/modern/_tsup-dts-rollup.d.ts +94 -48
  15. package/build/modern/chunk-572S5CLA.js +41 -0
  16. package/build/modern/chunk-572S5CLA.js.map +1 -0
  17. package/build/modern/{chunk-32M5JS5F.js → chunk-6I2FW4WI.js} +5 -5
  18. package/build/modern/{chunk-3B4SFTQB.js → chunk-A45TFOGO.js} +4 -4
  19. package/build/modern/{chunk-J7SAFAW3.js → chunk-EKIAT7N7.js} +4 -4
  20. package/build/modern/{chunk-Z6EXPMTS.js → chunk-EKZENP7X.js} +6 -6
  21. package/build/modern/{chunk-WA3QADO4.js → chunk-EQPYRZ3X.js} +4 -4
  22. package/build/modern/{chunk-R7IDIIST.js → chunk-LT62577B.js} +2 -2
  23. package/build/modern/{chunk-3J5D3O6Z.js → chunk-NTU5OYUF.js} +2 -2
  24. package/build/modern/chunk-RKGFPKKK.js +59 -0
  25. package/build/modern/chunk-RKGFPKKK.js.map +1 -0
  26. package/build/modern/chunk-RQCJKDXU.js +21 -0
  27. package/build/modern/chunk-RQCJKDXU.js.map +1 -0
  28. package/build/modern/chunk-TM6TVO2D.js +78 -0
  29. package/build/modern/chunk-TM6TVO2D.js.map +1 -0
  30. package/build/modern/chunk-UR2NYAQC.js +1 -0
  31. package/build/modern/{chunk-VNPLKMEM.js → chunk-VSTOSLFS.js} +4 -4
  32. package/build/modern/{chunk-R662TP4N.js → chunk-XYDJ5TRW.js} +12 -12
  33. package/build/modern/components/FileStatus.js +6 -6
  34. package/build/modern/components/admonition/admonition.js +15 -0
  35. package/build/modern/components/admonition/index.js +30 -0
  36. package/build/modern/components/admonition/index.js.map +1 -0
  37. package/build/modern/components/admonition/match-avatar.js +11 -0
  38. package/build/modern/components/admonition/match-avatar.js.map +1 -0
  39. package/build/modern/components/admonition/parts.js +8 -0
  40. package/build/modern/components/admonition/parts.js.map +1 -0
  41. package/build/modern/components/admonition/primitives.js +15 -0
  42. package/build/modern/components/admonition/primitives.js.map +1 -0
  43. package/build/modern/components/combobox/combobox.js +2 -2
  44. package/build/modern/components/combobox/index.js +6 -6
  45. package/build/modern/components/cta-dialog/index.js +2 -2
  46. package/build/modern/components/cta-dialog/provider.js +2 -2
  47. package/build/modern/components/deprecated/Label.js +5 -5
  48. package/build/modern/components/field/field.js +3 -3
  49. package/build/modern/components/field/index.js +6 -6
  50. package/build/modern/components/field/parts.js +3 -3
  51. package/build/modern/components/field/primitives.js +2 -2
  52. package/build/modern/context/confirm-modal.js +2 -2
  53. package/build/modern/context/field.js +2 -2
  54. package/build/modern/context/prompt-modal.js +9 -9
  55. package/build/modern/index.js +126 -113
  56. package/build/modern/index.js.map +1 -1
  57. package/package.json +2 -2
  58. package/src/components/admonition/admonition.tsx +65 -0
  59. package/src/components/admonition/index.ts +3 -0
  60. package/src/components/admonition/match-avatar.tsx +84 -0
  61. package/src/components/admonition/parts.ts +53 -0
  62. package/src/components/admonition/primitives.tsx +73 -0
  63. package/src/index.ts +1 -1
  64. package/build/legacy/components/Admonition.cjs +0 -273
  65. package/build/legacy/components/Admonition.cjs.map +0 -1
  66. package/build/legacy/components/Admonition.client.cjs.map +0 -1
  67. package/build/modern/chunk-2HOUQ2DX.js +0 -82
  68. package/build/modern/chunk-2HOUQ2DX.js.map +0 -1
  69. package/build/modern/chunk-DXBZ3HMY.js +0 -68
  70. package/build/modern/chunk-DXBZ3HMY.js.map +0 -1
  71. package/build/modern/components/Admonition.client.js +0 -11
  72. package/build/modern/components/Admonition.js +0 -15
  73. package/src/components/Admonition.client.tsx +0 -73
  74. package/src/components/Admonition.tsx +0 -117
  75. /package/build/modern/{chunk-32M5JS5F.js.map → chunk-6I2FW4WI.js.map} +0 -0
  76. /package/build/modern/{chunk-3B4SFTQB.js.map → chunk-A45TFOGO.js.map} +0 -0
  77. /package/build/modern/{chunk-J7SAFAW3.js.map → chunk-EKIAT7N7.js.map} +0 -0
  78. /package/build/modern/{chunk-Z6EXPMTS.js.map → chunk-EKZENP7X.js.map} +0 -0
  79. /package/build/modern/{chunk-WA3QADO4.js.map → chunk-EQPYRZ3X.js.map} +0 -0
  80. /package/build/modern/{chunk-R7IDIIST.js.map → chunk-LT62577B.js.map} +0 -0
  81. /package/build/modern/{chunk-3J5D3O6Z.js.map → chunk-NTU5OYUF.js.map} +0 -0
  82. /package/build/modern/{components/Admonition.client.js.map → chunk-UR2NYAQC.js.map} +0 -0
  83. /package/build/modern/{chunk-VNPLKMEM.js.map → chunk-VSTOSLFS.js.map} +0 -0
  84. /package/build/modern/{chunk-R662TP4N.js.map → chunk-XYDJ5TRW.js.map} +0 -0
  85. /package/build/modern/components/{Admonition.js.map → admonition/admonition.js.map} +0 -0
@@ -1,273 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/components/Admonition.tsx
21
- var Admonition_exports = {};
22
- __export(Admonition_exports, {
23
- Admonition: () => Admonition,
24
- AdmonitionDescription: () => AdmonitionDescription,
25
- AdmonitionHeading: () => AdmonitionHeading
26
- });
27
- module.exports = __toCommonJS(Admonition_exports);
28
- var import_recipes2 = require("@cerberus/styled-system/recipes");
29
- var import_css2 = require("@cerberus/styled-system/css");
30
- var import_patterns2 = require("@cerberus/styled-system/patterns");
31
-
32
- // src/components/Show.tsx
33
- var import_react = require("react");
34
- function Show(props) {
35
- const { when, children, fallback } = props;
36
- const condition = (0, import_react.useMemo)(() => when ?? false, [when]);
37
- return (0, import_react.useMemo)(() => {
38
- if (condition) return children;
39
- return fallback ?? null;
40
- }, [condition, children, fallback]);
41
- }
42
-
43
- // src/context/cerberus.tsx
44
- var import_react2 = require("react");
45
- var import_jsx_runtime = require("react/jsx-runtime");
46
- var CerberusContext = (0, import_react2.createContext)(null);
47
- function useCerberusContext() {
48
- const context = (0, import_react2.useContext)(CerberusContext);
49
- if (!context) {
50
- throw new Error("useCerberus must be used within a CerberusProvider");
51
- }
52
- return context;
53
- }
54
-
55
- // src/components/Avatar.tsx
56
- var import_css = require("@cerberus/styled-system/css");
57
- var import_patterns = require("@cerberus/styled-system/patterns");
58
- var import_recipes = require("@cerberus/styled-system/recipes");
59
- var import_jsx_runtime2 = require("react/jsx-runtime");
60
- function Avatar(props) {
61
- const {
62
- ariaLabel,
63
- as,
64
- gradient,
65
- size,
66
- src,
67
- width,
68
- height,
69
- icon,
70
- ...nativeProps
71
- } = props;
72
- const { icons } = useCerberusContext();
73
- const { avatar: AvatarIcon } = icons;
74
- const initials = (ariaLabel || "").split(" ").map((word) => word[0]).join("").slice(0, 2);
75
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
76
- "div",
77
- {
78
- ...nativeProps,
79
- className: (0, import_css.cx)(
80
- nativeProps.className,
81
- (0, import_recipes.avatar)({ gradient, size }),
82
- (0, import_patterns.circle)()
83
- ),
84
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
85
- Show,
86
- {
87
- when: Boolean(src) || Boolean(as),
88
- fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
89
- Show,
90
- {
91
- when: Boolean(initials),
92
- fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
93
- Show,
94
- {
95
- when: Boolean(icon),
96
- fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
97
- AvatarIcon,
98
- {
99
- size: iconSizeMap[size]
100
- }
101
- ),
102
- children: icon
103
- }
104
- ),
105
- children: initials
106
- }
107
- ),
108
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
109
- Show,
110
- {
111
- when: Boolean(as),
112
- fallback: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
113
- "img",
114
- {
115
- alt: props.ariaLabel,
116
- className: (0, import_css.css)({
117
- h: "full",
118
- objectFit: "cover",
119
- w: "full"
120
- }),
121
- decoding: "async",
122
- loading: "lazy",
123
- src,
124
- height,
125
- width
126
- }
127
- ),
128
- children: as
129
- }
130
- )
131
- }
132
- )
133
- }
134
- );
135
- }
136
- var iconSizeMap = {
137
- xs: 16,
138
- sm: 16,
139
- md: 20,
140
- lg: 34,
141
- xl: 32,
142
- "2xl": 32,
143
- "3xl": 32,
144
- "4xl": 32
145
- };
146
-
147
- // src/components/Admonition.client.tsx
148
- var import_jsx_runtime3 = require("react/jsx-runtime");
149
- function MatchAvatar(props) {
150
- const { icons } = useCerberusContext();
151
- const {
152
- infoNotification: InfoIcon,
153
- successNotification: SuccessIcon,
154
- warningNotification: WarningIcon,
155
- dangerNotification: DangerIcon
156
- } = icons;
157
- switch (props.palette) {
158
- case "page":
159
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
160
- Avatar,
161
- {
162
- gradient: "charon-light",
163
- ariaLabel: "",
164
- icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InfoIcon, {}),
165
- size: "sm",
166
- src: ""
167
- }
168
- );
169
- case "info":
170
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
171
- Avatar,
172
- {
173
- gradient: "amphiaraus-dark",
174
- ariaLabel: "",
175
- icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(InfoIcon, {}),
176
- size: "sm",
177
- src: ""
178
- }
179
- );
180
- case "success":
181
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
182
- Avatar,
183
- {
184
- gradient: "thanatos-dark",
185
- ariaLabel: "",
186
- icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SuccessIcon, {}),
187
- size: "sm",
188
- src: ""
189
- }
190
- );
191
- case "warning":
192
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
193
- Avatar,
194
- {
195
- gradient: "asphodel-light",
196
- ariaLabel: "",
197
- icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(WarningIcon, {}),
198
- size: "sm",
199
- src: ""
200
- }
201
- );
202
- case "danger":
203
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
204
- Avatar,
205
- {
206
- gradient: "hades-light",
207
- ariaLabel: "",
208
- icon: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(DangerIcon, {}),
209
- size: "sm",
210
- src: ""
211
- }
212
- );
213
- default:
214
- throw new Error("Unsupported admonition palette");
215
- }
216
- }
217
-
218
- // src/components/Admonition.tsx
219
- var import_jsx_runtime4 = require("react/jsx-runtime");
220
- function Admonition(props) {
221
- const { children, palette = "page", usage, icon, ...nativeProps } = props;
222
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
223
- "aside",
224
- {
225
- ...nativeProps,
226
- className: (0, import_css2.cx)(
227
- nativeProps.className,
228
- (0, import_patterns2.hstack)({
229
- gap: "md",
230
- w: "full"
231
- }),
232
- (0, import_recipes2.admonition)({ palette, usage }).root
233
- ),
234
- children: [
235
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Show, { when: Boolean(icon), fallback: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(MatchAvatar, { palette }), children: icon }),
236
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { children })
237
- ]
238
- }
239
- );
240
- }
241
- function AdmonitionHeading(props) {
242
- const { palette, usage, ...nativeProps } = props;
243
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
244
- "p",
245
- {
246
- ...nativeProps,
247
- className: (0, import_css2.cx)(
248
- nativeProps.className,
249
- (0, import_recipes2.admonition)({ palette, usage }).heading
250
- )
251
- }
252
- );
253
- }
254
- function AdmonitionDescription(props) {
255
- const { palette, usage, ...nativeProps } = props;
256
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
257
- "p",
258
- {
259
- ...nativeProps,
260
- className: (0, import_css2.cx)(
261
- nativeProps.className,
262
- (0, import_recipes2.admonition)({ palette, usage }).description
263
- )
264
- }
265
- );
266
- }
267
- // Annotate the CommonJS export names for ESM import in node:
268
- 0 && (module.exports = {
269
- Admonition,
270
- AdmonitionDescription,
271
- AdmonitionHeading
272
- });
273
- //# sourceMappingURL=Admonition.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Admonition.tsx","../../../src/components/Show.tsx","../../../src/context/cerberus.tsx","../../../src/components/Avatar.tsx","../../../src/components/Admonition.client.tsx"],"sourcesContent":["import {\n admonition,\n type AdmonitionVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { MatchAvatar } from './Admonition.client'\n\n/**\n * This module provides a set of components for creating admonitions.\n * @module Admonition\n */\n\nexport type AdmonitionProps = HTMLAttributes<HTMLDivElement> &\n AdmonitionVariantProps & {\n /**\n * One off replacement for the icon.\n */\n icon?: ReactNode\n }\n\n/**\n * The `Admonition` component is used to create an admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function Admonition(props: AdmonitionProps) {\n const { children, palette = 'page', usage, icon, ...nativeProps } = props\n return (\n <aside\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n gap: 'md',\n w: 'full',\n }),\n admonition({ palette, usage }).root,\n )}\n >\n <Show when={Boolean(icon)} fallback={<MatchAvatar palette={palette} />}>\n {icon}\n </Show>\n <div>{children}</div>\n </aside>\n )\n}\n\nexport type AdmonitionHeadingProps = HTMLAttributes<HTMLParagraphElement> &\n AdmonitionVariantProps\n\n/**\n * The `AdmonitionHeading` component is used to create a heading within an\n * admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function AdmonitionHeading(props: AdmonitionHeadingProps) {\n const { palette, usage, ...nativeProps } = props\n return (\n <p\n {...nativeProps}\n className={cx(\n nativeProps.className,\n admonition({ palette, usage }).heading,\n )}\n />\n )\n}\n\nexport type AdmonitionDescriptionProps = HTMLAttributes<HTMLParagraphElement> &\n AdmonitionVariantProps\n\n/**\n * The `AdmonitionDescription` component is used to create a description within\n * an admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function AdmonitionDescription(props: AdmonitionDescriptionProps) {\n const { palette, usage, ...nativeProps } = props\n return (\n <p\n {...nativeProps}\n className={cx(\n nativeProps.className,\n admonition({ palette, usage }).description,\n )}\n />\n )\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { icons } = useCerberusContext()\n const { avatar: AvatarIcon } = icons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\n}\n","'use client'\n\nimport type { AdmonitionVariantProps } from '@cerberus/styled-system/recipes'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Avatar } from './Avatar'\n\ntype MatchAvatarProps = AdmonitionVariantProps\n\nexport function MatchAvatar(props: MatchAvatarProps) {\n const { icons } = useCerberusContext()\n const {\n infoNotification: InfoIcon,\n successNotification: SuccessIcon,\n warningNotification: WarningIcon,\n dangerNotification: DangerIcon,\n } = icons\n\n switch (props.palette) {\n case 'page':\n return (\n <Avatar\n gradient=\"charon-light\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'info':\n return (\n <Avatar\n gradient=\"amphiaraus-dark\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'success':\n return (\n <Avatar\n gradient=\"thanatos-dark\"\n ariaLabel=\"\"\n icon={<SuccessIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'warning':\n return (\n <Avatar\n gradient=\"asphodel-light\"\n ariaLabel=\"\"\n icon={<WarningIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'danger':\n return (\n <Avatar\n gradient=\"hades-light\"\n ariaLabel=\"\"\n icon={<DangerIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n\n default:\n throw new Error('Unsupported admonition palette')\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,kBAGO;AACP,IAAAC,cAAmB;AACnB,IAAAC,mBAAuB;;;ACHvB,mBAAgE;AA4BzD,SAAS,KAAK,OAAgD;AACnE,QAAM,EAAE,MAAM,UAAU,SAAS,IAAI;AACrC,QAAM,gBAAY,sBAAQ,MAAM,QAAQ,OAAO,CAAC,IAAI,CAAC;AAErD,aAAO,sBAAQ,MAAM;AACnB,QAAI,UAAW,QAAO;AACtB,WAAO,YAAY;AAAA,EACrB,GAAG,CAAC,WAAW,UAAU,QAAQ,CAAC;AACpC;;;ACpCA,IAAAC,gBAAkE;AAyB9D;AAfJ,IAAM,sBAAkB,6BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,0BAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;ACzCA,iBAAwB;AACxB,sBAAuB;AACvB,qBAGO;AA2GW,IAAAC,sBAAA;AAtCX,SAAS,OAAO,OAAoB;AACzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,IAAI;AACJ,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM,EAAE,QAAQ,WAAW,IAAI;AAC/B,QAAM,YAAY,aAAa,IAC5B,MAAM,GAAG,EACT,IAAI,CAAC,S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GAAG;AAAA,QACL,CAAC;AAAA,YACD,4BAAW,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,MACjC;AAAA,MAEA;AAAA,qDAAC,QAAK,MAAM,QAAQ,IAAI,GAAG,UAAU,6CAAC,eAAY,SAAkB,GACjE,gBACH;AAAA,QACA,6CAAC,SAAK,UAAS;AAAA;AAAA;AAAA,EACjB;AAEJ;AAmBO,SAAS,kBAAkB,OAA+B;AAC/D,QAAM,EAAE,SAAS,OAAO,GAAG,YAAY,IAAI;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,4BAAW,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,MACjC;AAAA;AAAA,EACF;AAEJ;AAmBO,SAAS,sBAAsB,OAAmC;AACvE,QAAM,EAAE,SAAS,OAAO,GAAG,YAAY,IAAI;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,4BAAW,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,MACjC;AAAA;AAAA,EACF;AAEJ;","names":["import_recipes","import_css","import_patterns","import_react","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/Admonition.client.tsx","../../../src/context/cerberus.tsx","../../../src/components/Avatar.tsx","../../../src/components/Show.tsx"],"sourcesContent":["'use client'\n\nimport type { AdmonitionVariantProps } from '@cerberus/styled-system/recipes'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Avatar } from './Avatar'\n\ntype MatchAvatarProps = AdmonitionVariantProps\n\nexport function MatchAvatar(props: MatchAvatarProps) {\n const { icons } = useCerberusContext()\n const {\n infoNotification: InfoIcon,\n successNotification: SuccessIcon,\n warningNotification: WarningIcon,\n dangerNotification: DangerIcon,\n } = icons\n\n switch (props.palette) {\n case 'page':\n return (\n <Avatar\n gradient=\"charon-light\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'info':\n return (\n <Avatar\n gradient=\"amphiaraus-dark\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'success':\n return (\n <Avatar\n gradient=\"thanatos-dark\"\n ariaLabel=\"\"\n icon={<SuccessIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'warning':\n return (\n <Avatar\n gradient=\"asphodel-light\"\n ariaLabel=\"\"\n icon={<WarningIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'danger':\n return (\n <Avatar\n gradient=\"hades-light\"\n ariaLabel=\"\"\n icon={<DangerIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n\n default:\n throw new Error('Unsupported admonition palette')\n }\n}\n","'use client'\n\nimport { createContext, useContext, type PropsWithChildren } from 'react'\nimport type { SystemConfig } from '../config'\n\n/**\n * This module contains the Cerberus configuration context and helpers.\n * @module context/cerberus\n */\n\ntype CerberusContextValue = SystemConfig\n\nconst CerberusContext = createContext<CerberusContextValue | null>(null)\n\ninterface CerberusProviderProps {\n config: SystemConfig\n}\n\n/**\n * Cerberus configuration provider.\n * @param props.config The Cerberus configuration created with\n * `makeSystemConfig` helper.\n */\nexport function CerberusProvider(\n props: PropsWithChildren<CerberusProviderProps>,\n) {\n return (\n <CerberusContext.Provider value={props.config}>\n {props.children}\n </CerberusContext.Provider>\n )\n}\n\n/**\n * Returns the Cerberus configuration context.\n * @returns The Cerberus configuration context.\n */\nexport function useCerberusContext() {\n const context = useContext(CerberusContext)\n if (!context) {\n throw new Error('useCerberus must be used within a CerberusProvider')\n }\n return context\n}\n","'use client'\n\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n avatar,\n type AvatarVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HtmlHTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { useCerberusContext } from '../context/cerberus'\n\n/**\n * This module contains the Avatar component.\n * @module\n */\n\nexport type SharedAvatarProps = {\n /**\n * An optional icon to show when no src or ariaLabel is provided.\n */\n icon?: ReactNode\n /**\n * The size of the avatar.\n */\n width?: number\n /**\n * The size of the avatar.\n */\n height?: number\n}\nexport type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &\n SharedAvatarProps & {\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel: string\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as?: never\n /**\n * The source of the image.\n */\n src: string\n }\nexport type AvatarAsProps = SharedAvatarProps & {\n /**\n * An optional element to replace the image. Recommended for Next.js Image component.\n */\n as: ReactNode\n /**\n * The aria-label for the avatar needed for accessibility.\n */\n ariaLabel?: never\n /**\n * The source of the image.\n */\n src?: never\n}\n\nexport type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &\n AvatarVariantProps) &\n (AvatarImageProps | AvatarAsProps)\n\n/**\n * The Avatar component is used to represent a user or entity. It will show an image if src provided, otherwise it will show the ariaLabel of the ariaLabel. If the ariaLabel is empty, it will show a `defineIcons().avatar` icon.\n * @see https://cerberus.digitalu.design/react/avatar\n * @example\n * ```tsx\n * <Avatar\n * ariaLabel=\"Protector Cerberus\"\n * src=\"https://cerberus.digitalu.design/logo.svg\"\n * />\n * ```\n */\nexport function Avatar(props: AvatarProps) {\n const {\n ariaLabel,\n as,\n gradient,\n size,\n src,\n width,\n height,\n icon,\n ...nativeProps\n } = props\n const { icons } = useCerberusContext()\n const { avatar: AvatarIcon } = icons\n const initials = (ariaLabel || '')\n .split(' ')\n .map((word) => word[0])\n .join('')\n .slice(0, 2)\n\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n avatar({ gradient, size }),\n circle(),\n )}\n >\n <Show\n when={Boolean(src) || Boolean(as)}\n fallback={\n <Show\n when={Boolean(initials)}\n fallback={\n <Show\n when={Boolean(icon)}\n fallback={\n <AvatarIcon\n size={iconSizeMap[size as keyof typeof iconSizeMap]}\n />\n }\n >\n {icon}\n </Show>\n }\n >\n {initials}\n </Show>\n }\n >\n <Show\n when={Boolean(as)}\n fallback={\n <img\n alt={props.ariaLabel}\n className={css({\n h: 'full',\n objectFit: 'cover',\n w: 'full',\n })}\n decoding=\"async\"\n loading=\"lazy\"\n src={src}\n height={height}\n width={width}\n />\n }\n >\n {as}\n </Show>\n </Show>\n </div>\n )\n}\n\nconst iconSizeMap = {\n xs: 16,\n sm: 16,\n md: 20,\n lg: 34,\n xl: 32,\n '2xl': 32,\n '3xl': 32,\n '4xl': 32,\n}\n","'use client'\n\nimport { useMemo, type PropsWithChildren, type ReactNode } from 'react'\n\n/**\n * This module contains the Show component.\n * @module\n */\n\nexport interface ShowProps {\n /**\n * The condition to render memoized children or the fallback content.\n */\n when: boolean | null | undefined\n /**\n * The children to render when the condition is false.\n */\n fallback?: ReactNode\n}\n\n/**\n * Conditionally render a memoized version of the children or optional fallback\n * content.\n * @see https://cerberus.digitalu.design/react/show\n * @example\n * ```tsx\n * <Show when={isLoggedIn} fallback={<Navigate to=\"/login\" />}>\n * <Dashboard />\n * </Show>\n */\nexport function Show(props: PropsWithChildren<ShowProps>): ReactNode {\n const { when, children, fallback } = props\n const condition = useMemo(() => when ?? false, [when])\n\n return useMemo(() => {\n if (condition) return children\n return fallback ?? null\n }, [condition, children, fallback])\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,mBAAkE;AAyB9D;AAfJ,IAAM,sBAAkB,4BAA2C,IAAI;AAyBhE,SAAS,qBAAqB;AACnC,QAAM,cAAU,yBAAW,eAAe;AAC1C,MAAI,CAAC,SAAS;AACZ,UAAM,IAAI,MAAM,oDAAoD;AAAA,EACtE;AACA,SAAO;AACT;;;ACzCA,iBAAwB;AACxB,sBAAuB;AACvB,qBAGO;;;ACLP,IAAAA,gBAAgE;AA4BzD,SAAS,KAAK,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,UACT,WAAU;AAAA,UACV,MAAM,6CAAC,eAAY;AAAA,UACnB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,6CAAC,cAAW;AAAA,UAClB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAGJ;AACE,YAAM,IAAI,MAAM,gCAAgC;AAAA,EACpD;AACF;","names":["import_react","import_jsx_runtime","import_jsx_runtime"]}
@@ -1,82 +0,0 @@
1
- import {
2
- Avatar
3
- } from "./chunk-SXLPDPOZ.js";
4
- import {
5
- useCerberusContext
6
- } from "./chunk-GITT5645.js";
7
-
8
- // src/components/Admonition.client.tsx
9
- import { jsx } from "react/jsx-runtime";
10
- function MatchAvatar(props) {
11
- const { icons } = useCerberusContext();
12
- const {
13
- infoNotification: InfoIcon,
14
- successNotification: SuccessIcon,
15
- warningNotification: WarningIcon,
16
- dangerNotification: DangerIcon
17
- } = icons;
18
- switch (props.palette) {
19
- case "page":
20
- return /* @__PURE__ */ jsx(
21
- Avatar,
22
- {
23
- gradient: "charon-light",
24
- ariaLabel: "",
25
- icon: /* @__PURE__ */ jsx(InfoIcon, {}),
26
- size: "sm",
27
- src: ""
28
- }
29
- );
30
- case "info":
31
- return /* @__PURE__ */ jsx(
32
- Avatar,
33
- {
34
- gradient: "amphiaraus-dark",
35
- ariaLabel: "",
36
- icon: /* @__PURE__ */ jsx(InfoIcon, {}),
37
- size: "sm",
38
- src: ""
39
- }
40
- );
41
- case "success":
42
- return /* @__PURE__ */ jsx(
43
- Avatar,
44
- {
45
- gradient: "thanatos-dark",
46
- ariaLabel: "",
47
- icon: /* @__PURE__ */ jsx(SuccessIcon, {}),
48
- size: "sm",
49
- src: ""
50
- }
51
- );
52
- case "warning":
53
- return /* @__PURE__ */ jsx(
54
- Avatar,
55
- {
56
- gradient: "asphodel-light",
57
- ariaLabel: "",
58
- icon: /* @__PURE__ */ jsx(WarningIcon, {}),
59
- size: "sm",
60
- src: ""
61
- }
62
- );
63
- case "danger":
64
- return /* @__PURE__ */ jsx(
65
- Avatar,
66
- {
67
- gradient: "hades-light",
68
- ariaLabel: "",
69
- icon: /* @__PURE__ */ jsx(DangerIcon, {}),
70
- size: "sm",
71
- src: ""
72
- }
73
- );
74
- default:
75
- throw new Error("Unsupported admonition palette");
76
- }
77
- }
78
-
79
- export {
80
- MatchAvatar
81
- };
82
- //# sourceMappingURL=chunk-2HOUQ2DX.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Admonition.client.tsx"],"sourcesContent":["'use client'\n\nimport type { AdmonitionVariantProps } from '@cerberus/styled-system/recipes'\nimport { useCerberusContext } from '../context/cerberus'\nimport { Avatar } from './Avatar'\n\ntype MatchAvatarProps = AdmonitionVariantProps\n\nexport function MatchAvatar(props: MatchAvatarProps) {\n const { icons } = useCerberusContext()\n const {\n infoNotification: InfoIcon,\n successNotification: SuccessIcon,\n warningNotification: WarningIcon,\n dangerNotification: DangerIcon,\n } = icons\n\n switch (props.palette) {\n case 'page':\n return (\n <Avatar\n gradient=\"charon-light\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'info':\n return (\n <Avatar\n gradient=\"amphiaraus-dark\"\n ariaLabel=\"\"\n icon={<InfoIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'success':\n return (\n <Avatar\n gradient=\"thanatos-dark\"\n ariaLabel=\"\"\n icon={<SuccessIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'warning':\n return (\n <Avatar\n gradient=\"asphodel-light\"\n ariaLabel=\"\"\n icon={<WarningIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n case 'danger':\n return (\n <Avatar\n gradient=\"hades-light\"\n ariaLabel=\"\"\n icon={<DangerIcon />}\n size=\"sm\"\n src=\"\"\n />\n )\n\n default:\n throw new Error('Unsupported admonition palette')\n }\n}\n"],"mappings":";;;;;;;;AAuBgB;AAfT,SAAS,YAAY,OAAyB;AACnD,QAAM,EAAE,MAAM,IAAI,mBAAmB;AACrC,QAAM;AAAA,IACJ,kBAAkB;AAAA,IAClB,qBAAqB;AAAA,IACrB,qBAAqB;AAAA,IACrB,oBAAoB;AAAA,EACtB,IAAI;AAEJ,UAAQ,MAAM,SAAS;AAAA,IACrB,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,oBAAC,YAAS;AAAA,UAChB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,oBAAC,YAAS;AAAA,UAChB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,oBAAC,eAAY;AAAA,UACnB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,oBAAC,eAAY;AAAA,UACnB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAEJ,KAAK;AACH,aACE;AAAA,QAAC;AAAA;AAAA,UACC,UAAS;AAAA,UACT,WAAU;AAAA,UACV,MAAM,oBAAC,cAAW;AAAA,UAClB,MAAK;AAAA,UACL,KAAI;AAAA;AAAA,MACN;AAAA,IAGJ;AACE,YAAM,IAAI,MAAM,gCAAgC;AAAA,EACpD;AACF;","names":[]}
@@ -1,68 +0,0 @@
1
- import {
2
- MatchAvatar
3
- } from "./chunk-2HOUQ2DX.js";
4
- import {
5
- Show
6
- } from "./chunk-BUVVRQLZ.js";
7
-
8
- // src/components/Admonition.tsx
9
- import {
10
- admonition
11
- } from "@cerberus/styled-system/recipes";
12
- import { cx } from "@cerberus/styled-system/css";
13
- import { hstack } from "@cerberus/styled-system/patterns";
14
- import { jsx, jsxs } from "react/jsx-runtime";
15
- function Admonition(props) {
16
- const { children, palette = "page", usage, icon, ...nativeProps } = props;
17
- return /* @__PURE__ */ jsxs(
18
- "aside",
19
- {
20
- ...nativeProps,
21
- className: cx(
22
- nativeProps.className,
23
- hstack({
24
- gap: "md",
25
- w: "full"
26
- }),
27
- admonition({ palette, usage }).root
28
- ),
29
- children: [
30
- /* @__PURE__ */ jsx(Show, { when: Boolean(icon), fallback: /* @__PURE__ */ jsx(MatchAvatar, { palette }), children: icon }),
31
- /* @__PURE__ */ jsx("div", { children })
32
- ]
33
- }
34
- );
35
- }
36
- function AdmonitionHeading(props) {
37
- const { palette, usage, ...nativeProps } = props;
38
- return /* @__PURE__ */ jsx(
39
- "p",
40
- {
41
- ...nativeProps,
42
- className: cx(
43
- nativeProps.className,
44
- admonition({ palette, usage }).heading
45
- )
46
- }
47
- );
48
- }
49
- function AdmonitionDescription(props) {
50
- const { palette, usage, ...nativeProps } = props;
51
- return /* @__PURE__ */ jsx(
52
- "p",
53
- {
54
- ...nativeProps,
55
- className: cx(
56
- nativeProps.className,
57
- admonition({ palette, usage }).description
58
- )
59
- }
60
- );
61
- }
62
-
63
- export {
64
- Admonition,
65
- AdmonitionHeading,
66
- AdmonitionDescription
67
- };
68
- //# sourceMappingURL=chunk-DXBZ3HMY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/components/Admonition.tsx"],"sourcesContent":["import {\n admonition,\n type AdmonitionVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { cx } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport type { HTMLAttributes, ReactNode } from 'react'\nimport { Show } from './Show'\nimport { MatchAvatar } from './Admonition.client'\n\n/**\n * This module provides a set of components for creating admonitions.\n * @module Admonition\n */\n\nexport type AdmonitionProps = HTMLAttributes<HTMLDivElement> &\n AdmonitionVariantProps & {\n /**\n * One off replacement for the icon.\n */\n icon?: ReactNode\n }\n\n/**\n * The `Admonition` component is used to create an admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function Admonition(props: AdmonitionProps) {\n const { children, palette = 'page', usage, icon, ...nativeProps } = props\n return (\n <aside\n {...nativeProps}\n className={cx(\n nativeProps.className,\n hstack({\n gap: 'md',\n w: 'full',\n }),\n admonition({ palette, usage }).root,\n )}\n >\n <Show when={Boolean(icon)} fallback={<MatchAvatar palette={palette} />}>\n {icon}\n </Show>\n <div>{children}</div>\n </aside>\n )\n}\n\nexport type AdmonitionHeadingProps = HTMLAttributes<HTMLParagraphElement> &\n AdmonitionVariantProps\n\n/**\n * The `AdmonitionHeading` component is used to create a heading within an\n * admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function AdmonitionHeading(props: AdmonitionHeadingProps) {\n const { palette, usage, ...nativeProps } = props\n return (\n <p\n {...nativeProps}\n className={cx(\n nativeProps.className,\n admonition({ palette, usage }).heading,\n )}\n />\n )\n}\n\nexport type AdmonitionDescriptionProps = HTMLAttributes<HTMLParagraphElement> &\n AdmonitionVariantProps\n\n/**\n * The `AdmonitionDescription` component is used to create a description within\n * an admonition.\n * @example\n * ```tsx\n * <Admonition palette=\"page\">\n * <AdmonitionHeading palette=\"page\">Page</AdmonitionHeading>\n * <AdmonitionDescription palette=\"page\">\n * This is a page admonition.\n * </AdmonitionDescription>\n * </Admonition>\n * ```\n * @see https://cerberus.digitalu.design/react/admonition\n */\nexport function AdmonitionDescription(props: AdmonitionDescriptionProps) {\n const { palette, usage, ...nativeProps } = props\n return (\n <p\n {...nativeProps}\n className={cx(\n nativeProps.className,\n admonition({ palette, usage }).description,\n )}\n />\n )\n}\n"],"mappings":";;;;;;;;AAAA;AAAA,EACE;AAAA,OAEK;AACP,SAAS,UAAU;AACnB,SAAS,cAAc;AAkCnB,SAWuC,KAXvC;AAHG,SAAS,WAAW,OAAwB;AACjD,QAAM,EAAE,UAAU,UAAU,QAAQ,OAAO,MAAM,GAAG,YAAY,IAAI;AACpE,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,OAAO;AAAA,UACL,KAAK;AAAA,UACL,GAAG;AAAA,QACL,CAAC;AAAA,QACD,WAAW,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,MACjC;AAAA,MAEA;AAAA,4BAAC,QAAK,MAAM,QAAQ,IAAI,GAAG,UAAU,oBAAC,eAAY,SAAkB,GACjE,gBACH;AAAA,QACA,oBAAC,SAAK,UAAS;AAAA;AAAA;AAAA,EACjB;AAEJ;AAmBO,SAAS,kBAAkB,OAA+B;AAC/D,QAAM,EAAE,SAAS,OAAO,GAAG,YAAY,IAAI;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,MACjC;AAAA;AAAA,EACF;AAEJ;AAmBO,SAAS,sBAAsB,OAAmC;AACvE,QAAM,EAAE,SAAS,OAAO,GAAG,YAAY,IAAI;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,WAAW,EAAE,SAAS,MAAM,CAAC,EAAE;AAAA,MACjC;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,11 +0,0 @@
1
- "use client";
2
- import {
3
- MatchAvatar
4
- } from "../chunk-2HOUQ2DX.js";
5
- import "../chunk-SXLPDPOZ.js";
6
- import "../chunk-GITT5645.js";
7
- import "../chunk-BUVVRQLZ.js";
8
- export {
9
- MatchAvatar
10
- };
11
- //# sourceMappingURL=Admonition.client.js.map
@@ -1,15 +0,0 @@
1
- import {
2
- Admonition,
3
- AdmonitionDescription,
4
- AdmonitionHeading
5
- } from "../chunk-DXBZ3HMY.js";
6
- import "../chunk-2HOUQ2DX.js";
7
- import "../chunk-SXLPDPOZ.js";
8
- import "../chunk-GITT5645.js";
9
- import "../chunk-BUVVRQLZ.js";
10
- export {
11
- Admonition,
12
- AdmonitionDescription,
13
- AdmonitionHeading
14
- };
15
- //# sourceMappingURL=Admonition.js.map
@@ -1,73 +0,0 @@
1
- 'use client'
2
-
3
- import type { AdmonitionVariantProps } from '@cerberus/styled-system/recipes'
4
- import { useCerberusContext } from '../context/cerberus'
5
- import { Avatar } from './Avatar'
6
-
7
- type MatchAvatarProps = AdmonitionVariantProps
8
-
9
- export function MatchAvatar(props: MatchAvatarProps) {
10
- const { icons } = useCerberusContext()
11
- const {
12
- infoNotification: InfoIcon,
13
- successNotification: SuccessIcon,
14
- warningNotification: WarningIcon,
15
- dangerNotification: DangerIcon,
16
- } = icons
17
-
18
- switch (props.palette) {
19
- case 'page':
20
- return (
21
- <Avatar
22
- gradient="charon-light"
23
- ariaLabel=""
24
- icon={<InfoIcon />}
25
- size="sm"
26
- src=""
27
- />
28
- )
29
- case 'info':
30
- return (
31
- <Avatar
32
- gradient="amphiaraus-dark"
33
- ariaLabel=""
34
- icon={<InfoIcon />}
35
- size="sm"
36
- src=""
37
- />
38
- )
39
- case 'success':
40
- return (
41
- <Avatar
42
- gradient="thanatos-dark"
43
- ariaLabel=""
44
- icon={<SuccessIcon />}
45
- size="sm"
46
- src=""
47
- />
48
- )
49
- case 'warning':
50
- return (
51
- <Avatar
52
- gradient="asphodel-light"
53
- ariaLabel=""
54
- icon={<WarningIcon />}
55
- size="sm"
56
- src=""
57
- />
58
- )
59
- case 'danger':
60
- return (
61
- <Avatar
62
- gradient="hades-light"
63
- ariaLabel=""
64
- icon={<DangerIcon />}
65
- size="sm"
66
- src=""
67
- />
68
- )
69
-
70
- default:
71
- throw new Error('Unsupported admonition palette')
72
- }
73
- }