@payfit/unity-components 2.1.4 → 2.2.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/dist/esm/components/avatar/Avatar.context.d.ts +2 -1
- package/dist/esm/components/avatar/Avatar.context.js +13 -11
- package/dist/esm/components/avatar/Avatar.d.ts +126 -0
- package/dist/esm/components/avatar/Avatar.js +34 -20
- package/dist/esm/components/avatar/Avatar.variants.d.ts +39 -0
- package/dist/esm/components/avatar/Avatar.variants.js +22 -4
- package/dist/esm/components/avatar/parts/AvatarFallback.d.ts +52 -0
- package/dist/esm/components/avatar/parts/AvatarIcon.d.ts +31 -0
- package/dist/esm/components/avatar/parts/AvatarIcon.js +40 -0
- package/dist/esm/components/button/Button.js +8 -7
- package/dist/esm/components/dialog/Dialog.js +32 -31
- package/dist/esm/components/dialog/test-utils.d.ts +7 -1
- package/dist/esm/components/dialog/test-utils.js +39 -28
- package/dist/esm/components/inline-field-group/InlineFieldGroup.context.d.ts +23 -0
- package/dist/esm/components/inline-field-group/InlineFieldGroup.context.js +6 -0
- package/dist/esm/components/inline-field-group/InlineFieldGroup.d.ts +119 -0
- package/dist/esm/components/inline-field-group/InlineFieldGroup.js +185 -0
- package/dist/esm/components/inline-field-group/hooks/useInlineFieldGroupMode.d.ts +46 -0
- package/dist/esm/components/inline-field-group/hooks/useInlineFieldGroupMode.js +27 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupEditView.d.ts +64 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupEditView.js +56 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupHeader.d.ts +95 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupHeader.js +106 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupReadView.d.ts +56 -0
- package/dist/esm/components/inline-field-group/parts/InlineFieldGroupReadView.js +28 -0
- package/dist/esm/components/side-panel/parts/SidePanelFooter.js +19 -10
- package/dist/esm/hooks/tanstack-form-context.d.ts +1 -1
- package/dist/esm/hooks/use-tanstack-form.d.ts +32 -8
- package/dist/esm/hooks/use-tanstack-form.js +71 -48
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +445 -443
- package/i18n/en-GB.json +6 -0
- package/i18n/es-ES.json +6 -0
- package/i18n/fr-FR.json +6 -0
- package/package.json +21 -21
|
@@ -2,9 +2,10 @@ type AvatarContextValue = {
|
|
|
2
2
|
variant: 'circle' | 'square';
|
|
3
3
|
size: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
4
|
hasPair: boolean;
|
|
5
|
+
color?: 'teal' | 'plum' | 'purple' | 'orange' | 'neutral' | 'warning' | 'success' | 'info' | 'danger' | 'promo' | 'primary';
|
|
5
6
|
};
|
|
6
7
|
export declare const AvatarContext: import('react').Context<AvatarContextValue>;
|
|
7
|
-
export declare function AvatarProvider({ variant, size, hasPair, children, }: AvatarContextValue & {
|
|
8
|
+
export declare function AvatarProvider({ variant, size, hasPair, color, children, }: AvatarContextValue & {
|
|
8
9
|
children: React.ReactNode;
|
|
9
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
export declare function useAvatarContext(): AvatarContextValue;
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
const r =
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as s, useContext as v } from "react";
|
|
3
|
+
const r = s({
|
|
4
4
|
variant: "circle",
|
|
5
5
|
size: "md",
|
|
6
|
-
hasPair: !1
|
|
6
|
+
hasPair: !1,
|
|
7
|
+
color: void 0
|
|
7
8
|
});
|
|
8
|
-
function
|
|
9
|
+
function x({
|
|
9
10
|
variant: t,
|
|
10
11
|
size: e,
|
|
11
12
|
hasPair: o,
|
|
12
|
-
|
|
13
|
+
color: a,
|
|
14
|
+
children: n
|
|
13
15
|
}) {
|
|
14
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ i(r.Provider, { value: { variant: t, size: e, hasPair: o, color: a }, children: n });
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
const t =
|
|
18
|
+
function d() {
|
|
19
|
+
const t = v(r);
|
|
18
20
|
if (!t)
|
|
19
21
|
throw new Error("useAvatarContext must be used within an AvatarProvider");
|
|
20
22
|
return t;
|
|
21
23
|
}
|
|
22
24
|
export {
|
|
23
25
|
r as AvatarContext,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
x as AvatarProvider,
|
|
27
|
+
d as useAvatarContext
|
|
26
28
|
};
|
|
@@ -27,6 +27,41 @@ declare const avatarRoot: import('tailwind-variants').TVReturnType<{} | {
|
|
|
27
27
|
base?: import('tailwind-merge').ClassNameValue;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
+
color: {
|
|
31
|
+
teal: import('tailwind-merge').ClassNameValue | {
|
|
32
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
33
|
+
};
|
|
34
|
+
plum: import('tailwind-merge').ClassNameValue | {
|
|
35
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
36
|
+
};
|
|
37
|
+
purple: import('tailwind-merge').ClassNameValue | {
|
|
38
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
39
|
+
};
|
|
40
|
+
orange: import('tailwind-merge').ClassNameValue | {
|
|
41
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
42
|
+
};
|
|
43
|
+
neutral: import('tailwind-merge').ClassNameValue | {
|
|
44
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
45
|
+
};
|
|
46
|
+
warning: import('tailwind-merge').ClassNameValue | {
|
|
47
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
48
|
+
};
|
|
49
|
+
success: import('tailwind-merge').ClassNameValue | {
|
|
50
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
51
|
+
};
|
|
52
|
+
info: import('tailwind-merge').ClassNameValue | {
|
|
53
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
54
|
+
};
|
|
55
|
+
danger: import('tailwind-merge').ClassNameValue | {
|
|
56
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
57
|
+
};
|
|
58
|
+
promo: import('tailwind-merge').ClassNameValue | {
|
|
59
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
60
|
+
};
|
|
61
|
+
primary: import('tailwind-merge').ClassNameValue | {
|
|
62
|
+
base?: import('tailwind-merge').ClassNameValue;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
30
65
|
}, undefined, "uy:inline-block uy:relative uy:shrink-0", {
|
|
31
66
|
size: {
|
|
32
67
|
xs: string;
|
|
@@ -39,6 +74,19 @@ declare const avatarRoot: import('tailwind-variants').TVReturnType<{} | {
|
|
|
39
74
|
circle: string;
|
|
40
75
|
square: string;
|
|
41
76
|
};
|
|
77
|
+
color: {
|
|
78
|
+
teal: string;
|
|
79
|
+
plum: string;
|
|
80
|
+
purple: string;
|
|
81
|
+
orange: string;
|
|
82
|
+
neutral: string;
|
|
83
|
+
warning: string;
|
|
84
|
+
success: string;
|
|
85
|
+
info: string;
|
|
86
|
+
danger: string;
|
|
87
|
+
promo: string;
|
|
88
|
+
primary: string;
|
|
89
|
+
};
|
|
42
90
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
43
91
|
size: {
|
|
44
92
|
xs: string;
|
|
@@ -51,6 +99,19 @@ declare const avatarRoot: import('tailwind-variants').TVReturnType<{} | {
|
|
|
51
99
|
circle: string;
|
|
52
100
|
square: string;
|
|
53
101
|
};
|
|
102
|
+
color: {
|
|
103
|
+
teal: string;
|
|
104
|
+
plum: string;
|
|
105
|
+
purple: string;
|
|
106
|
+
orange: string;
|
|
107
|
+
neutral: string;
|
|
108
|
+
warning: string;
|
|
109
|
+
success: string;
|
|
110
|
+
info: string;
|
|
111
|
+
danger: string;
|
|
112
|
+
promo: string;
|
|
113
|
+
primary: string;
|
|
114
|
+
};
|
|
54
115
|
}, undefined, undefined, {
|
|
55
116
|
size: {
|
|
56
117
|
xs: string;
|
|
@@ -63,6 +124,19 @@ declare const avatarRoot: import('tailwind-variants').TVReturnType<{} | {
|
|
|
63
124
|
circle: string;
|
|
64
125
|
square: string;
|
|
65
126
|
};
|
|
127
|
+
color: {
|
|
128
|
+
teal: string;
|
|
129
|
+
plum: string;
|
|
130
|
+
purple: string;
|
|
131
|
+
orange: string;
|
|
132
|
+
neutral: string;
|
|
133
|
+
warning: string;
|
|
134
|
+
success: string;
|
|
135
|
+
info: string;
|
|
136
|
+
danger: string;
|
|
137
|
+
promo: string;
|
|
138
|
+
primary: string;
|
|
139
|
+
};
|
|
66
140
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
67
141
|
size: {
|
|
68
142
|
xs: string;
|
|
@@ -75,6 +149,19 @@ declare const avatarRoot: import('tailwind-variants').TVReturnType<{} | {
|
|
|
75
149
|
circle: string;
|
|
76
150
|
square: string;
|
|
77
151
|
};
|
|
152
|
+
color: {
|
|
153
|
+
teal: string;
|
|
154
|
+
plum: string;
|
|
155
|
+
purple: string;
|
|
156
|
+
orange: string;
|
|
157
|
+
neutral: string;
|
|
158
|
+
warning: string;
|
|
159
|
+
success: string;
|
|
160
|
+
info: string;
|
|
161
|
+
danger: string;
|
|
162
|
+
promo: string;
|
|
163
|
+
primary: string;
|
|
164
|
+
};
|
|
78
165
|
}, undefined, undefined, unknown, unknown, undefined>>>;
|
|
79
166
|
export type AvatarProps = PropsWithChildren<{
|
|
80
167
|
/** Additional class names to apply to the avatar */
|
|
@@ -83,6 +170,8 @@ export type AvatarProps = PropsWithChildren<{
|
|
|
83
170
|
variant?: VariantProps<typeof avatarRoot>['variant'];
|
|
84
171
|
/** Size of the avatar. One of: xs, sm, md, lg, xl */
|
|
85
172
|
size?: VariantProps<typeof avatarRoot>['size'];
|
|
173
|
+
/** Color variant for icon avatars. One of: teal, plum, purple, orange, neutral, warning, success, info, danger, promo, primary */
|
|
174
|
+
color?: VariantProps<typeof avatarRoot>['color'];
|
|
86
175
|
/** Accessible label for the avatar */
|
|
87
176
|
'aria-label': string;
|
|
88
177
|
/** ID of the element that labels the avatar */
|
|
@@ -96,6 +185,41 @@ export type AvatarProps = PropsWithChildren<{
|
|
|
96
185
|
}>;
|
|
97
186
|
/**
|
|
98
187
|
* The Avatar component displays visual or text content for representing people or entities.
|
|
188
|
+
* It supports images, initials, placeholders, and icons with customizable colors and sizes.
|
|
189
|
+
* @param {AvatarProps} props - Props for the Avatar component
|
|
190
|
+
* @example
|
|
191
|
+
* ```tsx
|
|
192
|
+
* import { Avatar, AvatarImage, AvatarFallback, AvatarIcon } from '@payfit/unity-components'
|
|
193
|
+
*
|
|
194
|
+
* // Avatar with image and fallback
|
|
195
|
+
* function Example() {
|
|
196
|
+
* return (
|
|
197
|
+
* <Avatar size="lg" variant="circle" aria-label="John Doe">
|
|
198
|
+
* <AvatarImage src="/images/avatar.jpg" alt="John Doe" />
|
|
199
|
+
* <AvatarFallback variant="initials">JD</AvatarFallback>
|
|
200
|
+
* </Avatar>
|
|
201
|
+
* )
|
|
202
|
+
* }
|
|
203
|
+
*
|
|
204
|
+
* // Avatar with icon and color
|
|
205
|
+
* function IconExample() {
|
|
206
|
+
* return (
|
|
207
|
+
* <Avatar size="lg" color="teal" variant="circle" aria-label="Vacation">
|
|
208
|
+
* <AvatarIcon src="PalmFilled" alt="Palm tree" />
|
|
209
|
+
* </Avatar>
|
|
210
|
+
* )
|
|
211
|
+
* }
|
|
212
|
+
* ```
|
|
213
|
+
* @remarks
|
|
214
|
+
* - Use the `circle` variant for representing people
|
|
215
|
+
* - Use the `square` variant for representing companies or organizations
|
|
216
|
+
* - The `color` prop applies background and text color variants for icon avatars
|
|
217
|
+
* - Always provide an `aria-label` or `aria-labelledby` for accessibility
|
|
218
|
+
* @see {@link AvatarProps} for all available props
|
|
219
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/avatar GitHub}
|
|
220
|
+
* @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library?node-id=19-3741 Figma}
|
|
221
|
+
* @see Design docs in {@link https://www.payfit.design/24f360409/p/69c10a-avatar Payfit.design}
|
|
222
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/component-reference-avatar unity-components.payfit.io}
|
|
99
223
|
*/
|
|
100
224
|
declare const Avatar: React.ForwardRefExoticComponent<{
|
|
101
225
|
/** Additional class names to apply to the avatar */
|
|
@@ -104,6 +228,8 @@ declare const Avatar: React.ForwardRefExoticComponent<{
|
|
|
104
228
|
variant?: VariantProps<typeof avatarRoot>["variant"];
|
|
105
229
|
/** Size of the avatar. One of: xs, sm, md, lg, xl */
|
|
106
230
|
size?: VariantProps<typeof avatarRoot>["size"];
|
|
231
|
+
/** Color variant for icon avatars. One of: teal, plum, purple, orange, neutral, warning, success, info, danger, promo, primary */
|
|
232
|
+
color?: VariantProps<typeof avatarRoot>["color"];
|
|
107
233
|
/** Accessible label for the avatar */
|
|
108
234
|
'aria-label': string;
|
|
109
235
|
/** ID of the element that labels the avatar */
|
|
@@ -1,32 +1,46 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
3
|
-
import { uyTv as
|
|
4
|
-
import * as
|
|
5
|
-
import { AvatarProvider as
|
|
6
|
-
import { avatarBase as
|
|
7
|
-
const
|
|
8
|
-
extend:
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { uyTv as d } from "@payfit/unity-themes";
|
|
4
|
+
import * as e from "@radix-ui/react-avatar";
|
|
5
|
+
import { AvatarProvider as f } from "./Avatar.context.js";
|
|
6
|
+
import { avatarBase as n } from "./Avatar.variants.js";
|
|
7
|
+
const p = d({
|
|
8
|
+
extend: n,
|
|
9
9
|
base: "uy:inline-block uy:relative uy:shrink-0",
|
|
10
10
|
defaultVariants: {
|
|
11
11
|
size: "md",
|
|
12
12
|
variant: "circle"
|
|
13
13
|
}
|
|
14
|
-
}),
|
|
15
|
-
({ size: a = "md", variant: r = "circle", className:
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}), v = c.forwardRef(
|
|
15
|
+
({ size: a = "md", variant: r = "circle", color: t, className: i, ...m }, s) => {
|
|
16
|
+
const l = p({
|
|
17
|
+
variant: r,
|
|
18
|
+
size: a,
|
|
19
|
+
color: t,
|
|
20
|
+
className: i
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ o(
|
|
23
|
+
f,
|
|
19
24
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
variant: r,
|
|
26
|
+
size: a,
|
|
27
|
+
hasPair: !1,
|
|
28
|
+
color: t,
|
|
29
|
+
children: /* @__PURE__ */ o(
|
|
30
|
+
e.Root,
|
|
31
|
+
{
|
|
32
|
+
ref: s,
|
|
33
|
+
role: "img",
|
|
34
|
+
className: l,
|
|
35
|
+
"data-dd-privacy": "allow",
|
|
36
|
+
...m
|
|
37
|
+
}
|
|
38
|
+
)
|
|
25
39
|
}
|
|
26
|
-
)
|
|
40
|
+
);
|
|
27
41
|
}
|
|
28
42
|
);
|
|
29
|
-
|
|
43
|
+
v.displayName = e.Root.displayName;
|
|
30
44
|
export {
|
|
31
|
-
|
|
45
|
+
v as Avatar
|
|
32
46
|
};
|
|
@@ -10,6 +10,19 @@ export declare const avatarBase: import('tailwind-variants').TVReturnType<{
|
|
|
10
10
|
circle: string;
|
|
11
11
|
square: string;
|
|
12
12
|
};
|
|
13
|
+
color: {
|
|
14
|
+
teal: string;
|
|
15
|
+
plum: string;
|
|
16
|
+
purple: string;
|
|
17
|
+
orange: string;
|
|
18
|
+
neutral: string;
|
|
19
|
+
warning: string;
|
|
20
|
+
success: string;
|
|
21
|
+
info: string;
|
|
22
|
+
danger: string;
|
|
23
|
+
promo: string;
|
|
24
|
+
primary: string;
|
|
25
|
+
};
|
|
13
26
|
}, undefined, undefined, {
|
|
14
27
|
size: {
|
|
15
28
|
xs: string;
|
|
@@ -22,6 +35,19 @@ export declare const avatarBase: import('tailwind-variants').TVReturnType<{
|
|
|
22
35
|
circle: string;
|
|
23
36
|
square: string;
|
|
24
37
|
};
|
|
38
|
+
color: {
|
|
39
|
+
teal: string;
|
|
40
|
+
plum: string;
|
|
41
|
+
purple: string;
|
|
42
|
+
orange: string;
|
|
43
|
+
neutral: string;
|
|
44
|
+
warning: string;
|
|
45
|
+
success: string;
|
|
46
|
+
info: string;
|
|
47
|
+
danger: string;
|
|
48
|
+
promo: string;
|
|
49
|
+
primary: string;
|
|
50
|
+
};
|
|
25
51
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
26
52
|
size: {
|
|
27
53
|
xs: string;
|
|
@@ -34,4 +60,17 @@ export declare const avatarBase: import('tailwind-variants').TVReturnType<{
|
|
|
34
60
|
circle: string;
|
|
35
61
|
square: string;
|
|
36
62
|
};
|
|
63
|
+
color: {
|
|
64
|
+
teal: string;
|
|
65
|
+
plum: string;
|
|
66
|
+
purple: string;
|
|
67
|
+
orange: string;
|
|
68
|
+
neutral: string;
|
|
69
|
+
warning: string;
|
|
70
|
+
success: string;
|
|
71
|
+
info: string;
|
|
72
|
+
danger: string;
|
|
73
|
+
promo: string;
|
|
74
|
+
primary: string;
|
|
75
|
+
};
|
|
37
76
|
}, undefined, undefined, unknown, unknown, undefined>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { uyTv as
|
|
2
|
-
const
|
|
1
|
+
import { uyTv as e } from "@payfit/unity-themes";
|
|
2
|
+
const t = e({
|
|
3
3
|
variants: {
|
|
4
4
|
size: {
|
|
5
5
|
xs: "uy:size-200",
|
|
@@ -11,6 +11,19 @@ const e = a({
|
|
|
11
11
|
variant: {
|
|
12
12
|
circle: "uy:rounded-circle",
|
|
13
13
|
square: "uy:aspect-square"
|
|
14
|
+
},
|
|
15
|
+
color: {
|
|
16
|
+
teal: "uy:bg-surface-decorative-teal-lowest uy:text-content-decorative-teal-high",
|
|
17
|
+
plum: "uy:bg-surface-decorative-plum-lowest uy:text-content-decorative-plum",
|
|
18
|
+
purple: "uy:bg-surface-decorative-purple-lowest uy:text-content-decorative-purple",
|
|
19
|
+
orange: "uy:bg-surface-decorative-orange-lowest uy:text-content-decorative-orange",
|
|
20
|
+
neutral: "uy:bg-surface-neutral-lowest uy:text-content-neutral",
|
|
21
|
+
warning: "uy:bg-surface-warning-low uy:text-content-warning-high",
|
|
22
|
+
success: "uy:bg-surface-success-low uy:text-content-success-high",
|
|
23
|
+
info: "uy:bg-surface-info-low uy:text-content-info-high",
|
|
24
|
+
danger: "uy:bg-surface-danger-low uy:text-content-danger-high",
|
|
25
|
+
promo: "uy:bg-surface-promo-low uy:text-content-promo-high",
|
|
26
|
+
primary: "uy:bg-surface-primary-lowest uy:text-content-primary-high"
|
|
14
27
|
}
|
|
15
28
|
},
|
|
16
29
|
compoundVariants: [
|
|
@@ -39,8 +52,13 @@ const e = a({
|
|
|
39
52
|
variant: "square",
|
|
40
53
|
className: "uy:rounded-200"
|
|
41
54
|
}
|
|
42
|
-
]
|
|
55
|
+
],
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
size: "md",
|
|
58
|
+
variant: "circle",
|
|
59
|
+
color: "neutral"
|
|
60
|
+
}
|
|
43
61
|
});
|
|
44
62
|
export {
|
|
45
|
-
|
|
63
|
+
t as avatarBase
|
|
46
64
|
};
|
|
@@ -32,6 +32,19 @@ declare const avatarPlaceholder: import('tailwind-variants').TVReturnType<{
|
|
|
32
32
|
circle: string;
|
|
33
33
|
square: string;
|
|
34
34
|
};
|
|
35
|
+
color: {
|
|
36
|
+
teal: string;
|
|
37
|
+
plum: string;
|
|
38
|
+
purple: string;
|
|
39
|
+
orange: string;
|
|
40
|
+
neutral: string;
|
|
41
|
+
warning: string;
|
|
42
|
+
success: string;
|
|
43
|
+
info: string;
|
|
44
|
+
danger: string;
|
|
45
|
+
promo: string;
|
|
46
|
+
primary: string;
|
|
47
|
+
};
|
|
35
48
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
36
49
|
size: {
|
|
37
50
|
xs: string;
|
|
@@ -44,6 +57,19 @@ declare const avatarPlaceholder: import('tailwind-variants').TVReturnType<{
|
|
|
44
57
|
circle: string;
|
|
45
58
|
square: string;
|
|
46
59
|
};
|
|
60
|
+
color: {
|
|
61
|
+
teal: string;
|
|
62
|
+
plum: string;
|
|
63
|
+
purple: string;
|
|
64
|
+
orange: string;
|
|
65
|
+
neutral: string;
|
|
66
|
+
warning: string;
|
|
67
|
+
success: string;
|
|
68
|
+
info: string;
|
|
69
|
+
danger: string;
|
|
70
|
+
promo: string;
|
|
71
|
+
primary: string;
|
|
72
|
+
};
|
|
47
73
|
}, undefined, undefined, {
|
|
48
74
|
size: {
|
|
49
75
|
xs: string;
|
|
@@ -56,6 +82,19 @@ declare const avatarPlaceholder: import('tailwind-variants').TVReturnType<{
|
|
|
56
82
|
circle: string;
|
|
57
83
|
square: string;
|
|
58
84
|
};
|
|
85
|
+
color: {
|
|
86
|
+
teal: string;
|
|
87
|
+
plum: string;
|
|
88
|
+
purple: string;
|
|
89
|
+
orange: string;
|
|
90
|
+
neutral: string;
|
|
91
|
+
warning: string;
|
|
92
|
+
success: string;
|
|
93
|
+
info: string;
|
|
94
|
+
danger: string;
|
|
95
|
+
promo: string;
|
|
96
|
+
primary: string;
|
|
97
|
+
};
|
|
59
98
|
}, undefined, import('tailwind-variants').TVReturnType<{
|
|
60
99
|
size: {
|
|
61
100
|
xs: string;
|
|
@@ -68,6 +107,19 @@ declare const avatarPlaceholder: import('tailwind-variants').TVReturnType<{
|
|
|
68
107
|
circle: string;
|
|
69
108
|
square: string;
|
|
70
109
|
};
|
|
110
|
+
color: {
|
|
111
|
+
teal: string;
|
|
112
|
+
plum: string;
|
|
113
|
+
purple: string;
|
|
114
|
+
orange: string;
|
|
115
|
+
neutral: string;
|
|
116
|
+
warning: string;
|
|
117
|
+
success: string;
|
|
118
|
+
info: string;
|
|
119
|
+
danger: string;
|
|
120
|
+
promo: string;
|
|
121
|
+
primary: string;
|
|
122
|
+
};
|
|
71
123
|
}, undefined, undefined, unknown, unknown, undefined>>>;
|
|
72
124
|
type AvatarFallbackBaseProps = Pick<React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>, 'delayMs'>;
|
|
73
125
|
type AvatarFallbackInitialsProps = AvatarFallbackBaseProps & {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IconProps } from '@payfit/unity-icons';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type AvatarIconProps = Omit<IconProps, 'size' | 'color'>;
|
|
4
|
+
/**
|
|
5
|
+
* The AvatarIcon component displays an icon within an Avatar component, using the Unity icon system.
|
|
6
|
+
* It automatically sizes the icon based on the parent Avatar's size and inherits the text color from the Avatar's color variant.
|
|
7
|
+
* @param {AvatarIconProps} props - Props for the AvatarIcon component
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* import { Avatar, AvatarIcon } from '@payfit/unity-components'
|
|
11
|
+
*
|
|
12
|
+
* function Example() {
|
|
13
|
+
* return (
|
|
14
|
+
* <Avatar size="lg" color="teal" variant="circle" aria-label="Vacation">
|
|
15
|
+
* <AvatarIcon src="PalmFilled" alt="Palm tree" />
|
|
16
|
+
* </Avatar>
|
|
17
|
+
* )
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
* @remarks
|
|
21
|
+
* - Must be used as a child of an Avatar component
|
|
22
|
+
* - Icons automatically scale: 20px for small to large avatars, 24px for extra-large avatars
|
|
23
|
+
* - The icon color is inherited from the parent Avatar's text color
|
|
24
|
+
* @see {@link AvatarIconProps} for all available props
|
|
25
|
+
* @see Source code in {@link https://github.com/PayFit/hr-apps/tree/master/libs/shared/unity/components/src/components/avatar/parts GitHub}
|
|
26
|
+
* @see Design specs {@link https://www.figma.com/design/poaMyU7abAgL9VRhx4ygyy/Unity-DS-%3E-Components-Library?node-id=19-3741 Figma}
|
|
27
|
+
* @see Design docs in {@link https://www.payfit.design/24f360409/p/69c10a-avatar Payfit.design}
|
|
28
|
+
* @see Developer docs in {@link https://unity-components.payfit.io/?path=/docs/component-reference-avatar-avataricon unity-components.payfit.io}
|
|
29
|
+
*/
|
|
30
|
+
declare const AvatarIcon: React.ForwardRefExoticComponent<AvatarIconProps & React.RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export { AvatarIcon };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { IconSprite as p } from "@payfit/unity-icons";
|
|
4
|
+
import * as a from "@payfit/unity-themes/tokens/spacings.json";
|
|
5
|
+
import { useAvatarContext as u } from "../Avatar.context.js";
|
|
6
|
+
const r = (e) => parseInt(e.replace("px", "").trim(), 10), m = {
|
|
7
|
+
xl: r(a.spacing[500].$value),
|
|
8
|
+
lg: r(a.spacing[300].$value),
|
|
9
|
+
md: r(a.spacing[250].$value),
|
|
10
|
+
sm: r(a.spacing[200].$value),
|
|
11
|
+
xs: r(a.spacing[150].$value),
|
|
12
|
+
default: r(a.spacing[250].$value)
|
|
13
|
+
}, f = c.forwardRef(
|
|
14
|
+
({ src: e, alt: o = "", className: s }, l) => {
|
|
15
|
+
const { size: n } = u(), t = m[n];
|
|
16
|
+
return /* @__PURE__ */ i(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
"data-dd-privacy": "allow",
|
|
20
|
+
ref: l,
|
|
21
|
+
role: "img",
|
|
22
|
+
className: `uy:flex uy:items-center uy:justify-center uy:w-full uy:h-full ${s || ""}`,
|
|
23
|
+
"aria-label": o,
|
|
24
|
+
children: /* @__PURE__ */ i(
|
|
25
|
+
p,
|
|
26
|
+
{
|
|
27
|
+
src: e,
|
|
28
|
+
width: t,
|
|
29
|
+
height: t,
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
f.displayName = "AvatarIcon";
|
|
38
|
+
export {
|
|
39
|
+
f as AvatarIcon
|
|
40
|
+
};
|
|
@@ -11,37 +11,37 @@ const I = (e, n) => e ? /* @__PURE__ */ m(B, { size: "small", color: "inherit",
|
|
|
11
11
|
children: n,
|
|
12
12
|
color: o = "primary",
|
|
13
13
|
size: c = "default",
|
|
14
|
-
isDisabled:
|
|
14
|
+
isDisabled: s = !1,
|
|
15
15
|
isLoading: t = !1,
|
|
16
16
|
prefixIcon: u = void 0,
|
|
17
17
|
...i
|
|
18
18
|
}, p) => {
|
|
19
19
|
const f = x(() => {
|
|
20
|
-
const
|
|
20
|
+
const a = { size: c, isDisabled: s, isLoading: t };
|
|
21
21
|
switch (e) {
|
|
22
22
|
case "primary": {
|
|
23
23
|
const r = {
|
|
24
|
-
...
|
|
24
|
+
...a,
|
|
25
25
|
color: o
|
|
26
26
|
};
|
|
27
27
|
return l(j(r));
|
|
28
28
|
}
|
|
29
29
|
case "secondary": {
|
|
30
30
|
const r = {
|
|
31
|
-
...
|
|
31
|
+
...a,
|
|
32
32
|
color: o
|
|
33
33
|
};
|
|
34
34
|
return l(N(r));
|
|
35
35
|
}
|
|
36
36
|
case "ghost": {
|
|
37
37
|
const r = {
|
|
38
|
-
...
|
|
38
|
+
...a,
|
|
39
39
|
color: o
|
|
40
40
|
};
|
|
41
41
|
return l(w(r));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
}, [e, o, c,
|
|
44
|
+
}, [e, o, c, s, t]), d = {
|
|
45
45
|
...t && { "data-loading": t }
|
|
46
46
|
};
|
|
47
47
|
return /* @__PURE__ */ m(
|
|
@@ -50,7 +50,8 @@ const I = (e, n) => e ? /* @__PURE__ */ m(B, { size: "small", color: "inherit",
|
|
|
50
50
|
"data-dd-privacy": "allow",
|
|
51
51
|
...i,
|
|
52
52
|
ref: p,
|
|
53
|
-
isDisabled:
|
|
53
|
+
isDisabled: s || t,
|
|
54
|
+
isPending: t,
|
|
54
55
|
className: f,
|
|
55
56
|
...d,
|
|
56
57
|
children: /* @__PURE__ */ y("span", { className: "uy:inline-flex uy:gap-50 uy:items-center", children: [
|