@astryxdesign/core 0.7.9-canary.53fa237 → 0.7.9-canary.5f81c3f
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.js +2 -2
- package/dist/CheckboxInput/CheckboxInput.d.ts +2 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +25 -7
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts +2 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.d.ts.map +1 -0
- package/dist/CheckboxInput/CheckboxRowPressContext.js +20 -0
- package/dist/CheckboxList/CheckboxListItem.d.ts +2 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +40 -14
- package/dist/astryx.css +7 -0
- package/dist/hooks/computeOverflow.d.ts +2 -0
- package/dist/hooks/computeOverflow.d.ts.map +1 -1
- package/dist/hooks/computeOverflow.js +1 -1
- package/dist/hooks/useMediaQuery.d.ts +2 -1
- package/dist/hooks/useMediaQuery.d.ts.map +1 -1
- package/dist/hooks/useMediaQuery.js +37 -12
- package/dist/hooks/useOverflow.d.ts.map +1 -1
- package/dist/hooks/useOverflow.js +190 -21
- package/dist/privateAttributes/press.stylex.d.ts +14 -11
- package/dist/privateAttributes/press.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/press.stylex.js +15 -11
- package/dist/utils/coarsePointer.d.ts +5 -0
- package/dist/utils/coarsePointer.d.ts.map +1 -1
- package/dist/utils/coarsePointer.js +22 -13
- package/package.json +4 -4
- package/src/BottomSheet/useSheetGestures.ts +2 -2
- package/src/CheckboxInput/CheckboxInput.doc.mjs +2 -2
- package/src/CheckboxInput/CheckboxInput.tsx +42 -11
- package/src/CheckboxInput/CheckboxRowPressContext.ts +22 -0
- package/src/CheckboxList/CheckboxList.doc.mjs +9 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +3 -3
- package/src/CheckboxList/CheckboxListItem.tsx +35 -14
- package/src/hooks/computeOverflow.ts +1 -1
- package/src/hooks/useMediaQuery.ts +41 -12
- package/src/hooks/useOverflow.ts +297 -73
- package/src/privateAttributes/press.stylex.ts +27 -11
- package/src/utils/coarsePointer.ts +27 -14
|
@@ -94,8 +94,8 @@ function touchPointerType(touch) {
|
|
|
94
94
|
return touch.touchType === 'stylus' ? 'pen' : 'touch';
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// A mouse's stretch past fully open: a resisted fraction of the
|
|
98
|
-
// at OVERSCROLL_MAX.
|
|
97
|
+
// A mouse's or a pen's stretch past fully open: a resisted fraction of the
|
|
98
|
+
// drag, capped at OVERSCROLL_MAX.
|
|
99
99
|
const OVERSCROLL_RESISTANCE = 0.35;
|
|
100
100
|
// SYNC: must not exceed MIN_RESERVE in BottomSheetPanel.tsx, the smallest
|
|
101
101
|
// reserve the sheet keeps below the screen.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file CheckboxInput.tsx
|
|
3
|
-
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip
|
|
3
|
+
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip,
|
|
4
|
+
* CheckboxRowPressContext (a row around the checkbox that owns its press)
|
|
4
5
|
* @output Exports CheckboxInput component, CheckboxInputProps
|
|
5
6
|
* @position Core implementation; consumed by index.ts, tested by CheckboxInput.test.tsx
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"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"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CheckboxInput.tsx
|
|
7
|
-
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip
|
|
7
|
+
* @input Uses React, useId, ChangeEvent, FieldLabel, FieldStatus, IconType, InputStatus, useTooltip,
|
|
8
|
+
* CheckboxRowPressContext (a row around the checkbox that owns its press)
|
|
8
9
|
* @output Exports CheckboxInput component, CheckboxInputProps
|
|
9
10
|
* @position Core implementation; consumed by index.ts, tested by CheckboxInput.test.tsx
|
|
10
11
|
*
|
|
@@ -15,7 +16,7 @@
|
|
|
15
16
|
* - /apps/storybook/stories/CheckboxInput.stories.tsx (storybook stories)
|
|
16
17
|
* - /packages/cli/assets/templates/blocks/components/CheckboxInput/ (showcase blocks)
|
|
17
18
|
*/
|
|
18
|
-
import { useId, useCallback, useOptimistic, useRef, useTransition } from 'react';
|
|
19
|
+
import { use, useId, useCallback, useOptimistic, useRef, useTransition } from 'react';
|
|
19
20
|
import * as stylex from '@stylexjs/stylex';
|
|
20
21
|
import "../theme/tokens.stylex.js";
|
|
21
22
|
import { colorVars, spacingVars, radiusVars, typographyVars, typeScaleVars, fontWeightVars } from "../theme/tokens.stylex.js";
|
|
@@ -40,6 +41,7 @@ import { useTouchHitArea } from "../utils/touchHitArea.js";
|
|
|
40
41
|
import { touchHitAreaStyles } from "../utils/touchHitArea.stylex.js";
|
|
41
42
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
42
43
|
import english from "../i18n/generated-english/CheckboxInput/CheckboxInput.generated.js";
|
|
44
|
+
import { CheckboxRowPressContext } from "./CheckboxRowPressContext.js";
|
|
43
45
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
44
46
|
registerEnglishFallback(english);
|
|
45
47
|
|
|
@@ -72,6 +74,10 @@ const styles = {
|
|
|
72
74
|
"--_indicator-press-image": "x1dueop1 x189o2zt",
|
|
73
75
|
$$css: true
|
|
74
76
|
},
|
|
77
|
+
indicatorRowPressImage: {
|
|
78
|
+
"--_indicator-press-image": "x1y1g3jp",
|
|
79
|
+
$$css: true
|
|
80
|
+
},
|
|
75
81
|
checkboxWrapper: {
|
|
76
82
|
kVAEAm: "x1n2onr6",
|
|
77
83
|
k1xSpc: "x78zum5",
|
|
@@ -91,6 +97,10 @@ const styles = {
|
|
|
91
97
|
kNctxI: "x1ikgzpo xsozn46",
|
|
92
98
|
$$css: true
|
|
93
99
|
},
|
|
100
|
+
indicatorRowPressOverlay: {
|
|
101
|
+
kNctxI: "xlvbopx",
|
|
102
|
+
$$css: true
|
|
103
|
+
},
|
|
94
104
|
input: {
|
|
95
105
|
kVAEAm: "x10l6tqk",
|
|
96
106
|
k87sOh: "xwa60dl",
|
|
@@ -182,6 +192,13 @@ export function CheckboxInput({
|
|
|
182
192
|
// The row is the pressable: the overlay's pressed arm reads the row's
|
|
183
193
|
// scope marker, the way the indicator's hover tint does.
|
|
184
194
|
const pressable = usePressFeedback();
|
|
195
|
+
// A row around the checkbox that answers a press anywhere on it (a
|
|
196
|
+
// CheckboxListItem) owns the touch press instead. The checkbox then carries
|
|
197
|
+
// no press marker of its own. So the controller's innermost-wins rule finds
|
|
198
|
+
// the row for a finger on the label, the description or the box. The
|
|
199
|
+
// overlay below paints that row's press.
|
|
200
|
+
const isRowPressSurface = use(CheckboxRowPressContext);
|
|
201
|
+
const ownsPress = !isDisabled && !isRowPressSurface;
|
|
185
202
|
const generatedId = useId();
|
|
186
203
|
const id = idProp || generatedId;
|
|
187
204
|
const descriptionID = useId();
|
|
@@ -296,17 +313,18 @@ export function CheckboxInput({
|
|
|
296
313
|
ref: rowRef,
|
|
297
314
|
onPointerDown: hasHitArea ? handleRowPointerDown : undefined,
|
|
298
315
|
onClick: hasHitArea ? handleRowClick : undefined,
|
|
299
|
-
...(
|
|
316
|
+
...(ownsPress ? pressable : undefined),
|
|
300
317
|
...stylex.props(styles.container, isLabelHidden && styles.containerLabelHidden, hasHitArea && styles.hitAreaHost, hasHitArea && touchHitAreaStyles.layer,
|
|
301
318
|
// Hover and focus reach the checkbox visual through this ancestor
|
|
302
319
|
// marker rather than props, so the whole row drives it.
|
|
303
|
-
!isDisabled && indicatorScope, !isDisabled && styles.indicatorPressImage,
|
|
320
|
+
!isDisabled && indicatorScope, !isDisabled && (isRowPressSurface ? styles.indicatorRowPressImage : styles.indicatorPressImage),
|
|
304
321
|
// The touch press's strength and release live on the row the
|
|
305
322
|
// controller writes to; the layer over the checkbox box inherits
|
|
306
|
-
// and paints it.
|
|
307
|
-
|
|
323
|
+
// and paints it. Under a row that owns the press, the box inherits
|
|
324
|
+
// that row's strength instead.
|
|
325
|
+
ownsPress && interactionOverlayStyles.pressedAlpha),
|
|
308
326
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
309
|
-
...stylex.props(styles.checkboxWrapper, wrapperSizeStyles[size], !isDisabled && styles.indicatorPressOverlay),
|
|
327
|
+
...stylex.props(styles.checkboxWrapper, wrapperSizeStyles[size], !isDisabled && styles.indicatorPressOverlay, !isDisabled && isRowPressSurface && styles.indicatorRowPressOverlay),
|
|
310
328
|
...focusProps,
|
|
311
329
|
children: [/*#__PURE__*/_jsx("input", {
|
|
312
330
|
...rest,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxRowPressContext.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxRowPressContext.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,uBAAuB,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file CheckboxRowPressContext.ts
|
|
7
|
+
* @input Uses the private layer-scoped context factory
|
|
8
|
+
* @output CheckboxRowPressContext: whether the row is its checkbox's press surface
|
|
9
|
+
* @position Internal; CheckboxListItem provides it, CheckboxInput reads it
|
|
10
|
+
*
|
|
11
|
+
* Such a row carries the shared press marker (utils/pressFeedback.ts). Its
|
|
12
|
+
* checkbox carries none, so a finger anywhere on the row presses the row.
|
|
13
|
+
* It is layer-scoped and wraps only the row's own checkbox.
|
|
14
|
+
*
|
|
15
|
+
* SYNC: When modified, update CheckboxInput.tsx and
|
|
16
|
+
* ../CheckboxList/CheckboxListItem.tsx.
|
|
17
|
+
*/
|
|
18
|
+
import { createLayerScopedContext } from "../Layer/layerScopedContext.js";
|
|
19
|
+
export const CheckboxRowPressContext = createLayerScopedContext(false);
|
|
20
|
+
CheckboxRowPressContext.displayName = 'CheckboxRowPressContext';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file CheckboxListItem.tsx
|
|
3
|
-
* @input Uses React, CheckboxInput, ListItem, CheckboxListContext
|
|
3
|
+
* @input Uses React, CheckboxInput, ListItem, CheckboxListContext,
|
|
4
|
+
* CheckboxRowPressContext, the touch presentation and the row press paint
|
|
4
5
|
* @output Exports CheckboxListItem component, CheckboxListItemProps
|
|
5
6
|
* @position Core implementation; consumed by index.ts, tested by CheckboxList.test.tsx
|
|
6
7
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxListItem.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxListItem.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"CheckboxListItem.d.ts","sourceRoot":"","sources":["../../src/CheckboxList/CheckboxListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAkC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAItE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAc5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAuBvC,MAAM,WAAW,qBAAsB,SAAQ,SAAS,CAAC,aAAa,CAAC;IACrE;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;;;;;OAaG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAChC;AAyCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,KAAK,EACL,WAAW,EACX,UAAU,EACV,UAAU,EAAE,cAAsB,EAClC,SAAS,EAAE,aAAqB,EAChC,SAAS,EACT,OAAO,EACP,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,KAAK,EACL,GAAG,SAAS,EACb,EAAE,qBAAqB,+BAiLvB;yBAlMe,gBAAgB"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file CheckboxListItem.tsx
|
|
7
|
-
* @input Uses React, CheckboxInput, ListItem, CheckboxListContext
|
|
7
|
+
* @input Uses React, CheckboxInput, ListItem, CheckboxListContext,
|
|
8
|
+
* CheckboxRowPressContext, the touch presentation and the row press paint
|
|
8
9
|
* @output Exports CheckboxListItem component, CheckboxListItemProps
|
|
9
10
|
* @position Core implementation; consumed by index.ts, tested by CheckboxList.test.tsx
|
|
10
11
|
*
|
|
@@ -21,6 +22,10 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
21
22
|
import "../theme/tokens.stylex.js";
|
|
22
23
|
import { colorVars } from "../theme/tokens.stylex.js";
|
|
23
24
|
import { CheckboxInput } from "../CheckboxInput/CheckboxInput.js";
|
|
25
|
+
import { CheckboxRowPressContext } from "../CheckboxInput/CheckboxRowPressContext.js";
|
|
26
|
+
import { rowPressPaintStyles } from "../privateAttributes/press.stylex.js";
|
|
27
|
+
import { interactionOverlayStyles } from "../utils/interactionOverlay.stylex.js";
|
|
28
|
+
import { useTouchPresentation } from "../utils/touchPresentation.js";
|
|
24
29
|
import { ListItem } from "../List/ListItem.js";
|
|
25
30
|
import { ListContext } from "../List/ListContext.js";
|
|
26
31
|
import { CheckboxListContext } from "./CheckboxListContext.js";
|
|
@@ -184,6 +189,14 @@ export function CheckboxListItem({
|
|
|
184
189
|
}) : undefined, [requiredGroup, isBoxChecked, isBoxEnabled]);
|
|
185
190
|
const checkboxInputRef = useMergedRefs(checkboxRef, registerWithRequiredGroup);
|
|
186
191
|
|
|
192
|
+
// Under a finger, a delegating row is the option's only press surface. A
|
|
193
|
+
// touch anywhere on it presses the row. A fine pointer keeps the box's own
|
|
194
|
+
// press.
|
|
195
|
+
const {
|
|
196
|
+
isTouch
|
|
197
|
+
} = useTouchPresentation();
|
|
198
|
+
const rowOwnsPress = isTouch && hasRowInteraction && !effectiveDisabled;
|
|
199
|
+
|
|
187
200
|
// A read-only checkbox carries aria-readonly, which the row's clickable
|
|
188
201
|
// container treats as a non-interactive target, so a click on it would be
|
|
189
202
|
// delegated straight back to the checkbox without end. Stop that click at
|
|
@@ -230,21 +243,34 @@ export function CheckboxListItem({
|
|
|
230
243
|
,
|
|
231
244
|
interactiveRef: hasRowInteraction ? checkboxRef : undefined,
|
|
232
245
|
"aria-busy": isBusy || undefined,
|
|
233
|
-
xstyle: [
|
|
246
|
+
xstyle: [
|
|
247
|
+
// The row's own press paint, which the layer over its box reads.
|
|
248
|
+
rowOwnsPress && rowPressPaintStyles.checkboxRow,
|
|
249
|
+
// Item's row layer drops the strength's release, and the box paints
|
|
250
|
+
// at that strength. So the row brings the release back, and the box
|
|
251
|
+
// fades with the row.
|
|
252
|
+
rowOwnsPress && interactionOverlayStyles.pressedAlpha, resolvedChecked === true && !effectiveDisabled && !effectiveReadOnly && styles.selected, xstyle],
|
|
234
253
|
className: className,
|
|
235
254
|
style: style,
|
|
236
|
-
startContent:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
value:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
255
|
+
startContent:
|
|
256
|
+
/*#__PURE__*/
|
|
257
|
+
// Only the row's own checkbox: a checkbox placed in the row's content
|
|
258
|
+
// keeps its own press.
|
|
259
|
+
_jsx(CheckboxRowPressContext, {
|
|
260
|
+
value: rowOwnsPress,
|
|
261
|
+
children: /*#__PURE__*/_jsx(DescribedCheckboxInput, {
|
|
262
|
+
ref: checkboxInputRef,
|
|
263
|
+
label: checkboxLabel,
|
|
264
|
+
"aria-labelledby": namesFromVisibleLabel ? labelID : undefined,
|
|
265
|
+
isLabelHidden: true,
|
|
266
|
+
value: resolvedChecked,
|
|
267
|
+
onChange: () => handleToggle(),
|
|
268
|
+
onClick: handleCheckboxClick,
|
|
269
|
+
isDisabled: effectiveDisabled,
|
|
270
|
+
isReadOnly: effectiveReadOnly,
|
|
271
|
+
isLoading: isBusy,
|
|
272
|
+
size: checkboxSize
|
|
273
|
+
})
|
|
248
274
|
})
|
|
249
275
|
});
|
|
250
276
|
}
|
package/dist/astryx.css
CHANGED
|
@@ -128,6 +128,7 @@
|
|
|
128
128
|
.x18zce08{--_chat-composer-padding:var(--spacing-2)}
|
|
129
129
|
.xk0ittl{--_chat-composer-padding:var(--spacing-3)}
|
|
130
130
|
.xx161y6{--_chat-composer-radius:var(--radius-chat)}
|
|
131
|
+
.x1ectg7s{--_checkbox-row-press-paint:none}
|
|
131
132
|
.xtk08jq{--_codeblock-gutter-width:var(--x---_codeblock-gutter-width)}
|
|
132
133
|
.x9pmotm{--_conceal-opacity:0}
|
|
133
134
|
.x1kgmhs9{--_conceal-opacity:1}
|
|
@@ -142,6 +143,7 @@
|
|
|
142
143
|
.xhg274n{--_hover-delay:0s}
|
|
143
144
|
.x8xu23y{--_hover-delay:var(--x---_hover-delay)}
|
|
144
145
|
.xqwz7mz{--_hovercard-radius:var(--radius-container)}
|
|
146
|
+
.x1y1g3jp{--_indicator-press-image:var(--_checkbox-row-press-paint,none)}
|
|
145
147
|
.xqxtgf4{--_input-clear-hit-content:none}
|
|
146
148
|
.xtoycft{--_input-clear-hit-inset:0px}
|
|
147
149
|
.x1dj2fx0{--_item-description-color:var(--color-text-error)}
|
|
@@ -438,6 +440,8 @@
|
|
|
438
440
|
.xpa4xmd{--tree-list-indent:var(--spacing-4)}
|
|
439
441
|
.x1xbi2jf{--tree-list-row-gap:var(--spacing-0-5)}
|
|
440
442
|
.x1gxz47l.x1gxz47l:where(.x139im0d:last-child *){--_table-row-divider-width:0px}
|
|
443
|
+
.xbxihhr:is([data-astryx-press="on"]){--_checkbox-row-press-paint:none}
|
|
444
|
+
.xvfewc:is([data-astryx-press="fading"]){--_checkbox-row-press-paint:none}
|
|
441
445
|
.x1wfyzv7:focus-within{--_fade-delay:0s}
|
|
442
446
|
.xqchwus:focus-visible{--_focus-outline-offset:var(--focus-outline-offset)}
|
|
443
447
|
.xqih627:focus-visible{--_focus-outline:var(--focus-outline-width) var(--focus-outline-style) var(--focus-outline-color)}
|
|
@@ -469,6 +473,8 @@
|
|
|
469
473
|
@media (pointer: coarse){.x1h9khjt.x1h9khjt{--_thumbnail-hit-inset:-2px}}
|
|
470
474
|
@media (hover: hover){.x1m110vg.x1m110vg{--resize-hint:transparent}}
|
|
471
475
|
.xb8awce.xb8awce:active:where(:not(:disabled,[aria-disabled="true"])){--_press-overlay:var(--color-overlay-pressed)}
|
|
476
|
+
@media (pointer: coarse){.x18sblwv.x18sblwv:is([data-astryx-press="on"]){--_checkbox-row-press-paint:var(--_press-paint-image)}}
|
|
477
|
+
@media (pointer: coarse){.x19dyfww.x19dyfww:is([data-astryx-press="fading"]){--_checkbox-row-press-paint:var(--_press-paint-image)}}
|
|
472
478
|
@media (hover: hover){.x1316hva.x1316hva.x1316hva:hover:where(:not(:disabled,[aria-disabled="true"])){--_conceal-opacity:0}}
|
|
473
479
|
@media (hover: hover){.xuzfaso.xuzfaso.xuzfaso:hover:where(:not(:disabled,[aria-disabled="true"])){--_conceal-opacity:1}}
|
|
474
480
|
@media (hover: hover){.xq03417.xq03417.xq03417:hover:where(:not(:disabled,[aria-disabled="true"])){--_fade-delay:0s}}
|
|
@@ -2377,6 +2383,7 @@
|
|
|
2377
2383
|
.xccdyz0:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{background-image:linear-gradient(to left,var(--color-shadow),transparent)}
|
|
2378
2384
|
.x1ppu1g5:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{background-image:linear-gradient(to right,var(--color-shadow),transparent)}
|
|
2379
2385
|
.x1xm21za:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{background-image:linear-gradient(var(--table-sticky-background,var(--color-background-card)),var(--table-sticky-background,var(--color-background-card)))}
|
|
2386
|
+
.xlvbopx:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{background-image:var(--_checkbox-row-press-paint,none)}
|
|
2380
2387
|
.x10e6nnj:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::after{background-image:var(--_segmented-after-background-image,none)}
|
|
2381
2388
|
.x19ph129:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{background-image:var(--_segmented-lens-background-image,none)}
|
|
2382
2389
|
.xjnwjuh:not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#):not(#\#)::before{background-origin:border-box}
|
|
@@ -38,6 +38,8 @@ export interface ComputeOverflowResult {
|
|
|
38
38
|
/** Number of rows the visible items occupy (always 1 for the single-line path). */
|
|
39
39
|
rows: number;
|
|
40
40
|
}
|
|
41
|
+
/** Count how many rows a set of items occupies when wrapped at availableWidth. */
|
|
42
|
+
export declare function countRows(orderedWidths: number[], gap: number, availableWidth: number): number;
|
|
41
43
|
/**
|
|
42
44
|
* Pure overflow computation. Given plain measurements and the configured
|
|
43
45
|
* limits, return how many items should be visible and how many rows they
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/computeOverflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd;
|
|
1
|
+
{"version":3,"file":"computeOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/computeOverflow.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,oBAAoB;IACnC,2DAA2D;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,cAAc,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,YAAY,EAAE,OAAO,GAAG,KAAK,CAAC;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;CACd;AAwHD,kFAAkF;AAClF,wBAAgB,SAAS,CACvB,aAAa,EAAE,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,GACrB,MAAM,CAkBR;AA2CD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,oBAAoB,GAC1B,qBAAqB,CAqDvB"}
|
|
@@ -107,7 +107,7 @@ function packRows(orderedWidths, gap, availableWidth, indicatorReserve, maxRows)
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/** Count how many rows a set of items occupies when wrapped at availableWidth. */
|
|
110
|
-
function countRows(orderedWidths, gap, availableWidth) {
|
|
110
|
+
export function countRows(orderedWidths, gap, availableWidth) {
|
|
111
111
|
if (orderedWidths.length === 0) {
|
|
112
112
|
return 0;
|
|
113
113
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SSR-safe media query hook.
|
|
3
3
|
* Returns whether the given media query matches. Where the window has no
|
|
4
|
-
* `matchMedia`, as in a test DOM, it returns `serverDefault`.
|
|
4
|
+
* `matchMedia`, as in a test DOM, it returns `serverDefault`. All callers of
|
|
5
|
+
* the same query share one listener.
|
|
5
6
|
*
|
|
6
7
|
* @param query - CSS media query string
|
|
7
8
|
* @param serverDefault - Value to return during SSR. Pass a server-side hint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../src/hooks/useMediaQuery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../src/hooks/useMediaQuery.ts"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,OAAO,CAiB3E"}
|
|
@@ -4,23 +4,56 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useMediaQuery.ts
|
|
7
|
-
* @input Uses React useSyncExternalStore, useCallback
|
|
7
|
+
* @input Uses React useSyncExternalStore, useCallback, and watchMediaQuery
|
|
8
|
+
* (utils/coarsePointer.ts)
|
|
8
9
|
* @output Exports useMediaQuery hook for responsive breakpoint detection
|
|
9
10
|
* @position Core hook; used by consumers for responsive patterns
|
|
10
11
|
*
|
|
11
12
|
* SSR-safe media query hook that subscribes to window.matchMedia changes
|
|
12
13
|
* via useSyncExternalStore — the canonical React pattern for external
|
|
13
|
-
* browser state.
|
|
14
|
+
* browser state. Every caller of a query shares one watch.
|
|
14
15
|
*
|
|
15
16
|
* SYNC: When modified, update:
|
|
16
17
|
* - /packages/core/src/hooks/index.ts
|
|
17
18
|
*/
|
|
18
19
|
import { useCallback, useSyncExternalStore } from 'react';
|
|
20
|
+
import { watchMediaQuery } from "../utils/coarsePointer.js";
|
|
21
|
+
const watches = new Map();
|
|
22
|
+
function subscribeToQuery(query, reader) {
|
|
23
|
+
// A DOM without `matchMedia`, such as a test DOM, has nothing to watch.
|
|
24
|
+
if (typeof window.matchMedia !== 'function') {
|
|
25
|
+
return () => {};
|
|
26
|
+
}
|
|
27
|
+
let watch = watches.get(query);
|
|
28
|
+
if (watch == null) {
|
|
29
|
+
const readers = new Set();
|
|
30
|
+
const stop = watchMediaQuery(window, query, () => {
|
|
31
|
+
for (const each of Array.from(readers)) {
|
|
32
|
+
each();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
watch = {
|
|
36
|
+
readers,
|
|
37
|
+
stop
|
|
38
|
+
};
|
|
39
|
+
watches.set(query, watch);
|
|
40
|
+
}
|
|
41
|
+
const entry = watch;
|
|
42
|
+
entry.readers.add(reader);
|
|
43
|
+
return () => {
|
|
44
|
+
entry.readers.delete(reader);
|
|
45
|
+
if (entry.readers.size === 0 && watches.get(query) === entry) {
|
|
46
|
+
entry.stop();
|
|
47
|
+
watches.delete(query);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
19
51
|
|
|
20
52
|
/**
|
|
21
53
|
* SSR-safe media query hook.
|
|
22
54
|
* Returns whether the given media query matches. Where the window has no
|
|
23
|
-
* `matchMedia`, as in a test DOM, it returns `serverDefault`.
|
|
55
|
+
* `matchMedia`, as in a test DOM, it returns `serverDefault`. All callers of
|
|
56
|
+
* the same query share one listener.
|
|
24
57
|
*
|
|
25
58
|
* @param query - CSS media query string
|
|
26
59
|
* @param serverDefault - Value to return during SSR. Pass a server-side hint
|
|
@@ -33,15 +66,7 @@ import { useCallback, useSyncExternalStore } from 'react';
|
|
|
33
66
|
* ```
|
|
34
67
|
*/
|
|
35
68
|
export function useMediaQuery(query, serverDefault = false) {
|
|
36
|
-
const subscribe = useCallback(onStoreChange =>
|
|
37
|
-
// A DOM without `matchMedia`, such as a test DOM, has nothing to watch.
|
|
38
|
-
if (typeof window.matchMedia !== 'function') {
|
|
39
|
-
return () => {};
|
|
40
|
-
}
|
|
41
|
-
const mql = window.matchMedia(query);
|
|
42
|
-
mql.addEventListener('change', onStoreChange);
|
|
43
|
-
return () => mql.removeEventListener('change', onStoreChange);
|
|
44
|
-
}, [query]);
|
|
69
|
+
const subscribe = useCallback(onStoreChange => subscribeToQuery(query, onStoreChange), [query]);
|
|
45
70
|
const getSnapshot = useCallback(() => typeof window.matchMedia === 'function' ? window.matchMedia(query).matches : serverDefault, [query, serverDefault]);
|
|
46
71
|
const getServerSnapshot = useCallback(() => serverDefault, [serverDefault]);
|
|
47
72
|
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useOverflow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOverflow.d.ts","sourceRoot":"","sources":["../../src/hooks/useOverflow.ts"],"names":[],"mappings":"AAyBA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,eAAe,GAAG,aAAa,CAAC;CAC5C;AAED,MAAM,WAAW,iBAAiB;IAChC,qDAAqD;IACrD,YAAY,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC7C,wDAAwD;IACxD,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IAC3C,wDAAwD;IACxD,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,EAAE,OAAO,CAAC;IACrB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,+EAA+E;IAC/E,SAAS,EAAE,MAAM,CAAC;CACnB;AA6JD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,kBAAuB,GAC/B,iBAAiB,CAoOnB"}
|