@astryxdesign/core 0.7.8-canary.f50bc74 → 0.7.8-canary.f60d2bb
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 +6 -3
- package/dist/Calendar/Calendar.d.ts.map +1 -1
- package/dist/Calendar/Calendar.js +3 -6
- package/dist/Calendar/getWeekdayHeaderNames.d.ts +16 -0
- package/dist/Calendar/getWeekdayHeaderNames.d.ts.map +1 -0
- package/dist/Calendar/getWeekdayHeaderNames.js +70 -0
- package/dist/Calendar/hooks/useCalendarDays.d.ts.map +1 -1
- package/dist/Calendar/hooks/useCalendarDays.js +2 -10
- package/dist/Calendar/{standaloneShortWeekdayNames.generated.d.ts → weekdayHeaderNames.generated.d.ts} +14 -14
- package/dist/Calendar/weekdayHeaderNames.generated.d.ts.map +1 -0
- package/dist/Calendar/{standaloneShortWeekdayNames.generated.js → weekdayHeaderNames.generated.js} +12 -12
- package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
- package/dist/Chat/ChatComposerInput.js +2 -1
- package/dist/CheckboxList/CheckboxList.d.ts +8 -1
- package/dist/CheckboxList/CheckboxList.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxList.js +2 -0
- package/dist/DateInput/PickerWheel.d.ts.map +1 -1
- package/dist/DateInput/PickerWheel.js +0 -3
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +8 -30
- package/dist/DateInput/Wheel.d.ts.map +1 -1
- package/dist/DateInput/Wheel.js +34 -8
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +8 -10
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +6 -1
- package/dist/Icon/Icon.d.ts +3 -3
- package/dist/Icon/Icon.d.ts.map +1 -1
- package/dist/Icon/Icon.js +15 -1
- package/dist/InfoTip/InfoTip.d.ts +5 -5
- package/dist/InfoTip/InfoTip.d.ts.map +1 -1
- package/dist/InfoTip/InfoTip.js +58 -19
- package/dist/Layer/useLayer.js +1 -1
- package/dist/Layer/useTouchTrigger.d.ts +13 -7
- package/dist/Layer/useTouchTrigger.d.ts.map +1 -1
- package/dist/Layer/useTouchTrigger.js +17 -6
- package/dist/Layout/index.d.ts +1 -1
- package/dist/Layout/index.d.ts.map +1 -1
- package/dist/Layout/index.js +1 -1
- package/dist/Layout/layoutReset.js +1 -1
- package/dist/Layout/overlayPaddingReset.stylex.d.ts +68 -0
- package/dist/Layout/overlayPaddingReset.stylex.d.ts.map +1 -0
- package/dist/Layout/overlayPaddingReset.stylex.js +72 -0
- package/dist/Layout/padding.stylex.d.ts +5 -129
- package/dist/Layout/padding.stylex.d.ts.map +1 -1
- package/dist/Layout/padding.stylex.js +9 -143
- package/dist/Layout/paddingStyles.stylex.d.ts +83 -0
- package/dist/Layout/paddingStyles.stylex.d.ts.map +1 -0
- package/dist/Layout/paddingStyles.stylex.js +99 -0
- package/dist/Lightbox/Lightbox.js +1 -1
- package/dist/MobileNav/MobileNav.js +1 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +2 -1
- package/dist/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/NumberInput/NumberInput.js +2 -1
- package/dist/Overlay/Overlay.d.ts.map +1 -1
- package/dist/Overlay/Overlay.js +7 -2
- package/dist/Popover/usePopover.js +2 -2
- package/dist/PowerSearch/PowerSearch.d.ts +6 -4
- package/dist/PowerSearch/PowerSearch.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearch.js +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts +24 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchBottomSheet.js +172 -50
- package/dist/PowerSearch/PowerSearchEditPopover.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchEditPopover.js +18 -4
- package/dist/PowerSearch/PowerSearchToken.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchToken.js +1 -5
- package/dist/PowerSearch/PowerSearchValueEditor.d.ts.map +1 -1
- package/dist/PowerSearch/PowerSearchValueEditor.js +84 -7
- package/dist/PowerSearch/formatFilterValue.d.ts +2 -7
- package/dist/PowerSearch/formatFilterValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatFilterValue.js +2 -15
- package/dist/PowerSearch/formatTokenValue.d.ts.map +1 -1
- package/dist/PowerSearch/formatTokenValue.js +3 -4
- package/dist/PowerSearch/powerSearchDateZone.d.ts +5 -1
- package/dist/PowerSearch/powerSearchDateZone.d.ts.map +1 -1
- package/dist/PowerSearch/powerSearchDateZone.js +22 -2
- package/dist/PowerSearch/types.d.ts +6 -1
- package/dist/PowerSearch/types.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.d.ts.map +1 -1
- package/dist/Resizable/ResizeHandle.js +15 -15
- package/dist/Resizable/createResizable.d.ts +70 -16
- package/dist/Resizable/createResizable.d.ts.map +1 -1
- package/dist/Resizable/createResizable.js +180 -22
- package/dist/Resizable/separatorAttributes.d.ts +45 -0
- package/dist/Resizable/separatorAttributes.d.ts.map +1 -0
- package/dist/Resizable/separatorAttributes.js +35 -0
- package/dist/Resizable/useResizable.js +2 -2
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +2 -1
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +36 -5
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +16 -11
- package/dist/Stepper/Stepper.d.ts.map +1 -1
- package/dist/Stepper/Stepper.js +10 -15
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts +12 -0
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.d.ts.map +1 -1
- package/dist/Table/plugins/rowExpansion/useTableRowExpansion.js +13 -3
- package/dist/Table/plugins/tree/useTableTreeData.d.ts +11 -0
- package/dist/Table/plugins/tree/useTableTreeData.d.ts.map +1 -1
- package/dist/Table/plugins/tree/useTableTreeData.js +27 -14
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +2 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +2 -1
- package/dist/Timestamp/formatInstant.d.ts.map +1 -1
- package/dist/Timestamp/formatInstant.js +1 -23
- package/dist/Tokenizer/Tokenizer.d.ts +0 -14
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +2 -6
- package/dist/Tokenizer/TokenizerBottomSheet.js +11 -17
- package/dist/Tooltip/Tooltip.d.ts +2 -23
- package/dist/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip/Tooltip.js +5 -29
- package/dist/Tooltip/useTooltip.d.ts +7 -32
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +182 -71
- package/dist/astryx.css +11 -1
- package/dist/hooks/actionGroupTracker.d.ts.map +1 -1
- package/dist/hooks/actionGroupTracker.js +5 -4
- package/dist/hooks/scrollLockTouchGuard.d.ts.map +1 -1
- package/dist/hooks/scrollLockTouchGuard.js +9 -26
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +2 -2
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.d.ts +3 -2
- package/dist/hooks/useScrollLock.d.ts.map +1 -1
- package/dist/hooks/useScrollLock.js +3 -8
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.js +5 -2
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts +8 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.d.ts.map +1 -0
- package/dist/i18n/generated-english/Resizable/createResizable.generated.js +13 -0
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.js +3 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.d.ts.map +1 -1
- package/dist/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.js +3 -1
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +9 -2
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +9 -2
- package/dist/motion/animatedLayout.d.ts +8 -0
- package/dist/motion/animatedLayout.d.ts.map +1 -1
- package/dist/motion/animatedLayout.js +239 -46
- package/dist/motion/animator.d.ts.map +1 -1
- package/dist/motion/animator.js +1 -7
- package/dist/motion/frameBlock.d.ts +14 -0
- package/dist/motion/frameBlock.d.ts.map +1 -0
- package/dist/motion/frameBlock.js +16 -0
- package/dist/motion/uikit/datePicker.d.ts +58 -0
- package/dist/motion/uikit/datePicker.d.ts.map +1 -0
- package/dist/motion/uikit/datePicker.js +60 -0
- package/dist/motion/uikit/index.d.ts +4 -3
- package/dist/motion/uikit/index.d.ts.map +1 -1
- package/dist/motion/uikit/index.js +4 -3
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +14 -13
- package/dist/theme/themeMotion.d.ts.map +1 -1
- package/dist/theme/themeMotion.js +8 -2
- package/dist/theme/tokens.stylex.d.ts +3 -0
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +4 -1
- package/dist/utils/disabledInteraction.d.ts +10 -2
- package/dist/utils/disabledInteraction.d.ts.map +1 -1
- package/dist/utils/disabledInteraction.js +16 -2
- package/dist/utils/focusReturn.d.ts +7 -25
- package/dist/utils/focusReturn.d.ts.map +1 -1
- package/dist/utils/focusReturn.js +8 -29
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/interactionOverlay.stylex.d.ts +3 -2
- package/dist/utils/interactionOverlay.stylex.d.ts.map +1 -1
- package/dist/utils/interactionOverlay.stylex.js +3 -2
- package/dist/utils/isFocusDetached.d.ts +27 -0
- package/dist/utils/isFocusDetached.d.ts.map +1 -0
- package/dist/utils/isFocusDetached.js +32 -0
- package/dist/utils/plainDate.d.ts +23 -0
- package/dist/utils/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +49 -4
- package/dist/utils/pressFeedback.d.ts +6 -0
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +77 -12
- package/dist/utils/pressGesture.d.ts +4 -2
- package/dist/utils/pressGesture.d.ts.map +1 -1
- package/dist/utils/pressGesture.js +3 -1
- package/locales/en.json +37 -9
- package/locales/pseudo.json +27 -6
- package/package.json +4 -4
- package/src/AppShell/AppShell.tsx +9 -4
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +5 -0
- package/src/Calendar/Calendar.tsx +4 -7
- package/src/Calendar/getWeekdayHeaderNames.ts +88 -0
- package/src/Calendar/hooks/useCalendarDays.ts +5 -10
- package/src/Calendar/{standaloneShortWeekdayNames.generated.ts → weekdayHeaderNames.generated.ts} +14 -14
- package/src/Chat/ChatComposerInput.tsx +2 -7
- package/src/CheckboxList/CheckboxList.doc.mjs +7 -0
- package/src/CheckboxList/CheckboxList.tsx +9 -0
- package/src/DateInput/PickerWheel.tsx +2 -6
- package/src/DateInput/TouchDateField.tsx +5 -32
- package/src/DateInput/Wheel.tsx +67 -22
- package/src/DateTimeInput/TouchDateTimeField.tsx +6 -13
- package/src/HoverCard/useHoverCard.tsx +6 -1
- package/src/Icon/Icon.doc.mjs +5 -5
- package/src/Icon/Icon.tsx +19 -4
- package/src/InfoTip/InfoTip.tsx +72 -16
- package/src/Layer/useLayer.tsx +1 -1
- package/src/Layer/useTouchTrigger.ts +17 -6
- package/src/Layout/index.ts +1 -1
- package/src/Layout/layoutReset.ts +1 -1
- package/src/Layout/overlayPaddingReset.stylex.ts +73 -0
- package/src/Layout/padding.stylex.ts +9 -133
- package/src/Layout/paddingStyles.stylex.ts +87 -0
- package/src/Lightbox/Lightbox.tsx +1 -1
- package/src/Lightbox/useLightbox.doc.mjs +167 -0
- package/src/MobileNav/MobileNav.tsx +1 -1
- package/src/MultiSelector/MultiSelector.tsx +2 -7
- package/src/NumberInput/NumberInput.tsx +2 -7
- package/src/Overlay/Overlay.tsx +7 -2
- package/src/Popover/usePopover.tsx +2 -2
- package/src/PowerSearch/PowerSearch.doc.mjs +4 -4
- package/src/PowerSearch/PowerSearch.tsx +7 -5
- package/src/PowerSearch/PowerSearchBottomSheet.tsx +237 -62
- package/src/PowerSearch/PowerSearchEditPopover.tsx +26 -3
- package/src/PowerSearch/PowerSearchToken.tsx +1 -6
- package/src/PowerSearch/PowerSearchValueEditor.tsx +102 -7
- package/src/PowerSearch/formatFilterValue.ts +2 -18
- package/src/PowerSearch/formatTokenValue.ts +9 -11
- package/src/PowerSearch/powerSearchDateZone.ts +32 -1
- package/src/PowerSearch/types.ts +6 -1
- package/src/Resizable/ResizeHandle.tsx +18 -26
- package/src/Resizable/createResizable.ts +242 -27
- package/src/Resizable/separatorAttributes.ts +73 -0
- package/src/Resizable/useResizable.ts +2 -2
- package/src/Selector/Selector.tsx +2 -7
- package/src/SideNav/SideNav.tsx +41 -5
- package/src/Slider/Slider.tsx +20 -11
- package/src/Stepper/Stepper.tsx +10 -27
- package/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx +27 -7
- package/src/Table/plugins/tree/useTableTreeData.tsx +43 -20
- package/src/Table/useTableRowExpansion.doc.mjs +9 -0
- package/src/Table/useTableTreeData.doc.mjs +15 -3
- package/src/TextArea/TextArea.tsx +2 -7
- package/src/TextInput/TextInput.tsx +2 -7
- package/src/Timestamp/formatInstant.ts +1 -33
- package/src/Tokenizer/Tokenizer.doc.mjs +0 -16
- package/src/Tokenizer/Tokenizer.tsx +2 -25
- package/src/Tokenizer/TokenizerBottomSheet.tsx +16 -22
- package/src/Tooltip/Tooltip.tsx +6 -42
- package/src/Tooltip/useTooltip.tsx +201 -97
- package/src/hooks/actionGroupTracker.ts +5 -4
- package/src/hooks/scrollLockTouchGuard.ts +9 -42
- package/src/hooks/useScrollLock.ts +3 -7
- package/src/i18n/generated-english/PowerSearch/PowerSearchBottomSheet.generated.ts +5 -2
- package/src/i18n/generated-english/Resizable/createResizable.generated.ts +14 -0
- package/src/i18n/generated-english/Table/plugins/rowExpansion/useTableRowExpansion.generated.ts +3 -1
- package/src/i18n/generated-english/Table/plugins/tree/useTableTreeData.generated.ts +3 -1
- package/src/i18n/generated-locales/en.generated.ts +10 -4
- package/src/i18n/generated-locales/pseudo.generated.ts +10 -4
- package/src/motion/MEASUREMENTS.md +10 -0
- package/src/motion/README.md +1 -0
- package/src/motion/animatedLayout.ts +313 -55
- package/src/motion/animator.ts +1 -7
- package/src/motion/frameBlock.ts +16 -0
- package/src/motion/uikit/datePicker.ts +60 -0
- package/src/motion/uikit/index.ts +4 -3
- package/src/theme/generateThemeRules.ts +14 -12
- package/src/theme/themeMotion.ts +10 -2
- package/src/theme/tokens.stylex.ts +2 -0
- package/src/utils/disabledInteraction.ts +23 -2
- package/src/utils/focusReturn.ts +8 -31
- package/src/utils/index.ts +1 -1
- package/src/utils/interactionOverlay.stylex.ts +3 -2
- package/src/utils/isFocusDetached.ts +34 -0
- package/src/utils/plainDate.ts +59 -4
- package/src/utils/pressFeedback.ts +102 -24
- package/src/utils/pressGesture.ts +4 -2
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts +0 -14
- package/dist/Calendar/getStandaloneShortWeekdayNames.d.ts.map +0 -1
- package/dist/Calendar/getStandaloneShortWeekdayNames.js +0 -26
- package/dist/Calendar/standaloneShortWeekdayNames.generated.d.ts.map +0 -1
- package/dist/Layer/usePressPin.d.ts +0 -105
- package/dist/Layer/usePressPin.d.ts.map +0 -1
- package/dist/Layer/usePressPin.js +0 -413
- package/src/Calendar/getStandaloneShortWeekdayNames.ts +0 -38
- package/src/Layer/usePressPin.ts +0 -576
|
@@ -45,10 +45,11 @@ import { rtlStyles } from "../utils/rtlStyles.js";
|
|
|
45
45
|
import { themeProps } from "../utils/themeProps.js";
|
|
46
46
|
import { normalizeDayOfWeek } from "../utils/dateTypes.js";
|
|
47
47
|
import { formatLocaleTime } from "../utils/timeFormat.js";
|
|
48
|
+
import { getWeekdayHeaders } from "../Calendar/getWeekdayHeaderNames.js";
|
|
48
49
|
import { formatISOTime, isImeKeyEvent, isRenderable, isTimeInRange, clampTime, mergeProps, parseISOTime } from "../utils/index.js";
|
|
49
50
|
import { chainEventHandlers } from "../utils/chainEventHandlers.js";
|
|
50
51
|
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
51
|
-
import { DATE_FORMAT_LONG,
|
|
52
|
+
import { DATE_FORMAT_LONG, plainDateFormat, plainDateFromISO, plainDateToday } from "../utils/plainDate.js";
|
|
52
53
|
import { plainDateFormatStandaloneMonthYear } from "../utils/plainDate.js";
|
|
53
54
|
import { MonthScroller } from "../DateInput/MonthScroller.js";
|
|
54
55
|
import { MonthYearWheels } from "../DateInput/MonthYearWheels.js";
|
|
@@ -398,13 +399,7 @@ export function TouchDateTimeField({
|
|
|
398
399
|
} = fromMonthIndex(monthIndex);
|
|
399
400
|
const canStepBack = monthIndex > minMonthIndex;
|
|
400
401
|
const canStepForward = monthIndex < maxMonthIndex;
|
|
401
|
-
const
|
|
402
|
-
length: 7
|
|
403
|
-
}, (_, offset) => plainDateFormat({
|
|
404
|
-
year: 1970,
|
|
405
|
-
month: 1,
|
|
406
|
-
day: 4 + (weekStartsOn + offset) % 7
|
|
407
|
-
}, DATE_FORMAT_WEEKDAY_ONLY, locale)), [weekStartsOn, locale]);
|
|
402
|
+
const weekdayHeaders = useMemo(() => getWeekdayHeaders(locale, weekStartsOn), [locale, weekStartsOn]);
|
|
408
403
|
const monthYearLabel = plainDateFormatStandaloneMonthYear({
|
|
409
404
|
year,
|
|
410
405
|
month,
|
|
@@ -757,12 +752,15 @@ export function TouchDateTimeField({
|
|
|
757
752
|
...{
|
|
758
753
|
className: "xrvj5dj x1mzazjb x6k0iem x6s0dn4"
|
|
759
754
|
},
|
|
760
|
-
children:
|
|
755
|
+
children: weekdayHeaders.map(({
|
|
756
|
+
dayOfWeek,
|
|
757
|
+
name
|
|
758
|
+
}) => /*#__PURE__*/_jsx("div", {
|
|
761
759
|
...{
|
|
762
760
|
className: "x2b8uid x141an7d x1sodnla xv1l7n4"
|
|
763
761
|
},
|
|
764
762
|
children: name
|
|
765
|
-
},
|
|
763
|
+
}, dayOfWeek))
|
|
766
764
|
}), /*#__PURE__*/_jsx(MonthScroller, {
|
|
767
765
|
handleRef: scrollerHandleRef,
|
|
768
766
|
minMonthIndex: minMonthIndex,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHoverCard.d.ts","sourceRoot":"","sources":["../../src/HoverCard/useHoverCard.tsx"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,WAAW,EACjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,cAAc,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AA8BlC;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;IAE3B;;;OAGG;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;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEtC;;;;OAIG;IACH,cAAc,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAEzC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;;;;;;OAOG;IACH,eAAe,EAAE,CACf,QAAQ,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,KAC5C,SAAS,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IAEjB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CAke5E"}
|
|
@@ -197,7 +197,12 @@ export function useHoverCard(options = {}) {
|
|
|
197
197
|
|
|
198
198
|
// Tap-to-open on touch; on a mouse this does nothing and hover still rules.
|
|
199
199
|
const handlePointerDown = useCallback(event => {
|
|
200
|
-
|
|
200
|
+
// A pen in range starts the hover show before it lands. Left pending,
|
|
201
|
+
// that show opens the card during the press. The tap then closes it.
|
|
202
|
+
if (handleTouchPointerDown(event) && showTimeoutRef.current) {
|
|
203
|
+
clearTimeout(showTimeoutRef.current);
|
|
204
|
+
showTimeoutRef.current = null;
|
|
205
|
+
}
|
|
201
206
|
}, [handleTouchPointerDown]);
|
|
202
207
|
|
|
203
208
|
// Under `auto`, whether focus counts is decided when it arrives, and a
|
package/dist/Icon/Icon.d.ts
CHANGED
|
@@ -106,9 +106,9 @@ export type IconType = ComponentType<SVGProps<SVGSVGElement>>;
|
|
|
106
106
|
*/
|
|
107
107
|
export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'ref' | 'color'> {
|
|
108
108
|
/**
|
|
109
|
-
* Ref to the rendered SVG element
|
|
110
|
-
*
|
|
111
|
-
*
|
|
109
|
+
* Ref to the rendered SVG element. For a semantic or namespaced name it is
|
|
110
|
+
* the `<svg>` inside Icon's wrapper, or `null` when the resolved glyph has
|
|
111
|
+
* no `<svg>`.
|
|
112
112
|
*/
|
|
113
113
|
ref?: React.Ref<SVGSVGElement>;
|
|
114
114
|
/**
|
package/dist/Icon/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,EAAc,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAC,MAAM,OAAO,CAAC;AAC5E,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAInD,OAAO,KAAK,EAAC,QAAQ,EAAE,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAKzC,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAEhE,YAAY,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAiDhD,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8Df,CAAC;AAMH,MAAM,MAAM,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
* - /apps/storybook/stories/Icon.stories.tsx (storybook stories)
|
|
30
30
|
* - /packages/cli/assets/templates/blocks/components/Icon/ (showcase blocks)
|
|
31
31
|
*/
|
|
32
|
-
import React from 'react';
|
|
32
|
+
import React, { useCallback } from 'react';
|
|
33
33
|
import * as stylex from '@stylexjs/stylex';
|
|
34
34
|
import "../theme/tokens.stylex.js";
|
|
35
35
|
import { colorVars } from "../theme/tokens.stylex.js";
|
|
36
36
|
import { useThemeName } from "../theme/useTheme.js";
|
|
37
37
|
import { resolveIcon } from "./globalIconRegistry.js";
|
|
38
38
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
39
|
+
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
39
40
|
import { themeProps } from "../utils/themeProps.js";
|
|
40
41
|
import { useIconSize } from "./IconDefaultSizeContext.js";
|
|
41
42
|
import { iconSizeStyles } from "./IconSize.stylex.js";
|
|
@@ -251,6 +252,7 @@ export function Icon({
|
|
|
251
252
|
className: className,
|
|
252
253
|
style: style,
|
|
253
254
|
xstyle: xstyle,
|
|
255
|
+
svgRef: ref,
|
|
254
256
|
spanProps: props
|
|
255
257
|
});
|
|
256
258
|
}
|
|
@@ -295,6 +297,7 @@ function IconFromRegistry({
|
|
|
295
297
|
className,
|
|
296
298
|
style,
|
|
297
299
|
xstyle,
|
|
300
|
+
svgRef,
|
|
298
301
|
spanProps
|
|
299
302
|
}) {
|
|
300
303
|
const themeName = useThemeName();
|
|
@@ -302,6 +305,11 @@ function IconFromRegistry({
|
|
|
302
305
|
size,
|
|
303
306
|
variant
|
|
304
307
|
});
|
|
308
|
+
// The glyph can change while the span stays. Attach the ref again when it
|
|
309
|
+
// does.
|
|
310
|
+
const attachSvgRef = useCallback(span => svgRef == null ? undefined : mergeRefs(svgRef)(span?.querySelector('svg') ?? null),
|
|
311
|
+
// eslint-disable-next-line @eslint-react/exhaustive-deps -- resolveIcon's inputs: a new glyph gets a new attach, and a function entry's new element each render does not.
|
|
312
|
+
[svgRef, name, themeName, size, variant]);
|
|
305
313
|
if (resolvedIcon == null) {
|
|
306
314
|
return null;
|
|
307
315
|
}
|
|
@@ -313,6 +321,12 @@ function IconFromRegistry({
|
|
|
313
321
|
// precedence (spread before the internal merge).
|
|
314
322
|
const restSpanProps = spanProps ?? {};
|
|
315
323
|
return /*#__PURE__*/_jsx("span", {
|
|
324
|
+
ref: svgRef == null ? undefined : attachSvgRef
|
|
325
|
+
// Derived a11y — decorative (aria-hidden) by default, or a meaningful
|
|
326
|
+
// image (role="img" + aria-label) when `label` is set. Placed BEFORE the
|
|
327
|
+
// prop spread so consumers can still override it with explicit
|
|
328
|
+
// aria-hidden/role/aria-label. This mirrors component-mode Icon.
|
|
329
|
+
,
|
|
316
330
|
...a11yProps,
|
|
317
331
|
...restSpanProps,
|
|
318
332
|
...mergeProps(themeProps('icon', {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file InfoTip.tsx
|
|
3
|
-
* @input Uses React, StyleX,
|
|
4
|
-
* touch hit area, color/spacing/radius/duration/ease tokens
|
|
3
|
+
* @input Uses React, StyleX, useTooltip, Icon, useComponentTranslator, the
|
|
4
|
+
* shared touch hit area, color/spacing/radius/duration/ease tokens
|
|
5
5
|
* @output Exports InfoTip component, InfoTipProps, InfoTipSize types
|
|
6
6
|
* @position Core implementation; consumed by index.ts, tested by
|
|
7
7
|
* InfoTip.test.tsx; `@astryxdesign/lab` re-exports it, deprecated
|
|
@@ -46,9 +46,9 @@ export interface InfoTipProps extends Pick<BaseProps, 'xstyle' | 'className' | '
|
|
|
46
46
|
* labels, values, and metrics for permission notes, metric definitions, and
|
|
47
47
|
* field help.
|
|
48
48
|
*
|
|
49
|
-
* InfoTip is a
|
|
50
|
-
* announces, and closes the help. The info icon
|
|
51
|
-
* the icon registry, so themes can replace it.
|
|
49
|
+
* InfoTip is a named button that toggles `useTooltip`'s `show()` and `hide()`:
|
|
50
|
+
* the hook previews, holds, announces, and closes the help. The info icon
|
|
51
|
+
* resolves from the icon registry, so themes can replace it.
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InfoTip.d.ts","sourceRoot":"","sources":["../../src/InfoTip/InfoTip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"InfoTip.d.ts","sourceRoot":"","sources":["../../src/InfoTip/InfoTip.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;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;AAqBjD;;;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;AA8CD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,KAAK,EACL,IAAW,EACX,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,GACN,EAAE,YAAY,GAAG,SAAS,CAyF1B;yBAjGe,OAAO"}
|
package/dist/InfoTip/InfoTip.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file InfoTip.tsx
|
|
7
|
-
* @input Uses React, StyleX,
|
|
8
|
-
* touch hit area, color/spacing/radius/duration/ease tokens
|
|
7
|
+
* @input Uses React, StyleX, useTooltip, Icon, useComponentTranslator, the
|
|
8
|
+
* shared touch hit area, color/spacing/radius/duration/ease tokens
|
|
9
9
|
* @output Exports InfoTip component, InfoTipProps, InfoTipSize types
|
|
10
10
|
* @position Core implementation; consumed by index.ts, tested by
|
|
11
11
|
* InfoTip.test.tsx; `@astryxdesign/lab` re-exports it, deprecated
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
* - /packages/core/src/InfoTip/InfoTip.test.tsx (tests for new/changed behavior)
|
|
17
17
|
* - /packages/core/src/InfoTip/index.ts (exports if types change)
|
|
18
18
|
*/
|
|
19
|
-
import { useCallback } from 'react';
|
|
19
|
+
import { useCallback, useState } from 'react';
|
|
20
20
|
import * as stylex from '@stylexjs/stylex';
|
|
21
21
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
22
22
|
import { Icon } from "../Icon/Icon.js";
|
|
23
|
-
import {
|
|
23
|
+
import { stopInReactTree } from "../Layer/layerClickBoundary.js";
|
|
24
|
+
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
24
25
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
25
26
|
import english from "../i18n/generated-english/InfoTip/InfoTip.generated.js";
|
|
26
27
|
import "../theme/tokens.stylex.js";
|
|
@@ -28,7 +29,7 @@ import { colorVars, durationVars, easeVars, radiusVars, spacingVars } from "../t
|
|
|
28
29
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
29
30
|
import { mergeProps } from "../utils/mergeProps.js";
|
|
30
31
|
import { watchHitArea, writeHitInsets } from "../utils/hitArea.js";
|
|
31
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
32
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
33
|
registerEnglishFallback(english);
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -70,9 +71,9 @@ const styles = {
|
|
|
70
71
|
* labels, values, and metrics for permission notes, metric definitions, and
|
|
71
72
|
* field help.
|
|
72
73
|
*
|
|
73
|
-
* InfoTip is a
|
|
74
|
-
* announces, and closes the help. The info icon
|
|
75
|
-
* the icon registry, so themes can replace it.
|
|
74
|
+
* InfoTip is a named button that toggles `useTooltip`'s `show()` and `hide()`:
|
|
75
|
+
* the hook previews, holds, announces, and closes the help. The info icon
|
|
76
|
+
* resolves from the icon registry, so themes can replace it.
|
|
76
77
|
*
|
|
77
78
|
* @example
|
|
78
79
|
* ```
|
|
@@ -99,28 +100,66 @@ export function InfoTip({
|
|
|
99
100
|
}
|
|
100
101
|
return watchHitArea(button, insets => writeHitInsets(button, insets));
|
|
101
102
|
}, []);
|
|
102
|
-
|
|
103
|
+
// Whether a press pinned the help. A hover or focus preview is not pinned.
|
|
104
|
+
const [isPinned, setIsPinned] = useState(false);
|
|
105
|
+
// Whether the help shows, pinned or previewed: the button names it in
|
|
106
|
+
// `aria-controls` only then.
|
|
107
|
+
const [isShown, setIsShown] = useState(false);
|
|
108
|
+
const handleShow = useCallback(() => setIsShown(true), []);
|
|
109
|
+
// Every close ends the pin: a second press, Escape, a press outside, or
|
|
110
|
+
// focus leaving.
|
|
111
|
+
const handleHide = useCallback(() => {
|
|
112
|
+
setIsShown(false);
|
|
113
|
+
setIsPinned(false);
|
|
114
|
+
}, []);
|
|
115
|
+
const tooltip = useTooltip({
|
|
116
|
+
onShow: handleShow,
|
|
117
|
+
onHide: handleHide
|
|
118
|
+
});
|
|
119
|
+
const mergedRef = useMergedRefs(ref, watchButtonHitArea, tooltip.ref);
|
|
120
|
+
|
|
121
|
+
// A primary mouse or pen press on a preview calls show() first. The hook's
|
|
122
|
+
// press-to-close then leaves it open. The click pins it.
|
|
123
|
+
const handlePointerDownCapture = useCallback(event => {
|
|
124
|
+
if (event.button !== 0 || event.pointerType === 'touch' || isPinned || !isShown) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
tooltip.show();
|
|
128
|
+
}, [isPinned, isShown, tooltip]);
|
|
129
|
+
|
|
130
|
+
// A click, tap, Enter, or Space pins the help, and the next one closes it.
|
|
131
|
+
// The press stops at the button: a clickable row, card, or label around it
|
|
132
|
+
// does nothing, and document listeners still see it.
|
|
133
|
+
const handleClick = useCallback(event => {
|
|
134
|
+
stopInReactTree(event);
|
|
135
|
+
event.preventDefault();
|
|
136
|
+
if (isPinned) {
|
|
137
|
+
tooltip.hide();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
tooltip.show();
|
|
141
|
+
setIsPinned(true);
|
|
142
|
+
}, [isPinned, tooltip]);
|
|
103
143
|
|
|
104
|
-
// No Escape handler of its own.
|
|
144
|
+
// No Escape handler of its own. The tooltip's entry in the shared dismissal
|
|
105
145
|
// stack takes Escape, so one press never closes both the help and an
|
|
106
146
|
// enclosing Dialog.
|
|
107
|
-
return /*#__PURE__*/
|
|
108
|
-
|
|
109
|
-
// The tooltip is the button's only purpose. A click, a tap, Enter, or
|
|
110
|
-
// Space pins it open, and the press stops at the button. So an InfoTip's
|
|
111
|
-
// content is reachable on a phone and from the keyboard alike.
|
|
112
|
-
,
|
|
113
|
-
triggerBehavior: "toggle",
|
|
114
|
-
children: /*#__PURE__*/_jsx("button", {
|
|
147
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
148
|
+
children: [/*#__PURE__*/_jsx("button", {
|
|
115
149
|
ref: mergedRef,
|
|
116
150
|
type: "button",
|
|
117
151
|
"aria-label": label ?? t('@astryx.infoTip.label'),
|
|
152
|
+
"aria-describedby": tooltip.describedBy,
|
|
153
|
+
"aria-expanded": isPinned,
|
|
154
|
+
"aria-controls": isShown ? tooltip.describedBy : undefined,
|
|
155
|
+
onPointerDownCapture: handlePointerDownCapture,
|
|
156
|
+
onClick: handleClick,
|
|
118
157
|
...mergeProps(stylex.props(focusOutlineStyles.focusVisible, styles.trigger, styles.hitArea, xstyle), className, style),
|
|
119
158
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
120
159
|
icon: "info",
|
|
121
160
|
size: size
|
|
122
161
|
})
|
|
123
|
-
})
|
|
162
|
+
}), tooltip.renderTooltip(content)]
|
|
124
163
|
});
|
|
125
164
|
}
|
|
126
165
|
InfoTip.displayName = 'InfoTip';
|
package/dist/Layer/useLayer.js
CHANGED
|
@@ -31,7 +31,7 @@ import { afterPopoverOperations, isBrowserHideInFlight, isPopoverOperationInFlig
|
|
|
31
31
|
import { preserveAnimations } from "./preserveAnimations.js";
|
|
32
32
|
import { useLayerContext } from "./LayerContext.js";
|
|
33
33
|
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
34
|
-
import { overlayPaddingReset } from "../Layout/
|
|
34
|
+
import { overlayPaddingReset } from "../Layout/overlayPaddingReset.stylex.js";
|
|
35
35
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
36
|
const _temp = {
|
|
37
37
|
keoZOQ: "x1vhfslr",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @output Exports useTouchTrigger hook, isActionTrigger, LayerTouchTrigger type,
|
|
5
5
|
* tapLandsOnDisabledControl, TOUCH_POINTER_TYPES and useTapStop (internal:
|
|
6
6
|
* not re-exported from index). Also useTouchTriggerInternal, with the
|
|
7
|
-
* outside dismissal's arm for
|
|
7
|
+
* outside dismissal's arm for useTooltip's hold (Core-internal).
|
|
8
8
|
* @position Layer hook; shared touch behavior for useTooltip and useHoverCard
|
|
9
9
|
*
|
|
10
10
|
* SYNC: When modified, update:
|
|
@@ -139,8 +139,8 @@ export interface UseTouchTriggerReturn {
|
|
|
139
139
|
clearTapOpen: () => void;
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
|
-
* useTouchTrigger's return plus the outside dismissal's arm, for
|
|
143
|
-
*
|
|
142
|
+
* useTouchTrigger's return plus the outside dismissal's arm, for useTooltip's
|
|
143
|
+
* hold behind show() and hide(). Not exported from the Layer entry point.
|
|
144
144
|
*
|
|
145
145
|
* @internal
|
|
146
146
|
*/
|
|
@@ -148,7 +148,7 @@ export interface UseTouchTriggerInternalReturn extends UseTouchTriggerReturn {
|
|
|
148
148
|
/**
|
|
149
149
|
* Arms the outside dismissal a tap-open gets: a press that lifts outside
|
|
150
150
|
* the trigger and the layer, or a scroll that starts there, hides it. A
|
|
151
|
-
*
|
|
151
|
+
* hold arms it too.
|
|
152
152
|
*/
|
|
153
153
|
armOutsideDismiss: () => void;
|
|
154
154
|
}
|
|
@@ -171,10 +171,16 @@ export interface UseTouchTriggerInternalReturn extends UseTouchTriggerReturn {
|
|
|
171
171
|
*/
|
|
172
172
|
export declare function useTouchTrigger(options: UseTouchTriggerOptions): UseTouchTriggerReturn;
|
|
173
173
|
/**
|
|
174
|
-
* useTouchTrigger, plus the outside dismissal's arm that
|
|
175
|
-
* close on a press or scroll outside.
|
|
174
|
+
* useTouchTrigger, plus the outside dismissal's arm that useTooltip's hold
|
|
175
|
+
* uses to close on a press or scroll outside.
|
|
176
176
|
*
|
|
177
177
|
* @internal
|
|
178
178
|
*/
|
|
179
|
-
export declare function useTouchTriggerInternal(options: UseTouchTriggerOptions
|
|
179
|
+
export declare function useTouchTriggerInternal(options: UseTouchTriggerOptions,
|
|
180
|
+
/**
|
|
181
|
+
* Called when a press that the outside dismissal watches ends with its
|
|
182
|
+
* pointer lifted inside the layer: the layer stays open, and useTooltip
|
|
183
|
+
* ends a hold that the press started.
|
|
184
|
+
*/
|
|
185
|
+
onReleaseInLayer?: () => void): UseTouchTriggerInternalReturn;
|
|
180
186
|
//# sourceMappingURL=useTouchTrigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTouchTrigger.d.ts","sourceRoot":"","sources":["../../src/Layer/useTouchTrigger.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAIL,KAAK,UAAU,IAAI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AAO,CAAC;IAEpD,gFAAgF;IAChF,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,qBAAqB,CASvB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,sBAAsB;AAC/B;;;;GAIG;AACH,gBAAgB,CAAC,EAAE,MAAM,IAAI,GAC5B,6BAA6B,CAkO/B"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @output Exports useTouchTrigger hook, isActionTrigger, LayerTouchTrigger type,
|
|
9
9
|
* tapLandsOnDisabledControl, TOUCH_POINTER_TYPES and useTapStop (internal:
|
|
10
10
|
* not re-exported from index). Also useTouchTriggerInternal, with the
|
|
11
|
-
* outside dismissal's arm for
|
|
11
|
+
* outside dismissal's arm for useTooltip's hold (Core-internal).
|
|
12
12
|
* @position Layer hook; shared touch behavior for useTooltip and useHoverCard
|
|
13
13
|
*
|
|
14
14
|
* SYNC: When modified, update:
|
|
@@ -179,8 +179,8 @@ function isEditable(element) {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
* useTouchTrigger's return plus the outside dismissal's arm, for
|
|
183
|
-
*
|
|
182
|
+
* useTouchTrigger's return plus the outside dismissal's arm, for useTooltip's
|
|
183
|
+
* hold behind show() and hide(). Not exported from the Layer entry point.
|
|
184
184
|
*
|
|
185
185
|
* @internal
|
|
186
186
|
*/
|
|
@@ -214,12 +214,18 @@ export function useTouchTrigger(options) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
/**
|
|
217
|
-
* useTouchTrigger, plus the outside dismissal's arm that
|
|
218
|
-
* close on a press or scroll outside.
|
|
217
|
+
* useTouchTrigger, plus the outside dismissal's arm that useTooltip's hold
|
|
218
|
+
* uses to close on a press or scroll outside.
|
|
219
219
|
*
|
|
220
220
|
* @internal
|
|
221
221
|
*/
|
|
222
|
-
export function useTouchTriggerInternal(options
|
|
222
|
+
export function useTouchTriggerInternal(options,
|
|
223
|
+
/**
|
|
224
|
+
* Called when a press that the outside dismissal watches ends with its
|
|
225
|
+
* pointer lifted inside the layer: the layer stays open, and useTooltip
|
|
226
|
+
* ends a hold that the press started.
|
|
227
|
+
*/
|
|
228
|
+
onReleaseInLayer) {
|
|
223
229
|
const {
|
|
224
230
|
touchTrigger,
|
|
225
231
|
isEnabled,
|
|
@@ -242,6 +248,8 @@ export function useTouchTriggerInternal(options) {
|
|
|
242
248
|
hideRef.current = hide;
|
|
243
249
|
const layerIdRef = useRef(layerId);
|
|
244
250
|
layerIdRef.current = layerId;
|
|
251
|
+
const onReleaseInLayerRef = useRef(onReleaseInLayer);
|
|
252
|
+
onReleaseInLayerRef.current = onReleaseInLayer;
|
|
245
253
|
|
|
246
254
|
// Whether a tap is what opened the layer. Only a tap-open owes the user an
|
|
247
255
|
// outside-tap dismissal: a hover-opened layer already closes on
|
|
@@ -291,6 +299,9 @@ export function useTouchTriggerInternal(options) {
|
|
|
291
299
|
}
|
|
292
300
|
// Hover card content is interactive; a tap inside it is not a dismiss.
|
|
293
301
|
if (docs.some(doc => doc.getElementById(layerIdRef.current)?.contains(target) === true)) {
|
|
302
|
+
if (event.type === 'pointerup') {
|
|
303
|
+
onReleaseInLayerRef.current?.();
|
|
304
|
+
}
|
|
294
305
|
return;
|
|
295
306
|
}
|
|
296
307
|
}
|
package/dist/Layout/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { container } from './container.stylex.js';
|
|
10
10
|
export type { ContainerComponent, ContainerOptions, SpacingToken, } from './container.stylex.js';
|
|
11
|
-
export { overlayPaddingReset } from './
|
|
11
|
+
export { overlayPaddingReset } from './overlayPaddingReset.stylex.js';
|
|
12
12
|
export { edgeCompSlot, EDGE_COMP_ATTR } from './edgeCompensation.stylex.js';
|
|
13
13
|
export { stack } from '../Stack/stack.stylex.js';
|
|
14
14
|
export type { StackOptions, StackDirection, StackCrossAlignment, StackMainAlignment, StackWrap, SpacingStep, } from '../Stack/stack.stylex.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Layout/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAC,mBAAmB,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Layout/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAGH,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAC,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAGjE,OAAO,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,2BAA2B,CAAC;AAGvE,OAAO,EAAC,KAAK,EAAC,MAAM,uBAAuB,CAAC;AAC5C,YAAY,EACV,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,SAAS,EACT,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,2BAA2B,CAAC;AACpD,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,aAAa,GACd,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAC1D,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,YAAY,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,YAAY,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAE7D,YAAY,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,YAAY,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AAExD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,YAAY,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,YAAY,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAC,yBAAyB,EAAC,MAAM,wBAAwB,CAAC"}
|
package/dist/Layout/index.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
export { container } from "./container.stylex.js";
|
|
16
16
|
// Overlay padding-variable reset (applied on overlay roots so the container
|
|
17
17
|
// padding system does not cross a fixed/top-layer boundary)
|
|
18
|
-
export { overlayPaddingReset } from "./
|
|
18
|
+
export { overlayPaddingReset } from "./overlayPaddingReset.stylex.js";
|
|
19
19
|
|
|
20
20
|
// Edge compensation utility
|
|
21
21
|
export { edgeCompSlot, EDGE_COMP_ATTR } from "./edgeCompensation.stylex.js";
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import * as stylex from '@stylexjs/stylex';
|
|
21
|
-
import { overlayPaddingReset } from "./
|
|
21
|
+
import { overlayPaddingReset } from "./overlayPaddingReset.stylex.js";
|
|
22
22
|
const resetBeyondOverlays = {
|
|
23
23
|
root: {
|
|
24
24
|
"--layout-content-width": "x1vpwbdg",
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file overlayPaddingReset.stylex.ts
|
|
3
|
+
* @input Uses @stylexjs/stylex
|
|
4
|
+
* @output overlayPaddingReset: the container padding boundary at an overlay's root
|
|
5
|
+
* @position Layout utility, re-exported by padding.stylex.ts and Layout/index.ts.
|
|
6
|
+
* Its own module so an overlay's eager code (useLayer) imports it without
|
|
7
|
+
* padding.stylex.ts: a lazily loaded overlay that uses the container padding
|
|
8
|
+
* styles there then keeps them out of the eager chunk it shares with this
|
|
9
|
+
* module.
|
|
10
|
+
*/
|
|
11
|
+
import * as stylex from '@stylexjs/stylex';
|
|
12
|
+
/**
|
|
13
|
+
* Padding-variable reset for overlay roots (Dialog, BottomSheet, Drawer,
|
|
14
|
+
* MobileNav, Lightbox, and every layer surface).
|
|
15
|
+
*
|
|
16
|
+
* ## Why an overlay needs this
|
|
17
|
+
*
|
|
18
|
+
* The container padding system talks to descendants through inherited custom
|
|
19
|
+
* properties: a padded container announces its padding, and children read the
|
|
20
|
+
* value either to apply it or to cancel it with a negative margin
|
|
21
|
+
* (`Section`, `Divider`, `Layout`, `Table`).
|
|
22
|
+
*
|
|
23
|
+
* Inheritance follows the DOM, but an overlay leaves its parent's visual box —
|
|
24
|
+
* a fixed/top-layer `<dialog>` is a DOM descendant of the padded page while
|
|
25
|
+
* being nowhere near it on screen. It inherits values describing padding that
|
|
26
|
+
* is not there, and its content compensates against phantom space: a `Section`
|
|
27
|
+
* inside a 640px sheet rendered 672px wide and hung off both edges.
|
|
28
|
+
*
|
|
29
|
+
* Two families leak, and they need opposite treatments:
|
|
30
|
+
*
|
|
31
|
+
* - `--container-padding-*` -> `0px`. Descendants SUBTRACT these (bleed
|
|
32
|
+
* margins). The overlay root has no padding of its own to escape, so the
|
|
33
|
+
* honest answer is zero. Nested containers that do set padding (a Dialog's
|
|
34
|
+
* content wrapper) re-announce their own values below this point, so
|
|
35
|
+
* legitimate edge-to-edge bleed inside the overlay is unaffected.
|
|
36
|
+
* - `--layout-padding-*` and `--_section-padding-propagated` -> `initial`.
|
|
37
|
+
* Descendants ADD these, so zeroing them would strip padding rather than
|
|
38
|
+
* restore it. `initial` makes each guaranteed-invalid, so readers fall
|
|
39
|
+
* through their own `var(…, fallback)` chain and land on the theme default —
|
|
40
|
+
* which is what an overlay at the top of the tree should show.
|
|
41
|
+
*
|
|
42
|
+
* `initial` is also why propagation moved off `--astryx-section-padding`: that
|
|
43
|
+
* name is public theme surface, set at the theme root, and making it invalid
|
|
44
|
+
* here would blank the theme's own section padding inside every overlay.
|
|
45
|
+
*
|
|
46
|
+
* Apply on the overlay's outermost styled element.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```
|
|
50
|
+
* <dialog {...stylex.props(styles.dialog, overlayPaddingReset.reset)} />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const overlayPaddingReset: Readonly<{
|
|
54
|
+
readonly reset: Readonly<{
|
|
55
|
+
readonly '--container-padding-inline-start': stylex.StyleXClassNameFor<"--container-padding-inline-start", "0px">;
|
|
56
|
+
readonly '--container-padding-inline-end': stylex.StyleXClassNameFor<"--container-padding-inline-end", "0px">;
|
|
57
|
+
readonly '--container-padding-block-start': stylex.StyleXClassNameFor<"--container-padding-block-start", "0px">;
|
|
58
|
+
readonly '--container-padding-block-end': stylex.StyleXClassNameFor<"--container-padding-block-end", "0px">;
|
|
59
|
+
readonly '--layout-padding-outer-x': stylex.StyleXClassNameFor<"--layout-padding-outer-x", "initial">;
|
|
60
|
+
readonly '--layout-padding-outer-y': stylex.StyleXClassNameFor<"--layout-padding-outer-y", "initial">;
|
|
61
|
+
readonly '--layout-padding-own-outer-x': stylex.StyleXClassNameFor<"--layout-padding-own-outer-x", "initial">;
|
|
62
|
+
readonly '--layout-padding-own-outer-y': stylex.StyleXClassNameFor<"--layout-padding-own-outer-y", "initial">;
|
|
63
|
+
readonly '--layout-padding-inner-x': stylex.StyleXClassNameFor<"--layout-padding-inner-x", "initial">;
|
|
64
|
+
readonly '--layout-padding-inner-y': stylex.StyleXClassNameFor<"--layout-padding-inner-y", "initial">;
|
|
65
|
+
readonly '--_section-padding-propagated': stylex.StyleXClassNameFor<"--_section-padding-propagated", "initial">;
|
|
66
|
+
}>;
|
|
67
|
+
}>;
|
|
68
|
+
//# sourceMappingURL=overlayPaddingReset.stylex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayPaddingReset.stylex.d.ts","sourceRoot":"","sources":["../../src/Layout/overlayPaddingReset.stylex.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;EAgB9B,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file overlayPaddingReset.stylex.ts
|
|
5
|
+
* @input Uses @stylexjs/stylex
|
|
6
|
+
* @output overlayPaddingReset: the container padding boundary at an overlay's root
|
|
7
|
+
* @position Layout utility, re-exported by padding.stylex.ts and Layout/index.ts.
|
|
8
|
+
* Its own module so an overlay's eager code (useLayer) imports it without
|
|
9
|
+
* padding.stylex.ts: a lazily loaded overlay that uses the container padding
|
|
10
|
+
* styles there then keeps them out of the eager chunk it shares with this
|
|
11
|
+
* module.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import * as stylex from '@stylexjs/stylex';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Padding-variable reset for overlay roots (Dialog, BottomSheet, Drawer,
|
|
18
|
+
* MobileNav, Lightbox, and every layer surface).
|
|
19
|
+
*
|
|
20
|
+
* ## Why an overlay needs this
|
|
21
|
+
*
|
|
22
|
+
* The container padding system talks to descendants through inherited custom
|
|
23
|
+
* properties: a padded container announces its padding, and children read the
|
|
24
|
+
* value either to apply it or to cancel it with a negative margin
|
|
25
|
+
* (`Section`, `Divider`, `Layout`, `Table`).
|
|
26
|
+
*
|
|
27
|
+
* Inheritance follows the DOM, but an overlay leaves its parent's visual box —
|
|
28
|
+
* a fixed/top-layer `<dialog>` is a DOM descendant of the padded page while
|
|
29
|
+
* being nowhere near it on screen. It inherits values describing padding that
|
|
30
|
+
* is not there, and its content compensates against phantom space: a `Section`
|
|
31
|
+
* inside a 640px sheet rendered 672px wide and hung off both edges.
|
|
32
|
+
*
|
|
33
|
+
* Two families leak, and they need opposite treatments:
|
|
34
|
+
*
|
|
35
|
+
* - `--container-padding-*` -> `0px`. Descendants SUBTRACT these (bleed
|
|
36
|
+
* margins). The overlay root has no padding of its own to escape, so the
|
|
37
|
+
* honest answer is zero. Nested containers that do set padding (a Dialog's
|
|
38
|
+
* content wrapper) re-announce their own values below this point, so
|
|
39
|
+
* legitimate edge-to-edge bleed inside the overlay is unaffected.
|
|
40
|
+
* - `--layout-padding-*` and `--_section-padding-propagated` -> `initial`.
|
|
41
|
+
* Descendants ADD these, so zeroing them would strip padding rather than
|
|
42
|
+
* restore it. `initial` makes each guaranteed-invalid, so readers fall
|
|
43
|
+
* through their own `var(…, fallback)` chain and land on the theme default —
|
|
44
|
+
* which is what an overlay at the top of the tree should show.
|
|
45
|
+
*
|
|
46
|
+
* `initial` is also why propagation moved off `--astryx-section-padding`: that
|
|
47
|
+
* name is public theme surface, set at the theme root, and making it invalid
|
|
48
|
+
* here would blank the theme's own section padding inside every overlay.
|
|
49
|
+
*
|
|
50
|
+
* Apply on the overlay's outermost styled element.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```
|
|
54
|
+
* <dialog {...stylex.props(styles.dialog, overlayPaddingReset.reset)} />
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export const overlayPaddingReset = {
|
|
58
|
+
reset: {
|
|
59
|
+
"--container-padding-inline-start": "xrhngw9",
|
|
60
|
+
"--container-padding-inline-end": "xjsfl84",
|
|
61
|
+
"--container-padding-block-start": "x1047aw6",
|
|
62
|
+
"--container-padding-block-end": "xax9j7h",
|
|
63
|
+
"--layout-padding-outer-x": "xdt8ak2",
|
|
64
|
+
"--layout-padding-outer-y": "x1rs4lu4",
|
|
65
|
+
"--layout-padding-own-outer-x": "x1vii845",
|
|
66
|
+
"--layout-padding-own-outer-y": "xojybgt",
|
|
67
|
+
"--layout-padding-inner-x": "x1qfll2g",
|
|
68
|
+
"--layout-padding-inner-y": "xyvxpqs",
|
|
69
|
+
"--_section-padding-propagated": "x1f17rg1",
|
|
70
|
+
$$css: true
|
|
71
|
+
}
|
|
72
|
+
};
|