@astryxdesign/core 0.1.2-canary.b753238 → 0.1.2-canary.bfcbf64
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/Breadcrumbs/BreadcrumbItem.d.ts +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -1
- package/dist/Breadcrumbs/BreadcrumbItem.js +1 -4
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +4 -2
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +14 -33
- package/dist/Calendar/hooks/index.d.ts +2 -0
- package/dist/Calendar/hooks/index.d.ts.map +1 -1
- package/dist/Calendar/hooks/index.js +2 -1
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts +57 -0
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts.map +1 -0
- package/dist/Calendar/hooks/useCalendarRovingTabindex.js +96 -0
- package/dist/Calendar/index.d.ts +2 -2
- package/dist/Calendar/index.d.ts.map +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/CheckboxList/CheckboxList.js +3 -3
- package/dist/ContextMenu/ContextMenu.d.ts +7 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +13 -7
- package/dist/DropdownMenu/DropdownMenu.d.ts +8 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +9 -4
- package/dist/Field/Field.d.ts +4 -4
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +2 -2
- package/dist/Field/FieldLabel.d.ts +4 -4
- package/dist/Field/FieldLabel.d.ts.map +1 -1
- package/dist/Field/FieldLabel.js +2 -2
- package/dist/InputGroup/InputGroup.js +3 -3
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +4 -2
- package/dist/MoreMenu/MoreMenu.d.ts +7 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +2 -0
- package/dist/MultiSelector/MultiSelector.d.ts +2 -25
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -31
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +4 -2
- package/dist/RadioList/RadioList.js +3 -3
- package/dist/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +61 -51
- package/dist/Selector/Selector.d.ts +1 -22
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +6 -31
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +4 -2
- package/dist/TabList/TabList.d.ts +2 -3
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +33 -55
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +3 -0
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +4 -2
- package/dist/Toolbar/Toolbar.d.ts +3 -3
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +6 -46
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +22 -16
- package/dist/TreeList/TreeListItem.d.ts +2 -3
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/astryx.css +0 -3
- package/dist/astryx.umd.js +47 -47
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +2 -4
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useGridFocus.d.ts +0 -56
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +24 -138
- package/dist/hooks/useTreeFocus.d.ts +3 -27
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +6 -69
- package/package.json +1 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +2 -5
- package/src/Button/Button.tsx +16 -3
- package/src/Calendar/Calendar.tsx +22 -52
- package/src/Calendar/hooks/index.ts +6 -0
- package/src/Calendar/hooks/useCalendarRovingTabindex.ts +118 -0
- package/src/Calendar/index.ts +3 -0
- package/src/CheckboxList/CheckboxList.tsx +3 -3
- package/src/ContextMenu/ContextMenu.doc.mjs +6 -0
- package/src/ContextMenu/ContextMenu.test.tsx +6 -4
- package/src/ContextMenu/ContextMenu.tsx +19 -7
- package/src/DropdownMenu/DropdownMenu.doc.mjs +8 -1
- package/src/DropdownMenu/DropdownMenu.test.tsx +23 -0
- package/src/DropdownMenu/DropdownMenu.tsx +16 -4
- package/src/Field/Field.test.tsx +2 -2
- package/src/Field/Field.tsx +5 -5
- package/src/Field/FieldLabel.tsx +5 -5
- package/src/InputGroup/InputGroup.tsx +3 -3
- package/src/Link/Link.tsx +13 -2
- package/src/MoreMenu/MoreMenu.doc.mjs +17 -2
- package/src/MoreMenu/MoreMenu.tsx +9 -0
- package/src/MultiSelector/MultiSelector.doc.mjs +0 -25
- package/src/MultiSelector/MultiSelector.test.tsx +1 -150
- package/src/MultiSelector/MultiSelector.tsx +3 -55
- package/src/ProgressBar/ProgressBar.tsx +3 -2
- package/src/RadioList/RadioList.tsx +3 -3
- package/src/SegmentedControl/SegmentedControl.tsx +77 -51
- package/src/Selector/Selector.doc.mjs +0 -21
- package/src/Selector/Selector.test.tsx +1 -123
- package/src/Selector/Selector.tsx +3 -53
- package/src/Switch/Switch.tsx +16 -2
- package/src/TabList/TabList.test.tsx +0 -41
- package/src/TabList/TabList.tsx +39 -66
- package/src/Table/tableContextMenu.tsx +5 -1
- package/src/TextArea/TextArea.tsx +13 -3
- package/src/Toolbar/Toolbar.test.tsx +6 -64
- package/src/Toolbar/Toolbar.tsx +4 -55
- package/src/TreeList/TreeList.tsx +28 -17
- package/src/TreeList/TreeListItem.tsx +2 -3
- package/src/VisuallyHidden/VisuallyHidden.doc.mjs +7 -7
- package/src/hooks/index.ts +5 -12
- package/src/hooks/useGridFocus.doc.mjs +2 -40
- package/src/hooks/useGridFocus.ts +23 -179
- package/src/hooks/useTreeFocus.doc.mjs +1 -15
- package/src/hooks/useTreeFocus.ts +6 -101
- package/dist/hooks/useKeyboardHint.d.ts +0 -82
- package/dist/hooks/useKeyboardHint.d.ts.map +0 -1
- package/dist/hooks/useKeyboardHint.js +0 -220
- package/src/hooks/useGridFocus.test.tsx +0 -132
- package/src/hooks/useKeyboardHint.doc.mjs +0 -101
- package/src/hooks/useKeyboardHint.test.tsx +0 -70
- package/src/hooks/useKeyboardHint.tsx +0 -332
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Selector.tsx
|
|
7
|
-
* @input Uses React, StyleX, usePopover,
|
|
7
|
+
* @input Uses React, StyleX, usePopover, Icon
|
|
8
8
|
* @output Exports Selector component
|
|
9
9
|
* @position Core implementation; consumed by index.ts
|
|
10
10
|
*
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
import React, { useCallback, useEffect, useId, useMemo, useOptimistic, useRef, useState, useTransition } from 'react';
|
|
17
17
|
import * as stylex from '@stylexjs/stylex';
|
|
18
18
|
import { usePopover } from "../Popover/usePopover.js";
|
|
19
|
-
import { useTooltip } from "../Tooltip/index.js";
|
|
20
19
|
import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
21
20
|
import { Field, inputStatusBorderStyles, inputStatusHoverShadowStyles, inputWrapperStyles } from "../Field/index.js";
|
|
22
21
|
import { Divider } from "../Divider/index.js";
|
|
@@ -181,7 +180,6 @@ export function Selector(props) {
|
|
|
181
180
|
isOptional = false,
|
|
182
181
|
isRequired = false,
|
|
183
182
|
isDisabled = false,
|
|
184
|
-
disabledMessage,
|
|
185
183
|
options,
|
|
186
184
|
value,
|
|
187
185
|
onChange,
|
|
@@ -222,22 +220,8 @@ export function Selector(props) {
|
|
|
222
220
|
const [optimisticValue, setOptimisticValue] = useOptimistic(normalizedValue);
|
|
223
221
|
const isBusy = isLoading || optimisticValue !== normalizedValue;
|
|
224
222
|
|
|
225
|
-
// Disabled-reason tooltip. Disabled controls swallow pointer events, so the
|
|
226
|
-
// tooltip listeners attach to the trigger container (which already exists)
|
|
227
|
-
// and the trigger button stays perceivable via aria-disabled instead of the
|
|
228
|
-
// disabled attribute. Activation is blocked by the isDisabled guards in
|
|
229
|
-
// useCombobox (onTriggerClick / onKeyDown).
|
|
230
|
-
const showsDisabledMessage = isDisabled && !!disabledMessage;
|
|
231
|
-
const disabledMessageTooltip = useTooltip({
|
|
232
|
-
placement: 'above',
|
|
233
|
-
// The container div is not naturally focusable; focusin bubbles up from
|
|
234
|
-
// the trigger button, so always attach focus listeners.
|
|
235
|
-
focusTrigger: 'always',
|
|
236
|
-
isEnabled: showsDisabledMessage
|
|
237
|
-
});
|
|
238
|
-
|
|
239
223
|
// Build aria-describedby
|
|
240
|
-
const ariaDescribedBy = [description ? descriptionId : null, status?.message ? statusMessageId : null
|
|
224
|
+
const ariaDescribedBy = [description ? descriptionId : null, status?.message ? statusMessageId : null].filter(Boolean).join(' ') || undefined;
|
|
241
225
|
|
|
242
226
|
// Flatten options for keyboard navigation
|
|
243
227
|
const selectableItems = useMemo(() => getSelectableOptions(options), [options]);
|
|
@@ -507,10 +491,6 @@ export function Selector(props) {
|
|
|
507
491
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
508
492
|
ref: el => {
|
|
509
493
|
popover.triggerRef(el);
|
|
510
|
-
// Anchor + hover/focus listeners for the disabled-message tooltip.
|
|
511
|
-
// Handlers are gated internally by isEnabled, and anchor names
|
|
512
|
-
// compose, so attaching unconditionally is safe.
|
|
513
|
-
disabledMessageTooltip.ref(el);
|
|
514
494
|
},
|
|
515
495
|
onClick: onTriggerClick,
|
|
516
496
|
"data-testid": testId,
|
|
@@ -538,15 +518,10 @@ export function Selector(props) {
|
|
|
538
518
|
"aria-describedby": ariaDescribedBy,
|
|
539
519
|
"aria-required": isRequired ? 'true' : undefined,
|
|
540
520
|
"aria-invalid": status?.type === 'error' ? 'true' : undefined,
|
|
541
|
-
"aria-busy": isBusy || undefined
|
|
542
|
-
|
|
543
|
-
// aria-disabled so the reason is focus-discoverable; activation is
|
|
544
|
-
// still blocked by the isDisabled guards in useCombobox.
|
|
545
|
-
,
|
|
546
|
-
disabled: isDisabled && !showsDisabledMessage,
|
|
547
|
-
"aria-disabled": showsDisabledMessage ? 'true' : undefined,
|
|
521
|
+
"aria-busy": isBusy || undefined,
|
|
522
|
+
disabled: isDisabled,
|
|
548
523
|
onKeyDown: onKeyDown,
|
|
549
|
-
tabIndex: isDisabled
|
|
524
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
550
525
|
...{
|
|
551
526
|
className: "x78zum5 x6s0dn4 x1qughib x1txdalj x1iyjqo2 xs83m0k x1r8uery xeuugli x1717udv x1ghz6dp xc342km xng3xce xjbqb8w xjb2p0i x1qlqyl8 x15bjb6t x1heor9g x1ypdohk x1a2a7pz"
|
|
552
527
|
},
|
|
@@ -625,7 +600,7 @@ export function Selector(props) {
|
|
|
625
600
|
alignment: 'start',
|
|
626
601
|
xstyle: [styles.popover, layerAnimations[popoverPlacement]],
|
|
627
602
|
style: popoverOffsetStyle
|
|
628
|
-
})
|
|
603
|
+
})]
|
|
629
604
|
});
|
|
630
605
|
}
|
|
631
606
|
Selector.displayName = 'Selector';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAaf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,S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mergeProps } from "../utils/index.js";
|
|
|
26
26
|
import "./switch.markers.stylex.js";
|
|
27
27
|
import { switchScope } from "./switch.markers.stylex.js";
|
|
28
28
|
import { themeProps } from "../utils/themeProps.js";
|
|
29
|
-
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
30
29
|
|
|
31
30
|
// Fixed dimensions: 40px width, 24px height, 16px thumb (off), 20px thumb (on)
|
|
32
31
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -236,7 +235,10 @@ export function Switch({
|
|
|
236
235
|
size: "sm"
|
|
237
236
|
})
|
|
238
237
|
})
|
|
239
|
-
}), isBusy && /*#__PURE__*/_jsx(
|
|
238
|
+
}), isBusy && /*#__PURE__*/_jsx("span", {
|
|
239
|
+
...{
|
|
240
|
+
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
241
|
+
},
|
|
240
242
|
role: "status",
|
|
241
243
|
children: "Loading"
|
|
242
244
|
})]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file TabList.tsx
|
|
3
|
-
* @input Uses React, StyleX, TabListContext, useListFocus
|
|
3
|
+
* @input Uses React, StyleX, TabListContext, useListFocus
|
|
4
4
|
* @output Exports TabList component and TabListProps type
|
|
5
5
|
* @position Nav wrapper; provides TabListContext to Tab and TabMenu children.
|
|
6
6
|
* Owns roving-tabindex keyboard navigation (Arrow/Home/End) across the tab
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
import React, { type ReactNode } from 'react';
|
|
16
16
|
import type { BaseProps } from '../BaseProps';
|
|
17
17
|
import type { TabListOrientation, TabListSize } from './TabListContext';
|
|
18
|
-
import { EDGE_COMP_ATTR } from '../Layout/edgeCompensation.stylex';
|
|
19
18
|
export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
20
19
|
ref?: React.Ref<HTMLElement>;
|
|
21
20
|
/**
|
|
@@ -74,7 +73,7 @@ export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
|
74
73
|
* </TabList>
|
|
75
74
|
* ```
|
|
76
75
|
*/
|
|
77
|
-
export declare function TabList({ ref, value, onChange, size: sizeProp, layout, hasDivider, orientation, xstyle, className, style, children,
|
|
76
|
+
export declare function TabList({ ref, value, onChange, size: sizeProp, layout, hasDivider, orientation, xstyle, className, style, children, ...restProps }: TabListProps): React.JSX.Element;
|
|
78
77
|
export declare namespace TabList {
|
|
79
78
|
var displayName: string;
|
|
80
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../src/TabList/TabList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"TabList.d.ts","sourceRoot":"","sources":["../../src/TabList/TabList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAsBtE,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,UAAU,CAAC;IAC5E,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;OAIG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAoBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EACtB,GAAG,EACH,KAAK,EACL,QAAQ,EACR,IAAI,EAAE,QAAQ,EACd,MAAc,EACd,UAAkB,EAClB,WAA0B,EAC1B,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,SAAS,EACb,EAAE,YAAY,qBAoEd;yBAjFe,OAAO"}
|
package/dist/TabList/TabList.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file TabList.tsx
|
|
7
|
-
* @input Uses React, StyleX, TabListContext, useListFocus
|
|
7
|
+
* @input Uses React, StyleX, TabListContext, useListFocus
|
|
8
8
|
* @output Exports TabList component and TabListProps type
|
|
9
9
|
* @position Nav wrapper; provides TabListContext to Tab and TabMenu children.
|
|
10
10
|
* Owns roving-tabindex keyboard navigation (Arrow/Home/End) across the tab
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* - /packages/core/src/TabList/TabList.test.tsx
|
|
17
17
|
* - /packages/cli/templates/blocks/components/TabList/ (showcase blocks)
|
|
18
18
|
*/
|
|
19
|
-
import React, {
|
|
19
|
+
import React, { useMemo } from 'react';
|
|
20
20
|
import * as stylex from '@stylexjs/stylex';
|
|
21
21
|
import "../theme/tokens.stylex.js";
|
|
22
22
|
import { borderVars, colorVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
@@ -24,7 +24,7 @@ import { TabListContext } from "./TabListContext.js";
|
|
|
24
24
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
25
25
|
import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
26
26
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
27
|
-
import {
|
|
27
|
+
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
28
28
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
29
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
30
|
|
|
@@ -33,8 +33,11 @@ import { themeProps } from "../utils/themeProps.js";
|
|
|
33
33
|
* (`[data-tab-value]`) and every TabMenu trigger (`[data-tab-menu]`),
|
|
34
34
|
* in DOM order. Disabled stops are filtered out by the handler.
|
|
35
35
|
*/
|
|
36
|
-
import {
|
|
36
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
37
37
|
const TAB_STOP_SELECTOR = '[data-tab-value],[data-tab-menu]';
|
|
38
|
+
function isDisabledStop(el) {
|
|
39
|
+
return el.getAttribute('aria-disabled') === 'true' || el instanceof HTMLButtonElement && el.disabled;
|
|
40
|
+
}
|
|
38
41
|
const styles = {
|
|
39
42
|
nav: {
|
|
40
43
|
k1xSpc: "x78zum5",
|
|
@@ -84,12 +87,6 @@ export function TabList({
|
|
|
84
87
|
className,
|
|
85
88
|
style,
|
|
86
89
|
children,
|
|
87
|
-
onKeyDown: onKeyDownProp,
|
|
88
|
-
onFocus: onFocusProp,
|
|
89
|
-
onBlur: onBlurProp,
|
|
90
|
-
'aria-label': ariaLabel = 'Tabs',
|
|
91
|
-
'aria-orientation': _ariaOrientation,
|
|
92
|
-
[EDGE_COMP_ATTR]: _edgeCompAttr,
|
|
93
90
|
...restProps
|
|
94
91
|
}) {
|
|
95
92
|
const size = useSize(sizeProp, 'md');
|
|
@@ -99,30 +96,12 @@ export function TabList({
|
|
|
99
96
|
// allowance for tab strips (ArrowRight/ArrowDown advance, ArrowLeft/ArrowUp
|
|
100
97
|
// retreat) regardless of the component's `orientation` prop, which only
|
|
101
98
|
// drives the reported `aria-orientation`.
|
|
102
|
-
//
|
|
103
|
-
// `hasRovingTabIndex` makes the hook own the single tab stop: it stamps
|
|
104
|
-
// tabindex 0/-1, repairs the stop on mount and as stops mount/unmount or
|
|
105
|
-
// toggle disabled, and — via `handleFocus` on the nav — keeps the stop in
|
|
106
|
-
// sync after clicks or programmatic focus. Individual Tabs still render
|
|
107
|
-
// `tabIndex={isSelected ? 0 : -1}` (see Tab.tsx) as the initial source of
|
|
108
|
-
// truth; the hook's repair preserves an existing tab stop and only promotes
|
|
109
|
-
// the first enabled stop when none is tabbable.
|
|
110
99
|
const {
|
|
111
100
|
listRef,
|
|
112
|
-
handleKeyDown
|
|
113
|
-
handleFocus
|
|
101
|
+
handleKeyDown
|
|
114
102
|
} = useListFocus({
|
|
115
103
|
itemSelector: TAB_STOP_SELECTOR,
|
|
116
|
-
orientation: 'both'
|
|
117
|
-
hasRovingTabIndex: true
|
|
118
|
-
});
|
|
119
|
-
const {
|
|
120
|
-
hintElement,
|
|
121
|
-
onKeyDown: onHintKeyDown,
|
|
122
|
-
onFocus: onHintFocus,
|
|
123
|
-
onBlur: onHintBlur
|
|
124
|
-
} = useKeyboardHint({
|
|
125
|
-
orientation
|
|
104
|
+
orientation: 'both'
|
|
126
105
|
});
|
|
127
106
|
const contextValue = useMemo(() => ({
|
|
128
107
|
value,
|
|
@@ -130,44 +109,43 @@ export function TabList({
|
|
|
130
109
|
size,
|
|
131
110
|
layout
|
|
132
111
|
}), [value, onChange, size, layout]);
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
112
|
+
|
|
113
|
+
// Roving tabindex: the tab strip is a single Tab stop. Individual Tabs set
|
|
114
|
+
// tabIndex={0} on the selected tab and -1 on the rest (see Tab.tsx). If the
|
|
115
|
+
// selected value doesn't correspond to any focusable stop (e.g. selection
|
|
116
|
+
// lives in a collapsed TabMenu that renders no matching stop, or there is no
|
|
117
|
+
// selection at all), no stop would be tabbable — this effect repairs that by
|
|
118
|
+
// making the first stop tabbable. useListFocus handles arrow navigation but
|
|
119
|
+
// not the initial tabbable stop, so this stays. Same pattern as the
|
|
120
|
+
// SegmentedControl fix.
|
|
121
|
+
useIsomorphicLayoutEffect(() => {
|
|
122
|
+
const nav = listRef.current;
|
|
123
|
+
if (nav == null) {
|
|
136
124
|
return;
|
|
137
125
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}, [onKeyDownProp, onHintKeyDown, handleKeyDown]);
|
|
141
|
-
const handleRootFocus = useCallback(e => {
|
|
142
|
-
onFocusProp?.(e);
|
|
143
|
-
if (e.defaultPrevented) {
|
|
126
|
+
const stops = Array.from(nav.querySelectorAll(TAB_STOP_SELECTOR));
|
|
127
|
+
if (stops.length === 0) {
|
|
144
128
|
return;
|
|
145
129
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
onBlurProp?.(e);
|
|
151
|
-
if (e.defaultPrevented) {
|
|
152
|
-
return;
|
|
130
|
+
const hasTabbable = stops.some(el => el.tabIndex === 0);
|
|
131
|
+
if (!hasTabbable) {
|
|
132
|
+
const firstEnabled = stops.find(el => !isDisabledStop(el)) ?? stops[0];
|
|
133
|
+
firstEnabled.tabIndex = 0;
|
|
153
134
|
}
|
|
154
|
-
|
|
155
|
-
}, [onBlurProp, onHintBlur]);
|
|
135
|
+
});
|
|
156
136
|
return /*#__PURE__*/_jsx(TabListContext, {
|
|
157
137
|
value: contextValue,
|
|
158
|
-
children: /*#__PURE__*/
|
|
138
|
+
children: /*#__PURE__*/_jsx("nav", {
|
|
159
139
|
ref: mergeRefs(ref, listRef),
|
|
160
|
-
|
|
161
|
-
"aria-label": ariaLabel,
|
|
140
|
+
"aria-label": "Tabs",
|
|
162
141
|
"aria-orientation": orientation,
|
|
163
|
-
onKeyDown:
|
|
164
|
-
onFocus: handleRootFocus,
|
|
165
|
-
onBlur: handleRootBlur,
|
|
142
|
+
onKeyDown: handleKeyDown,
|
|
166
143
|
[EDGE_COMP_ATTR]: '',
|
|
144
|
+
...restProps,
|
|
167
145
|
...mergeProps(themeProps('tab-list', {
|
|
168
146
|
size
|
|
169
147
|
}), stylex.props(styles.nav, layout === 'fill' && styles.fill, hasDivider && styles.divider, xstyle), className, style),
|
|
170
|
-
children:
|
|
148
|
+
children: children
|
|
171
149
|
})
|
|
172
150
|
});
|
|
173
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableContextMenu.d.ts","sourceRoot":"","sources":["../../src/Table/tableContextMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAAW,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAC,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,mBAAmB,GAAG,SAAS,GACvC,kBAAkB,EAAE,CAKtB;
|
|
1
|
+
{"version":3,"file":"tableContextMenu.d.ts","sourceRoot":"","sources":["../../src/Table/tableContextMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAAW,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAK,EAAC,kBAAkB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAErE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,mBAAmB,GAAG,SAAS,GACvC,kBAAkB,EAAE,CAKtB;AAiFD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,mBAAmB,GAAG,SAAS,GACvC,SAAS,CAgBX"}
|
|
@@ -98,6 +98,7 @@ function LazyTableContextMenu({
|
|
|
98
98
|
const [options, setOptions] = useState(null);
|
|
99
99
|
return /*#__PURE__*/_jsx(ContextMenu, {
|
|
100
100
|
items: options ?? [],
|
|
101
|
+
hasAutoFocus: false,
|
|
101
102
|
onOpenChange: open => {
|
|
102
103
|
// Resolve actions when opening; clear on close so state derived later
|
|
103
104
|
// (e.g. current sort direction) is always fresh next open.
|
|
@@ -124,10 +125,12 @@ export function wrapInTableContextMenu(element, actions) {
|
|
|
124
125
|
if (!actions || actions.length === 0) {
|
|
125
126
|
return element;
|
|
126
127
|
}
|
|
128
|
+
// hasAutoFocus={false}: a right-click menu shouldn't pre-highlight the first
|
|
127
129
|
// item (it looked like "ascending" was always selected). Focus moves only
|
|
128
130
|
// when the user arrow-keys into the menu.
|
|
129
131
|
return /*#__PURE__*/_jsx(ContextMenu, {
|
|
130
132
|
items: toContextMenuOptions(actions),
|
|
133
|
+
hasAutoFocus: false,
|
|
131
134
|
children: element
|
|
132
135
|
});
|
|
133
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../src/TextArea/TextArea.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgBf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAG5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../src/TextArea/TextArea.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgBf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAG5D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAiF9C,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,SA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H,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC3D;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IACvD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CACvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,WAAW,EACX,IAAQ,EACR,UAAkB,EAClB,MAAM,EACN,YAAY,EACZ,SAAS,EACT,aAAoB,EACpB,OAAO,EACP,SAAS,EACT,YAAoB,EACpB,IAAI,EAAE,QAAQ,EACd,QAAQ,EACR,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,aAAa,+BAiKf;yBA/Le,QAAQ"}
|
|
@@ -26,7 +26,6 @@ import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
|
26
26
|
import { useInputContainer } from "../hooks/useInputContainer.js";
|
|
27
27
|
import { useSize } from "../SizeContext/SizeContext.js";
|
|
28
28
|
import { themeProps } from "../utils/themeProps.js";
|
|
29
|
-
import { VisuallyHidden } from "../VisuallyHidden/index.js";
|
|
30
29
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
30
|
const COUNTER_WARNING_THRESHOLD = 0.8;
|
|
32
31
|
const styles = {
|
|
@@ -214,8 +213,11 @@ export function TextArea({
|
|
|
214
213
|
className: "x78zum5 x13a6bvl xcsaf9d x9ynric x141an7d xjt36v0"
|
|
215
214
|
}
|
|
216
215
|
}[!!(optimisticValue.length > maxLength) << 0],
|
|
217
|
-
children: [optimisticValue.length, "/", maxLength, /*#__PURE__*/_jsx(
|
|
216
|
+
children: [optimisticValue.length, "/", maxLength, /*#__PURE__*/_jsx("span", {
|
|
218
217
|
"aria-live": "polite",
|
|
218
|
+
...{
|
|
219
|
+
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
220
|
+
},
|
|
219
221
|
children: optimisticValue.length >= maxLength * COUNTER_WARNING_THRESHOLD ? optimisticValue.length > maxLength ? `${optimisticValue.length - maxLength} characters over limit` : `${maxLength - optimisticValue.length} characters remaining` : ''
|
|
220
222
|
})]
|
|
221
223
|
})]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Toolbar.tsx
|
|
3
|
-
* @input Uses Section, SizeContext, useListFocus,
|
|
3
|
+
* @input Uses Section, SizeContext, useListFocus, StyleX, spacingVars, sizeVars
|
|
4
4
|
* @output Exports Toolbar component and ToolbarProps
|
|
5
5
|
* @position Core implementation; consumed by index.ts
|
|
6
6
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - /apps/storybook/stories/Toolbar.stories.tsx
|
|
12
12
|
* - /packages/cli/templates/blocks/components/Toolbar/ (showcase blocks)
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import type { ReactNode } from 'react';
|
|
15
15
|
import type { BaseProps } from '../BaseProps';
|
|
16
16
|
import type { SectionVariant } from '../Section/Section';
|
|
17
17
|
import type { SpacingStep } from '../utils/types';
|
|
@@ -90,7 +90,7 @@ export interface ToolbarProps extends BaseProps<HTMLDivElement> {
|
|
|
90
90
|
* />
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export declare function Toolbar({ startContent, centerContent, endContent, label, size, gap, orientation, variant, dividers, xstyle, className, style, ref,
|
|
93
|
+
export declare function Toolbar({ startContent, centerContent, endContent, label, size, gap, orientation, variant, dividers, xstyle, className, style, ref, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
94
94
|
export declare namespace Toolbar {
|
|
95
95
|
var displayName: string;
|
|
96
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAoH5D,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC;AAEtC,MAAM,WAAW,YAAa,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC7D,gDAAgD;IAChD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IACxC;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EACtB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,KAAK,EACL,IAAW,EACX,GAAO,EACP,WAA0B,EAC1B,OAAuB,EACvB,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,YAAY,+BAmGd;yBAlHe,OAAO"}
|
package/dist/Toolbar/Toolbar.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Toolbar.tsx
|
|
7
|
-
* @input Uses Section, SizeContext, useListFocus,
|
|
7
|
+
* @input Uses Section, SizeContext, useListFocus, StyleX, spacingVars, sizeVars
|
|
8
8
|
* @output Exports Toolbar component and ToolbarProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts
|
|
10
10
|
*
|
|
@@ -15,14 +15,12 @@
|
|
|
15
15
|
* - /apps/storybook/stories/Toolbar.stories.tsx
|
|
16
16
|
* - /packages/cli/templates/blocks/components/Toolbar/ (showcase blocks)
|
|
17
17
|
*/
|
|
18
|
-
import { useCallback } from 'react';
|
|
19
18
|
import * as stylex from '@stylexjs/stylex';
|
|
20
19
|
import "../theme/tokens.stylex.js";
|
|
21
20
|
import { spacingVars, sizeVars } from "../theme/tokens.stylex.js";
|
|
22
21
|
import { mergeProps } from "../utils/index.js";
|
|
23
22
|
import { Section } from "../Section/Section.js";
|
|
24
23
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
25
|
-
import { useKeyboardHint } from "../hooks/useKeyboardHint.js";
|
|
26
24
|
import { SizeProvider } from "../SizeContext/SizeContext.js";
|
|
27
25
|
import { edgeCompSlot } from "../Layout/edgeCompensation.stylex.js";
|
|
28
26
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -169,12 +167,6 @@ export function Toolbar({
|
|
|
169
167
|
className,
|
|
170
168
|
style,
|
|
171
169
|
ref,
|
|
172
|
-
onKeyDown: onKeyDownProp,
|
|
173
|
-
onFocus: onFocusProp,
|
|
174
|
-
onBlur: onBlurProp,
|
|
175
|
-
role: _role,
|
|
176
|
-
'aria-label': _ariaLabel,
|
|
177
|
-
'aria-orientation': _ariaOrientation,
|
|
178
170
|
...props
|
|
179
171
|
}) {
|
|
180
172
|
const hasCenterContent = centerContent != null;
|
|
@@ -191,37 +183,6 @@ export function Toolbar({
|
|
|
191
183
|
hasRovingTabIndex: true,
|
|
192
184
|
hasCaretGuard: true
|
|
193
185
|
});
|
|
194
|
-
const {
|
|
195
|
-
hintElement,
|
|
196
|
-
onKeyDown: onHintKeyDown,
|
|
197
|
-
onFocus: onHintFocus,
|
|
198
|
-
onBlur: onHintBlur
|
|
199
|
-
} = useKeyboardHint({
|
|
200
|
-
orientation
|
|
201
|
-
});
|
|
202
|
-
const handleToolbarKeyDown = useCallback(e => {
|
|
203
|
-
onKeyDownProp?.(e);
|
|
204
|
-
if (e.defaultPrevented) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
onHintKeyDown(e);
|
|
208
|
-
handleKeyDown(e);
|
|
209
|
-
}, [onKeyDownProp, onHintKeyDown, handleKeyDown]);
|
|
210
|
-
const handleToolbarFocus = useCallback(e => {
|
|
211
|
-
onFocusProp?.(e);
|
|
212
|
-
if (e.defaultPrevented) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
onHintFocus(e);
|
|
216
|
-
handleFocus(e);
|
|
217
|
-
}, [onFocusProp, onHintFocus, handleFocus]);
|
|
218
|
-
const handleToolbarBlur = useCallback(e => {
|
|
219
|
-
onBlurProp?.(e);
|
|
220
|
-
if (e.defaultPrevented) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
onHintBlur(e);
|
|
224
|
-
}, [onBlurProp, onHintBlur]);
|
|
225
186
|
return /*#__PURE__*/_jsx(SizeProvider, {
|
|
226
187
|
value: size,
|
|
227
188
|
children: /*#__PURE__*/_jsx(Section, {
|
|
@@ -232,19 +193,18 @@ export function Toolbar({
|
|
|
232
193
|
xstyle: xstyle,
|
|
233
194
|
className: className,
|
|
234
195
|
style: style,
|
|
235
|
-
children: /*#__PURE__*/
|
|
196
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
236
197
|
ref: listRef,
|
|
237
198
|
role: "toolbar",
|
|
238
199
|
"aria-label": label,
|
|
239
200
|
"aria-orientation": orientation,
|
|
240
|
-
onKeyDown:
|
|
241
|
-
onFocus:
|
|
242
|
-
onBlur: handleToolbarBlur,
|
|
201
|
+
onKeyDown: handleKeyDown,
|
|
202
|
+
onFocus: handleFocus,
|
|
243
203
|
...mergeProps(themeProps('toolbar', {
|
|
244
204
|
size
|
|
245
205
|
}), stylex.props(hasCenterContent ? styles.baseGrid : styles.baseFlex, orientation === 'vertical' && styles.vertical, sizeStyles.base, dynamicStyles.gap(gapVar), dynamicStyles.tabIndicatorBottom(`calc(-1 * (${blockPaddingVarForSize[size]}${dividers?.includes('bottom') ? ' + 1px' : ''}))`))),
|
|
246
206
|
...props,
|
|
247
|
-
children:
|
|
207
|
+
children: hasCenterContent ?
|
|
248
208
|
/*#__PURE__*/
|
|
249
209
|
// Three-slot grid layout
|
|
250
210
|
_jsxs(_Fragment, {
|
|
@@ -269,7 +229,7 @@ export function Toolbar({
|
|
|
269
229
|
...stylex.props(styles.endSlot, !hasStartContent && styles.endOnly, edgeCompSlot.inset(edgeCompInsetForSize[size]), dynamicStyles.gap(gapVar)),
|
|
270
230
|
children: endContent
|
|
271
231
|
})]
|
|
272
|
-
})
|
|
232
|
+
})
|
|
273
233
|
})
|
|
274
234
|
})
|
|
275
235
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeList.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI5E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAQvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAE1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"TreeList.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeList.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI5E,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,gBAAgB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAQvE,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;OAGG;IACH,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAE1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAsED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,OAAoB,EACpB,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,GACJ,EAAE,aAAa,+BA4Jf;yBArKe,QAAQ"}
|
|
@@ -57,13 +57,12 @@ function collectExpandedKeys(items) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Compute the initial roving-tabindex
|
|
61
|
-
* document order, else the first enabled item, else the first item.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* with keyboard navigation.
|
|
60
|
+
* Compute the initial roving-tabindex owner: the first selected enabled item
|
|
61
|
+
* in document order, else the first enabled item, else the first item.
|
|
62
|
+
* Only the top-level candidates are considered for the default so the tab stop
|
|
63
|
+
* is reachable even when the tree is fully collapsed.
|
|
65
64
|
*/
|
|
66
|
-
function
|
|
65
|
+
function findDefaultActiveId(items) {
|
|
67
66
|
let firstEnabled;
|
|
68
67
|
const walk = list => {
|
|
69
68
|
for (const item of list) {
|
|
@@ -141,11 +140,20 @@ export function TreeList({
|
|
|
141
140
|
// Roving tabindex + APG tree keyboard model (via useTreeFocus)
|
|
142
141
|
// ---------------------------------------------------------------------------
|
|
143
142
|
|
|
144
|
-
// The
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
// The treeitem that currently owns the tree's single tab stop. The hook moves
|
|
144
|
+
// it around via onActiveChange; a data-driven default seeds it (selected item
|
|
145
|
+
// or first enabled).
|
|
146
|
+
const [activeId, setActiveId] = useState(() => findDefaultActiveId(items));
|
|
147
|
+
|
|
148
|
+
// If the seed id is no longer present (items changed), fall back to a valid
|
|
149
|
+
// default so the tree always has exactly one reachable tab stop.
|
|
150
|
+
const resolvedActiveId = useMemo(() => {
|
|
151
|
+
if (activeId == null) {
|
|
152
|
+
return findDefaultActiveId(items);
|
|
153
|
+
}
|
|
154
|
+
const exists = list => list.some(item => item.id === activeId || item.children != null && exists(item.children));
|
|
155
|
+
return exists(items) ? activeId : findDefaultActiveId(items);
|
|
156
|
+
}, [activeId, items]);
|
|
149
157
|
|
|
150
158
|
// Enter/Space activation: prefer the treeitem's own inner action (link or
|
|
151
159
|
// button); return true when handled so the hook does not also toggle. Scoped
|
|
@@ -163,12 +171,11 @@ export function TreeList({
|
|
|
163
171
|
}, []);
|
|
164
172
|
const {
|
|
165
173
|
treeRef,
|
|
166
|
-
handleKeyDown
|
|
167
|
-
handleFocus
|
|
174
|
+
handleKeyDown
|
|
168
175
|
} = useTreeFocus({
|
|
169
176
|
onToggleExpand: handleToggle,
|
|
170
177
|
onActivate: activateItem,
|
|
171
|
-
|
|
178
|
+
onActiveChange: setActiveId
|
|
172
179
|
});
|
|
173
180
|
function renderItems(items, nestedLevel, ancestorsIsLast) {
|
|
174
181
|
return items.map((item, index) => {
|
|
@@ -198,7 +205,7 @@ export function TreeList({
|
|
|
198
205
|
renderedChildren: renderedChildren,
|
|
199
206
|
posInSet: index + 1,
|
|
200
207
|
setSize: items.length,
|
|
201
|
-
isTabbable: item.id ===
|
|
208
|
+
isTabbable: item.id === resolvedActiveId
|
|
202
209
|
}, item.id);
|
|
203
210
|
});
|
|
204
211
|
}
|
|
@@ -219,7 +226,6 @@ export function TreeList({
|
|
|
219
226
|
role: "tree",
|
|
220
227
|
"aria-labelledby": header != null ? headerId : undefined,
|
|
221
228
|
onKeyDown: handleKeyDown,
|
|
222
|
-
onFocus: handleFocus,
|
|
223
229
|
...{
|
|
224
230
|
className: "x1ghz6dp x1717udv x3ct3a4"
|
|
225
231
|
},
|
|
@@ -36,9 +36,8 @@ export interface TreeListItemInternalProps {
|
|
|
36
36
|
/** Number of siblings at this level (aria-setsize). */
|
|
37
37
|
setSize: number;
|
|
38
38
|
/**
|
|
39
|
-
* Whether this treeitem
|
|
40
|
-
* treeitem is
|
|
41
|
-
* then owns the tab stop dynamically.
|
|
39
|
+
* Whether this treeitem currently owns the tree's single tab stop
|
|
40
|
+
* (roving tabindex). Exactly one visible treeitem is tabbable at a time.
|
|
42
41
|
*/
|
|
43
42
|
isTabbable: boolean;
|
|
44
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeListItem.d.ts","sourceRoot":"","sources":["../../src/TreeList/TreeListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAiB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAcrD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAoNrD,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU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M,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,eAAe,CAAC;IACzB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB;AAMD,wBAAgB,YAAY,CAAC,EAC3B,EAAE,EACF,KAAK,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,MAAM,EACN,UAAkB,EAClB,UAAkB,EAClB,WAAW,EACX,WAAW,EACX,MAAM,EACN,eAAe,EACf,UAAU,EACV,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,UAAU,GACX,EAAE,yBAAyB,+BA2L3B;yBAjNe,YAAY"}
|
package/dist/astryx.css
CHANGED
|
@@ -253,7 +253,6 @@
|
|
|
253
253
|
@media (hover: hover){.x1pkcbo2.x1pkcbo2:hover{--table-row-overlay:var(--color-overlay-hover)}}
|
|
254
254
|
.xln7xf2:not(#\#){font:inherit}
|
|
255
255
|
.x10a8y8t:not(#\#){inset:0}
|
|
256
|
-
.x1anvkwx:not(#\#){inset:auto}
|
|
257
256
|
.xh3736h:not(#\#){inset:unset}
|
|
258
257
|
.xkdpibf:not(#\#){margin:-1px}
|
|
259
258
|
.x1ghz6dp:not(#\#){margin:0}
|
|
@@ -944,7 +943,6 @@
|
|
|
944
943
|
.x1ahifba:not(#\#):not(#\#):not(#\#){transition-delay:0s}
|
|
945
944
|
.x10b1n17:not(#\#):not(#\#):not(#\#){transition-delay:var(--duration-fast)}
|
|
946
945
|
.x11bq7d0:not(#\#):not(#\#):not(#\#){transition-duration:.06s}
|
|
947
|
-
.xx6bhzk:not(#\#):not(#\#):not(#\#){transition-duration:.15s}
|
|
948
946
|
.x13dflua:not(#\#):not(#\#):not(#\#){transition-duration:.2s}
|
|
949
947
|
.xjd9b36:not(#\#):not(#\#):not(#\#){transition-duration:1ms}
|
|
950
948
|
.x2rcmwa:not(#\#):not(#\#):not(#\#){transition-duration:var(--duration-fast-max)}
|
|
@@ -973,7 +971,6 @@
|
|
|
973
971
|
.x1wbls7o:not(#\#):not(#\#):not(#\#){transition-property:opacity,background-color,transform}
|
|
974
972
|
.xnpjden:not(#\#):not(#\#):not(#\#){transition-property:opacity,background-color}
|
|
975
973
|
.x1kx2cm7:not(#\#):not(#\#):not(#\#){transition-property:opacity,box-shadow}
|
|
976
|
-
.xsm4mo9:not(#\#):not(#\#):not(#\#){transition-property:opacity,display,overlay}
|
|
977
974
|
.x1apppo2:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform,max-width}
|
|
978
975
|
.x4bbghf:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform,overlay,display}
|
|
979
976
|
.x6o7n8i:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform}
|