@astryxdesign/core 0.1.7-canary.d91c851 → 0.1.7-canary.e486729
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/README.md +19 -30
- package/dist/Avatar/Avatar.d.ts +5 -10
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +8 -12
- package/dist/Avatar/AvatarSizeContext.d.ts +1 -1
- package/dist/Avatar/AvatarSizeContext.js +1 -1
- package/dist/Avatar/AvatarStatusDot.d.ts +2 -2
- package/dist/Avatar/AvatarStatusDot.js +2 -2
- package/dist/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/dist/AvatarGroup/AvatarGroup.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroup.js +2 -2
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +1 -1
- package/dist/Carousel/Carousel.d.ts +2 -3
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +2 -32
- package/dist/Chat/ChatMessage.d.ts +1 -1
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessage.js +1 -1
- package/dist/Icon/Icon.d.ts +1 -26
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +7 -34
- package/dist/Outline/Outline.d.ts +3 -69
- package/dist/Outline/Outline.d.ts.map +1 -1
- package/dist/Outline/Outline.js +26 -129
- package/dist/Outline/useScrollSpy.d.ts +7 -27
- package/dist/Outline/useScrollSpy.d.ts.map +1 -1
- package/dist/Outline/useScrollSpy.js +70 -202
- package/dist/Table/Table.d.ts +1 -1
- package/dist/Table/Table.js +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +2 -24
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +7 -18
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/TreeList/TreeListItem.js +14 -5
- package/dist/TreeList/treeListItem.markers.stylex.d.ts +16 -0
- package/dist/TreeList/treeListItem.markers.stylex.d.ts.map +1 -0
- package/dist/TreeList/treeListItem.markers.stylex.js +22 -0
- package/dist/astryx.css +2 -6
- package/dist/astryx.umd.js +49 -49
- package/dist/astryx.umd.js.map +4 -4
- package/dist/theme/Theme.js +1 -1
- package/dist/theme/defineTheme.d.ts +1 -1
- package/dist/theme/defineTheme.js +1 -1
- package/docs.mjs +461 -32
- package/locales/en.json +172 -192
- package/locales/pseudo.json +0 -15
- package/package.json +1 -3
- package/src/Avatar/Avatar.doc.mjs +6 -6
- package/src/Avatar/Avatar.tsx +11 -16
- package/src/Avatar/AvatarSizeContext.ts +1 -1
- package/src/Avatar/AvatarStatusDot.tsx +2 -2
- package/src/AvatarGroup/AvatarGroup.doc.mjs +1 -1
- package/src/AvatarGroup/AvatarGroup.test.tsx +3 -3
- package/src/AvatarGroup/AvatarGroup.tsx +3 -3
- package/src/AvatarGroup/AvatarGroupOverflow.doc.mjs +2 -2
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +1 -1
- package/src/Carousel/Carousel.doc.mjs +0 -1
- package/src/Carousel/Carousel.test.tsx +1 -96
- package/src/Carousel/Carousel.tsx +2 -29
- package/src/Chat/Chat.doc.mjs +1 -1
- package/src/Chat/ChatMessage.tsx +2 -4
- package/src/CheckboxInput/CheckboxInput.doc.mjs +1 -1
- package/src/DropdownMenu/DropdownMenuItem.doc.mjs +1 -1
- package/src/Field/Field.doc.mjs +1 -1
- package/src/Field/FieldLabel.doc.mjs +1 -1
- package/src/Icon/Icon.doc.mjs +0 -12
- package/src/Icon/Icon.test.tsx +0 -96
- package/src/Icon/Icon.tsx +6 -61
- package/src/Item/Item.doc.mjs +1 -1
- package/src/NumberInput/NumberInput.doc.mjs +2 -2
- package/src/Outline/Outline.doc.mjs +3 -123
- package/src/Outline/Outline.test.tsx +0 -735
- package/src/Outline/Outline.tsx +33 -184
- package/src/Outline/useScrollSpy.ts +72 -248
- package/src/Selector/SelectorOption.doc.mjs +1 -1
- package/src/SideNav/SideNavItem.doc.mjs +2 -2
- package/src/Switch/Switch.doc.mjs +1 -1
- package/src/Table/Table.tsx +1 -1
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.test.tsx +1 -90
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +5 -37
- package/src/Table/plugins/sortable/useTableSortable.test.tsx +9 -95
- package/src/Table/plugins/sortable/useTableSortable.tsx +7 -23
- package/src/TextArea/TextArea.doc.mjs +1 -1
- package/src/TextInput/TextInput.doc.mjs +1 -1
- package/src/TreeList/TreeList.test.tsx +1 -32
- package/src/TreeList/TreeListItem.tsx +10 -19
- package/src/TreeList/treeListItem.markers.stylex.ts +20 -0
- package/src/docs-script.test.mjs +13 -18
- package/src/theme/Theme.doc.mjs +4 -4
- package/src/theme/Theme.tsx +1 -1
- package/src/theme/defineTheme.ts +1 -1
- package/scripts/postinstall.mjs +0 -93
- package/src/postinstall.test.mjs +0 -71
package/README.md
CHANGED
|
@@ -2,27 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Core UI components, theme system, and utilities for the Astryx design system. For project setup, see [Quick Start](#quick-start) below.
|
|
4
4
|
|
|
5
|
-
> **Building with an AI agent?**
|
|
6
|
-
>
|
|
7
|
-
> ```bash
|
|
8
|
-
> npm install -D @astryxdesign/cli # or: pnpm add -D / yarn add -D / bun add -d
|
|
9
|
-
> npx astryx init # resolves to the CLI you just installed
|
|
10
|
-
> ```
|
|
11
|
-
>
|
|
12
|
-
> `init` writes the Astryx component index into your `AGENTS.md`/`CLAUDE.md` so your agent discovers components, templates, and design tokens instead of guessing. Need a single command without installing? Use the scoped package directly — `npx @astryxdesign/cli <cmd>` (or `pnpm dlx`/`bunx @astryxdesign/cli`). Bare `npx astryx` only works once `@astryxdesign/cli` is a dependency; before that npm resolves it to an unrelated package. See [XDS CLI](#xds-cli).
|
|
5
|
+
> **Building with an AI agent?** Run **`npx astryx init`** first. It installs the Astryx CLI's component index into your `AGENTS.md`/`CLAUDE.md` so your agent discovers components, templates, and design tokens instead of guessing. Without it, agents can't see the CLI — see [XDS CLI](#xds-cli).
|
|
13
6
|
|
|
14
7
|
## Component Docs
|
|
15
8
|
|
|
16
|
-
Look up any component's full API (props,
|
|
9
|
+
Look up any component's full API (props, types, best practices, and theming):
|
|
17
10
|
|
|
18
11
|
```bash
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
node node_modules/@astryxdesign/core/docs.mjs Button # full docs for a component
|
|
13
|
+
node node_modules/@astryxdesign/core/docs.mjs --list # list all components
|
|
14
|
+
node node_modules/@astryxdesign/core/docs.mjs --list --brief # brief summaries
|
|
22
15
|
```
|
|
23
16
|
|
|
24
|
-
> Use the scoped `@astryxdesign/cli` to run without installing; bare `npx astryx` only resolves once the CLI is a dependency.
|
|
25
|
-
|
|
26
17
|
## Page Layouts
|
|
27
18
|
|
|
28
19
|
Building a full page? Start with a template rather than composing from scratch.
|
|
@@ -34,9 +25,9 @@ global navigation.
|
|
|
34
25
|
Requires `@astryxdesign/cli` (`npm install -D @astryxdesign/cli`):
|
|
35
26
|
|
|
36
27
|
```bash
|
|
37
|
-
astryx template --list # browse all page and block templates
|
|
38
|
-
astryx template dashboard # emit full page source
|
|
39
|
-
astryx template settings --skeleton # layout skeleton with spatial annotations
|
|
28
|
+
npx astryx template --list # browse all page and block templates
|
|
29
|
+
npx astryx template dashboard # emit full page source
|
|
30
|
+
npx astryx template settings --skeleton # layout skeleton with spatial annotations
|
|
40
31
|
```
|
|
41
32
|
|
|
42
33
|
## Astryx CLI
|
|
@@ -44,21 +35,19 @@ astryx template settings --skeleton # layout skeleton with spatial annotations
|
|
|
44
35
|
The CLI (`@astryxdesign/cli`) provides additional tooling:
|
|
45
36
|
|
|
46
37
|
```bash
|
|
47
|
-
astryx --help # full listing of all commands
|
|
48
|
-
astryx component Button # full docs + related block templates
|
|
49
|
-
astryx docs # reference docs (principles, tokens, theming, styling)
|
|
50
|
-
astryx docs theme # theming guide (Theme, defineTheme, light/dark)
|
|
51
|
-
astryx docs tokens # spacing, color, radius, typography token reference
|
|
52
|
-
astryx init # initialize Astryx in your project
|
|
53
|
-
astryx theme build # build theme CSS for production
|
|
54
|
-
astryx swizzle Button # eject component source for customization
|
|
55
|
-
astryx upgrade --apply # run codemods to migrate between versions
|
|
56
|
-
astryx discover # discover external Astryx packages
|
|
57
|
-
astryx gap-report # report a missing capability
|
|
38
|
+
npx astryx --help # full listing of all commands
|
|
39
|
+
npx astryx component Button # full docs + related block templates
|
|
40
|
+
npx astryx docs # reference docs (principles, tokens, theming, styling)
|
|
41
|
+
npx astryx docs theme # theming guide (Theme, defineTheme, light/dark)
|
|
42
|
+
npx astryx docs tokens # spacing, color, radius, typography token reference
|
|
43
|
+
npx astryx init # initialize Astryx in your project
|
|
44
|
+
npx astryx theme build # build theme CSS for production
|
|
45
|
+
npx astryx swizzle Button # eject component source for customization
|
|
46
|
+
npx astryx upgrade --apply # run codemods to migrate between versions
|
|
47
|
+
npx astryx discover # discover external Astryx packages
|
|
48
|
+
npx astryx gap-report # report a missing capability
|
|
58
49
|
```
|
|
59
50
|
|
|
60
|
-
> Prefix these with your runner: `npx astryx …` / `pnpm exec astryx …` once the CLI is installed, or `npx @astryxdesign/cli …` to run without installing.
|
|
61
|
-
|
|
62
51
|
## Related Packages
|
|
63
52
|
|
|
64
53
|
| Package | Description |
|
package/dist/Avatar/Avatar.d.ts
CHANGED
|
@@ -13,13 +13,9 @@
|
|
|
13
13
|
import { type ReactNode } from 'react';
|
|
14
14
|
import type { BaseProps } from '../BaseProps';
|
|
15
15
|
/**
|
|
16
|
-
* Named size options
|
|
17
|
-
*
|
|
18
|
-
* Avatar uses the same abbreviated scale as Icon (`xsm`/`sm`/`md`/`lg`/`xl`),
|
|
19
|
-
* but the values are larger because avatars align with media rather than
|
|
20
|
-
* glyphs. The tiers match EPS's avatar sizes.
|
|
16
|
+
* Named size options
|
|
21
17
|
*/
|
|
22
|
-
type AvatarNamedSize = '
|
|
18
|
+
type AvatarNamedSize = 'tiny' | 'xsmall' | 'small' | 'medium' | 'large';
|
|
23
19
|
/**
|
|
24
20
|
* Numeric size options (in pixels)
|
|
25
21
|
*/
|
|
@@ -56,9 +52,8 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
56
52
|
*/
|
|
57
53
|
name?: string;
|
|
58
54
|
/**
|
|
59
|
-
* The size of the avatar.
|
|
60
|
-
*
|
|
61
|
-
* @default 'md'
|
|
55
|
+
* The size of the avatar.
|
|
56
|
+
* @default 'small'
|
|
62
57
|
*/
|
|
63
58
|
size?: AvatarSize;
|
|
64
59
|
/**
|
|
@@ -80,7 +75,7 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
80
75
|
* @example
|
|
81
76
|
* ```
|
|
82
77
|
* <Avatar src="/user.jpg" name="John Doe" />
|
|
83
|
-
* <Avatar name="Jane Smith" size="
|
|
78
|
+
* <Avatar name="Jane Smith" size="large" />
|
|
84
79
|
* <Avatar src="/user.jpg" status={<OnlineIndicator />} />
|
|
85
80
|
* ```
|
|
86
81
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsC5C
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAoB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAsC5C;;GAEG;AACH,KAAK,eAAe,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAExE;;GAEG;AACH,KAAK,iBAAiB,GACpB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE7D;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAgBpD;AAqFD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC5D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AAsCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,WAAW,EACX,IAAI,EACJ,IAAc,EACd,GAAG,EACH,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BAwFb;yBArGe,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -50,11 +50,7 @@ const CIRCLE_EDGE_OFFSET_RATIO = (1 - 1 / Math.SQRT2) / 2;
|
|
|
50
50
|
const INITIALS_FONT_SIZE_RATIO = 0.4;
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
* Named size options
|
|
54
|
-
*
|
|
55
|
-
* Avatar uses the same abbreviated scale as Icon (`xsm`/`sm`/`md`/`lg`/`xl`),
|
|
56
|
-
* but the values are larger because avatars align with media rather than
|
|
57
|
-
* glyphs. The tiers match EPS's avatar sizes.
|
|
53
|
+
* Named size options
|
|
58
54
|
*/
|
|
59
55
|
|
|
60
56
|
/**
|
|
@@ -73,15 +69,15 @@ export function resolveSize(size) {
|
|
|
73
69
|
return size;
|
|
74
70
|
}
|
|
75
71
|
switch (size) {
|
|
76
|
-
case '
|
|
72
|
+
case 'tiny':
|
|
77
73
|
return 20;
|
|
78
|
-
case '
|
|
74
|
+
case 'xsmall':
|
|
79
75
|
return 24;
|
|
80
|
-
case '
|
|
76
|
+
case 'small':
|
|
81
77
|
return 36;
|
|
82
|
-
case '
|
|
78
|
+
case 'medium':
|
|
83
79
|
return 48;
|
|
84
|
-
case '
|
|
80
|
+
case 'large':
|
|
85
81
|
return 128;
|
|
86
82
|
}
|
|
87
83
|
}
|
|
@@ -227,7 +223,7 @@ function DefaultIcon({
|
|
|
227
223
|
* @example
|
|
228
224
|
* ```
|
|
229
225
|
* <Avatar src="/user.jpg" name="John Doe" />
|
|
230
|
-
* <Avatar name="Jane Smith" size="
|
|
226
|
+
* <Avatar name="Jane Smith" size="large" />
|
|
231
227
|
* <Avatar src="/user.jpg" status={<OnlineIndicator />} />
|
|
232
228
|
* ```
|
|
233
229
|
*/
|
|
@@ -236,7 +232,7 @@ export function Avatar({
|
|
|
236
232
|
'data-testid': testId,
|
|
237
233
|
fallbackSrc,
|
|
238
234
|
name,
|
|
239
|
-
size = '
|
|
235
|
+
size = 'small',
|
|
240
236
|
src,
|
|
241
237
|
status,
|
|
242
238
|
xstyle,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Context that provides the resolved numeric avatar size (in pixels)
|
|
3
3
|
* to child components like AvatarStatusDot.
|
|
4
4
|
*
|
|
5
|
-
* Default value of 36 matches the default '
|
|
5
|
+
* Default value of 36 matches the default 'small' avatar size.
|
|
6
6
|
*/
|
|
7
7
|
export declare const AvatarSizeContext: import("react").Context<number>;
|
|
8
8
|
//# sourceMappingURL=AvatarSizeContext.d.ts.map
|
|
@@ -17,7 +17,7 @@ import { createContext } from 'react';
|
|
|
17
17
|
* Context that provides the resolved numeric avatar size (in pixels)
|
|
18
18
|
* to child components like AvatarStatusDot.
|
|
19
19
|
*
|
|
20
|
-
* Default value of 36 matches the default '
|
|
20
|
+
* Default value of 36 matches the default 'small' avatar size.
|
|
21
21
|
*/
|
|
22
22
|
export const AvatarSizeContext = /*#__PURE__*/createContext(36);
|
|
23
23
|
AvatarSizeContext.displayName = 'AvatarSizeContext';
|
|
@@ -76,12 +76,12 @@ export interface AvatarStatusDotProps extends BaseProps<HTMLDivElement> {
|
|
|
76
76
|
* ```
|
|
77
77
|
* <Avatar
|
|
78
78
|
* name="John Doe"
|
|
79
|
-
* size="
|
|
79
|
+
* size="medium"
|
|
80
80
|
* status={<AvatarStatusDot variant="success" label="Online" />}
|
|
81
81
|
* />
|
|
82
82
|
* <Avatar
|
|
83
83
|
* name="Jane Smith"
|
|
84
|
-
* size="
|
|
84
|
+
* size="large"
|
|
85
85
|
* status={<AvatarStatusDot variant="success" label="Verified" icon={<CheckIcon />} />}
|
|
86
86
|
* />
|
|
87
87
|
* ```
|
|
@@ -148,12 +148,12 @@ const variantStyleMap = {
|
|
|
148
148
|
* ```
|
|
149
149
|
* <Avatar
|
|
150
150
|
* name="John Doe"
|
|
151
|
-
* size="
|
|
151
|
+
* size="medium"
|
|
152
152
|
* status={<AvatarStatusDot variant="success" label="Online" />}
|
|
153
153
|
* />
|
|
154
154
|
* <Avatar
|
|
155
155
|
* name="Jane Smith"
|
|
156
|
-
* size="
|
|
156
|
+
* size="large"
|
|
157
157
|
* status={<AvatarStatusDot variant="success" label="Verified" icon={<CheckIcon />} />}
|
|
158
158
|
* />
|
|
159
159
|
* ```
|
|
@@ -27,7 +27,7 @@ export interface AvatarGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
27
27
|
children: ReactNode;
|
|
28
28
|
/**
|
|
29
29
|
* Size applied to all avatars via context.
|
|
30
|
-
* @default '
|
|
30
|
+
* @default 'small'
|
|
31
31
|
*/
|
|
32
32
|
size?: AvatarSize;
|
|
33
33
|
/**
|
|
@@ -45,7 +45,7 @@ export interface AvatarGroupProps extends BaseProps<HTMLDivElement> {
|
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```
|
|
48
|
-
* <AvatarGroup size="
|
|
48
|
+
* <AvatarGroup size="medium">
|
|
49
49
|
* {users.slice(0, 3).map(u => (
|
|
50
50
|
* <Avatar key={u.id} src={u.src} name={u.name} />
|
|
51
51
|
* ))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,KAAK,UAAU,EAAC,MAAM,WAAW,CAAC;AASvD,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;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,
|
|
1
|
+
{"version":3,"file":"AvatarGroup.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroup.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAc,KAAK,UAAU,EAAC,MAAM,WAAW,CAAC;AASvD,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;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,IAAc,EACd,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,kBAAkB,EAChC,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,SAAS,CA6B9B;yBAvCe,WAAW"}
|
|
@@ -44,7 +44,7 @@ const styles = {
|
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
46
|
* ```
|
|
47
|
-
* <AvatarGroup size="
|
|
47
|
+
* <AvatarGroup size="medium">
|
|
48
48
|
* {users.slice(0, 3).map(u => (
|
|
49
49
|
* <Avatar key={u.id} src={u.src} name={u.name} />
|
|
50
50
|
* ))}
|
|
@@ -54,7 +54,7 @@ const styles = {
|
|
|
54
54
|
*/
|
|
55
55
|
export function AvatarGroup({
|
|
56
56
|
children,
|
|
57
|
-
size = '
|
|
57
|
+
size = 'small',
|
|
58
58
|
'data-testid': testId,
|
|
59
59
|
'aria-label': ariaLabelFromProps,
|
|
60
60
|
xstyle,
|
|
@@ -33,7 +33,7 @@ export interface AvatarGroupOverflowProps extends Omit<BaseProps<HTMLElement>, '
|
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* ```
|
|
36
|
-
* <AvatarGroup size="
|
|
36
|
+
* <AvatarGroup size="medium">
|
|
37
37
|
* {users.slice(0, 3).map(u => (
|
|
38
38
|
* <Avatar key={u.id} src={u.src} name={u.name} />
|
|
39
39
|
* ))}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* @input Uses React, StyleX, useScrollOverflow, useLayer, Button, Icon, theme tokens
|
|
4
4
|
* @output Exports Carousel component
|
|
5
5
|
* @position Horizontal scroll container with fade-edge overflow indication,
|
|
6
|
-
* optional prev/next buttons on the top layer, scroll-snap, a 1px
|
|
7
|
-
* visual bleed allowance for child selection indicators
|
|
8
|
-
* mapping so mouse users can scroll horizontally.
|
|
6
|
+
* optional prev/next buttons on the top layer, scroll-snap, and a 1px
|
|
7
|
+
* visual bleed allowance for child selection indicators.
|
|
9
8
|
*
|
|
10
9
|
* SYNC: When modified, update:
|
|
11
10
|
* - /packages/core/src/Carousel/index.ts (exports)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../../src/Carousel/Carousel.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAC;AAc/E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAIhD,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,kEAAkE;IAClE,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAyJD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,QAAQ,EACR,GAAO,EACP,UAAiB,EACjB,WAAkB,EAClB,OAAe,EACf,OAAO,EACP,YAAY,EAAE,kBAAkB,EAChC,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,SAAS,EACb,EAAE,aAAa,+BAmJf;yBAjKe,QAAQ"}
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
* @input Uses React, StyleX, useScrollOverflow, useLayer, Button, Icon, theme tokens
|
|
8
8
|
* @output Exports Carousel component
|
|
9
9
|
* @position Horizontal scroll container with fade-edge overflow indication,
|
|
10
|
-
* optional prev/next buttons on the top layer, scroll-snap, a 1px
|
|
11
|
-
* visual bleed allowance for child selection indicators
|
|
12
|
-
* mapping so mouse users can scroll horizontally.
|
|
10
|
+
* optional prev/next buttons on the top layer, scroll-snap, and a 1px
|
|
11
|
+
* visual bleed allowance for child selection indicators.
|
|
13
12
|
*
|
|
14
13
|
* SYNC: When modified, update:
|
|
15
14
|
* - /packages/core/src/Carousel/index.ts (exports)
|
|
@@ -235,34 +234,6 @@ export function Carousel({
|
|
|
235
234
|
scrollElRef.current = el;
|
|
236
235
|
scrollRef(el);
|
|
237
236
|
}, [scrollRef]);
|
|
238
|
-
|
|
239
|
-
// Map Shift + vertical wheel to horizontal scroll. Trackpads emit
|
|
240
|
-
// horizontal deltas natively, but a standard mouse only produces deltaY —
|
|
241
|
-
// so mouse users can't wheel-scroll a horizontal container. Shift + wheel
|
|
242
|
-
// is the long-established convention for horizontal scroll containers; we
|
|
243
|
-
// honor it by translating the vertical delta into a horizontal scroll.
|
|
244
|
-
//
|
|
245
|
-
// Only kicks in when Shift is held and the wheel is purely vertical
|
|
246
|
-
// (deltaX === 0), so native trackpad horizontal scrolling is untouched.
|
|
247
|
-
const handleWheel = useCallback(event => {
|
|
248
|
-
if (!event.shiftKey || event.deltaY === 0 || event.deltaX !== 0) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
const el = scrollElRef.current;
|
|
252
|
-
if (!el) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
// Nothing to scroll horizontally — let the event fall through so the page
|
|
256
|
-
// can scroll as it normally would.
|
|
257
|
-
if (el.scrollWidth <= el.clientWidth) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
event.preventDefault();
|
|
261
|
-
el.scrollBy({
|
|
262
|
-
left: event.deltaY,
|
|
263
|
-
behavior: 'auto'
|
|
264
|
-
});
|
|
265
|
-
}, []);
|
|
266
237
|
const scrollBy = useCallback(direction => {
|
|
267
238
|
const el = scrollElRef.current;
|
|
268
239
|
if (!el) {
|
|
@@ -300,7 +271,6 @@ export function Carousel({
|
|
|
300
271
|
children: [/*#__PURE__*/_jsx("div", {
|
|
301
272
|
ref: composedRef,
|
|
302
273
|
tabIndex: 0,
|
|
303
|
-
onWheel: handleWheel,
|
|
304
274
|
...stylex.props(styles.scroller, gapStyles[gap], padding != null && paddingStyles[padding], hasSnap && styles.snap, fadeStyle),
|
|
305
275
|
children: Children.map(children, child => /*#__PURE__*/_jsx("div", {
|
|
306
276
|
...{
|
|
@@ -46,7 +46,7 @@ export interface ChatMessageProps extends BaseProps<HTMLElement> {
|
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
48
|
* ```
|
|
49
|
-
* <ChatMessage sender="assistant" name="Navi" avatar={<Avatar name="Navi" size="
|
|
49
|
+
* <ChatMessage sender="assistant" name="Navi" avatar={<Avatar name="Navi" size="small" />}>
|
|
50
50
|
* <ChatMessageBubble>Hello!</ChatMessageBubble>
|
|
51
51
|
* <ChatMessageMetadata timestamp="2:30 PM" />
|
|
52
52
|
* </ChatMessage>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAQrD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAoFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+
|
|
1
|
+
{"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAQrD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAoFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+BAyFlB;yBAtGe,WAAW"}
|
package/dist/Chat/ChatMessage.js
CHANGED
|
@@ -122,7 +122,7 @@ const styles = {
|
|
|
122
122
|
*
|
|
123
123
|
* @example
|
|
124
124
|
* ```
|
|
125
|
-
* <ChatMessage sender="assistant" name="Navi" avatar={<Avatar name="Navi" size="
|
|
125
|
+
* <ChatMessage sender="assistant" name="Navi" avatar={<Avatar name="Navi" size="small" />}>
|
|
126
126
|
* <ChatMessageBubble>Hello!</ChatMessageBubble>
|
|
127
127
|
* <ChatMessageMetadata timestamp="2:30 PM" />
|
|
128
128
|
* </ChatMessage>
|
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -140,31 +140,6 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
140
140
|
* @default 'md'
|
|
141
141
|
*/
|
|
142
142
|
size?: IconSize;
|
|
143
|
-
/**
|
|
144
|
-
* Accessible name for the icon. Set this only when the icon is MEANINGFUL on
|
|
145
|
-
* its own — a standalone status glyph or an icon-only indicator with no
|
|
146
|
-
* adjacent text conveying the same information. Providing it exposes the icon
|
|
147
|
-
* to assistive tech as `role="img"` with this string as the accessible name
|
|
148
|
-
* (via `aria-label`) and drops the default `aria-hidden="true"`.
|
|
149
|
-
*
|
|
150
|
-
* Omit it (the default) for decorative icons — the common case, e.g. an icon
|
|
151
|
-
* beside a text label — and the icon stays hidden from assistive tech
|
|
152
|
-
* (`aria-hidden="true"`). An empty string (`''`) is treated the same as
|
|
153
|
-
* omitting it (decorative), since an empty accessible name is meaningless.
|
|
154
|
-
*
|
|
155
|
-
* Don't set `label` when an interactive parent (Button, IconButton, link)
|
|
156
|
-
* already names the control — that produces a duplicate announcement.
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```
|
|
160
|
-
* // Meaningful, standalone icon
|
|
161
|
-
* <Icon icon="success" label="Completed" />
|
|
162
|
-
*
|
|
163
|
-
* // Decorative icon (default) — omit label
|
|
164
|
-
* <Icon icon="search" />
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
label?: string;
|
|
168
143
|
}
|
|
169
144
|
/**
|
|
170
145
|
* Renders an icon from the icon registry or a custom SVG component.
|
|
@@ -174,7 +149,7 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'
|
|
|
174
149
|
* <Icon icon="close" size="md" color="primary" />
|
|
175
150
|
* ```
|
|
176
151
|
*/
|
|
177
|
-
export declare function Icon({ icon, color, size,
|
|
152
|
+
export declare function Icon({ icon, color, size, ref, ...props }: IconProps): React.JSX.Element;
|
|
178
153
|
export declare namespace Icon {
|
|
179
154
|
var displayName: string;
|
|
180
155
|
}
|
package/dist/Icon/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAqBnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2Df,CAAC;AAEH;;;;;;;;GAQG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;EAiBd,CAAC;AAyCH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,WAAW,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,QAAQ,CAAC,aAAa,CAAC,EACvB,KAAK,GAAG,OAAO,CAChB;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,EAAC,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC/D,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAqBnD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2Df,CAAC;AAEH;;;;;;;;GAQG;AACH,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;EAiBd,CAAC;AAyCH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,WAAW,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAC;AAE/C;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,IAAI,CACrC,QAAQ,CAAC,aAAa,CAAC,EACvB,KAAK,GAAG,OAAO,CAChB;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;OAIG;IACH,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAMD;;;;;;;GAOG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,KAAiB,EACjB,IAAW,EACX,GAAG,EACH,GAAG,KAAK,EACT,EAAE,SAAS,qBA0BX;yBAhCe,IAAI;;;AAiFpB;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,QAAQ,EAChC,KAAK,CAAC,EAAE;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAAC,GAC3C,KAAK,CAAC,SAAS,CAYjB"}
|
package/dist/Icon/Icon.js
CHANGED
|
@@ -205,26 +205,6 @@ const spanSizeStyles = {
|
|
|
205
205
|
* Extends SVGProps to allow passing additional SVG attributes (used when icon is a component).
|
|
206
206
|
*/
|
|
207
207
|
|
|
208
|
-
/**
|
|
209
|
-
* Derives the ARIA attributes for an icon from its `label` prop.
|
|
210
|
-
*
|
|
211
|
-
* - Non-empty `label` → meaningful image: `role="img"` + `aria-label`, and no
|
|
212
|
-
* `aria-hidden` (an `aria-hidden` element is removed from the accessibility
|
|
213
|
-
* tree, so its accessible name would be ignored).
|
|
214
|
-
* - Omitted or empty `label` → decorative default: `aria-hidden="true"`.
|
|
215
|
-
*
|
|
216
|
-
* The result is spread BEFORE `{...props}` in both render modes so an explicit
|
|
217
|
-
* `aria-hidden` / `role` / `aria-label` from the consumer always wins.
|
|
218
|
-
*/
|
|
219
|
-
function getIconA11yProps(label) {
|
|
220
|
-
return label != null && label !== '' ? {
|
|
221
|
-
role: 'img',
|
|
222
|
-
'aria-label': label
|
|
223
|
-
} : {
|
|
224
|
-
'aria-hidden': 'true'
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
208
|
// =============================================================================
|
|
229
209
|
// Component
|
|
230
210
|
// =============================================================================
|
|
@@ -241,21 +221,15 @@ export function Icon({
|
|
|
241
221
|
icon,
|
|
242
222
|
color = 'inherit',
|
|
243
223
|
size = 'md',
|
|
244
|
-
label,
|
|
245
224
|
ref,
|
|
246
225
|
...props
|
|
247
226
|
}) {
|
|
248
|
-
// Derive ARIA from `label`: decorative (aria-hidden) by default, or a
|
|
249
|
-
// meaningful image (role="img" + aria-label) when `label` is non-empty.
|
|
250
|
-
const a11yProps = getIconA11yProps(label);
|
|
251
|
-
|
|
252
227
|
// String mode: resolve from icon registry, wrap in styled span
|
|
253
228
|
if (typeof icon === 'string') {
|
|
254
229
|
return /*#__PURE__*/_jsx(IconFromRegistry, {
|
|
255
230
|
name: icon,
|
|
256
231
|
color: color,
|
|
257
232
|
size: size,
|
|
258
|
-
a11yProps: a11yProps,
|
|
259
233
|
spanProps: props
|
|
260
234
|
});
|
|
261
235
|
}
|
|
@@ -263,12 +237,8 @@ export function Icon({
|
|
|
263
237
|
// Component mode: render SVG component directly with ref forwarding
|
|
264
238
|
const IconComponent = icon;
|
|
265
239
|
return /*#__PURE__*/_jsx(IconComponent, {
|
|
266
|
-
ref: ref
|
|
267
|
-
|
|
268
|
-
// BEFORE {...props} so an explicit aria-hidden/role/aria-label from the
|
|
269
|
-
// consumer still wins as an escape hatch.
|
|
270
|
-
,
|
|
271
|
-
...a11yProps,
|
|
240
|
+
ref: ref,
|
|
241
|
+
"aria-hidden": "true",
|
|
272
242
|
...mergeProps(themeProps('icon', {
|
|
273
243
|
size,
|
|
274
244
|
color
|
|
@@ -293,7 +263,6 @@ function IconFromRegistry({
|
|
|
293
263
|
name,
|
|
294
264
|
color,
|
|
295
265
|
size,
|
|
296
|
-
a11yProps,
|
|
297
266
|
spanProps
|
|
298
267
|
}) {
|
|
299
268
|
const resolvedIcon = getIcon(name);
|
|
@@ -301,7 +270,11 @@ function IconFromRegistry({
|
|
|
301
270
|
return null;
|
|
302
271
|
}
|
|
303
272
|
return /*#__PURE__*/_jsx("span", {
|
|
304
|
-
|
|
273
|
+
// Decorative by default, but placed BEFORE the prop spread so consumers
|
|
274
|
+
// can override it (e.g. `aria-hidden={false}` + `role="img"` +
|
|
275
|
+
// `aria-label`) to expose a meaningful standalone icon. This matches
|
|
276
|
+
// component-mode Icon, which already sets aria-hidden before its spread.
|
|
277
|
+
"aria-hidden": "true",
|
|
305
278
|
...spanProps,
|
|
306
279
|
...mergeProps(themeProps('icon', {
|
|
307
280
|
size,
|
|
@@ -19,50 +19,6 @@ export interface OutlineProps extends BaseProps<HTMLElement> {
|
|
|
19
19
|
* @default 'default'
|
|
20
20
|
*/
|
|
21
21
|
density?: 'default' | 'compact';
|
|
22
|
-
/**
|
|
23
|
-
* Called when navigation to an item begins, before the scroll starts.
|
|
24
|
-
* Receives the item `id`. Pair with `onNavigateEnd` to drive an arrival
|
|
25
|
-
* effect (flash, ring, pulse) on the target heading.
|
|
26
|
-
*/
|
|
27
|
-
onNavigateStart?: (id: string) => void;
|
|
28
|
-
/**
|
|
29
|
-
* Called once when navigation to an item resolves — when the smooth scroll
|
|
30
|
-
* settles, or immediately-ish when reduced motion turns it into a jump.
|
|
31
|
-
*
|
|
32
|
-
* Fires exactly once for every `onNavigateStart`, including when the user
|
|
33
|
-
* interrupts the scroll by scrolling manually, so a "navigating" state can
|
|
34
|
-
* never leak. It does not fire if the Outline unmounts mid-scroll.
|
|
35
|
-
*/
|
|
36
|
-
onNavigateEnd?: (id: string) => void;
|
|
37
|
-
/**
|
|
38
|
-
* Height in px of a fixed header overlaying the top of the scroll root.
|
|
39
|
-
*
|
|
40
|
-
* Shifts both the activation line *and* the scroll landing by the same
|
|
41
|
-
* amount, so a heading activates exactly where navigating to it puts it —
|
|
42
|
-
* below the header rather than hidden underneath it.
|
|
43
|
-
*
|
|
44
|
-
* It composes with each heading's own `scroll-margin-top` (the header, then
|
|
45
|
-
* the breathing room below it) rather than replacing it. When nothing
|
|
46
|
-
* overlays the content, leave this at 0 and let `scroll-margin-top` do the
|
|
47
|
-
* work — the browser already honors it.
|
|
48
|
-
*
|
|
49
|
-
* @default 0
|
|
50
|
-
*/
|
|
51
|
-
offset?: number;
|
|
52
|
-
/**
|
|
53
|
-
* Scroll container to track, instead of auto-detecting the nearest scrollable
|
|
54
|
-
* ancestor. Use this when the content scrolls inside a split pane, modal, or
|
|
55
|
-
* dashboard panel rather than the viewport.
|
|
56
|
-
*/
|
|
57
|
-
scrollContainerRef?: React.RefObject<HTMLElement | null>;
|
|
58
|
-
/**
|
|
59
|
-
* Whether activating an item smooth-scrolls to it. Set to false to own the
|
|
60
|
-
* scrolling yourself (virtualized content, a router) — the Outline still
|
|
61
|
-
* updates the active item, the hash, and the navigate callbacks, but performs
|
|
62
|
-
* no scroll and suppresses the anchor's default jump.
|
|
63
|
-
* @default true
|
|
64
|
-
*/
|
|
65
|
-
hasScrollOnClick?: boolean;
|
|
66
22
|
/** Test ID for testing frameworks. */
|
|
67
23
|
'data-testid'?: string;
|
|
68
24
|
}
|
|
@@ -74,15 +30,8 @@ export interface OutlineProps extends BaseProps<HTMLElement> {
|
|
|
74
30
|
* track that animates to the active item.
|
|
75
31
|
*
|
|
76
32
|
* When `activeId` is omitted, it tracks scroll position and marks the last
|
|
77
|
-
* heading whose top has passed its activation line
|
|
78
|
-
*
|
|
79
|
-
* scroll root) plus the heading's own `scroll-margin-top`. It defaults to the
|
|
80
|
-
* first item at the top and the last at the bottom.
|
|
81
|
-
*
|
|
82
|
-
* Keyboard: the list is a single tab stop (roving tabindex), seated on the
|
|
83
|
-
* active heading. Arrow keys move between headings, Home/End jump to the ends,
|
|
84
|
-
* and Enter/Space activate — so a long table of contents costs one Tab press,
|
|
85
|
-
* not one per heading.
|
|
33
|
+
* heading whose top has passed its activation line (its scroll-margin-top)
|
|
34
|
+
* active — defaulting to the first item at the top and the last at the bottom.
|
|
86
35
|
*
|
|
87
36
|
* @example
|
|
88
37
|
* ```
|
|
@@ -94,23 +43,8 @@ export interface OutlineProps extends BaseProps<HTMLElement> {
|
|
|
94
43
|
* ]}
|
|
95
44
|
* />
|
|
96
45
|
* ```
|
|
97
|
-
*
|
|
98
|
-
* Scoped to a custom scroll container, under a fixed header:
|
|
99
|
-
*
|
|
100
|
-
* @example
|
|
101
|
-
* ```
|
|
102
|
-
* const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
103
|
-
*
|
|
104
|
-
* <div ref={scrollContainerRef} style={{overflowY: 'auto'}}>...</div>
|
|
105
|
-
* <Outline
|
|
106
|
-
* items={items}
|
|
107
|
-
* scrollContainerRef={scrollContainerRef}
|
|
108
|
-
* offset={64}
|
|
109
|
-
* onNavigateEnd={id => flashHeading(id)}
|
|
110
|
-
* />
|
|
111
|
-
* ```
|
|
112
46
|
*/
|
|
113
|
-
export declare function Outline({ items, activeId, onActiveIdChange, label: labelFromProps, density,
|
|
47
|
+
export declare function Outline({ items, activeId, onActiveIdChange, label: labelFromProps, density, xstyle, className, style, ref, 'data-testid': testId, ...props }: OutlineProps): import("react").JSX.Element;
|
|
114
48
|
export declare namespace Outline {
|
|
115
49
|
var displayName: string;
|
|
116
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/Outline/Outline.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Outline.d.ts","sourceRoot":"","sources":["../../src/Outline/Outline.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAIzC,YAAY,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC1D,6CAA6C;IAC7C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE7B,+CAA+C;IAC/C,KAAK,EAAE,WAAW,EAAE,CAAC;IAErB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAExC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAEhC,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAgJD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,gBAAgB,EAChB,KAAK,EAAE,cAAc,EACrB,OAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,GAAG,KAAK,EACT,EAAE,YAAY,+BA2Gd;yBAvHe,OAAO"}
|