@astryx-vue/core 0.16.4 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertDialog/index.js +1 -1
- package/dist/{AlertDialog-C8W-FjkH.js → AlertDialog-CNb0dkY9.js} +4 -4
- package/dist/AppShell/index.d.ts +1 -1
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-dMLeTLRs.js → Avatar-D85dSNpq.js} +1 -1
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-CJgIpZby.js → Banner-BXITu2pn.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/{Breadcrumbs-oyT1pLaR.js → Breadcrumbs-DXzBkpkd.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-OfqvSU1j.js → Button-BZtim0B-.js} +1 -2
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-DN_gn5t4.js → Carousel-BaCXqtKK.js} +1 -1
- package/dist/Center/index.d.ts +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-DzxOPova.js → Chat-Wq7e98zS.js} +3 -3
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-CWfobjQ1.js → CheckboxInput-3ONBl1AY.js} +1 -1
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxList-CEFhwHbk.js → CheckboxList-CbRX5YDA.js} +3 -3
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/Code/index.js +1 -1
- package/dist/{CodeBlock-DFq81dwg.js → CodeBlock-CLVXVlB7.js} +2 -2
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/CommandPalette/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-urnqxaZR.js → CommandPalette-CECjNvGB.js} +2 -2
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-Bb9Tietz.js → ComplexSelector-Dmaag1wm.js} +7 -3
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-UGCRWpCu.js → DateInput-BitZfGEY.js} +2 -2
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-CbFNAXhb.js → DateRangeInput-kxXBsUTU.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-DsB9quGn.js → DateTimeInput-Cfkuec_h.js} +4 -4
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-CvRMUDsx.js → Dialog-BQ5OBB1d.js} +1 -1
- package/dist/{Dialog-BoV6-sZg.js → Dialog-DgdbRn2l.js} +25 -6
- package/dist/{DialogHeader-Dz-7FLep.js → DialogHeader-D8234o9F.js} +7 -3
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-EuUM3b5t.js → Drawer-Dqus7kUc.js} +2 -2
- package/dist/DropdownMenu/index.js +2 -2
- package/dist/{DropdownMenu-BvTeXvbu.js → DropdownMenu-BC_zB9le.js} +1 -1
- package/dist/{DropdownMenu-DF56Xz8n.js → DropdownMenu-LQsXd-_V.js} +1 -1
- package/dist/EmptyState/index.js +1 -1
- package/dist/{EmptyState-D2ENfW7V.js → EmptyState-Bw0kWfMi.js} +3 -3
- package/dist/Field/index.js +3 -3
- package/dist/{Field-BE1CuxSu.js → Field-BXkGR8H0.js} +1 -1
- package/dist/{FieldInfoTip-CSXfFcdR.js → FieldInfoTip-DzpUxMDh.js} +1 -1
- package/dist/{FieldLabel-CvPYOohI.js → FieldLabel-DI7Yqdhf.js} +1 -1
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-dYwavUsk.js → FileInput-BNHjbyQY.js} +2 -2
- package/dist/Heading/index.d.ts +1 -1
- package/dist/Heading/index.js +1 -1
- package/dist/{Heading-CNOg6iq5.js → Heading-Oph-5DDq.js} +1 -1
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/HoverCard/index.js +1 -1
- package/dist/{HoverCard-DafCEtWH.js → HoverCard-DVPLeccv.js} +22 -10
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-Cn3iSGRd.js → IconButton-Du2XBBAX.js} +1 -1
- package/dist/Indicator/index.d.ts +2 -2
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-BnGk9nr_.js → InfoTip-Bjw1ithP.js} +1 -1
- package/dist/{InputClearButton-h4GQJMqr.js → InputClearButton-CED-zP2y.js} +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-BX4cdWQW.js → InputGroup-D5PoL4cU.js} +1 -1
- package/dist/InternationalizationProvider/index.d.ts +1 -1
- package/dist/InternationalizationProvider/index.js +1 -1
- package/dist/{InternationalizationProvider-7rA65NO7.js → InternationalizationProvider-Dr5GE6f0.js} +1 -1
- package/dist/LayerProvider/index.d.ts +1 -1
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-3y6Gzumf.js → Lightbox-RN_f7zRw.js} +3 -2
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-wft8544N.js → Link-CQ-Ztuo_.js} +1 -1
- package/dist/List/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-rtBS8dBv.js → Markdown-DnnWjJGX.js} +3 -3
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-BfaD8buF.js → MoreMenu-i80Ey9vR.js} +2 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-BqsGkkNQ.js → MultiSelector-BK6nZweN.js} +28 -16
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-CKXqM4cC.js → NumberInput-BPeesTRv.js} +3 -3
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BYbqhFXF.js → Pagination-DFQNX_Mb.js} +1 -1
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-BepO8m2B.js → Popover-CmAEizH-.js} +3 -3
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-UclIfhPU.js → PowerSearch-BAOqpQag.js} +16 -16
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +1 -1
- package/dist/{ProgressBar-CHdyTMyH.js → ProgressBar-DgyPRxV0.js} +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-BvoO922B.js → RadioGroup-FhoQMqg5.js} +2 -2
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioList-LmcRXW-R.js → RadioList-DK2uXQ5S.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-CTzIfy5D.js → Selector-Bo7qkt1P.js} +158 -63
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-BFDgU7Ul.js → SideNav-CcZLUd7G.js} +2 -2
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-JoQDr9bl.js → Slider-DIgb8ogt.js} +1 -1
- package/dist/StatusDot/index.js +1 -1
- package/dist/{StatusDot-DdR_DF-k.js → StatusDot-Cxm-uhTD.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-CijkvpAA.js → Switch-5toeiELX.js} +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-0D-DE9wZ.js → Table-CRKljXg4.js} +12 -12
- package/dist/Text/index.d.ts +1 -1
- package/dist/Text/index.js +1 -1
- package/dist/{Text-DKlvc1pK.js → Text-CiSw2pOi.js} +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-B2uVGYED.js → TextArea-B82oXF-m.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-7_aLlg3G.js → TextInput-_SIiqVOY.js} +4 -4
- package/dist/Theme/index.d.ts +3 -3
- package/dist/Theme/index.js +1 -1
- package/dist/{Theme-8bDq2nud.js → Theme-iqi6AvU_.js} +363 -39
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-B1E4wEei.js → Thumbnail-BlueoqOH.js} +2 -2
- package/dist/{TimeField-EMXQhof_.js → TimeField-CBWgdA1Y.js} +1 -1
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-Cy1ikWWy.js → TimeInput-8ASOMV3B.js} +2 -2
- package/dist/Timer/index.js +1 -1
- package/dist/{Timer-DOs3NhSX.js → Timer-C8evnsTE.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-Dw5CyS_N.js → Timestamp-CgvZe6vH.js} +3 -3
- package/dist/Toast/index.d.ts +2 -2
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-DhWuBX-f.js → Toast-CzbqvHDN.js} +107 -34
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-DcLaKPDT.js → ToggleButton-CO0XWWc0.js} +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-DGW3Nurz.js → Tokenizer-CsFiYUJ_.js} +173 -105
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.js +2 -2
- package/dist/{Tooltip-vUyPDqhh.js → Tooltip-DQipgW1R.js} +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/Typeahead/index.d.ts +2 -1
- package/dist/Typeahead/index.js +2 -2
- package/dist/{Typeahead-BuVI6J9T.js → Typeahead--kEp21ut.js} +160 -72
- package/dist/{useKeyboardHighlight-CGCf1O57.js → assertOptions-CK_gJ0d3.js} +12 -1
- package/dist/composables/index.d.ts +3 -3
- package/dist/composables/index.js +7 -7
- package/dist/composables-BKHcPgN0.js +5730 -0
- package/dist/{index-BZ_lOqjE.d.ts → index-85RFPeV0.d.ts} +6 -6
- package/dist/{index-rzkX36wM.d.ts → index-9tZJgo0R.d.ts} +1 -1
- package/dist/{index-s0Ezq3U-.d.ts → index-B0iRA00v.d.ts} +5 -5
- package/dist/{index-B00KlO-P.d.ts → index-B95VIgRl.d.ts} +66 -66
- package/dist/{index-ZbNwGVkS.d.ts → index-BKnyTWPM.d.ts} +1 -1
- package/dist/{index-BTK7aStw.d.ts → index-BaK0mywG.d.ts} +1 -1
- package/dist/{index-Bfm6mF-r.d.ts → index-BfoazhEu.d.ts} +1 -1
- package/dist/{index-BOCb89V9.d.ts → index-BxWCX2pJ.d.ts} +1 -1
- package/dist/{index-CQ1bsxLC.d.ts → index-C1qJlC65.d.ts} +1 -1
- package/dist/{index-CL8JvxHW.d.ts → index-C1zwvxPH.d.ts} +2 -2
- package/dist/{index-Dc9_kBrU.d.ts → index-CH-xSiJz.d.ts} +10 -3
- package/dist/{index-YKCx03zD.d.ts → index-COgrQZIL.d.ts} +2 -2
- package/dist/{index-Bgk1Rj2A.d.ts → index-CTjkJP4x.d.ts} +1 -1
- package/dist/{index-FeZXsFO-.d.ts → index-CbA8rR_b.d.ts} +2 -2
- package/dist/{index-Bzi3A980.d.ts → index-ChqMaV6N.d.ts} +1 -1
- package/dist/{index-B0R5CLPF.d.ts → index-CsYDrQ9R.d.ts} +1 -1
- package/dist/{index-BhxqUt3y.d.ts → index-CuW4AQ7M.d.ts} +2 -2
- package/dist/{index-rnFsCdJ7.d.ts → index-Cy1rEWC-.d.ts} +1 -1
- package/dist/{index-BSlzqFzV.d.ts → index-CyMStZq4.d.ts} +5 -5
- package/dist/{index-C2cH8OLC.d.ts → index-D31bgBoy.d.ts} +1 -1
- package/dist/index-DGXCnzOL.d.ts +69 -0
- package/dist/{index-nNUT4Etk.d.ts → index-DK0Wdo9N.d.ts} +5 -5
- package/dist/{index--tm6L1ot.d.ts → index-DofC9Rll.d.ts} +2 -2
- package/dist/{index-Dy746dfn.d.ts → index-Qdbssopn.d.ts} +1 -1
- package/dist/{index-DE1genab.d.ts → index-QnlWyUxN.d.ts} +2 -2
- package/dist/{index-B1eCxBCY.d.ts → index-TXcNH86P.d.ts} +1 -1
- package/dist/{index-D7XRtUTY.d.ts → index-bk5kfP_c.d.ts} +5 -1
- package/dist/{index-C5e2rZML.d.ts → index-dWlCpnua.d.ts} +2 -2
- package/dist/{index-DS9SzqqJ.d.ts → index-lmd9LZKB.d.ts} +2 -2
- package/dist/{index-CtYlR9Cu.d.ts → index-rdwI-mcm.d.ts} +1 -1
- package/dist/{index-BXDqyk2_.d.ts → index-tuNsmJxw.d.ts} +169 -2
- package/dist/{index-BEZ4ezJk.d.ts → index-wY6dKz6c.d.ts} +2 -2
- package/dist/{index-C89cIh4E.d.ts → index-waTkqxTz.d.ts} +1 -1
- package/dist/index.d.ts +40 -39
- package/dist/index.js +75 -75
- package/dist/{layerFocusReturn-13azEIdn.js → layerFocusReturn-B8Hp14ZG.js} +1 -1
- package/dist/{loadCatalog-DFyDz_4e.d.ts → loadCatalog-BJwcyX8i.d.ts} +2 -0
- package/dist/{loadCatalog-C3MSknfx.js → loadCatalog-C1kms5sO.js} +5 -1
- package/dist/locale/index.d.ts +2 -2
- package/dist/locale/index.js +3 -3
- package/dist/{locale-OCGw4bi6.js → locale-CHhsd9Mq.js} +1 -1
- package/dist/tooltipFocusRules-D4cJ08fk.js +67 -0
- package/dist/{useLayer-CzyH9KXY.js → tooltipTriggerRules-PBxqztvn.js} +10 -1
- package/dist/{typeahead-RkZw0Ktn.js → typeahead-BgfLP7vR.js} +2 -0
- package/dist/{types-BRfVvZTH.d.ts → types-Bc_G8h4i.d.ts} +2 -0
- package/dist/{index-BzViSe8D.d.ts → types-C1ydeFiu.d.ts} +43 -65
- package/dist/{types-uWxXh1Jm.d.ts → types-fRasDCe4.d.ts} +47 -6
- package/dist/{useAsyncSource-Gk0VtE7_.js → useAsyncSource-7GTcK8ep.js} +31 -1
- package/dist/{useAsyncSource-aGzrvRkI.d.ts → useAsyncSource-DbG2FSuI.d.ts} +19 -2
- package/dist/{useCombobox-D374_pT8.js → useCombobox-DIR9yoEu.js} +150 -3
- package/dist/{useInputStatusIcon-CwCNWBnG.js → useInputStatusIcon-ne9V7ZQC.js} +1 -1
- package/dist/{useTooltip-frKBHzqr.js → useTooltip-C7gHRGEO.js} +9 -44
- package/dist/{useTruncationTooltip-DUkkZgmO.js → useTruncationTooltip-DwUQN7fD.js} +3 -3
- package/dist/{useTypeaheadAnnouncement-CSikDlpK.js → useTypeaheadMenuConfig--4f7jR6G.js} +264 -20
- package/package.json +1 -1
- package/styles/dialog-header.css +19 -4
- package/styles/dialog.css +4 -0
- package/styles/hover-card.css +6 -0
- package/styles/motion.css +10 -0
- package/styles/selector.css +10 -0
- package/styles/toast.css +19 -0
- package/styles/tooltip.css +6 -0
- package/dist/composables-CCsHfpCS.js +0 -1256
- package/dist/tooltipTriggerRules-9zkDe8_b.js +0 -10
- package/dist/useHoverLayerDismiss-CFGjvYi4.js +0 -27
- package/dist/{index-J6YRJ7Ul.d.ts → index-D8lv2BiD.d.ts} +1 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { t as characterCount } from "./characters-wTnzjkkR.js";
|
|
2
|
-
import { t as useAnnounce } from "./announce-GU01Oix2.js";
|
|
3
|
-
import { n as useAsyncSource } from "./useAsyncSource-Gk0VtE7_.js";
|
|
4
|
-
import { t as useCombobox } from "./useCombobox-D374_pT8.js";
|
|
5
2
|
import { n as isDevBuild, t as devPropError } from "./devBuild-G249YcdZ.js";
|
|
6
|
-
import { t as
|
|
3
|
+
import { t as devWarn } from "./useDevWarning-B2fsk2B-.js";
|
|
4
|
+
import { t as useAnnounce } from "./announce-GU01Oix2.js";
|
|
5
|
+
import { n as useAsyncSource } from "./useAsyncSource-7GTcK8ep.js";
|
|
6
|
+
import { t as useCombobox } from "./useCombobox-DIR9yoEu.js";
|
|
7
|
+
import { t as _sfc_main$3 } from "./Spinner-DEVPDsD0.js";
|
|
7
8
|
import { t as createStillPointerGate } from "./stillPointerGate-0vdn-hSa.js";
|
|
8
9
|
import { i as isOptionAction, n as searchResultMessage, r as OptionAction, t as useOptionActionGrid } from "./useOptionActionGrid-C7ibYM_A.js";
|
|
9
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, toValue, unref, watch, withModifiers } from "vue";
|
|
10
|
+
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, openBlock, ref, renderList, renderSlot, toDisplayString, toValue, unref, useSlots, useTemplateRef, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
|
|
11
|
+
import "../styles/layer.css";
|
|
10
12
|
import "../styles/typeahead.css";
|
|
11
13
|
//#region src/Typeahead/queryLength.ts
|
|
12
14
|
/**
|
|
@@ -49,6 +51,11 @@ function useTypeaheadMenu(options) {
|
|
|
49
51
|
if (source === previous || asyncSource.status.value !== "loading") return;
|
|
50
52
|
asyncSource.status.value = "idle";
|
|
51
53
|
}, { flush: "sync" });
|
|
54
|
+
const isSettled = computed(() => asyncSource.status.value !== "loading" && asyncSource.searchedQuery.value === query.value);
|
|
55
|
+
const menuStatus = computed(() => {
|
|
56
|
+
const status = asyncSource.status.value;
|
|
57
|
+
return status === "empty" && asyncSource.searchedQuery.value !== query.value ? "idle" : status;
|
|
58
|
+
});
|
|
52
59
|
const matchCount = computed(() => {
|
|
53
60
|
if (belowMinQueryLength.value) return 0;
|
|
54
61
|
const excluded = new Set(toValue(options.excludeIds) ?? []);
|
|
@@ -106,6 +113,14 @@ function useTypeaheadMenu(options) {
|
|
|
106
113
|
const current = list[combobox.activeIndex.value];
|
|
107
114
|
if (!current || current.disabled) combobox.highlightFirst();
|
|
108
115
|
});
|
|
116
|
+
watch([
|
|
117
|
+
isSettled,
|
|
118
|
+
() => asyncSource.status.value,
|
|
119
|
+
() => entries.value.length
|
|
120
|
+
], () => {
|
|
121
|
+
if (!combobox.isOpen.value || !isSettled.value || query.value.trim() !== "") return;
|
|
122
|
+
if ((asyncSource.status.value === "empty" || asyncSource.status.value === "error") && entries.value.length === 0) close();
|
|
123
|
+
});
|
|
109
124
|
/**
|
|
110
125
|
* 太短的查询没东西可展示,此时不让下拉打开。
|
|
111
126
|
* 只有从文字自己派生的条目(比如「创建 xxx」)还值得看一眼。
|
|
@@ -134,14 +149,27 @@ function useTypeaheadMenu(options) {
|
|
|
134
149
|
if (value.length > 0 || toValue(options.showOnFocus)) open();
|
|
135
150
|
else close();
|
|
136
151
|
}
|
|
152
|
+
function resetQuery() {
|
|
153
|
+
const changed = query.value !== "";
|
|
154
|
+
query.value = "";
|
|
155
|
+
if (changed) options.onQueryChange?.("");
|
|
156
|
+
}
|
|
137
157
|
function selectHighlighted() {
|
|
138
158
|
const entry = entries.value[combobox.activeIndex.value];
|
|
139
159
|
if (entry && !entry.disabled) options.onSelect(entry);
|
|
140
160
|
}
|
|
141
161
|
function onKeyDown(event) {
|
|
142
162
|
if (event.isComposing || event.key === "Process") return;
|
|
143
|
-
if (toValue(options.disabled)) return;
|
|
144
163
|
const openNow = combobox.isOpen.value;
|
|
164
|
+
if (toValue(options.disabled)) {
|
|
165
|
+
if (openNow && event.key === "Enter") event.preventDefault();
|
|
166
|
+
if (openNow && event.key === "Escape") {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
close();
|
|
169
|
+
}
|
|
170
|
+
if (openNow && event.key === "Tab") close();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
145
173
|
const list = entries.value;
|
|
146
174
|
switch (event.key) {
|
|
147
175
|
case "ArrowDown":
|
|
@@ -193,7 +221,6 @@ function useTypeaheadMenu(options) {
|
|
|
193
221
|
if (openNow) {
|
|
194
222
|
event.preventDefault();
|
|
195
223
|
close();
|
|
196
|
-
options.onEscape?.();
|
|
197
224
|
}
|
|
198
225
|
break;
|
|
199
226
|
case "Tab": if (openNow) close();
|
|
@@ -211,8 +238,11 @@ function useTypeaheadMenu(options) {
|
|
|
211
238
|
error: asyncSource.error,
|
|
212
239
|
activeId,
|
|
213
240
|
belowMinQueryLength,
|
|
241
|
+
isSettled,
|
|
242
|
+
menuStatus,
|
|
214
243
|
matchCount,
|
|
215
244
|
setQuery,
|
|
245
|
+
resetQuery,
|
|
216
246
|
open,
|
|
217
247
|
close,
|
|
218
248
|
onKeyDown
|
|
@@ -254,7 +284,7 @@ function useLatchedOptionGrid(options) {
|
|
|
254
284
|
}
|
|
255
285
|
//#endregion
|
|
256
286
|
//#region src/Typeahead/TypeaheadItem.vue
|
|
257
|
-
const _hoisted_1$
|
|
287
|
+
const _hoisted_1$2 = ["data-disabled"];
|
|
258
288
|
const _hoisted_2$1 = {
|
|
259
289
|
key: 0,
|
|
260
290
|
class: "astryx-typeahead-item-icon",
|
|
@@ -266,7 +296,7 @@ const _hoisted_5$1 = {
|
|
|
266
296
|
key: 0,
|
|
267
297
|
class: "astryx-typeahead-option-description"
|
|
268
298
|
};
|
|
269
|
-
const _sfc_main$
|
|
299
|
+
const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
270
300
|
name: "AstryxTypeaheadItem",
|
|
271
301
|
__name: "TypeaheadItem",
|
|
272
302
|
props: {
|
|
@@ -282,16 +312,16 @@ const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
|
282
312
|
return openBlock(), createElementBlock("span", {
|
|
283
313
|
class: "astryx-typeahead-item",
|
|
284
314
|
"data-disabled": props.isDisabled || props.item.disabled || void 0
|
|
285
|
-
}, [_ctx.$slots.icon ? (openBlock(), createElementBlock("span", _hoisted_2$1, [renderSlot(_ctx.$slots, "icon")])) : createCommentVNode("v-if", true), createElementVNode("span", _hoisted_3$1, [createElementVNode("span", _hoisted_4$1, toDisplayString(props.item.label), 1), props.description ?? props.item.description ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(props.description ?? props.item.description), 1)) : createCommentVNode("v-if", true)])], 8, _hoisted_1$
|
|
315
|
+
}, [_ctx.$slots.icon ? (openBlock(), createElementBlock("span", _hoisted_2$1, [renderSlot(_ctx.$slots, "icon")])) : createCommentVNode("v-if", true), createElementVNode("span", _hoisted_3$1, [createElementVNode("span", _hoisted_4$1, toDisplayString(props.item.label), 1), props.description ?? props.item.description ? (openBlock(), createElementBlock("span", _hoisted_5$1, toDisplayString(props.description ?? props.item.description), 1)) : createCommentVNode("v-if", true)])], 8, _hoisted_1$2);
|
|
286
316
|
};
|
|
287
317
|
}
|
|
288
318
|
});
|
|
289
319
|
//#endregion
|
|
290
320
|
//#region src/Typeahead/TypeaheadMenu.vue
|
|
291
|
-
const _hoisted_1 = {
|
|
321
|
+
const _hoisted_1$1 = {
|
|
292
322
|
key: 0,
|
|
293
323
|
class: "astryx-typeahead-state",
|
|
294
|
-
|
|
324
|
+
"aria-hidden": "true"
|
|
295
325
|
};
|
|
296
326
|
const _hoisted_2 = {
|
|
297
327
|
key: 1,
|
|
@@ -316,6 +346,9 @@ const _hoisted_7 = [
|
|
|
316
346
|
"aria-selected",
|
|
317
347
|
"aria-disabled",
|
|
318
348
|
"data-option-id",
|
|
349
|
+
"data-highlighted",
|
|
350
|
+
"data-selected",
|
|
351
|
+
"data-disabled",
|
|
319
352
|
"onMouseenter",
|
|
320
353
|
"onClick"
|
|
321
354
|
];
|
|
@@ -344,7 +377,7 @@ const _hoisted_13 = {
|
|
|
344
377
|
fill: "none",
|
|
345
378
|
"aria-hidden": "true"
|
|
346
379
|
};
|
|
347
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
380
|
+
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
348
381
|
name: "AstryxTypeaheadMenu",
|
|
349
382
|
__name: "TypeaheadMenu",
|
|
350
383
|
props: {
|
|
@@ -404,10 +437,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
404
437
|
class: "astryx-typeahead-menu",
|
|
405
438
|
role: "presentation",
|
|
406
439
|
onMousemove: _cache[3] || (_cache[3] = (...args) => unref(pointerGate).track && unref(pointerGate).track(...args))
|
|
407
|
-
}, [props.status === "loading" && props.entries.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_sfc_main$
|
|
440
|
+
}, [props.status === "loading" && props.entries.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_1$1, [createVNode(_sfc_main$3, {
|
|
408
441
|
size: "sm",
|
|
409
442
|
label: props.loadingText
|
|
410
|
-
}, null, 8, ["label"])])) : props.status === "error" ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(props.errorText), 1)) : props.entries.length === 0 ? (openBlock(), createElementBlock("div", {
|
|
443
|
+
}, null, 8, ["label"])])) : props.status === "error" ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(props.errorText), 1)) : props.entries.length === 0 && props.status !== "idle" ? (openBlock(), createElementBlock("div", {
|
|
411
444
|
key: 2,
|
|
412
445
|
class: "astryx-typeahead-state",
|
|
413
446
|
role: props.grid ? "presentation" : "option",
|
|
@@ -435,6 +468,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
435
468
|
"aria-selected": row.entry.selected ? "true" : "false",
|
|
436
469
|
"aria-disabled": row.entry.disabled || void 0,
|
|
437
470
|
"data-option-id": row.entry.id,
|
|
471
|
+
"data-highlighted": row.index === props.activeIndex ? "highlighted" : void 0,
|
|
472
|
+
"data-selected": row.entry.selected ? "selected" : void 0,
|
|
473
|
+
"data-disabled": row.entry.disabled ? "disabled" : void 0,
|
|
438
474
|
tabindex: "-1",
|
|
439
475
|
onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
|
|
440
476
|
onMouseenter: ($event) => onRowEnter($event, row.index),
|
|
@@ -452,7 +488,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
452
488
|
entry: row.entry,
|
|
453
489
|
isActive: row.index === props.activeIndex,
|
|
454
490
|
isSelected: Boolean(row.entry.selected)
|
|
455
|
-
}, () => [createVNode(_sfc_main$
|
|
491
|
+
}, () => [createVNode(_sfc_main$2, {
|
|
456
492
|
item: {
|
|
457
493
|
id: row.entry.id,
|
|
458
494
|
label: row.entry.label,
|
|
@@ -483,7 +519,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
483
519
|
entry: row.entry,
|
|
484
520
|
isActive: row.index === props.activeIndex,
|
|
485
521
|
isSelected: Boolean(row.entry.selected)
|
|
486
|
-
}, () => [createVNode(_sfc_main$
|
|
522
|
+
}, () => [createVNode(_sfc_main$2, {
|
|
487
523
|
item: {
|
|
488
524
|
id: row.entry.id,
|
|
489
525
|
label: row.entry.label,
|
|
@@ -507,6 +543,117 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
507
543
|
}
|
|
508
544
|
});
|
|
509
545
|
//#endregion
|
|
546
|
+
//#region src/Typeahead/TypeaheadPopup.vue
|
|
547
|
+
const _hoisted_1 = [
|
|
548
|
+
"id",
|
|
549
|
+
"role",
|
|
550
|
+
"aria-label",
|
|
551
|
+
"data-placement"
|
|
552
|
+
];
|
|
553
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
554
|
+
name: "AstryxTypeaheadPopup",
|
|
555
|
+
inheritAttrs: false,
|
|
556
|
+
__name: "TypeaheadPopup",
|
|
557
|
+
props: {
|
|
558
|
+
id: {},
|
|
559
|
+
isOpen: { type: Boolean },
|
|
560
|
+
config: {},
|
|
561
|
+
label: {},
|
|
562
|
+
grid: { type: Boolean },
|
|
563
|
+
placement: {},
|
|
564
|
+
popupStyle: {},
|
|
565
|
+
popupClass: {},
|
|
566
|
+
entries: {},
|
|
567
|
+
activeIndex: {},
|
|
568
|
+
actionIndex: {},
|
|
569
|
+
status: {},
|
|
570
|
+
emptyText: {},
|
|
571
|
+
loadingText: {},
|
|
572
|
+
errorText: {},
|
|
573
|
+
query: {},
|
|
574
|
+
isSettled: { type: Boolean }
|
|
575
|
+
},
|
|
576
|
+
emits: [
|
|
577
|
+
"select",
|
|
578
|
+
"highlight",
|
|
579
|
+
"close",
|
|
580
|
+
"keydown"
|
|
581
|
+
],
|
|
582
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
583
|
+
const props = __props;
|
|
584
|
+
const emit = __emit;
|
|
585
|
+
const slots = useSlots();
|
|
586
|
+
const root = useTemplateRef("root");
|
|
587
|
+
__expose({ el: root });
|
|
588
|
+
const isDialog = computed(() => props.config?.role === "dialog");
|
|
589
|
+
const dialogLabel = computed(() => props.config?.role === "dialog" ? props.config.label : void 0);
|
|
590
|
+
/** listbox 角色带 `menu` 插槽:浮层本身不是列表,列表由插槽里的 `listbox` 放在想放的位置。 */
|
|
591
|
+
const wrapsList = computed(() => !isDialog.value && slots.menu != null);
|
|
592
|
+
const listRole = computed(() => props.grid ? "grid" : "listbox");
|
|
593
|
+
const isBusy = computed(() => props.status === "loading");
|
|
594
|
+
const isEmptySearch = computed(() => props.status === "empty" && props.isSettled && props.query.trim() !== "");
|
|
595
|
+
const menuProps = computed(() => ({
|
|
596
|
+
entries: props.entries,
|
|
597
|
+
activeIndex: props.activeIndex,
|
|
598
|
+
grid: props.grid,
|
|
599
|
+
actionIndex: props.actionIndex,
|
|
600
|
+
status: props.status,
|
|
601
|
+
listboxId: props.id,
|
|
602
|
+
emptyText: props.emptyText,
|
|
603
|
+
loadingText: props.loadingText,
|
|
604
|
+
errorText: props.errorText,
|
|
605
|
+
onSelect: (id) => emit("select", id),
|
|
606
|
+
onHighlight: (index) => emit("highlight", index)
|
|
607
|
+
}));
|
|
608
|
+
function menuSlots() {
|
|
609
|
+
return {
|
|
610
|
+
...slots.item ? { item: slots.item } : {},
|
|
611
|
+
...slots.empty ? { empty: slots.empty } : {}
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
/** 结果列表:唯一带 listbox 角色的元素,菜单插槽围着它放别的信息。 */
|
|
615
|
+
const Listbox = defineComponent({
|
|
616
|
+
name: "AstryxTypeaheadListbox",
|
|
617
|
+
setup: () => () => h("div", {
|
|
618
|
+
"id": props.id,
|
|
619
|
+
"role": listRole.value,
|
|
620
|
+
"aria-label": props.label
|
|
621
|
+
}, [h(_sfc_main$1, menuProps.value, menuSlots())])
|
|
622
|
+
});
|
|
623
|
+
return (_ctx, _cache) => {
|
|
624
|
+
return openBlock(), createBlock(Teleport, { to: "body" }, [createCommentVNode(" eslint-disable-next-line vue-a11y/no-static-element-interactions -- Escape 关 dialog 菜单:焦点在菜单里的任何地方按下都要接到。 "), withDirectives(createElementVNode("div", {
|
|
625
|
+
id: isDialog.value || !wrapsList.value ? __props.id : void 0,
|
|
626
|
+
ref_key: "root",
|
|
627
|
+
ref: root,
|
|
628
|
+
class: normalizeClass(["astryx-typeahead-listbox astryx-layer", __props.popupClass]),
|
|
629
|
+
role: isDialog.value ? "dialog" : wrapsList.value ? void 0 : listRole.value,
|
|
630
|
+
"aria-label": isDialog.value ? dialogLabel.value : wrapsList.value ? void 0 : __props.label,
|
|
631
|
+
"data-placement": __props.placement,
|
|
632
|
+
style: normalizeStyle(__props.popupStyle),
|
|
633
|
+
tabindex: "-1",
|
|
634
|
+
onKeydown: _cache[0] || (_cache[0] = ($event) => emit("keydown", $event))
|
|
635
|
+
}, [isDialog.value ? renderSlot(_ctx.$slots, "menu", {
|
|
636
|
+
query: __props.query,
|
|
637
|
+
close: () => emit("close")
|
|
638
|
+
}, void 0, void 0, 0) : wrapsList.value ? renderSlot(_ctx.$slots, "menu", {
|
|
639
|
+
listbox: unref(Listbox),
|
|
640
|
+
query: __props.query,
|
|
641
|
+
isBusy: isBusy.value,
|
|
642
|
+
isEmptySearch: isEmptySearch.value,
|
|
643
|
+
close: () => emit("close")
|
|
644
|
+
}, void 0, void 0, 1) : (openBlock(), createBlock(_sfc_main$1, normalizeProps(mergeProps({ key: 2 }, menuProps.value)), createSlots({ _: 2 }, [_ctx.$slots.item ? {
|
|
645
|
+
name: "item",
|
|
646
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "item", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
647
|
+
key: "0"
|
|
648
|
+
} : void 0, _ctx.$slots.empty ? {
|
|
649
|
+
name: "empty",
|
|
650
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "empty")]),
|
|
651
|
+
key: "1"
|
|
652
|
+
} : void 0]), 1040))], 46, _hoisted_1), [[vShow, __props.isOpen]])]);
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
});
|
|
656
|
+
//#endregion
|
|
510
657
|
//#region src/Typeahead/useTypeaheadAnnouncement.ts
|
|
511
658
|
/**
|
|
512
659
|
* 输入了文字、搜索落定之后,念一句结果数(点名每一条匹配,包括超出 `maxMenuItems`
|
|
@@ -519,7 +666,7 @@ function useTypeaheadAnnouncement(options) {
|
|
|
519
666
|
const createRows = menu.entries.value.filter((entry) => entry.create).length;
|
|
520
667
|
return searchResultMessage({
|
|
521
668
|
isOpen: menu.combobox.isOpen.value,
|
|
522
|
-
isLoading: menu.
|
|
669
|
+
isLoading: !menu.isSettled.value,
|
|
523
670
|
query: menu.query.value,
|
|
524
671
|
matchCount: menu.matchCount.value,
|
|
525
672
|
hasCreateRow: createRows > 0,
|
|
@@ -529,9 +676,106 @@ function useTypeaheadAnnouncement(options) {
|
|
|
529
676
|
});
|
|
530
677
|
});
|
|
531
678
|
watch(message, (next) => {
|
|
532
|
-
if (next)
|
|
679
|
+
if (!next) return;
|
|
680
|
+
options.settleBusy?.();
|
|
681
|
+
announce(next);
|
|
533
682
|
});
|
|
534
683
|
return message;
|
|
535
684
|
}
|
|
536
685
|
//#endregion
|
|
537
|
-
|
|
686
|
+
//#region src/Typeahead/useTypeaheadMenuConfig.ts
|
|
687
|
+
const FOCUSABLE = "a[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
|
|
688
|
+
/**
|
|
689
|
+
* 菜单的角色:结果列表(listbox)或会拿走焦点的内容(dialog),以及用 `open()` 打开它的方法。
|
|
690
|
+
*
|
|
691
|
+
* - dialog 只能由 `open()` 打开,输入、聚焦、方向键都不会;打开后焦点进到里面,
|
|
692
|
+
* Escape 或 `close()` 关掉后焦点回到打开它时的元素,那个元素没了就回到输入框。
|
|
693
|
+
* - listbox 的 `open()` 显示结果,需要时先加载。
|
|
694
|
+
* - 在 `change` 里调用 `open()`:这次选择之后菜单保持打开,换成 dialog 时挂在同一个锚点上不闪。
|
|
695
|
+
*/
|
|
696
|
+
function useTypeaheadMenuConfig(options) {
|
|
697
|
+
const isDialog = computed(() => options.config()?.role === "dialog");
|
|
698
|
+
const dialogOpen = ref(false);
|
|
699
|
+
const popupOpen = computed(() => isDialog.value ? dialogOpen.value : options.listbox.isOpen.value);
|
|
700
|
+
let opener = null;
|
|
701
|
+
let requestedInPick = false;
|
|
702
|
+
function popupHolds(element) {
|
|
703
|
+
return element != null && options.popupEl()?.contains(element) === true;
|
|
704
|
+
}
|
|
705
|
+
/** 焦点掉在菜单里、或没处可去时,才送回打开它的元素。点到别处的焦点不抢。 */
|
|
706
|
+
function restoreFocus() {
|
|
707
|
+
const active = document.activeElement;
|
|
708
|
+
if (active != null && active !== document.body && !popupHolds(active)) return;
|
|
709
|
+
const target = opener?.isConnected ? opener : options.returnTarget?.() ?? options.inputEl();
|
|
710
|
+
opener = null;
|
|
711
|
+
target?.focus();
|
|
712
|
+
}
|
|
713
|
+
function focusInside() {
|
|
714
|
+
const popup = options.popupEl();
|
|
715
|
+
(popup?.querySelector(FOCUSABLE) ?? popup)?.focus();
|
|
716
|
+
}
|
|
717
|
+
function open() {
|
|
718
|
+
if (options.isDisabled()) return;
|
|
719
|
+
const active = document.activeElement;
|
|
720
|
+
opener = active instanceof HTMLElement && !popupHolds(active) ? active : null;
|
|
721
|
+
requestedInPick = true;
|
|
722
|
+
nextTick(() => {
|
|
723
|
+
if (options.isDisabled()) return;
|
|
724
|
+
if (isDialog.value) {
|
|
725
|
+
options.listbox.close();
|
|
726
|
+
dialogOpen.value = true;
|
|
727
|
+
nextTick(focusInside);
|
|
728
|
+
} else if (options.canOpenList()) options.listbox.open();
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
function close() {
|
|
732
|
+
if (dialogOpen.value) {
|
|
733
|
+
dialogOpen.value = false;
|
|
734
|
+
nextTick(restoreFocus);
|
|
735
|
+
} else options.listbox.close();
|
|
736
|
+
}
|
|
737
|
+
function dismiss() {
|
|
738
|
+
dialogOpen.value = false;
|
|
739
|
+
opener = null;
|
|
740
|
+
}
|
|
741
|
+
watch(isDialog, (dialog) => {
|
|
742
|
+
if (!dialog) dialogOpen.value = false;
|
|
743
|
+
});
|
|
744
|
+
watch(() => options.isDisabled(), (disabled) => {
|
|
745
|
+
if (disabled) dialogOpen.value = false;
|
|
746
|
+
});
|
|
747
|
+
watch(popupOpen, (isOpen) => {
|
|
748
|
+
if (!isOpen || isDialog.value) return;
|
|
749
|
+
nextTick(() => {
|
|
750
|
+
const popup = options.popupEl();
|
|
751
|
+
const list = popup?.querySelector("[role=\"listbox\"], [role=\"grid\"]");
|
|
752
|
+
if (!popup || !list) return;
|
|
753
|
+
if ([...popup.querySelectorAll(FOCUSABLE)].some((control) => !list.contains(control) && control !== popup)) devWarn("Typeahead", "a control sits outside the result list in the menu. Anything a person acts on belongs in the list as a result, so the arrow keys reach it.");
|
|
754
|
+
});
|
|
755
|
+
});
|
|
756
|
+
function closeOnEscape(event) {
|
|
757
|
+
if (event.key !== "Escape" || !isDialog.value || !popupOpen.value) return false;
|
|
758
|
+
event.preventDefault();
|
|
759
|
+
event.stopPropagation();
|
|
760
|
+
close();
|
|
761
|
+
return true;
|
|
762
|
+
}
|
|
763
|
+
return {
|
|
764
|
+
isDialog,
|
|
765
|
+
popupOpen,
|
|
766
|
+
open,
|
|
767
|
+
close,
|
|
768
|
+
closeOnEscape,
|
|
769
|
+
dismiss,
|
|
770
|
+
beginPick: () => {
|
|
771
|
+
requestedInPick = false;
|
|
772
|
+
},
|
|
773
|
+
endPick: () => {
|
|
774
|
+
const requested = requestedInPick;
|
|
775
|
+
requestedInPick = false;
|
|
776
|
+
return requested;
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
//#endregion
|
|
781
|
+
export { useLatchedOptionGrid as a, _sfc_main$2 as i, useTypeaheadAnnouncement as n, useTypeaheadMenu as o, _sfc_main as r, useTypeaheadMenuConfig as t };
|
package/package.json
CHANGED
package/styles/dialog-header.css
CHANGED
|
@@ -7,6 +7,18 @@
|
|
|
7
7
|
align-items: flex-start;
|
|
8
8
|
justify-content: space-between;
|
|
9
9
|
gap: var(--astryx-spacing-3, 12px);
|
|
10
|
+
/* 标题的中线对齐关闭按钮的中线:中号按钮的一半,减去它外溢的 spacing-2,再减去标题行高的一半。 */
|
|
11
|
+
--_dialog-header-title-offset: calc(var(--astryx-size-element-md, 32px) / 2 - var(--astryx-spacing-2, 8px) - var(--astryx-text-heading-2-size, 1.25rem) * var(--astryx-text-heading-2-leading, 1.4) / 2);
|
|
12
|
+
--_dialog-header-end-offset: 0px;
|
|
13
|
+
/* 各槽位保留自己相对标题行的垂直偏移;负外边距会让整行比槽位矮,带底色的标题栏就罩不住标题。
|
|
14
|
+
所以整行取最负的那个偏移,各槽位再减去它,差值永远不为负。 */
|
|
15
|
+
--_dialog-header-row-offset: min(var(--_dialog-header-title-offset), var(--_dialog-header-end-offset), 0px);
|
|
16
|
+
margin-block: var(--_dialog-header-row-offset);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* 右侧操作区的视觉内边距由按钮自身承担,整行也读这个偏移。 */
|
|
20
|
+
.astryx-dialog-header--compensate-end-block {
|
|
21
|
+
--_dialog-header-end-offset: calc(-1 * var(--astryx-spacing-2, 8px));
|
|
10
22
|
}
|
|
11
23
|
|
|
12
24
|
.astryx-dialog-header[data-layout-header] {
|
|
@@ -24,8 +36,7 @@
|
|
|
24
36
|
flex: 1 1 auto;
|
|
25
37
|
flex-direction: column;
|
|
26
38
|
min-width: 0;
|
|
27
|
-
|
|
28
|
-
margin-block: calc(var(--astryx-size-element-md, 32px) / 2 - var(--astryx-spacing-2, 8px) - var(--astryx-text-heading-2-size, 1.25rem) * var(--astryx-text-heading-2-leading, 1.4) / 2);
|
|
39
|
+
margin-block: calc(var(--_dialog-header-title-offset) - var(--_dialog-header-row-offset));
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
/* 标题使用 role="heading" 而非 h2,宿主页面对 h2 的全局边框与外边距不会作用到组件上 */
|
|
@@ -54,9 +65,13 @@
|
|
|
54
65
|
gap: var(--astryx-spacing-2, 8px);
|
|
55
66
|
}
|
|
56
67
|
|
|
68
|
+
.astryx-dialog-header-start-content {
|
|
69
|
+
margin-block: calc(0px - var(--_dialog-header-row-offset));
|
|
70
|
+
}
|
|
71
|
+
|
|
57
72
|
/* 关闭按钮的视觉内边距由按钮自身承担,此处抵消以对齐边缘 */
|
|
58
|
-
.astryx-dialog-
|
|
59
|
-
margin-block: calc(-
|
|
73
|
+
.astryx-dialog-header-end-content {
|
|
74
|
+
margin-block: calc(var(--_dialog-header-end-offset) - var(--_dialog-header-row-offset));
|
|
60
75
|
}
|
|
61
76
|
|
|
62
77
|
.astryx-dialog-header__actions--compensate-inline {
|
package/styles/dialog.css
CHANGED
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
.astryx-dialog--fullscreen {
|
|
62
|
+
--_dialog-radius: 0px;
|
|
62
63
|
width: 100dvw;
|
|
63
64
|
height: 100dvh;
|
|
64
65
|
max-width: 100dvw;
|
|
@@ -93,6 +94,9 @@
|
|
|
93
94
|
min-height: 0;
|
|
94
95
|
overflow: hidden;
|
|
95
96
|
border-radius: inherit;
|
|
97
|
+
/* 贴边的表格、列表行取对话框的圆角,免得方角戳出圆角之外。 */
|
|
98
|
+
--_container-corner-block-start: var(--_dialog-radius);
|
|
99
|
+
--_container-corner-block-end: var(--_dialog-radius);
|
|
96
100
|
padding-block: var(--_dialog-pad-block-start) var(--_dialog-pad-block-end);
|
|
97
101
|
padding-inline: var(--_dialog-pad-inline-start) var(--_dialog-pad-inline-end);
|
|
98
102
|
}
|
package/styles/hover-card.css
CHANGED
|
@@ -107,6 +107,12 @@
|
|
|
107
107
|
display: inline;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/* 文本触发器是 Astryx 加上的 Tab 停靠点,自己画共用的焦点环。 */
|
|
111
|
+
.astryx-hover-card__trigger--text:focus-visible {
|
|
112
|
+
outline: 2px solid var(--astryx-color-border-focus, #0074e2);
|
|
113
|
+
outline-offset: 2px;
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
.astryx-hover-card__trigger--indicated {
|
|
111
117
|
text-decoration-line: underline;
|
|
112
118
|
text-decoration-style: dashed;
|
package/styles/motion.css
CHANGED
|
@@ -5,11 +5,21 @@
|
|
|
5
5
|
* their own animations; these names are for later use and for the theme docs.
|
|
6
6
|
* prefers-reduced-motion collapses the distance, scale, and opacity delta to
|
|
7
7
|
* nothing, without rewriting component duration tokens.
|
|
8
|
+
*
|
|
9
|
+
* Reduce Motion splits by pointer, as UIKit does: under
|
|
10
|
+
* `@media (prefers-reduced-motion: reduce) and (pointer: coarse)` a change
|
|
11
|
+
* cross-fades over `--_astryx-reduced-motion-fade-duration` on
|
|
12
|
+
* `--_astryx-reduced-motion-fade-easing`; under
|
|
13
|
+
* `@media (prefers-reduced-motion: reduce) and (not (pointer: coarse))` it
|
|
14
|
+
* lands at once. The fade is a constant, not a theme token (no theme
|
|
15
|
+
* lengthens it); src/motion/reducedMotionCss.ts holds the same values.
|
|
8
16
|
*/
|
|
9
17
|
@layer astryx.reset, astryx.tokens, astryx.base, astryx.components, astryx.overrides;
|
|
10
18
|
|
|
11
19
|
@layer astryx.tokens {
|
|
12
20
|
:root {
|
|
21
|
+
--_astryx-reduced-motion-fade-duration: 200ms;
|
|
22
|
+
--_astryx-reduced-motion-fade-easing: cubic-bezier(0.42, 0, 0.58, 1);
|
|
13
23
|
--astryx-motion-enter-opacity: 0;
|
|
14
24
|
--astryx-motion-exit-opacity: 1;
|
|
15
25
|
--astryx-motion-scale-from: 0.95;
|
package/styles/selector.css
CHANGED
|
@@ -535,6 +535,16 @@
|
|
|
535
535
|
outline: none;
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
/*
|
|
539
|
+
* 幽灵和次要触发器的外框没有边框和聚焦底纹,焦点环画在真正拿到键盘焦点的那一个上:
|
|
540
|
+
* 触发器聚焦时环画在外框,清除按钮聚焦时环画在它自己身上,不会两个一起圈。
|
|
541
|
+
*/
|
|
542
|
+
.astryx-selector-field:is(.is-ghost, [data-variant='secondary']):has(.astryx-selector-trigger:focus-visible),
|
|
543
|
+
.astryx-selector-field:is(.is-ghost, [data-variant='secondary']) .astryx-selector-clear:focus-visible {
|
|
544
|
+
outline: var(--astryx-focus-outline-width, 2px) var(--astryx-focus-outline-style, solid) var(--astryx-focus-outline-color, currentcolor);
|
|
545
|
+
outline-offset: 2px;
|
|
546
|
+
}
|
|
547
|
+
|
|
538
548
|
/* 强制颜色下焦点只剩边框能表达:聚焦(含可聚焦的禁用字段)的边框取系统 Highlight 色。 */
|
|
539
549
|
@layer astryx.components {
|
|
540
550
|
@media (forced-colors: active) {
|
package/styles/toast.css
CHANGED
|
@@ -26,10 +26,29 @@
|
|
|
26
26
|
--astryx-toast-motion-duration: var(--astryx-duration-fast-max, 165ms);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/* 触屏上下沿至少让开 34px:Face ID iPhone 竖屏的底部安全区,Safari 只在页面设了
|
|
30
|
+
viewport-fit=cover 时才报告它。 */
|
|
31
|
+
@media (pointer: coarse) {
|
|
32
|
+
.astryx-toast-viewport {
|
|
33
|
+
--_toast-bottom-floor: 34px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.astryx-toast-viewport--placement-bottom-start,
|
|
38
|
+
.astryx-toast-viewport--placement-bottom-center,
|
|
39
|
+
.astryx-toast-viewport--placement-bottom-end {
|
|
40
|
+
padding-block-end: calc(var(--astryx-spacing-4, 16px) + max(env(safe-area-inset-bottom, 0px), var(--_toast-bottom-floor, 0px)));
|
|
41
|
+
}
|
|
42
|
+
|
|
29
43
|
.astryx-toast-viewport > * {
|
|
30
44
|
pointer-events: auto;
|
|
31
45
|
}
|
|
32
46
|
|
|
47
|
+
/* iOS Safari 按贴着屏幕下沿的固定元素给工具栏取色,没有提示的视口不占盒子。 */
|
|
48
|
+
.astryx-toast-viewport--empty {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
33
52
|
/* 视口搬进/搬出模态对话框时,节点等于重新插入文档,浏览器会把 `@starting-style`
|
|
34
53
|
里的进场动画重放一遍:toast 会在原来的位置上下一跳。搬的这一帧先关掉过渡。 */
|
|
35
54
|
.astryx-toast-viewport--rehosting,
|
package/styles/tooltip.css
CHANGED
|
@@ -57,6 +57,12 @@
|
|
|
57
57
|
display: inline;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/* 文本触发器是 Astryx 加上的 Tab 停靠点,自己画共用的焦点环。 */
|
|
61
|
+
.astryx-tooltip-trigger.astryx-tooltip-trigger--text:focus-visible {
|
|
62
|
+
outline: 2px solid var(--astryx-color-border-focus, #0074e2);
|
|
63
|
+
outline-offset: 2px;
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
.astryx-tooltip-trigger--indicated {
|
|
61
67
|
text-decoration-line: underline;
|
|
62
68
|
text-decoration-style: dashed;
|