@cerberus-design/react 0.8.1 → 0.9.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/build/legacy/_tsup-dts-rollup.d.cts +49 -0
- package/build/legacy/components/Avatar.cjs +196 -0
- package/build/legacy/components/Avatar.cjs.map +1 -0
- package/build/legacy/components/Checkbox.cjs +1 -0
- package/build/legacy/components/Checkbox.cjs.map +1 -1
- package/build/legacy/components/FileStatus.cjs +1 -0
- package/build/legacy/components/FileStatus.cjs.map +1 -1
- package/build/legacy/components/FileUploader.cjs +1 -0
- package/build/legacy/components/FileUploader.cjs.map +1 -1
- package/build/legacy/components/Input.cjs +1 -0
- package/build/legacy/components/Input.cjs.map +1 -1
- package/build/legacy/components/Notification.cjs +1 -0
- package/build/legacy/components/Notification.cjs.map +1 -1
- package/build/legacy/components/Select.cjs +1 -0
- package/build/legacy/components/Select.cjs.map +1 -1
- package/build/legacy/components/Toggle.cjs +1 -0
- package/build/legacy/components/Toggle.cjs.map +1 -1
- package/build/legacy/config/cerbIcons.cjs +1 -0
- package/build/legacy/config/cerbIcons.cjs.map +1 -1
- package/build/legacy/config/defineIcons.cjs +1 -0
- package/build/legacy/config/defineIcons.cjs.map +1 -1
- package/build/legacy/context/confirm-modal.cjs +1 -0
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +1 -0
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +1 -0
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/index.cjs +499 -403
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +49 -0
- package/build/modern/{chunk-ID3XWGLY.js → chunk-4YJOK7JJ.js} +2 -2
- package/build/modern/{chunk-GUECLKHY.js → chunk-BDCFYW34.js} +3 -1
- package/build/modern/chunk-BDCFYW34.js.map +1 -0
- package/build/modern/{chunk-S6CMAXQF.js → chunk-CZMC77YO.js} +9 -9
- package/build/modern/{chunk-53QBTZZF.js → chunk-FMFKM2AB.js} +2 -2
- package/build/modern/{chunk-GZY6CH7D.js → chunk-GB3SECCO.js} +8 -8
- package/build/modern/{chunk-VPWBSZAR.js → chunk-KKJKOKP7.js} +5 -5
- package/build/modern/{chunk-7NX4RGDB.js → chunk-MLCVO7JP.js} +2 -2
- package/build/modern/{chunk-5WVXIAG2.js → chunk-NBG2OSYI.js} +2 -2
- package/build/modern/{chunk-EJIMJWPB.js → chunk-QZ6NS6VN.js} +2 -2
- package/build/modern/{chunk-TF3HRELU.js → chunk-TUIVLIJI.js} +2 -2
- package/build/modern/chunk-UN3OAW56.js +104 -0
- package/build/modern/chunk-UN3OAW56.js.map +1 -0
- package/build/modern/{chunk-RHG26FYL.js → chunk-VRPAW76S.js} +2 -2
- package/build/modern/{chunk-4FD33RTW.js → chunk-ZCIJRM2X.js} +2 -2
- package/build/modern/components/Avatar.js +11 -0
- package/build/modern/components/Avatar.js.map +1 -0
- package/build/modern/components/Checkbox.js +3 -3
- package/build/modern/components/FileStatus.js +3 -3
- package/build/modern/components/FileUploader.js +3 -3
- package/build/modern/components/Input.js +3 -3
- package/build/modern/components/Notification.js +3 -3
- package/build/modern/components/Select.js +3 -3
- package/build/modern/components/Toggle.js +3 -3
- package/build/modern/config/cerbIcons.js +1 -1
- package/build/modern/config/defineIcons.js +2 -2
- package/build/modern/context/confirm-modal.js +5 -5
- package/build/modern/context/notification-center.js +5 -5
- package/build/modern/context/prompt-modal.js +6 -6
- package/build/modern/index.js +35 -31
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Avatar.tsx +132 -0
- package/src/config/cerbIcons.ts +3 -0
- package/src/index.ts +1 -0
- package/build/modern/chunk-GUECLKHY.js.map +0 -1
- /package/build/modern/{chunk-ID3XWGLY.js.map → chunk-4YJOK7JJ.js.map} +0 -0
- /package/build/modern/{chunk-S6CMAXQF.js.map → chunk-CZMC77YO.js.map} +0 -0
- /package/build/modern/{chunk-53QBTZZF.js.map → chunk-FMFKM2AB.js.map} +0 -0
- /package/build/modern/{chunk-GZY6CH7D.js.map → chunk-GB3SECCO.js.map} +0 -0
- /package/build/modern/{chunk-VPWBSZAR.js.map → chunk-KKJKOKP7.js.map} +0 -0
- /package/build/modern/{chunk-7NX4RGDB.js.map → chunk-MLCVO7JP.js.map} +0 -0
- /package/build/modern/{chunk-5WVXIAG2.js.map → chunk-NBG2OSYI.js.map} +0 -0
- /package/build/modern/{chunk-EJIMJWPB.js.map → chunk-QZ6NS6VN.js.map} +0 -0
- /package/build/modern/{chunk-TF3HRELU.js.map → chunk-TUIVLIJI.js.map} +0 -0
- /package/build/modern/{chunk-RHG26FYL.js.map → chunk-VRPAW76S.js.map} +0 -0
- /package/build/modern/{chunk-4FD33RTW.js.map → chunk-ZCIJRM2X.js.map} +0 -0
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
import {
|
|
3
3
|
PromptModal,
|
|
4
4
|
usePromptModal
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-VCR5C6Q3.js";
|
|
5
|
+
} from "../chunk-CZMC77YO.js";
|
|
7
6
|
import "../chunk-4CAT3FHV.js";
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-JB7IQ2BM.js";
|
|
8
|
+
import "../chunk-VCR5C6Q3.js";
|
|
9
|
+
import "../chunk-FMFKM2AB.js";
|
|
9
10
|
import "../chunk-2FK7NR7Y.js";
|
|
10
11
|
import "../chunk-2UFNQM55.js";
|
|
11
12
|
import "../chunk-4M4LCQ43.js";
|
|
12
13
|
import "../chunk-QU7UV5DB.js";
|
|
13
|
-
import "../chunk-JB7IQ2BM.js";
|
|
14
14
|
import "../chunk-6F34A7NZ.js";
|
|
15
15
|
import "../chunk-4O4QFF4S.js";
|
|
16
16
|
import "../chunk-ZAU4JVLL.js";
|
|
17
17
|
import "../chunk-JIZQFTW6.js";
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
18
|
+
import "../chunk-NBG2OSYI.js";
|
|
19
|
+
import "../chunk-BDCFYW34.js";
|
|
20
20
|
import "../chunk-CP7OUC2Q.js";
|
|
21
21
|
import "../chunk-C5HLLGME.js";
|
|
22
22
|
export {
|
package/build/modern/index.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfirmModal,
|
|
3
|
+
useConfirmModal
|
|
4
|
+
} from "./chunk-GB3SECCO.js";
|
|
1
5
|
import {
|
|
2
6
|
NotificationCenter,
|
|
3
7
|
useNotificationCenter
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KKJKOKP7.js";
|
|
5
9
|
import {
|
|
6
10
|
PromptModal,
|
|
7
11
|
usePromptModal
|
|
8
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CZMC77YO.js";
|
|
13
|
+
import {
|
|
14
|
+
Table,
|
|
15
|
+
Tr
|
|
16
|
+
} from "./chunk-A5WYZVUR.js";
|
|
9
17
|
import {
|
|
10
18
|
Tag
|
|
11
19
|
} from "./chunk-Z6IWNVPN.js";
|
|
@@ -26,18 +34,17 @@ import {
|
|
|
26
34
|
} from "./chunk-N3FUF4TB.js";
|
|
27
35
|
import {
|
|
28
36
|
Toggle
|
|
29
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-4YJOK7JJ.js";
|
|
30
38
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} from "./chunk-GZY6CH7D.js";
|
|
39
|
+
Portal
|
|
40
|
+
} from "./chunk-4CAT3FHV.js";
|
|
34
41
|
import {
|
|
35
42
|
Radio
|
|
36
43
|
} from "./chunk-PH64POOB.js";
|
|
37
44
|
import {
|
|
38
45
|
Option,
|
|
39
46
|
Select
|
|
40
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-VRPAW76S.js";
|
|
41
48
|
import {
|
|
42
49
|
Tab
|
|
43
50
|
} from "./chunk-SONHHNYQ.js";
|
|
@@ -48,9 +55,8 @@ import {
|
|
|
48
55
|
TabPanel
|
|
49
56
|
} from "./chunk-U72VPIZA.js";
|
|
50
57
|
import {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} from "./chunk-A5WYZVUR.js";
|
|
58
|
+
ModalHeading
|
|
59
|
+
} from "./chunk-JB7IQ2BM.js";
|
|
54
60
|
import {
|
|
55
61
|
ModalIcon
|
|
56
62
|
} from "./chunk-VCR5C6Q3.js";
|
|
@@ -70,7 +76,7 @@ import {
|
|
|
70
76
|
} from "./chunk-KJUCHZHV.js";
|
|
71
77
|
import {
|
|
72
78
|
Notification
|
|
73
|
-
} from "./chunk-
|
|
79
|
+
} from "./chunk-QZ6NS6VN.js";
|
|
74
80
|
import {
|
|
75
81
|
NotificationDescription
|
|
76
82
|
} from "./chunk-HW76XVA3.js";
|
|
@@ -78,14 +84,21 @@ import {
|
|
|
78
84
|
NotificationHeading
|
|
79
85
|
} from "./chunk-3C2DJSEE.js";
|
|
80
86
|
import {
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
FileStatus,
|
|
88
|
+
processStatus
|
|
89
|
+
} from "./chunk-MLCVO7JP.js";
|
|
90
|
+
import {
|
|
91
|
+
ProgressBar
|
|
92
|
+
} from "./chunk-TYTEREKZ.js";
|
|
83
93
|
import {
|
|
84
94
|
FileUploader
|
|
85
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-TUIVLIJI.js";
|
|
96
|
+
import {
|
|
97
|
+
IconButton
|
|
98
|
+
} from "./chunk-SLHX5K6I.js";
|
|
86
99
|
import {
|
|
87
100
|
Input
|
|
88
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-FMFKM2AB.js";
|
|
89
102
|
import {
|
|
90
103
|
Label
|
|
91
104
|
} from "./chunk-2FK7NR7Y.js";
|
|
@@ -98,9 +111,6 @@ import {
|
|
|
98
111
|
import {
|
|
99
112
|
ModalHeader
|
|
100
113
|
} from "./chunk-QU7UV5DB.js";
|
|
101
|
-
import {
|
|
102
|
-
ModalHeading
|
|
103
|
-
} from "./chunk-JB7IQ2BM.js";
|
|
104
114
|
import {
|
|
105
115
|
MODE_KEY,
|
|
106
116
|
THEME_KEY,
|
|
@@ -111,12 +121,15 @@ import {
|
|
|
111
121
|
import {
|
|
112
122
|
useToggle
|
|
113
123
|
} from "./chunk-QEA6N6TN.js";
|
|
124
|
+
import {
|
|
125
|
+
Avatar
|
|
126
|
+
} from "./chunk-UN3OAW56.js";
|
|
114
127
|
import {
|
|
115
128
|
Button
|
|
116
129
|
} from "./chunk-6F34A7NZ.js";
|
|
117
130
|
import {
|
|
118
131
|
Checkbox
|
|
119
|
-
} from "./chunk-
|
|
132
|
+
} from "./chunk-ZCIJRM2X.js";
|
|
120
133
|
import {
|
|
121
134
|
Droppable
|
|
122
135
|
} from "./chunk-7VJOPJVX.js";
|
|
@@ -130,16 +143,6 @@ import {
|
|
|
130
143
|
import {
|
|
131
144
|
Show
|
|
132
145
|
} from "./chunk-4O4QFF4S.js";
|
|
133
|
-
import {
|
|
134
|
-
FileStatus,
|
|
135
|
-
processStatus
|
|
136
|
-
} from "./chunk-7NX4RGDB.js";
|
|
137
|
-
import {
|
|
138
|
-
ProgressBar
|
|
139
|
-
} from "./chunk-TYTEREKZ.js";
|
|
140
|
-
import {
|
|
141
|
-
IconButton
|
|
142
|
-
} from "./chunk-SLHX5K6I.js";
|
|
143
146
|
import {
|
|
144
147
|
FieldMessage
|
|
145
148
|
} from "./chunk-VGHVH2T3.js";
|
|
@@ -165,8 +168,8 @@ import {
|
|
|
165
168
|
import {
|
|
166
169
|
$cerberusIcons,
|
|
167
170
|
defineIcons
|
|
168
|
-
} from "./chunk-
|
|
169
|
-
import "./chunk-
|
|
171
|
+
} from "./chunk-NBG2OSYI.js";
|
|
172
|
+
import "./chunk-BDCFYW34.js";
|
|
170
173
|
import "./chunk-CP7OUC2Q.js";
|
|
171
174
|
import {
|
|
172
175
|
useModal
|
|
@@ -176,6 +179,7 @@ import {
|
|
|
176
179
|
export * from "@dnd-kit/core";
|
|
177
180
|
export {
|
|
178
181
|
$cerberusIcons,
|
|
182
|
+
Avatar,
|
|
179
183
|
Button,
|
|
180
184
|
Checkbox,
|
|
181
185
|
ConfirmModal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * This module is the entry point for the Cerberus React package.\n * @module\n */\n\n// components\n\nexport * from './components/Avatar'\nexport * from './components/Button'\nexport * from './components/Checkbox'\nexport * from './components/Droppable'\nexport * from './components/FieldMessage'\nexport * from './components/FeatureFlag'\nexport * from './components/FileStatus'\nexport * from './components/FileUploader'\nexport * from './components/IconButton'\nexport * from './components/Input'\nexport * from './components/Label'\nexport * from './components/Modal'\nexport * from './components/ModalHeader'\nexport * from './components/ModalHeading'\nexport * from './components/ModalDescription'\nexport * from './components/ModalIcon'\nexport * from './components/NavMenuTrigger'\nexport * from './components/NavMenuList'\nexport * from './components/NavMenuLink'\nexport * from './components/Notification'\nexport * from './components/NotificationHeading'\nexport * from './components/NotificationDescription'\nexport * from './components/Portal'\nexport * from './components/ProgressBar'\nexport * from './components/Radio'\nexport * from './components/Select'\nexport * from './components/Tab'\nexport * from './components/TabList'\nexport * from './components/TabPanel'\nexport * from './components/Table'\nexport * from './components/Thead'\nexport * from './components/Th'\nexport * from './components/Td'\nexport * from './components/Tbody'\nexport * from './components/Tag'\nexport * from './components/Textarea'\nexport * from './components/Toggle'\nexport * from './components/Show'\n\n// context\n\nexport * from './context/confirm-modal'\nexport * from './context/feature-flags'\nexport * from './context/field'\nexport * from './context/navMenu'\nexport * from './context/notification-center'\nexport * from './context/prompt-modal'\nexport * from './context/tabs'\nexport * from './context/theme'\n\n// hooks\n\nexport * from './hooks/useModal'\nexport * from './hooks/useTheme'\nexport * from './hooks/useToggle'\n\n// aria-helpers\n\nexport * from './aria-helpers/nav-menu.aria'\nexport * from './aria-helpers/tabs.aria'\nexport * from './aria-helpers/trap-focus.aria'\n\n// utils\n\nexport * from './config/defineIcons'\n\n// shared types\n\nexport * from './types'\n\n// 3rd party\n\nexport * from '@dnd-kit/core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cerberus-design/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "The Cerberus Design React component library.",
|
|
5
5
|
"browserslist": "> 0.25%, not dead",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-dom": "^18",
|
|
27
27
|
"tsup": "^8.1.0",
|
|
28
28
|
"@cerberus-design/configs": "0.0.0",
|
|
29
|
-
"@cerberus-design/styled-system": "0.
|
|
29
|
+
"@cerberus-design/styled-system": "0.9.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { css, cx } from '@cerberus/styled-system/css'
|
|
2
|
+
import { circle } from '@cerberus/styled-system/patterns'
|
|
3
|
+
import {
|
|
4
|
+
avatar,
|
|
5
|
+
type AvatarVariantProps,
|
|
6
|
+
} from '@cerberus/styled-system/recipes'
|
|
7
|
+
import { $cerberusIcons } from '../config/defineIcons'
|
|
8
|
+
import type { HtmlHTMLAttributes, ReactNode } from 'react'
|
|
9
|
+
import { Show } from './Show'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This module contains the Avatar component.
|
|
13
|
+
* @module
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export type SharedAvatarProps = {
|
|
17
|
+
icon?: ReactNode
|
|
18
|
+
width?: number
|
|
19
|
+
height?: number
|
|
20
|
+
}
|
|
21
|
+
export type AvatarImageProps = HtmlHTMLAttributes<HTMLImageElement> &
|
|
22
|
+
SharedAvatarProps & {
|
|
23
|
+
ariaLabel: string
|
|
24
|
+
as?: never
|
|
25
|
+
src: string
|
|
26
|
+
}
|
|
27
|
+
export type AvatarAsProps = SharedAvatarProps & {
|
|
28
|
+
as: ReactNode
|
|
29
|
+
ariaLabel?: never
|
|
30
|
+
src?: never
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type AvatarProps = (HtmlHTMLAttributes<HTMLDivElement> &
|
|
34
|
+
AvatarVariantProps) &
|
|
35
|
+
(AvatarImageProps | AvatarAsProps)
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 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.
|
|
39
|
+
* @definition [Avatar docs](https://cerberus.digitalu.design/react/avatar)
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <Avatar
|
|
43
|
+
* ariaLabel="Protector Cerberus"
|
|
44
|
+
* src="https://cerberus.digitalu.design/logo.svg"
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function Avatar(props: AvatarProps) {
|
|
49
|
+
const {
|
|
50
|
+
ariaLabel,
|
|
51
|
+
as,
|
|
52
|
+
gradient,
|
|
53
|
+
size,
|
|
54
|
+
src,
|
|
55
|
+
width,
|
|
56
|
+
height,
|
|
57
|
+
icon,
|
|
58
|
+
...nativeProps
|
|
59
|
+
} = props
|
|
60
|
+
const { avatar: AvatarIcon } = $cerberusIcons
|
|
61
|
+
const initials = (ariaLabel || '')
|
|
62
|
+
.split(' ')
|
|
63
|
+
.map((word) => word[0])
|
|
64
|
+
.join('')
|
|
65
|
+
.slice(0, 2)
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
{...nativeProps}
|
|
70
|
+
className={cx(
|
|
71
|
+
nativeProps.className,
|
|
72
|
+
avatar({ gradient, size }),
|
|
73
|
+
circle(),
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
76
|
+
<Show
|
|
77
|
+
when={Boolean(src) || Boolean(as)}
|
|
78
|
+
fallback={
|
|
79
|
+
<Show
|
|
80
|
+
when={Boolean(initials)}
|
|
81
|
+
fallback={
|
|
82
|
+
<Show
|
|
83
|
+
when={Boolean(icon)}
|
|
84
|
+
fallback={
|
|
85
|
+
<AvatarIcon
|
|
86
|
+
size={iconSizeMap[size as keyof typeof iconSizeMap]}
|
|
87
|
+
/>
|
|
88
|
+
}
|
|
89
|
+
>
|
|
90
|
+
{icon}
|
|
91
|
+
</Show>
|
|
92
|
+
}
|
|
93
|
+
>
|
|
94
|
+
{initials}
|
|
95
|
+
</Show>
|
|
96
|
+
}
|
|
97
|
+
>
|
|
98
|
+
<Show
|
|
99
|
+
when={Boolean(as)}
|
|
100
|
+
fallback={
|
|
101
|
+
<img
|
|
102
|
+
alt={props.ariaLabel}
|
|
103
|
+
className={css({
|
|
104
|
+
h: 'full',
|
|
105
|
+
objectFit: 'cover',
|
|
106
|
+
w: 'full',
|
|
107
|
+
})}
|
|
108
|
+
decoding="async"
|
|
109
|
+
loading="lazy"
|
|
110
|
+
src={src}
|
|
111
|
+
height={height}
|
|
112
|
+
width={width}
|
|
113
|
+
/>
|
|
114
|
+
}
|
|
115
|
+
>
|
|
116
|
+
{as}
|
|
117
|
+
</Show>
|
|
118
|
+
</Show>
|
|
119
|
+
</div>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const iconSizeMap = {
|
|
124
|
+
xs: 16,
|
|
125
|
+
sm: 16,
|
|
126
|
+
md: 20,
|
|
127
|
+
lg: 34,
|
|
128
|
+
xl: 32,
|
|
129
|
+
'2xl': 32,
|
|
130
|
+
'3xl': 32,
|
|
131
|
+
'4xl': 32,
|
|
132
|
+
}
|
package/src/config/cerbIcons.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
InformationFilled,
|
|
10
10
|
Restart,
|
|
11
11
|
TrashCan,
|
|
12
|
+
UserFilled,
|
|
12
13
|
Warning,
|
|
13
14
|
WarningFilled,
|
|
14
15
|
type CarbonIconType,
|
|
@@ -19,6 +20,7 @@ import { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'
|
|
|
19
20
|
export type IconType = CarbonIconType | ElementType
|
|
20
21
|
|
|
21
22
|
export interface DefinedIcons {
|
|
23
|
+
avatar?: IconType
|
|
22
24
|
checkbox?: IconType
|
|
23
25
|
close?: IconType
|
|
24
26
|
confirmModal?: IconType
|
|
@@ -38,6 +40,7 @@ export interface DefinedIcons {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
export const defaultIcons: DefinedIcons = {
|
|
43
|
+
avatar: UserFilled,
|
|
41
44
|
checkbox: CheckmarkIcon,
|
|
42
45
|
close: CloseFilled,
|
|
43
46
|
confirmModal: Information,
|
package/src/index.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/config/cerbIcons.ts"],"sourcesContent":["import {\n Checkmark,\n CheckmarkFilled,\n ChevronDown,\n CloseFilled,\n CloudUpload,\n ErrorFilled,\n Information,\n InformationFilled,\n Restart,\n TrashCan,\n Warning,\n WarningFilled,\n type CarbonIconType,\n} from '@cerberus/icons'\nimport type { ElementType } from 'react'\nimport { CheckmarkIcon, IndeterminateIcon } from './icons/checkbox.icons'\n\nexport type IconType = CarbonIconType | ElementType\n\nexport interface DefinedIcons {\n checkbox?: IconType\n close?: IconType\n confirmModal?: IconType\n delete?: IconType\n promptModal?: IconType\n fileUploader?: IconType\n indeterminate?: IconType\n infoNotification?: IconType\n successNotification?: IconType\n warningNotification?: IconType\n dangerNotification?: IconType\n invalid: IconType\n invalidAlt?: IconType\n redo?: IconType\n selectArrow?: IconType\n toggleChecked?: IconType\n}\n\nexport const defaultIcons: DefinedIcons = {\n checkbox: CheckmarkIcon,\n close: CloseFilled,\n confirmModal: Information,\n delete: TrashCan,\n promptModal: Information,\n fileUploader: CloudUpload,\n indeterminate: IndeterminateIcon,\n infoNotification: InformationFilled,\n successNotification: CheckmarkFilled,\n warningNotification: WarningFilled,\n dangerNotification: ErrorFilled,\n invalid: WarningFilled,\n invalidAlt: Warning,\n redo: Restart,\n selectArrow: ChevronDown,\n toggleChecked: Checkmark,\n}\n"],"mappings":";;;;;;AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAyBA,IAAM,eAA6B;AAAA,EACxC,UAAU;AAAA,EACV,OAAO;AAAA,EACP,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,oBAAoB;AAAA,EACpB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,eAAe;AACjB;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|