@astryxdesign/core 0.1.2-canary.bfcbf64 → 0.1.2-canary.c395fca
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 +4 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +2 -4
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +33 -14
- package/dist/Calendar/hooks/index.d.ts +0 -2
- package/dist/Calendar/hooks/index.d.ts.map +1 -1
- package/dist/Calendar/hooks/index.js +1 -2
- 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/Citation/Citation.d.ts.map +1 -1
- package/dist/Citation/Citation.js +3 -3
- package/dist/ContextMenu/ContextMenu.d.ts +1 -7
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +7 -13
- package/dist/DropdownMenu/DropdownMenu.d.ts +1 -8
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +4 -9
- 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 +2 -4
- package/dist/MoreMenu/MoreMenu.d.ts +1 -7
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +0 -2
- package/dist/MultiSelector/MultiSelector.d.ts +25 -2
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +31 -6
- package/dist/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/ProgressBar/ProgressBar.js +2 -4
- 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 +51 -61
- package/dist/Selector/Selector.d.ts +22 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +31 -6
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +2 -4
- package/dist/TabList/TabList.d.ts +3 -2
- package/dist/TabList/TabList.d.ts.map +1 -1
- package/dist/TabList/TabList.js +55 -33
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +0 -3
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +2 -4
- package/dist/Toolbar/Toolbar.d.ts +3 -3
- package/dist/Toolbar/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar/Toolbar.js +46 -6
- package/dist/TreeList/TreeList.d.ts.map +1 -1
- package/dist/TreeList/TreeList.js +16 -22
- package/dist/TreeList/TreeListItem.d.ts +3 -2
- package/dist/TreeList/TreeListItem.d.ts.map +1 -1
- package/dist/astryx.css +3 -0
- package/dist/astryx.umd.js +47 -47
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +4 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useGridFocus.d.ts +56 -0
- package/dist/hooks/useGridFocus.d.ts.map +1 -1
- package/dist/hooks/useGridFocus.js +138 -24
- package/dist/hooks/useKeyboardHint.d.ts +82 -0
- package/dist/hooks/useKeyboardHint.d.ts.map +1 -0
- package/dist/hooks/useKeyboardHint.js +220 -0
- package/dist/hooks/useTreeFocus.d.ts +27 -3
- package/dist/hooks/useTreeFocus.d.ts.map +1 -1
- package/dist/hooks/useTreeFocus.js +69 -6
- package/package.json +1 -1
- package/src/Breadcrumbs/BreadcrumbItem.tsx +5 -2
- package/src/Button/Button.tsx +3 -16
- package/src/Calendar/Calendar.tsx +52 -22
- package/src/Calendar/hooks/index.ts +0 -6
- package/src/Calendar/index.ts +0 -3
- package/src/CheckboxList/CheckboxList.tsx +3 -3
- package/src/Citation/Citation.doc.mjs +10 -0
- package/src/Citation/Citation.test.tsx +117 -0
- package/src/Citation/Citation.tsx +9 -1
- package/src/ContextMenu/ContextMenu.doc.mjs +0 -6
- package/src/ContextMenu/ContextMenu.test.tsx +4 -6
- package/src/ContextMenu/ContextMenu.tsx +7 -19
- package/src/DropdownMenu/DropdownMenu.doc.mjs +1 -8
- package/src/DropdownMenu/DropdownMenu.test.tsx +0 -23
- package/src/DropdownMenu/DropdownMenu.tsx +4 -16
- 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 +2 -13
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -17
- package/src/MoreMenu/MoreMenu.tsx +0 -9
- package/src/MultiSelector/MultiSelector.doc.mjs +25 -0
- package/src/MultiSelector/MultiSelector.test.tsx +150 -1
- package/src/MultiSelector/MultiSelector.tsx +55 -3
- package/src/ProgressBar/ProgressBar.tsx +2 -3
- package/src/RadioList/RadioList.tsx +3 -3
- package/src/SegmentedControl/SegmentedControl.tsx +51 -77
- package/src/Selector/Selector.doc.mjs +21 -0
- package/src/Selector/Selector.test.tsx +123 -1
- package/src/Selector/Selector.tsx +53 -3
- package/src/Switch/Switch.tsx +2 -16
- package/src/TabList/TabList.test.tsx +41 -0
- package/src/TabList/TabList.tsx +66 -39
- package/src/Table/tableContextMenu.tsx +1 -5
- package/src/TextArea/TextArea.tsx +3 -13
- package/src/Toolbar/Toolbar.test.tsx +64 -6
- package/src/Toolbar/Toolbar.tsx +55 -4
- package/src/TreeList/TreeList.tsx +17 -28
- package/src/TreeList/TreeListItem.tsx +3 -2
- package/src/VisuallyHidden/VisuallyHidden.doc.mjs +7 -7
- package/src/hooks/index.ts +12 -5
- package/src/hooks/useGridFocus.doc.mjs +40 -2
- package/src/hooks/useGridFocus.test.tsx +132 -0
- package/src/hooks/useGridFocus.ts +179 -23
- package/src/hooks/useKeyboardHint.doc.mjs +101 -0
- package/src/hooks/useKeyboardHint.test.tsx +70 -0
- package/src/hooks/useKeyboardHint.tsx +332 -0
- package/src/hooks/useTreeFocus.doc.mjs +15 -1
- package/src/hooks/useTreeFocus.ts +101 -6
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts +0 -57
- package/dist/Calendar/hooks/useCalendarRovingTabindex.d.ts.map +0 -1
- package/dist/Calendar/hooks/useCalendarRovingTabindex.js +0 -96
- package/src/Calendar/hooks/useCalendarRovingTabindex.ts +0 -118
|
@@ -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, useKeyboardHint
|
|
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,6 +15,7 @@
|
|
|
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';
|
|
18
19
|
export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
19
20
|
ref?: React.Ref<HTMLElement>;
|
|
20
21
|
/**
|
|
@@ -73,7 +74,7 @@ export interface TabListProps extends Omit<BaseProps<HTMLElement>, 'onChange'> {
|
|
|
73
74
|
* </TabList>
|
|
74
75
|
* ```
|
|
75
76
|
*/
|
|
76
|
-
export declare function TabList({ ref, value, onChange, size: sizeProp, layout, hasDivider, orientation, xstyle, className, style, children, ...restProps }: TabListProps): React.JSX.Element;
|
|
77
|
+
export declare function TabList({ ref, value, onChange, size: sizeProp, layout, hasDivider, orientation, xstyle, className, style, children, onKeyDown: onKeyDownProp, onFocus: onFocusProp, onBlur: onBlurProp, 'aria-label': ariaLabel, 'aria-orientation': _ariaOrientation, [EDGE_COMP_ATTR]: _edgeCompAttr, ...restProps }: TabListProps): React.JSX.Element;
|
|
77
78
|
export declare namespace TabList {
|
|
78
79
|
var displayName: string;
|
|
79
80
|
}
|
|
@@ -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,EAAuB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,KAAK,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAKtE,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAUjE,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,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,SAAkB,EAChC,kBAAkB,EAAE,gBAAgB,EACpC,CAAC,cAAc,CAAC,EAAE,aAAa,EAC/B,GAAG,SAAS,EACb,EAAE,YAAY,qBAgGd;yBAnHe,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, useKeyboardHint
|
|
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, { useMemo } from 'react';
|
|
19
|
+
import React, { useCallback, 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 { useKeyboardHint } from "../hooks/useKeyboardHint.js";
|
|
28
28
|
import { EDGE_COMP_ATTR } from "../Layout/edgeCompensation.stylex.js";
|
|
29
29
|
import { themeProps } from "../utils/themeProps.js";
|
|
30
30
|
|
|
@@ -33,11 +33,8 @@ 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 { jsx as _jsx } from "react/jsx-runtime";
|
|
36
|
+
import { jsxs as _jsxs, 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
|
-
}
|
|
41
38
|
const styles = {
|
|
42
39
|
nav: {
|
|
43
40
|
k1xSpc: "x78zum5",
|
|
@@ -87,6 +84,12 @@ export function TabList({
|
|
|
87
84
|
className,
|
|
88
85
|
style,
|
|
89
86
|
children,
|
|
87
|
+
onKeyDown: onKeyDownProp,
|
|
88
|
+
onFocus: onFocusProp,
|
|
89
|
+
onBlur: onBlurProp,
|
|
90
|
+
'aria-label': ariaLabel = 'Tabs',
|
|
91
|
+
'aria-orientation': _ariaOrientation,
|
|
92
|
+
[EDGE_COMP_ATTR]: _edgeCompAttr,
|
|
90
93
|
...restProps
|
|
91
94
|
}) {
|
|
92
95
|
const size = useSize(sizeProp, 'md');
|
|
@@ -96,12 +99,30 @@ export function TabList({
|
|
|
96
99
|
// allowance for tab strips (ArrowRight/ArrowDown advance, ArrowLeft/ArrowUp
|
|
97
100
|
// retreat) regardless of the component's `orientation` prop, which only
|
|
98
101
|
// 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.
|
|
99
110
|
const {
|
|
100
111
|
listRef,
|
|
101
|
-
handleKeyDown
|
|
112
|
+
handleKeyDown,
|
|
113
|
+
handleFocus
|
|
102
114
|
} = useListFocus({
|
|
103
115
|
itemSelector: TAB_STOP_SELECTOR,
|
|
104
|
-
orientation: 'both'
|
|
116
|
+
orientation: 'both',
|
|
117
|
+
hasRovingTabIndex: true
|
|
118
|
+
});
|
|
119
|
+
const {
|
|
120
|
+
hintElement,
|
|
121
|
+
onKeyDown: onHintKeyDown,
|
|
122
|
+
onFocus: onHintFocus,
|
|
123
|
+
onBlur: onHintBlur
|
|
124
|
+
} = useKeyboardHint({
|
|
125
|
+
orientation
|
|
105
126
|
});
|
|
106
127
|
const contextValue = useMemo(() => ({
|
|
107
128
|
value,
|
|
@@ -109,43 +130,44 @@ export function TabList({
|
|
|
109
130
|
size,
|
|
110
131
|
layout
|
|
111
132
|
}), [value, onChange, size, layout]);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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) {
|
|
133
|
+
const handleRootKeyDown = useCallback(e => {
|
|
134
|
+
onKeyDownProp?.(e);
|
|
135
|
+
if (e.defaultPrevented) {
|
|
124
136
|
return;
|
|
125
137
|
}
|
|
126
|
-
|
|
127
|
-
|
|
138
|
+
onHintKeyDown(e);
|
|
139
|
+
handleKeyDown(e);
|
|
140
|
+
}, [onKeyDownProp, onHintKeyDown, handleKeyDown]);
|
|
141
|
+
const handleRootFocus = useCallback(e => {
|
|
142
|
+
onFocusProp?.(e);
|
|
143
|
+
if (e.defaultPrevented) {
|
|
128
144
|
return;
|
|
129
145
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
146
|
+
onHintFocus(e);
|
|
147
|
+
handleFocus(e);
|
|
148
|
+
}, [onFocusProp, onHintFocus, handleFocus]);
|
|
149
|
+
const handleRootBlur = useCallback(e => {
|
|
150
|
+
onBlurProp?.(e);
|
|
151
|
+
if (e.defaultPrevented) {
|
|
152
|
+
return;
|
|
134
153
|
}
|
|
135
|
-
|
|
154
|
+
onHintBlur(e);
|
|
155
|
+
}, [onBlurProp, onHintBlur]);
|
|
136
156
|
return /*#__PURE__*/_jsx(TabListContext, {
|
|
137
157
|
value: contextValue,
|
|
138
|
-
children: /*#__PURE__*/
|
|
158
|
+
children: /*#__PURE__*/_jsxs("nav", {
|
|
139
159
|
ref: mergeRefs(ref, listRef),
|
|
140
|
-
|
|
160
|
+
...restProps,
|
|
161
|
+
"aria-label": ariaLabel,
|
|
141
162
|
"aria-orientation": orientation,
|
|
142
|
-
onKeyDown:
|
|
163
|
+
onKeyDown: handleRootKeyDown,
|
|
164
|
+
onFocus: handleRootFocus,
|
|
165
|
+
onBlur: handleRootBlur,
|
|
143
166
|
[EDGE_COMP_ATTR]: '',
|
|
144
|
-
...restProps,
|
|
145
167
|
...mergeProps(themeProps('tab-list', {
|
|
146
168
|
size
|
|
147
169
|
}), stylex.props(styles.nav, layout === 'fill' && styles.fill, hasDivider && styles.divider, xstyle), className, style),
|
|
148
|
-
children: children
|
|
170
|
+
children: [children, hintElement]
|
|
149
171
|
})
|
|
150
172
|
});
|
|
151
173
|
}
|
|
@@ -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;AAgFD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,mBAAmB,GAAG,SAAS,GACvC,SAAS,CAaX"}
|
|
@@ -98,7 +98,6 @@ function LazyTableContextMenu({
|
|
|
98
98
|
const [options, setOptions] = useState(null);
|
|
99
99
|
return /*#__PURE__*/_jsx(ContextMenu, {
|
|
100
100
|
items: options ?? [],
|
|
101
|
-
hasAutoFocus: false,
|
|
102
101
|
onOpenChange: open => {
|
|
103
102
|
// Resolve actions when opening; clear on close so state derived later
|
|
104
103
|
// (e.g. current sort direction) is always fresh next open.
|
|
@@ -125,12 +124,10 @@ export function wrapInTableContextMenu(element, actions) {
|
|
|
125
124
|
if (!actions || actions.length === 0) {
|
|
126
125
|
return element;
|
|
127
126
|
}
|
|
128
|
-
// hasAutoFocus={false}: a right-click menu shouldn't pre-highlight the first
|
|
129
127
|
// item (it looked like "ascending" was always selected). Focus moves only
|
|
130
128
|
// when the user arrow-keys into the menu.
|
|
131
129
|
return /*#__PURE__*/_jsx(ContextMenu, {
|
|
132
130
|
items: toContextMenuOptions(actions),
|
|
133
|
-
hasAutoFocus: false,
|
|
134
131
|
children: element
|
|
135
132
|
});
|
|
136
133
|
}
|
|
@@ -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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,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,6 +26,7 @@ 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";
|
|
29
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
31
|
const COUNTER_WARNING_THRESHOLD = 0.8;
|
|
31
32
|
const styles = {
|
|
@@ -213,11 +214,8 @@ export function TextArea({
|
|
|
213
214
|
className: "x78zum5 x13a6bvl xcsaf9d x9ynric x141an7d xjt36v0"
|
|
214
215
|
}
|
|
215
216
|
}[!!(optimisticValue.length > maxLength) << 0],
|
|
216
|
-
children: [optimisticValue.length, "/", maxLength, /*#__PURE__*/_jsx(
|
|
217
|
+
children: [optimisticValue.length, "/", maxLength, /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
217
218
|
"aria-live": "polite",
|
|
218
|
-
...{
|
|
219
|
-
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xkdpibf xb3r6kr xzpqnlu xuxw1ft xc342km"
|
|
220
|
-
},
|
|
221
219
|
children: optimisticValue.length >= maxLength * COUNTER_WARNING_THRESHOLD ? optimisticValue.length > maxLength ? `${optimisticValue.length - maxLength} characters over limit` : `${maxLength - optimisticValue.length} characters remaining` : ''
|
|
222
220
|
})]
|
|
223
221
|
})]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Toolbar.tsx
|
|
3
|
-
* @input Uses Section, SizeContext, useListFocus, StyleX, spacingVars, sizeVars
|
|
3
|
+
* @input Uses Section, SizeContext, useListFocus, useKeyboardHint, 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 type
|
|
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, ...props }: ToolbarProps): import("react").JSX.Element;
|
|
93
|
+
export declare function Toolbar({ startContent, centerContent, endContent, label, size, gap, orientation, variant, dividers, xstyle, className, style, ref, onKeyDown: onKeyDownProp, onFocus: onFocusProp, onBlur: onBlurProp, role: _role, 'aria-label': _ariaLabel, 'aria-orientation': _ariaOrientation, ...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,KAAK,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,E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M,EAAE,UAAU,EAClB,IAAI,EAAE,KAAK,EACX,YAAY,EAAE,UAAU,EACxB,kBAAkB,EAAE,gBAAgB,EACpC,GAAG,KAAK,EACT,EAAE,YAAY,+BA+Id;yBApKe,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, StyleX, spacingVars, sizeVars
|
|
7
|
+
* @input Uses Section, SizeContext, useListFocus, useKeyboardHint, StyleX, spacingVars, sizeVars
|
|
8
8
|
* @output Exports Toolbar component and ToolbarProps
|
|
9
9
|
* @position Core implementation; consumed by index.ts
|
|
10
10
|
*
|
|
@@ -15,12 +15,14 @@
|
|
|
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';
|
|
18
19
|
import * as stylex from '@stylexjs/stylex';
|
|
19
20
|
import "../theme/tokens.stylex.js";
|
|
20
21
|
import { spacingVars, sizeVars } from "../theme/tokens.stylex.js";
|
|
21
22
|
import { mergeProps } from "../utils/index.js";
|
|
22
23
|
import { Section } from "../Section/Section.js";
|
|
23
24
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
25
|
+
import { useKeyboardHint } from "../hooks/useKeyboardHint.js";
|
|
24
26
|
import { SizeProvider } from "../SizeContext/SizeContext.js";
|
|
25
27
|
import { edgeCompSlot } from "../Layout/edgeCompensation.stylex.js";
|
|
26
28
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -167,6 +169,12 @@ export function Toolbar({
|
|
|
167
169
|
className,
|
|
168
170
|
style,
|
|
169
171
|
ref,
|
|
172
|
+
onKeyDown: onKeyDownProp,
|
|
173
|
+
onFocus: onFocusProp,
|
|
174
|
+
onBlur: onBlurProp,
|
|
175
|
+
role: _role,
|
|
176
|
+
'aria-label': _ariaLabel,
|
|
177
|
+
'aria-orientation': _ariaOrientation,
|
|
170
178
|
...props
|
|
171
179
|
}) {
|
|
172
180
|
const hasCenterContent = centerContent != null;
|
|
@@ -183,6 +191,37 @@ export function Toolbar({
|
|
|
183
191
|
hasRovingTabIndex: true,
|
|
184
192
|
hasCaretGuard: true
|
|
185
193
|
});
|
|
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]);
|
|
186
225
|
return /*#__PURE__*/_jsx(SizeProvider, {
|
|
187
226
|
value: size,
|
|
188
227
|
children: /*#__PURE__*/_jsx(Section, {
|
|
@@ -193,18 +232,19 @@ export function Toolbar({
|
|
|
193
232
|
xstyle: xstyle,
|
|
194
233
|
className: className,
|
|
195
234
|
style: style,
|
|
196
|
-
children: /*#__PURE__*/
|
|
235
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
197
236
|
ref: listRef,
|
|
198
237
|
role: "toolbar",
|
|
199
238
|
"aria-label": label,
|
|
200
239
|
"aria-orientation": orientation,
|
|
201
|
-
onKeyDown:
|
|
202
|
-
onFocus:
|
|
240
|
+
onKeyDown: handleToolbarKeyDown,
|
|
241
|
+
onFocus: handleToolbarFocus,
|
|
242
|
+
onBlur: handleToolbarBlur,
|
|
203
243
|
...mergeProps(themeProps('toolbar', {
|
|
204
244
|
size
|
|
205
245
|
}), 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' : ''}))`))),
|
|
206
246
|
...props,
|
|
207
|
-
children: hasCenterContent ?
|
|
247
|
+
children: [hasCenterContent ?
|
|
208
248
|
/*#__PURE__*/
|
|
209
249
|
// Three-slot grid layout
|
|
210
250
|
_jsxs(_Fragment, {
|
|
@@ -229,7 +269,7 @@ export function Toolbar({
|
|
|
229
269
|
...stylex.props(styles.endSlot, !hasStartContent && styles.endOnly, edgeCompSlot.inset(edgeCompInsetForSize[size]), dynamicStyles.gap(gapVar)),
|
|
230
270
|
children: endContent
|
|
231
271
|
})]
|
|
232
|
-
})
|
|
272
|
+
}), hintElement]
|
|
233
273
|
})
|
|
234
274
|
})
|
|
235
275
|
});
|
|
@@ -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,gBAAg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,OAAoB,EACpB,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,GACJ,EAAE,aAAa,+BAgJf;yBAzJe,QAAQ"}
|
|
@@ -57,12 +57,13 @@ function collectExpandedKeys(items) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
* Compute the initial roving-tabindex
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
60
|
+
* Compute the initial roving-tabindex seed: the first selected enabled item in
|
|
61
|
+
* document order, else the first enabled item, else the first item. The hook
|
|
62
|
+
* (useTreeFocus with hasRovingTabIndex) takes ownership after mount — it
|
|
63
|
+
* preserves this seeded `tabindex="0"` on its repair pass and moves the stop
|
|
64
|
+
* with keyboard navigation.
|
|
64
65
|
*/
|
|
65
|
-
function
|
|
66
|
+
function findInitialTabbableId(items) {
|
|
66
67
|
let firstEnabled;
|
|
67
68
|
const walk = list => {
|
|
68
69
|
for (const item of list) {
|
|
@@ -140,20 +141,11 @@ export function TreeList({
|
|
|
140
141
|
// Roving tabindex + APG tree keyboard model (via useTreeFocus)
|
|
141
142
|
// ---------------------------------------------------------------------------
|
|
142
143
|
|
|
143
|
-
// The
|
|
144
|
-
//
|
|
145
|
-
// or first enabled)
|
|
146
|
-
|
|
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]);
|
|
144
|
+
// The hook (hasRovingTabIndex) owns the tree's single tab stop: it repairs
|
|
145
|
+
// the stop on mount and moves it with keyboard navigation. We only seed the
|
|
146
|
+
// initially-tabbable treeitem in the render (selected item or first enabled);
|
|
147
|
+
// the hook's repair pass preserves that seeded `tabindex="0"`.
|
|
148
|
+
const initialTabbableId = useMemo(() => findInitialTabbableId(items), [items]);
|
|
157
149
|
|
|
158
150
|
// Enter/Space activation: prefer the treeitem's own inner action (link or
|
|
159
151
|
// button); return true when handled so the hook does not also toggle. Scoped
|
|
@@ -171,11 +163,12 @@ export function TreeList({
|
|
|
171
163
|
}, []);
|
|
172
164
|
const {
|
|
173
165
|
treeRef,
|
|
174
|
-
handleKeyDown
|
|
166
|
+
handleKeyDown,
|
|
167
|
+
handleFocus
|
|
175
168
|
} = useTreeFocus({
|
|
176
169
|
onToggleExpand: handleToggle,
|
|
177
170
|
onActivate: activateItem,
|
|
178
|
-
|
|
171
|
+
hasRovingTabIndex: true
|
|
179
172
|
});
|
|
180
173
|
function renderItems(items, nestedLevel, ancestorsIsLast) {
|
|
181
174
|
return items.map((item, index) => {
|
|
@@ -205,7 +198,7 @@ export function TreeList({
|
|
|
205
198
|
renderedChildren: renderedChildren,
|
|
206
199
|
posInSet: index + 1,
|
|
207
200
|
setSize: items.length,
|
|
208
|
-
isTabbable: item.id ===
|
|
201
|
+
isTabbable: item.id === initialTabbableId
|
|
209
202
|
}, item.id);
|
|
210
203
|
});
|
|
211
204
|
}
|
|
@@ -226,6 +219,7 @@ export function TreeList({
|
|
|
226
219
|
role: "tree",
|
|
227
220
|
"aria-labelledby": header != null ? headerId : undefined,
|
|
228
221
|
onKeyDown: handleKeyDown,
|
|
222
|
+
onFocus: handleFocus,
|
|
229
223
|
...{
|
|
230
224
|
className: "x1ghz6dp x1717udv x3ct3a4"
|
|
231
225
|
},
|
|
@@ -36,8 +36,9 @@ export interface TreeListItemInternalProps {
|
|
|
36
36
|
/** Number of siblings at this level (aria-setsize). */
|
|
37
37
|
setSize: number;
|
|
38
38
|
/**
|
|
39
|
-
* Whether this treeitem
|
|
40
|
-
*
|
|
39
|
+
* Whether this treeitem is the initial roving-tabindex seed. Exactly one
|
|
40
|
+
* treeitem is seeded tabbable at mount; useTreeFocus (hasRovingTabIndex)
|
|
41
|
+
* then owns the tab stop dynamically.
|
|
41
42
|
*/
|
|
42
43
|
isTabbable: boolean;
|
|
43
44
|
}
|
|
@@ -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,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,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,uD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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,6 +253,7 @@
|
|
|
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}
|
|
256
257
|
.xh3736h:not(#\#){inset:unset}
|
|
257
258
|
.xkdpibf:not(#\#){margin:-1px}
|
|
258
259
|
.x1ghz6dp:not(#\#){margin:0}
|
|
@@ -943,6 +944,7 @@
|
|
|
943
944
|
.x1ahifba:not(#\#):not(#\#):not(#\#){transition-delay:0s}
|
|
944
945
|
.x10b1n17:not(#\#):not(#\#):not(#\#){transition-delay:var(--duration-fast)}
|
|
945
946
|
.x11bq7d0:not(#\#):not(#\#):not(#\#){transition-duration:.06s}
|
|
947
|
+
.xx6bhzk:not(#\#):not(#\#):not(#\#){transition-duration:.15s}
|
|
946
948
|
.x13dflua:not(#\#):not(#\#):not(#\#){transition-duration:.2s}
|
|
947
949
|
.xjd9b36:not(#\#):not(#\#):not(#\#){transition-duration:1ms}
|
|
948
950
|
.x2rcmwa:not(#\#):not(#\#):not(#\#){transition-duration:var(--duration-fast-max)}
|
|
@@ -971,6 +973,7 @@
|
|
|
971
973
|
.x1wbls7o:not(#\#):not(#\#):not(#\#){transition-property:opacity,background-color,transform}
|
|
972
974
|
.xnpjden:not(#\#):not(#\#):not(#\#){transition-property:opacity,background-color}
|
|
973
975
|
.x1kx2cm7:not(#\#):not(#\#):not(#\#){transition-property:opacity,box-shadow}
|
|
976
|
+
.xsm4mo9:not(#\#):not(#\#):not(#\#){transition-property:opacity,display,overlay}
|
|
974
977
|
.x1apppo2:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform,max-width}
|
|
975
978
|
.x4bbghf:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform,overlay,display}
|
|
976
979
|
.x6o7n8i:not(#\#):not(#\#):not(#\#){transition-property:opacity,transform}
|