@astryxdesign/core 0.7.9-canary.d7a7dd3 → 0.7.9-canary.dd5ca29
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/BottomSheet/useSheetGestures.d.ts.map +1 -1
- package/dist/BottomSheet/useSheetGestures.js +36 -9
- package/dist/Icon/index.d.ts +4 -0
- package/dist/Icon/index.d.ts.map +1 -1
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +9 -2
- package/dist/Table/plugins/sortable/useTableSortable.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortable.js +16 -8
- package/dist/privateAttributes/press.stylex.d.ts +5 -1
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/press.stylex.js +6 -1
- package/package.json +4 -4
- package/src/BottomSheet/useSheetGestures.ts +41 -10
- package/src/Icon/index.ts +4 -0
- package/src/Item/Item.tsx +14 -1
- package/src/Overlay/useOverlay.doc.mjs +176 -0
- package/src/Table/Table.doc.mjs +19 -0
- package/src/Table/plugins/sortable/useTableSortable.tsx +19 -12
- package/src/privateAttributes/press.stylex.ts +21 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSheetGestures.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/useSheetGestures.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAoCH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,SAAS,EACd,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,OAAO,IAAI,YAAY,EAC7B,MAAM,OAAO,CAAC;AA4Hf;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,G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AAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,uBAAuB,EAAE,MAAM,CAAC;IAChC,qEAAqE;IACrE,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAwB,EACxB,UAAiB,EACjB,sBAA0B,EAC1B,SAAS,EACT,WAAW,EACX,MAAM,EACN,aAAa,EACb,cAAc,EACd,cAAsB,GACvB,EAAE,uBAAuB,GAAG,sBAAsB,
|
|
1
|
+
{"version":3,"file":"useSheetGestures.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/useSheetGestures.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AAoCH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,YAAY,IAAI,iBAAiB,EACtC,KAAK,SAAS,EACd,KAAK,UAAU,IAAI,eAAe,EAClC,KAAK,OAAO,IAAI,YAAY,EAC7B,MAAM,OAAO,CAAC;AA4Hf;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MA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ACH,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,aAAa,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,UAAU,EAAE,OAAO,CAAC;IACpB,4EAA4E;IAC5E,WAAW,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;;OAIG;IACH,eAAe,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,4EAA4E;IAC5E,uBAAuB,EAAE,MAAM,CAAC;IAChC,qEAAqE;IACrE,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;OAOG;IACH,wBAAwB,EAAE,MAAM,IAAI,CAAC;IACrC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,eAAwB,EACxB,UAAiB,EACjB,sBAA0B,EAC1B,SAAS,EACT,WAAW,EACX,MAAM,EACN,aAAa,EACb,cAAc,EACd,cAAsB,GACvB,EAAE,uBAAuB,GAAG,sBAAsB,CA+4ClD"}
|
|
@@ -333,18 +333,26 @@ export function useSheetGestures({
|
|
|
333
333
|
// onDismiss() and sets `pending`; the host answers in the same update, so
|
|
334
334
|
// the first render afterwards says whether it took the close (its
|
|
335
335
|
// controlled state now says closed: the exit under way is the drag's) or
|
|
336
|
-
// refused it (a guarded onOpenChange left it open: the sheet snaps back
|
|
337
|
-
// the request is spent). Either way the flag is
|
|
338
|
-
// prev-prop pattern, and derived back to false
|
|
339
|
-
// again — so a later close from a control, Escape
|
|
340
|
-
// mistaken for a drag.
|
|
336
|
+
// refused it (a guarded onOpenChange left it open: the sheet snaps back,
|
|
337
|
+
// its scrim with it, and the request is spent). Either way the flag is
|
|
338
|
+
// settled during render, the prev-prop pattern, and derived back to false
|
|
339
|
+
// once the sheet is open again — so a later close from a control, Escape
|
|
340
|
+
// or code is never mistaken for a drag.
|
|
341
341
|
const [touchDragDismissal, setTouchDragDismissal] = useState(null);
|
|
342
|
+
// The render that spends a refused request counts it. The layout effect
|
|
343
|
+
// below answers each count.
|
|
344
|
+
const [refusedDismissalCount, setRefusedDismissalCount] = useState(0);
|
|
342
345
|
if (touchDragDismissal != null) {
|
|
343
346
|
if (touchDragDismissal.pending) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
347
|
+
if (isOpenRequested) {
|
|
348
|
+
setTouchDragDismissal(null);
|
|
349
|
+
setRefusedDismissalCount(count => count + 1);
|
|
350
|
+
} else {
|
|
351
|
+
setTouchDragDismissal({
|
|
352
|
+
isTouch: touchDragDismissal.isTouch,
|
|
353
|
+
pending: false
|
|
354
|
+
});
|
|
355
|
+
}
|
|
348
356
|
} else if (isOpenRequested) {
|
|
349
357
|
setTouchDragDismissal(null);
|
|
350
358
|
}
|
|
@@ -452,6 +460,24 @@ export function useSheetGestures({
|
|
|
452
460
|
hasFixedHeightRef.current = hasFixedHeight;
|
|
453
461
|
});
|
|
454
462
|
|
|
463
|
+
// The release cannot know whether the host takes the close. The host
|
|
464
|
+
// answers through `isOpenRequested` in the next render. Keep the left
|
|
465
|
+
// detent's scrim until then.
|
|
466
|
+
const restingScrimOpacityRef = useRef(null);
|
|
467
|
+
// Syncs the host's scrim (its backdrop, written through `onScrimOpacity`)
|
|
468
|
+
// with the panel's return to rest after a refusal: the panel rests on that
|
|
469
|
+
// detent again, so the scrim the drag thinned toward the dismiss line rests
|
|
470
|
+
// with it. The refusal changes none of the host's own scrim inputs, so the
|
|
471
|
+
// drag's last value would otherwise stand.
|
|
472
|
+
useLayoutEffect(() => {
|
|
473
|
+
const restingScrimOpacity = restingScrimOpacityRef.current;
|
|
474
|
+
if (refusedDismissalCount === 0 || restingScrimOpacity == null) {
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
restingScrimOpacityRef.current = null;
|
|
478
|
+
onScrimOpacityRef.current?.(restingScrimOpacity);
|
|
479
|
+
}, [refusedDismissalCount]);
|
|
480
|
+
|
|
455
481
|
// Live drag bookkeeping (refs so pointermove doesn't churn renders).
|
|
456
482
|
const dragStateRef = useRef(null);
|
|
457
483
|
|
|
@@ -770,6 +796,7 @@ export function useSheetGestures({
|
|
|
770
796
|
if (dir > 0 && projected > dismissOffset) {
|
|
771
797
|
if (canDismissRef.current) {
|
|
772
798
|
prepareScrollAreaSettle(baseLayoutOffset, baseOffset, baseLayoutOffset, baseLayoutOffset, baseLayoutOffset, naturalEndGap, false);
|
|
799
|
+
restingScrimOpacityRef.current = scrimOpacityForOffset(baseOffset, offsets, dismissOffset, peekOffset);
|
|
773
800
|
setTouchDragDismissal({
|
|
774
801
|
isTouch,
|
|
775
802
|
pending: true
|
package/dist/Icon/index.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export interface ComponentIconSlotMap {
|
|
|
62
62
|
'timestamp-copy': {
|
|
63
63
|
readonly copied: boolean;
|
|
64
64
|
};
|
|
65
|
+
/** A sortable Table column's sort indicator, by the column's sort direction. */
|
|
66
|
+
'table-sort-indicator': {
|
|
67
|
+
readonly direction: 'ascending' | 'descending' | 'none';
|
|
68
|
+
};
|
|
65
69
|
}
|
|
66
70
|
/** A slot name from the augmentable {@link ComponentIconSlotMap}. */
|
|
67
71
|
export type ComponentIconSlotName = keyof ComponentIconSlotMap & string;
|
package/dist/Icon/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Icon/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,cAAc;CAAG;AAElC,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AS,CAAC;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAC1C,GAAG,OAAO,CAUV;AAuOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,EACnB,EAAE,EAAE,SAAiB,EACrB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,UAAU,EACV,KAAgB,EAChB,OAAoB,EACpB,UAAU,EACV,gBAAgB,EAChB,MAAkB,EAClB,OAAO,EACP,cAAc,EACd,IAAI,EACJ,MAAM,EAAE,eAAe,EACvB,GAAG,EAAE,YAAY,EACjB,aAAqB,EACrB,UAAkB,EAClB,UAAkB,EAClB,YAAY,EACZ,aAAwB,EACxB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,IAAI,EACJ,GAAG,SAAS,EACb,EAAE,SAAS,+BA+aX;yBA3ce,IAAI"}
|
package/dist/Item/Item.js
CHANGED
|
@@ -331,6 +331,7 @@ export function Item({
|
|
|
331
331
|
});
|
|
332
332
|
useDevWarning('Item', '`interactiveRef` is mutually exclusive with `onClick`/`href`. In ' + 'delegation mode the row only forwards clicks to the referenced control, ' + 'so `onClick`/`href` are ignored. Drop one of them.', isDelegate && (onClick != null || href != null));
|
|
333
333
|
const isInteractive = onClick != null || href != null || isDelegate;
|
|
334
|
+
const hasStateFill = isHighlighted || isSelected;
|
|
334
335
|
const {
|
|
335
336
|
target,
|
|
336
337
|
rel
|
|
@@ -593,11 +594,17 @@ export function Item({
|
|
|
593
594
|
highlighted: isHighlighted ? 'highlighted' : null,
|
|
594
595
|
selected: isSelected ? 'selected' : null,
|
|
595
596
|
disabled: isDisabled ? 'disabled' : null
|
|
596
|
-
}), focusOutlineProps.focusWithin(styles.root, densityStyles[density], align === 'start' && styles.alignStart, align === 'first-line' && styles.alignFirstLine, isInteractive && styles.interactive,
|
|
597
|
+
}), focusOutlineProps.focusWithin(styles.root, densityStyles[density], align === 'start' && styles.alignStart, align === 'first-line' && styles.alignFirstLine, isInteractive && styles.interactive,
|
|
598
|
+
// A row with a state fill keeps the fill as its background colour.
|
|
599
|
+
// Its overlay paints as an image layer over the fill.
|
|
600
|
+
isInteractive && (hasStateFill ? interactionOverlayStyles.backgroundImage : interactionOverlayStyles.backgroundColor),
|
|
597
601
|
// The touch press on a compositor layer (after the overlay, whose
|
|
598
602
|
// own touch paint it turns off): the release keeps fading while
|
|
599
603
|
// script runs.
|
|
600
|
-
isInteractive && rowPressLayerStyles.cell,
|
|
604
|
+
isInteractive && rowPressLayerStyles.cell,
|
|
605
|
+
// A highlighted row's fill is already the hover tone, so it shows
|
|
606
|
+
// only its press. A selected row also shows its hover.
|
|
607
|
+
isInteractive && hasStateFill && (isSelected ? rowPressLayerStyles.cellOnImage : rowPressLayerStyles.cellOnImagePressOnly), isLinkRoot && styles.linkRoot, isHighlighted && styles.highlighted, isSelected && styles.selected, isDisabled && !hasParentRole && styles.disabled, hasSwipe && styles.swipeRoot, xstyle), className, style),
|
|
601
608
|
role: role,
|
|
602
609
|
onClick: rootOnClick,
|
|
603
610
|
children: [/*#__PURE__*/_jsx(ItemDescriptionContext, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableSortable.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/sortable/useTableSortable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTableSortable.d.ts","sourceRoot":"","sources":["../../../../src/Table/plugins/sortable/useTableSortable.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,aAAa,CAAC;AAarB;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,YAAY,CAAC;AAE5D;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IAC9D,2EAA2E;IAC3E,OAAO,EAAE,QAAQ,CAAC;IAClB,0BAA0B;IAC1B,SAAS,EAAE,kBAAkB,CAAC;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,IACzD,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;AAM7B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAsB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM;IACtE,iEAAiE;IACjE,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAE/B;;;OAGG;IACH,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IAEvD;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AA6ND;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAChC,MAAM,EAAE,sBAAsB,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CA2F1D"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTableSortable.tsx
|
|
7
|
-
* @input React, types, Icon, theme
|
|
7
|
+
* @input React, types, Icon, the theme's `table-sort-indicator` icon slot,
|
|
8
|
+
* theme tokens, i18n (useComponentTranslator)
|
|
8
9
|
* @output Exports useTableSortable hook and sort-related types
|
|
9
10
|
* @position Sortable plugin; consumed by Table via plugins prop
|
|
10
11
|
*
|
|
@@ -18,6 +19,7 @@ import "../../../theme/tokens.stylex.js";
|
|
|
18
19
|
import { colorVars, spacingVars, radiusVars } from "../../../theme/tokens.stylex.js";
|
|
19
20
|
import { focusOutlineProps } from "../../../utils/focusOutline.stylex.js";
|
|
20
21
|
import { Icon } from "../../../Icon/index.js";
|
|
22
|
+
import { ComponentIcon } from "../../../Icon/ComponentIcon.js";
|
|
21
23
|
import { resolveContextActions } from "../../tableContextMenu.js";
|
|
22
24
|
import { registerEnglishFallback, useComponentTranslator } from "../../../i18n/useComponentTranslator.js";
|
|
23
25
|
import english from "../../../i18n/generated-english/Table/plugins/sortable/useTableSortable.generated.js";
|
|
@@ -149,7 +151,7 @@ function SortHeaderButton({
|
|
|
149
151
|
const direction = entry?.direction ?? null;
|
|
150
152
|
const isMultiSort = config.isMultiSortEnabled === true && config.sort.length > 1;
|
|
151
153
|
const rank = isMultiSort && entryIndex >= 0 ? entryIndex + 1 : null;
|
|
152
|
-
const
|
|
154
|
+
const indicator = direction === 'ascending' ? 'arrowUp' : direction === 'descending' ? 'arrowDown' : 'arrowsUpDown';
|
|
153
155
|
|
|
154
156
|
// The button is named by its column's text, so the column header keeps
|
|
155
157
|
// that name; direction lives in the header's aria-sort. Only the multi-sort
|
|
@@ -210,15 +212,21 @@ function SortHeaderButton({
|
|
|
210
212
|
}), /*#__PURE__*/_jsx("span", {
|
|
211
213
|
...{
|
|
212
214
|
0: {
|
|
213
|
-
className: "x3nfvp2
|
|
215
|
+
className: "x3nfvp2 xjl7jj x6s0dn4 xqtp20y"
|
|
214
216
|
},
|
|
215
217
|
1: {
|
|
216
|
-
className: "x3nfvp2"
|
|
218
|
+
className: "x3nfvp2 xjl7jj x6s0dn4 xqtp20y x3onkmb xof6bs x25t5g8"
|
|
217
219
|
}
|
|
218
|
-
}[!!(direction
|
|
219
|
-
children: /*#__PURE__*/_jsx(
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
}[!!(direction == null) << 0],
|
|
221
|
+
children: /*#__PURE__*/_jsx(ComponentIcon, {
|
|
222
|
+
slot: "table-sort-indicator",
|
|
223
|
+
state: {
|
|
224
|
+
direction: direction ?? 'none'
|
|
225
|
+
},
|
|
226
|
+
fallback: {
|
|
227
|
+
icon: indicator,
|
|
228
|
+
size: 'xsm'
|
|
229
|
+
},
|
|
222
230
|
color: direction != null ? 'accent' : 'secondary'
|
|
223
231
|
})
|
|
224
232
|
}), rank != null && /*#__PURE__*/_jsx("span", {
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @input StyleX, the overlay color tokens, the touch press strength
|
|
4
4
|
* (`pressVars`) and the row layer's clocks (utils/rowPressLayer.stylex.ts)
|
|
5
5
|
* @output `rowPressLayerStyles`, the compositor press layer for list rows
|
|
6
|
-
* (`cell`, `cellOnImage` for a `backgroundImage` row
|
|
6
|
+
* (`cell`, `cellOnImage` for a `backgroundImage` row,
|
|
7
|
+
* `cellOnImagePressOnly` for a row whose fill is the hover tone), and
|
|
7
8
|
* `rowPressPaintStyles`, a CheckboxList row's press paint for its box
|
|
8
9
|
* @position Owner module of the private press attribute: the press controller
|
|
9
10
|
* (utils/pressFeedback.ts) writes it, and this file reads it. No package
|
|
@@ -133,6 +134,9 @@ export declare const rowPressLayerStyles: Readonly<{
|
|
|
133
134
|
readonly cellOnImage: Readonly<{
|
|
134
135
|
readonly backgroundImage: stylex.StyleXClassNameFor<"backgroundImage", string | null>;
|
|
135
136
|
}>;
|
|
137
|
+
readonly cellOnImagePressOnly: Readonly<{
|
|
138
|
+
readonly backgroundImage: stylex.StyleXClassNameFor<"backgroundImage", string | null>;
|
|
139
|
+
}>;
|
|
136
140
|
}>;
|
|
137
141
|
export declare const rowPressPaintStyles: Readonly<{
|
|
138
142
|
readonly checkboxRow: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"press.stylex.d.ts","sourceRoot":"","sources":["../../src/privateAttributes/press.stylex.ts"],"names":[],"mappings":"AAKA
|
|
1
|
+
{"version":3,"file":"press.stylex.d.ts","sourceRoot":"","sources":["../../src/privateAttributes/press.stylex.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAqD3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8L9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;EAgB9B,CAAC"}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* @input StyleX, the overlay color tokens, the touch press strength
|
|
9
9
|
* (`pressVars`) and the row layer's clocks (utils/rowPressLayer.stylex.ts)
|
|
10
10
|
* @output `rowPressLayerStyles`, the compositor press layer for list rows
|
|
11
|
-
* (`cell`, `cellOnImage` for a `backgroundImage` row
|
|
11
|
+
* (`cell`, `cellOnImage` for a `backgroundImage` row,
|
|
12
|
+
* `cellOnImagePressOnly` for a row whose fill is the hover tone), and
|
|
12
13
|
* `rowPressPaintStyles`, a CheckboxList row's press paint for its box
|
|
13
14
|
* @position Owner module of the private press attribute: the press controller
|
|
14
15
|
* (utils/pressFeedback.ts) writes it, and this file reads it. No package
|
|
@@ -91,6 +92,10 @@ export const rowPressLayerStyles = {
|
|
|
91
92
|
cellOnImage: {
|
|
92
93
|
kKwaWg: "x7uyq82 x3f84ok x7ngsy6 x10ogxw0 xubczrd x18xnkjv xmvprkv xetgvay",
|
|
93
94
|
$$css: true
|
|
95
|
+
},
|
|
96
|
+
cellOnImagePressOnly: {
|
|
97
|
+
kKwaWg: "x7uyq82 x3f84ok x7ngsy6 x10ogxw0 xubczrd x18xnkjv",
|
|
98
|
+
$$css: true
|
|
94
99
|
}
|
|
95
100
|
};
|
|
96
101
|
export const rowPressPaintStyles = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.9-canary.
|
|
3
|
+
"version": "0.7.9-canary.dd5ca29",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -880,9 +880,9 @@
|
|
|
880
880
|
"react-dom": ">=19.0.0"
|
|
881
881
|
},
|
|
882
882
|
"devDependencies": {
|
|
883
|
-
"@astryxdesign/a11y-spec": "0.7.9-canary.
|
|
884
|
-
"@astryxdesign/cli": "0.7.9-canary.
|
|
885
|
-
"@astryxdesign/interaction-harness": "0.7.9-canary.
|
|
883
|
+
"@astryxdesign/a11y-spec": "0.7.9-canary.dd5ca29",
|
|
884
|
+
"@astryxdesign/cli": "0.7.9-canary.dd5ca29",
|
|
885
|
+
"@astryxdesign/interaction-harness": "0.7.9-canary.dd5ca29",
|
|
886
886
|
"@babel/cli": "^7.29.7",
|
|
887
887
|
"@babel/core": "^7.29.7",
|
|
888
888
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -560,22 +560,29 @@ export function useSheetGestures({
|
|
|
560
560
|
// onDismiss() and sets `pending`; the host answers in the same update, so
|
|
561
561
|
// the first render afterwards says whether it took the close (its
|
|
562
562
|
// controlled state now says closed: the exit under way is the drag's) or
|
|
563
|
-
// refused it (a guarded onOpenChange left it open: the sheet snaps back
|
|
564
|
-
// the request is spent). Either way the flag is
|
|
565
|
-
// prev-prop pattern, and derived back to false
|
|
566
|
-
// again — so a later close from a control, Escape
|
|
567
|
-
// mistaken for a drag.
|
|
563
|
+
// refused it (a guarded onOpenChange left it open: the sheet snaps back,
|
|
564
|
+
// its scrim with it, and the request is spent). Either way the flag is
|
|
565
|
+
// settled during render, the prev-prop pattern, and derived back to false
|
|
566
|
+
// once the sheet is open again — so a later close from a control, Escape
|
|
567
|
+
// or code is never mistaken for a drag.
|
|
568
568
|
const [touchDragDismissal, setTouchDragDismissal] = useState<{
|
|
569
569
|
isTouch: boolean;
|
|
570
570
|
pending: boolean;
|
|
571
571
|
} | null>(null);
|
|
572
|
+
// The render that spends a refused request counts it. The layout effect
|
|
573
|
+
// below answers each count.
|
|
574
|
+
const [refusedDismissalCount, setRefusedDismissalCount] = useState(0);
|
|
572
575
|
if (touchDragDismissal != null) {
|
|
573
576
|
if (touchDragDismissal.pending) {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
577
|
+
if (isOpenRequested) {
|
|
578
|
+
setTouchDragDismissal(null);
|
|
579
|
+
setRefusedDismissalCount(count => count + 1);
|
|
580
|
+
} else {
|
|
581
|
+
setTouchDragDismissal({
|
|
582
|
+
isTouch: touchDragDismissal.isTouch,
|
|
583
|
+
pending: false,
|
|
584
|
+
});
|
|
585
|
+
}
|
|
579
586
|
} else if (isOpenRequested) {
|
|
580
587
|
setTouchDragDismissal(null);
|
|
581
588
|
}
|
|
@@ -712,6 +719,24 @@ export function useSheetGestures({
|
|
|
712
719
|
hasFixedHeightRef.current = hasFixedHeight;
|
|
713
720
|
});
|
|
714
721
|
|
|
722
|
+
// The release cannot know whether the host takes the close. The host
|
|
723
|
+
// answers through `isOpenRequested` in the next render. Keep the left
|
|
724
|
+
// detent's scrim until then.
|
|
725
|
+
const restingScrimOpacityRef = useRef<number | null>(null);
|
|
726
|
+
// Syncs the host's scrim (its backdrop, written through `onScrimOpacity`)
|
|
727
|
+
// with the panel's return to rest after a refusal: the panel rests on that
|
|
728
|
+
// detent again, so the scrim the drag thinned toward the dismiss line rests
|
|
729
|
+
// with it. The refusal changes none of the host's own scrim inputs, so the
|
|
730
|
+
// drag's last value would otherwise stand.
|
|
731
|
+
useLayoutEffect(() => {
|
|
732
|
+
const restingScrimOpacity = restingScrimOpacityRef.current;
|
|
733
|
+
if (refusedDismissalCount === 0 || restingScrimOpacity == null) {
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
restingScrimOpacityRef.current = null;
|
|
737
|
+
onScrimOpacityRef.current?.(restingScrimOpacity);
|
|
738
|
+
}, [refusedDismissalCount]);
|
|
739
|
+
|
|
715
740
|
// Live drag bookkeeping (refs so pointermove doesn't churn renders).
|
|
716
741
|
const dragStateRef = useRef<{
|
|
717
742
|
// Whether the touch path drives this drag. Such a drag holds no pointer
|
|
@@ -1169,6 +1194,12 @@ export function useSheetGestures({
|
|
|
1169
1194
|
naturalEndGap,
|
|
1170
1195
|
false,
|
|
1171
1196
|
);
|
|
1197
|
+
restingScrimOpacityRef.current = scrimOpacityForOffset(
|
|
1198
|
+
baseOffset,
|
|
1199
|
+
offsets,
|
|
1200
|
+
dismissOffset,
|
|
1201
|
+
peekOffset,
|
|
1202
|
+
);
|
|
1172
1203
|
setTouchDragDismissal({isTouch, pending: true});
|
|
1173
1204
|
onDismissRef.current();
|
|
1174
1205
|
} else {
|
package/src/Icon/index.ts
CHANGED
|
@@ -66,6 +66,10 @@ export interface ComponentIconSlotMap {
|
|
|
66
66
|
'code-block-copy': {readonly copied: boolean};
|
|
67
67
|
/** A Timestamp hover card row's copy button. `copied` is true while the copied feedback shows. */
|
|
68
68
|
'timestamp-copy': {readonly copied: boolean};
|
|
69
|
+
/** A sortable Table column's sort indicator, by the column's sort direction. */
|
|
70
|
+
'table-sort-indicator': {
|
|
71
|
+
readonly direction: 'ascending' | 'descending' | 'none';
|
|
72
|
+
};
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
/** A slot name from the augmentable {@link ComponentIconSlotMap}. */
|
package/src/Item/Item.tsx
CHANGED
|
@@ -692,6 +692,7 @@ export function Item({
|
|
|
692
692
|
);
|
|
693
693
|
|
|
694
694
|
const isInteractive = onClick != null || href != null || isDelegate;
|
|
695
|
+
const hasStateFill = isHighlighted || isSelected;
|
|
695
696
|
const {target, rel} = computeTargetAndRel(targetFromProps, relFromProps);
|
|
696
697
|
// When a semantic role is provided (e.g. "menuitem"), a parent component
|
|
697
698
|
// handles keyboard access. Skip the invisible button/anchor and put
|
|
@@ -1019,11 +1020,23 @@ export function Item({
|
|
|
1019
1020
|
align === 'start' && styles.alignStart,
|
|
1020
1021
|
align === 'first-line' && styles.alignFirstLine,
|
|
1021
1022
|
isInteractive && styles.interactive,
|
|
1022
|
-
|
|
1023
|
+
// A row with a state fill keeps the fill as its background colour.
|
|
1024
|
+
// Its overlay paints as an image layer over the fill.
|
|
1025
|
+
isInteractive &&
|
|
1026
|
+
(hasStateFill
|
|
1027
|
+
? interactionOverlayStyles.backgroundImage
|
|
1028
|
+
: interactionOverlayStyles.backgroundColor),
|
|
1023
1029
|
// The touch press on a compositor layer (after the overlay, whose
|
|
1024
1030
|
// own touch paint it turns off): the release keeps fading while
|
|
1025
1031
|
// script runs.
|
|
1026
1032
|
isInteractive && rowPressLayerStyles.cell,
|
|
1033
|
+
// A highlighted row's fill is already the hover tone, so it shows
|
|
1034
|
+
// only its press. A selected row also shows its hover.
|
|
1035
|
+
isInteractive &&
|
|
1036
|
+
hasStateFill &&
|
|
1037
|
+
(isSelected
|
|
1038
|
+
? rowPressLayerStyles.cellOnImage
|
|
1039
|
+
: rowPressLayerStyles.cellOnImagePressOnly),
|
|
1027
1040
|
isLinkRoot && styles.linkRoot,
|
|
1028
1041
|
isHighlighted && styles.highlighted,
|
|
1029
1042
|
isSelected && styles.selected,
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').HookDoc} */
|
|
4
|
+
export const docs = {
|
|
5
|
+
name: 'useOverlay',
|
|
6
|
+
displayName: 'useOverlay',
|
|
7
|
+
group: 'Overlay',
|
|
8
|
+
keywords: [
|
|
9
|
+
'overlay',
|
|
10
|
+
'scrim',
|
|
11
|
+
'hover reveal',
|
|
12
|
+
'focus-within',
|
|
13
|
+
'quick view',
|
|
14
|
+
'card actions',
|
|
15
|
+
'media overlay',
|
|
16
|
+
],
|
|
17
|
+
params: [
|
|
18
|
+
{
|
|
19
|
+
name: 'options',
|
|
20
|
+
type: 'UseOverlayOptions',
|
|
21
|
+
description: 'Overlay configuration. Every field is optional.',
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'options.content',
|
|
26
|
+
type: 'ReactNode',
|
|
27
|
+
description:
|
|
28
|
+
'Content to render inside the scrim. When set, the hook returns it pre-rendered as element.',
|
|
29
|
+
required: false,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'options.showOn',
|
|
33
|
+
type: "'hover' | 'always' | 'focus' | 'hover-or-focus'",
|
|
34
|
+
description:
|
|
35
|
+
"Visibility trigger, read with CSS from the container. 'hover' also reveals on focus within the container for keyboard users; 'hover-or-focus' is an alias for it. On a touch device (hover: none), a hover overlay toggles on a tap on the container instead.",
|
|
36
|
+
default: "'always'",
|
|
37
|
+
required: false,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'options.isOpen',
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
description:
|
|
43
|
+
'Controlled visibility. When set, it takes precedence over showOn and the touch toggle.',
|
|
44
|
+
required: false,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'options.scrim',
|
|
48
|
+
type: "'dark' | 'light' | false",
|
|
49
|
+
description:
|
|
50
|
+
'Scrim background. false renders the content with no scrim background.',
|
|
51
|
+
default: "'dark'",
|
|
52
|
+
required: false,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'options.position',
|
|
56
|
+
type: "'fill' | 'bottom' | 'top'",
|
|
57
|
+
description:
|
|
58
|
+
'Where the scrim sits: over the whole positioned area, or as a strip along its bottom or top edge.',
|
|
59
|
+
default: "'fill'",
|
|
60
|
+
required: false,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'options.align',
|
|
64
|
+
type: "'start' | 'center' | 'end'",
|
|
65
|
+
description: 'Alignment of the content within the scrim.',
|
|
66
|
+
default: "'end'",
|
|
67
|
+
required: false,
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
returns: [
|
|
71
|
+
{
|
|
72
|
+
name: 'containerRef',
|
|
73
|
+
type: 'RefObject<HTMLElement | null>',
|
|
74
|
+
description: 'Attach to the container element.',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'containerProps',
|
|
78
|
+
type: 'OverlayContainerProps',
|
|
79
|
+
description:
|
|
80
|
+
'Spread on the same container: className and style mark it as the overlay scope (positioned, clipped), and on a touch device with a hover overlay onClick and onMouseUp toggle it on a tap.',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'element',
|
|
84
|
+
type: 'ReactElement | null',
|
|
85
|
+
description:
|
|
86
|
+
'The scrim with options.content, ready to render once inside the container. null when content is not set.',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'renderOverlay',
|
|
90
|
+
type: '(children: ReactNode) => ReactElement',
|
|
91
|
+
description:
|
|
92
|
+
'Renders the scrim around the children you pass, for content that changes or a scrim you mount yourself. Use it or element, not both.',
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
usage: {
|
|
96
|
+
description:
|
|
97
|
+
"Adds overlay behavior to a container you already render, such as a Card or a custom media frame, without the wrapper Overlay adds. Spread containerRef and containerProps on the container, then render element (or renderOverlay(children)) once inside it. The scrim is absolutely positioned, so it covers the nearest positioned ancestor: the container itself, or a positioned section inside it such as an image area. Visibility is CSS-driven from the container's :hover and :focus-within, so with showOn 'hover' a keyboard user reveals the content by moving focus into the container. Hidden content is not focusable, so the container needs a focusable element before the overlay content in tab order. A revealed scrim takes pointer input over the area it covers, so put that element outside the scrim, or use a top or bottom strip and keep it in the part the strip leaves uncovered.",
|
|
98
|
+
bestPractices: [
|
|
99
|
+
{
|
|
100
|
+
guidance: true,
|
|
101
|
+
description:
|
|
102
|
+
"Use showOn 'hover' for actions on media cards: it also reveals on keyboard focus within the container.",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
guidance: true,
|
|
106
|
+
description:
|
|
107
|
+
'Put a focusable element (a link or the card title) before the overlay content in the container, so Tab reveals the content and the next Tab reaches it.',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
guidance: true,
|
|
111
|
+
description:
|
|
112
|
+
'Use the Overlay component when you do not already have a container element to attach to.',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
guidance: false,
|
|
116
|
+
description:
|
|
117
|
+
'Put the only way to reach an action behind hover with nothing focusable before it; keyboard users cannot focus content that is hidden.',
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
relatedComponents: ['Overlay', 'Card', 'AspectRatio'],
|
|
122
|
+
relatedHooks: ['useClickableContainer'],
|
|
123
|
+
importPath: '@astryxdesign/core/Overlay',
|
|
124
|
+
category: 'interaction',
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
/** @type {import('@astryxdesign/cli/authoring').HookTranslationDoc} */
|
|
128
|
+
export const docsDense = {
|
|
129
|
+
description:
|
|
130
|
+
"Overlay behavior on a container you already render (Card, media frame) w/o Overlay's wrapper. Spread containerRef + containerProps on it, render element / renderOverlay(children) once inside. CSS-driven via container :hover/:focus-within; hover mode also reveals on keyboard focus. Hidden content is not focusable, so put a focusable element before it, outside the area a revealed scrim covers (the scrim takes pointer input).",
|
|
131
|
+
paramDescriptions: {
|
|
132
|
+
options: 'overlay config; all fields optional.',
|
|
133
|
+
'options.content':
|
|
134
|
+
'content inside the scrim; returned pre-rendered as element.',
|
|
135
|
+
'options.showOn':
|
|
136
|
+
"CSS visibility trigger. 'hover' also reveals on focus-within; 'hover-or-focus' = alias. Touch (hover: none): hover overlays toggle on tap.",
|
|
137
|
+
'options.isOpen': 'controlled visibility; wins over showOn + touch toggle.',
|
|
138
|
+
'options.scrim': 'scrim background; false = no background.',
|
|
139
|
+
'options.position': "scrim placement: 'fill', or a 'bottom' / 'top' strip.",
|
|
140
|
+
'options.align': 'content alignment in the scrim.',
|
|
141
|
+
},
|
|
142
|
+
returnDescriptions: {
|
|
143
|
+
containerRef: 'attach to the container.',
|
|
144
|
+
containerProps:
|
|
145
|
+
'spread on the container: overlay scope className/style (positioned, clipped) + tap toggle handlers for hover overlays on touch devices.',
|
|
146
|
+
element:
|
|
147
|
+
'scrim with content, render once inside the container; null w/o content.',
|
|
148
|
+
renderOverlay:
|
|
149
|
+
'(children) => scrim; for dynamic content or self-mounted scrim. Use it or element.',
|
|
150
|
+
},
|
|
151
|
+
usage: {
|
|
152
|
+
description:
|
|
153
|
+
'Overlay behavior on an existing container: spread containerRef + containerProps, render element once inside. Scrim covers nearest positioned ancestor. CSS :hover/:focus-within; hover mode reveals on keyboard focus too. Put a focusable element before hidden content.',
|
|
154
|
+
bestPractices: [
|
|
155
|
+
{
|
|
156
|
+
guidance: true,
|
|
157
|
+
description:
|
|
158
|
+
"showOn 'hover' for media card actions; also reveals on keyboard focus.",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
guidance: true,
|
|
162
|
+
description:
|
|
163
|
+
'Put a focusable element before the overlay content so Tab reveals it, next Tab reaches it.',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
guidance: true,
|
|
167
|
+
description: 'Use Overlay when there is no container to attach to.',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
guidance: false,
|
|
171
|
+
description:
|
|
172
|
+
'Hide the only route to an action behind hover with nothing focusable before it.',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
};
|
package/src/Table/Table.doc.mjs
CHANGED
|
@@ -143,6 +143,25 @@ export const docs = {
|
|
|
143
143
|
{className: 'astryx-table-cell', visualProps: ['density']},
|
|
144
144
|
{className: 'astryx-table-header-cell', visualProps: ['density']},
|
|
145
145
|
],
|
|
146
|
+
componentIcons: [
|
|
147
|
+
{
|
|
148
|
+
slot: 'table-sort-indicator',
|
|
149
|
+
description:
|
|
150
|
+
"The sort direction glyph beside a sortable column's label (`useTableSortable`).",
|
|
151
|
+
fallback:
|
|
152
|
+
'`arrowUp` ascending; `arrowDown` descending; `arrowsUpDown` unsorted',
|
|
153
|
+
state: [
|
|
154
|
+
{
|
|
155
|
+
name: 'direction',
|
|
156
|
+
type: "'ascending' | 'descending' | 'none'",
|
|
157
|
+
description:
|
|
158
|
+
"The column's sort direction; `none` while the column is not sorted.",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
whenNull:
|
|
162
|
+
'Hides the glyph. The Sort control keeps its label and its click and keyboard sorting; the column header keeps `aria-sort`.',
|
|
163
|
+
},
|
|
164
|
+
],
|
|
146
165
|
},
|
|
147
166
|
description:
|
|
148
167
|
'Styled, data-driven table with density, dividers, hover highlight, striped rows, and named plugin support. T must extend Record<string, unknown>.',
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTableSortable.tsx
|
|
7
|
-
* @input React, types, Icon, theme
|
|
7
|
+
* @input React, types, Icon, the theme's `table-sort-indicator` icon slot,
|
|
8
|
+
* theme tokens, i18n (useComponentTranslator)
|
|
8
9
|
* @output Exports useTableSortable hook and sort-related types
|
|
9
10
|
* @position Sortable plugin; consumed by Table via plugins prop
|
|
10
11
|
*
|
|
@@ -18,6 +19,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
18
19
|
import {colorVars, spacingVars, radiusVars} from '../../../theme/tokens.stylex';
|
|
19
20
|
import {focusOutlineProps} from '../../../utils/focusOutline.stylex';
|
|
20
21
|
import {Icon} from '../../../Icon';
|
|
22
|
+
import {ComponentIcon} from '../../../Icon/ComponentIcon';
|
|
21
23
|
import {resolveContextActions} from '../../tableContextMenu';
|
|
22
24
|
import type {
|
|
23
25
|
TablePlugin,
|
|
@@ -153,17 +155,22 @@ const sortStyles = stylex.create({
|
|
|
153
155
|
buttonAlignEnd: {
|
|
154
156
|
justifyContent: 'flex-end',
|
|
155
157
|
},
|
|
158
|
+
// The wrapper takes no block size, so a theme's larger glyph overflows it
|
|
159
|
+
// instead of growing the Sort control or the header row. When the slot
|
|
160
|
+
// hides the glyph, the empty wrapper collapses, so the button's gap does
|
|
161
|
+
// not offset an end-aligned label.
|
|
162
|
+
iconWrapper: {
|
|
163
|
+
display: {default: 'inline-flex', ':empty': 'none'},
|
|
164
|
+
alignItems: 'center',
|
|
165
|
+
blockSize: 0,
|
|
166
|
+
},
|
|
156
167
|
iconWrapperUnsorted: {
|
|
157
|
-
display: 'inline-flex',
|
|
158
168
|
opacity: {
|
|
159
169
|
default: 0.35,
|
|
160
170
|
':is(th:hover *)': 1,
|
|
161
171
|
':focus-visible': 1,
|
|
162
172
|
},
|
|
163
173
|
},
|
|
164
|
-
iconWrapperActive: {
|
|
165
|
-
display: 'inline-flex',
|
|
166
|
-
},
|
|
167
174
|
rank: {
|
|
168
175
|
fontSize: 10,
|
|
169
176
|
// eslint-disable-next-line @astryx/no-hardcoded-styles -- no token for lineHeight:1 (tight badge)
|
|
@@ -227,7 +234,7 @@ function SortHeaderButton<T extends Record<string, unknown>>({
|
|
|
227
234
|
config.isMultiSortEnabled === true && config.sort.length > 1;
|
|
228
235
|
const rank = isMultiSort && entryIndex >= 0 ? entryIndex + 1 : null;
|
|
229
236
|
|
|
230
|
-
const
|
|
237
|
+
const indicator =
|
|
231
238
|
direction === 'ascending'
|
|
232
239
|
? 'arrowUp'
|
|
233
240
|
: direction === 'descending'
|
|
@@ -299,13 +306,13 @@ function SortHeaderButton<T extends Record<string, unknown>>({
|
|
|
299
306
|
<span>{children}</span>
|
|
300
307
|
<span
|
|
301
308
|
{...stylex.props(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
: sortStyles.iconWrapperUnsorted,
|
|
309
|
+
sortStyles.iconWrapper,
|
|
310
|
+
direction == null && sortStyles.iconWrapperUnsorted,
|
|
305
311
|
)}>
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
312
|
+
<ComponentIcon
|
|
313
|
+
slot="table-sort-indicator"
|
|
314
|
+
state={{direction: direction ?? 'none'}}
|
|
315
|
+
fallback={{icon: indicator, size: 'xsm'}}
|
|
309
316
|
color={direction != null ? 'accent' : 'secondary'}
|
|
310
317
|
/>
|
|
311
318
|
</span>
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* @input StyleX, the overlay color tokens, the touch press strength
|
|
9
9
|
* (`pressVars`) and the row layer's clocks (utils/rowPressLayer.stylex.ts)
|
|
10
10
|
* @output `rowPressLayerStyles`, the compositor press layer for list rows
|
|
11
|
-
* (`cell`, `cellOnImage` for a `backgroundImage` row
|
|
11
|
+
* (`cell`, `cellOnImage` for a `backgroundImage` row,
|
|
12
|
+
* `cellOnImagePressOnly` for a row whose fill is the hover tone), and
|
|
12
13
|
* `rowPressPaintStyles`, a CheckboxList row's press paint for its box
|
|
13
14
|
* @position Owner module of the private press attribute: the press controller
|
|
14
15
|
* (utils/pressFeedback.ts) writes it, and this file reads it. No package
|
|
@@ -240,6 +241,25 @@ export const rowPressLayerStyles = stylex.create({
|
|
|
240
241
|
},
|
|
241
242
|
},
|
|
242
243
|
},
|
|
244
|
+
/**
|
|
245
|
+
* `cellOnImage` without the hover arm, for a row whose fill is already the
|
|
246
|
+
* hover tone (a highlighted Item row). A hover layer on it would match a
|
|
247
|
+
* pressed row, so the row shows only its press.
|
|
248
|
+
*/
|
|
249
|
+
cellOnImagePressOnly: {
|
|
250
|
+
backgroundImage: {
|
|
251
|
+
default: null,
|
|
252
|
+
[ENABLED]: {
|
|
253
|
+
default: null,
|
|
254
|
+
':active': {
|
|
255
|
+
default: pressedImage,
|
|
256
|
+
[COARSE]: 'none',
|
|
257
|
+
},
|
|
258
|
+
[PRESSED_ON]: {default: pressedOverlayImage, [COARSE]: 'none'},
|
|
259
|
+
[PRESSED_FADING]: {default: pressedOverlayImage, [COARSE]: 'none'},
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
},
|
|
243
263
|
});
|
|
244
264
|
|
|
245
265
|
export const rowPressPaintStyles = stylex.create({
|