@astryxdesign/core 0.7.1 → 0.7.2-canary.07f97c6
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 +38 -14
- package/dist/Drawer/Drawer.d.ts +191 -0
- package/dist/Drawer/Drawer.d.ts.map +1 -0
- package/dist/Drawer/Drawer.js +382 -0
- package/dist/Drawer/DrawerHeader.d.ts +85 -0
- package/dist/Drawer/DrawerHeader.d.ts.map +1 -0
- package/dist/Drawer/DrawerHeader.js +134 -0
- package/dist/Drawer/index.d.ts +11 -0
- package/dist/Drawer/index.d.ts.map +1 -0
- package/dist/Drawer/index.js +11 -0
- package/dist/Drawer/useDrawerDialogPresence.d.ts +42 -0
- package/dist/Drawer/useDrawerDialogPresence.d.ts.map +1 -0
- package/dist/Drawer/useDrawerDialogPresence.js +236 -0
- package/dist/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +4 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +10 -2
- package/dist/Layer/layerViewportInset.stylex.d.ts +6 -2
- package/dist/Layer/layerViewportInset.stylex.d.ts.map +1 -1
- package/dist/Layer/layerViewportInset.stylex.js +6 -2
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +13 -7
- package/dist/Layer/useLayerDismissal.d.ts +1 -1
- package/dist/Layer/useLayerDismissal.js +1 -1
- package/dist/Layout/container.stylex.d.ts +5 -5
- package/dist/Layout/container.stylex.js +4 -4
- package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
- package/dist/Markdown/plugins/frontmatter.js +7 -3
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +22 -8
- package/dist/MultiSelector/OptionActions.a11y.chromium.spec.js +100 -2
- package/dist/MultiSelector/hooks.d.ts.map +1 -1
- package/dist/MultiSelector/hooks.js +3 -1
- package/dist/Pagination/Pagination.d.ts +8 -5
- package/dist/Pagination/Pagination.d.ts.map +1 -1
- package/dist/Pagination/Pagination.js +21 -8
- package/dist/Popover/Popover.js +2 -2
- package/dist/PowerSearch/PowerSearch.js +1 -1
- package/dist/Selector/hooks.d.ts.map +1 -1
- package/dist/Selector/hooks.js +6 -2
- package/dist/Switch/Switch.d.ts +1 -1
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +13 -1
- package/dist/TabList/TabMenu.d.ts +2 -2
- package/dist/TabList/TabMenu.d.ts.map +1 -1
- package/dist/TabList/TabMenu.js +6 -3
- package/dist/Text/useTruncation.d.ts +7 -5
- package/dist/Text/useTruncation.d.ts.map +1 -1
- package/dist/Text/useTruncation.js +16 -5
- package/dist/Tooltip/useTooltip.d.ts.map +1 -1
- package/dist/Tooltip/useTooltip.js +11 -0
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +26 -0
- package/dist/astryx.css +21 -10
- package/dist/hooks/useEntryAnimation.d.ts +2 -1
- package/dist/hooks/useEntryAnimation.d.ts.map +1 -1
- package/dist/hooks/useEntryAnimation.js +14 -12
- package/dist/hooks/useIsHydrating.d.ts +6 -0
- package/dist/hooks/useIsHydrating.d.ts.map +1 -0
- package/dist/hooks/useIsHydrating.js +30 -0
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +112 -1
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +112 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +0 -3
- package/dist/utils/focusOutline.stylex.d.ts +4 -0
- package/dist/utils/focusOutline.stylex.d.ts.map +1 -1
- package/dist/utils/focusOutline.stylex.js +4 -0
- package/dist/utils/sharedMutationObserver.d.ts +21 -0
- package/dist/utils/sharedMutationObserver.d.ts.map +1 -0
- package/dist/utils/sharedMutationObserver.js +69 -0
- package/locales/en.json +444 -0
- package/locales/pseudo.json +333 -0
- package/package.json +9 -4
- package/src/Button/Button.doc.mjs +2 -2
- package/src/Button/Button.test.tsx +155 -9
- package/src/Button/Button.tsx +39 -16
- package/src/Button/__tests__/Button.a11y.known-failures.ts +1 -62
- package/src/Button/__tests__/Button.a11y.states.ts +0 -10
- package/src/Drawer/Drawer.doc.mjs +472 -0
- package/src/Drawer/Drawer.spec.md +357 -0
- package/src/Drawer/Drawer.test.tsx +1300 -0
- package/src/Drawer/Drawer.tsx +613 -0
- package/src/Drawer/DrawerDirection.test.tsx +127 -0
- package/src/Drawer/DrawerHeader.doc.mjs +293 -0
- package/src/Drawer/DrawerHeader.test.tsx +102 -0
- package/src/Drawer/DrawerHeader.tsx +235 -0
- package/src/Drawer/__tests__/DrawerAudit.a11y.chromium.spec.ts +401 -0
- package/src/Drawer/__tests__/DrawerHeaderAudit.a11y.chromium.spec.ts +297 -0
- package/src/Drawer/index.ts +13 -0
- package/src/Drawer/useDrawerDialogPresence.ts +284 -0
- package/src/DropdownMenu/DropdownMenu.tsx +2 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +2 -2
- package/src/HoverCard/HoverCard.test.tsx +58 -0
- package/src/HoverCard/useHoverCard.tsx +10 -2
- package/src/IconButton/IconButton.doc.mjs +2 -2
- package/src/IconButton/IconButton.test.tsx +3 -1
- package/src/Layer/layerViewportInset.source-build.test.mjs +90 -0
- package/src/Layer/layerViewportInset.stylex.ts +6 -2
- package/src/Layer/layerViewportInset.test.ts +1 -0
- package/src/Layer/useLayer.tsx +24 -13
- package/src/Layer/useLayerDismissal.ts +1 -1
- package/src/Layout/container.stylex.ts +6 -6
- package/src/List/ListItem.doc.mjs +8 -5
- package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
- package/src/Markdown/plugins/frontmatter.ts +7 -3
- package/src/MultiSelector/MultiSelector.test.tsx +159 -0
- package/src/MultiSelector/MultiSelector.tsx +40 -7
- package/src/MultiSelector/OptionActions.a11y.chromium.spec.ts +112 -2
- package/src/MultiSelector/hooks.ts +3 -1
- package/src/MultiSelector/useMultiCombobox.doc.mjs +267 -0
- package/src/Pagination/Pagination.doc.mjs +7 -7
- package/src/Pagination/Pagination.spec.md +9 -9
- package/src/Pagination/Pagination.test.tsx +242 -0
- package/src/Pagination/Pagination.tsx +27 -11
- package/src/Popover/Popover.test.tsx +2 -2
- package/src/Popover/Popover.tsx +4 -4
- package/src/PowerSearch/PowerSearch.test.tsx +85 -0
- package/src/PowerSearch/PowerSearch.tsx +2 -2
- package/src/Selector/hooks.ts +6 -2
- package/src/Selector/useCombobox.doc.mjs +237 -0
- package/src/Switch/Switch.test.tsx +49 -0
- package/src/Switch/Switch.tsx +11 -0
- package/src/TabList/TabList.test.tsx +67 -0
- package/src/TabList/TabMenu.doc.mjs +4 -3
- package/src/TabList/TabMenu.tsx +7 -4
- package/src/Text/useTruncation.test.tsx +69 -0
- package/src/Text/useTruncation.ts +16 -5
- package/src/Tokenizer/Tokenizer.test.tsx +54 -1
- package/src/Tooltip/Tooltip.test.tsx +31 -0
- package/src/Tooltip/useTooltip.test.tsx +13 -0
- package/src/Tooltip/useTooltip.tsx +11 -0
- package/src/Typeahead/BaseTypeahead.tsx +26 -0
- package/src/Typeahead/Typeahead.test.tsx +260 -2
- package/src/hooks/useEntryAnimation.doc.mjs +4 -4
- package/src/hooks/useEntryAnimation.ssr.test.tsx +143 -0
- package/src/hooks/useEntryAnimation.ts +15 -16
- package/src/hooks/useIsHydrating.test.tsx +70 -0
- package/src/hooks/useIsHydrating.ts +31 -0
- package/src/i18n/InternationalizationProvider.doc.mjs +8 -0
- package/src/i18n/InternationalizationProvider.spec.md +252 -0
- package/src/i18n/__tests__/InternationalizationProvider.test.tsx +128 -0
- package/src/i18n/generated-locales/en.generated.ts +121 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +121 -0
- package/src/i18n/useTranslator.test.tsx +37 -0
- package/src/index.ts +1 -0
- package/src/theme/derivedVarRegistry.test.ts +0 -3
- package/src/theme/derivedVarRegistry.ts +0 -3
- package/src/utils/focusOutline.stylex.ts +4 -0
- package/src/utils/sharedMutationObserver.test.ts +53 -0
- package/src/utils/sharedMutationObserver.ts +78 -0
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* built Storybook.
|
|
7
7
|
* @output Real-engine proof for option actions: the action is visible at rest
|
|
8
8
|
* beside its row (`spec:AST-058` FR8), the keyboard reaches it through the
|
|
9
|
-
* inline-end arrow in both directions and fires it with Enter,
|
|
10
|
-
*
|
|
9
|
+
* inline-end arrow in both directions and fires it with Enter, the active
|
|
10
|
+
* action cell draws the standard focus ring when the shared input modality
|
|
11
|
+
* is keyboard and not after pointer input, and the highlight follows a real
|
|
12
|
+
* mouse across rows and actions.
|
|
11
13
|
* @position Run with `pnpm test:a11y-contract`; paint, pointer paths and the
|
|
12
14
|
* active descendant as an engine exposes them are not jsdom claims.
|
|
13
15
|
*/
|
|
@@ -105,6 +107,102 @@ test('the keyboard reaches an action through the inline-end arrow and fires it w
|
|
|
105
107
|
await search.press('ArrowLeft');
|
|
106
108
|
await expect.poll(async () => activeDescendant(page)).toBe('row:Bug');
|
|
107
109
|
});
|
|
110
|
+
test('the active action cell draws the standard focus ring', async ({
|
|
111
|
+
page
|
|
112
|
+
}) => {
|
|
113
|
+
await page.goto(`${storybook.origin}/iframe.html?id=core-multiselector--row-actions&viewMode=story`);
|
|
114
|
+
const search = page.getByRole('combobox');
|
|
115
|
+
await expect(search).toBeFocused();
|
|
116
|
+
await search.press('ArrowDown'); // select-all
|
|
117
|
+
await search.press('ArrowDown'); // Feature (no action)
|
|
118
|
+
await search.press('ArrowDown'); // Bug
|
|
119
|
+
await search.press('ArrowRight');
|
|
120
|
+
await expect.poll(async () => activeDescendant(page)).toBe('gridcell:Edit Bug');
|
|
121
|
+
const ring = await page.evaluate(() => {
|
|
122
|
+
const id = document.activeElement?.getAttribute('aria-activedescendant');
|
|
123
|
+
const cell = id ? document.getElementById(id) : null;
|
|
124
|
+
if (!cell) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const cs = getComputedStyle(cell);
|
|
128
|
+
// The ring the focus tokens describe, resolved by the browser on a probe.
|
|
129
|
+
const probe = document.createElement('div');
|
|
130
|
+
probe.style.cssText = 'outline-width:var(--focus-outline-width);outline-style:var(--focus-outline-style);outline-color:var(--focus-outline-color);outline-offset:var(--focus-outline-offset)';
|
|
131
|
+
document.body.appendChild(probe);
|
|
132
|
+
const want = getComputedStyle(probe);
|
|
133
|
+
const result = {
|
|
134
|
+
style: cs.outlineStyle,
|
|
135
|
+
width: cs.outlineWidth,
|
|
136
|
+
color: cs.outlineColor,
|
|
137
|
+
offset: cs.outlineOffset,
|
|
138
|
+
wantStyle: want.outlineStyle,
|
|
139
|
+
wantWidth: want.outlineWidth,
|
|
140
|
+
wantColor: want.outlineColor,
|
|
141
|
+
wantOffset: want.outlineOffset
|
|
142
|
+
};
|
|
143
|
+
probe.remove();
|
|
144
|
+
return result;
|
|
145
|
+
});
|
|
146
|
+
expect(ring).not.toBeNull();
|
|
147
|
+
expect(ring.style).not.toBe('none');
|
|
148
|
+
expect(ring.width).not.toBe('0px');
|
|
149
|
+
expect(ring.style).toBe(ring.wantStyle);
|
|
150
|
+
expect(ring.width).toBe(ring.wantWidth);
|
|
151
|
+
expect(ring.color).toBe(ring.wantColor);
|
|
152
|
+
expect(ring.offset).toBe(ring.wantOffset);
|
|
153
|
+
// Back on the option cell, the action cell drops the ring.
|
|
154
|
+
await search.press('ArrowLeft');
|
|
155
|
+
await expect.poll(async () => activeDescendant(page)).toBe('row:Bug');
|
|
156
|
+
const after = await page.getByRole('row', {
|
|
157
|
+
name: 'Bug'
|
|
158
|
+
}).locator('[data-multi-selector-action-cell]').evaluate(cell => getComputedStyle(cell).outlineStyle);
|
|
159
|
+
expect(after).toBe('none');
|
|
160
|
+
});
|
|
161
|
+
test('the action-cell ring follows the shared input modality', async ({
|
|
162
|
+
page
|
|
163
|
+
}) => {
|
|
164
|
+
await page.goto(`${storybook.origin}/iframe.html?id=core-multiselector--row-actions&viewMode=story`);
|
|
165
|
+
const search = page.getByRole('combobox');
|
|
166
|
+
await expect(search).toBeFocused();
|
|
167
|
+
const actionCell = name => page.getByRole('row', {
|
|
168
|
+
name
|
|
169
|
+
}).locator('[data-multi-selector-action-cell]');
|
|
170
|
+
const outlineStyle = async name => actionCell(name).evaluate(cell => getComputedStyle(cell).outlineStyle);
|
|
171
|
+
const hover = async name => {
|
|
172
|
+
const cell = await box(actionCell(name));
|
|
173
|
+
await page.mouse.move(cell.x + cell.width / 2, cell.y + cell.height / 2, {
|
|
174
|
+
steps: 6
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// Pointer input: a click into the search field, then a hover onto an
|
|
179
|
+
// action, moves the highlight without the ring, and leaves none behind.
|
|
180
|
+
await search.click();
|
|
181
|
+
await hover('Bug');
|
|
182
|
+
await expect.poll(async () => activeDescendant(page)).toBe('gridcell:Edit Bug');
|
|
183
|
+
expect(await outlineStyle('Bug')).toBe('none');
|
|
184
|
+
// A modifier chord is not keyboard navigation for the shared tracker.
|
|
185
|
+
await search.press('Control+ArrowRight');
|
|
186
|
+
expect(await outlineStyle('Bug')).toBe('none');
|
|
187
|
+
await page.mouse.move(1, 1, {
|
|
188
|
+
steps: 6
|
|
189
|
+
});
|
|
190
|
+
expect(await outlineStyle('Bug')).toBe('none');
|
|
191
|
+
|
|
192
|
+
// Keyboard input: back onto the same cell, the ring is drawn.
|
|
193
|
+
await search.press('ArrowLeft');
|
|
194
|
+
await expect.poll(async () => activeDescendant(page)).toBe('row:Bug');
|
|
195
|
+
await search.press('ArrowRight');
|
|
196
|
+
await expect.poll(async () => activeDescendant(page)).toBe('gridcell:Edit Bug');
|
|
197
|
+
expect(await outlineStyle('Bug')).not.toBe('none');
|
|
198
|
+
|
|
199
|
+
// Still keyboard-driven, a hover that moves the highlight to another
|
|
200
|
+
// row's action carries the ring with it.
|
|
201
|
+
await hover('P0');
|
|
202
|
+
await expect.poll(async () => activeDescendant(page)).toBe('gridcell:Edit P0');
|
|
203
|
+
expect(await outlineStyle('P0')).not.toBe('none');
|
|
204
|
+
expect(await outlineStyle('Bug')).toBe('none');
|
|
205
|
+
});
|
|
108
206
|
test('under RTL the inline-end arrow is ArrowLeft', async ({
|
|
109
207
|
page
|
|
110
208
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/hooks.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAErD,UAAU,uBAAuB;IAC/B,eAAe,EAAE,uBAAuB,EAAE,CAAC;IAC3C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,6DAA6D;AAC7D,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpD,UAAU,sBAAsB;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,4EAA4E;IAC5E,eAAe,EAAE,iBAAiB,CAAC;IACnC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,iFAAiF;IACjF,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC3C,+DAA+D;IAC/D,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IAC5C,gBAAgB,EAAE,CAChB,IAAI,EAAE,uBAAuB,EAC7B,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,iBAAiB,KACrB,IAAI,CAAC;CACX;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,eAAe,EACf,UAAkB,EAClB,MAAM,EACN,SAAiB,EACjB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAgB,EAChB,SAAS,EACT,MAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,EAAE,uBAAuB,GAAG,sBAAsB,CAwSlD"}
|
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
* @file hooks.ts
|
|
7
7
|
* @input Uses React hooks, MultiSelectorOptionData type
|
|
8
8
|
* @output Exports useMultiCombobox hook
|
|
9
|
-
* @position
|
|
9
|
+
* @position Public hook, exported from the MultiSelector entry point; used by
|
|
10
|
+
* MultiSelector.tsx
|
|
10
11
|
*
|
|
11
12
|
* SYNC: When modified, update:
|
|
12
13
|
* - /packages/core/src/MultiSelector/index.ts
|
|
14
|
+
* - /packages/core/src/MultiSelector/useMultiCombobox.doc.mjs
|
|
13
15
|
*/
|
|
14
16
|
import { useCallback, useRef, useState } from 'react';
|
|
15
17
|
import { isRtlElement } from "../hooks/isRtlElement.js";
|
|
@@ -42,7 +42,8 @@ export interface PaginationProps extends Omit<BaseProps<HTMLElement>, 'onChange'
|
|
|
42
42
|
* Visual variant controlling what appears between prev/next buttons.
|
|
43
43
|
* - pages: Page number buttons with ellipsis (default)
|
|
44
44
|
* - count: "X–Y of Z" text
|
|
45
|
-
* - compact: "Page X of Y" text
|
|
45
|
+
* - compact: "Page X of Y" text. First/last buttons are opt-in (see
|
|
46
|
+
* hasFirstLast).
|
|
46
47
|
* - dots: Dot indicators
|
|
47
48
|
* - input: An editable number box rendering "Page [ n ] / N". The leading
|
|
48
49
|
* noun is controlled by `pageLabel`. First/last double-chevron buttons
|
|
@@ -59,9 +60,11 @@ export interface PaginationProps extends Omit<BaseProps<HTMLElement>, 'onChange'
|
|
|
59
60
|
pageLabel?: string;
|
|
60
61
|
/**
|
|
61
62
|
* Whether to show first/last («/») double-chevron buttons flanking
|
|
62
|
-
* prev/next.
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* prev/next. Applies to the `input` variant (shown unless false) and the
|
|
64
|
+
* `compact` variant (shown only when true); other variants ignore it.
|
|
65
|
+
* The last button needs a known total — both are omitted when the page count
|
|
66
|
+
* is unknown (cursor/hasMore pagination).
|
|
67
|
+
* @default true for `input`, false for `compact`
|
|
65
68
|
*/
|
|
66
69
|
hasFirstLast?: boolean;
|
|
67
70
|
/**
|
|
@@ -121,7 +124,7 @@ export declare function generatePageRange(currentPage: number, totalPages: numbe
|
|
|
121
124
|
* />
|
|
122
125
|
* ```
|
|
123
126
|
*/
|
|
124
|
-
export declare function Pagination({ page, onChange, changeAction, totalItems, totalPages: totalPagesProp, hasMore, pageSize: pageSizeProp, pageSizeOptions, onPageSizeChange, variant, pageLabel, hasFirstLast, step: stepProp, siblingCount, size, isDisabled, label: labelFromProps, 'data-testid': testId, xstyle, className, style, ref, ...rest }: PaginationProps): import("react").JSX.Element | null;
|
|
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;
|
|
125
128
|
export declare namespace Pagination {
|
|
126
129
|
var displayName: string;
|
|
127
130
|
}
|
|
@@ -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":"AA4CA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAMlD;;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,oCAAoC;IACpC,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,C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,gBAAgB,EAC9B,IAAI,EAAE,QAAY,EAClB,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,sCAwfjB;yBAhhBe,UAAU"}
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file Pagination.tsx
|
|
7
7
|
* @input Uses React, StyleX, Button, Icon, Selector, Text; page number buttons delegate to Button.
|
|
8
|
+
* Compact first/last buttons cancel the inside control gap with logical token margins.
|
|
8
9
|
* Prev/next and first/last chevrons mirror under RTL via the shared rtlStyles.mirror
|
|
9
|
-
* (CSS scaleX), not a JS direction read. The input
|
|
10
|
-
* (first/last) icons.
|
|
10
|
+
* (CSS scaleX), not a JS direction read. The input and compact variants use the
|
|
11
|
+
* chevronsLeft/chevronsRight (first/last) icons.
|
|
11
12
|
* @output Exports Pagination component, PaginationProps, PaginationVariant, PaginationSize types
|
|
12
13
|
* @position Core implementation; consumed by index.ts, tested by Pagination.test.tsx
|
|
13
14
|
*
|
|
@@ -61,6 +62,14 @@ const styles = {
|
|
|
61
62
|
kOIVth: "x18g69wz",
|
|
62
63
|
$$css: true
|
|
63
64
|
},
|
|
65
|
+
compactFirst: {
|
|
66
|
+
k71WvV: "xkd40ry",
|
|
67
|
+
$$css: true
|
|
68
|
+
},
|
|
69
|
+
compactLast: {
|
|
70
|
+
keTefX: "x547jwd",
|
|
71
|
+
$$css: true
|
|
72
|
+
},
|
|
64
73
|
dot: {
|
|
65
74
|
kzqmXN: "x1f0dxl5",
|
|
66
75
|
kZKoxP: "xoqw5ej",
|
|
@@ -188,7 +197,7 @@ export function Pagination({
|
|
|
188
197
|
onPageSizeChange,
|
|
189
198
|
variant = 'pages',
|
|
190
199
|
pageLabel,
|
|
191
|
-
hasFirstLast
|
|
200
|
+
hasFirstLast: hasFirstLastProp,
|
|
192
201
|
step: stepProp = 1,
|
|
193
202
|
siblingCount = 1,
|
|
194
203
|
size = 'md',
|
|
@@ -363,9 +372,11 @@ export function Pagination({
|
|
|
363
372
|
const buttonSize = size === 'sm' ? 'sm' : 'md';
|
|
364
373
|
const isSm = size === 'sm';
|
|
365
374
|
|
|
366
|
-
// First/last buttons
|
|
367
|
-
//
|
|
368
|
-
|
|
375
|
+
// First/last buttons are on by default in the input variant and opt-in for
|
|
376
|
+
// compact; other variants never render them. They also need a known page
|
|
377
|
+
// count (the last button would have no target otherwise).
|
|
378
|
+
const hasFirstLast = variant === 'input' ? hasFirstLastProp ?? true : variant === 'compact' && hasFirstLastProp === true;
|
|
379
|
+
const showFirstLast = hasFirstLast && computedTotalPages != null;
|
|
369
380
|
const renderIndicator = () => {
|
|
370
381
|
switch (variant) {
|
|
371
382
|
case 'pages':
|
|
@@ -600,7 +611,8 @@ export function Pagination({
|
|
|
600
611
|
}),
|
|
601
612
|
onClick: handleFirst,
|
|
602
613
|
isDisabled: isDisabled || !hasPrevious,
|
|
603
|
-
isIconOnly: true
|
|
614
|
+
isIconOnly: true,
|
|
615
|
+
xstyle: variant === 'compact' && styles.compactFirst
|
|
604
616
|
}), /*#__PURE__*/_jsx(Button, {
|
|
605
617
|
label: previousLabel,
|
|
606
618
|
tooltip: isDisabled || !hasPrevious ? undefined : previousLabel,
|
|
@@ -639,7 +651,8 @@ export function Pagination({
|
|
|
639
651
|
}),
|
|
640
652
|
onClick: handleLast,
|
|
641
653
|
isDisabled: isDisabled || !hasNext,
|
|
642
|
-
isIconOnly: true
|
|
654
|
+
isIconOnly: true,
|
|
655
|
+
xstyle: variant === 'compact' && styles.compactLast
|
|
643
656
|
})]
|
|
644
657
|
})]
|
|
645
658
|
});
|
package/dist/Popover/Popover.js
CHANGED
|
@@ -532,7 +532,7 @@ export function PowerSearch({
|
|
|
532
532
|
} else if (change.type === 'remove' && change.item) {
|
|
533
533
|
const auxData = change.item.auxiliaryData;
|
|
534
534
|
if (auxData?.filterIndex != null) {
|
|
535
|
-
const newFilters = filters.filter((_, i) =>
|
|
535
|
+
const newFilters = filters.filter((_, i) => _items.some(item => item.auxiliaryData?.filterIndex === i));
|
|
536
536
|
onChange(newFilters, 'remove', auxData.filterIndex);
|
|
537
537
|
}
|
|
538
538
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/Selector/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/Selector/hooks.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAyBhD,UAAU,4BAA4B;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC7C,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CAC1C;AAED,UAAU,2BAA2B;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,SAAS,GACV,EAAE,4BAA4B,GAAG,2BAA2B,CAgF5D;AAMD,UAAU,kBAAkB;IAC1B,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,UAAU,iBAAiB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACrC,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACjD,gBAAgB,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACrE;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,eAAe,EACf,KAAK,EACL,UAAkB,EAClB,MAAM,EACN,SAAiB,EACjB,MAAM,EACN,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,GACV,EAAE,kBAAkB,GAAG,iBAAiB,CAqOxC"}
|
package/dist/Selector/hooks.js
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* @file hooks.ts
|
|
7
7
|
* @input Uses untransformed DOM layout geometry from the Selector's outer
|
|
8
8
|
* anchor, listbox, and selected option
|
|
9
|
-
* @output Hooks for Selector
|
|
10
|
-
*
|
|
9
|
+
* @output Hooks for Selector: useSelectedItemOffset, and useCombobox (public,
|
|
10
|
+
* exported from the Selector entry point; also used by CommandPalette)
|
|
11
|
+
* @position Selector hooks; used by Selector.tsx and CommandPalette
|
|
12
|
+
*
|
|
13
|
+
* SYNC: When useCombobox's options or return change, update:
|
|
14
|
+
* - /packages/core/src/Selector/useCombobox.doc.mjs
|
|
11
15
|
*/
|
|
12
16
|
import { useCallback, useState } from 'react';
|
|
13
17
|
import { useHighlightedOptionScroll } from "../hooks/useHighlightedOptionScroll.js";
|
package/dist/Switch/Switch.d.ts
CHANGED
|
@@ -159,7 +159,7 @@ export interface SwitchProps extends Omit<BaseProps, 'onChange'> {
|
|
|
159
159
|
* />
|
|
160
160
|
* ```
|
|
161
161
|
*/
|
|
162
|
-
export declare function Switch({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, htmlName, disabledMessage, isOptional, isRequired, onFocus, onBlur, labelIcon, labelTooltip, labelPosition, labelSpacing, status, size, width, xstyle, className, style, ref, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
162
|
+
export declare function Switch({ label, isLabelHidden, description, onChange, changeAction, isLoading, value, isDisabled, htmlName, disabledMessage, isOptional, isRequired, onFocus, onBlur, labelIcon, labelTooltip, labelPosition, labelSpacing, status, size, width, xstyle, className, style, ref, 'aria-describedby': ariaDescribedByProp, 'aria-labelledby': ariaLabelledByProp, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
163
163
|
export declare namespace Switch {
|
|
164
164
|
var displayName: string;
|
|
165
165
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/Switch/Switch.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAcf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAMhD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,E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,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,OAAO,EACP,MAAM,EACN,SAAS,EACT,YAAY,EACZ,aAAqB,EACrB,YAAoB,EACpB,MAAM,EACN,IAAW,EACX,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,kBAAkB,EAAE,mBAAmB,EACvC,iBAAiB,EAAE,kBAAkB,EACrC,GAAG,IAAI,EACR,EAAE,WAAW,+BAiOb;yBA9Pe,MAAM"}
|
package/dist/Switch/Switch.js
CHANGED
|
@@ -291,6 +291,8 @@ export function Switch({
|
|
|
291
291
|
className,
|
|
292
292
|
style,
|
|
293
293
|
ref,
|
|
294
|
+
'aria-describedby': ariaDescribedByProp,
|
|
295
|
+
'aria-labelledby': ariaLabelledByProp,
|
|
294
296
|
...rest
|
|
295
297
|
}) {
|
|
296
298
|
const t = useTranslator();
|
|
@@ -335,7 +337,12 @@ export function Switch({
|
|
|
335
337
|
// Only include descriptionID when the element actually renders.
|
|
336
338
|
// FieldLabel renders the description (with descriptionID) even when the
|
|
337
339
|
// label is visually hidden — it's sr-only, so keep it linked.
|
|
340
|
+
// A consumer's own `aria-describedby` describes the control, so it comes
|
|
341
|
+
// first here rather than landing on the field wrapper via `...rest`.
|
|
338
342
|
const describedByParts = [];
|
|
343
|
+
if (ariaDescribedByProp) {
|
|
344
|
+
describedByParts.push(ariaDescribedByProp);
|
|
345
|
+
}
|
|
339
346
|
if (description) {
|
|
340
347
|
describedByParts.push(descriptionID);
|
|
341
348
|
}
|
|
@@ -382,7 +389,12 @@ export function Switch({
|
|
|
382
389
|
}
|
|
383
390
|
},
|
|
384
391
|
onFocus: onFocus,
|
|
385
|
-
onBlur: onBlur
|
|
392
|
+
onBlur: onBlur
|
|
393
|
+
// A caller's `aria-labelledby` names the control (a visible title
|
|
394
|
+
// elsewhere in the row, for example), so it reaches the input rather
|
|
395
|
+
// than the field wrapper via `...rest`.
|
|
396
|
+
,
|
|
397
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
386
398
|
"aria-describedby": ariaDescribedBy,
|
|
387
399
|
"aria-invalid": status?.type === 'error' ? true : undefined,
|
|
388
400
|
"aria-busy": isBusy || undefined,
|
|
@@ -22,7 +22,7 @@ export interface TabMenuOption {
|
|
|
22
22
|
*/
|
|
23
23
|
icon?: ReactNode | IconType;
|
|
24
24
|
}
|
|
25
|
-
export interface TabMenuProps extends
|
|
25
|
+
export interface TabMenuProps extends Omit<BaseProps<HTMLButtonElement>, 'role' | 'tabIndex' | 'aria-haspopup' | 'aria-expanded' | 'aria-controls'> {
|
|
26
26
|
ref?: React.Ref<HTMLButtonElement>;
|
|
27
27
|
/**
|
|
28
28
|
* Label for the trigger button and dropdown heading.
|
|
@@ -50,7 +50,7 @@ export interface TabMenuProps extends Pick<BaseProps<HTMLButtonElement>, 'xstyle
|
|
|
50
50
|
* </TabList>
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
export declare function TabMenu({ ref, label, options, xstyle, className, style, }: TabMenuProps): React.JSX.Element;
|
|
53
|
+
export declare function TabMenu({ ref, label, options, xstyle, className, style, onClick, ...rest }: TabMenuProps): React.JSX.Element;
|
|
54
54
|
export declare namespace TabMenu {
|
|
55
55
|
var displayName: string;
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabMenu.d.ts","sourceRoot":"","sources":["../../src/TabList/TabMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAA6B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGxE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAoBtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,CAAC,iBAAiB,CAAC,EAC5B,
|
|
1
|
+
{"version":3,"file":"TabMenu.d.ts","sourceRoot":"","sources":["../../src/TabList/TabMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EAA6B,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGxE,OAAO,EAAiB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAoBtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC7B;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CACxC,SAAS,CAAC,iBAAiB,CAAC,EAC5B,MAAM,GAAG,UAAU,GAAG,eAAe,GAAG,eAAe,GAAG,eAAe,CAC1E;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AA+KD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,EACtB,GAAG,EACH,KAAK,EACL,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EACP,GAAG,IAAI,EACR,EAAE,YAAY,qBA6Ld;yBAtMe,OAAO"}
|
package/dist/TabList/TabMenu.js
CHANGED
|
@@ -28,7 +28,7 @@ import { useListFocus } from "../hooks/useListFocus.js";
|
|
|
28
28
|
import { useTabListContext } from "./TabListContext.js";
|
|
29
29
|
import "./tab.markers.stylex.js";
|
|
30
30
|
import { tabScope } from "./tab.markers.stylex.js";
|
|
31
|
-
import { mergeProps } from "../utils/index.js";
|
|
31
|
+
import { composeEventHandlers, mergeProps } from "../utils/index.js";
|
|
32
32
|
import { useMergedRefs } from "../hooks/useMergedRefs.js";
|
|
33
33
|
import { themeProps } from "../utils/themeProps.js";
|
|
34
34
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -166,7 +166,9 @@ export function TabMenu({
|
|
|
166
166
|
options,
|
|
167
167
|
xstyle,
|
|
168
168
|
className,
|
|
169
|
-
style
|
|
169
|
+
style,
|
|
170
|
+
onClick,
|
|
171
|
+
...rest
|
|
170
172
|
}) {
|
|
171
173
|
const tabListCtx = useTabListContext();
|
|
172
174
|
const menuId = useId();
|
|
@@ -231,6 +233,7 @@ export function TabMenu({
|
|
|
231
233
|
const setButtonRef = useMergedRefs(popover.triggerRef, buttonRef, ref);
|
|
232
234
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
233
235
|
children: [/*#__PURE__*/_jsxs("button", {
|
|
236
|
+
...rest,
|
|
234
237
|
ref: setButtonRef,
|
|
235
238
|
type: "button",
|
|
236
239
|
"aria-haspopup": "menu",
|
|
@@ -238,7 +241,7 @@ export function TabMenu({
|
|
|
238
241
|
"aria-controls": menuId,
|
|
239
242
|
"data-tab-menu": "",
|
|
240
243
|
tabIndex: hasSelectedOption ? 0 : -1,
|
|
241
|
-
onClick: handleToggle,
|
|
244
|
+
onClick: composeEventHandlers(handleToggle, onClick),
|
|
242
245
|
...mergeProps(themeProps('tab-menu'), focusOutlineProps.focusVisible(styles.trigger, sizeStyles[size], hasSelectedOption && styles.triggerSelected, tabScope, xstyle), className, style),
|
|
243
246
|
children: [/*#__PURE__*/_jsx("span", {
|
|
244
247
|
"aria-hidden": "true",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file useTruncation.ts
|
|
3
|
-
* @input Uses React hooks, sharedResizeObserver
|
|
3
|
+
* @input Uses React hooks, sharedResizeObserver, sharedMutationObserver
|
|
4
4
|
* @output Exports useTruncation hook for detecting text overflow
|
|
5
5
|
* @position Hook; consumed by Text.tsx, Heading.tsx
|
|
6
6
|
*
|
|
@@ -32,10 +32,12 @@ export interface UseTruncationReturn {
|
|
|
32
32
|
/**
|
|
33
33
|
* Hook for detecting text overflow/truncation.
|
|
34
34
|
*
|
|
35
|
-
* Uses a shared ResizeObserver singleton (via observeResize)
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
35
|
+
* Uses a shared ResizeObserver singleton (via observeResize) for size
|
|
36
|
+
* changes and a shared MutationObserver singleton (via observeContent) for
|
|
37
|
+
* content changes, so even hundreds of table cells create one observer of
|
|
38
|
+
* each kind. Observing content matters because an element whose text changes
|
|
39
|
+
* without resizing (a fixed-width status line) must still be re-measured for
|
|
40
|
+
* the tooltip text and the truncated state to follow the current content.
|
|
39
41
|
*
|
|
40
42
|
* - Single-line: compares scrollWidth > offsetWidth
|
|
41
43
|
* - Multi-line: uses Range.getBoundingClientRect() to measure actual content
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTruncation.d.ts","sourceRoot":"","sources":["../../src/Text/useTruncation.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAgC,KAAK,WAAW,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useTruncation.d.ts","sourceRoot":"","sources":["../../src/Text/useTruncation.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,OAAO,EAAgC,KAAK,WAAW,EAAC,MAAM,OAAO,CAAC;AAItE,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IAE9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,oBAAoB,GAC5B,mBAAmB,CAmFrB"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @file useTruncation.ts
|
|
7
|
-
* @input Uses React hooks, sharedResizeObserver
|
|
7
|
+
* @input Uses React hooks, sharedResizeObserver, sharedMutationObserver
|
|
8
8
|
* @output Exports useTruncation hook for detecting text overflow
|
|
9
9
|
* @position Hook; consumed by Text.tsx, Heading.tsx
|
|
10
10
|
*
|
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { useCallback, useRef, useState } from 'react';
|
|
15
15
|
import { observeResize } from "../utils/sharedResizeObserver.js";
|
|
16
|
+
import { observeContent } from "../utils/sharedMutationObserver.js";
|
|
16
17
|
/**
|
|
17
18
|
* Hook for detecting text overflow/truncation.
|
|
18
19
|
*
|
|
19
|
-
* Uses a shared ResizeObserver singleton (via observeResize)
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Uses a shared ResizeObserver singleton (via observeResize) for size
|
|
21
|
+
* changes and a shared MutationObserver singleton (via observeContent) for
|
|
22
|
+
* content changes, so even hundreds of table cells create one observer of
|
|
23
|
+
* each kind. Observing content matters because an element whose text changes
|
|
24
|
+
* without resizing (a fixed-width status line) must still be re-measured for
|
|
25
|
+
* the tooltip text and the truncated state to follow the current content.
|
|
23
26
|
*
|
|
24
27
|
* - Single-line: compares scrollWidth > offsetWidth
|
|
25
28
|
* - Multi-line: uses Range.getBoundingClientRect() to measure actual content
|
|
@@ -44,6 +47,7 @@ export function useTruncation(options) {
|
|
|
44
47
|
const [fullText, setFullText] = useState('');
|
|
45
48
|
const elementRef = useRef(null);
|
|
46
49
|
const unobserveRef = useRef(null);
|
|
50
|
+
const unobserveContentRef = useRef(null);
|
|
47
51
|
const checkTruncation = useCallback(element => {
|
|
48
52
|
if (maxLines === 0) {
|
|
49
53
|
setIsTruncated(false);
|
|
@@ -80,6 +84,8 @@ export function useTruncation(options) {
|
|
|
80
84
|
// by element leaves any other observer of the same node untouched.
|
|
81
85
|
unobserveRef.current?.();
|
|
82
86
|
unobserveRef.current = null;
|
|
87
|
+
unobserveContentRef.current?.();
|
|
88
|
+
unobserveContentRef.current = null;
|
|
83
89
|
elementRef.current = element;
|
|
84
90
|
if (element && maxLines > 0) {
|
|
85
91
|
// Observe via shared singleton (if available).
|
|
@@ -92,6 +98,11 @@ export function useTruncation(options) {
|
|
|
92
98
|
} else {
|
|
93
99
|
checkTruncation(element);
|
|
94
100
|
}
|
|
101
|
+
// New text in a box that keeps its size fires no resize, so the
|
|
102
|
+
// captured text and truncated state would otherwise stay stale.
|
|
103
|
+
unobserveContentRef.current = observeContent(element, () => {
|
|
104
|
+
checkTruncation(element);
|
|
105
|
+
});
|
|
95
106
|
} else {
|
|
96
107
|
setIsTruncated(false);
|
|
97
108
|
setFullText('');
|
|
@@ -1 +1 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AY,CAAC,EAAE,mBAAmB,CAAC;IAEnC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;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,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IACH,aAAa,EAAE,CACb,QAAQ,EAAE,SAAS,EACnB,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,KAC5C,SAAS,CAAC;CAChB;AAyBD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CAwXtE"}
|
|
@@ -177,6 +177,17 @@ export function useTooltip(options = {}) {
|
|
|
177
177
|
}, delay);
|
|
178
178
|
}, [isEnabled, isOpen, clearTimeouts, showLayer, delay]);
|
|
179
179
|
|
|
180
|
+
// A show scheduled while the triggers were enabled must not outlive them:
|
|
181
|
+
// disabling also detaches the leave listener that would have cancelled it,
|
|
182
|
+
// so the timer would open a tooltip that nothing ever closes. Only the
|
|
183
|
+
// pending show is dropped; a pending hide still runs.
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (!isEnabled && showTimeoutRef.current) {
|
|
186
|
+
clearTimeout(showTimeoutRef.current);
|
|
187
|
+
showTimeoutRef.current = null;
|
|
188
|
+
}
|
|
189
|
+
}, [isEnabled]);
|
|
190
|
+
|
|
180
191
|
// Schedule hide with delay (suppressed when isOpen is true).
|
|
181
192
|
// A small hover bridge (when hideDelay is 0) lets the pointer travel from the
|
|
182
193
|
// trigger onto the tooltip surface without the tooltip vanishing — required
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseTypeahead.d.ts","sourceRoot":"","sources":["../../src/Typeahead/BaseTypeahead.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAMZ,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AA2BnD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAW1D,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,IAAI,CACxE,SAAS,CAAC,WAAW,CAAC,EACtB,UAAU,CACX;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAE9B;;OAEG;IACH,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAEnC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC;IAEpC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,YA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-340,6 +340,32 @@ export const BaseTypeahead = function BaseTypeahead({
|
|
|
340
340
|
sourceGenRef.current = ++searchGenRef.current;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
// The previous source is remembered in state, not a ref, so a render React
|
|
344
|
+
// discards cannot consume the comparison without its state updates.
|
|
345
|
+
const [sourceOfState, setSourceOfState] = useState(searchSource);
|
|
346
|
+
if (sourceOfState !== searchSource) {
|
|
347
|
+
setSourceOfState(searchSource);
|
|
348
|
+
if (isLoading) {
|
|
349
|
+
setIsLoading(false);
|
|
350
|
+
setHasSearched(false);
|
|
351
|
+
}
|
|
352
|
+
loadingRef.current = false;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// When the search source is replaced, any in-flight load from the previous
|
|
356
|
+
// source is abandoned (generation bumped above). Notify the wrapper's busy lane
|
|
357
|
+
// in an effect so external store listeners run safely after commit.
|
|
358
|
+
const isInitialMountRef = useRef(true);
|
|
359
|
+
useEffect(() => {
|
|
360
|
+
if (isInitialMountRef.current) {
|
|
361
|
+
isInitialMountRef.current = false;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (!loadingRef.current) {
|
|
365
|
+
onLoadingChangeRef.current?.(false);
|
|
366
|
+
}
|
|
367
|
+
}, [searchSource]);
|
|
368
|
+
|
|
343
369
|
// Layer for dropdown
|
|
344
370
|
const handleLayerShow = useCallback(() => {
|
|
345
371
|
onOpenChange?.(true);
|