@cerberus-design/react 0.9.1 → 0.9.2-next-dd740c8
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/build/legacy/_tsup-dts-rollup.d.cts +0 -9
- package/build/legacy/components/FileStatus.cjs +147 -46
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +116 -16
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +136 -43
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +136 -43
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +290 -259
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +0 -9
- package/build/modern/{chunk-MLCVO7JP.js → chunk-DGJPW76I.js} +18 -18
- package/build/modern/chunk-DGJPW76I.js.map +1 -0
- package/build/modern/{chunk-KKJKOKP7.js → chunk-O6WHVUEW.js} +4 -4
- package/build/modern/{chunk-CZMC77YO.js → chunk-T7TOXGZT.js} +35 -10
- package/build/modern/chunk-T7TOXGZT.js.map +1 -0
- package/build/modern/{chunk-GB3SECCO.js → chunk-WWJRKSM5.js} +35 -10
- package/build/modern/chunk-WWJRKSM5.js.map +1 -0
- package/build/modern/{chunk-TUIVLIJI.js → chunk-XOVQGPIE.js} +16 -4
- package/build/modern/chunk-XOVQGPIE.js.map +1 -0
- package/build/modern/components/FileStatus.js +3 -1
- package/build/modern/components/FileUploader.js +2 -1
- package/build/modern/context/confirm-modal.js +3 -3
- package/build/modern/context/notification-center.js +2 -2
- package/build/modern/context/prompt-modal.js +3 -3
- package/build/modern/index.js +14 -18
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/FileStatus.tsx +17 -19
- package/src/components/FileUploader.tsx +12 -5
- package/src/context/confirm-modal.tsx +25 -12
- package/src/context/prompt-modal.tsx +25 -12
- package/src/index.ts +0 -1
- package/build/legacy/components/ModalIcon.cjs +0 -51
- package/build/legacy/components/ModalIcon.cjs.map +0 -1
- package/build/modern/chunk-CZMC77YO.js.map +0 -1
- package/build/modern/chunk-GB3SECCO.js.map +0 -1
- package/build/modern/chunk-MLCVO7JP.js.map +0 -1
- package/build/modern/chunk-TUIVLIJI.js.map +0 -1
- package/build/modern/chunk-VCR5C6Q3.js +0 -29
- package/build/modern/chunk-VCR5C6Q3.js.map +0 -1
- package/build/modern/components/ModalIcon.js +0 -7
- package/build/modern/components/ModalIcon.js.map +0 -1
- package/src/components/ModalIcon.tsx +0 -28
- /package/build/modern/{chunk-KKJKOKP7.js.map → chunk-O6WHVUEW.js.map} +0 -0
|
@@ -13,10 +13,11 @@ import {
|
|
|
13
13
|
type FileStatusVariantProps,
|
|
14
14
|
} from '@cerberus/styled-system/recipes'
|
|
15
15
|
import { css, cx } from '@cerberus/styled-system/css'
|
|
16
|
-
import {
|
|
16
|
+
import { hstack, vstack } from '@cerberus/styled-system/patterns'
|
|
17
17
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
18
18
|
import { FieldMessage } from './FieldMessage'
|
|
19
19
|
import { Field } from '../context/field'
|
|
20
|
+
import { Avatar } from './Avatar'
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* This module contains the FileStatus component.
|
|
@@ -97,16 +98,12 @@ export function FileStatus(props: FileStatusProps) {
|
|
|
97
98
|
{...nativeProps}
|
|
98
99
|
className={cx(nativeProps.className, styles.root, hstack())}
|
|
99
100
|
>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)}
|
|
107
|
-
>
|
|
108
|
-
<MatchFileStatusIcon status={status} />
|
|
109
|
-
</div>
|
|
101
|
+
<Avatar
|
|
102
|
+
ariaLabel=""
|
|
103
|
+
gradient={modalIconPalette}
|
|
104
|
+
icon={<MatchFileStatusIcon size={24} status={status} />}
|
|
105
|
+
src=""
|
|
106
|
+
/>
|
|
110
107
|
|
|
111
108
|
<div
|
|
112
109
|
className={vstack({
|
|
@@ -124,7 +121,7 @@ export function FileStatus(props: FileStatusProps) {
|
|
|
124
121
|
{file}
|
|
125
122
|
</small>
|
|
126
123
|
<ProgressBar now={now} size="sm" />
|
|
127
|
-
<Field invalid={modalIconPalette === '
|
|
124
|
+
<Field invalid={modalIconPalette === 'red'}>
|
|
128
125
|
<FieldMessage
|
|
129
126
|
className={css({
|
|
130
127
|
color: 'page.text.100',
|
|
@@ -150,6 +147,7 @@ export function FileStatus(props: FileStatusProps) {
|
|
|
150
147
|
|
|
151
148
|
interface FileStatusElProps {
|
|
152
149
|
status: FileStatusProps['status']
|
|
150
|
+
size?: 16 | 20 | 24 | 32
|
|
153
151
|
now?: number
|
|
154
152
|
}
|
|
155
153
|
|
|
@@ -163,11 +161,11 @@ function MatchFileStatusIcon(props: FileStatusElProps) {
|
|
|
163
161
|
switch (props.status) {
|
|
164
162
|
case processStatus.TODO:
|
|
165
163
|
case processStatus.PROCESSING:
|
|
166
|
-
return <FileUploaderIcon />
|
|
164
|
+
return <FileUploaderIcon size={props.size} />
|
|
167
165
|
case processStatus.DONE:
|
|
168
|
-
return <DoneIcon />
|
|
166
|
+
return <DoneIcon size={props.size} />
|
|
169
167
|
case processStatus.ERROR:
|
|
170
|
-
return <InvalidIcon />
|
|
168
|
+
return <InvalidIcon size={props.size} />
|
|
171
169
|
default:
|
|
172
170
|
throw new Error('Unknown status')
|
|
173
171
|
}
|
|
@@ -235,12 +233,12 @@ function getModalIconPalette(status: FileStatusKey) {
|
|
|
235
233
|
switch (status) {
|
|
236
234
|
case processStatus.TODO:
|
|
237
235
|
case processStatus.PROCESSING:
|
|
238
|
-
return '
|
|
236
|
+
return 'light-purple'
|
|
239
237
|
case processStatus.ERROR:
|
|
240
|
-
return '
|
|
238
|
+
return 'red'
|
|
241
239
|
case processStatus.DONE:
|
|
242
|
-
return '
|
|
240
|
+
return 'green'
|
|
243
241
|
default:
|
|
244
|
-
return '
|
|
242
|
+
return 'light-purple'
|
|
245
243
|
}
|
|
246
244
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { cx } from '@cerberus/styled-system/css'
|
|
4
|
-
import {
|
|
4
|
+
import { vstack } from '@cerberus/styled-system/patterns'
|
|
5
5
|
import { type InputHTMLAttributes } from 'react'
|
|
6
6
|
import { Show } from './Show'
|
|
7
|
-
import { fileUploader
|
|
7
|
+
import { fileUploader } from '@cerberus/styled-system/recipes'
|
|
8
8
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
9
|
+
import { Avatar } from './Avatar'
|
|
9
10
|
|
|
10
11
|
export interface FileUploaderProps
|
|
11
12
|
extends InputHTMLAttributes<HTMLInputElement> {
|
|
@@ -26,9 +27,15 @@ export function FileUploader(props: FileUploaderProps) {
|
|
|
26
27
|
styles.container,
|
|
27
28
|
)}
|
|
28
29
|
>
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
|
|
30
|
+
<div className={styles.icon}>
|
|
31
|
+
<Avatar
|
|
32
|
+
gradient="light-purple"
|
|
33
|
+
ariaLabel=""
|
|
34
|
+
icon={<Icon />}
|
|
35
|
+
size="md"
|
|
36
|
+
src=""
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
32
39
|
|
|
33
40
|
<label
|
|
34
41
|
className={cx(
|
|
@@ -16,13 +16,13 @@ import { css } from '@cerberus/styled-system/css'
|
|
|
16
16
|
import { hstack } from '@cerberus/styled-system/patterns'
|
|
17
17
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
18
18
|
import { trapFocus } from '../aria-helpers/trap-focus.aria'
|
|
19
|
-
import { ModalIcon } from '../components/ModalIcon'
|
|
20
19
|
import { Show } from '../components/Show'
|
|
21
20
|
import { Modal } from '../components/Modal'
|
|
22
21
|
import { useModal } from '../hooks/useModal'
|
|
23
22
|
import { ModalHeader } from '../components/ModalHeader'
|
|
24
23
|
import { ModalHeading } from '../components/ModalHeading'
|
|
25
24
|
import { ModalDescription } from '../components/ModalDescription'
|
|
25
|
+
import { Avatar } from '../components/Avatar'
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* This module provides a context and hook for the confirm modal.
|
|
@@ -123,18 +123,31 @@ export function ConfirmModal(
|
|
|
123
123
|
<Portal>
|
|
124
124
|
<Modal onKeyDown={focusTrap} ref={modalRef}>
|
|
125
125
|
<ModalHeader>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
</ModalIcon>
|
|
132
|
-
}
|
|
126
|
+
<div
|
|
127
|
+
className={hstack({
|
|
128
|
+
justify: 'center',
|
|
129
|
+
w: 'full',
|
|
130
|
+
})}
|
|
133
131
|
>
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
<Show
|
|
133
|
+
when={palette === 'danger'}
|
|
134
|
+
fallback={
|
|
135
|
+
<Avatar
|
|
136
|
+
ariaLabel=""
|
|
137
|
+
gradient="light-purple"
|
|
138
|
+
icon={<ConfirmIcon size={24} />}
|
|
139
|
+
src=""
|
|
140
|
+
/>
|
|
141
|
+
}
|
|
142
|
+
>
|
|
143
|
+
<Avatar
|
|
144
|
+
ariaLabel=""
|
|
145
|
+
gradient="red"
|
|
146
|
+
icon={<ConfirmIcon size={24} />}
|
|
147
|
+
src=""
|
|
148
|
+
/>
|
|
149
|
+
</Show>
|
|
150
|
+
</div>
|
|
138
151
|
<ModalHeading>{content?.heading}</ModalHeading>
|
|
139
152
|
<ModalDescription>{content?.description}</ModalDescription>
|
|
140
153
|
</ModalHeader>
|
|
@@ -20,13 +20,13 @@ import { Input } from '../components/Input'
|
|
|
20
20
|
import { Field } from './field'
|
|
21
21
|
import { Label } from '../components/Label'
|
|
22
22
|
import { $cerberusIcons } from '../config/defineIcons'
|
|
23
|
-
import { ModalIcon } from '../components/ModalIcon'
|
|
24
23
|
import { Show } from '../components/Show'
|
|
25
24
|
import { useModal } from '../hooks/useModal'
|
|
26
25
|
import { Modal } from '../components/Modal'
|
|
27
26
|
import { ModalHeader } from '../components/ModalHeader'
|
|
28
27
|
import { ModalHeading } from '../components/ModalHeading'
|
|
29
28
|
import { ModalDescription } from '../components/ModalDescription'
|
|
29
|
+
import { Avatar } from '../components/Avatar'
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* This module provides a context and hook for the prompt modal.
|
|
@@ -142,18 +142,31 @@ export function PromptModal(
|
|
|
142
142
|
<Portal>
|
|
143
143
|
<Modal onKeyDown={focusTrap} ref={modalRef}>
|
|
144
144
|
<ModalHeader>
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
</ModalIcon>
|
|
151
|
-
}
|
|
145
|
+
<div
|
|
146
|
+
className={hstack({
|
|
147
|
+
justify: 'center',
|
|
148
|
+
w: 'full',
|
|
149
|
+
})}
|
|
152
150
|
>
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
<Show
|
|
152
|
+
when={palette === 'danger'}
|
|
153
|
+
fallback={
|
|
154
|
+
<Avatar
|
|
155
|
+
ariaLabel=""
|
|
156
|
+
gradient="light-purple"
|
|
157
|
+
icon={<PromptIcon size={24} />}
|
|
158
|
+
src=""
|
|
159
|
+
/>
|
|
160
|
+
}
|
|
161
|
+
>
|
|
162
|
+
<Avatar
|
|
163
|
+
ariaLabel=""
|
|
164
|
+
gradient="red"
|
|
165
|
+
icon={<PromptIcon size={24} />}
|
|
166
|
+
src=""
|
|
167
|
+
/>
|
|
168
|
+
</Show>
|
|
169
|
+
</div>
|
|
157
170
|
<ModalHeading>{content?.heading}</ModalHeading>
|
|
158
171
|
<ModalDescription>{content?.description}</ModalDescription>
|
|
159
172
|
</ModalHeader>
|
package/src/index.ts
CHANGED
|
@@ -20,7 +20,6 @@ export * from './components/Modal'
|
|
|
20
20
|
export * from './components/ModalHeader'
|
|
21
21
|
export * from './components/ModalHeading'
|
|
22
22
|
export * from './components/ModalDescription'
|
|
23
|
-
export * from './components/ModalIcon'
|
|
24
23
|
export * from './components/NavMenuTrigger'
|
|
25
24
|
export * from './components/NavMenuList'
|
|
26
25
|
export * from './components/NavMenuLink'
|
|
@@ -1,51 +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/ModalIcon.tsx
|
|
21
|
-
var ModalIcon_exports = {};
|
|
22
|
-
__export(ModalIcon_exports, {
|
|
23
|
-
ModalIcon: () => ModalIcon
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(ModalIcon_exports);
|
|
26
|
-
var import_css = require("@cerberus/styled-system/css");
|
|
27
|
-
var import_patterns = require("@cerberus/styled-system/patterns");
|
|
28
|
-
var import_recipes = require("@cerberus/styled-system/recipes");
|
|
29
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
|
-
function ModalIcon(props) {
|
|
31
|
-
const { palette, ...nativeProps } = props;
|
|
32
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
|
-
"div",
|
|
34
|
-
{
|
|
35
|
-
...nativeProps,
|
|
36
|
-
className: (0, import_css.cx)(
|
|
37
|
-
nativeProps.className,
|
|
38
|
-
(0, import_recipes.modalIcon)({
|
|
39
|
-
palette
|
|
40
|
-
}),
|
|
41
|
-
(0, import_patterns.circle)()
|
|
42
|
-
),
|
|
43
|
-
children: props.children
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
ModalIcon
|
|
50
|
-
});
|
|
51
|
-
//# sourceMappingURL=ModalIcon.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/ModalIcon.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n modalIcon,\n type ModalIconVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nexport type ModalIconProps = HTMLAttributes<HTMLDivElement> &\n ModalIconVariantProps\n\nexport function ModalIcon(props: PropsWithChildren<ModalIconProps>) {\n const { palette, ...nativeProps } = props\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n modalIcon({\n palette,\n }),\n circle(),\n )}\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAmB;AACnB,sBAAuB;AACvB,qBAGO;AASH;AAHG,SAAS,UAAU,OAA0C;AAClE,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,eAAW;AAAA,QACT,YAAY;AAAA,YACZ,0BAAU;AAAA,UACR;AAAA,QACF,CAAC;AAAA,YACD,wBAAO;AAAA,MACT;AAAA,MAEC,gBAAM;AAAA;AAAA,EACT;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/prompt-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { Input } from '../components/Input'\nimport { Field } from './field'\nimport { Label } from '../components/Label'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { ModalIcon } from '../components/ModalIcon'\nimport { Show } from '../components/Show'\nimport { useModal } from '../hooks/useModal'\nimport { Modal } from '../components/Modal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\n\n/**\n * This module provides a context and hook for the prompt modal.\n * @module\n */\n\nexport interface ShowPromptModalOptions {\n kind?: 'destructive' | 'non-destructive'\n heading: string\n description?: string\n key: string\n actionText: string\n cancelText: string\n}\nexport type PromptShowResult =\n | ((value: string | PromiseLike<string>) => void)\n | null\n\nexport interface PromptModalValue {\n show: (options: ShowPromptModalOptions) => Promise<string>\n}\n\nconst PromptModalContext = createContext<PromptModalValue | null>(null)\n\nexport interface PromptModalProviderProps {}\n\n/**\n * Provides a prompt modal to the app.\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <PromptModal>\n * <SomeFeatureSection />\n * </PromptModal>\n *\n * // Use the hook to show the prompt modal.\n * const prompt = usePromptModal()\n *\n * const handleClick = useCallback(async () => {\n * const accepted = await prompt.show({\n * kind: 'destructive',\n * heading: 'Delete channel?',\n * description:\n * 'This will permanently delete a channel on your account. There is no going back.',\n * key: CHANNEL_NAME,\n * actionText: 'Yes, delete channel',\n * cancelText: 'No, cancel',\n * })\n * // do something with accepted\n * }, [prompt])\n * ```\n */\nexport function PromptModal(\n props: PropsWithChildren<PromptModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<PromptShowResult>(null)\n const [content, setContent] = useState<ShowPromptModalOptions | null>(null)\n const [inputValue, setInputValue] = useState<string>('')\n const focusTrap = trapFocus(modalRef)\n const PromptIcon = $cerberusIcons.promptModal\n\n const isValid = useMemo(\n () => inputValue === content?.key,\n [inputValue, content],\n )\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n setInputValue(e.currentTarget.value)\n },\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(inputValue)\n }\n close()\n },\n [inputValue, close],\n )\n\n const handleShow = useCallback(\n (options: ShowPromptModalOptions) => {\n return new Promise<string>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <PromptModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <Show\n when={palette === 'danger'}\n fallback={\n <ModalIcon palette=\"action\">\n <PromptIcon size={24} />\n </ModalIcon>\n }\n >\n <ModalIcon palette=\"danger\">\n <PromptIcon size={24} />\n </ModalIcon>\n </Show>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n mt: '4',\n mb: '8',\n })}\n >\n <Field invalid={!isValid}>\n <Label htmlFor=\"confirm\" size=\"md\">\n Type\n <strong\n className={css({\n textTransform: 'uppercase',\n })}\n >\n {content?.key}\n </strong>\n to confirm\n </Label>\n <Input\n id=\"confirm\"\n name=\"confirm\"\n onChange={handleChange}\n type=\"text\"\n />\n </Field>\n </div>\n\n <div\n className={hstack({\n justifyContent: 'stretch',\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n disabled={!isValid}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </PromptModalContext.Provider>\n )\n}\n\nexport function usePromptModal(): PromptModalValue {\n const context = useContext(PromptModalContext)\n if (context === null) {\n throw new Error('usePromptModal must be used within a PromptModal Provider')\n }\n return context\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAGP,SAAS,WAAW;AACpB,SAAS,QAAQ,cAAc;AA+HrB,SAKQ,KALR;AA5FV,IAAM,qBAAqB,cAAuC,IAAI;AA8B/D,SAAS,YACd,OACA;AACA,QAAM,EAAE,UAAU,MAAM,MAAM,IAAI,SAAS;AAC3C,QAAM,aAAa,OAAyB,IAAI;AAChD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwC,IAAI;AAC1E,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AACvD,QAAM,YAAY,UAAU,QAAQ;AACpC,QAAM,aAAa,eAAe;AAElC,QAAM,UAAU;AAAA,IACd,MAAM,eAAe,SAAS;AAAA,IAC9B,CAAC,YAAY,OAAO;AAAA,EACtB;AAEA,QAAM,UAAU;AAAA,IACd,MAAO,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|
-
{"version":3,"sources":["../../src/context/confirm-modal.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n} from 'react'\nimport { Portal } from '../components/Portal'\nimport { Button } from '../components/Button'\nimport { css } from '@cerberus/styled-system/css'\nimport { hstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { trapFocus } from '../aria-helpers/trap-focus.aria'\nimport { ModalIcon } from '../components/ModalIcon'\nimport { Show } from '../components/Show'\nimport { Modal } from '../components/Modal'\nimport { useModal } from '../hooks/useModal'\nimport { ModalHeader } from '../components/ModalHeader'\nimport { ModalHeading } from '../components/ModalHeading'\nimport { ModalDescription } from '../components/ModalDescription'\n\n/**\n * This module provides a context and hook for the confirm modal.\n * @module\n */\n\nexport interface ShowConfirmModalOptions {\n kind?: 'destructive' | 'non-destructive'\n heading: string\n description?: string\n actionText: string\n cancelText: string\n}\nexport type ShowResult =\n | ((value: boolean | PromiseLike<boolean>) => void)\n | null\n\nexport interface ConfirmModalValue {\n show: (options: ShowConfirmModalOptions) => Promise<boolean>\n}\n\nconst ConfirmModalContext = createContext<ConfirmModalValue | null>(null)\n\nexport interface ConfirmModalProviderProps {}\n\n/**\n * Provides a confirm modal to the app.\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <ConfirmModal>\n * <SomeFeatureSection />\n * </ConfirmModal>\n *\n * // Use the hook to show the confirm modal.\n * const confirm = useConfirmModal()\n *\n * const handleClick = useCallback(async () => {\n * const userConsent = await confirm.show({\n * heading: 'Add new payment method?',\n * description:\n * 'This will add a new payment method to your account to be billed for future purchases.',\n * actionText: 'Yes, add payment method',\n * cancelText: 'No, cancel',\n * })\n * setConsent(userConsent)\n * }, [confirm])\n * ```\n */\nexport function ConfirmModal(\n props: PropsWithChildren<ConfirmModalProviderProps>,\n) {\n const { modalRef, show, close } = useModal()\n const resolveRef = useRef<ShowResult>(null)\n const [content, setContent] = useState<ShowConfirmModalOptions | null>(null)\n const focusTrap = trapFocus(modalRef)\n const ConfirmIcon = $cerberusIcons.confirmModal\n\n const palette = useMemo(\n () => (content?.kind === 'destructive' ? 'danger' : 'action'),\n [content],\n )\n\n const handleChoice = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n if (target.value === 'true') {\n resolveRef.current?.(true)\n }\n resolveRef.current?.(false)\n close()\n },\n [close],\n )\n\n const handleShow = useCallback(\n (options: ShowConfirmModalOptions) => {\n return new Promise<boolean>((resolve) => {\n setContent({ ...options, kind: options.kind || 'non-destructive' })\n show()\n resolveRef.current = resolve\n })\n },\n [show],\n )\n\n const value = useMemo(\n () => ({\n show: handleShow,\n }),\n [handleShow],\n )\n\n return (\n <ConfirmModalContext.Provider value={value}>\n {props.children}\n\n <Portal>\n <Modal onKeyDown={focusTrap} ref={modalRef}>\n <ModalHeader>\n <Show\n when={palette === 'danger'}\n fallback={\n <ModalIcon palette=\"action\">\n <ConfirmIcon size={24} />\n </ModalIcon>\n }\n >\n <ModalIcon palette=\"danger\">\n <ConfirmIcon size={24} />\n </ModalIcon>\n </Show>\n <ModalHeading>{content?.heading}</ModalHeading>\n <ModalDescription>{content?.description}</ModalDescription>\n </ModalHeader>\n\n <div\n className={hstack({\n gap: '4',\n })}\n >\n <Button\n autoFocus\n className={css({\n w: '1/2',\n })}\n name=\"confirm\"\n onClick={handleChoice}\n palette={palette}\n value=\"true\"\n >\n {content?.actionText}\n </Button>\n <Button\n className={css({\n w: '1/2',\n })}\n name=\"cancel\"\n onClick={handleChoice}\n usage=\"outlined\"\n value=\"false\"\n >\n {content?.cancelText}\n </Button>\n </div>\n </Modal>\n </Portal>\n </ConfirmModalContext.Provider>\n )\n}\n\nexport function useConfirmModal(): ConfirmModalValue {\n const context = useContext(ConfirmModalContext)\n if (context === null) {\n throw new Error(\n 'useConfirmModal must be used within a ConfirmModal Provider',\n )\n }\n return context\n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;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,YAAY;AAAA,YAClB,UACE,oBAAC,aAAU,SAAQ,UACjB,8BAAC,eAAY,MAAM,IAAI,GACzB;AAAA,YAGF,8BAAC,aAAU,SAAQ,UACjB,8BAAC,eAAY,MAAM,IAAI,GACzB;AAAA;AAAA,QACF;AAAA,QACA,oBAAC,gBAAc,mBAAS,SAAQ;AAAA,QAChC,oBAAC,oBAAkB,mBAAS,aAAY;AAAA,SAC1C;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,OAAO;AAAA,YAChB,KAAK;AAAA,UACP,CAAC;AAAA,UAED;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAS;AAAA,gBACT,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT;AAAA,gBACA,OAAM;AAAA,gBAEL,mBAAS;AAAA;AAAA,YACZ;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,IAAI;AAAA,kBACb,GAAG;AAAA,gBACL,CAAC;AAAA,gBACD,MAAK;AAAA,gBACL,SAAS;AAAA,gBACT,OAAM;AAAA,gBACN,OAAM;AAAA,gBAEL,mBAAS;AAAA;AAAA,YACZ;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEO,SAAS,kBAAqC;AACnD,QAAM,UAAU,WAAW,mBAAmB;AAC9C,MAAI,YAAY,MAAM;AACpB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/FileStatus.tsx"],"sourcesContent":["'use client'\n\nimport {\n useCallback,\n useMemo,\n type HTMLAttributes,\n type MouseEvent,\n} from 'react'\nimport { ProgressBar } from './ProgressBar'\nimport { IconButton } from './IconButton'\nimport {\n fileStatus,\n type FileStatusVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport { css, cx } from '@cerberus/styled-system/css'\nimport { circle, hstack, vstack } from '@cerberus/styled-system/patterns'\nimport { $cerberusIcons } from '../config/defineIcons'\nimport { FieldMessage } from './FieldMessage'\nimport { Field } from '../context/field'\n\n/**\n * This module contains the FileStatus component.\n * @module\n */\n\nexport type FileStatusKey = (typeof processStatus)[keyof typeof processStatus]\nexport type FileStatusActions = 'cancel' | 'retry' | 'delete'\nexport interface FileBaseStatusProps\n extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {\n file: string\n now: number\n status: processStatus\n onClick: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n}\nexport type FileStatusProps = FileBaseStatusProps & FileStatusVariantProps\n\n/**\n * A helper object to represent the status of a file.\n * @example\n * ```tsx\n * import { fileStatus } from '@cerberus/react'\n * processStatus.TODO // 'todo'\n * ```\n */\nexport const enum processStatus {\n TODO = 'todo',\n PROCESSING = 'processing',\n DONE = 'done',\n ERROR = 'error',\n}\n\n/**\n * This component displays the status of a file.\n * @param props - {\n * file: string,\n * now: number,\n * status: keyof typeof fileStatus,\n * action: (status: FileStatusActions, e: MouseEvent<HTMLButtonElement>) => void\n * }.\n * @example\n * ```tsx\n * <FileStatus file=\"file.txt\" now={0} status={processStatus.TODO} action={(status, e) => console.log(status, e)} />\n * ```\n */\nexport function FileStatus(props: FileStatusProps) {\n const { file, now, status, onClick, ...nativeProps } = props\n const actionLabel = useMemo(() => getStatusActionLabel(status), [status])\n const palette = useMemo(() => getPalette(status), [status])\n const modalIconPalette = useMemo(() => getModalIconPalette(status), [status])\n const styles = useMemo(() => {\n switch (status) {\n case processStatus.TODO:\n return fileStatus({ status: 'todo' })\n case processStatus.PROCESSING:\n return fileStatus({ status: 'processing' })\n case processStatus.DONE:\n return fileStatus({ status: 'done' })\n case processStatus.ERROR:\n return fileStatus({ status: 'error' })\n default:\n return fileStatus()\n }\n }, [status])\n\n const handleClick = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n const actionStatus = getStatusActionLabel(\n status,\n ).toLocaleLowerCase() as FileStatusActions\n onClick(actionStatus, e)\n },\n [onClick],\n )\n\n return (\n <div\n {...nativeProps}\n className={cx(nativeProps.className, styles.root, hstack())}\n >\n <div\n className={cx(\n styles.icon,\n circle({\n size: '2rem',\n }),\n )}\n >\n <MatchFileStatusIcon status={status} />\n </div>\n\n <div\n className={vstack({\n alignItems: 'flex-start',\n gap: '0.12rem',\n w: 'full',\n })}\n >\n <small\n className={css({\n color: 'page.text.initial',\n textStyle: 'label-sm',\n })}\n >\n {file}\n </small>\n <ProgressBar now={now} size=\"sm\" />\n <Field invalid={modalIconPalette === 'danger'}>\n <FieldMessage\n className={css({\n color: 'page.text.100',\n })}\n id={`help:${file}`}\n >\n <MatchFileStatusText status={status} now={now} />\n </FieldMessage>\n </Field>\n </div>\n\n <IconButton\n ariaLabel={actionLabel}\n onClick={handleClick}\n palette={palette}\n size=\"sm\"\n >\n <MatchStatusAction status={status} />\n </IconButton>\n </div>\n )\n}\n\ninterface FileStatusElProps {\n status: FileStatusProps['status']\n now?: number\n}\n\nfunction MatchFileStatusIcon(props: FileStatusElProps) {\n const {\n fileUploader: FileUploaderIcon,\n invalidAlt: InvalidIcon,\n successNotification: DoneIcon,\n } = $cerberusIcons\n\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <FileUploaderIcon />\n case processStatus.DONE:\n return <DoneIcon />\n case processStatus.ERROR:\n return <InvalidIcon />\n default:\n throw new Error('Unknown status')\n }\n}\n\nfunction MatchFileStatusText(props: FileStatusElProps) {\n switch (props.status) {\n case processStatus.TODO:\n return 'Waiting to upload'\n case processStatus.PROCESSING:\n return `${props.now}% Complete`\n case processStatus.DONE:\n return 'File uploaded successfully'\n case processStatus.ERROR:\n return 'There was an error uploading the file'\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction MatchStatusAction(props: FileStatusElProps) {\n const { close: CloseIcon, redo: RedoIcon, delete: TrashIcon } = $cerberusIcons\n switch (props.status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return <CloseIcon />\n case processStatus.ERROR:\n return <RedoIcon />\n case processStatus.DONE:\n return <TrashIcon />\n default:\n throw new Error('Invalid status')\n }\n}\n\nfunction getStatusActionLabel(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'Cancel'\n case processStatus.ERROR:\n return 'Retry'\n case processStatus.DONE:\n return 'Delete'\n default:\n return ''\n }\n}\n\nfunction getPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'danger'\n case processStatus.ERROR:\n return 'action'\n case processStatus.DONE:\n return 'danger'\n default:\n return 'action'\n }\n}\n\nfunction getModalIconPalette(status: FileStatusKey) {\n switch (status) {\n case processStatus.TODO:\n case processStatus.PROCESSING:\n return 'action'\n case processStatus.ERROR:\n return 'danger'\n case processStatus.DONE:\n return 'success'\n default:\n return 'action'\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAEA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAGP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,KAAK,UAAU;AACxB,SAAS,QAAQ,QAAQ,cAAc;AA4F/B,cAGF,YAHE;AA/DD,IAAW,gBAAX,kBAAWA,mBAAX;AACL,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,gBAAa;AACb,EAAAA,eAAA,UAAO;AACP,EAAAA,eAAA,WAAQ;AAJQ,SAAAA;AAAA,GAAA;AAoBX,SAAS,WAAW,OAAwB;AACjD,QAAM,EAAE,MAAM,KAAK,QAAQ,SAAS,GAAG,YAAY,IAAI;AACvD,QAAM,cAAc,QAAQ,MAAM,qBAAqB,MAAM,GAAG,CAAC,MAAM,CAAC;AACxE,QAAM,UAAU,QAAQ,MAAM,WAAW,MAAM,GAAG,CAAC,MAAM,CAAC;AAC1D,QAAM,mBAAmB,QAAQ,MAAM,oBAAoB,MA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IAAI,MAAM,gBAAgB;AAAA,EACpC;AACF;AAEA,SAAS,qBAAqB,QAAuB;AACnD,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,WAAW,QAAuB;AACzC,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,oBAAoB,QAAuB;AAClD,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;","names":["processStatus"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/FileUploader.tsx"],"sourcesContent":["'use client'\n\nimport { cx } from '@cerberus/styled-system/css'\nimport { circle, vstack } from '@cerberus/styled-system/patterns'\nimport { type InputHTMLAttributes } from 'react'\nimport { Show } from './Show'\nimport { fileUploader, modalIcon } from '@cerberus/styled-system/recipes'\nimport { $cerberusIcons } from '../config/defineIcons'\n\nexport interface FileUploaderProps\n extends InputHTMLAttributes<HTMLInputElement> {\n heading?: string\n name: string\n}\n\nexport function FileUploader(props: FileUploaderProps) {\n const styles = fileUploader()\n const Icon = $cerberusIcons.fileUploader\n\n return (\n <div\n className={cx(\n vstack({\n justify: 'center',\n }),\n styles.container,\n )}\n >\n <span className={cx(styles.icon, modalIcon(), circle())}>\n <Icon />\n </span>\n\n <label\n className={cx(\n vstack({\n justify: 'center',\n }),\n styles.label,\n )}\n htmlFor={props.name}\n >\n <Show when={Boolean(props.heading)}>\n <p className={styles.heading}>{props.heading}</p>\n </Show>\n Import {props.accept?.replace(',', ', ')} files\n <p className={styles.description}>Click to select files</p>\n <input\n {...props}\n className={cx(props.className, styles.input)}\n type=\"file\"\n />\n </label>\n </div>\n )\n}\n"],"mappings":";;;;;;;;AAEA,SAAS,UAAU;AACnB,SAAS,QAAQ,cAAc;AAG/B,SAAS,cAAc,iBAAiB;AAuBhC,cAGF,YAHE;AAdD,SAAS,aAAa,OAA0B;AACrD,QAAM,SAAS,aAAa;AAC5B,QAAM,OAAO,eAAe;AAE5B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT,OAAO;AAAA,UACL,SAAS;AAAA,QACX,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MAEA;AAAA,4BAAC,UAAK,WAAW,GAAG,OAAO,MAAM,UAAU,GAAG,OAAO,CAAC,GACpD,8BAAC,QAAK,GACR;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW;AAAA,cACT,OAAO;AAAA,gBACL,SAAS;AAAA,cACX,CAAC;AAAA,cACD,OAAO;AAAA,YACT;AAAA,YACA,SAAS,MAAM;AAAA,YAEf;AAAA,kCAAC,QAAK,MAAM,QAAQ,MAAM,OAAO,GAC/B,8BAAC,OAAE,WAAW,OAAO,SAAU,gBAAM,SAAQ,GAC/C;AAAA,cAAO;AAAA,cACC,MAAM,QAAQ,QAAQ,KAAK,IAAI;AAAA,cAAE;AAAA,cACzC,oBAAC,OAAE,WAAW,OAAO,aAAa,mCAAqB;AAAA,cACvD;AAAA,gBAAC;AAAA;AAAA,kBACE,GAAG;AAAA,kBACJ,WAAW,GAAG,MAAM,WAAW,OAAO,KAAK;AAAA,kBAC3C,MAAK;AAAA;AAAA,cACP;AAAA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// src/components/ModalIcon.tsx
|
|
2
|
-
import { cx } from "@cerberus/styled-system/css";
|
|
3
|
-
import { circle } from "@cerberus/styled-system/patterns";
|
|
4
|
-
import {
|
|
5
|
-
modalIcon
|
|
6
|
-
} from "@cerberus/styled-system/recipes";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
function ModalIcon(props) {
|
|
9
|
-
const { palette, ...nativeProps } = props;
|
|
10
|
-
return /* @__PURE__ */ jsx(
|
|
11
|
-
"div",
|
|
12
|
-
{
|
|
13
|
-
...nativeProps,
|
|
14
|
-
className: cx(
|
|
15
|
-
nativeProps.className,
|
|
16
|
-
modalIcon({
|
|
17
|
-
palette
|
|
18
|
-
}),
|
|
19
|
-
circle()
|
|
20
|
-
),
|
|
21
|
-
children: props.children
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
ModalIcon
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=chunk-VCR5C6Q3.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ModalIcon.tsx"],"sourcesContent":["import { cx } from '@cerberus/styled-system/css'\nimport { circle } from '@cerberus/styled-system/patterns'\nimport {\n modalIcon,\n type ModalIconVariantProps,\n} from '@cerberus/styled-system/recipes'\nimport type { HTMLAttributes, PropsWithChildren } from 'react'\n\nexport type ModalIconProps = HTMLAttributes<HTMLDivElement> &\n ModalIconVariantProps\n\nexport function ModalIcon(props: PropsWithChildren<ModalIconProps>) {\n const { palette, ...nativeProps } = props\n return (\n <div\n {...nativeProps}\n className={cx(\n nativeProps.className,\n modalIcon({\n palette,\n }),\n circle(),\n )}\n >\n {props.children}\n </div>\n )\n}\n"],"mappings":";AAAA,SAAS,UAAU;AACnB,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,OAEK;AASH;AAHG,SAAS,UAAU,OAA0C;AAClE,QAAM,EAAE,SAAS,GAAG,YAAY,IAAI;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,QACT,YAAY;AAAA,QACZ,UAAU;AAAA,UACR;AAAA,QACF,CAAC;AAAA,QACD,OAAO;AAAA,MACT;AAAA,MAEC,gBAAM;AAAA;AAAA,EACT;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { cx } from '@cerberus/styled-system/css'
|
|
2
|
-
import { circle } from '@cerberus/styled-system/patterns'
|
|
3
|
-
import {
|
|
4
|
-
modalIcon,
|
|
5
|
-
type ModalIconVariantProps,
|
|
6
|
-
} from '@cerberus/styled-system/recipes'
|
|
7
|
-
import type { HTMLAttributes, PropsWithChildren } from 'react'
|
|
8
|
-
|
|
9
|
-
export type ModalIconProps = HTMLAttributes<HTMLDivElement> &
|
|
10
|
-
ModalIconVariantProps
|
|
11
|
-
|
|
12
|
-
export function ModalIcon(props: PropsWithChildren<ModalIconProps>) {
|
|
13
|
-
const { palette, ...nativeProps } = props
|
|
14
|
-
return (
|
|
15
|
-
<div
|
|
16
|
-
{...nativeProps}
|
|
17
|
-
className={cx(
|
|
18
|
-
nativeProps.className,
|
|
19
|
-
modalIcon({
|
|
20
|
-
palette,
|
|
21
|
-
}),
|
|
22
|
-
circle(),
|
|
23
|
-
)}
|
|
24
|
-
>
|
|
25
|
-
{props.children}
|
|
26
|
-
</div>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
File without changes
|