@astryxdesign/core 0.7.15 → 0.7.16-canary.g54dd64e
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/AppShell/AppShell.d.ts.map +1 -1
- package/dist/AppShell/AppShell.js +8 -2
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +11 -6
- package/dist/DateInput/DateInput.d.ts +3 -3
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +13 -2
- package/dist/DateInput/NativeDateField.d.ts +1 -1
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +48 -31
- package/dist/DateInput/useTypedDate.d.ts +66 -6
- package/dist/DateInput/useTypedDate.d.ts.map +1 -1
- package/dist/DateInput/useTypedDate.js +151 -21
- package/dist/DateTimeInput/DateTimeInput.d.ts +3 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +26 -3
- package/dist/DateTimeInput/NativeDateSegment.d.ts +8 -1
- package/dist/DateTimeInput/NativeDateSegment.d.ts.map +1 -1
- package/dist/DateTimeInput/NativeDateSegment.js +20 -14
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +10 -3
- 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/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +625 -180
- 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/sortable/useTableSortableState.d.ts.map +1 -1
- package/dist/Table/plugins/sortable/useTableSortableState.js +4 -4
- 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/Text/useTruncation.d.ts +6 -1
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +53 -35
- 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 +22 -11
- 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/DateInput/NativeDateField.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateInput/NativeDateField.generated.js +0 -1
- package/dist/i18n/generated-english/DateTimeInput/NativeDateSegment.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/DateTimeInput/NativeDateSegment.generated.js +0 -1
- package/dist/i18n/generated-english/Lightbox/Lightbox.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Lightbox/Lightbox.generated.js +2 -0
- 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 +32 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +32 -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/sharedResizeObserver.d.ts +18 -2
- package/dist/utils/sharedResizeObserver.d.ts.map +1 -1
- package/dist/utils/sharedResizeObserver.js +43 -2
- 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 +129 -1
- package/locales/pseudo.json +96 -0
- package/package.json +5 -5
- package/src/AppShell/AppShell.tsx +12 -3
- 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/DateInput/DateInput.doc.mjs +3 -3
- package/src/DateInput/DateInput.tsx +27 -5
- package/src/DateInput/NativeDateField.tsx +58 -36
- package/src/DateInput/useTypedDate.ts +226 -55
- package/src/DateTimeInput/DateTimeInput.doc.mjs +3 -3
- package/src/DateTimeInput/DateTimeInput.tsx +38 -5
- package/src/DateTimeInput/NativeDateSegment.tsx +35 -13
- package/src/DropdownMenu/DropdownMenu.tsx +10 -3
- 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/Lightbox/Lightbox.doc.mjs +2 -1
- package/src/Lightbox/Lightbox.tsx +864 -257
- 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/sortable/useTableSortableState.tsx +4 -4
- 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/Text/useTruncation.doc.mjs +10 -0
- package/src/Text/useTruncation.ts +53 -35
- 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/DateInput/NativeDateField.generated.ts +0 -1
- package/src/i18n/generated-english/DateTimeInput/NativeDateSegment.generated.ts +0 -1
- package/src/i18n/generated-english/Lightbox/Lightbox.generated.ts +2 -0
- package/src/i18n/generated-english/Table/plugins/infiniteScroll/useTableInfiniteScroll.generated.ts +13 -0
- package/src/i18n/generated-locales/en.generated.ts +34 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +34 -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/sharedResizeObserver.ts +46 -2
- 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
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":"useL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,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) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lightbox.d.ts","sourceRoot":"","sources":["../../src/Lightbox/Lightbox.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Lightbox.d.ts","sourceRoot":"","sources":["../../src/Lightbox/Lightbox.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAWL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAyBf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgD5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,gEAAgE;IAChE,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IACjE,+CAA+C;IAC/C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;OAEG;IACH,MAAM,EAAE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