@kavagy/react 0.1.1
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/CHANGELOG.md +35 -0
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/avatar/avatar.d.ts +189 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/avatar.js +185 -0
- package/dist/avatar/avatar.js.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +2 -0
- package/dist/badges/badges.d.ts +149 -0
- package/dist/badges/badges.d.ts.map +1 -0
- package/dist/badges/badges.js +269 -0
- package/dist/badges/badges.js.map +1 -0
- package/dist/badges/index.d.ts +2 -0
- package/dist/badges/index.js +2 -0
- package/dist/button/button.d.ts +208 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/button.js +158 -0
- package/dist/button/button.js.map +1 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +2 -0
- package/dist/button-utility/button-utility.d.ts +59 -0
- package/dist/button-utility/button-utility.d.ts.map +1 -0
- package/dist/button-utility/button-utility.js +78 -0
- package/dist/button-utility/button-utility.js.map +1 -0
- package/dist/button-utility/index.d.ts +2 -0
- package/dist/button-utility/index.js +2 -0
- package/dist/checkbox/checkbox.d.ts +23 -0
- package/dist/checkbox/checkbox.d.ts.map +1 -0
- package/dist/checkbox/checkbox.js +81 -0
- package/dist/checkbox/checkbox.js.map +1 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +2 -0
- package/dist/dropdown/dropdown.d.ts +33 -0
- package/dist/dropdown/dropdown.d.ts.map +1 -0
- package/dist/dropdown/dropdown.js +128 -0
- package/dist/dropdown/dropdown.js.map +1 -0
- package/dist/dropdown/index.d.ts +2 -0
- package/dist/dropdown/index.js +2 -0
- package/dist/featured-icon/featured-icon.d.ts +141 -0
- package/dist/featured-icon/featured-icon.d.ts.map +1 -0
- package/dist/featured-icon/featured-icon.js +292 -0
- package/dist/featured-icon/featured-icon.js.map +1 -0
- package/dist/featured-icon/index.d.ts +2 -0
- package/dist/featured-icon/index.js +2 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +2 -0
- package/dist/input/input.d.ts +42 -0
- package/dist/input/input.d.ts.map +1 -0
- package/dist/input/input.js +136 -0
- package/dist/input/input.js.map +1 -0
- package/dist/modal/index.d.ts +2 -0
- package/dist/modal/index.js +2 -0
- package/dist/modal/modal.d.ts +8 -0
- package/dist/modal/modal.d.ts.map +1 -0
- package/dist/modal/modal.js +35 -0
- package/dist/modal/modal.js.map +1 -0
- package/dist/radio-buttons/index.d.ts +2 -0
- package/dist/radio-buttons/index.js +2 -0
- package/dist/radio-buttons/radio-buttons.d.ts +30 -0
- package/dist/radio-buttons/radio-buttons.d.ts.map +1 -0
- package/dist/radio-buttons/radio-buttons.js +71 -0
- package/dist/radio-buttons/radio-buttons.js.map +1 -0
- package/dist/select/index.d.ts +2 -0
- package/dist/select/index.js +2 -0
- package/dist/select/select.d.ts +40 -0
- package/dist/select/select.d.ts.map +1 -0
- package/dist/select/select.js +198 -0
- package/dist/select/select.js.map +1 -0
- package/dist/styles.css +2843 -0
- package/dist/table/index.d.ts +2 -0
- package/dist/table/index.js +2 -0
- package/dist/table/table.d.ts +61 -0
- package/dist/table/table.d.ts.map +1 -0
- package/dist/table/table.js +208 -0
- package/dist/table/table.js.map +1 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tabs/index.js +2 -0
- package/dist/tabs/tabs.d.ts +62 -0
- package/dist/tabs/tabs.d.ts.map +1 -0
- package/dist/tabs/tabs.js +120 -0
- package/dist/tabs/tabs.js.map +1 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +2 -0
- package/dist/textarea/textarea.d.ts +26 -0
- package/dist/textarea/textarea.d.ts.map +1 -0
- package/dist/textarea/textarea.js +74 -0
- package/dist/textarea/textarea.js.map +1 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +2 -0
- package/dist/toggle/toggle.d.ts +151 -0
- package/dist/toggle/toggle.d.ts.map +1 -0
- package/dist/toggle/toggle.js +145 -0
- package/dist/toggle/toggle.js.map +1 -0
- package/dist/tooltip/index.d.ts +2 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tooltip/tooltip.d.ts +59 -0
- package/dist/tooltip/tooltip.d.ts.map +1 -0
- package/dist/tooltip/tooltip.js +86 -0
- package/dist/tooltip/tooltip.js.map +1 -0
- package/dist/utils/cx.d.ts +21 -0
- package/dist/utils/cx.d.ts.map +1 -0
- package/dist/utils/cx.js +75 -0
- package/dist/utils/cx.js.map +1 -0
- package/dist/utils/is-react-component.d.ts +9 -0
- package/dist/utils/is-react-component.d.ts.map +1 -0
- package/dist/utils/is-react-component.js +17 -0
- package/dist/utils/is-react-component.js.map +1 -0
- package/dist/utils/tv.d.ts +6 -0
- package/dist/utils/tv.d.ts.map +1 -0
- package/dist/utils/tv.js +11 -0
- package/dist/utils/tv.js.map +1 -0
- package/package.json +146 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @kavagy/react
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cd4353a: Generate Tailwind utilities for the semantic bg/text/border tokens (`bg-brand-solid`, `text-primary_on-brand`, `border-primary`, ...). Before this, `theme.css` declared them only as `--color-*` custom properties, which Tailwind v4 maps to `bg-bg-*`, so the classes the components use produced no CSS and the components rendered unstyled in every consumer. `theme.css` now adds a `@theme inline` alias block; token names and CSS custom properties are unchanged. The prebuilt `styles.css` includes these rules.
|
|
8
|
+
- Updated dependencies [cd4353a]
|
|
9
|
+
- @kavagy/tokens@0.1.1
|
|
10
|
+
|
|
11
|
+
## 0.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 6b877ab: Align dark mode on `.dark`, and make brand surfaces re-brandable.
|
|
16
|
+
|
|
17
|
+
- Dark mode now uses the `.dark` class instead of `.dark-mode`, matching the
|
|
18
|
+
convention consuming apps already use. Apps applying `.dark-mode` must rename
|
|
19
|
+
it.
|
|
20
|
+
- `@kavagy/tokens` now declares `tailwindcss-animate` and
|
|
21
|
+
`tailwindcss-react-aria-components` as dependencies. They were emitted as
|
|
22
|
+
`@plugin` in `theme.css` but never declared, so importing the stylesheet
|
|
23
|
+
failed in a consumer that did not happen to have them installed.
|
|
24
|
+
- `Button`'s primary variant reads `text-primary_on-brand` instead of a
|
|
25
|
+
hardcoded `text-white`. A client with a light brand colour previously got
|
|
26
|
+
white text on a light surface with no way to override it.
|
|
27
|
+
- Added semantic `outline-focus-ring` / `ring-focus-ring` tokens so focus rings
|
|
28
|
+
can be themed independently of the brand colour.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [6b877ab]
|
|
33
|
+
- Updated dependencies [413ef2d]
|
|
34
|
+
- @kavagy/tokens@0.1.0
|
|
35
|
+
- @kavagy/icons@0.1.0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Components in this package are derived from the free, open-source Untitled UI
|
|
4
|
+
React components (https://github.com/untitleduico/react). Every derived file
|
|
5
|
+
carries a `@kavagy-source: untitledui/<path>` header naming its origin. Those
|
|
6
|
+
components are distributed under the following license:
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2025 Untitled UI
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
```
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { VariantProps } from "../utils/tv.js";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
//#region src/avatar/avatar.d.ts
|
|
4
|
+
export declare const avatarStyles: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
xs: {
|
|
7
|
+
root: string;
|
|
8
|
+
initials: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
};
|
|
11
|
+
sm: {
|
|
12
|
+
root: string;
|
|
13
|
+
initials: string;
|
|
14
|
+
icon: string;
|
|
15
|
+
};
|
|
16
|
+
md: {
|
|
17
|
+
root: string;
|
|
18
|
+
initials: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
};
|
|
21
|
+
lg: {
|
|
22
|
+
root: string;
|
|
23
|
+
initials: string;
|
|
24
|
+
icon: string;
|
|
25
|
+
};
|
|
26
|
+
xl: {
|
|
27
|
+
root: string;
|
|
28
|
+
initials: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
};
|
|
31
|
+
'2xl': {
|
|
32
|
+
root: string;
|
|
33
|
+
initials: string;
|
|
34
|
+
icon: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
rounded: {
|
|
38
|
+
true: {
|
|
39
|
+
root: string;
|
|
40
|
+
content: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
border: {
|
|
44
|
+
true: {
|
|
45
|
+
root: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
focusable: {
|
|
49
|
+
true: {
|
|
50
|
+
root: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
root: string;
|
|
55
|
+
content: string;
|
|
56
|
+
initials: string;
|
|
57
|
+
icon: string;
|
|
58
|
+
}, undefined, {
|
|
59
|
+
size: {
|
|
60
|
+
xs: {
|
|
61
|
+
root: string;
|
|
62
|
+
initials: string;
|
|
63
|
+
icon: string;
|
|
64
|
+
};
|
|
65
|
+
sm: {
|
|
66
|
+
root: string;
|
|
67
|
+
initials: string;
|
|
68
|
+
icon: string;
|
|
69
|
+
};
|
|
70
|
+
md: {
|
|
71
|
+
root: string;
|
|
72
|
+
initials: string;
|
|
73
|
+
icon: string;
|
|
74
|
+
};
|
|
75
|
+
lg: {
|
|
76
|
+
root: string;
|
|
77
|
+
initials: string;
|
|
78
|
+
icon: string;
|
|
79
|
+
};
|
|
80
|
+
xl: {
|
|
81
|
+
root: string;
|
|
82
|
+
initials: string;
|
|
83
|
+
icon: string;
|
|
84
|
+
};
|
|
85
|
+
'2xl': {
|
|
86
|
+
root: string;
|
|
87
|
+
initials: string;
|
|
88
|
+
icon: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
rounded: {
|
|
92
|
+
true: {
|
|
93
|
+
root: string;
|
|
94
|
+
content: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
border: {
|
|
98
|
+
true: {
|
|
99
|
+
root: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
focusable: {
|
|
103
|
+
true: {
|
|
104
|
+
root: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
root: string;
|
|
109
|
+
content: string;
|
|
110
|
+
initials: string;
|
|
111
|
+
icon: string;
|
|
112
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
113
|
+
size: {
|
|
114
|
+
xs: {
|
|
115
|
+
root: string;
|
|
116
|
+
initials: string;
|
|
117
|
+
icon: string;
|
|
118
|
+
};
|
|
119
|
+
sm: {
|
|
120
|
+
root: string;
|
|
121
|
+
initials: string;
|
|
122
|
+
icon: string;
|
|
123
|
+
};
|
|
124
|
+
md: {
|
|
125
|
+
root: string;
|
|
126
|
+
initials: string;
|
|
127
|
+
icon: string;
|
|
128
|
+
};
|
|
129
|
+
lg: {
|
|
130
|
+
root: string;
|
|
131
|
+
initials: string;
|
|
132
|
+
icon: string;
|
|
133
|
+
};
|
|
134
|
+
xl: {
|
|
135
|
+
root: string;
|
|
136
|
+
initials: string;
|
|
137
|
+
icon: string;
|
|
138
|
+
};
|
|
139
|
+
'2xl': {
|
|
140
|
+
root: string;
|
|
141
|
+
initials: string;
|
|
142
|
+
icon: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
rounded: {
|
|
146
|
+
true: {
|
|
147
|
+
root: string;
|
|
148
|
+
content: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
border: {
|
|
152
|
+
true: {
|
|
153
|
+
root: string;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
focusable: {
|
|
157
|
+
true: {
|
|
158
|
+
root: string;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
}, {
|
|
162
|
+
root: string;
|
|
163
|
+
content: string;
|
|
164
|
+
initials: string;
|
|
165
|
+
icon: string;
|
|
166
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
167
|
+
type AvatarVariants = VariantProps<typeof avatarStyles>;
|
|
168
|
+
export interface AvatarProps {
|
|
169
|
+
size?: AvatarVariants['size'];
|
|
170
|
+
className?: string;
|
|
171
|
+
contentClassName?: string;
|
|
172
|
+
src?: string | null;
|
|
173
|
+
alt?: string;
|
|
174
|
+
rounded?: boolean;
|
|
175
|
+
border?: boolean;
|
|
176
|
+
badge?: ReactNode;
|
|
177
|
+
status?: 'online' | 'offline';
|
|
178
|
+
verified?: boolean;
|
|
179
|
+
count?: number;
|
|
180
|
+
initials?: string;
|
|
181
|
+
placeholderIcon?: FC<{
|
|
182
|
+
className?: string;
|
|
183
|
+
}>;
|
|
184
|
+
placeholder?: ReactNode;
|
|
185
|
+
focusable?: boolean;
|
|
186
|
+
}
|
|
187
|
+
export declare const Avatar: import("react").ForwardRefExoticComponent<AvatarProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
188
|
+
//#endregion
|
|
189
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.d.ts","names":[],"sources":["../../src/avatar/avatar.tsx"],"mappings":";;;qBAWa,0CAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCpB,iBAAiB,oBAAoB;iBAkEzB;EACf,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA,kBAAkB;IAAK;;EACvB,cAAc;EACd;;qBAGW,wBAAM,0BAAA,8BAAA,cAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../utils/cx.js";
|
|
3
|
+
import { tv } from "../utils/tv.js";
|
|
4
|
+
import { User01 } from "@kavagy/icons";
|
|
5
|
+
import { forwardRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/avatar/avatar.tsx
|
|
8
|
+
const avatarStyles = tv({
|
|
9
|
+
slots: {
|
|
10
|
+
root: "relative inline-flex shrink-0 rounded-[7px]",
|
|
11
|
+
content: "relative inline-flex size-full shrink-0 items-center justify-center overflow-hidden rounded-md bg-tertiary outline-[0.5px] -outline-offset-[0.5px] outline-black/16",
|
|
12
|
+
initials: "text-quaternary font-semibold",
|
|
13
|
+
icon: "text-fg-quaternary"
|
|
14
|
+
},
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
xs: {
|
|
18
|
+
root: "size-6",
|
|
19
|
+
initials: "text-xs",
|
|
20
|
+
icon: "size-4"
|
|
21
|
+
},
|
|
22
|
+
sm: {
|
|
23
|
+
root: "size-8",
|
|
24
|
+
initials: "text-sm",
|
|
25
|
+
icon: "size-5"
|
|
26
|
+
},
|
|
27
|
+
md: {
|
|
28
|
+
root: "size-10",
|
|
29
|
+
initials: "text-md",
|
|
30
|
+
icon: "size-6"
|
|
31
|
+
},
|
|
32
|
+
lg: {
|
|
33
|
+
root: "size-12",
|
|
34
|
+
initials: "text-lg",
|
|
35
|
+
icon: "size-7"
|
|
36
|
+
},
|
|
37
|
+
xl: {
|
|
38
|
+
root: "size-14",
|
|
39
|
+
initials: "text-xl",
|
|
40
|
+
icon: "size-8"
|
|
41
|
+
},
|
|
42
|
+
"2xl": {
|
|
43
|
+
root: "size-16",
|
|
44
|
+
initials: "text-display-xs",
|
|
45
|
+
icon: "size-8"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
rounded: { true: {
|
|
49
|
+
root: "rounded-full",
|
|
50
|
+
content: "rounded-full"
|
|
51
|
+
} },
|
|
52
|
+
border: { true: { root: "ring-1 ring-secondary_alt" } },
|
|
53
|
+
focusable: { true: { root: "outline-transparent group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-focus-ring" } }
|
|
54
|
+
},
|
|
55
|
+
compoundVariants: [
|
|
56
|
+
{
|
|
57
|
+
border: true,
|
|
58
|
+
size: "xs",
|
|
59
|
+
class: { root: "p-px" }
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
border: true,
|
|
63
|
+
size: "sm",
|
|
64
|
+
class: { root: "p-px" }
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
border: true,
|
|
68
|
+
size: "md",
|
|
69
|
+
class: { root: "p-px" }
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
border: true,
|
|
73
|
+
size: "lg",
|
|
74
|
+
class: { root: "p-[1.5px]" }
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
border: true,
|
|
78
|
+
size: "xl",
|
|
79
|
+
class: { root: "p-0.5" }
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
border: true,
|
|
83
|
+
size: "2xl",
|
|
84
|
+
class: { root: "p-0.5" }
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
size: "md",
|
|
89
|
+
rounded: true
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
const onlineIndicatorSizes = {
|
|
93
|
+
xs: "size-1.5",
|
|
94
|
+
sm: "size-2",
|
|
95
|
+
md: "size-2.5",
|
|
96
|
+
lg: "size-3",
|
|
97
|
+
xl: "size-3.5",
|
|
98
|
+
"2xl": "size-4"
|
|
99
|
+
};
|
|
100
|
+
const AvatarOnlineIndicator = ({ size, status }) => /* @__PURE__ */ jsx("span", {
|
|
101
|
+
"data-status": status,
|
|
102
|
+
className: cx("absolute right-0 bottom-0 rounded-full ring-[1.5px] ring-bg-primary", status === "online" ? "bg-fg-success-secondary" : "bg-utility-neutral-300", onlineIndicatorSizes[size])
|
|
103
|
+
});
|
|
104
|
+
const AvatarCount = ({ count }) => /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "absolute right-0 bottom-0 p-px",
|
|
106
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: "flex size-3.5 items-center justify-center rounded-full bg-fg-error-primary text-center text-[10px] leading-[13px] font-bold text-white",
|
|
108
|
+
children: count
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
const verifiedTickSizes = {
|
|
112
|
+
xs: "size-2.5",
|
|
113
|
+
sm: "size-3",
|
|
114
|
+
md: "size-3.5",
|
|
115
|
+
lg: "size-4",
|
|
116
|
+
xl: "size-4.5",
|
|
117
|
+
"2xl": "size-5"
|
|
118
|
+
};
|
|
119
|
+
const VerifiedTick = ({ size, className }) => /* @__PURE__ */ jsxs("svg", {
|
|
120
|
+
"aria-hidden": "true",
|
|
121
|
+
viewBox: "0 0 10 10",
|
|
122
|
+
fill: "none",
|
|
123
|
+
className: cx("z-10 text-utility-blue-500", verifiedTickSizes[size], className),
|
|
124
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
125
|
+
className: "fill-current",
|
|
126
|
+
d: "M7.72237 1.77098C7.81734 2.00068 7.99965 2.18326 8.2292 2.27858L9.03413 2.61199C9.26384 2.70714 9.44635 2.88965 9.5415 3.11936C9.63665 3.34908 9.63665 3.60718 9.5415 3.83689L9.20833 4.64125C9.11313 4.87106 9.113 5.12943 9.20863 5.35913L9.54122 6.16325C9.58839 6.27702 9.61268 6.39897 9.6127 6.52214C9.61272 6.6453 9.58847 6.76726 9.54134 6.88105C9.4942 6.99484 9.42511 7.09823 9.33801 7.18531C9.2509 7.27238 9.14749 7.34144 9.03369 7.38854L8.22934 7.72171C7.99964 7.81669 7.81706 7.99899 7.72174 8.22855L7.38833 9.03348C7.29318 9.26319 7.11067 9.4457 6.88096 9.54085C6.65124 9.636 6.39314 9.636 6.16343 9.54085L5.35907 9.20767C5.12935 9.11276 4.87134 9.11295 4.64177 9.20821L3.83684 9.54115C3.60725 9.63608 3.34937 9.636 3.11984 9.54092C2.89032 9.44585 2.70791 9.26356 2.6127 9.03409L2.27918 8.22892C2.18421 7.99923 2.0019 7.81665 1.77235 7.72133L0.967421 7.38792C0.737807 7.29281 0.555355 7.11041 0.460169 6.88083C0.364983 6.65125 0.364854 6.39327 0.45981 6.16359L0.792984 5.35924C0.8879 5.12952 0.887707 4.87151 0.792445 4.64193L0.459749 3.83642C0.41258 3.72265 0.388291 3.60069 0.388272 3.47753C0.388252 3.35436 0.412501 3.2324 0.459634 3.11861C0.506767 3.00482 0.57586 2.90144 0.662965 2.81436C0.75007 2.72728 0.853479 2.65822 0.967283 2.61113L1.77164 2.27795C2.00113 2.18306 2.1836 2.00099 2.27899 1.7717L2.6124 0.966768C2.70755 0.737054 2.89006 0.554547 3.11978 0.459397C3.34949 0.364246 3.60759 0.364246 3.83731 0.459397L4.64166 0.792571C4.87138 0.887487 5.12939 0.887293 5.35897 0.792031L6.16424 0.459913C6.39392 0.364816 6.65197 0.364836 6.88164 0.459968C7.11131 0.555099 7.29379 0.737554 7.38895 0.967208L7.72247 1.77238L7.72237 1.77098Z"
|
|
127
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
128
|
+
fillRule: "evenodd",
|
|
129
|
+
clipRule: "evenodd",
|
|
130
|
+
fill: "white",
|
|
131
|
+
d: "M6.95829 3.68932C7.02509 3.58439 7.04747 3.45723 7.02051 3.3358C6.99356 3.21437 6.91946 3.10862 6.81454 3.04182C6.70961 2.97502 6.58245 2.95264 6.46102 2.97959C6.33959 3.00655 6.23384 3.08064 6.16704 3.18557L4.33141 6.06995L3.49141 5.01995C3.41375 4.92281 3.30069 4.8605 3.17709 4.84673C3.05349 4.83296 2.92949 4.86885 2.83235 4.94651C2.73522 5.02417 2.67291 5.13723 2.65914 5.26083C2.64536 5.38443 2.68125 5.50843 2.75891 5.60557L4.00891 7.16807C4.0555 7.22638 4.11533 7.27271 4.18344 7.30323C4.25154 7.33375 4.32595 7.34757 4.40047 7.34353C4.47499 7.3395 4.54747 7.31773 4.61188 7.28004C4.67629 7.24234 4.73077 7.18981 4.77079 7.12682L6.95829 3.68932Z"
|
|
132
|
+
})]
|
|
133
|
+
});
|
|
134
|
+
const Avatar = forwardRef(function Avatar(props, ref) {
|
|
135
|
+
const { size = "md", src, alt, initials, placeholder, placeholderIcon: PlaceholderIcon, border, badge, status, verified, count, focusable = false, rounded = true, className, contentClassName } = props;
|
|
136
|
+
const [isFailed, setIsFailed] = useState(false);
|
|
137
|
+
const canShowImage = Boolean(src) && !isFailed;
|
|
138
|
+
const slots = avatarStyles({
|
|
139
|
+
size,
|
|
140
|
+
rounded,
|
|
141
|
+
border,
|
|
142
|
+
focusable
|
|
143
|
+
});
|
|
144
|
+
const renderMainContent = () => {
|
|
145
|
+
if (canShowImage) return /* @__PURE__ */ jsx("img", {
|
|
146
|
+
"data-avatar-img": true,
|
|
147
|
+
className: "size-full object-cover",
|
|
148
|
+
src: src ?? void 0,
|
|
149
|
+
alt,
|
|
150
|
+
onError: () => setIsFailed(true)
|
|
151
|
+
});
|
|
152
|
+
if (initials) return /* @__PURE__ */ jsx("span", {
|
|
153
|
+
className: slots.initials(),
|
|
154
|
+
children: initials
|
|
155
|
+
});
|
|
156
|
+
if (PlaceholderIcon) return /* @__PURE__ */ jsx(PlaceholderIcon, { className: slots.icon() });
|
|
157
|
+
return placeholder || /* @__PURE__ */ jsx(User01, { className: slots.icon() });
|
|
158
|
+
};
|
|
159
|
+
const renderBadgeContent = () => {
|
|
160
|
+
if (status) return /* @__PURE__ */ jsx(AvatarOnlineIndicator, {
|
|
161
|
+
status,
|
|
162
|
+
size: size ?? "md"
|
|
163
|
+
});
|
|
164
|
+
if (verified) return /* @__PURE__ */ jsx(VerifiedTick, {
|
|
165
|
+
size: size ?? "md",
|
|
166
|
+
className: cx("absolute right-0 bottom-0", size === "xs" && "-right-px -bottom-px")
|
|
167
|
+
});
|
|
168
|
+
if (count) return /* @__PURE__ */ jsx(AvatarCount, { count });
|
|
169
|
+
return badge;
|
|
170
|
+
};
|
|
171
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
ref,
|
|
173
|
+
"data-avatar": true,
|
|
174
|
+
className: cx(slots.root(), className),
|
|
175
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
176
|
+
className: cx(slots.content(), canShowImage && size !== "xs" && "before:absolute before:inset-0 before:rounded-[inherit] before:border before:border-white/32 before:mask-[linear-gradient(to_bottom,black_0%,transparent_25%,transparent_75%,black_100%)]", contentClassName),
|
|
177
|
+
children: renderMainContent()
|
|
178
|
+
}), renderBadgeContent()]
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
Avatar.displayName = "Avatar";
|
|
182
|
+
//#endregion
|
|
183
|
+
export { Avatar, avatarStyles };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avatar.js","names":[],"sources":["../../src/avatar/avatar.tsx"],"sourcesContent":["'use client';\n\n/* @kavagy-source: untitledui/base/avatar/avatar.tsx, base/avatar/base-components/avatar-online-indicator.tsx, base/avatar/base-components/avatar-count.tsx, base/avatar/base-components/verified-tick.tsx */\n\nimport { User01 } from '@kavagy/icons';\nimport type { FC, ReactNode } from 'react';\nimport { forwardRef, useState } from 'react';\nimport { cx } from '../utils/cx';\nimport type { VariantProps } from '../utils/tv';\nimport { tv } from '../utils/tv';\n\nexport const avatarStyles = tv({\n slots: {\n root: 'relative inline-flex shrink-0 rounded-[7px]',\n content:\n 'relative inline-flex size-full shrink-0 items-center justify-center overflow-hidden rounded-md bg-tertiary outline-[0.5px] -outline-offset-[0.5px] outline-black/16',\n initials: 'text-quaternary font-semibold',\n icon: 'text-fg-quaternary',\n },\n variants: {\n size: {\n xs: { root: 'size-6', initials: 'text-xs', icon: 'size-4' },\n sm: { root: 'size-8', initials: 'text-sm', icon: 'size-5' },\n md: { root: 'size-10', initials: 'text-md', icon: 'size-6' },\n lg: { root: 'size-12', initials: 'text-lg', icon: 'size-7' },\n xl: { root: 'size-14', initials: 'text-xl', icon: 'size-8' },\n '2xl': { root: 'size-16', initials: 'text-display-xs', icon: 'size-8' },\n },\n rounded: { true: { root: 'rounded-full', content: 'rounded-full' } },\n border: { true: { root: 'ring-1 ring-secondary_alt' } },\n focusable: {\n true: {\n root: 'outline-transparent group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-focus-ring',\n },\n },\n },\n compoundVariants: [\n { border: true, size: 'xs', class: { root: 'p-px' } },\n { border: true, size: 'sm', class: { root: 'p-px' } },\n { border: true, size: 'md', class: { root: 'p-px' } },\n { border: true, size: 'lg', class: { root: 'p-[1.5px]' } },\n { border: true, size: 'xl', class: { root: 'p-0.5' } },\n { border: true, size: '2xl', class: { root: 'p-0.5' } },\n ],\n defaultVariants: { size: 'md', rounded: true },\n});\n\ntype AvatarVariants = VariantProps<typeof avatarStyles>;\ntype AvatarSize = NonNullable<AvatarVariants['size']>;\n\nconst onlineIndicatorSizes: Record<AvatarSize, string> = {\n xs: 'size-1.5',\n sm: 'size-2',\n md: 'size-2.5',\n lg: 'size-3',\n xl: 'size-3.5',\n '2xl': 'size-4',\n};\n\nconst AvatarOnlineIndicator = ({\n size,\n status,\n}: {\n size: AvatarSize;\n status: 'online' | 'offline';\n}) => (\n <span\n data-status={status}\n className={cx(\n 'absolute right-0 bottom-0 rounded-full ring-[1.5px] ring-bg-primary',\n status === 'online' ? 'bg-fg-success-secondary' : 'bg-utility-neutral-300',\n onlineIndicatorSizes[size],\n )}\n />\n);\n\nconst AvatarCount = ({ count }: { count: number }) => (\n <div className=\"absolute right-0 bottom-0 p-px\">\n <div className=\"flex size-3.5 items-center justify-center rounded-full bg-fg-error-primary text-center text-[10px] leading-[13px] font-bold text-white\">\n {count}\n </div>\n </div>\n);\n\nconst verifiedTickSizes: Record<AvatarSize, string> = {\n xs: 'size-2.5',\n sm: 'size-3',\n md: 'size-3.5',\n lg: 'size-4',\n xl: 'size-4.5',\n '2xl': 'size-5',\n};\n\nconst VerifiedTick = ({ size, className }: { size: AvatarSize; className?: string }) => (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 10 10\"\n fill=\"none\"\n className={cx('z-10 text-utility-blue-500', verifiedTickSizes[size], className)}\n >\n <path\n className=\"fill-current\"\n d=\"M7.72237 1.77098C7.81734 2.00068 7.99965 2.18326 8.2292 2.27858L9.03413 2.61199C9.26384 2.70714 9.44635 2.88965 9.5415 3.11936C9.63665 3.34908 9.63665 3.60718 9.5415 3.83689L9.20833 4.64125C9.11313 4.87106 9.113 5.12943 9.20863 5.35913L9.54122 6.16325C9.58839 6.27702 9.61268 6.39897 9.6127 6.52214C9.61272 6.6453 9.58847 6.76726 9.54134 6.88105C9.4942 6.99484 9.42511 7.09823 9.33801 7.18531C9.2509 7.27238 9.14749 7.34144 9.03369 7.38854L8.22934 7.72171C7.99964 7.81669 7.81706 7.99899 7.72174 8.22855L7.38833 9.03348C7.29318 9.26319 7.11067 9.4457 6.88096 9.54085C6.65124 9.636 6.39314 9.636 6.16343 9.54085L5.35907 9.20767C5.12935 9.11276 4.87134 9.11295 4.64177 9.20821L3.83684 9.54115C3.60725 9.63608 3.34937 9.636 3.11984 9.54092C2.89032 9.44585 2.70791 9.26356 2.6127 9.03409L2.27918 8.22892C2.18421 7.99923 2.0019 7.81665 1.77235 7.72133L0.967421 7.38792C0.737807 7.29281 0.555355 7.11041 0.460169 6.88083C0.364983 6.65125 0.364854 6.39327 0.45981 6.16359L0.792984 5.35924C0.8879 5.12952 0.887707 4.87151 0.792445 4.64193L0.459749 3.83642C0.41258 3.72265 0.388291 3.60069 0.388272 3.47753C0.388252 3.35436 0.412501 3.2324 0.459634 3.11861C0.506767 3.00482 0.57586 2.90144 0.662965 2.81436C0.75007 2.72728 0.853479 2.65822 0.967283 2.61113L1.77164 2.27795C2.00113 2.18306 2.1836 2.00099 2.27899 1.7717L2.6124 0.966768C2.70755 0.737054 2.89006 0.554547 3.11978 0.459397C3.34949 0.364246 3.60759 0.364246 3.83731 0.459397L4.64166 0.792571C4.87138 0.887487 5.12939 0.887293 5.35897 0.792031L6.16424 0.459913C6.39392 0.364816 6.65197 0.364836 6.88164 0.459968C7.11131 0.555099 7.29379 0.737554 7.38895 0.967208L7.72247 1.77238L7.72237 1.77098Z\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n fill=\"white\"\n d=\"M6.95829 3.68932C7.02509 3.58439 7.04747 3.45723 7.02051 3.3358C6.99356 3.21437 6.91946 3.10862 6.81454 3.04182C6.70961 2.97502 6.58245 2.95264 6.46102 2.97959C6.33959 3.00655 6.23384 3.08064 6.16704 3.18557L4.33141 6.06995L3.49141 5.01995C3.41375 4.92281 3.30069 4.8605 3.17709 4.84673C3.05349 4.83296 2.92949 4.86885 2.83235 4.94651C2.73522 5.02417 2.67291 5.13723 2.65914 5.26083C2.64536 5.38443 2.68125 5.50843 2.75891 5.60557L4.00891 7.16807C4.0555 7.22638 4.11533 7.27271 4.18344 7.30323C4.25154 7.33375 4.32595 7.34757 4.40047 7.34353C4.47499 7.3395 4.54747 7.31773 4.61188 7.28004C4.67629 7.24234 4.73077 7.18981 4.77079 7.12682L6.95829 3.68932Z\"\n />\n </svg>\n);\n\nexport interface AvatarProps {\n size?: AvatarVariants['size'];\n className?: string;\n contentClassName?: string;\n src?: string | null;\n alt?: string;\n rounded?: boolean;\n border?: boolean;\n badge?: ReactNode;\n status?: 'online' | 'offline';\n verified?: boolean;\n count?: number;\n initials?: string;\n placeholderIcon?: FC<{ className?: string }>;\n placeholder?: ReactNode;\n focusable?: boolean;\n}\n\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(props, ref) {\n const {\n size = 'md',\n src,\n alt,\n initials,\n placeholder,\n placeholderIcon: PlaceholderIcon,\n border,\n badge,\n status,\n verified,\n count,\n focusable = false,\n rounded = true,\n className,\n contentClassName,\n } = props;\n\n const [isFailed, setIsFailed] = useState(false);\n const canShowImage = Boolean(src) && !isFailed;\n const slots = avatarStyles({ size, rounded, border, focusable });\n\n const renderMainContent = () => {\n if (canShowImage) {\n return (\n <img\n data-avatar-img\n className=\"size-full object-cover\"\n src={src ?? undefined}\n alt={alt}\n onError={() => setIsFailed(true)}\n />\n );\n }\n if (initials) {\n return <span className={slots.initials()}>{initials}</span>;\n }\n if (PlaceholderIcon) {\n return <PlaceholderIcon className={slots.icon()} />;\n }\n return placeholder || <User01 className={slots.icon()} />;\n };\n\n const renderBadgeContent = () => {\n if (status) return <AvatarOnlineIndicator status={status} size={size ?? 'md'} />;\n if (verified) {\n return (\n <VerifiedTick\n size={size ?? 'md'}\n className={cx('absolute right-0 bottom-0', size === 'xs' && '-right-px -bottom-px')}\n />\n );\n }\n if (count) return <AvatarCount count={count} />;\n return badge;\n };\n\n return (\n <div ref={ref} data-avatar className={cx(slots.root(), className)}>\n <div\n className={cx(\n slots.content(),\n canShowImage &&\n size !== 'xs' &&\n 'before:absolute before:inset-0 before:rounded-[inherit] before:border before:border-white/32 before:mask-[linear-gradient(to_bottom,black_0%,transparent_25%,transparent_75%,black_100%)]',\n contentClassName,\n )}\n >\n {renderMainContent()}\n </div>\n {renderBadgeContent()}\n </div>\n );\n});\n\nAvatar.displayName = 'Avatar';\n"],"mappings":"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"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { VariantProps } from "../utils/tv.js";
|
|
2
|
+
import { FC, ReactNode } from "react";
|
|
3
|
+
//#region src/badges/badges.d.ts
|
|
4
|
+
export declare const badgeStyles: import("tailwind-variants").TVReturnType<{
|
|
5
|
+
size: {
|
|
6
|
+
sm: {
|
|
7
|
+
root: string;
|
|
8
|
+
dismissButton: string;
|
|
9
|
+
};
|
|
10
|
+
md: {
|
|
11
|
+
root: string;
|
|
12
|
+
dismissButton: string;
|
|
13
|
+
};
|
|
14
|
+
lg: {
|
|
15
|
+
root: string;
|
|
16
|
+
dismissButton: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
type: {
|
|
20
|
+
'pill-color': {
|
|
21
|
+
root: string;
|
|
22
|
+
};
|
|
23
|
+
color: {
|
|
24
|
+
root: string;
|
|
25
|
+
};
|
|
26
|
+
modern: {
|
|
27
|
+
root: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
color: {
|
|
31
|
+
gray: {};
|
|
32
|
+
brand: {};
|
|
33
|
+
error: {};
|
|
34
|
+
warning: {};
|
|
35
|
+
success: {};
|
|
36
|
+
blue: {};
|
|
37
|
+
indigo: {};
|
|
38
|
+
pink: {};
|
|
39
|
+
orange: {};
|
|
40
|
+
};
|
|
41
|
+
}, {
|
|
42
|
+
root: string;
|
|
43
|
+
addon: string;
|
|
44
|
+
dismissButton: string;
|
|
45
|
+
}, undefined, {
|
|
46
|
+
size: {
|
|
47
|
+
sm: {
|
|
48
|
+
root: string;
|
|
49
|
+
dismissButton: string;
|
|
50
|
+
};
|
|
51
|
+
md: {
|
|
52
|
+
root: string;
|
|
53
|
+
dismissButton: string;
|
|
54
|
+
};
|
|
55
|
+
lg: {
|
|
56
|
+
root: string;
|
|
57
|
+
dismissButton: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type: {
|
|
61
|
+
'pill-color': {
|
|
62
|
+
root: string;
|
|
63
|
+
};
|
|
64
|
+
color: {
|
|
65
|
+
root: string;
|
|
66
|
+
};
|
|
67
|
+
modern: {
|
|
68
|
+
root: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
color: {
|
|
72
|
+
gray: {};
|
|
73
|
+
brand: {};
|
|
74
|
+
error: {};
|
|
75
|
+
warning: {};
|
|
76
|
+
success: {};
|
|
77
|
+
blue: {};
|
|
78
|
+
indigo: {};
|
|
79
|
+
pink: {};
|
|
80
|
+
orange: {};
|
|
81
|
+
};
|
|
82
|
+
}, {
|
|
83
|
+
root: string;
|
|
84
|
+
addon: string;
|
|
85
|
+
dismissButton: string;
|
|
86
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
87
|
+
size: {
|
|
88
|
+
sm: {
|
|
89
|
+
root: string;
|
|
90
|
+
dismissButton: string;
|
|
91
|
+
};
|
|
92
|
+
md: {
|
|
93
|
+
root: string;
|
|
94
|
+
dismissButton: string;
|
|
95
|
+
};
|
|
96
|
+
lg: {
|
|
97
|
+
root: string;
|
|
98
|
+
dismissButton: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
type: {
|
|
102
|
+
'pill-color': {
|
|
103
|
+
root: string;
|
|
104
|
+
};
|
|
105
|
+
color: {
|
|
106
|
+
root: string;
|
|
107
|
+
};
|
|
108
|
+
modern: {
|
|
109
|
+
root: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
color: {
|
|
113
|
+
gray: {};
|
|
114
|
+
brand: {};
|
|
115
|
+
error: {};
|
|
116
|
+
warning: {};
|
|
117
|
+
success: {};
|
|
118
|
+
blue: {};
|
|
119
|
+
indigo: {};
|
|
120
|
+
pink: {};
|
|
121
|
+
orange: {};
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
root: string;
|
|
125
|
+
addon: string;
|
|
126
|
+
dismissButton: string;
|
|
127
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
128
|
+
type BadgeVariants = VariantProps<typeof badgeStyles>;
|
|
129
|
+
export interface BadgeProps {
|
|
130
|
+
size?: BadgeVariants['size'];
|
|
131
|
+
type?: BadgeVariants['type'];
|
|
132
|
+
color?: BadgeVariants['color'];
|
|
133
|
+
/** Renders a status dot before the content. */
|
|
134
|
+
dot?: boolean;
|
|
135
|
+
iconLeading?: FC<{
|
|
136
|
+
className?: string;
|
|
137
|
+
}> | ReactNode;
|
|
138
|
+
iconTrailing?: FC<{
|
|
139
|
+
className?: string;
|
|
140
|
+
}> | ReactNode;
|
|
141
|
+
/** Renders a close button; once `onDismiss` is passed, the badge becomes dismissible. */
|
|
142
|
+
onDismiss?: () => void;
|
|
143
|
+
dismissLabel?: string;
|
|
144
|
+
children?: ReactNode;
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
148
|
+
//#endregion
|
|
149
|
+
//# sourceMappingURL=badges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badges.d.ts","names":[],"sources":["../../src/badges/badges.tsx"],"mappings":";;;qBAea,yCAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoLnB,gBAAgB,oBAAoB;iBAExB;EACf,OAAO;EACP,OAAO;EACP,QAAQ;;EAER;EACA,cAAc;IAAK;OAAwB;EAC3C,eAAe;IAAK;OAAwB;;EAE5C;EACA;EACA,WAAW;EACX;;qBAGW,uBAAK,0BAAA,6BAAA,cAAA"}
|