@astryxdesign/core 0.5.0-canary.e6dc4bd → 0.5.0-canary.f4d494c
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/Avatar/Avatar.d.ts +25 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +43 -9
- package/dist/Avatar/index.d.ts +2 -2
- package/dist/Avatar/index.d.ts.map +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/AvatarGroup/AvatarGroup.d.ts +9 -2
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +5 -2
- package/dist/AvatarGroup/AvatarGroupContext.d.ts +2 -1
- package/dist/AvatarGroup/AvatarGroupContext.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +10 -6
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +52 -3
- package/dist/HoverCard/useHoverCard.d.ts +11 -2
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +2 -0
- package/dist/astryx.css +6 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +4 -0
- package/package.json +2 -2
- package/src/Avatar/Avatar.doc.mjs +12 -2
- package/src/Avatar/Avatar.test.tsx +80 -0
- package/src/Avatar/Avatar.tsx +64 -14
- package/src/Avatar/index.ts +2 -2
- package/src/AvatarGroup/AvatarGroup.doc.mjs +8 -2
- package/src/AvatarGroup/AvatarGroup.test.tsx +24 -0
- package/src/AvatarGroup/AvatarGroup.tsx +12 -4
- package/src/AvatarGroup/AvatarGroupContext.ts +5 -3
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +10 -4
- package/src/HoverCard/HoverCard.test.tsx +84 -4
- package/src/HoverCard/HoverCard.tsx +65 -3
- package/src/HoverCard/useHoverCard.tsx +15 -2
- package/src/theme/derivedVarRegistry.test.ts +1 -0
- package/src/theme/derivedVarRegistry.ts +1 -0
package/dist/Avatar/Avatar.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import { type ReactNode } from 'react';
|
|
18
18
|
import type { BaseProps } from '../BaseProps';
|
|
19
|
+
import * as stylex from '@stylexjs/stylex';
|
|
19
20
|
import type { LinkComponentType } from '../Link/types';
|
|
20
21
|
/**
|
|
21
22
|
* Named size options.
|
|
@@ -33,10 +34,25 @@ type AvatarNumericSize = 16 | 20 | 24 | 32 | 36 | 40 | 48 | 60 | 64 | 72 | 96 |
|
|
|
33
34
|
* Avatar size - can be a named size or a specific pixel value
|
|
34
35
|
*/
|
|
35
36
|
export type AvatarSize = AvatarNamedSize | AvatarNumericSize;
|
|
37
|
+
/**
|
|
38
|
+
* Avatar shape options
|
|
39
|
+
*/
|
|
40
|
+
export type AvatarShape = 'circle' | 'rounded' | 'square';
|
|
36
41
|
/**
|
|
37
42
|
* Resolves named sizes to their numeric pixel values
|
|
38
43
|
*/
|
|
39
44
|
export declare function resolveSize(size: AvatarSize): number;
|
|
45
|
+
export declare const shapeStyles: Readonly<{
|
|
46
|
+
readonly circle: Readonly<{
|
|
47
|
+
readonly '--_avatar-radius': stylex.StyleXClassNameFor<"--_avatar-radius", "9999px">;
|
|
48
|
+
}>;
|
|
49
|
+
readonly rounded: Readonly<{
|
|
50
|
+
readonly '--_avatar-radius': stylex.StyleXClassNameFor<"--_avatar-radius", "8px">;
|
|
51
|
+
}>;
|
|
52
|
+
readonly square: Readonly<{
|
|
53
|
+
readonly '--_avatar-radius': stylex.StyleXClassNameFor<"--_avatar-radius", "0px">;
|
|
54
|
+
}>;
|
|
55
|
+
}>;
|
|
40
56
|
export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
41
57
|
/** Ref forwarded to the root element */
|
|
42
58
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -69,6 +85,14 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
69
85
|
* @default 'md'
|
|
70
86
|
*/
|
|
71
87
|
size?: AvatarSize;
|
|
88
|
+
/**
|
|
89
|
+
* Shape variant of the avatar.
|
|
90
|
+
* - 'circle': Full circle (default)
|
|
91
|
+
* - 'rounded': Rounded square
|
|
92
|
+
* - 'square': Sharp square
|
|
93
|
+
* @default 'circle'
|
|
94
|
+
*/
|
|
95
|
+
shape?: AvatarShape;
|
|
72
96
|
/**
|
|
73
97
|
* The primary image source for the avatar.
|
|
74
98
|
*/
|
|
@@ -147,7 +171,7 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
147
171
|
* <Avatar src="/user.jpg" name="John Doe" onClick={() => openProfile()} />
|
|
148
172
|
* ```
|
|
149
173
|
*/
|
|
150
|
-
export declare function Avatar({ alt, 'data-testid': testId, fallbackSrc, name, size, src, status, tooltip, href, as, target, rel, onClick, xstyle, className, style, ref, ...props }: AvatarProps): import("react").JSX.Element;
|
|
174
|
+
export declare function Avatar({ alt, 'data-testid': testId, fallbackSrc, name, size, shape, src, status, tooltip, href, as, target, rel, onClick, xstyle, className, style, ref, ...props }: AvatarProps): import("react").JSX.Element;
|
|
151
175
|
export declare namespace Avatar {
|
|
152
176
|
var displayName: string;
|
|
153
177
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAML,KAAK,S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GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD;AAwHD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,WAAW,EACX,IAAI,EACJ,IAAW,EACX,KAAgB,EAChB,GAAG,EACH,MAAM,EACN,OAAc,EACd,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BAsVb;yBA1We,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -77,6 +77,10 @@ const INITIALS_FONT_SIZE_RATIO = 0.4;
|
|
|
77
77
|
* Avatar size - can be a named size or a specific pixel value
|
|
78
78
|
*/
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Avatar shape options
|
|
82
|
+
*/
|
|
83
|
+
|
|
80
84
|
/**
|
|
81
85
|
* Resolves named sizes to their numeric pixel values
|
|
82
86
|
*/
|
|
@@ -98,6 +102,28 @@ export function resolveSize(size) {
|
|
|
98
102
|
}
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
// Sets one local custom property rather than `borderRadius` directly, so
|
|
106
|
+
// every clipping/ring surface that needs the shape's radius (the wrapper,
|
|
107
|
+
// the interactive focus ring, the content div that actually clips via
|
|
108
|
+
// `overflow: hidden`, and AvatarGroupOverflow's "+N" indicator) reads the
|
|
109
|
+
// same value instead of each hardcoding its own borderRadius independently.
|
|
110
|
+
// A theme override only has to reach this one property, not fight the
|
|
111
|
+
// per-surface StyleX class order to change the shape everywhere at once.
|
|
112
|
+
export const shapeStyles = {
|
|
113
|
+
circle: {
|
|
114
|
+
"--_avatar-radius": "xeincmr",
|
|
115
|
+
$$css: true
|
|
116
|
+
},
|
|
117
|
+
rounded: {
|
|
118
|
+
"--_avatar-radius": "xdarwi0",
|
|
119
|
+
$$css: true
|
|
120
|
+
},
|
|
121
|
+
square: {
|
|
122
|
+
"--_avatar-radius": "x877142",
|
|
123
|
+
$$css: true
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
101
127
|
/**
|
|
102
128
|
* Base styles for the avatar
|
|
103
129
|
* Uses a wrapper/content structure so status isn't clipped by overflow:hidden
|
|
@@ -107,7 +133,7 @@ const styles = {
|
|
|
107
133
|
kVAEAm: "x1n2onr6",
|
|
108
134
|
k1xSpc: "x3nfvp2",
|
|
109
135
|
kmuXW: "x2lah0s",
|
|
110
|
-
kaIpWk: "
|
|
136
|
+
kaIpWk: "xbc78cj",
|
|
111
137
|
$$css: true
|
|
112
138
|
},
|
|
113
139
|
fallback: {
|
|
@@ -138,7 +164,7 @@ const styles = {
|
|
|
138
164
|
kVVagm: "xln7xf2",
|
|
139
165
|
kybGjl: "x1hl2dhg",
|
|
140
166
|
kkrTdU: "x1ypdohk x16khyan",
|
|
141
|
-
kaIpWk: "
|
|
167
|
+
kaIpWk: "xbc78cj",
|
|
142
168
|
$$css: true
|
|
143
169
|
}
|
|
144
170
|
};
|
|
@@ -168,15 +194,20 @@ const dynamicStyles = {
|
|
|
168
194
|
fontSize: size => [_temp, {
|
|
169
195
|
"--x-fontSize": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(`${size * INITIALS_FONT_SIZE_RATIO}px`)
|
|
170
196
|
}],
|
|
171
|
-
|
|
197
|
+
statusPositionCircle: size => [_temp2, {
|
|
172
198
|
"--x-bottom": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(size * CIRCLE_EDGE_OFFSET_RATIO),
|
|
173
199
|
"--x-insetInlineEnd": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(size * CIRCLE_EDGE_OFFSET_RATIO)
|
|
174
|
-
}]
|
|
200
|
+
}],
|
|
201
|
+
statusPositionCorner: {
|
|
202
|
+
krVfgx: "x1ey2m1c",
|
|
203
|
+
kt4wiu: "xtijo5x",
|
|
204
|
+
k3aq6I: "xv8yid9 x10fxb7p",
|
|
205
|
+
$$css: true
|
|
206
|
+
}
|
|
175
207
|
};
|
|
176
208
|
const BORDER_WIDTH = 2;
|
|
177
209
|
const groupStyles = {
|
|
178
210
|
ring: {
|
|
179
|
-
kaIpWk: "xjspbzw",
|
|
180
211
|
kMzoRj: "xdh2fpr",
|
|
181
212
|
ksu8eU: "x1y0btm7",
|
|
182
213
|
kVAM5u: "x1touxvs",
|
|
@@ -333,6 +364,7 @@ export function Avatar({
|
|
|
333
364
|
fallbackSrc,
|
|
334
365
|
name,
|
|
335
366
|
size = 'md',
|
|
367
|
+
shape = 'circle',
|
|
336
368
|
src,
|
|
337
369
|
status,
|
|
338
370
|
tooltip = true,
|
|
@@ -384,6 +416,7 @@ export function Avatar({
|
|
|
384
416
|
} : undefined;
|
|
385
417
|
const avatarGroup = useAvatarGroup();
|
|
386
418
|
const resolvedSize = avatarGroup?.size ?? size;
|
|
419
|
+
const resolvedShape = avatarGroup?.shape ?? shape;
|
|
387
420
|
const numericSize = useMemo(() => resolveSize(resolvedSize), [resolvedSize]);
|
|
388
421
|
|
|
389
422
|
// Resolve the tooltip content:
|
|
@@ -487,7 +520,7 @@ export function Avatar({
|
|
|
487
520
|
const visualContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
488
521
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
489
522
|
...{
|
|
490
|
-
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d
|
|
523
|
+
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d xb3r6kr x87ps6o xbc78cj"
|
|
491
524
|
},
|
|
492
525
|
children: [showImage && /*#__PURE__*/_jsx("img", {
|
|
493
526
|
src: src,
|
|
@@ -519,7 +552,7 @@ export function Avatar({
|
|
|
519
552
|
})
|
|
520
553
|
})]
|
|
521
554
|
}), status && /*#__PURE__*/_jsx("div", {
|
|
522
|
-
...stylex.props(styles.status, dynamicStyles.
|
|
555
|
+
...stylex.props(styles.status, resolvedShape === 'circle' ? dynamicStyles.statusPositionCircle(numericSize) : dynamicStyles.statusPositionCorner),
|
|
523
556
|
children: status
|
|
524
557
|
})]
|
|
525
558
|
});
|
|
@@ -529,8 +562,9 @@ export function Avatar({
|
|
|
529
562
|
// tooltip tab-stop focus ring all live here so the interactive
|
|
530
563
|
// `<a>`/`<button>` and the static `<div>` carry the exact same box.
|
|
531
564
|
const rootStylexProps = mergeProps(themeProps('avatar', {
|
|
532
|
-
size: resolvedSize
|
|
533
|
-
|
|
565
|
+
size: resolvedSize,
|
|
566
|
+
shape: resolvedShape
|
|
567
|
+
}), focusOutlineProps.focusVisible(styles.wrapper, dynamicStyles.size(numericSize), isInteractive && styles.interactive, avatarGroup && groupStyles.ring, avatarGroup && groupStyles.overlap, avatarGroup && groupDynamicStyles.overlap(-avatarGroup.overlap), shapeStyles[resolvedShape], xstyle), className, style);
|
|
534
568
|
let rootElement;
|
|
535
569
|
|
|
536
570
|
// `props` is typed for the default `<div>` root (its event handlers are
|
package/dist/Avatar/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file index.ts
|
|
3
3
|
* @input Imports Avatar component and types from Avatar.tsx, AvatarStatusDot from AvatarStatusDot.tsx
|
|
4
|
-
* @output Exports Avatar, AvatarProps, AvatarSize, AvatarStatusDot, AvatarStatusDotProps, AvatarStatusDotVariant
|
|
4
|
+
* @output Exports Avatar, AvatarProps, AvatarSize, AvatarShape, resolveSize, AvatarStatusDot, AvatarStatusDotProps, AvatarStatusDotVariant
|
|
5
5
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update this header and /packages/core/src/Avatar/Avatar.doc.mjs
|
|
@@ -32,7 +32,7 @@ export interface AvatarStatusDotVariantMap {
|
|
|
32
32
|
error: true;
|
|
33
33
|
}
|
|
34
34
|
export { Avatar, resolveSize } from './Avatar';
|
|
35
|
-
export type { AvatarProps, AvatarSize } from './Avatar';
|
|
35
|
+
export type { AvatarProps, AvatarSize, AvatarShape } from './Avatar';
|
|
36
36
|
export { AvatarStatusDot } from './AvatarStatusDot';
|
|
37
37
|
export type { AvatarStatusDotProps, AvatarStatusDotVariant, } from './AvatarStatusDot';
|
|
38
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Avatar/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;CACb;AAED,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Avatar/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,IAAI,CAAC;CACb;AAED,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAC,MAAM,UAAU,CAAC;AACnE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,YAAY,EACV,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
|
package/dist/Avatar/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file index.ts
|
|
7
7
|
* @input Imports Avatar component and types from Avatar.tsx, AvatarStatusDot from AvatarStatusDot.tsx
|
|
8
|
-
* @output Exports Avatar, AvatarProps, AvatarSize, AvatarStatusDot, AvatarStatusDotProps, AvatarStatusDotVariant
|
|
8
|
+
* @output Exports Avatar, AvatarProps, AvatarSize, AvatarShape, resolveSize, AvatarStatusDot, AvatarStatusDotProps, AvatarStatusDotVariant
|
|
9
9
|
* @position Component entry point; re-exported by /packages/core/src/index.ts
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update this header and /packages/core/src/Avatar/Avatar.doc.mjs
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { type ReactNode } from 'react';
|
|
24
24
|
import type { BaseProps } from '../BaseProps';
|
|
25
|
-
import { type AvatarSize } from '../Avatar';
|
|
25
|
+
import { type AvatarShape, type AvatarSize } from '../Avatar';
|
|
26
26
|
export interface AvatarGroupProps extends BaseProps<HTMLDivElement> {
|
|
27
27
|
/** Ref forwarded to the root element. */
|
|
28
28
|
ref?: React.Ref<HTMLDivElement>;
|
|
@@ -38,6 +38,13 @@ export interface AvatarGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
38
38
|
* @default 'md'
|
|
39
39
|
*/
|
|
40
40
|
size?: AvatarSize;
|
|
41
|
+
/**
|
|
42
|
+
* Shape applied to all avatars via context, overriding each avatar's own
|
|
43
|
+
* `shape` prop so a group stays visually uniform. Also applied to the
|
|
44
|
+
* `AvatarGroupOverflow` "+N" indicator, so it matches the group.
|
|
45
|
+
* @default 'circle'
|
|
46
|
+
*/
|
|
47
|
+
shape?: AvatarShape;
|
|
41
48
|
/**
|
|
42
49
|
* Test ID for integration testing.
|
|
43
50
|
*/
|
|
@@ -61,7 +68,7 @@ export interface AvatarGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
61
68
|
* </AvatarGroup>
|
|
62
69
|
* ```
|
|
63
70
|
*/
|
|
64
|
-
export declare function AvatarGroup({ children, size, 'data-testid': testId, 'aria-label': ariaLabelFromProps, 'aria-describedby': ariaDescribedByFromProps, onKeyDown, onFocus, xstyle, className, style, ref, ...props }: AvatarGroupProps): ReactNode;
|
|
71
|
+
export declare function AvatarGroup({ children, size, shape, 'data-testid': testId, 'aria-label': ariaLabelFromProps, 'aria-describedby': ariaDescribedByFromProps, onKeyDown, onFocus, xstyle, className, style, ref, ...props }: AvatarGroupProps): ReactNode;
|
|
65
72
|
export declare namespace AvatarGroup {
|
|
66
73
|
var displayName: string;
|
|
67
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,KAAK,UAAU,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAA2B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAC,MAAM,WAAW,CAAC;AAczE,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACjE,yCAAyC;IACzC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,IAAW,EACX,KAAgB,EAChB,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,kBAAkB,EAChC,kBAAkB,EAAE,wBAAwB,EAC5C,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CAmE9B;yBAjFe,WAAW"}
|
|
@@ -66,6 +66,7 @@ const styles = {
|
|
|
66
66
|
export function AvatarGroup({
|
|
67
67
|
children,
|
|
68
68
|
size = 'md',
|
|
69
|
+
shape = 'circle',
|
|
69
70
|
'data-testid': testId,
|
|
70
71
|
'aria-label': ariaLabelFromProps,
|
|
71
72
|
'aria-describedby': ariaDescribedByFromProps,
|
|
@@ -83,9 +84,10 @@ export function AvatarGroup({
|
|
|
83
84
|
const overlap = Math.round(numericSize * OVERLAP_RATIO);
|
|
84
85
|
const contextValue = useMemo(() => ({
|
|
85
86
|
size,
|
|
87
|
+
shape,
|
|
86
88
|
overlap,
|
|
87
89
|
numericSize
|
|
88
|
-
}), [size, overlap, numericSize]);
|
|
90
|
+
}), [size, shape, overlap, numericSize]);
|
|
89
91
|
|
|
90
92
|
// The keyboard hint and roving tab stop only make sense once the group has
|
|
91
93
|
// interactive children. Detect their presence from the rendered DOM after
|
|
@@ -127,7 +129,8 @@ export function AvatarGroup({
|
|
|
127
129
|
onKeyDown: composeEventHandlers(onKeyDown, handleKeyDown),
|
|
128
130
|
onFocus: composeEventHandlers(onFocus, handleFocus),
|
|
129
131
|
...mergeProps(themeProps('avatar-group', {
|
|
130
|
-
size
|
|
132
|
+
size,
|
|
133
|
+
shape
|
|
131
134
|
}), stylex.props(styles.root, xstyle), className, style),
|
|
132
135
|
children: [children, hasInteractiveItems && /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
133
136
|
id: hintId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroupContext.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroupContext.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"AvatarGroupContext.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroupContext.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AAEvD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,kBAAkB,yDAE9B,CAAC;AAGF,wBAAgB,cAAc,IAAI,uBAAuB,GAAG,IAAI,CAE/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroupOverflow.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroupOverflow.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAa5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,SAAS,CAAC,WAAW,CAAC,EACtB,SAAS,CACV;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"AvatarGroupOverflow.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroupOverflow.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAa5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,MAAM,WAAW,wBAAyB,SAAQ,IAAI,CACpD,SAAS,CAAC,WAAW,CAAC,EACtB,SAAS,CACV;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAwFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,GAAG,EACH,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,wBAAwB,GAAG,SAAS,CAkEtC;yBA3Ee,mBAAmB"}
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import * as stylex from '@stylexjs/stylex';
|
|
17
17
|
import "../theme/tokens.stylex.js";
|
|
18
|
-
import { colorVars, typographyVars, typeScaleVars, fontWeightVars,
|
|
18
|
+
import { colorVars, typographyVars, typeScaleVars, fontWeightVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
19
|
+
import { shapeStyles } from "../Avatar/Avatar.js";
|
|
19
20
|
import { mergeProps } from "../utils/index.js";
|
|
20
21
|
import { resolveSize } from "../Avatar/index.js";
|
|
21
22
|
import { useAvatarGroup } from "./AvatarGroupContext.js";
|
|
@@ -31,7 +32,7 @@ const styles = {
|
|
|
31
32
|
k1xSpc: "x3nfvp2",
|
|
32
33
|
kGNEyG: "x6s0dn4",
|
|
33
34
|
kjj79g: "xl56j7k",
|
|
34
|
-
kaIpWk: "
|
|
35
|
+
kaIpWk: "xbc78cj",
|
|
35
36
|
kWkggS: "x10xzikg",
|
|
36
37
|
kMwMTN: "xv1l7n4",
|
|
37
38
|
kMv6JI: "x9ynric",
|
|
@@ -109,6 +110,7 @@ export function AvatarGroupOverflow({
|
|
|
109
110
|
const t = useTranslator();
|
|
110
111
|
const group = useAvatarGroup();
|
|
111
112
|
const size = group?.size ?? 'md';
|
|
113
|
+
const shape = group?.shape ?? 'circle';
|
|
112
114
|
const numericSize = group?.numericSize ?? resolveSize('md');
|
|
113
115
|
const overlap = group?.overlap ?? 0;
|
|
114
116
|
|
|
@@ -129,8 +131,9 @@ export function AvatarGroupOverflow({
|
|
|
129
131
|
"aria-label": label,
|
|
130
132
|
"data-avatar-item": "",
|
|
131
133
|
...mergeProps(themeProps('avatar-group-overflow', {
|
|
132
|
-
size
|
|
133
|
-
|
|
134
|
+
size,
|
|
135
|
+
shape
|
|
136
|
+
}), focusOutlineProps.focusVisible(styles.base, styles.button, styles.overlap, dynamicStyles.size(numericSize), dynamicStyles.fontSize(numericSize), dynamicStyles.overlap(-overlap), shapeStyles[shape], xstyle), className, style),
|
|
134
137
|
children: content
|
|
135
138
|
});
|
|
136
139
|
}
|
|
@@ -139,8 +142,9 @@ export function AvatarGroupOverflow({
|
|
|
139
142
|
...rest,
|
|
140
143
|
"aria-label": label,
|
|
141
144
|
...mergeProps(themeProps('avatar-group-overflow', {
|
|
142
|
-
size
|
|
143
|
-
|
|
145
|
+
size,
|
|
146
|
+
shape
|
|
147
|
+
}), stylex.props(styles.base, styles.overlap, dynamicStyles.size(numericSize), dynamicStyles.fontSize(numericSize), dynamicStyles.overlap(-overlap), shapeStyles[shape], xstyle), className, style),
|
|
144
148
|
children: content
|
|
145
149
|
});
|
|
146
150
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/HoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG7E,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,YAAY,EACV,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AAiBxB,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,SAAS,EACT,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IA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ACT,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;IAErC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtC;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAiBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,OAAO,EACP,SAAmB,EACnB,SAAoB,EACpB,KAAW,EACX,SAAe,EACf,YAAqB,EACrB,YAAqB,EACrB,SAAgB,EAChB,KAAK,EACL,YAAY,EACZ,kBAA2B,EAC3B,MAAM,EACN,aAAa,EACb,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,cAAc,GAAG,YAAY,CAwK/B;yBA1Le,SAAS"}
|
|
@@ -115,8 +115,54 @@ export function HoverCard({
|
|
|
115
115
|
|
|
116
116
|
// Use combined ref for position + interaction
|
|
117
117
|
hoverCard.ref(firstChild);
|
|
118
|
+
if (label) {
|
|
119
|
+
// When named, the hover card is a dialog. The trigger should advertise the
|
|
120
|
+
// popup relationship with aria-haspopup/aria-expanded, not describe the
|
|
121
|
+
// trigger with the dialog's content (aria-describedby is for plain-text
|
|
122
|
+
// descriptions, not navigable regions). See #5049.
|
|
123
|
+
//
|
|
124
|
+
// Merge rather than overwrite: the trigger may already carry its own
|
|
125
|
+
// popup semantics (e.g. a menu button wrapped in a labelled HoverCard),
|
|
126
|
+
// so preserve the existing values and restore them on cleanup.
|
|
127
|
+
const existingHaspopup = firstChild.getAttribute('aria-haspopup');
|
|
128
|
+
const existingControls = firstChild.getAttribute('aria-controls');
|
|
129
|
+
const existingExpanded = firstChild.getAttribute('aria-expanded');
|
|
130
|
+
firstChild.setAttribute('aria-haspopup', 'dialog');
|
|
131
|
+
// Only point aria-controls at the layer while it is open and in the DOM.
|
|
132
|
+
// While closed, useLayer leaves only an inert <template> marker, so the
|
|
133
|
+
// id would reference nothing. DateInput gates it the same way. The
|
|
134
|
+
// trigger's own aria-controls (if any) is preserved either way.
|
|
135
|
+
if (hoverCard.isOpen) {
|
|
136
|
+
firstChild.setAttribute('aria-controls', mergeIds(existingControls, hoverCard.id) ?? '');
|
|
137
|
+
} else if (existingControls) {
|
|
138
|
+
firstChild.setAttribute('aria-controls', existingControls);
|
|
139
|
+
} else {
|
|
140
|
+
firstChild.removeAttribute('aria-controls');
|
|
141
|
+
}
|
|
142
|
+
firstChild.setAttribute('aria-expanded', String(hoverCard.isOpen));
|
|
143
|
+
return () => {
|
|
144
|
+
hoverCard.ref(null);
|
|
145
|
+
if (existingHaspopup) {
|
|
146
|
+
firstChild.setAttribute('aria-haspopup', existingHaspopup);
|
|
147
|
+
} else {
|
|
148
|
+
firstChild.removeAttribute('aria-haspopup');
|
|
149
|
+
}
|
|
150
|
+
if (existingControls) {
|
|
151
|
+
firstChild.setAttribute('aria-controls', existingControls);
|
|
152
|
+
} else {
|
|
153
|
+
firstChild.removeAttribute('aria-controls');
|
|
154
|
+
}
|
|
155
|
+
if (existingExpanded) {
|
|
156
|
+
firstChild.setAttribute('aria-expanded', existingExpanded);
|
|
157
|
+
} else {
|
|
158
|
+
firstChild.removeAttribute('aria-expanded');
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
118
162
|
|
|
119
|
-
//
|
|
163
|
+
// Unnamed fallback: the popup remains role="group", which is not a dialog,
|
|
164
|
+
// so keep the previous description relationship until a naming decision is
|
|
165
|
+
// made for the no-label case (tracked in #5049).
|
|
120
166
|
const existingDescribedBy = firstChild.getAttribute('aria-describedby');
|
|
121
167
|
firstChild.setAttribute('aria-describedby', mergeIds(existingDescribedBy, hoverCard.describedBy) ?? '');
|
|
122
168
|
return () => {
|
|
@@ -127,7 +173,7 @@ export function HoverCard({
|
|
|
127
173
|
firstChild.removeAttribute('aria-describedby');
|
|
128
174
|
}
|
|
129
175
|
};
|
|
130
|
-
}, [textOnly, hoverCard.ref, hoverCard.describedBy]);
|
|
176
|
+
}, [textOnly, label, hoverCard.ref, hoverCard.id, hoverCard.isOpen, hoverCard.describedBy]);
|
|
131
177
|
|
|
132
178
|
// While closed, useLayer leaves only an inert <template> marker at this JSX
|
|
133
179
|
// position. When the card needs to open, it uses that marker to keep the
|
|
@@ -145,7 +191,10 @@ export function HoverCard({
|
|
|
145
191
|
children: [/*#__PURE__*/_jsx("span", {
|
|
146
192
|
ref: hoverCard.ref,
|
|
147
193
|
tabIndex: 0,
|
|
148
|
-
"aria-
|
|
194
|
+
"aria-haspopup": label ? 'dialog' : undefined,
|
|
195
|
+
"aria-controls": label && hoverCard.isOpen ? hoverCard.id : undefined,
|
|
196
|
+
"aria-expanded": label ? hoverCard.isOpen : undefined,
|
|
197
|
+
"aria-describedby": label ? undefined : hoverCard.describedBy,
|
|
149
198
|
...{
|
|
150
199
|
0: {
|
|
151
200
|
className: "xt0psk2"
|
|
@@ -124,10 +124,19 @@ export interface HoverCardReturn {
|
|
|
124
124
|
*/
|
|
125
125
|
anchorId: string;
|
|
126
126
|
/**
|
|
127
|
-
* ID for
|
|
128
|
-
*
|
|
127
|
+
* Unique ID for the hover card container.
|
|
128
|
+
* Useful for `aria-controls` or `aria-owns` on the trigger.
|
|
129
|
+
*/
|
|
130
|
+
id: string;
|
|
131
|
+
/**
|
|
132
|
+
* Deprecated alias of `id`. Kept for backwards compatibility; prefer `id`.
|
|
129
133
|
*/
|
|
130
134
|
describedBy: string;
|
|
135
|
+
/**
|
|
136
|
+
* Whether the hover card is currently open.
|
|
137
|
+
* Useful for driving `aria-expanded` on the trigger.
|
|
138
|
+
*/
|
|
139
|
+
isOpen: boolean;
|
|
131
140
|
/**
|
|
132
141
|
* Render function for hover card content.
|
|
133
142
|
* Returns anchor-positioned popover element.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/useHoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AA6BlC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,YA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E,MAAM,CAAC;IAEjB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;;OAOG;IACH,eAAe,EAAE,CACf,QAAQ,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,KAC5C,SAAS,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAyBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CA6a5E"}
|
|
@@ -425,7 +425,9 @@ export function useHoverCard(options = {}) {
|
|
|
425
425
|
positionRef: layer.ref,
|
|
426
426
|
interactionRef,
|
|
427
427
|
anchorId: layer.anchorId,
|
|
428
|
+
id: layer.id,
|
|
428
429
|
describedBy: layer.id,
|
|
430
|
+
isOpen: layer.isOpen,
|
|
429
431
|
renderHoverCard,
|
|
430
432
|
show: layer.show,
|
|
431
433
|
hide: layer.hide
|
package/dist/astryx.css
CHANGED
|
@@ -79,6 +79,9 @@
|
|
|
79
79
|
:root, .x1kvdh9l{--spacing-0:0px;--spacing-0-5:2px;--spacing-1:4px;--spacing-1-5:6px;--spacing-2:8px;--spacing-3:12px;--spacing-4:16px;--spacing-5:20px;--spacing-6:24px;--spacing-7:28px;--spacing-8:32px;--spacing-9:36px;--spacing-10:40px;--spacing-11:44px;--spacing-12:48px;}
|
|
80
80
|
:root, .x1etlgq0{--text-heading-1-size:var(--font-size-2xl);--text-heading-1-weight:var(--font-weight-semibold);--text-heading-1-leading:1.3333;--text-heading-2-size:var(--font-size-xl);--text-heading-2-weight:var(--font-weight-semibold);--text-heading-2-leading:1.4;--text-heading-3-size:var(--font-size-lg);--text-heading-3-weight:var(--font-weight-semibold);--text-heading-3-leading:1.4118;--text-heading-4-size:var(--font-size-base);--text-heading-4-weight:var(--font-weight-semibold);--text-heading-4-leading:1.4286;--text-heading-5-size:var(--font-size-sm);--text-heading-5-weight:var(--font-weight-semibold);--text-heading-5-leading:1.6667;--text-heading-6-size:var(--font-size-xs);--text-heading-6-weight:var(--font-weight-semibold);--text-heading-6-leading:1.6;--text-body-size:var(--font-size-base);--text-body-weight:var(--font-weight-normal);--text-body-leading:1.4286;--text-large-size:var(--font-size-lg);--text-large-weight:var(--font-weight-semibold);--text-large-leading:1.4118;--text-label-size:var(--font-size-base);--text-label-weight:var(--font-weight-medium);--text-label-leading:1.4286;--text-code-size:var(--font-size-base);--text-code-weight:var(--font-weight-normal);--text-code-leading:1.4286;--text-supporting-size:var(--font-size-sm);--text-supporting-weight:var(--font-weight-normal);--text-supporting-leading:1.6667;--text-display-1-size:var(--font-size-5xl);--text-display-1-weight:var(--font-weight-normal);--text-display-1-leading:1.2381;--text-display-2-size:var(--font-size-4xl);--text-display-2-weight:var(--font-weight-normal);--text-display-2-leading:1.2571;--text-display-3-size:var(--font-size-3xl);--text-display-3-weight:var(--font-weight-normal);--text-display-3-leading:1.2414;}
|
|
81
81
|
.xlz5hwt{--_avatar-group-overlap:var(--x---_avatar-group-overlap)}
|
|
82
|
+
.xdarwi0{--_avatar-radius:var(--radius-element)}
|
|
83
|
+
.xeincmr{--_avatar-radius:var(--radius-full)}
|
|
84
|
+
.x877142{--_avatar-radius:var(--radius-none)}
|
|
82
85
|
.xh8ntw8{--_button-radius:calc(var(--radius-element) - var(--spacing-1))}
|
|
83
86
|
.xcw7vlg{--_button-radius:max(var(--radius-element),calc(var(--_chat-composer-radius) - var(--_chat-composer-padding)))}
|
|
84
87
|
.x1rjw8qi{--_button-radius:var(--radius-full)}
|
|
@@ -401,6 +404,7 @@
|
|
|
401
404
|
.x1pjcqnp:not(#\#):not(#\#){border-radius:inherit}
|
|
402
405
|
.x1ws5lxm:not(#\#):not(#\#){border-radius:max(0px,calc(var(--_dropdown-menu-radius,var(--spacing-2)) - var(--_dropdown-menu-padding,var(--spacing-1))))}
|
|
403
406
|
.xc910v0:not(#\#):not(#\#){border-radius:max(0px,calc(var(--_segmented-control-radius) - var(--_segmented-control-padding)))}
|
|
407
|
+
.xbc78cj:not(#\#):not(#\#){border-radius:var(--_avatar-radius)}
|
|
404
408
|
.x1vf2byn:not(#\#):not(#\#){border-radius:var(--_banner-radius,var(--radius-container))}
|
|
405
409
|
.x1jxw6zd:not(#\#):not(#\#){border-radius:var(--_button-radius,var(--radius-element))}
|
|
406
410
|
.xy0xnkn:not(#\#):not(#\#){border-radius:var(--_button-radius,var(--radius-full))}
|
|
@@ -1149,6 +1153,7 @@
|
|
|
1149
1153
|
.x3oybdh:not(#\#):not(#\#):not(#\#){transform:scale(1)}
|
|
1150
1154
|
.x11lhmoz:not(#\#):not(#\#):not(#\#){transform:translate(-50%,-50%)}
|
|
1151
1155
|
.x1m9mm8y:not(#\#):not(#\#):not(#\#){transform:translate(-50%,50%)}
|
|
1156
|
+
.xv8yid9:not(#\#):not(#\#):not(#\#){transform:translate(25%,25%)}
|
|
1152
1157
|
.x4v1no5:not(#\#):not(#\#):not(#\#){transform:translate(50%,50%)}
|
|
1153
1158
|
.x5i6ehr:not(#\#):not(#\#):not(#\#){transform:translateX(-100%)}
|
|
1154
1159
|
.xuuh30:not(#\#):not(#\#):not(#\#){transform:translateX(-50%)}
|
|
@@ -1298,6 +1303,7 @@
|
|
|
1298
1303
|
.xaafvuh:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:scaleX(-1) rotate(0deg)}
|
|
1299
1304
|
.x1nxqau:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:scaleX(-1) rotate(90deg)}
|
|
1300
1305
|
.xgtlewx:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:scaleX(-1)}
|
|
1306
|
+
.x10fxb7p:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:translate(-25%,25%)}
|
|
1301
1307
|
.xqgnvz5:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:translate(-50%,50%)}
|
|
1302
1308
|
.xoffwj3:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:translate(50%,-50%)}
|
|
1303
1309
|
.x1df3fe5:is([dir="rtl"] *):not(#\#):not(#\#):not(#\#){transform:translateX(-100%)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivedVarRegistry.d.ts","sourceRoot":"","sources":["../../src/theme/derivedVarRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"derivedVarRegistry.d.ts","sourceRoot":"","sources":["../../src/theme/derivedVarRegistry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,iFAAiF;IACjF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CA+ChE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,eAAe,EAAE,CAMnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.5.0-canary.
|
|
3
|
+
"version": "0.5.0-canary.f4d494c",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -661,7 +661,7 @@
|
|
|
661
661
|
"react-dom": ">=19.0.0"
|
|
662
662
|
},
|
|
663
663
|
"devDependencies": {
|
|
664
|
-
"@astryxdesign/cli": "0.5.0-canary.
|
|
664
|
+
"@astryxdesign/cli": "0.5.0-canary.f4d494c",
|
|
665
665
|
"@babel/cli": "^8.0.4",
|
|
666
666
|
"@babel/core": "^7.29.7",
|
|
667
667
|
"@babel/preset-react": "^8.0.1",
|
|
@@ -19,7 +19,7 @@ export const docs = {
|
|
|
19
19
|
{guidance: true, description: 'Give every interactive avatar (href or onClick) a name or alt. It is the control\'s accessible name, and it warns in development when it is missing.'},
|
|
20
20
|
{guidance: false, description: 'Rely on a status label to name an interactive avatar. "Online" says nothing about where the link goes.'},
|
|
21
21
|
{guidance: false, description: 'Use Avatar for logos, product images, or anything that isn\'t a person or team. Use an image or icon instead.'},
|
|
22
|
-
{guidance: false, description: '
|
|
22
|
+
{guidance: false, description: 'Use xstyle or className to override shape. Use the shape prop instead so themes can control it globally.'},
|
|
23
23
|
],
|
|
24
24
|
anatomy: [
|
|
25
25
|
{name: 'Photo', required: false, description: 'The profile image, loaded from the src URL. Shown when available.'},
|
|
@@ -30,13 +30,17 @@ export const docs = {
|
|
|
30
30
|
},
|
|
31
31
|
theming: {
|
|
32
32
|
targets: [
|
|
33
|
-
{className: 'astryx-avatar', visualProps: ['size']},
|
|
33
|
+
{className: 'astryx-avatar', visualProps: ['size', 'shape']},
|
|
34
34
|
{className: 'astryx-avatar-fallback', visualProps: ['size']},
|
|
35
35
|
{className: 'astryx-avatar-status-dot', visualProps: ['variant']},
|
|
36
36
|
{className: 'astryx-avatar-status-dot-glyph', visualProps: ['shape']},
|
|
37
37
|
],
|
|
38
38
|
vars: [
|
|
39
39
|
{name: '--_avatar-group-overlap', description: 'Negative inline offset applied to every avatar after the first when avatars are stacked in an AvatarGroup. Set from the group size; a more negative value tightens the stack.', default: 'set at runtime from the group avatar size (px)', private: true},
|
|
40
|
+
{name: '--_avatar-radius', description: 'Border radius of the avatar wrapper, content, focus ring, and the AvatarGroupOverflow "+N" chip. Set per shape variant by shapeStyles.', default: 'var(--radius-full)', private: true},
|
|
41
|
+
],
|
|
42
|
+
derived: [
|
|
43
|
+
{property: 'borderRadius', vars: ['--_avatar-radius']},
|
|
40
44
|
],
|
|
41
45
|
},
|
|
42
46
|
description: 'Displays a user avatar with image, initials fallback, and optional status indicator.',
|
|
@@ -67,6 +71,12 @@ export const docs = {
|
|
|
67
71
|
description: "Avatar size. Use a named size ('xsm' 20px, 'sm' 24px, 'md' 36px, 'lg' 48px, 'xl' 128px) or a numeric pixel value. Avatar shares Icon's abbreviated scale, but its tiers are larger because avatars align with media rather than glyphs. Inside an AvatarGroup the group's size wins and this prop is ignored.",
|
|
68
72
|
default: "'md'",
|
|
69
73
|
},
|
|
74
|
+
{
|
|
75
|
+
name: 'shape',
|
|
76
|
+
type: "'circle' | 'rounded' | 'square'",
|
|
77
|
+
description: "Shape variant of the avatar. 'circle' (default) stays fully round. 'rounded' uses the element radius token so it matches UI corner rounding and can be set globally via theme. 'square' has no radius. Status dot positioning adapts automatically: 4-o'clock on circle, bottom-right corner on rounded/square.",
|
|
78
|
+
default: "'circle'",
|
|
79
|
+
},
|
|
70
80
|
{
|
|
71
81
|
name: 'status',
|
|
72
82
|
type: 'ReactNode',
|