@astryxdesign/core 0.7.1 → 0.7.2-canary.151434a
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/AspectRatio/AspectRatio.d.ts +6 -8
- package/dist/AspectRatio/AspectRatio.d.ts.map +1 -1
- package/dist/AspectRatio/AspectRatio.js +44 -3
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +38 -14
- package/dist/CheckboxInput/CheckboxInput.d.ts +1 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +3 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts +9 -1
- package/dist/CheckboxList/CheckboxListItem.d.ts.map +1 -1
- package/dist/CheckboxList/CheckboxListItem.js +4 -2
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +20 -8
- 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/DropdownMenuDivider.d.ts +5 -3
- package/dist/DropdownMenu/DropdownMenuDivider.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuDivider.js +7 -3
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +4 -4
- package/dist/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/EmptyState/EmptyState.js +4 -10
- package/dist/Field/Field.d.ts +1 -1
- package/dist/Field/Field.d.ts.map +1 -1
- package/dist/Field/Field.js +8 -4
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +10 -2
- package/dist/Item/Item.d.ts +6 -2
- package/dist/Item/Item.d.ts.map +1 -1
- package/dist/Item/Item.js +19 -4
- 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/List/List.d.ts +46 -19
- package/dist/List/List.d.ts.map +1 -1
- package/dist/List/List.js +28 -10
- package/dist/List/ListContext.d.ts +8 -3
- package/dist/List/ListContext.d.ts.map +1 -1
- package/dist/List/ListContext.js +7 -2
- package/dist/List/ListItem.d.ts +13 -5
- package/dist/List/ListItem.d.ts.map +1 -1
- package/dist/List/ListItem.js +21 -8
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.d.ts.map +1 -1
- package/dist/Markdown/Markdown.d.ts.map +1 -1
- package/dist/Markdown/Markdown.js +8 -1
- package/dist/Markdown/plugins/frontmatter.d.ts.map +1 -1
- package/dist/Markdown/plugins/frontmatter.js +7 -3
- package/dist/MetadataList/MetadataList.d.ts.map +1 -1
- package/dist/MetadataList/MetadataList.js +5 -1
- package/dist/MetadataList/MetadataListContext.d.ts +1 -1
- package/dist/MetadataList/MetadataListContext.d.ts.map +1 -1
- 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/RadioList/RadioListItem.d.ts +9 -1
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +2 -0
- 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 +35 -12
- 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/plainDate.d.ts.map +1 -1
- package/dist/utils/plainDate.js +15 -9
- 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/AspectRatio/AspectRatio.test.tsx +44 -43
- package/src/AspectRatio/AspectRatio.tsx +38 -18
- package/src/AspectRatio/__tests__/AspectRatioFitLayers.a11y.browser.spec.ts +157 -0
- 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/CheckboxInput/CheckboxInput.test.tsx +34 -0
- package/src/CheckboxInput/CheckboxInput.tsx +3 -1
- package/src/CheckboxList/CheckboxList.test.tsx +22 -0
- package/src/CheckboxList/CheckboxListItem.doc.mjs +16 -0
- package/src/CheckboxList/CheckboxListItem.tsx +10 -0
- package/src/Dialog/Dialog.test.tsx +46 -0
- package/src/Dialog/Dialog.tsx +20 -7
- package/src/Dialog/__tests__/Dialog.a11y.known-failures.ts +0 -14
- 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.test.tsx +21 -12
- package/src/DropdownMenu/DropdownMenu.tsx +2 -2
- package/src/DropdownMenu/DropdownMenuDivider.doc.mjs +2 -2
- package/src/DropdownMenu/DropdownMenuDivider.tsx +9 -5
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +2 -2
- package/src/DropdownMenu/__tests__/Menu.a11y.chromium.spec.ts +145 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.known-failures.ts +26 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.renders.tsx +65 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.states.ts +138 -0
- package/src/DropdownMenu/__tests__/Menu.a11y.test.tsx +136 -0
- package/src/EmptyState/EmptyState.doc.mjs +3 -2
- package/src/EmptyState/EmptyState.spec.md +189 -0
- package/src/EmptyState/EmptyState.test.tsx +74 -3
- package/src/EmptyState/EmptyState.tsx +4 -8
- package/src/Field/Field.doc.mjs +14 -8
- package/src/Field/Field.spec.md +217 -0
- package/src/Field/Field.test.tsx +60 -2
- package/src/Field/Field.tsx +17 -8
- 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/Item/Item.doc.mjs +12 -8
- package/src/Item/Item.spec.md +226 -0
- package/src/Item/Item.test.tsx +61 -0
- package/src/Item/Item.tsx +40 -4
- 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/List.doc.mjs +14 -1
- package/src/List/List.spec.md +129 -77
- package/src/List/List.test.tsx +163 -94
- package/src/List/List.tsx +74 -18
- package/src/List/ListContext.tsx +9 -3
- package/src/List/ListItem.doc.mjs +24 -5
- package/src/List/ListItem.tsx +56 -27
- package/src/List/index.ts +1 -1
- package/src/Markdown/Markdown.tsx +14 -1
- package/src/Markdown/plugins/frontmatter.test.tsx +25 -0
- package/src/Markdown/plugins/frontmatter.ts +7 -3
- package/src/MetadataList/MetadataList.doc.mjs +2 -2
- package/src/MetadataList/MetadataList.test.tsx +38 -0
- package/src/MetadataList/MetadataList.tsx +8 -1
- package/src/MetadataList/MetadataListContext.tsx +1 -1
- 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/RadioList/RadioList.test.tsx +22 -0
- package/src/RadioList/RadioListItem.doc.mjs +16 -0
- package/src/RadioList/RadioListItem.tsx +10 -1
- 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.spec.md +57 -44
- 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/TreeList/TreeList.spec.md +29 -17
- 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/reset.css +0 -29
- package/src/theme/derivedVarRegistry.test.ts +3 -3
- package/src/theme/derivedVarRegistry.ts +0 -3
- package/src/utils/focusOutline.stylex.ts +4 -0
- package/src/utils/plainDate.test.ts +37 -1
- package/src/utils/plainDate.ts +15 -5
- package/src/utils/sharedMutationObserver.test.ts +53 -0
- package/src/utils/sharedMutationObserver.ts +78 -0
|
@@ -129,7 +129,11 @@ export function MetadataList({
|
|
|
129
129
|
const isMultiColumn = columns === 'multi' || typeof columns === 'number' && columns > 1;
|
|
130
130
|
// Default to 'top' for multi-column and horizontal layouts since side labels
|
|
131
131
|
// don't work well when items are in separate grid cells.
|
|
132
|
-
const
|
|
132
|
+
const defaultLabelConfig = isMultiColumn ? LABEL_TOP : LABEL_START;
|
|
133
|
+
const labelConfig = useMemo(() => ({
|
|
134
|
+
...label,
|
|
135
|
+
position: label?.position ?? defaultLabelConfig.position
|
|
136
|
+
}), [label, defaultLabelConfig]);
|
|
133
137
|
const [isShowAll, setIsShowAll] = useState(false);
|
|
134
138
|
const contentId = useId();
|
|
135
139
|
const t = useTranslator();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetadataListContext.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataListContext.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"MetadataListContext.d.ts","sourceRoot":"","sources":["../../src/MetadataList/MetadataListContext.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,uBAAuB,CAAC;IACrC,WAAW,EAAE,UAAU,GAAG,YAAY,CAAC;CACxC;AAED,eAAO,MAAM,mBAAmB,0DACsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAUZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE5D,OAAO,EAKL,KAAK,kBAAkB,EACxB,MAAM,UAAU,CAAC;AAOlB,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,EAUZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAuB,KAAK,QAAQ,EAAC,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AAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IAEzC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAqED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,uBAAuB,EAAE,EAC/D,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,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,GAAG,SAAS,EACb,EAAE,kBAAkB,CAAC,CAAC,CAAC,qBAykDvB;yBA/nDe,aAAa"}
|
|
@@ -29,13 +29,12 @@ import { PanelSearchInput } from "../Field/PanelSearchInput.js";
|
|
|
29
29
|
import { CheckboxInput } from "../CheckboxInput/index.js";
|
|
30
30
|
import { Badge } from "../Badge/index.js";
|
|
31
31
|
import "../theme/tokens.stylex.js";
|
|
32
|
-
import { colorVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
32
|
+
import { colorVars, focusVars, sizeVars, spacingVars, radiusVars, durationVars, easeVars, typographyVars, fontWeightVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
33
33
|
import { isOptionData, isDivider, isSection, normalizeOption, getSelectableOptions } from "../Selector/utils.js";
|
|
34
34
|
import { useMultiCombobox } from "./hooks.js";
|
|
35
35
|
import { getInputARIA, isImeKeyEvent, mergeProps } from "../utils/index.js";
|
|
36
36
|
import { devWarn, warnOnce } from "../utils/devWarning.js";
|
|
37
|
-
import "../utils/
|
|
38
|
-
import { FOCUS_OUTLINE_PARTS } from "../utils/focusOutline.stylex.js";
|
|
37
|
+
import { getInteractionModality, useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
39
38
|
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
40
39
|
import { FOCUSABLE_SELECTOR } from "../hooks/focusableSelector.js";
|
|
41
40
|
import { useAnnounceRenderedText } from "../hooks/useAnnounceRenderedText.js";
|
|
@@ -894,8 +893,8 @@ export function MultiSelector({
|
|
|
894
893
|
getActionCellId,
|
|
895
894
|
activeDescendantId,
|
|
896
895
|
onTriggerClick,
|
|
897
|
-
onKeyDown,
|
|
898
|
-
onItemMouseEnter
|
|
896
|
+
onKeyDown: onComboboxKeyDown,
|
|
897
|
+
onItemMouseEnter: onComboboxItemMouseEnter
|
|
899
898
|
} = useMultiCombobox({
|
|
900
899
|
selectableItems: sortedItems,
|
|
901
900
|
isDisabled: isDisabled || isEffectivelyReadOnly,
|
|
@@ -918,6 +917,21 @@ export function MultiSelector({
|
|
|
918
917
|
}, [getActionCellIdForActivate])
|
|
919
918
|
});
|
|
920
919
|
|
|
920
|
+
// A hover moves the highlight too, but the focus ring follows the shared
|
|
921
|
+
// interaction modality (architecture:interaction-modality INV1): it is read
|
|
922
|
+
// whenever a key or the pointer moves the highlight, so an action cell
|
|
923
|
+
// highlighted after pointer input keeps the hover treatment and no ring.
|
|
924
|
+
useInteractionModalityTracking();
|
|
925
|
+
const [isKeyboardHighlight, setIsKeyboardHighlight] = useState(() => getInteractionModality() === 'keyboard');
|
|
926
|
+
const onKeyDown = useCallback(event => {
|
|
927
|
+
onComboboxKeyDown(event);
|
|
928
|
+
setIsKeyboardHighlight(getInteractionModality() === 'keyboard');
|
|
929
|
+
}, [onComboboxKeyDown]);
|
|
930
|
+
const onItemMouseEnter = useCallback((...args) => {
|
|
931
|
+
onComboboxItemMouseEnter(...args);
|
|
932
|
+
setIsKeyboardHighlight(getInteractionModality() === 'keyboard');
|
|
933
|
+
}, [onComboboxItemMouseEnter]);
|
|
934
|
+
|
|
921
935
|
// The trigger button owns its click so a consumer `onClick`, which lands on
|
|
922
936
|
// the button, composes after the built-in toggle. A press elsewhere in the
|
|
923
937
|
// control box (padding, start icon, chevron) still opens the panel.
|
|
@@ -1179,14 +1193,14 @@ export function MultiSelector({
|
|
|
1179
1193
|
className: "x78zum5 x6s0dn4 x2lah0s xh6dtrn"
|
|
1180
1194
|
},
|
|
1181
1195
|
1: {
|
|
1182
|
-
className: "x78zum5 x6s0dn4 x2lah0s xh6dtrn
|
|
1196
|
+
className: "x78zum5 x6s0dn4 x2lah0s xh6dtrn xak0ai5 x9ssot5 x19bwoy8 x1eqjuhu"
|
|
1183
1197
|
}
|
|
1184
|
-
}[!!(isHighlighted && highlightedCell === 'action') << 0],
|
|
1198
|
+
}[!!(isHighlighted && highlightedCell === 'action' && isKeyboardHighlight) << 0],
|
|
1185
1199
|
children: isSelectAll || isCreate ? null : item.action
|
|
1186
1200
|
})]
|
|
1187
1201
|
}) : content
|
|
1188
1202
|
}, item.value);
|
|
1189
|
-
}, [isGrid, highlightedCell, getActionCellId, renderOption, indicatorPosition, highlightedIndex, optimisticValue, allEnabledSelected, selectAllState, selectAllLabel, getItemId, handleNavigableToggle, onItemMouseEnter, size, t]);
|
|
1203
|
+
}, [isGrid, highlightedCell, isKeyboardHighlight, getActionCellId, renderOption, indicatorPosition, highlightedIndex, optimisticValue, allEnabledSelected, selectAllState, selectAllLabel, getItemId, handleNavigableToggle, onItemMouseEnter, size, t]);
|
|
1190
1204
|
|
|
1191
1205
|
// Render all options. Uses sortedItems as the single source of truth for
|
|
1192
1206
|
// item order — no independent sorting here. Structural elements (dividers,
|
|
@@ -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,CAAC;IAGtD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,UA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B,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
|
}
|
|
@@ -15,8 +15,16 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import React, { type ReactNode } from 'react';
|
|
17
17
|
import type { BaseProps } from '../BaseProps';
|
|
18
|
+
import { type ItemAlign } from '../Item';
|
|
18
19
|
export interface RadioListItemProps extends BaseProps<HTMLDivElement> {
|
|
19
20
|
ref?: React.Ref<HTMLDivElement>;
|
|
21
|
+
/**
|
|
22
|
+
* Vertical alignment of the start and end content against the label,
|
|
23
|
+
* forwarded to Item. Use `first-line` to keep the radio level with the
|
|
24
|
+
* first line of a wrapped label.
|
|
25
|
+
* @default 'center'
|
|
26
|
+
*/
|
|
27
|
+
align?: ItemAlign;
|
|
20
28
|
/**
|
|
21
29
|
* Primary label for the radio item.
|
|
22
30
|
*
|
|
@@ -83,7 +91,7 @@ export interface RadioListItemProps extends BaseProps<HTMLDivElement> {
|
|
|
83
91
|
* />
|
|
84
92
|
* ```
|
|
85
93
|
*/
|
|
86
|
-
export declare function RadioListItem({ ref, label, 'aria-label': ariaLabel, value, description, isDisabled: isItemDisabled, startContent, endContent, xstyle, className, style, onClick, ...rest }: RadioListItemProps): React.JSX.Element;
|
|
94
|
+
export declare function RadioListItem({ ref, label, 'aria-label': ariaLabel, value, description, isDisabled: isItemDisabled, startContent, endContent, align, xstyle, className, style, onClick, ...rest }: RadioListItemProps): React.JSX.Element;
|
|
87
95
|
export declare namespace RadioListItem {
|
|
88
96
|
var displayName: string;
|
|
89
97
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioListItem.d.ts","sourceRoot":"","sources":["../../src/RadioList/RadioListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioListItem.d.ts","sourceRoot":"","sources":["../../src/RadioList/RadioListItem.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,EAAqB,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAQ5C,OAAO,EAAO,KAAK,SAAS,EAAC,MAAM,SAAS,CAAC;AA6H7C,MAAM,WAAW,kBAAmB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACnE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;;;;;;OAUG;IACH,KAAK,EAAE,SAAS,CAAC;IACjB;;;;;;;;;;;;;;OAcG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,KAAK,EACL,YAAY,EAAE,SAAS,EACvB,KAAK,EACL,WAAW,EACX,UAAU,EAAE,cAAsB,EAClC,YAAY,EACZ,UAAU,EACV,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,OAAO,EACP,GAAG,IAAI,EACR,EAAE,kBAAkB,qBAoKpB;yBAnLe,aAAa"}
|
|
@@ -122,6 +122,7 @@ export function RadioListItem({
|
|
|
122
122
|
isDisabled: isItemDisabled = false,
|
|
123
123
|
startContent,
|
|
124
124
|
endContent,
|
|
125
|
+
align,
|
|
125
126
|
xstyle,
|
|
126
127
|
className,
|
|
127
128
|
style,
|
|
@@ -244,6 +245,7 @@ export function RadioListItem({
|
|
|
244
245
|
children: description
|
|
245
246
|
}) : undefined,
|
|
246
247
|
endContent: endContent,
|
|
248
|
+
align: align,
|
|
247
249
|
xstyle: [
|
|
248
250
|
// Hover reaches the radio visual through this ancestor marker rather
|
|
249
251
|
// than props, so hovering the row tints the control. The marker rides
|
|
@@ -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;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C,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,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",
|