@astryxdesign/core 0.7.16 → 0.7.17-canary.g49a475f
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/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/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/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +11 -5
- package/dist/Swipe/SwipeActionsLayer.d.ts +11 -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 +219 -0
- package/dist/Swipe/useSwipeAction.d.ts.map +1 -0
- package/dist/Swipe/useSwipeAction.js +1120 -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/TopNav/TopNav.d.ts.map +1 -1
- package/dist/TopNav/TopNav.js +6 -1
- package/dist/astryx.css +29 -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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- 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/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/theme/defineTheme.d.ts +19 -1
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +18 -0
- package/dist/theme/generateThemeRules.d.ts.map +1 -1
- package/dist/theme/generateThemeRules.js +121 -76
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/mergeComponents.d.ts +2 -1
- package/dist/theme/mergeComponents.d.ts.map +1 -1
- package/dist/theme/mergeComponents.js +18 -2
- package/dist/utils/pressFeedback.d.ts.map +1 -1
- package/dist/utils/pressFeedback.js +4 -1
- package/package.json +10 -5
- 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/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/Selector/Selector.tsx +21 -9
- 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 +1413 -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/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/index.ts +1 -0
- package/src/motion/MEASUREMENTS.md +16 -0
- package/src/motion/README.md +1 -0
- package/src/motion/uikit/swipeActions.ts +142 -0
- package/src/privateAttributes/pressHeld.stylex.ts +31 -0
- package/src/theme/defineTheme.ts +23 -1
- package/src/theme/generateThemeRules.ts +194 -116
- package/src/theme/index.ts +1 -0
- package/src/theme/mergeComponents.ts +15 -5
- package/src/theme/syntax/useSyntaxTheme.doc.mjs +95 -0
- 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
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["../../src/Pagination/Pagination.tsx"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAGrD,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAalD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,CAAC;AAE3D,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAE7B,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC1D;;;OAGG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IAGvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;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YAAgB,EAChB,IAAW,EACX,UAAkB,EAClB,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,MAAM,EACrB,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,eAAe,sCAuiBjB;yBAjkBe,UAAU"}
|
|
@@ -4,29 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Pagination.tsx
|
|
7
|
-
* @input
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* chevronsLeft/chevronsRight (first/last) icons.
|
|
12
|
-
* @output Exports Pagination component, PaginationProps, PaginationVariant, PaginationSize types
|
|
7
|
+
* @input React, StyleX, Button, Icon, NumberInput, Selector, and Text. Button renders each
|
|
8
|
+
* control, as a link with getPageHref. useFocusAcrossSwap keeps focus on a control whose
|
|
9
|
+
* element Button replaces. rtlStyles.mirror mirrors the chevrons under RTL in CSS.
|
|
10
|
+
* @output Exports Pagination, generatePageRange, PaginationProps, PaginationVariant, PaginationSize
|
|
13
11
|
* @position Core implementation; consumed by index.ts, tested by Pagination.test.tsx
|
|
14
12
|
*
|
|
15
13
|
* SYNC: When modified, update these files to stay in sync:
|
|
16
|
-
* - /packages/core/src/Pagination/Pagination.test.tsx
|
|
17
|
-
* - /packages/core/src/Pagination/index.ts
|
|
18
|
-
* - /apps/storybook/stories/Pagination.stories.tsx
|
|
19
|
-
* - /packages/cli/assets/templates/blocks/components/Pagination/
|
|
20
|
-
*
|
|
21
|
-
* Last synced props: page, onChange, changeAction, totalItems, totalPages, hasMore,
|
|
22
|
-
* pageSize, pageSizeOptions, onPageSizeChange, variant, pageLabel,
|
|
23
|
-
* hasFirstLast, step, siblingCount, size, isDisabled, label, data-testid, xstyle
|
|
14
|
+
* - /packages/core/src/Pagination/Pagination.test.tsx
|
|
15
|
+
* - /packages/core/src/Pagination/index.ts
|
|
16
|
+
* - /apps/storybook/stories/Pagination.stories.tsx
|
|
17
|
+
* - /packages/cli/assets/templates/blocks/components/Pagination/
|
|
24
18
|
*/
|
|
25
|
-
import { useOptimistic, useState, useTransition } from 'react';
|
|
19
|
+
import { useEffect, useOptimistic, useRef, useState, useTransition } from 'react';
|
|
26
20
|
import * as stylex from '@stylexjs/stylex';
|
|
27
21
|
import "../theme/tokens.stylex.js";
|
|
28
22
|
import { colorVars, fontWeightVars, sizeVars, spacingVars, durationVars, easeVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
29
23
|
import { Button } from "../Button/index.js";
|
|
24
|
+
import { isModifiedClick } from "../DropdownMenu/menuItemRoles.js";
|
|
30
25
|
import { Icon } from "../Icon/index.js";
|
|
31
26
|
import { NumberInput } from "../NumberInput/index.js";
|
|
32
27
|
import { Selector } from "../Selector/index.js";
|
|
@@ -35,6 +30,7 @@ import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
|
35
30
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
36
31
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
37
32
|
import { focusForLastInput } from "../utils/focusReturn.js";
|
|
33
|
+
import { useFocusAcrossSwap } from "../utils/useFocusAcrossSwap.js";
|
|
38
34
|
import { useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
39
35
|
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
40
36
|
import { themeProps } from "../utils/themeProps.js";
|
|
@@ -171,6 +167,29 @@ export function generatePageRange(currentPage, totalPages, siblingCount) {
|
|
|
171
167
|
return pages;
|
|
172
168
|
}
|
|
173
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Whether a click on a page link navigates this document. A modifier key or a
|
|
172
|
+
* `target` other than `_self` opens the URL elsewhere. A link with a rejected
|
|
173
|
+
* URL has no `href` and opens nothing.
|
|
174
|
+
*/
|
|
175
|
+
function navigatesHere(event) {
|
|
176
|
+
const link = event.currentTarget;
|
|
177
|
+
const target = link.getAttribute('target');
|
|
178
|
+
return !link.matches('a:not([href])') && !isModifiedClick(event) && (!target || target.toLowerCase() === '_self');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Button replaces the element when the control starts or stops being a link.
|
|
183
|
+
* The new element takes the focus.
|
|
184
|
+
*/
|
|
185
|
+
function PaginationButton(props) {
|
|
186
|
+
const ref = useFocusAcrossSwap();
|
|
187
|
+
return /*#__PURE__*/_jsx(Button, {
|
|
188
|
+
...props,
|
|
189
|
+
ref: ref
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
174
193
|
// =============================================================================
|
|
175
194
|
// Component
|
|
176
195
|
// =============================================================================
|
|
@@ -196,10 +215,12 @@ export function Pagination({
|
|
|
196
215
|
page,
|
|
197
216
|
onChange,
|
|
198
217
|
changeAction,
|
|
218
|
+
getPageHref,
|
|
219
|
+
as,
|
|
199
220
|
totalItems,
|
|
200
221
|
totalPages: totalPagesProp,
|
|
201
222
|
hasMore,
|
|
202
|
-
pageSize: pageSizeProp
|
|
223
|
+
pageSize: pageSizeProp,
|
|
203
224
|
pageSizeOptions,
|
|
204
225
|
onPageSizeChange,
|
|
205
226
|
variant = 'pages',
|
|
@@ -233,7 +254,10 @@ export function Pagination({
|
|
|
233
254
|
// type level but yield Infinity/NaN page counts, and
|
|
234
255
|
// Array.from({length: Infinity}) crashes the dots variant. Coerce to a
|
|
235
256
|
// positive integer; non-finite values fall back to the default.
|
|
236
|
-
const pageSize = Number.isFinite(pageSizeProp) ? Math.max(1, Math.floor(pageSizeProp)) : 10;
|
|
257
|
+
const pageSize = pageSizeProp != null && Number.isFinite(pageSizeProp) ? Math.max(1, Math.floor(pageSizeProp)) : 10;
|
|
258
|
+
const hasPageSizeOptions = pageSizeOptions != null && pageSizeOptions.length > 0;
|
|
259
|
+
// A caller that sets no page size has none in its URLs.
|
|
260
|
+
const hrefPageSize = pageSizeProp !== undefined || hasPageSizeOptions ? pageSize : undefined;
|
|
237
261
|
|
|
238
262
|
// Prev/next stride. Same guard as pageSize: non-integer or < 1 falls back to
|
|
239
263
|
// a single-page step so a bad value never freezes or reverses navigation.
|
|
@@ -259,6 +283,15 @@ export function Pagination({
|
|
|
259
283
|
// Track the page optimistically so rapid prev/next clicks advance from the
|
|
260
284
|
// in-flight target instead of stalling on the last committed page.
|
|
261
285
|
const [optimisticPage, setOptimisticPage] = useOptimistic(page);
|
|
286
|
+
// A link click changes the page before the browser follows the link's URL.
|
|
287
|
+
// Previous and Next count from the page of the click until that click is
|
|
288
|
+
// over, so the browser follows the URL that was clicked.
|
|
289
|
+
const [clickedFromPage, setClickedFromPage] = useState(null);
|
|
290
|
+
const linkPage = clickedFromPage ?? optimisticPage;
|
|
291
|
+
const countFromCurrentPage = () => setClickedFromPage(null);
|
|
292
|
+
const clickOverTimerRef = useRef(undefined);
|
|
293
|
+
// Releases the timer that waits for the click to be over on unmount.
|
|
294
|
+
useEffect(() => () => clearTimeout(clickOverTimerRef.current), []);
|
|
262
295
|
// A kept rejected entry widens the page box to fit the status icon beside
|
|
263
296
|
// the typed text.
|
|
264
297
|
const [isPageEntryRejected, setIsPageEntryRejected] = useState(false);
|
|
@@ -341,25 +374,28 @@ export function Pagination({
|
|
|
341
374
|
const lower = Math.max(target, 1);
|
|
342
375
|
return computedTotalPages != null ? Math.min(lower, computedTotalPages) : lower;
|
|
343
376
|
};
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
377
|
+
|
|
378
|
+
// An unavailable or disabled control gets no URL. Its Button is disabled,
|
|
379
|
+
// so its click handler does not run.
|
|
380
|
+
const controlProps = (target, isAvailable) => {
|
|
381
|
+
const href = isAvailable && !isDisabled ? getPageHref?.(target, hrefPageSize) : undefined;
|
|
382
|
+
return {
|
|
383
|
+
href,
|
|
384
|
+
as,
|
|
385
|
+
onClick: event => {
|
|
386
|
+
if (href != null) {
|
|
387
|
+
// A link click that opens the URL elsewhere changes no page here.
|
|
388
|
+
if (!navigatesHere(event)) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
setClickedFromPage(linkPage);
|
|
392
|
+
clearTimeout(clickOverTimerRef.current);
|
|
393
|
+
// The browser follows the link before the next task starts.
|
|
394
|
+
clickOverTimerRef.current = setTimeout(countFromCurrentPage, 0);
|
|
395
|
+
}
|
|
396
|
+
handlePageChange(target);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
363
399
|
};
|
|
364
400
|
const handlePageSizeChange = value => {
|
|
365
401
|
const newSize = Number(value);
|
|
@@ -419,7 +455,7 @@ export function Pagination({
|
|
|
419
455
|
}, `ellipsis-${previousPage}-${nextPage}`);
|
|
420
456
|
}
|
|
421
457
|
const isActive = item === optimisticPage;
|
|
422
|
-
return /*#__PURE__*/_jsx(
|
|
458
|
+
return /*#__PURE__*/_jsx(PaginationButton, {
|
|
423
459
|
label: t('@astryx.pagination.goToPage', {
|
|
424
460
|
page: item
|
|
425
461
|
}),
|
|
@@ -428,7 +464,7 @@ export function Pagination({
|
|
|
428
464
|
}),
|
|
429
465
|
variant: "ghost",
|
|
430
466
|
size: buttonSize,
|
|
431
|
-
|
|
467
|
+
...controlProps(item, true),
|
|
432
468
|
isDisabled: isDisabled,
|
|
433
469
|
"aria-current": isActive ? 'page' : undefined,
|
|
434
470
|
xstyle: isActive && styles.activePage,
|
|
@@ -612,7 +648,7 @@ export function Pagination({
|
|
|
612
648
|
...rest,
|
|
613
649
|
"aria-label": label,
|
|
614
650
|
"data-testid": testId,
|
|
615
|
-
children: [
|
|
651
|
+
children: [hasPageSizeOptions && /*#__PURE__*/_jsx("div", {
|
|
616
652
|
...{
|
|
617
653
|
className: "x78zum5 x6s0dn4 x1txdalj"
|
|
618
654
|
},
|
|
@@ -634,7 +670,11 @@ export function Pagination({
|
|
|
634
670
|
...{
|
|
635
671
|
className: "x78zum5 x1a02dak x6s0dn4 xzye2dw xeuugli"
|
|
636
672
|
},
|
|
637
|
-
|
|
673
|
+
// A key or pointer press can arrive before that task. The click that
|
|
674
|
+
// it starts counts from the current page too.
|
|
675
|
+
onKeyDownCapture: countFromCurrentPage,
|
|
676
|
+
onPointerDownCapture: countFromCurrentPage,
|
|
677
|
+
children: [showFirstLast && /*#__PURE__*/_jsx(PaginationButton, {
|
|
638
678
|
label: firstLabel,
|
|
639
679
|
tooltip: isDisabled || !hasPrevious ? undefined : firstLabel,
|
|
640
680
|
variant: "ghost",
|
|
@@ -644,11 +684,11 @@ export function Pagination({
|
|
|
644
684
|
size: isSm ? 'sm' : 'md',
|
|
645
685
|
xstyle: rtlStyles.mirror
|
|
646
686
|
}),
|
|
647
|
-
|
|
687
|
+
...controlProps(1, hasPrevious),
|
|
648
688
|
isDisabled: isDisabled || !hasPrevious,
|
|
649
689
|
isIconOnly: true,
|
|
650
690
|
xstyle: variant === 'compact' && styles.compactFirst
|
|
651
|
-
}), /*#__PURE__*/_jsx(
|
|
691
|
+
}), /*#__PURE__*/_jsx(PaginationButton, {
|
|
652
692
|
label: previousLabel,
|
|
653
693
|
tooltip: isDisabled || !hasPrevious ? undefined : previousLabel,
|
|
654
694
|
variant: "ghost",
|
|
@@ -658,10 +698,10 @@ export function Pagination({
|
|
|
658
698
|
size: isSm ? 'sm' : 'md',
|
|
659
699
|
xstyle: rtlStyles.mirror
|
|
660
700
|
}),
|
|
661
|
-
|
|
701
|
+
...controlProps(clampPage(linkPage - step), hasPrevious),
|
|
662
702
|
isDisabled: isDisabled || !hasPrevious,
|
|
663
703
|
isIconOnly: true
|
|
664
|
-
}), renderIndicator(), /*#__PURE__*/_jsx(
|
|
704
|
+
}), renderIndicator(), /*#__PURE__*/_jsx(PaginationButton, {
|
|
665
705
|
label: nextLabel,
|
|
666
706
|
tooltip: isDisabled || !hasNext ? undefined : nextLabel,
|
|
667
707
|
variant: "ghost",
|
|
@@ -671,10 +711,10 @@ export function Pagination({
|
|
|
671
711
|
size: isSm ? 'sm' : 'md',
|
|
672
712
|
xstyle: rtlStyles.mirror
|
|
673
713
|
}),
|
|
674
|
-
|
|
714
|
+
...controlProps(clampPage(linkPage + step), hasNext),
|
|
675
715
|
isDisabled: isDisabled || !hasNext,
|
|
676
716
|
isIconOnly: true
|
|
677
|
-
}), showFirstLast && /*#__PURE__*/_jsx(
|
|
717
|
+
}), showFirstLast && /*#__PURE__*/_jsx(PaginationButton, {
|
|
678
718
|
label: lastLabel,
|
|
679
719
|
tooltip: isDisabled || !hasNext ? undefined : lastLabel,
|
|
680
720
|
variant: "ghost",
|
|
@@ -684,7 +724,7 @@ export function Pagination({
|
|
|
684
724
|
size: isSm ? 'sm' : 'md',
|
|
685
725
|
xstyle: rtlStyles.mirror
|
|
686
726
|
}),
|
|
687
|
-
|
|
727
|
+
...controlProps(computedTotalPages ?? optimisticPage, hasNext),
|
|
688
728
|
isDisabled: isDisabled || !hasNext,
|
|
689
729
|
isIconOnly: true,
|
|
690
730
|
xstyle: variant === 'compact' && styles.compactLast
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Selector.d.ts","sourceRoot":"","sources":["../../src/Selector/Selector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;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;AAYpD,OAAO,EAAwB,KAAK,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAqB7E,OAAO,KAAK,EAAC,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAepE,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,g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CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IAC3E,iBAAiB,CAAC,CAAC,CAAC,GAAG;IACrB;;;;;OAKG;IACH,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D,CAAC;AAEJ,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,IACzE,yBAAyB,CAAC,CAAC,CAAC,GAAG,sBAAsB,CAAC,CAAC,CAAC,CAAC;AA+M3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,kBAAkB,EACnD,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,qBAo0CxB;yBAr0Ce,QAAQ"}
|
|
@@ -86,6 +86,12 @@ const MOST_ROWS_THAT_FIT = 12;
|
|
|
86
86
|
|
|
87
87
|
// Private runtime state. No app or theme sets it.
|
|
88
88
|
const OVERLAY_MARGIN_PROPERTY = '--_selector-overlay-margin';
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The trigger's own list is open. A press does not scale the box then, so the
|
|
92
|
+
* list anchors to the box at rest.
|
|
93
|
+
*/
|
|
94
|
+
const LAYER_OPEN = ':has([aria-expanded="true"])';
|
|
89
95
|
const styles = {
|
|
90
96
|
triggerContainer: {
|
|
91
97
|
kVAEAm: "x1n2onr6",
|
|
@@ -134,8 +140,8 @@ const styles = {
|
|
|
134
140
|
kWkggS: "xjbqb8w",
|
|
135
141
|
kGVxlE: "x1gnnqk1 x1s17dad x15ysqaf",
|
|
136
142
|
k63SB2: "x1e4wzip",
|
|
137
|
-
k1ekBW: "xrafxwg",
|
|
138
|
-
k3aq6I: "x3oybdh
|
|
143
|
+
k1ekBW: "xrafxwg xhu4vej",
|
|
144
|
+
k3aq6I: "x3oybdh x1g2qjg4 x182m0z6 x5euuyh",
|
|
139
145
|
$$css: true
|
|
140
146
|
},
|
|
141
147
|
triggerSecondary: {
|
|
@@ -145,8 +151,8 @@ const styles = {
|
|
|
145
151
|
kWkggS: "x17x4s8c",
|
|
146
152
|
kGVxlE: "x1gnnqk1 x1s17dad x15ysqaf",
|
|
147
153
|
k63SB2: "x1e4wzip",
|
|
148
|
-
k1ekBW: "xrafxwg",
|
|
149
|
-
k3aq6I: "x3oybdh
|
|
154
|
+
k1ekBW: "xrafxwg xhu4vej",
|
|
155
|
+
k3aq6I: "x3oybdh x1g2qjg4 x182m0z6 x5euuyh",
|
|
150
156
|
$$css: true
|
|
151
157
|
},
|
|
152
158
|
triggerGhostDisabled: {
|
|
@@ -715,7 +721,7 @@ export function Selector(props) {
|
|
|
715
721
|
|
|
716
722
|
// Open dropdown on mount when isDefaultOpen is true and interaction is allowed.
|
|
717
723
|
useEffect(() => {
|
|
718
|
-
if (isDefaultOpen && !isEffectivelyReadOnly) {
|
|
724
|
+
if (isDefaultOpen && !isDisabled && !isEffectivelyReadOnly) {
|
|
719
725
|
surface.show();
|
|
720
726
|
}
|
|
721
727
|
// eslint-disable-next-line @eslint-react/exhaustive-deps -- mount-only: isDefaultOpen is not reactive
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SwipeLayerProps } from './swipeHost.js';
|
|
2
|
+
/**
|
|
3
|
+
* The swipe half of a row with swipe actions: both panels, rendered into the
|
|
4
|
+
* root the row owns, and the gesture that drives that root.
|
|
5
|
+
*/
|
|
6
|
+
declare function SwipeActionsLayer({ onBridge, leading, trailing, behavior, itemKey, }: SwipeLayerProps): import("react").JSX.Element;
|
|
7
|
+
declare namespace SwipeActionsLayer {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
export default SwipeActionsLayer;
|
|
11
|
+
//# sourceMappingURL=SwipeActionsLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwipeActionsLayer.d.ts","sourceRoot":"","sources":["../../src/Swipe/SwipeActionsLayer.tsx"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAa,eAAe,EAAC,MAAM,aAAa,CAAC;AAyM7D;;;GAGG;AACH,iBAAwB,iBAAiB,CAAC,EACxC,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,GACR,EAAE,eAAe,+BA6KjB;kBAnLuB,iBAAiB;;;eAAjB,iBAAiB"}
|