@astryxdesign/core 0.5.0-canary.ea888ef → 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/DateInput/DateInput.d.ts +43 -0
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +19 -0
- package/dist/DateInput/NativeDateField.d.ts +10 -0
- package/dist/DateInput/NativeDateField.d.ts.map +1 -0
- package/dist/DateInput/NativeDateField.js +477 -0
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts.map +1 -1
- 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/Indicator/CheckboxIndicator.d.ts.map +1 -1
- package/dist/Indicator/CheckboxIndicator.js +6 -2
- package/dist/Kbd/Kbd.d.ts.map +1 -1
- package/dist/Kbd/Kbd.js +2 -26
- package/dist/astryx.css +21 -0
- package/dist/hooks/useHotkeys.d.ts.map +1 -1
- package/dist/hooks/useHotkeys.js +3 -25
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +4 -0
- package/dist/theme/syntax/tokens.d.ts +1 -1
- package/dist/theme/syntax/tokens.d.ts.map +1 -1
- package/dist/theme/syntax/tokens.js +5 -2
- package/dist/utils/isApplePlatform.d.ts +18 -0
- package/dist/utils/isApplePlatform.d.ts.map +1 -0
- package/dist/utils/isApplePlatform.js +37 -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/DateInput/DateInput.doc.mjs +16 -0
- package/src/DateInput/DateInput.tsx +52 -0
- package/src/DateInput/DateInputTouch.test.tsx +32 -9
- package/src/DateInput/NativeDateField.test.tsx +565 -0
- package/src/DateInput/NativeDateField.tsx +623 -0
- package/src/DateInput/index.ts +1 -0
- package/src/HoverCard/HoverCard.test.tsx +84 -4
- package/src/HoverCard/HoverCard.tsx +65 -3
- package/src/HoverCard/useHoverCard.tsx +15 -2
- package/src/Indicator/CheckboxIndicator.tsx +14 -8
- package/src/Indicator/Indicator.doc.mjs +2 -0
- package/src/Kbd/Kbd.test.tsx +0 -17
- package/src/Kbd/Kbd.tsx +2 -26
- package/src/hooks/useHotkeys.test.ts +0 -18
- package/src/hooks/useHotkeys.ts +3 -25
- package/src/theme/derivedVarRegistry.test.ts +1 -0
- package/src/theme/derivedVarRegistry.ts +1 -0
- package/src/theme/syntax/tokens.ts +5 -2
- package/src/utils/isApplePlatform.test.ts +61 -0
- package/src/utils/isApplePlatform.ts +37 -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,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAqB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AAE,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
|
}
|
|
@@ -31,6 +31,16 @@ export type DateInputSize = keyof typeof sizeStyles;
|
|
|
31
31
|
* types stay in compile-time lockstep: renaming or removing one of these
|
|
32
32
|
* members from `TimestampFormat` breaks this type at build time.
|
|
33
33
|
*/
|
|
34
|
+
/**
|
|
35
|
+
* When DateInput hands date picking to the browser/OS instead of its own
|
|
36
|
+
* surfaces.
|
|
37
|
+
*
|
|
38
|
+
* - `'touch'`: native on touch devices (coarse pointer), Astryx's calendar
|
|
39
|
+
* popover on mouse-driven ones
|
|
40
|
+
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
41
|
+
* - `'never'`: Astryx's own pickers everywhere
|
|
42
|
+
*/
|
|
43
|
+
export type DateInputNativePicker = 'touch' | 'always' | 'never';
|
|
34
44
|
export type DateInputFormat = Extract<TimestampFormat, 'date' | 'date_long' | 'date_weekday' | 'system_date'>;
|
|
35
45
|
export type { InputStatus as DateInputStatus, InputStatusType as DateInputStatusType, } from '../Field';
|
|
36
46
|
import type { BaseProps } from '../BaseProps';
|
|
@@ -202,6 +212,39 @@ export interface DateInputProps extends Omit<BaseProps, 'onChange' | 'defaultVal
|
|
|
202
212
|
* ```
|
|
203
213
|
*/
|
|
204
214
|
format?: DateInputFormat | ((value: ISODateString) => string);
|
|
215
|
+
/**
|
|
216
|
+
* When date picking is handed to the browser/OS instead of Astryx's own
|
|
217
|
+
* surfaces: the field becomes an `<input type="date">` and the platform
|
|
218
|
+
* draws the picker — the iOS wheel, the Android calendar dialog — with the
|
|
219
|
+
* OS's own hit areas, momentum scrolling, locale and accessibility
|
|
220
|
+
* settings.
|
|
221
|
+
*
|
|
222
|
+
* - `'touch'` (default): native on touch devices (coarse pointer), the text
|
|
223
|
+
* field and calendar popover on mouse-driven ones
|
|
224
|
+
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
225
|
+
* - `'never'`: Astryx's own pickers everywhere — the touch picker on a
|
|
226
|
+
* finger, the calendar popover on a mouse
|
|
227
|
+
*
|
|
228
|
+
* `format` and `placeholder` still apply in native mode: DateInput paints
|
|
229
|
+
* the closed field's text itself, over the control. `numberOfMonths` and
|
|
230
|
+
* `weekStartsOn` do not — they describe a calendar grid the native picker
|
|
231
|
+
* does not have — so a field that needs either should pass `'never'`.
|
|
232
|
+
*
|
|
233
|
+
* `min` and `max` are forwarded, but note that a native picker may not
|
|
234
|
+
* *show* them: on iOS they are constraint-validation flags rather than
|
|
235
|
+
* clamps, so an out-of-range date can be selected and is refused on commit
|
|
236
|
+
* (announced to assistive technology) rather than being greyed out in the
|
|
237
|
+
* picker. `dateConstraints` is enforced the same way, on commit, and is
|
|
238
|
+
* reason enough to prefer `'never'` on a field that uses it.
|
|
239
|
+
*
|
|
240
|
+
* @default 'touch'
|
|
241
|
+
* @example
|
|
242
|
+
* ```
|
|
243
|
+
* // Astryx's own touch picker instead of the platform's
|
|
244
|
+
* <DateInput label="Event date" value={date} onChange={setDate} nativePicker="never" />
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
nativePicker?: DateInputNativePicker;
|
|
205
248
|
}
|
|
206
249
|
/**
|
|
207
250
|
* A date picker that fits the pointer it is being used with.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../src/DateInput/DateInput.tsx"],"names":[],"mappings":"AA2BA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,EAGL,KAAK,WAAW,EAKhB,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAOlB,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"DateInput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CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC,CAAC;IAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAmeD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAc9C;yBAde,SAAS"}
|
|
@@ -32,6 +32,7 @@ import { useInputStatusIcon } from "../hooks/useInputStatusIcon.js";
|
|
|
32
32
|
import { useMediaQuery } from "../hooks/useMediaQuery.js";
|
|
33
33
|
import { useResolvedRequired } from "../hooks/useResolvedRequired.js";
|
|
34
34
|
import { usePopover } from "../Popover/index.js";
|
|
35
|
+
import { NativeDateField } from "./NativeDateField.js";
|
|
35
36
|
import { TouchDateField } from "./TouchDateField.js";
|
|
36
37
|
import { useTooltip } from "../Tooltip/index.js";
|
|
37
38
|
import { getInputARIA, isImeKeyEvent, parseDateInput } from "../utils/index.js";
|
|
@@ -87,6 +88,15 @@ const sizeStyles = {
|
|
|
87
88
|
* types stay in compile-time lockstep: renaming or removing one of these
|
|
88
89
|
* members from `TimestampFormat` breaks this type at build time.
|
|
89
90
|
*/
|
|
91
|
+
/**
|
|
92
|
+
* When DateInput hands date picking to the browser/OS instead of its own
|
|
93
|
+
* surfaces.
|
|
94
|
+
*
|
|
95
|
+
* - `'touch'`: native on touch devices (coarse pointer), Astryx's calendar
|
|
96
|
+
* popover on mouse-driven ones
|
|
97
|
+
* - `'always'`: native wherever the browser supports `<input type="date">`
|
|
98
|
+
* - `'never'`: Astryx's own pickers everywhere
|
|
99
|
+
*/
|
|
90
100
|
|
|
91
101
|
// Re-export shared types for convenience
|
|
92
102
|
|
|
@@ -560,6 +570,15 @@ PointerDateField.displayName = 'PointerDateField';
|
|
|
560
570
|
*/
|
|
561
571
|
export function DateInput(props) {
|
|
562
572
|
const isTouch = useMediaQuery(TOUCH_POINTER_QUERY);
|
|
573
|
+
const nativePicker = props.nativePicker ?? 'touch';
|
|
574
|
+
|
|
575
|
+
// The platform's picker, where the consumer asked for it — see the
|
|
576
|
+
// `nativePicker` prop for what that trades away.
|
|
577
|
+
if (nativePicker === 'always' || nativePicker === 'touch' && isTouch) {
|
|
578
|
+
return /*#__PURE__*/_jsx(NativeDateField, {
|
|
579
|
+
...props
|
|
580
|
+
});
|
|
581
|
+
}
|
|
563
582
|
return isTouch ? /*#__PURE__*/_jsx(TouchDateField, {
|
|
564
583
|
...props
|
|
565
584
|
}) : /*#__PURE__*/_jsx(PointerDateField, {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DateInputProps } from './DateInput';
|
|
2
|
+
/**
|
|
3
|
+
* The OS-picker surface. Takes `DateInput`'s props verbatim; see
|
|
4
|
+
* {@link DateInput} for when it is chosen over the other two.
|
|
5
|
+
*/
|
|
6
|
+
export declare function NativeDateField({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, value, onChange, isLoading, min, max, dateConstraints, placeholder: placeholderFromProps, size: sizeProp, status, statusVariant, labelTooltip, hasClear, numberOfMonths: _numberOfMonths, weekStartsOn: _weekStartsOn, format, width, xstyle, className, style, ref, ...rest }: DateInputProps): import("react").JSX.Element;
|
|
7
|
+
export declare namespace NativeDateField {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=NativeDateField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NativeDateField.d.ts","sourceRoot":"","sources":["../../src/DateInput/NativeDateField.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAwLhD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,QAAgB,EAGhB,cAAc,EAAE,eAAe,EAC/B,YAAY,EAAE,aAAa,EAC3B,MAAoB,EACpB,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BAmXhB;yBAlZe,eAAe"}
|