@astryxdesign/core 0.7.16 → 0.7.17-canary.g16fe6a8
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/AlertDialog/AlertDialog.d.ts +7 -4
- package/dist/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/AlertDialog/AlertDialog.js +41 -12
- package/dist/AlertDialog/useAlertMotion.d.ts +16 -0
- package/dist/AlertDialog/useAlertMotion.d.ts.map +1 -0
- package/dist/AlertDialog/useAlertMotion.js +277 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +10 -3
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +5 -2
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +10 -4
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +20 -8
- package/dist/DropdownMenu/menuItemRoles.d.ts.map +1 -1
- package/dist/DropdownMenu/menuItemRoles.js +5 -2
- package/dist/Icon/Icon.js +4 -4
- package/dist/Icon/globalIconRegistry.d.ts.map +1 -1
- package/dist/Icon/globalIconRegistry.js +16 -6
- package/dist/Icon/useIcon.js +5 -5
- package/dist/Item/Item.d.ts +49 -67
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +91 -99
- package/dist/Layer/inputHold.d.ts +9 -7
- package/dist/Layer/inputHold.d.ts.map +1 -1
- package/dist/Layer/inputHold.js +74 -24
- package/dist/Lightbox/Lightbox.d.ts.map +1 -1
- package/dist/Lightbox/Lightbox.js +129 -8
- package/dist/Link/Link.d.ts.map +1 -1
- package/dist/Link/Link.js +6 -1
- package/dist/List/ListItem.d.ts +5 -7
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +11 -1
- package/dist/MetadataList/MetadataListItem.d.ts +7 -2
- package/dist/MetadataList/MetadataListItem.d.ts.map +1 -1
- package/dist/MetadataList/MetadataListItem.js +3 -1
- package/dist/MobileNav/MobileNav.d.ts.map +1 -1
- package/dist/MobileNav/MobileNav.js +32 -23
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +15 -7
- package/dist/Pagination/Pagination.d.ts +25 -2
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +87 -47
- package/dist/Popover/popoverSurfaceMotion.d.ts.map +1 -1
- package/dist/Popover/popoverSurfaceMotion.js +4 -9
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +4 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +11 -5
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +15 -4
- package/dist/Swipe/SwipeActionsLayer.d.ts +31 -0
- package/dist/Swipe/SwipeActionsLayer.d.ts.map +1 -0
- package/dist/Swipe/SwipeActionsLayer.js +358 -0
- package/dist/Swipe/createSwipe.d.ts +26 -0
- package/dist/Swipe/createSwipe.d.ts.map +1 -0
- package/dist/Swipe/createSwipe.js +97 -0
- package/dist/Swipe/index.d.ts +3 -0
- package/dist/Swipe/index.d.ts.map +1 -0
- package/dist/Swipe/index.js +5 -0
- package/dist/Swipe/swipeHost.d.ts +208 -0
- package/dist/Swipe/swipeHost.d.ts.map +1 -0
- package/dist/Swipe/swipeHost.js +122 -0
- package/dist/Swipe/swipeHost.stylex.d.ts +21 -0
- package/dist/Swipe/swipeHost.stylex.d.ts.map +1 -0
- package/dist/Swipe/swipeHost.stylex.js +27 -0
- package/dist/Swipe/useSwipeAction.d.ts +220 -0
- package/dist/Swipe/useSwipeAction.d.ts.map +1 -0
- package/dist/Swipe/useSwipeAction.js +1122 -0
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +2 -2
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js +25 -3
- package/dist/Table/plugins/selection/useTableSelection.d.ts.map +1 -1
- package/dist/Table/plugins/selection/useTableSelection.js +20 -2
- package/dist/Table/tableContextMenu.d.ts +6 -0
- package/dist/Table/tableContextMenu.d.ts.map +1 -1
- package/dist/Table/tableContextMenu.js +10 -1
- package/dist/Toast/Toast.d.ts.map +1 -1
- package/dist/Toast/Toast.js +10 -5
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +6 -1
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +1 -1
- package/dist/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +6 -1
- package/dist/astryx.css +33 -18
- package/dist/dragToSnapPoints/compositorSettle.d.ts +38 -0
- package/dist/dragToSnapPoints/compositorSettle.d.ts.map +1 -0
- package/dist/dragToSnapPoints/compositorSettle.js +140 -0
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts +29 -5
- package/dist/dragToSnapPoints/createDragToSnapPoints.d.ts.map +1 -1
- package/dist/dragToSnapPoints/createDragToSnapPoints.js +123 -7
- package/dist/hooks/useHotkeys.d.ts +1 -1
- 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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/motion/themeTiming.d.ts +11 -4
- package/dist/motion/themeTiming.d.ts.map +1 -1
- package/dist/motion/themeTiming.js +14 -4
- package/dist/motion/uikit/swipeActions.d.ts +148 -0
- package/dist/motion/uikit/swipeActions.d.ts.map +1 -0
- package/dist/motion/uikit/swipeActions.js +150 -0
- package/dist/privateAttributes/layerRoot.stylex.d.ts +2 -0
- package/dist/privateAttributes/layerRoot.stylex.d.ts.map +1 -1
- package/dist/privateAttributes/layerRoot.stylex.js +10 -3
- package/dist/privateAttributes/pressHeld.stylex.d.ts +5 -0
- package/dist/privateAttributes/pressHeld.stylex.d.ts.map +1 -0
- package/dist/privateAttributes/pressHeld.stylex.js +31 -0
- package/dist/reset.font.a11y.chromium.spec.d.ts.map +1 -0
- package/dist/theme/defineTheme.d.ts +18 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +17 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +188 -83
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/mergeComponents.d.ts +13 -5
- package/dist/theme/mergeComponents.d.ts.map +1 -1
- package/dist/theme/mergeComponents.js +74 -6
- package/dist/theme/resolveThemeValues.js +2 -2
- package/dist/theme/themeAdaptations.d.ts.map +1 -1
- package/dist/theme/themeAdaptations.js +4 -1
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +4 -1
- package/locales/en.json +8 -0
- package/locales/pseudo.json +6 -0
- package/package.json +10 -5
- package/src/AlertDialog/AlertDialog.doc.mjs +3 -3
- package/src/AlertDialog/AlertDialog.tsx +49 -11
- package/src/AlertDialog/useAlertMotion.ts +313 -0
- package/src/Button/Button.tsx +16 -5
- package/src/Chat/useChatDictation.doc.mjs +246 -0
- package/src/CheckboxInput/CheckboxInput.tsx +5 -1
- package/src/ComplexSelector/ComplexSelector.tsx +20 -8
- package/src/ContextMenu/ContextMenu.tsx +22 -12
- package/src/DropdownMenu/menuItemRoles.ts +9 -6
- package/src/Icon/Icon.tsx +4 -4
- package/src/Icon/globalIconRegistry.tsx +27 -15
- package/src/Icon/useIcon.ts +5 -5
- package/src/Item/Item.doc.mjs +8 -2
- package/src/Item/Item.tsx +143 -158
- package/src/Layer/inputHold.ts +95 -24
- package/src/Lightbox/Lightbox.tsx +200 -11
- package/src/Link/Link.tsx +14 -6
- package/src/List/ListItem.doc.mjs +21 -6
- package/src/List/ListItem.tsx +16 -7
- package/src/MetadataList/MetadataListItem.doc.mjs +36 -1
- package/src/MetadataList/MetadataListItem.tsx +7 -2
- package/src/MobileNav/MobileNav.tsx +45 -28
- package/src/MultiSelector/MultiSelector.tsx +28 -11
- package/src/Pagination/Pagination.doc.mjs +39 -3
- package/src/Pagination/Pagination.tsx +122 -55
- package/src/Popover/popoverSurfaceMotion.ts +4 -13
- package/src/Popover/usePopover.tsx +7 -1
- package/src/Selector/Selector.tsx +21 -9
- package/src/Slider/Slider.tsx +26 -3
- package/src/Swipe/SwipeActionsLayer.tsx +438 -0
- package/src/Swipe/createSwipe.doc.mjs +118 -0
- package/src/Swipe/createSwipe.ts +112 -0
- package/src/Swipe/index.ts +6 -0
- package/src/Swipe/swipeHost.stylex.ts +27 -0
- package/src/Swipe/swipeHost.ts +255 -0
- package/src/Swipe/useSwipeAction.ts +1414 -0
- package/src/Table/Table.doc.mjs +1 -1
- package/src/Table/TableCell.tsx +5 -4
- package/src/Table/TableHeaderCell.tsx +31 -3
- package/src/Table/plugins/selection/useTableSelection.tsx +18 -2
- package/src/Table/tableContextMenu.tsx +15 -1
- package/src/Toast/Toast.tsx +28 -5
- package/src/Tokenizer/Tokenizer.tsx +18 -5
- package/src/Tooltip/useTooltip.tsx +2 -3
- package/src/TopNav/TopNav.tsx +17 -1
- package/src/dragToSnapPoints/compositorSettle.ts +175 -0
- package/src/dragToSnapPoints/createDragToSnapPoints.ts +146 -11
- package/src/hooks/useHotkeys.doc.mjs +4 -4
- package/src/hooks/useHotkeys.ts +1 -1
- package/src/i18n/generated-locales/en.generated.ts +2 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +2 -0
- package/src/index.ts +1 -0
- package/src/motion/MEASUREMENTS.md +16 -0
- package/src/motion/README.md +1 -0
- package/src/motion/themeTiming.ts +20 -4
- package/src/motion/uikit/swipeActions.ts +142 -0
- package/src/privateAttributes/layerRoot.stylex.ts +10 -3
- package/src/privateAttributes/pressHeld.stylex.ts +31 -0
- package/src/reset.css +7 -0
- package/src/theme/defineTheme.ts +22 -1
- package/src/theme/generateThemeRules.ts +274 -124
- package/src/theme/index.ts +1 -0
- package/src/theme/mergeComponents.ts +86 -10
- package/src/theme/resolveThemeValues.ts +2 -2
- package/src/theme/syntax/useSyntaxTheme.doc.mjs +95 -0
- package/src/theme/themeAdaptations.ts +3 -1
- package/src/utils/pressFeedback.ts +8 -1
- package/dist/Item/ItemSwipeLayer.d.ts +0 -51
- package/dist/Item/ItemSwipeLayer.d.ts.map +0 -1
- package/dist/Item/ItemSwipeLayer.js +0 -282
- package/dist/Item/useSwipeAction.d.ts +0 -77
- package/dist/Item/useSwipeAction.d.ts.map +0 -1
- package/dist/Item/useSwipeAction.js +0 -551
- package/src/Item/ItemSwipeLayer.tsx +0 -400
- package/src/Item/useSwipeAction.ts +0 -752
|
@@ -96,7 +96,6 @@ const _temp = {
|
|
|
96
96
|
k1xSpc: "x104kibb",
|
|
97
97
|
kgKLqz: "x1ua5tub",
|
|
98
98
|
kzqmXN: "x1uyokj7",
|
|
99
|
-
keTefX: "x11g1kdw",
|
|
100
99
|
kUuF72: "xx1nm32",
|
|
101
100
|
"$$css": true
|
|
102
101
|
};
|
|
@@ -162,6 +161,7 @@ const styles = {
|
|
|
162
161
|
captionTogglePlace: {
|
|
163
162
|
kyUFMd: "x18mqm2i xl3jo06",
|
|
164
163
|
k1xSpc: "x1s85apg",
|
|
164
|
+
keTefX: "x11g1kdw",
|
|
165
165
|
kVQacm: "xb3r6kr",
|
|
166
166
|
khDVqt: "x1sdyfia",
|
|
167
167
|
kfSwDN: "x87ps6o",
|
|
@@ -182,6 +182,10 @@ const styles = {
|
|
|
182
182
|
krVfgx: "x1ey2m1c",
|
|
183
183
|
$$css: true
|
|
184
184
|
},
|
|
185
|
+
captionTextToggleOwnLine: {
|
|
186
|
+
kGO01o: "xivesfc",
|
|
187
|
+
$$css: true
|
|
188
|
+
},
|
|
185
189
|
captionToggleHidden: {
|
|
186
190
|
k1xSpc: "x1s85apg",
|
|
187
191
|
$$css: true
|
|
@@ -285,6 +289,44 @@ const KEYBOARD_PAN_OFFSETS = {
|
|
|
285
289
|
/** The height of a video's native controls, px: no browser reports it. */
|
|
286
290
|
const VIDEO_CONTROLS_BAND = 48;
|
|
287
291
|
|
|
292
|
+
// Elements that the browser replaces with their own content.
|
|
293
|
+
const REPLACED_ELEMENT = /^(?:img|video|canvas|svg|iframe|embed|object|picture)$/;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Whether a box in the caption's flow cannot narrow to sit beside a float. A
|
|
297
|
+
* block-level replaced element, such as an image, keeps its own width, so it
|
|
298
|
+
* drops below the toggle's place when it does not fit beside it. Any other
|
|
299
|
+
* block narrows beside the place, and inline boxes wrap around it.
|
|
300
|
+
*/
|
|
301
|
+
function isUnnarrowableBlock(element, view) {
|
|
302
|
+
if (!REPLACED_ELEMENT.test(element.localName)) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
const style = view.getComputedStyle(element);
|
|
306
|
+
return !/^(?:inline|contents|none)/.test(style.display) && style.position !== 'absolute' && style.position !== 'fixed' && style.float === 'none';
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Whether the toggle's place, shown with the flow's lines, would push a box
|
|
311
|
+
* in the flow down by half a line or more. The flow is read without the
|
|
312
|
+
* place. The place floats at the flow's start and is as long as the flow, so
|
|
313
|
+
* a box that cannot narrow and is wider than the room beside the place drops
|
|
314
|
+
* below the place's last line. A box shorter than half a line adds no line
|
|
315
|
+
* to the place, so it stays where the text ends.
|
|
316
|
+
*/
|
|
317
|
+
function wouldPlacePushBlock(flow, place, view, room, placeBottom, line) {
|
|
318
|
+
for (const element of Array.from(flow.querySelectorAll('*'))) {
|
|
319
|
+
if (element === place || !isUnnarrowableBlock(element, view)) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
const box = element.getBoundingClientRect();
|
|
323
|
+
if (box.width > room + 0.5 && placeBottom - box.top > line / 2) {
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
|
|
288
330
|
/**
|
|
289
331
|
* A fullscreen overlay for viewing images and videos at full resolution.
|
|
290
332
|
*
|
|
@@ -619,12 +661,19 @@ export function Lightbox({
|
|
|
619
661
|
const [captionShownLines, setCaptionShownLines] = useState(0);
|
|
620
662
|
// The current caption's lines, without its toggle's place.
|
|
621
663
|
const bandCaptionFlowRef = useRef(null);
|
|
664
|
+
const bandCaptionPlaceRef = useRef(null);
|
|
622
665
|
// The caption's width at its last measure, and the cancel of a smaller
|
|
623
666
|
// count that waits for the next frame.
|
|
624
667
|
const captionWidthRef = useRef(0);
|
|
625
668
|
const cancelCaptionShrinkRef = useRef(null);
|
|
626
669
|
// Whether the open caption scrolls inside its panel.
|
|
627
670
|
const [isCaptionScrolling, setIsCaptionScrolling] = useState(false);
|
|
671
|
+
// Whether a block in the open caption sits below the toggle's place, as a
|
|
672
|
+
// wide image does. The place then makes the caption taller, and the taller
|
|
673
|
+
// caption makes the place longer, so the place is not shown and the toggle
|
|
674
|
+
// takes the line below the caption.
|
|
675
|
+
const [isCaptionPlaceOff, setIsCaptionPlaceOff] = useState(false);
|
|
676
|
+
const captionPlaceOffRef = useRef(false);
|
|
628
677
|
// The caption's toggle. Under a coarse pointer it takes taps out toward
|
|
629
678
|
// 44 px. A finger's tap on it is its own, as UIKit gives a control's tap
|
|
630
679
|
// precedence over the single tap of the photo around it.
|
|
@@ -648,14 +697,76 @@ export function Lightbox({
|
|
|
648
697
|
// The client height rounds to whole pixels, so this rounds to whole
|
|
649
698
|
// lines.
|
|
650
699
|
const lineCount = hasLine ? linesOf(caption.clientHeight) : 0;
|
|
700
|
+
const flow = bandCaptionFlowRef.current;
|
|
701
|
+
const place = bandCaptionPlaceRef.current;
|
|
702
|
+
const width = caption.clientWidth;
|
|
703
|
+
const hasNewWidth = width !== captionWidthRef.current;
|
|
704
|
+
// The flow's lines. A block that does not fit beside the place drops
|
|
705
|
+
// below it. The caption's height then counts the place's lines and the
|
|
706
|
+
// block's, and that height lengthens the place again in each delivery.
|
|
707
|
+
// So when the place has pushed a block down, the place leaves the flow.
|
|
708
|
+
const textLines = hasLine && flow != null ? Math.round(flow.getBoundingClientRect().height / line) : 0;
|
|
709
|
+
// The place stays off until the caption closes. A wider caption could
|
|
710
|
+
// fit the block beside the place, but its height may not change, so no
|
|
711
|
+
// delivery would turn the place back on.
|
|
712
|
+
const isPlaceOff = isCaptionOpen && captionPlaceOffRef.current;
|
|
713
|
+
// The open caption's count decides the place once per open. A later
|
|
714
|
+
// width can still push a block below a shown place. Then this is the
|
|
715
|
+
// count without the place, for the next frame.
|
|
716
|
+
let linesWithPlaceOff = null;
|
|
717
|
+
if (isCaptionOpen && !isPlaceOff && hasLine && flow != null && place != null) {
|
|
718
|
+
const placeBottom = place.getBoundingClientRect().bottom;
|
|
719
|
+
const blockBelowPlace = place.getBoundingClientRect().height > 0 ? Array.from(flow.querySelectorAll('*')).find(element => element !== place && !/^(?:inline|contents|none)/.test(view.getComputedStyle(element).display) && Math.abs(element.getBoundingClientRect().top - placeBottom) <= 1) : undefined;
|
|
720
|
+
if (blockBelowPlace != null) {
|
|
721
|
+
// The lines without the place, from reads alone: the text before
|
|
722
|
+
// the block, and everything from the block's top down. The block
|
|
723
|
+
// starts at the place's bottom edge, so the flow's height below
|
|
724
|
+
// it is the same with or without the place.
|
|
725
|
+
const text = flow.ownerDocument.createRange();
|
|
726
|
+
text.setStartAfter(place);
|
|
727
|
+
text.setEndBefore(blockBelowPlace);
|
|
728
|
+
const textBox = text.getBoundingClientRect();
|
|
729
|
+
const textHeight = textBox.height > 0 ? textBox.bottom - textBox.top : 0;
|
|
730
|
+
const textBottom = textBox.height > 0 ? textBox.bottom : flow.getBoundingClientRect().top;
|
|
731
|
+
// The text can end on the place's last line. Then an empty block, a
|
|
732
|
+
// thin rule or a 1x1 image starts at the place's bottom too, and it
|
|
733
|
+
// stays beside the place. The loop happens only when the place
|
|
734
|
+
// pushes the block a line below the text. The range's box ends at
|
|
735
|
+
// the glyphs, above the line box, so the check allows half a line.
|
|
736
|
+
if (blockBelowPlace.getBoundingClientRect().top - textBottom > line / 2) {
|
|
737
|
+
const belowHeight = flow.getBoundingClientRect().bottom - blockBelowPlace.getBoundingClientRect().top;
|
|
738
|
+
linesWithPlaceOff = Math.round(textHeight / line) + Math.round(belowHeight / line);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
captionPlaceOffRef.current = isPlaceOff;
|
|
743
|
+
setIsCaptionPlaceOff(isPlaceOff);
|
|
744
|
+
if (linesWithPlaceOff != null) {
|
|
745
|
+
// Turning the place off changes the caption's height. Inside this
|
|
746
|
+
// delivery that is a resize loop, so it waits for the next frame, and
|
|
747
|
+
// the place keeps its length until then.
|
|
748
|
+
const lines = linesWithPlaceOff;
|
|
749
|
+
const frame = view.requestAnimationFrame(() => {
|
|
750
|
+
cancelCaptionShrinkRef.current = null;
|
|
751
|
+
if (bandCaptionRef.current !== caption) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
captionPlaceOffRef.current = true;
|
|
755
|
+
setIsCaptionPlaceOff(true);
|
|
756
|
+
setCaptionShownLines(lines);
|
|
757
|
+
});
|
|
758
|
+
cancelCaptionShrinkRef.current = () => {
|
|
759
|
+
view.cancelAnimationFrame(frame);
|
|
760
|
+
};
|
|
761
|
+
captionWidthRef.current = width;
|
|
762
|
+
setIsCaptionScrolling(caption.scrollHeight > caption.clientHeight + 1);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
651
765
|
setCaptionShownLines(lineCount);
|
|
652
766
|
// The open caption is a scroll container, so its height includes the
|
|
653
767
|
// toggle's place, and that height never falls by itself. A new width
|
|
654
768
|
// can need fewer lines. The flow's height counts only the text's lines.
|
|
655
|
-
|
|
656
|
-
const width = caption.clientWidth;
|
|
657
|
-
if (isCaptionOpen && hasLine && flow != null && (width !== captionWidthRef.current || wasShrinking)) {
|
|
658
|
-
const textLines = Math.round(flow.getBoundingClientRect().height / line);
|
|
769
|
+
if (isCaptionOpen && hasLine && flow != null && (hasNewWidth || wasShrinking)) {
|
|
659
770
|
if (textLines < lineCount) {
|
|
660
771
|
// Fewer lines shrink the caption. Inside this delivery that is a
|
|
661
772
|
// resize loop, so they wait for the next frame. A toggle that no
|
|
@@ -764,7 +875,16 @@ export function Lightbox({
|
|
|
764
875
|
if (toggleWidth > 0) {
|
|
765
876
|
setCaptionToggleWidth(toggleWidth);
|
|
766
877
|
}
|
|
767
|
-
|
|
878
|
+
const flowBox = flow.getBoundingClientRect();
|
|
879
|
+
const lines = Math.round(flowBox.height / line);
|
|
880
|
+
// The place's state is decided here, once per open, from this layout
|
|
881
|
+
// without the place. A place that would push a block down stays off, so
|
|
882
|
+
// the first resize delivery finds the caption at its final size.
|
|
883
|
+
const place = bandCaptionPlaceRef.current;
|
|
884
|
+
const isPlaceOff = place != null && toggleWidth > 0 && wouldPlacePushBlock(flow, place, view, flowBox.width - toggleWidth - parseFloat(view.getComputedStyle(place).marginInlineStart), flowBox.top + lines * line, line);
|
|
885
|
+
captionPlaceOffRef.current = isPlaceOff;
|
|
886
|
+
setIsCaptionPlaceOff(isPlaceOff);
|
|
887
|
+
setCaptionShownLines(lines);
|
|
768
888
|
}, []);
|
|
769
889
|
// Syncs the toggle's place in the caption's last line with its width. The
|
|
770
890
|
// width is the delivery's own size, measured in the layout the delivery
|
|
@@ -1284,7 +1404,7 @@ export function Lightbox({
|
|
|
1284
1404
|
const pageIndexes = [index - 1, index, index + 1].filter(i => i >= 0 && i < mediaArray.length);
|
|
1285
1405
|
const hasCaptionBand = mediaArray.some(item => isRenderable(item.caption));
|
|
1286
1406
|
// Its place ends the caption's last line, unless the open caption scrolls.
|
|
1287
|
-
const hasCaptionTogglePlace = hasCaptionToggle && !isCaptionScrolling;
|
|
1407
|
+
const hasCaptionTogglePlace = hasCaptionToggle && !isCaptionScrolling && !(isCaptionOpen && isCaptionPlaceOff);
|
|
1288
1408
|
// The keyboard's zoom button is the current page's photo box, so the
|
|
1289
1409
|
// caption band stays outside it.
|
|
1290
1410
|
const zoomButtonProps = {
|
|
@@ -1459,13 +1579,14 @@ export function Lightbox({
|
|
|
1459
1579
|
type: "body",
|
|
1460
1580
|
maxLines: i === index && isCaptionOpen ? 0 : 2,
|
|
1461
1581
|
hasTruncateTooltip: false,
|
|
1462
|
-
xstyle: [styles.caption, styles.captionClamped, i === index && isCaptionOpen && styles.captionTextOpen, i === index && hasCaptionToggle && isCaptionScrolling && styles.captionTextBesideToggle(captionToggleWidth)],
|
|
1582
|
+
xstyle: [styles.caption, styles.captionClamped, i === index && isCaptionOpen && styles.captionTextOpen, i === index && hasCaptionToggle && isCaptionScrolling && styles.captionTextBesideToggle(captionToggleWidth), i === index && hasCaptionToggle && isCaptionOpen && isCaptionPlaceOff && !isCaptionScrolling && styles.captionTextToggleOwnLine],
|
|
1463
1583
|
children: /*#__PURE__*/_jsxs("div", {
|
|
1464
1584
|
ref: i === index ? bandCaptionFlowRef : undefined,
|
|
1465
1585
|
...{
|
|
1466
1586
|
className: "x1lliihq"
|
|
1467
1587
|
},
|
|
1468
1588
|
children: [/*#__PURE__*/_jsx("span", {
|
|
1589
|
+
ref: i === index ? bandCaptionPlaceRef : undefined,
|
|
1469
1590
|
"aria-hidden": "true",
|
|
1470
1591
|
...stylex.props(styles.captionTogglePlace, i === index && hasCaptionTogglePlace && captionShownLines > 0 && styles.captionTogglePlaceShown(captionToggleWidth, captionShownLines))
|
|
1471
1592
|
}), mediaArray[i].caption]
|
package/dist/Link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link/Link.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAM,KAAK,SA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
k1xSpc: "x3nfvp2",
|
|
47
|
+
ks0D6T: "x193iq5w",
|
|
47
48
|
kGNEyG: "x6s0dn4",
|
|
48
49
|
kOIVth: "x1lsbc85",
|
|
49
50
|
kMv6JI: "xjb2p0i",
|
|
@@ -58,7 +59,10 @@ const styles = {
|
|
|
58
59
|
$$css: true
|
|
59
60
|
},
|
|
60
61
|
truncating: {
|
|
61
|
-
|
|
62
|
+
k7Eaqz: "xeuugli",
|
|
63
|
+
$$css: true
|
|
64
|
+
},
|
|
65
|
+
label: {
|
|
62
66
|
k7Eaqz: "xeuugli",
|
|
63
67
|
$$css: true
|
|
64
68
|
},
|
|
@@ -235,6 +239,7 @@ export function Link({
|
|
|
235
239
|
color: labelColor,
|
|
236
240
|
display: display,
|
|
237
241
|
maxLines: maxLines,
|
|
242
|
+
xstyle: styles.label,
|
|
238
243
|
children: children
|
|
239
244
|
}), isExternalWithIcon && /*#__PURE__*/_jsxs(_Fragment, {
|
|
240
245
|
children: [/*#__PURE__*/_jsx(Icon, {
|
package/dist/List/ListItem.d.ts
CHANGED
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
import { type ReactNode } from 'react';
|
|
35
35
|
import type { BaseProps } from '../BaseProps.js';
|
|
36
36
|
import type { ItemAlign, ItemSwipeActions, ItemSwipeBehavior } from '../Item/index.js';
|
|
37
|
+
import { type Swipe } from '../Swipe/swipeHost.js';
|
|
37
38
|
export interface ListItemProps extends BaseProps<HTMLLIElement> {
|
|
38
39
|
/** Ref forwarded to the root element */
|
|
39
40
|
ref?: React.Ref<HTMLLIElement>;
|
|
@@ -118,15 +119,12 @@ export interface ListItemProps extends BaseProps<HTMLLIElement> {
|
|
|
118
119
|
* React's `key`, which stays React's own.
|
|
119
120
|
*/
|
|
120
121
|
itemKey?: string | number;
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* clips the rows in the inline axis for them.
|
|
125
|
-
*/
|
|
122
|
+
/** Swipe actions from `createSwipe`, passed to `Item` with this row's `itemKey` added. */
|
|
123
|
+
swipe?: Swipe;
|
|
124
|
+
/** @deprecated Pass `swipe` instead. */
|
|
126
125
|
swipeActions?: ItemSwipeActions;
|
|
127
126
|
/**
|
|
128
|
-
*
|
|
129
|
-
* `Item.swipeBehavior`.
|
|
127
|
+
* @deprecated Set it in `swipe` instead.
|
|
130
128
|
* @default 'reveal'
|
|
131
129
|
*/
|
|
132
130
|
swipeBehavior?: ItemSwipeBehavior;
|
|
@@ -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;
|
|
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;AAC5E,OAAO,EAAmB,KAAK,KAAK,EAAC,MAAM,oBAAoB,CAAC;AAahE,MAAM,WAAW,aAAc,SAAQ,SAAS,CAAC,aAAa,CAAC;IAC7D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;OAMG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ListRowContext.js";
|
|
|
48
48
|
import { ItemMarkerColumnsContext } from "../Item/ItemMarkerColumnsContext.js";
|
|
49
49
|
import { ItemLabelNeededContext } from "../Item/ItemLabelContext.js";
|
|
50
50
|
import { ItemTrailingContext } from "../Item/ItemTrailingContext.js";
|
|
51
|
+
import { swipeWithItemKey } from "../Swipe/swipeHost.js";
|
|
51
52
|
import { themeProps } from "../utils/themeProps.js";
|
|
52
53
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
53
54
|
import { isReportedRow, keepPresentation } from "./listLayoutUpdates.js";
|
|
@@ -262,6 +263,13 @@ export function ListItem({
|
|
|
262
263
|
...restProps
|
|
263
264
|
}) {
|
|
264
265
|
const ctx = use(ListContext);
|
|
266
|
+
// The row's swipe, attached with its key for each action's `onActivate`.
|
|
267
|
+
// Kept per swipe value and key: a render that changes neither hands the row
|
|
268
|
+
// the same value. So an open row stays as it is.
|
|
269
|
+
const {
|
|
270
|
+
swipe
|
|
271
|
+
} = restProps;
|
|
272
|
+
const keyedSwipe = useMemo(() => swipe == null ? undefined : swipeWithItemKey(swipe, itemKey), [swipe, itemKey]);
|
|
265
273
|
// The row's element, which a row without a handle names for the reorder.
|
|
266
274
|
const rowRef = useRef(null);
|
|
267
275
|
// A List isolates its rows, so what a row raises stays below a page-level
|
|
@@ -296,6 +304,7 @@ export function ListItem({
|
|
|
296
304
|
// its band's own z-index orders only inside it, and under a finger the row
|
|
297
305
|
// raises itself. Its root is its `<li>`, never a link.
|
|
298
306
|
const isRaisedSwipeRow = isInList && isTouchTarget && servesSwipeActions({
|
|
307
|
+
swipe: restProps.swipe,
|
|
299
308
|
swipeActions: restProps.swipeActions,
|
|
300
309
|
isDisabled,
|
|
301
310
|
isDelegate: interactiveRef != null,
|
|
@@ -371,7 +380,8 @@ export function ListItem({
|
|
|
371
380
|
style
|
|
372
381
|
}),
|
|
373
382
|
...itemKeyProps(itemKey),
|
|
374
|
-
...restProps
|
|
383
|
+
...restProps,
|
|
384
|
+
swipe: keyedSwipe
|
|
375
385
|
});
|
|
376
386
|
const row = /*#__PURE__*/_jsx(ItemListRowContext, {
|
|
377
387
|
value: true,
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/core/src/MetadataList/MetadataList.doc.mjs
|
|
9
|
+
* - /packages/core/src/MetadataList/MetadataListItem.doc.mjs
|
|
9
10
|
* - /packages/core/src/MetadataList/MetadataList.test.tsx
|
|
11
|
+
* - /packages/core/src/MetadataList/MetadataListItem.test.tsx
|
|
10
12
|
* - /packages/core/src/MetadataList/index.ts
|
|
11
13
|
* - /apps/storybook/stories/MetadataList.stories.tsx
|
|
12
14
|
* - /packages/cli/assets/templates/blocks/components/MetadataList/ (showcase blocks)
|
|
@@ -14,7 +16,10 @@
|
|
|
14
16
|
import { type ReactNode } from 'react';
|
|
15
17
|
import type { BaseProps } from '../BaseProps.js';
|
|
16
18
|
export interface MetadataListItemProps extends BaseProps<HTMLDivElement> {
|
|
17
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Ref forwarded to the item element: the label `dt` side by side, or the
|
|
21
|
+
* stacked wrapper.
|
|
22
|
+
*/
|
|
18
23
|
ref?: React.Ref<HTMLDivElement>;
|
|
19
24
|
/**
|
|
20
25
|
* Content value for this metadata item.
|
|
@@ -34,7 +39,7 @@ export interface MetadataListItemProps extends BaseProps<HTMLDivElement> {
|
|
|
34
39
|
'data-testid'?: string;
|
|
35
40
|
}
|
|
36
41
|
/**
|
|
37
|
-
* A single labeled metadata value within
|
|
42
|
+
* A single labeled metadata value within a MetadataList.
|
|
38
43
|
*
|
|
39
44
|
* Renders a `<dt>` / `<dd>` pair. Layout (side-by-side or stacked) is
|
|
40
45
|
* determined by the parent MetadataList's label configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetadataListItem.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataListItem.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"MetadataListItem.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAM,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAS1C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAS5C,MAAM,WAAW,qBAAsB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACtE;;;OAGG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAqED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,qBAAqB,+BAwDvB;yBAlEe,gBAAgB"}
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
*
|
|
11
11
|
* SYNC: When modified, update these files to stay in sync:
|
|
12
12
|
* - /packages/core/src/MetadataList/MetadataList.doc.mjs
|
|
13
|
+
* - /packages/core/src/MetadataList/MetadataListItem.doc.mjs
|
|
13
14
|
* - /packages/core/src/MetadataList/MetadataList.test.tsx
|
|
15
|
+
* - /packages/core/src/MetadataList/MetadataListItem.test.tsx
|
|
14
16
|
* - /packages/core/src/MetadataList/index.ts
|
|
15
17
|
* - /apps/storybook/stories/MetadataList.stories.tsx
|
|
16
18
|
* - /packages/cli/assets/templates/blocks/components/MetadataList/ (showcase blocks)
|
|
@@ -60,7 +62,7 @@ const styles = {
|
|
|
60
62
|
// =============================================================================
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
|
-
* A single labeled metadata value within
|
|
65
|
+
* A single labeled metadata value within a MetadataList.
|
|
64
66
|
*
|
|
65
67
|
* Renders a `<dt>` / `<dd>` pair. Layout (side-by-side or stacked) is
|
|
66
68
|
* determined by the parent MetadataList's label configuration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileNav.d.ts","sourceRoot":"","sources":["../../src/MobileNav/MobileNav.tsx"],"names":[],"mappings":"AA8CA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAuBf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MobileNav.d.ts","sourceRoot":"","sources":["../../src/MobileNav/MobileNav.tsx"],"names":[],"mappings":"AA8CA,OAAO,EAOL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAuBf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6M5C;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,MAAM,CAAC;AAI/B;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBpE;AAkED,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC;IAC9D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EAAE,UAAU,EAClB,YAAY,EAAE,gBAAgB,EAC9B,QAAQ,EACR,MAAM,EACN,KAAW,EACX,IAAa,EACb,KAAK,EACL,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EAAE,WAAW,EACpB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,cAAc,+BAkThB;yBAjUe,SAAS"}
|
|
@@ -64,6 +64,8 @@ import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
|
64
64
|
import { themeProps } from "../utils/themeProps.js";
|
|
65
65
|
import { matchesMediaQuery } from "../utils/coarsePointer.js";
|
|
66
66
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
67
|
+
import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
68
|
+
import { useIsHydrating } from "../hooks/useIsHydrating.js";
|
|
67
69
|
import { useScrollLock } from "../hooks/useScrollLock.js";
|
|
68
70
|
import { useFocusRegionContainment } from "../hooks/useFocusTrap.js";
|
|
69
71
|
import { registerEnglishFallback, useComponentTranslator } from "../i18n/useComponentTranslator.js";
|
|
@@ -364,33 +366,40 @@ export function MobileNav({
|
|
|
364
366
|
// open/close effect below, so it measures the scrollbar gutter before
|
|
365
367
|
// showModal() can hide the scrollbar.
|
|
366
368
|
useScrollLock(isOpen);
|
|
367
|
-
//
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
//
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
//
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if (
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
369
|
+
// For side='auto', the edge is resolved while rendering the transition to
|
|
370
|
+
// open (or to `auto` while open). An Effect would commit the default `end`
|
|
371
|
+
// first, so the drawer would slide in from the wrong edge. An explicit
|
|
372
|
+
// `side` is used directly.
|
|
373
|
+
const [autoSide, setAutoSide] = useState('end');
|
|
374
|
+
const [wasAutoOpen, setWasAutoOpen] = useState(false);
|
|
375
|
+
const isAutoOpen = isOpen && side === 'auto';
|
|
376
|
+
// Hydration must not read focus or layout; resolve after it.
|
|
377
|
+
const canReadDom = !useIsHydrating();
|
|
378
|
+
if (canReadDom && isAutoOpen !== wasAutoOpen) {
|
|
379
|
+
setWasAutoOpen(isAutoOpen);
|
|
380
|
+
if (isAutoOpen) {
|
|
381
|
+
// The opener is the focused element. If a tap left no focus, or focus is
|
|
382
|
+
// already inside this dialog (a server-open drawer, where showModal()
|
|
383
|
+
// ran before this render), fall back to the element whose
|
|
384
|
+
// `aria-controls` names this dialog.
|
|
385
|
+
const active = document.activeElement;
|
|
386
|
+
const hasOpenerFocus = active !== null && active !== document.body && !dialogRef.current?.contains(active);
|
|
387
|
+
const dialogIds = [dialogId, dialogRef.current?.id, rest.id];
|
|
388
|
+
const trigger = hasOpenerFocus && active ? active : Array.from(
|
|
389
|
+
// eslint-disable-next-line @eslint-react/purity -- runs only on the closed-to-open render. Never on the server or while hydrating.
|
|
390
|
+
document.querySelectorAll('[aria-controls]')).find(el => (el.getAttribute('aria-controls') ?? '').split(/\s+/).some(token => token !== '' && dialogIds.includes(token)));
|
|
391
|
+
if (trigger) {
|
|
384
392
|
const rect = trigger.getBoundingClientRect();
|
|
385
393
|
const triggerCenter = rect.left + rect.width / 2;
|
|
386
|
-
|
|
387
|
-
|
|
394
|
+
const half = window.innerWidth / 2;
|
|
395
|
+
// An opener in the inline-start half opens the drawer at the start. A
|
|
396
|
+
// centred opener opens it at the end in both directions.
|
|
397
|
+
const isInStartHalf = isRtlElement(trigger) ? triggerCenter > half : triggerCenter < half;
|
|
398
|
+
setAutoSide(isInStartHalf ? 'start' : 'end');
|
|
388
399
|
}
|
|
389
|
-
} else {
|
|
390
|
-
// eslint-disable-next-line @eslint-react/set-state-in-effect -- side prop changes must update the open dialog placement
|
|
391
|
-
setResolvedSide(side);
|
|
392
400
|
}
|
|
393
|
-
}
|
|
401
|
+
}
|
|
402
|
+
const resolvedSide = side === 'auto' ? autoSide : side;
|
|
394
403
|
|
|
395
404
|
// Open/close the dialog via showModal()/close()
|
|
396
405
|
// close() is delayed so the slide-out transition can play.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAWZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAe5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAcpD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAWZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAe5D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAcpD,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,SAAS,C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SAAS,uBAAuB,EAAE,EAC/D,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAU,EAAE,cAAsB,EAClC,UAAkB,EAClB,eAAe,EACf,OAAO,EACP,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,WAAW,EAAE,oBAAoB,EACjC,IAAI,EAAE,QAAQ,EACd,OAAiB,EACjB,MAAM,EACN,aAA0B,EAC1B,YAAY,EACZ,SAAS,EACT,QAAgB,EAChB,YAAoB,EACpB,cAAc,EAAE,uBAAuB,EACvC,SAAiB,EACjB,iBAAiB,EAAE,0BAA0B,EAC7C,SAAS,EAAE,kBAAkB,EAC7B,eAAe,EAAE,wBAAwB,EACzC,SAAiB,EACjB,cAAwB,EACxB,WAAW,EACX,SAAa,EACb,YAAY,EACZ,iBAA2B,EAC3B,YAAwB,EACxB,aAAqB,EACrB,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,GAAG,EACH,EAAE,EACF,OAAO,EACP,OAAO,EACP,SAAS,EAAE,aAAa,EACxB,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,SAAS,EACb,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBA6oDvB;yBApsDe,aAAa"}
|
|
@@ -37,7 +37,7 @@ import { isOptionData, isDivider, isSection, normalizeOption, getSelectableOptio
|
|
|
37
37
|
import { useMultiCombobox } from "./hooks.js";
|
|
38
38
|
import { getInputARIA, isImeKeyEvent, mergeProps } from "../utils/index.js";
|
|
39
39
|
import { joinAriaIDs } from "../utils/inputAria.js";
|
|
40
|
-
import { withholdCallerHandlers } from "../utils/disabledInteraction.js";
|
|
40
|
+
import { disabledInteractionProps, withholdCallerHandlers } from "../utils/disabledInteraction.js";
|
|
41
41
|
import { devWarn, warnOnce } from "../utils/devWarning.js";
|
|
42
42
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
43
43
|
import { useKeyboardHighlight } from "../hooks/useKeyboardHighlight.js";
|
|
@@ -80,6 +80,12 @@ const CREATE_VALUE_PREFIX = '__astryx_multi_selector_create__';
|
|
|
80
80
|
function isCreateValue(value) {
|
|
81
81
|
return value.startsWith(CREATE_VALUE_PREFIX);
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The trigger's own list is open. A press does not scale the box then, so the
|
|
86
|
+
* list anchors to the box at rest.
|
|
87
|
+
*/
|
|
88
|
+
const LAYER_OPEN = ':has([aria-expanded="true"])';
|
|
83
89
|
const styles = {
|
|
84
90
|
triggerContainer: {
|
|
85
91
|
kVAEAm: "x1n2onr6",
|
|
@@ -122,8 +128,8 @@ const styles = {
|
|
|
122
128
|
kWkggS: "xjbqb8w",
|
|
123
129
|
kGVxlE: "x1gnnqk1 x1s17dad x15ysqaf",
|
|
124
130
|
k63SB2: "x1e4wzip",
|
|
125
|
-
k1ekBW: "xrafxwg",
|
|
126
|
-
k3aq6I: "x3oybdh
|
|
131
|
+
k1ekBW: "xrafxwg xhu4vej",
|
|
132
|
+
k3aq6I: "x3oybdh x1g2qjg4 x182m0z6 x5euuyh",
|
|
127
133
|
$$css: true
|
|
128
134
|
},
|
|
129
135
|
triggerSecondary: {
|
|
@@ -131,8 +137,8 @@ const styles = {
|
|
|
131
137
|
kWkggS: "x17x4s8c",
|
|
132
138
|
kGVxlE: "x1gnnqk1 x1s17dad x15ysqaf",
|
|
133
139
|
k63SB2: "x1e4wzip",
|
|
134
|
-
k1ekBW: "xrafxwg",
|
|
135
|
-
k3aq6I: "x3oybdh
|
|
140
|
+
k1ekBW: "xrafxwg xhu4vej",
|
|
141
|
+
k3aq6I: "x3oybdh x1g2qjg4 x182m0z6 x5euuyh",
|
|
136
142
|
$$css: true
|
|
137
143
|
},
|
|
138
144
|
triggerGhostDisabled: {
|
|
@@ -714,7 +720,7 @@ export function MultiSelector({
|
|
|
714
720
|
|
|
715
721
|
// Open dropdown on mount when isDefaultOpen is true and interaction is allowed.
|
|
716
722
|
useEffect(() => {
|
|
717
|
-
if (isDefaultOpen && !isEffectivelyReadOnly) {
|
|
723
|
+
if (isDefaultOpen && !isDisabled && !isEffectivelyReadOnly) {
|
|
718
724
|
surface.show();
|
|
719
725
|
}
|
|
720
726
|
// eslint-disable-next-line @eslint-react/exhaustive-deps -- mount-only: isDefaultOpen is not reactive
|
|
@@ -1500,7 +1506,7 @@ export function MultiSelector({
|
|
|
1500
1506
|
const triggerProps = {
|
|
1501
1507
|
// Base props reach the caller's control, the primary semantic control
|
|
1502
1508
|
// in this mode; the selector's own wiring below wins over them.
|
|
1503
|
-
...
|
|
1509
|
+
...callerProps,
|
|
1504
1510
|
'aria-describedby': ariaDescribedByProp,
|
|
1505
1511
|
// Only a caller value is handed back, so a control that names itself
|
|
1506
1512
|
// with its own aria-labelledby before spreading keeps it.
|
|
@@ -1524,6 +1530,7 @@ export function MultiSelector({
|
|
|
1524
1530
|
id: triggerId,
|
|
1525
1531
|
onClick: isEffectivelyReadOnly ? onClick : composeEventHandlers(onTriggerClick, onClick),
|
|
1526
1532
|
onKeyDown: isEffectivelyReadOnly ? onKeyDownProp : composeEventHandlers(onKeyDown, onKeyDownProp),
|
|
1533
|
+
...(isDisabled ? disabledInteractionProps() : undefined),
|
|
1527
1534
|
onFocus: event => {
|
|
1528
1535
|
onFocus?.(event);
|
|
1529
1536
|
surface.onTriggerFocus(event);
|
|
@@ -1538,6 +1545,7 @@ export function MultiSelector({
|
|
|
1538
1545
|
'aria-expanded': isEffectivelyReadOnly ? false : surface.isOpen,
|
|
1539
1546
|
'aria-controls': isEffectivelyReadOnly ? undefined : listboxId,
|
|
1540
1547
|
'aria-busy': isBusy || undefined,
|
|
1548
|
+
'aria-disabled': isDisabled || callerProps['aria-disabled'],
|
|
1541
1549
|
// Withholding the disclosure attributes stops the control lying about
|
|
1542
1550
|
// a panel, but leaves it silent about WHY it does not open. The field
|
|
1543
1551
|
// path says so through its own chrome; the caller's control has none,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BaseProps } from '../BaseProps.js';
|
|
2
|
+
import type { LinkComponentType } from '../Link/types.js';
|
|
2
3
|
import type { PaginationVariantMap } from './index.js';
|
|
3
4
|
/** Visual variant controlling what appears between prev/next buttons.
|
|
4
5
|
* Extensible via module augmentation of PaginationVariantMap.
|
|
@@ -11,13 +12,35 @@ export interface PaginationProps extends Omit<BaseProps<HTMLElement>, 'onChange'
|
|
|
11
12
|
ref?: React.Ref<HTMLElement>;
|
|
12
13
|
/** Current page number (1-based). Page 1 is the first page. */
|
|
13
14
|
page: number;
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Called when the page changes. With `getPageHref` it also runs when a page
|
|
17
|
+
* link is activated: use it there for state or analytics, and do not
|
|
18
|
+
* navigate in it, because the link navigates.
|
|
19
|
+
*/
|
|
15
20
|
onChange: (page: number) => void;
|
|
16
21
|
/**
|
|
17
22
|
* Async action on page change. Fires after onChange.
|
|
18
23
|
* Uses React transitions for built-in loading state.
|
|
19
24
|
*/
|
|
20
25
|
changeAction?: (page: number) => void | Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the URL of a page. When set, the page number, previous, next,
|
|
28
|
+
* first and last controls render as links to that URL, and `onChange` still
|
|
29
|
+
* runs when one is activated. `pageSize` is the current page size when
|
|
30
|
+
* `pageSize` or `pageSizeOptions` is set. The dots, the page box and the
|
|
31
|
+
* page-size selector are not links. For a page-size choice, navigate in
|
|
32
|
+
* `onPageSizeChange`, not in the `onChange(1)` that follows. When `onChange`
|
|
33
|
+
* navigates for the dots or the page box, leave this unset in the `dots`
|
|
34
|
+
* and `input` variants, or their arrow links navigate twice. In cursor
|
|
35
|
+
* pagination, map the page before or after the current one to the cursor's
|
|
36
|
+
* URL.
|
|
37
|
+
*/
|
|
38
|
+
getPageHref?: (page: number, pageSize?: number) => string;
|
|
39
|
+
/**
|
|
40
|
+
* Custom link component for the links `getPageHref` makes.
|
|
41
|
+
* Overrides the provider-level default set by LinkProvider.
|
|
42
|
+
*/
|
|
43
|
+
as?: LinkComponentType;
|
|
21
44
|
/**
|
|
22
45
|
* Total number of items. Used to calculate page count.
|
|
23
46
|
* Takes precedence over totalPages if both provided.
|
|
@@ -124,7 +147,7 @@ export declare function generatePageRange(currentPage: number, totalPages: numbe
|
|
|
124
147
|
* />
|
|
125
148
|
* ```
|
|
126
149
|
*/
|
|
127
|
-
export declare function Pagination({ page, onChange, changeAction, totalItems, totalPages: totalPagesProp, hasMore, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, variant, pageLabel, hasFirstLast: hasFirstLastProp, step: stepProp, siblingCount, size, isDisabled, label: labelFromProps, 'data-testid': testId, xstyle, className, style, ref, ...rest }: PaginationProps): import("react").JSX.Element | null;
|
|
150
|
+
export declare function Pagination({ page, onChange, changeAction, getPageHref, as, totalItems, totalPages: totalPagesProp, hasMore, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, variant, pageLabel, hasFirstLast: hasFirstLastProp, step: stepProp, siblingCount, size, isDisabled, label: labelFromProps, 'data-testid': testId, xstyle, className, style, ref, ...rest }: PaginationProps): import("react").JSX.Element | null;
|
|
128
151
|
export declare namespace Pagination {
|
|
129
152
|
var displayName: string;
|
|
130
153
|
}
|