@astryxdesign/core 0.7.15 → 0.7.16-canary.g9b5ad42
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/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +11 -6
- package/dist/Field/InputClearButton.d.ts.map +1 -1
- package/dist/Field/InputClearButton.js +4 -2
- package/dist/InfoTip/InfoTip.d.ts +1 -1
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +4 -1
- package/dist/Layer/layerAnimations.stylex.d.ts.map +1 -1
- package/dist/Layer/layerAnimations.stylex.js +17 -13
- package/dist/Layer/layerEntranceSide.d.ts +24 -10
- package/dist/Layer/layerEntranceSide.d.ts.map +1 -1
- package/dist/Layer/layerEntranceSide.js +28 -13
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +14 -11
- package/dist/List/ListItem.d.ts +3 -2
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListReorderHandle.d.ts +7 -0
- package/dist/List/ListReorderHandle.d.ts.map +1 -1
- package/dist/List/ListReorderHandle.js +42 -58
- package/dist/List/listReorderContext.d.ts.map +1 -1
- package/dist/List/listReorderContext.js +4 -4
- package/dist/List/listReorderEngine.d.ts +50 -2
- package/dist/List/listReorderEngine.d.ts.map +1 -1
- package/dist/List/listReorderEngine.js +205 -10
- package/dist/MoreMenu/MoreMenu.d.ts +1 -1
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +4 -1
- package/dist/PowerSearch/PowerSearch.d.ts +1 -1
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +8 -4
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts +4 -1
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +4 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchFilterEditor.js +7 -3
- package/dist/PowerSearch/PowerSearchToken.d.ts +1 -1
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +4 -1
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -1
- package/dist/Selector/useSelectorPresentation.js +13 -12
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +6 -8
- package/dist/Table/BaseTable.d.ts +1 -1
- package/dist/Table/BaseTable.d.ts.map +1 -1
- package/dist/Table/BaseTable.js +265 -197
- package/dist/Table/Table.d.ts +5 -1
- package/dist/Table/Table.d.ts.map +1 -1
- package/dist/Table/index.d.ts +5 -3
- package/dist/Table/index.d.ts.map +1 -1
- package/dist/Table/index.js +2 -1
- package/dist/Table/plugins/infiniteScroll/TableInfiniteScrollWide.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/Table/plugins/infiniteScroll/index.d.ts +9 -0
- package/dist/Table/plugins/infiniteScroll/index.d.ts.map +1 -0
- package/dist/Table/plugins/infiniteScroll/index.js +9 -0
- package/dist/Table/plugins/infiniteScroll/useTableInfiniteScroll.d.ts +29 -0
- package/dist/Table/plugins/infiniteScroll/useTableInfiniteScroll.d.ts.map +1 -0
- package/dist/Table/plugins/infiniteScroll/useTableInfiniteScroll.js +394 -0
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.d.ts.map +1 -1
- package/dist/Table/plugins/stickyColumns/useTableStickyColumns.js +21 -1
- package/dist/Table/plugins/virtualization/TableColumnWindow.d.ts +4 -0
- package/dist/Table/plugins/virtualization/TableColumnWindow.d.ts.map +1 -0
- package/dist/Table/plugins/virtualization/TableColumnWindow.js +109 -0
- package/dist/Table/plugins/virtualization/index.d.ts +3 -1
- package/dist/Table/plugins/virtualization/index.d.ts.map +1 -1
- package/dist/Table/plugins/virtualization/index.js +3 -2
- package/dist/Table/plugins/virtualization/useTableColumnWindow.d.ts +33 -0
- package/dist/Table/plugins/virtualization/useTableColumnWindow.d.ts.map +1 -0
- package/dist/Table/plugins/virtualization/useTableColumnWindow.js +143 -0
- package/dist/Table/plugins/virtualization/useTableColumnsVirtualization.d.ts +23 -0
- package/dist/Table/plugins/virtualization/useTableColumnsVirtualization.d.ts.map +1 -0
- package/dist/Table/plugins/virtualization/useTableColumnsVirtualization.js +37 -0
- package/dist/Table/tableColumnWindowing.d.ts +85 -0
- package/dist/Table/tableColumnWindowing.d.ts.map +1 -0
- package/dist/Table/tableColumnWindowing.js +47 -0
- package/dist/Table/tablePinnedColumnRuns.d.ts +23 -0
- package/dist/Table/tablePinnedColumnRuns.d.ts.map +1 -0
- package/dist/Table/tablePinnedColumnRuns.js +41 -0
- package/dist/Table/tableRuntime.d.ts +14 -2
- package/dist/Table/tableRuntime.d.ts.map +1 -1
- package/dist/Table/tableRuntime.js +32 -11
- package/dist/Table/types.d.ts +28 -2
- package/dist/Table/types.d.ts.map +1 -1
- package/dist/Table/useBaseTablePlugins.js +2 -2
- package/dist/TextArea/TextArea.d.ts +10 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +2 -0
- package/dist/Toast/Toast.d.ts +1 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +4 -2
- package/dist/astryx.css +10 -10
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts +156 -0
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts.map +1 -1
- package/dist/dragToSnapPoints/createDragToSnapPoints.js +313 -97
- package/dist/gestures/createPanGesture.d.ts +41 -0
- package/dist/gestures/createPanGesture.d.ts.map +1 -1
- package/dist/gestures/createPanGesture.js +66 -22
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +36 -2
- package/dist/i18n/generated-english/Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.js +12 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +2 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +2 -0
- package/dist/internal/touch.d.ts +1 -1
- package/dist/internal/touch.d.ts.map +1 -1
- package/dist/internal/touch.js +1 -1
- package/dist/motion/animator.d.ts +28 -1
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +99 -19
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +14 -3
- package/dist/theme/tokenReferences.d.ts +7 -15
- package/dist/theme/tokenReferences.d.ts.map +1 -1
- package/dist/theme/tokenReferences.js +49 -7
- package/dist/utils/clickGuard.d.ts +8 -1
- package/dist/utils/clickGuard.d.ts.map +1 -1
- package/dist/utils/clickGuard.js +24 -4
- package/dist/utils/themeProps.d.ts +8 -0
- package/dist/utils/themeProps.d.ts.map +1 -1
- package/dist/utils/themeProps.js +17 -0
- package/dist/utils/timeParser.d.ts +3 -1
- package/dist/utils/timeParser.d.ts.map +1 -1
- package/dist/utils/timeParser.js +7 -3
- package/dist/virtualization/listWindow.d.ts +18 -2
- package/dist/virtualization/listWindow.d.ts.map +1 -1
- package/dist/virtualization/listWindow.js +55 -2
- package/dist/virtualization/useInlineListWindow.d.ts +40 -0
- package/dist/virtualization/useInlineListWindow.d.ts.map +1 -0
- package/dist/virtualization/useInlineListWindow.js +58 -0
- package/locales/en.json +8 -0
- package/locales/pseudo.json +6 -0
- package/package.json +5 -5
- package/src/BottomSheet/BottomSheet.tsx +12 -8
- package/src/ButtonGroup/ButtonGroup.doc.mjs +5 -0
- package/src/CheckboxInput/CheckboxInput.doc.mjs +3 -0
- package/src/Field/InputClearButton.tsx +3 -1
- package/src/InfoTip/InfoTip.doc.mjs +2 -2
- package/src/InfoTip/InfoTip.tsx +3 -0
- package/src/Layer/layerAnimations.stylex.ts +13 -9
- package/src/Layer/layerEntranceSide.ts +48 -11
- package/src/Layer/useLayer.tsx +14 -12
- package/src/List/ListItem.tsx +3 -2
- package/src/List/ListReorderHandle.tsx +59 -77
- package/src/List/listReorderContext.ts +3 -4
- package/src/List/listReorderEngine.tsx +246 -11
- package/src/MoreMenu/MoreMenu.doc.mjs +2 -2
- package/src/MoreMenu/MoreMenu.tsx +3 -0
- package/src/NumberInput/NumberInput.doc.mjs +3 -0
- package/src/PowerSearch/PowerSearch.doc.mjs +2 -2
- package/src/PowerSearch/PowerSearch.tsx +7 -3
- package/src/PowerSearch/PowerSearchEditPopover.tsx +12 -2
- package/src/PowerSearch/PowerSearchFilterEditor.tsx +3 -0
- package/src/PowerSearch/PowerSearchToken.tsx +3 -0
- package/src/ProgressBar/ProgressBar.doc.mjs +3 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +5 -0
- package/src/Selector/useSelectorPresentation.ts +16 -12
- package/src/Slider/Slider.tsx +6 -8
- package/src/StatusDot/StatusDot.doc.mjs +3 -0
- package/src/Switch/Switch.doc.mjs +3 -0
- package/src/TabList/TabList.doc.mjs +4 -0
- package/src/Table/BaseTable.tsx +406 -287
- package/src/Table/Table.doc.mjs +2 -2
- package/src/Table/Table.tsx +5 -1
- package/src/Table/index.ts +8 -1
- package/src/Table/plugins/infiniteScroll/index.ts +10 -0
- package/src/Table/plugins/infiniteScroll/useTableInfiniteScroll.tsx +523 -0
- package/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx +31 -1
- package/src/Table/plugins/virtualization/TableColumnWindow.tsx +150 -0
- package/src/Table/plugins/virtualization/index.ts +3 -1
- package/src/Table/plugins/virtualization/useTableColumnWindow.ts +168 -0
- package/src/Table/plugins/virtualization/useTableColumnsVirtualization.ts +53 -0
- package/src/Table/tableColumnWindowing.ts +131 -0
- package/src/Table/tablePinnedColumnRuns.ts +55 -0
- package/src/Table/tableRuntime.ts +44 -11
- package/src/Table/types.ts +25 -2
- package/src/Table/useBaseTablePlugins.ts +2 -2
- package/src/Table/useTableColumnsVirtualization.doc.mjs +29 -0
- package/src/Table/useTableInfiniteScroll.doc.mjs +58 -0
- package/src/Text/Heading.doc.mjs +3 -0
- package/src/TextArea/TextArea.doc.mjs +15 -0
- package/src/TextArea/TextArea.tsx +11 -0
- package/src/TextInput/TextInput.doc.mjs +3 -0
- package/src/Toast/Toast.doc.mjs +2 -2
- package/src/Toast/Toast.tsx +3 -1
- package/src/TopNav/TopNav.doc.mjs +4 -0
- package/src/dragToSnapPoints/createDragToSnapPoints.ts +437 -119
- package/src/gestures/createPanGesture.ts +112 -39
- package/src/hooks/useMenuPress.ts +39 -0
- package/src/i18n/generated-english/Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +2 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +2 -0
- package/src/internal/touch.ts +5 -1
- package/src/motion/animator.ts +181 -23
- package/src/theme/generateThemeRules.ts +14 -3
- package/src/theme/tokenReferences.ts +48 -7
- package/src/utils/clickGuard.ts +30 -3
- package/src/utils/themeProps.ts +17 -0
- package/src/utils/timeParser.ts +7 -9
- package/src/virtualization/listWindow.ts +76 -2
- package/src/virtualization/useInlineListWindow.ts +119 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAuBH,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomShe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B;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AA69BxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
// stack, but they replace each other. Each open modal sheet is an outlet for
|
|
51
51
|
// toasts (Layer/modalOutlet.ts), in stack order.
|
|
52
52
|
import { use, useCallback, useEffect, useInsertionEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
53
|
+
import { useCommittedRef } from "../hooks/useCommittedRef.js";
|
|
53
54
|
import { useIsHydrating } from "../hooks/useIsHydrating.js";
|
|
54
55
|
import { useSettledOpen } from "../hooks/useSettledOpen.js";
|
|
55
56
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -294,8 +295,9 @@ function StandaloneBottomSheet({
|
|
|
294
295
|
// sheet leaves the page interactive, so it returns focus to its opener
|
|
295
296
|
// only if the person was still in the sheet; a modal sheet always does.
|
|
296
297
|
const hadFocusAtCloseRef = useRef(false);
|
|
297
|
-
|
|
298
|
-
|
|
298
|
+
// The committed `finalFocusRef`. The stack reads it when it closes the
|
|
299
|
+
// sheet, which can happen in a layout effect.
|
|
300
|
+
const finalFocusRefRef = useCommittedRef(finalFocusRef);
|
|
299
301
|
// A sheet rendered in another sheet's content is presented only while that
|
|
300
302
|
// sheet is open: it leaves with its host and, if its own state is still
|
|
301
303
|
// open, comes back when the host does (see BottomSheetHostContext). Its
|
|
@@ -391,8 +393,9 @@ function StandaloneBottomSheet({
|
|
|
391
393
|
const handlePanelElementChange = useCallback(element => {
|
|
392
394
|
panelRef.current = element;
|
|
393
395
|
}, []);
|
|
396
|
+
// The stack's view for the handlers. The registry's `onView` writes it with
|
|
397
|
+
// each view it reports, together with the state.
|
|
394
398
|
const stackViewRef = useRef(stackView);
|
|
395
|
-
stackViewRef.current = stackView;
|
|
396
399
|
const scrimWriteRef = useRef({
|
|
397
400
|
frame: null
|
|
398
401
|
});
|
|
@@ -436,6 +439,8 @@ function StandaloneBottomSheet({
|
|
|
436
439
|
const repairOnRemoval = dialog == null ? null : prepareFocusRepairOnRemoval(dialog, {
|
|
437
440
|
keepRestingFocus: true
|
|
438
441
|
});
|
|
442
|
+
// Where focus returns when the sheet leaves, read when it leaves.
|
|
443
|
+
const getReturnTarget = () => finalFocusRefRef.current?.current ?? triggerRef.current;
|
|
439
444
|
const leave = registerBottomSheet({
|
|
440
445
|
key,
|
|
441
446
|
getElement: () => dialogRef.current,
|
|
@@ -456,7 +461,7 @@ function StandaloneBottomSheet({
|
|
|
456
461
|
},
|
|
457
462
|
hide: () => closeDialogKeepingFocus(dialogRef.current),
|
|
458
463
|
focus: reason => focusSheetPanel(panelRef.current, reason, hasScrim),
|
|
459
|
-
getReturnTarget
|
|
464
|
+
getReturnTarget,
|
|
460
465
|
onView: view => {
|
|
461
466
|
stackViewRef.current = view;
|
|
462
467
|
setStackView(view);
|
|
@@ -491,7 +496,7 @@ function StandaloneBottomSheet({
|
|
|
491
496
|
// person had already moved out of the sheet to the page body stays
|
|
492
497
|
// there: the removal did not lose it.
|
|
493
498
|
if (repairOnRemoval != null && isSheetHostPresented(dialog)) {
|
|
494
|
-
const returnTarget =
|
|
499
|
+
const returnTarget = getReturnTarget();
|
|
495
500
|
const revealed = hasScrim ? getBottomSheetBeneath(key) : null;
|
|
496
501
|
repairOnRemoval(() => {
|
|
497
502
|
// The sheet beneath left too. Its own repair returns focus for the
|
|
@@ -508,7 +513,7 @@ function StandaloneBottomSheet({
|
|
|
508
513
|
}
|
|
509
514
|
leave();
|
|
510
515
|
};
|
|
511
|
-
}, [hasScrim, shouldPresent, writeScrim]);
|
|
516
|
+
}, [finalFocusRefRef, hasScrim, shouldPresent, writeScrim]);
|
|
512
517
|
useLayoutEffect(() => {
|
|
513
518
|
if (!isOpen) {
|
|
514
519
|
// Where focus was when the person closed the sheet. The closing sheet
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAyE3C,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC7B,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,6BAA8B,SAAQ,qBAAqB;IACnE,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACtD,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CACtD;
|
|
1
|
+
{"version":3,"file":"InputClearButton.d.ts","sourceRoot":"","sources":["../../src/Field/InputClearButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAyE3C,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IAC7B,iFAAiF;IACjF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,6BAA8B,SAAQ,qBAAqB;IACnE,aAAa,EAAE,KAAK,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IACtD,cAAc,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CACtD;AA8DD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CAMxE;yBANe,gBAAgB;;;AAQhC;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,6BAA6B,GACnC,SAAS,CAMX"}
|
|
@@ -20,7 +20,7 @@ import { Button } from "../Button/Button.js";
|
|
|
20
20
|
import { BUTTON_HIT_AREA, ButtonHitAreaContext } from "../Button/buttonHitArea.js";
|
|
21
21
|
import { clampedHitInsets } from "../utils/hitArea.js";
|
|
22
22
|
import { Icon } from "../Icon/Icon.js";
|
|
23
|
-
import { themeProps } from "../utils/themeProps.js";
|
|
23
|
+
import { pickDataAttributes, themeProps } from "../utils/themeProps.js";
|
|
24
24
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
25
25
|
import english from "../i18n/generated-english/Field/InputClearButton.generated.js";
|
|
26
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -85,7 +85,8 @@ function renderInputClearButton({
|
|
|
85
85
|
onPointerDown,
|
|
86
86
|
onClickCapture,
|
|
87
87
|
xstyle,
|
|
88
|
-
iconClassName
|
|
88
|
+
iconClassName,
|
|
89
|
+
...rest
|
|
89
90
|
}) {
|
|
90
91
|
const {
|
|
91
92
|
className: iconTargetClassName
|
|
@@ -96,6 +97,7 @@ function renderInputClearButton({
|
|
|
96
97
|
return /*#__PURE__*/_jsx(ButtonHitAreaContext, {
|
|
97
98
|
value: CLEAR_BUTTON_HIT_AREA,
|
|
98
99
|
children: /*#__PURE__*/_jsx(Button, {
|
|
100
|
+
...pickDataAttributes(rest),
|
|
99
101
|
variant: "ghost",
|
|
100
102
|
size: "sm",
|
|
101
103
|
label: label
|
|
@@ -57,7 +57,7 @@ export interface InfoTipProps extends Pick<BaseProps, 'xstyle' | 'className' | '
|
|
|
57
57
|
* <InfoTip content="30-day rolling average." label="About this metric" />
|
|
58
58
|
* ```
|
|
59
59
|
*/
|
|
60
|
-
export declare function InfoTip({ content, label, size, ref, xstyle, className, style, }: InfoTipProps): ReactNode;
|
|
60
|
+
export declare function InfoTip({ content, label, size, ref, xstyle, className, style, ...rest }: InfoTipProps): ReactNode;
|
|
61
61
|
export declare namespace InfoTip {
|
|
62
62
|
var displayName: string;
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoTip.d.ts","sourceRoot":"","sources":["../../src/InfoTip/InfoTip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"InfoTip.d.ts","sourceRoot":"","sources":["../../src/InfoTip/InfoTip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,GAAG,EACT,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,cAAc,CAAC;AAuBjD;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;AAEnC,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,EACT,QAAQ,GAAG,WAAW,GAAG,OAAO,CACjC;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC7B;;;OAGG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AA+BD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,KAAK,EACL,IAAW,EACX,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,YAAY,GAAG,SAAS,CAkF1B;yBA3Fe,OAAO"}
|
package/dist/InfoTip/InfoTip.js
CHANGED
|
@@ -31,6 +31,7 @@ import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
|
31
31
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
32
32
|
import { useTouchHitArea } from "../utils/touchHitArea.js";
|
|
33
33
|
import { touchHitAreaStyles } from "../internal/touchHitArea.stylex.js";
|
|
34
|
+
import { pickDataAttributes } from "../utils/themeProps.js";
|
|
34
35
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
35
36
|
registerEnglishFallback(english);
|
|
36
37
|
|
|
@@ -84,7 +85,8 @@ export function InfoTip({
|
|
|
84
85
|
ref,
|
|
85
86
|
xstyle,
|
|
86
87
|
className,
|
|
87
|
-
style
|
|
88
|
+
style,
|
|
89
|
+
...rest
|
|
88
90
|
}) {
|
|
89
91
|
const t = useComponentTranslator();
|
|
90
92
|
const hitAreaRef = useTouchHitArea(true);
|
|
@@ -134,6 +136,7 @@ export function InfoTip({
|
|
|
134
136
|
// enclosing Dialog.
|
|
135
137
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
136
138
|
children: [/*#__PURE__*/_jsx("button", {
|
|
139
|
+
...pickDataAttributes(rest),
|
|
137
140
|
ref: mergedRef,
|
|
138
141
|
type: "button",
|
|
139
142
|
"aria-label": label ?? t('@astryx.infoTip.label'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerAnimations.stylex.d.ts","sourceRoot":"","sources":["../../src/Layer/layerAnimations.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"layerAnimations.stylex.d.ts","sourceRoot":"","sources":["../../src/Layer/layerAnimations.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AA8F3C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuC1B,CAAC"}
|
|
@@ -41,24 +41,28 @@ import "../theme/tokens.stylex.js";
|
|
|
41
41
|
import { durationVars, easeVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
42
42
|
|
|
43
43
|
// The layer runtime writes the side a shown anchored layer landed on. It
|
|
44
|
-
// writes a step toward the trigger on each axis (-1, 0 or 1)
|
|
45
|
-
//
|
|
46
|
-
// nothing is written.
|
|
44
|
+
// writes a step toward the trigger on each axis (-1, 0 or 1) and the scale's
|
|
45
|
+
// origin. It also writes the room to the trigger, which caps the step. Each
|
|
46
|
+
// fallback is the placement's own side, used when nothing is written.
|
|
47
47
|
const ENTER_X = '--_astryx-layer-enter-x';
|
|
48
48
|
const ENTER_Y = '--_astryx-layer-enter-y';
|
|
49
49
|
const ENTER_ORIGIN = '--_astryx-layer-enter-origin';
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
50
|
+
const ENTER_GAP = '--_astryx-layer-enter-gap';
|
|
51
|
+
// One step: the spacing token, or the room to the trigger when that is less.
|
|
52
|
+
// Without a written gap, the step is the token.
|
|
53
|
+
const STEP = `min(${spacingVars['--spacing-2']}, var(${ENTER_GAP}, ${spacingVars['--spacing-2']}))`;
|
|
54
|
+
const enterBelow = "x1fbltco-B";
|
|
55
|
+
const enterAbove = "xmqt0mh-B";
|
|
56
|
+
const enterEnd = "x1yqd01s-B";
|
|
57
|
+
const enterStart = "x12ghk8m-B";
|
|
54
58
|
|
|
55
59
|
// RTL: the horizontal fallback is a physical translateX, so it mirrors under
|
|
56
60
|
// RTL. A layer on the inline-end or inline-start side then slides in from
|
|
57
61
|
// the physical side that follows the reading flow. Only the horizontal
|
|
58
62
|
// fallbacks mirror; the vertical ones are direction-neutral. The side the
|
|
59
63
|
// runtime writes is physical already.
|
|
60
|
-
const enterEndRtl = "
|
|
61
|
-
const enterStartRtl = "
|
|
64
|
+
const enterEndRtl = "x12ghk8m-B";
|
|
65
|
+
const enterStartRtl = "x1yqd01s-B";
|
|
62
66
|
|
|
63
67
|
// Reduce Motion under a finger: the same entrance without its travel. A touch
|
|
64
68
|
// presentation substitutes a cross-fade for motion, never a jump.
|
|
@@ -95,7 +99,7 @@ const animationBase = {
|
|
|
95
99
|
*/
|
|
96
100
|
export const layerAnimations = {
|
|
97
101
|
below: {
|
|
98
|
-
kKVMdj: "
|
|
102
|
+
kKVMdj: "x1d5jn3a x2g3n7u xaqowwx",
|
|
99
103
|
k44tkh: "x9uej1z x10got5w",
|
|
100
104
|
kyAemX: "x128ha8g",
|
|
101
105
|
kWV6AL: "xskzprw",
|
|
@@ -103,7 +107,7 @@ export const layerAnimations = {
|
|
|
103
107
|
$$css: true
|
|
104
108
|
},
|
|
105
109
|
above: {
|
|
106
|
-
kKVMdj: "
|
|
110
|
+
kKVMdj: "xksu0ym x2g3n7u xaqowwx",
|
|
107
111
|
k44tkh: "x9uej1z x10got5w",
|
|
108
112
|
kyAemX: "x128ha8g",
|
|
109
113
|
kWV6AL: "xskzprw",
|
|
@@ -111,7 +115,7 @@ export const layerAnimations = {
|
|
|
111
115
|
$$css: true
|
|
112
116
|
},
|
|
113
117
|
end: {
|
|
114
|
-
kKVMdj: "
|
|
118
|
+
kKVMdj: "xyzx0um xixcm9l x2g3n7u xaqowwx",
|
|
115
119
|
k44tkh: "x9uej1z x10got5w",
|
|
116
120
|
kyAemX: "x128ha8g",
|
|
117
121
|
kWV6AL: "xskzprw",
|
|
@@ -119,7 +123,7 @@ export const layerAnimations = {
|
|
|
119
123
|
$$css: true
|
|
120
124
|
},
|
|
121
125
|
start: {
|
|
122
|
-
kKVMdj: "
|
|
126
|
+
kKVMdj: "x1qqotkc x1g7o29q x2g3n7u xaqowwx",
|
|
123
127
|
k44tkh: "x9uej1z x10got5w",
|
|
124
128
|
kyAemX: "x128ha8g",
|
|
125
129
|
kWV6AL: "xskzprw",
|
|
@@ -4,6 +4,8 @@ export declare const LAYER_ENTER_X_PROPERTY = "--_astryx-layer-enter-x";
|
|
|
4
4
|
export declare const LAYER_ENTER_Y_PROPERTY = "--_astryx-layer-enter-y";
|
|
5
5
|
/** The scale's origin, in px from the layer's top-left corner. */
|
|
6
6
|
export declare const LAYER_ENTER_ORIGIN_PROPERTY = "--_astryx-layer-enter-origin";
|
|
7
|
+
/** The room between the layer and its anchor: the longest step it takes. */
|
|
8
|
+
export declare const LAYER_ENTER_GAP_PROPERTY = "--_astryx-layer-enter-gap";
|
|
7
9
|
interface Box {
|
|
8
10
|
readonly left: number;
|
|
9
11
|
readonly top: number;
|
|
@@ -17,15 +19,25 @@ export interface LayerEntranceSide {
|
|
|
17
19
|
/** Where the layer meets its anchor, in px from the layer's top-left. */
|
|
18
20
|
readonly originX: number;
|
|
19
21
|
readonly originY: number;
|
|
22
|
+
/**
|
|
23
|
+
* The room between the layer and its anchor on the step's axis, in px.
|
|
24
|
+
* `null` for a point anchor, at most a pixel each way, such as a menu's
|
|
25
|
+
* cursor anchor.
|
|
26
|
+
*/
|
|
27
|
+
readonly gap: number | null;
|
|
20
28
|
}
|
|
21
29
|
/**
|
|
22
30
|
* The side that `layer` sits on against `anchor`, with the step toward the
|
|
23
|
-
* anchor. The origin is where the two meet: on the layer's edge that faces
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
31
|
+
* anchor. The origin is where the two meet: on the layer's edge that faces the
|
|
32
|
+
* anchor, on the anchor's center line. It stays on that edge. The gap is the
|
|
33
|
+
* room between the two on the step's axis. The step never goes past it, so no
|
|
34
|
+
* frame of the entrance covers a sized anchor. A layer flush against or over
|
|
35
|
+
* its anchor takes no step. An anchor of at most a pixel each way, such as a
|
|
36
|
+
* menu's cursor anchor, is a point. A point has no gap, and its layer takes the
|
|
37
|
+
* whole step. The side is the axis on which the two centers are furthest apart,
|
|
38
|
+
* in half their joint size. A layer that overlaps its anchor by a few pixels (a
|
|
39
|
+
* submenu against its row) thus still has a side. A layer over its anchor's
|
|
40
|
+
* center (a list over its selected item) has no side. It does not move, and it
|
|
29
41
|
* scales about that center. `null` for a box without size.
|
|
30
42
|
*/
|
|
31
43
|
export declare function layerEntranceSide(layer: Box, anchor: Box): LayerEntranceSide | null;
|
|
@@ -37,10 +49,12 @@ export declare function layerEntranceSide(layer: Box, anchor: Box): LayerEntranc
|
|
|
37
49
|
export declare function readLayerEntranceSide(layer: HTMLElement, anchor: Element): LayerEntranceSide | null;
|
|
38
50
|
/**
|
|
39
51
|
* Gives the layer's entrance the side the layer landed on after any flip.
|
|
40
|
-
* The entrance then slides from that side,
|
|
41
|
-
* the layer meets its anchor.
|
|
42
|
-
*
|
|
43
|
-
*
|
|
52
|
+
* The entrance then slides from that side, no further than the gap, and
|
|
53
|
+
* scales about the point where the layer meets its anchor. A layer at a
|
|
54
|
+
* point, as a menu at its cursor anchor, has no gap and takes the whole
|
|
55
|
+
* step. It only writes, so it can follow a pass that read the boxes. `null`
|
|
56
|
+
* sets the properties to `initial`. The entrance then keeps its placement's
|
|
57
|
+
* side, and a layer inside never inherits the values.
|
|
44
58
|
*/
|
|
45
59
|
export declare function writeLayerEntranceSide(layer: HTMLElement, side: LayerEntranceSide | null): void;
|
|
46
60
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layerEntranceSide.d.ts","sourceRoot":"","sources":["../../src/Layer/layerEntranceSide.ts"],"names":[],"mappings":"AAkBA,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,8DAA8D;AAC9D,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"layerEntranceSide.d.ts","sourceRoot":"","sources":["../../src/Layer/layerEntranceSide.ts"],"names":[],"mappings":"AAkBA,mEAAmE;AACnE,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,8DAA8D;AAC9D,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,iCAAiC,CAAC;AAC1E,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,UAAU,GAAG;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAID;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,GAAG,EACV,MAAM,EAAE,GAAG,GACV,iBAAiB,GAAG,IAAI,CAuD1B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,OAAO,GACd,iBAAiB,GAAG,IAAI,CAG1B;AAID;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAC7B,IAAI,CAmBN"}
|
|
@@ -22,16 +22,22 @@ export const LAYER_ENTER_X_PROPERTY = '--_astryx-layer-enter-x';
|
|
|
22
22
|
export const LAYER_ENTER_Y_PROPERTY = '--_astryx-layer-enter-y';
|
|
23
23
|
/** The scale's origin, in px from the layer's top-left corner. */
|
|
24
24
|
export const LAYER_ENTER_ORIGIN_PROPERTY = '--_astryx-layer-enter-origin';
|
|
25
|
+
/** The room between the layer and its anchor: the longest step it takes. */
|
|
26
|
+
export const LAYER_ENTER_GAP_PROPERTY = '--_astryx-layer-enter-gap';
|
|
25
27
|
const clamp = (value, max) => Math.min(max, Math.max(0, value));
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* The side that `layer` sits on against `anchor`, with the step toward the
|
|
29
|
-
* anchor. The origin is where the two meet: on the layer's edge that faces
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* anchor. The origin is where the two meet: on the layer's edge that faces the
|
|
32
|
+
* anchor, on the anchor's center line. It stays on that edge. The gap is the
|
|
33
|
+
* room between the two on the step's axis. The step never goes past it, so no
|
|
34
|
+
* frame of the entrance covers a sized anchor. A layer flush against or over
|
|
35
|
+
* its anchor takes no step. An anchor of at most a pixel each way, such as a
|
|
36
|
+
* menu's cursor anchor, is a point. A point has no gap, and its layer takes the
|
|
37
|
+
* whole step. The side is the axis on which the two centers are furthest apart,
|
|
38
|
+
* in half their joint size. A layer that overlaps its anchor by a few pixels (a
|
|
39
|
+
* submenu against its row) thus still has a side. A layer over its anchor's
|
|
40
|
+
* center (a list over its selected item) has no side. It does not move, and it
|
|
35
41
|
* scales about that center. `null` for a box without size.
|
|
36
42
|
*/
|
|
37
43
|
export function layerEntranceSide(layer, anchor) {
|
|
@@ -42,13 +48,15 @@ export function layerEntranceSide(layer, anchor) {
|
|
|
42
48
|
const anchorY = anchor.top + anchor.height / 2;
|
|
43
49
|
const originX = clamp(anchorX - layer.left, layer.width);
|
|
44
50
|
const originY = clamp(anchorY - layer.top, layer.height);
|
|
51
|
+
const isPoint = anchor.width <= 1 && anchor.height <= 1;
|
|
45
52
|
const coversAnchor = originX > 0 && originX < layer.width && originY > 0 && originY < layer.height;
|
|
46
53
|
if (coversAnchor) {
|
|
47
54
|
return {
|
|
48
55
|
x: 0,
|
|
49
56
|
y: 0,
|
|
50
57
|
originX,
|
|
51
|
-
originY
|
|
58
|
+
originY,
|
|
59
|
+
gap: 0
|
|
52
60
|
};
|
|
53
61
|
}
|
|
54
62
|
const apartX = (layer.left + layer.width / 2 - anchorX) / ((layer.width + anchor.width) / 2);
|
|
@@ -59,7 +67,8 @@ export function layerEntranceSide(layer, anchor) {
|
|
|
59
67
|
x: 0,
|
|
60
68
|
y: below ? -1 : 1,
|
|
61
69
|
originX,
|
|
62
|
-
originY: below ? 0 : layer.height
|
|
70
|
+
originY: below ? 0 : layer.height,
|
|
71
|
+
gap: isPoint ? null : Math.max(0, below ? layer.top - (anchor.top + anchor.height) : anchor.top - (layer.top + layer.height))
|
|
63
72
|
};
|
|
64
73
|
}
|
|
65
74
|
const right = apartX > 0;
|
|
@@ -67,7 +76,8 @@ export function layerEntranceSide(layer, anchor) {
|
|
|
67
76
|
x: right ? -1 : 1,
|
|
68
77
|
y: 0,
|
|
69
78
|
originX: right ? 0 : layer.width,
|
|
70
|
-
originY
|
|
79
|
+
originY,
|
|
80
|
+
gap: isPoint ? null : Math.max(0, right ? layer.left - (anchor.left + anchor.width) : anchor.left - (layer.left + layer.width))
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
83
|
|
|
@@ -84,13 +94,18 @@ const px = value => `${Math.round(value * 1000) / 1000}px`;
|
|
|
84
94
|
|
|
85
95
|
/**
|
|
86
96
|
* Gives the layer's entrance the side the layer landed on after any flip.
|
|
87
|
-
* The entrance then slides from that side,
|
|
88
|
-
* the layer meets its anchor.
|
|
89
|
-
*
|
|
90
|
-
*
|
|
97
|
+
* The entrance then slides from that side, no further than the gap, and
|
|
98
|
+
* scales about the point where the layer meets its anchor. A layer at a
|
|
99
|
+
* point, as a menu at its cursor anchor, has no gap and takes the whole
|
|
100
|
+
* step. It only writes, so it can follow a pass that read the boxes. `null`
|
|
101
|
+
* sets the properties to `initial`. The entrance then keeps its placement's
|
|
102
|
+
* side, and a layer inside never inherits the values.
|
|
91
103
|
*/
|
|
92
104
|
export function writeLayerEntranceSide(layer, side) {
|
|
93
105
|
layer.style.setProperty(LAYER_ENTER_X_PROPERTY, side == null ? 'initial' : String(side.x));
|
|
94
106
|
layer.style.setProperty(LAYER_ENTER_Y_PROPERTY, side == null ? 'initial' : String(side.y));
|
|
95
107
|
layer.style.setProperty(LAYER_ENTER_ORIGIN_PROPERTY, side == null ? 'initial' : `${px(side.originX)} ${px(side.originY)}`);
|
|
108
|
+
// Floored, so rounding never carries the step past the anchor's edge.
|
|
109
|
+
const gap = side?.gap == null ? null : Math.floor(side.gap * 1000) / 1000;
|
|
110
|
+
layer.style.setProperty(LAYER_ENTER_GAP_PROPERTY, gap == null ? 'initial' : `${gap}px`);
|
|
96
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLayer.d.ts","sourceRoot":"","sources":["../../src/Layer/useLayer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAQZ,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file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AAkB,CAAC;AAC3E,wBAAgB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;AAOvE;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,2BAA2B,GACnC,kBAAkB,CAAC;AACtB,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAAC"}
|
package/dist/Layer/useLayer.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* - /packages/core/src/Layer/index.ts
|
|
15
15
|
*/
|
|
16
16
|
import React, { useCallback, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from 'react';
|
|
17
|
+
import { useCommittedRef, useCommittedRefInto } from "../hooks/useCommittedRef.js";
|
|
17
18
|
import * as stylex from '@stylexjs/stylex';
|
|
18
19
|
import { createPortal } from 'react-dom';
|
|
19
20
|
import { LayerContentBoundary } from "./layerScopedContext.js";
|
|
@@ -793,16 +794,18 @@ function getGutterStyles(placement, alignment) {
|
|
|
793
794
|
* of the public useLayer or usePopover return types.
|
|
794
795
|
*/
|
|
795
796
|
export function useKeepLayerOpenProps(id, isOpen) {
|
|
796
|
-
const isOpenRef = useRef(isOpen);
|
|
797
|
-
isOpenRef.current = isOpen;
|
|
798
797
|
return useMemo(() => ({
|
|
799
798
|
onPointerDown: event => {
|
|
800
|
-
|
|
799
|
+
const control = event.currentTarget;
|
|
800
|
+
const doc = control.ownerDocument;
|
|
801
|
+
// The runtime shows the layer before its open state commits. The
|
|
802
|
+
// layer renders in the control's own tree, a shadow root included.
|
|
803
|
+
const root = control.getRootNode();
|
|
804
|
+
const layer = (isShadowRoot(root) ? root : doc).getElementById(id);
|
|
805
|
+
if (!isOpen && (layer == null || !isShownAsPopover(layer))) {
|
|
801
806
|
return;
|
|
802
807
|
}
|
|
803
808
|
// The browser reads the invoker relationship at both ends of the press.
|
|
804
|
-
const control = event.currentTarget;
|
|
805
|
-
const doc = control.ownerDocument;
|
|
806
809
|
control.setAttribute('popovertarget', id);
|
|
807
810
|
const onPressEnd = () => {
|
|
808
811
|
doc.removeEventListener('pointerup', onPressEnd);
|
|
@@ -823,7 +826,7 @@ export function useKeepLayerOpenProps(id, isOpen) {
|
|
|
823
826
|
control.removeAttribute('popovertarget');
|
|
824
827
|
}
|
|
825
828
|
}
|
|
826
|
-
}), [id]);
|
|
829
|
+
}), [id, isOpen]);
|
|
827
830
|
}
|
|
828
831
|
|
|
829
832
|
/**
|
|
@@ -852,8 +855,8 @@ function useLayerImplementation(options) {
|
|
|
852
855
|
const keepsAnchorClear = mode === 'context' ? options.keepsAnchorClear ?? false : false;
|
|
853
856
|
const watchesOutsidePans = mode === 'context' ? options.watchesOutsidePans : undefined;
|
|
854
857
|
const writesEntranceSide = mode === 'context' ? options.writesEntranceSide ?? false : false;
|
|
855
|
-
const
|
|
856
|
-
onCloseStartRef
|
|
858
|
+
const onCloseStart = mode === 'context' ? options.onCloseStart : undefined;
|
|
859
|
+
const onCloseStartRef = useCommittedRef(onCloseStart);
|
|
857
860
|
const id = useId();
|
|
858
861
|
const anchorId = `--astryx-layer-${id.replace(/:/g, '')}`;
|
|
859
862
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -1332,12 +1335,12 @@ function useLayerImplementation(options) {
|
|
|
1332
1335
|
}
|
|
1333
1336
|
releaseAnchor(popoverRef.current);
|
|
1334
1337
|
clearContextMount();
|
|
1335
|
-
}, [onHide, clearContextMount, releaseAnchor, cancelPendingAnchorWait, stopOutsidePanWatch]);
|
|
1338
|
+
}, [onHide, clearContextMount, releaseAnchor, cancelPendingAnchorWait, stopOutsidePanWatch, onCloseStartRef]);
|
|
1336
1339
|
|
|
1337
1340
|
// A deferred show() replays through a ref so the queued closure reaches the
|
|
1338
1341
|
// current callback rather than the one captured when it was queued.
|
|
1339
1342
|
const showRef = useRef(show);
|
|
1340
|
-
showRef
|
|
1343
|
+
useCommittedRefInto(showRef, show);
|
|
1341
1344
|
|
|
1342
1345
|
// The open-state geometry observers of a layer that keeps its anchor clear
|
|
1343
1346
|
// (`observeAnchorClearance`), as their teardown. The open-state layout
|
|
@@ -1531,7 +1534,7 @@ function useLayerImplementation(options) {
|
|
|
1531
1534
|
exitRef.current = null;
|
|
1532
1535
|
removeAnchorName(trigger, anchorId);
|
|
1533
1536
|
}
|
|
1534
|
-
}, [anchorId]);
|
|
1537
|
+
}, [anchorId, onCloseStartRef]);
|
|
1535
1538
|
const handleToggle = useCallback(e => {
|
|
1536
1539
|
const toggleEvent = e;
|
|
1537
1540
|
if (toggleEvent.newState === 'closed' && isOpenRef.current) {
|
package/dist/List/ListItem.d.ts
CHANGED
|
@@ -61,12 +61,13 @@ export interface ListItemProps extends BaseProps<HTMLLIElement> {
|
|
|
61
61
|
*/
|
|
62
62
|
description?: ReactNode;
|
|
63
63
|
/**
|
|
64
|
-
* Content
|
|
64
|
+
* Content before the label, inside the row (icon, avatar, checkbox).
|
|
65
65
|
* Uses start/end naming for RTL support.
|
|
66
66
|
*/
|
|
67
67
|
startContent?: ReactNode;
|
|
68
68
|
/**
|
|
69
|
-
* Content
|
|
69
|
+
* Content after the label and description, inside the row (badge, action
|
|
70
|
+
* button, chevron).
|
|
70
71
|
*/
|
|
71
72
|
endContent?: ReactNode;
|
|
72
73
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.d.ts","sourceRoot":"","sources":["../../src/List/ListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,EAAuB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAS3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAU5C,OAAO,KAAK,EAAC,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAa5E,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,aAAa,CAAC;IAC7D,wCAAwC;IACxC,GAAG,CAAC,EAAE,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MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAEhC;;;;OAIG;IACH,aAAa,CAAC,EAAE,iBAAiB,CAAC;CACnC;AA6PD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,OAAO,EACP,cAAc,EACd,IAAI,EACJ,MAAM,EACN,GAAG,EACH,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,SAAS,EACb,EAAE,aAAa,+BA8Mf;yBAjOe,QAAQ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as stylex from '@stylexjs/stylex';
|
|
2
2
|
import type { ListReorderHandleProps, ListReorderRowNameProps } from './listReorderContext.js';
|
|
3
|
+
import type { ListReorderHandleName } from './listReorderEngine.js';
|
|
3
4
|
/**
|
|
4
5
|
* The style of a row that ends with a handle, which ListItem applies. Its
|
|
5
6
|
* ring on focus within stays off for the handle, which rings itself.
|
|
@@ -47,6 +48,12 @@ export declare function ListReorderHandle({ label, itemKey, isDisabled, rowLabel
|
|
|
47
48
|
export declare namespace ListReorderHandle {
|
|
48
49
|
var displayName: string;
|
|
49
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* A handle's name before the session reads it: its server snapshot, and the
|
|
53
|
+
* session's answer for a handle it has not read. One object keeps the
|
|
54
|
+
* snapshot through hydration and the first read.
|
|
55
|
+
*/
|
|
56
|
+
export declare const UNREAD_HANDLE_NAME: ListReorderHandleName;
|
|
50
57
|
/**
|
|
51
58
|
* Names a reorderable List's row that has no handle, for the announcements
|
|
52
59
|
* of the moves beside it. That is a row that stays, or one without an item
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListReorderHandle.d.ts","sourceRoot":"","sources":["../../src/List/ListReorderHandle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ListReorderHandle.d.ts","sourceRoot":"","sources":["../../src/List/ListReorderHandle.tsx"],"names":[],"mappings":"AA2CA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAoB3C,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AA+G7B;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;EAAqC,CAAC;AAElE,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,IAAI,CAAC;AA6B1C,6EAA6E;AAC7E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;KAA4C,CAAC;AAW1E;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,UAAkB,EAClB,QAAQ,EACR,aAAa,EACb,QAAQ,GACT,EAAE,sBAAsB,sCAuJxB;yBA9Je,iBAAiB;;;AAoKjC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,qBAGhC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EAAC,GAAG,EAAE,KAAK,EAAC,EAAE,uBAAuB,QAUvE;yBAVe,kBAAkB"}
|