@astryx-vue/core 0.2.1 → 0.2.3
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/THIRD_PARTY_NOTICES.md +2 -0
- package/dist/AppShell/index.d.ts +1 -1
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-1wNIEtK_.js → AppShell-Dd-D4bA2.js} +2 -2
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/Badge/index.d.ts +2 -1
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.d.ts +3 -2
- package/dist/Breadcrumbs/index.js +3 -2
- package/dist/{Breadcrumbs-C97HmjkC.js → Breadcrumbs-CWGfgLNK.js} +13 -8
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +2 -2
- package/dist/Calendar/index.js +1 -1
- package/dist/Calendar-CnOsSjMY.js +656 -0
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-BGUnskjo.js → Carousel-JA7ilqI_.js} +2 -2
- package/dist/Chat/index.d.ts +2 -2
- package/dist/Chat/index.js +2 -2
- package/dist/Chat-C7WrCOE4.js +3148 -0
- package/dist/CheckboxIndicator/index.js +1 -1
- package/dist/CheckboxIndicator-D37cm2Rh.js +68 -0
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-CMsEE1_4.js → CheckboxInput-25Q8ItH-.js} +10 -9
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxList-BbCPiend.js → CheckboxList-CnCGnkZk.js} +77 -24
- package/dist/Citation/index.js +1 -1
- package/dist/{Citation-DunoAqVH.js → Citation-CtwrU33I.js} +2 -2
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/Code/index.js +2 -2
- package/dist/{Code-yb_KOFtJ.js → Code-BvefYRpx.js} +2 -1
- package/dist/{CodeBlock-CAF-VJnh.js → CodeBlock-BZGzYeoL.js} +1 -1
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/Collapsible/index.js +1 -1
- package/dist/{Collapsible-DvMiYJp7.js → Collapsible-3YerR-FO.js} +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-xfm9ldUI.js → CommandPalette-BNbM9T9y.js} +1 -1
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-B6lBTRhP.js → ComplexSelector-LtbLlrcj.js} +3 -3
- package/dist/ContextMenu/index.d.ts +3 -2
- package/dist/ContextMenu/index.js +3 -2
- package/dist/{ContextMenu-DUkED3Z3.js → ContextMenu-DVQl0xL5.js} +204 -56
- package/dist/DateInput/index.d.ts +2 -2
- package/dist/DateInput/index.js +1 -1
- package/dist/DateInput-zm8sNc0t.js +743 -0
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-e9KSxBBK.js → DateRangeInput-DlVFzrf7.js} +54 -19
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-fSOfuLex.js → DateTimeInput-C7Z-p6Yd.js} +54 -15
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Divider/index.d.ts +1 -1
- package/dist/DropdownMenu/index.d.ts +3 -3
- package/dist/DropdownMenu/index.js +4 -3
- package/dist/{DropdownMenu-8G0B1UND.js → DropdownMenu-BoZChdev.js} +308 -63
- package/dist/DropdownMenu-u1psFjis.js +325 -0
- package/dist/DropdownMenuRadioItem.vue-uVM0FD2f.d.ts +564 -0
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-D-fchyQH.js → FileInput-QdlZn7qK.js} +2 -2
- package/dist/Icon/index.d.ts +4 -3
- package/dist/Icon/index.js +2 -2
- package/dist/{Icon-Bku25g_K.js → Icon-bteSId7T.js} +114 -14
- package/dist/Indicator/index.d.ts +3 -0
- package/dist/Indicator/index.js +2 -0
- package/dist/InputGroup/index.d.ts +2 -2
- package/dist/InputGroup/index.js +3 -2
- package/dist/InputGroup-BzR6JRZb.js +129 -0
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-uuVGgHxW.js → Lightbox-BSzfqZ-u.js} +2 -2
- package/dist/List/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-DLICa3db.js → Markdown-B6tSqenv.js} +8 -5
- package/dist/MetadataList/index.d.ts +1 -1
- package/dist/MetadataList/index.js +1 -1
- package/dist/{MetadataList-h492rqEN.js → MetadataList-aN1tRn6W.js} +1 -1
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-BMj3Wtuq.js → MobileNavToggle-fqcSafkc.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-DkYi5az5.js → MoreMenu-B3brqdK_.js} +1 -1
- package/dist/MultiSelector/index.d.ts +2 -2
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-C2IS-EaU.js → MultiSelector-BD5PMgez.js} +303 -121
- package/dist/{NavDisclosure-DHrSNRDR.js → NavDisclosure-DbYLDXK0.js} +1 -1
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NavMenu/index.js +2 -2
- package/dist/{NavMenuItem-B-k7olt5.js → NavMenuItem-DrwIMHKO.js} +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-CjfAsFwj.js → NumberInput-CBeU4lEl.js} +1 -1
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-BTmrtvXR.js → Outline--HVMSB6i.js} +1 -1
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-CRE8BE7V.js → OverflowList-FMh7r-r_.js} +3 -3
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BpGXPmc7.js → Pagination-DlIvESjx.js} +2 -2
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-Crhk9PNP.js → Popover-D7zqpFwU.js} +1 -1
- package/dist/PowerSearch/index.d.ts +2 -0
- package/dist/PowerSearch/index.js +2 -0
- package/dist/PowerSearch-CMG7Rb69.js +2386 -0
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-BqjdSCfJ.js → RadioGroup-CBqUPq_L.js} +16 -8
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioList-DI8ujXcT.js → RadioList-CPOJn9Th.js} +1 -1
- package/dist/Resizable/index.d.ts +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{Resizable-CE8XQDL2.js → Resizable-CXpvj1TZ.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 +2 -2
- package/dist/Selector/index.js +1 -1
- package/dist/Selector-BpPnuWH3.js +618 -0
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-DcDWBnXJ.js → SideNav-D4TupqgE.js} +3 -3
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Stepper/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-DZKaqEoz.js → Stepper-H-6-T5Ps.js} +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-hm06QPiW.js → TabList-BlzkrObv.js} +2 -2
- package/dist/Table/index.d.ts +3 -3
- package/dist/Table/index.js +2 -2
- package/dist/Table-nqA_njNz.js +1982 -0
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/Theme/index.d.ts +2 -1
- package/dist/Theme/index.js +1 -1
- package/dist/{Theme-BuUiiJNr.js → Theme-CejS9MHm.js} +21 -3
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-CAOYds8t.js → Thumbnail-CXb3m_Hv.js} +2 -2
- package/dist/{TimeField-BGbxCoKU.js → TimeField-B3cndWb0.js} +2 -2
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-DJP3l4ZS.js → TimeInput-BHQ_LKGm.js} +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-BzRp8uWc.js → Timestamp-Cfuxbb3i.js} +3 -3
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-CjocuhzE.js → Token-CdVLH0_H.js} +2 -2
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-mYES5SPM.js → Tokenizer-DlD-S_8-.js} +4 -4
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-C2t6JkZb.js → TopNav-DzV874G7.js} +5 -5
- package/dist/TreeList/index.d.ts +1 -1
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-THJ0KamE.js → TreeList-DEwvlZRV.js} +2 -2
- package/dist/Typeahead/index.d.ts +1 -1
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-D7VnvRpK.js → Typeahead-DQ3tmqYe.js} +4 -4
- package/dist/{useTypeaheadMenu-Ba7XpcZl.js → TypeaheadMenu-CGvo0Tud.js} +107 -107
- package/dist/{context-O2Vb8cJl.js → colorMode-CBgdgDSn.js} +1 -7
- package/dist/composables/index.d.ts +4 -4
- package/dist/composables/index.js +10 -5
- package/dist/{composables-CVfjp9h4.js → composables-DDI08XFF.js} +98 -1
- package/dist/context-Cws_tXTr.js +7 -0
- package/dist/context-D5-MwxnN.js +4 -0
- package/dist/{context-DzcK4T_C.js → context-DmOLCubj.js} +262 -12
- package/dist/{index-DimuSES0.d.ts → index-B1x05arQ.d.ts} +3 -1
- package/dist/index-B9WzWqzk.d.ts +18 -0
- package/dist/index-B9f1rUEv.d.ts +77 -0
- package/dist/{index-DnSrjbjP.d.ts → index-BB5yVIN-.d.ts} +2 -2
- package/dist/{index-Bu0Zd1uw.d.ts → index-BMn9ghAX.d.ts} +3 -3
- package/dist/{index-CJlBAXwj.d.ts → index-BRfR0lhb.d.ts} +41 -4
- package/dist/{index-DeOftUMq.d.ts → index-BTAgQRP0.d.ts} +762 -114
- package/dist/{index-DA52oIdw.d.ts → index-BcJBLWJ0.d.ts} +2 -2
- package/dist/{index-jdjcb3Js.d.ts → index-Bqb_Fyju.d.ts} +2 -2
- package/dist/{index-CNjbOgty.d.ts → index-C-QpeUlQ.d.ts} +2 -2
- package/dist/{index-I4J7gwa1.d.ts → index-C2sfHfBw.d.ts} +31 -5
- package/dist/{index-By2mSzUA.d.ts → index-CA6RbRWx.d.ts} +1 -1
- package/dist/{index-DnEh-HA0.d.ts → index-C_2Z65Rp.d.ts} +1 -1
- package/dist/{index-cG1E0U2s.d.ts → index-Ca8VIE4l.d.ts} +1 -1
- package/dist/{index-CRizexSC.d.ts → index-Ch6BbxCP.d.ts} +2 -67
- package/dist/{index-CBym0hSq.d.ts → index-ChWlKHjc.d.ts} +1 -1
- package/dist/{index-DXSs3rwa.d.ts → index-CngORuiq.d.ts} +137 -2
- package/dist/index-Ctu32CLv.d.ts +902 -0
- package/dist/{index-DQAnGHu7.d.ts → index-D1Twv_fL.d.ts} +65 -6
- package/dist/{index-D_nYxnNv.d.ts → index-D7-WTV6I.d.ts} +1 -1
- package/dist/{index-c_TaW8mM.d.ts → index-D8o50qOE.d.ts} +1 -1
- package/dist/index-DMQG6kdM.d.ts +416 -0
- package/dist/index-D_UEJIU5.d.ts +83 -0
- package/dist/{index-D2bSSSBP.d.ts → index-DkVEBdWa.d.ts} +2 -2
- package/dist/{index-SMh42NI8.d.ts → index-DxsKyAxq.d.ts} +118 -46
- package/dist/{index-BHqRH7QW.d.ts → index-FEy8qFSD.d.ts} +2 -2
- package/dist/{index-Byar3h1e.d.ts → index-HV6W3xCx.d.ts} +1 -1
- package/dist/{index-Clmz00IK.d.ts → index-LIyvJTW3.d.ts} +63 -0
- package/dist/{index-BKr7yvVv.d.ts → index-MPcg1Pm4.d.ts} +1 -1
- package/dist/{index-cGagYM1g.d.ts → index-ViSV0RBx.d.ts} +1 -1
- package/dist/{index-Z_onS2lR.d.ts → index-f4NGT-e2.d.ts} +3 -3
- package/dist/{index-DsyKhauk.d.ts → index-foQMNKZO.d.ts} +1 -1
- package/dist/{index-1uRMrk63.d.ts → index-nCEmW6wa.d.ts} +1 -1
- package/dist/{index-NOXYEdOI.d.ts → index-utZGF4GR.d.ts} +1 -1
- package/dist/{index-3p2BDVHq.d.ts → index-vP0EtrJJ.d.ts} +13 -3
- package/dist/{index-CZeoAr0a.d.ts → index-xfkEuGLY.d.ts} +2 -2
- package/dist/index.d.ts +81 -78
- package/dist/index.js +122 -106
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +2 -2
- package/dist/{locale-Cpk_nrLA.js → locale-CCwVnyMZ.js} +25 -1
- package/dist/power-search-DrDfcoL1.d.ts +68 -0
- package/dist/searchResultMessage-DN0HeRRB.js +94 -0
- package/dist/semantic-CKH9XVqa.d.ts +54 -0
- package/dist/{types-JktRxujg.d.ts → types-Cp4liug-.d.ts} +66 -3
- package/dist/{types-BKcxXW--.d.ts → types-CwyibrRB.d.ts} +12 -11
- package/dist/types-DIYwbkpe.d.ts +33 -0
- package/dist/types-jmqqnkKA.d.ts +163 -0
- package/dist/{useAnchoredListbox-7W90Ny-9.js → useAnchoredListbox-BN9LQnon.js} +1 -1
- package/dist/useDatePresentation-C07PnOCw.js +21 -0
- package/dist/{useMonthGrid-CmJsZTcB.js → useDateRange-CIXoE_8k.js} +1 -42
- package/dist/useDisclosureHandle-Df3HhAfC.js +24 -0
- package/dist/{useDismiss-CAiHU6QD.js → useDismiss-Cj8x_51F.js} +8 -4
- package/dist/useFieldControlState-voICDrys.js +18 -0
- package/dist/useHandleRef-6cdKugm8.js +17 -0
- package/dist/useIndicator-i1NORM7W.js +147 -0
- package/dist/useMenuDrillIn-OaEwjK44.js +520 -0
- package/dist/useMonthGrid-fGHSSrFc.js +43 -0
- package/dist/usePendingChange-ib-h8FZK.js +25 -0
- package/dist/{useResizable-CeESZS1v.d.ts → useResizable-CUoNPmUw.d.ts} +1 -1
- package/dist/useSubmenuMode-CZN9qrUo.js +37 -0
- package/package.json +9 -1
- package/styles/calendar.css +38 -3
- package/styles/chat.css +469 -1
- package/styles/check-indicator.css +17 -0
- package/styles/checkbox-indicator.css +29 -10
- package/styles/checkbox-input.css +0 -11
- package/styles/date-input.css +48 -0
- package/styles/dropdown-menu.css +163 -0
- package/styles/field.css +48 -0
- package/styles/icon.css +69 -1
- package/styles/input-group.css +32 -3
- package/styles/multi-selector.css +26 -0
- package/styles/power-search.css +303 -0
- package/styles/radio-indicator.css +90 -0
- package/styles/radio.css +9 -42
- package/styles/selector.css +112 -14
- package/styles/table.css +304 -1
- package/styles.css +3 -0
- package/dist/Calendar-DqC3EDN1.js +0 -352
- package/dist/Chat-DCjXRiOF.js +0 -1051
- package/dist/CheckboxIndicator-DdJmksHt.js +0 -52
- package/dist/DateInput-Crcg-CCj.js +0 -376
- package/dist/DropdownMenu-XvW4BJob.js +0 -164
- package/dist/InputGroup-ChrFVxzV.js +0 -42
- package/dist/Selector-DkJOLZSR.js +0 -468
- package/dist/Table-DwehtMap.js +0 -967
- package/dist/index-BLOEjvaM.d.ts +0 -398
- package/dist/index-Bgv4ZmBl.d.ts +0 -72
- package/dist/index-CuFLztiI.d.ts +0 -49
- package/dist/index-DJo-BmXZ.d.ts +0 -431
- package/dist/index-IbUN4M8V.d.ts +0 -40
- package/dist/types-DDAAT1Xd.d.ts +0 -285
- package/dist/useGridRovingFocus-DQQAOYH5.js +0 -99
- /package/dist/{index-BUXNRekN.d.ts → index-BXkNZF3q.d.ts} +0 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import { t as _sfc_main$4 } from "./Icon-bteSId7T.js";
|
|
2
|
+
import { t as _sfc_main$5 } from "./Item-C1z6gXn8.js";
|
|
3
|
+
import { t as _sfc_main$6 } from "./CheckboxIndicator-D37cm2Rh.js";
|
|
4
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, mergeModels, openBlock, provide, ref, renderSlot, toDisplayString, unref, useModel, useSlots, watch, withCtx } from "vue";
|
|
5
|
+
import "../styles/dropdown-menu.css";
|
|
6
|
+
//#region src/DropdownMenu/MenuSelectionMark.vue
|
|
7
|
+
const _hoisted_1$3 = { class: "astryx-dropdown-menu-mark" };
|
|
8
|
+
const _hoisted_2$2 = [
|
|
9
|
+
"data-checked",
|
|
10
|
+
"data-disabled",
|
|
11
|
+
"data-size"
|
|
12
|
+
];
|
|
13
|
+
const _sfc_main$3 = /*@__PURE__*/ defineComponent({
|
|
14
|
+
name: "AstryxMenuSelectionMark",
|
|
15
|
+
__name: "MenuSelectionMark",
|
|
16
|
+
props: {
|
|
17
|
+
kind: {},
|
|
18
|
+
checked: { type: Boolean },
|
|
19
|
+
size: { default: "md" },
|
|
20
|
+
isDisabled: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
setup(__props) {
|
|
26
|
+
return (_ctx, _cache) => {
|
|
27
|
+
return openBlock(), createElementBlock("span", _hoisted_1$3, [__props.kind === "checkbox" ? (openBlock(), createBlock(_sfc_main$6, {
|
|
28
|
+
key: 0,
|
|
29
|
+
"is-disabled": __props.isDisabled,
|
|
30
|
+
size: __props.size,
|
|
31
|
+
state: __props.checked ? "checked" : "unchecked"
|
|
32
|
+
}, null, 8, [
|
|
33
|
+
"is-disabled",
|
|
34
|
+
"size",
|
|
35
|
+
"state"
|
|
36
|
+
])) : (openBlock(), createElementBlock("span", {
|
|
37
|
+
key: 1,
|
|
38
|
+
class: "astryx-dropdown-menu-radio",
|
|
39
|
+
"data-checked": __props.checked ? "checked" : void 0,
|
|
40
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
41
|
+
"data-size": __props.size,
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}, [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "astryx-dropdown-menu-radio-dot" }, null, -1)])], 8, _hoisted_2$2))]);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/ContextMenu/context.ts
|
|
49
|
+
const contextMenuContextKey = Symbol("astryx-context-menu");
|
|
50
|
+
/**
|
|
51
|
+
* Whether the submenu flyout that contains this one is showing.
|
|
52
|
+
*
|
|
53
|
+
* Nested flyouts are teleported to `body`, so hiding an ancestor's DOM does
|
|
54
|
+
* not hide them. Each submenu provides its own `showsFlyout` for the next
|
|
55
|
+
* level; a row with no ancestor submenu reads as open.
|
|
56
|
+
*/
|
|
57
|
+
const submenuAncestorOpenKey = Symbol("astryx-submenu-ancestor-open");
|
|
58
|
+
/** The surrounding menu, or `undefined` when the row stands alone. */
|
|
59
|
+
function useContextMenu() {
|
|
60
|
+
return inject(contextMenuContextKey, void 0);
|
|
61
|
+
}
|
|
62
|
+
/** The row density of the surrounding menu, or the menu default. */
|
|
63
|
+
function useContextMenuSize() {
|
|
64
|
+
const menu = useContextMenu();
|
|
65
|
+
return computed(() => menu?.menuSize.value ?? "md");
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/DropdownMenu/context.ts
|
|
69
|
+
const dropdownMenuContextKey = Symbol("astryx-dropdown-menu-context");
|
|
70
|
+
/** The surrounding menu, or `undefined` when a row stands alone. */
|
|
71
|
+
function useDropdownMenuContext() {
|
|
72
|
+
return inject(dropdownMenuContextKey, void 0);
|
|
73
|
+
}
|
|
74
|
+
const dropdownMenuRadioGroupKey = Symbol("astryx-dropdown-menu-radio-group");
|
|
75
|
+
/** The radio group around this row, or `undefined` when there is none. */
|
|
76
|
+
function useDropdownMenuRadioGroup() {
|
|
77
|
+
return inject(dropdownMenuRadioGroupKey, void 0);
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/DropdownMenu/useMenuSelectableRow.ts
|
|
81
|
+
/**
|
|
82
|
+
* Activation shared by a checkbox row and a radio row.
|
|
83
|
+
*
|
|
84
|
+
* The row owns the role and the checked state. The marker is decorative, so
|
|
85
|
+
* the click always lands on the row. A disabled row stays in the tree and
|
|
86
|
+
* refuses the toggle.
|
|
87
|
+
*/
|
|
88
|
+
function useMenuSelectableRow(options) {
|
|
89
|
+
const dropdown = useDropdownMenuContext();
|
|
90
|
+
const contextMenu = useContextMenu();
|
|
91
|
+
const menuSize = computed(() => contextMenu?.menuSize.value ?? dropdown?.menuSize.value ?? "md");
|
|
92
|
+
const controlSize = computed(() => menuSize.value === "sm" ? "sm" : "md");
|
|
93
|
+
const density = computed(() => menuSize.value === "sm" ? "compact" : "balanced");
|
|
94
|
+
const inContextMenu = computed(() => contextMenu != null);
|
|
95
|
+
function closeHost() {
|
|
96
|
+
if (!options.hasCloseOnSelect.value) return;
|
|
97
|
+
if (contextMenu != null) contextMenu.closeMenu();
|
|
98
|
+
else dropdown?.closeMenu();
|
|
99
|
+
}
|
|
100
|
+
function handleClick(event) {
|
|
101
|
+
if (options.isDisabled.value) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
options.onActivate();
|
|
106
|
+
closeHost();
|
|
107
|
+
}
|
|
108
|
+
function handlePointerMove(event) {
|
|
109
|
+
if (options.isDisabled.value || event.pointerType !== "mouse") return;
|
|
110
|
+
const row = event.currentTarget;
|
|
111
|
+
if (row instanceof HTMLElement && row !== row.ownerDocument.activeElement) row.focus({ preventScroll: true });
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
controlSize,
|
|
115
|
+
density,
|
|
116
|
+
handleClick,
|
|
117
|
+
handlePointerMove,
|
|
118
|
+
inContextMenu,
|
|
119
|
+
menuSize
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/DropdownMenu/DropdownMenuCheckboxItem.vue
|
|
124
|
+
const _hoisted_1$2 = [
|
|
125
|
+
"aria-checked",
|
|
126
|
+
"aria-disabled",
|
|
127
|
+
"data-disabled",
|
|
128
|
+
"data-size",
|
|
129
|
+
"tabindex"
|
|
130
|
+
];
|
|
131
|
+
const _hoisted_2$1 = {
|
|
132
|
+
key: 0,
|
|
133
|
+
class: "astryx-context-menu-item__start"
|
|
134
|
+
};
|
|
135
|
+
const _hoisted_3$1 = { class: "astryx-context-menu-item__content" };
|
|
136
|
+
const _hoisted_4$1 = {
|
|
137
|
+
key: 0,
|
|
138
|
+
class: "astryx-context-menu-item__label",
|
|
139
|
+
"data-menu-item-label": ""
|
|
140
|
+
};
|
|
141
|
+
const _hoisted_5$1 = {
|
|
142
|
+
key: 1,
|
|
143
|
+
class: "astryx-context-menu-item__description"
|
|
144
|
+
};
|
|
145
|
+
const _hoisted_6$1 = {
|
|
146
|
+
key: 1,
|
|
147
|
+
class: "astryx-context-menu-item__end"
|
|
148
|
+
};
|
|
149
|
+
const _sfc_main$2 = /*@__PURE__*/ defineComponent({
|
|
150
|
+
name: "AstryxDropdownMenuCheckboxItem",
|
|
151
|
+
inheritAttrs: false,
|
|
152
|
+
__name: "DropdownMenuCheckboxItem",
|
|
153
|
+
props: /*@__PURE__*/ mergeModels({
|
|
154
|
+
label: {},
|
|
155
|
+
description: {},
|
|
156
|
+
icon: {},
|
|
157
|
+
isDisabled: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
default: false
|
|
160
|
+
},
|
|
161
|
+
hasCloseOnSelect: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
164
|
+
}
|
|
165
|
+
}, {
|
|
166
|
+
"modelValue": {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
required: true
|
|
169
|
+
},
|
|
170
|
+
"modelModifiers": {}
|
|
171
|
+
}),
|
|
172
|
+
emits: /*@__PURE__*/ mergeModels(["change"], ["update:modelValue"]),
|
|
173
|
+
setup(__props, { emit: __emit }) {
|
|
174
|
+
const props = __props;
|
|
175
|
+
const emit = __emit;
|
|
176
|
+
const checked = useModel(__props, "modelValue");
|
|
177
|
+
const slots = useSlots();
|
|
178
|
+
const { controlSize, density, handleClick, handlePointerMove, inContextMenu, menuSize } = useMenuSelectableRow({
|
|
179
|
+
hasCloseOnSelect: computed(() => props.hasCloseOnSelect),
|
|
180
|
+
isDisabled: computed(() => props.isDisabled),
|
|
181
|
+
onActivate: () => {
|
|
182
|
+
const next = !checked.value;
|
|
183
|
+
checked.value = next;
|
|
184
|
+
emit("change", next);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
const hasStart = computed(() => slots.icon != null || props.icon != null);
|
|
188
|
+
const hasLabel = computed(() => slots.label != null || props.label != null);
|
|
189
|
+
const hasDescription = computed(() => slots.description != null || props.description != null);
|
|
190
|
+
const hasEnd = computed(() => slots.endContent != null);
|
|
191
|
+
return (_ctx, _cache) => {
|
|
192
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/interactive-supports-focus -- The menu owns Enter, Space, and the arrows. tabindex is -1 while the row is enabled and removed while disabled. "), unref(inContextMenu) ? (openBlock(), createElementBlock("div", {
|
|
193
|
+
key: 0,
|
|
194
|
+
class: "astryx-context-menu-item",
|
|
195
|
+
role: "menuitemcheckbox",
|
|
196
|
+
"aria-checked": checked.value,
|
|
197
|
+
"aria-disabled": __props.isDisabled || void 0,
|
|
198
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
199
|
+
"data-size": unref(menuSize),
|
|
200
|
+
tabindex: __props.isDisabled ? void 0 : -1,
|
|
201
|
+
onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args)),
|
|
202
|
+
onPointermove: _cache[1] || (_cache[1] = (...args) => unref(handlePointerMove) && unref(handlePointerMove)(...args))
|
|
203
|
+
}, [
|
|
204
|
+
createVNode(_sfc_main$3, {
|
|
205
|
+
kind: "checkbox",
|
|
206
|
+
checked: checked.value,
|
|
207
|
+
"is-disabled": __props.isDisabled,
|
|
208
|
+
size: unref(controlSize)
|
|
209
|
+
}, null, 8, [
|
|
210
|
+
"checked",
|
|
211
|
+
"is-disabled",
|
|
212
|
+
"size"
|
|
213
|
+
]),
|
|
214
|
+
hasStart.value ? (openBlock(), createElementBlock("span", _hoisted_2$1, [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$4, {
|
|
215
|
+
color: "secondary",
|
|
216
|
+
icon: __props.icon,
|
|
217
|
+
size: "sm"
|
|
218
|
+
}, null, 8, ["icon"])])])) : createCommentVNode("v-if", true),
|
|
219
|
+
createElementVNode("span", _hoisted_3$1, [hasLabel.value ? (openBlock(), createElementBlock("span", _hoisted_4$1, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])])) : createCommentVNode("v-if", true), hasDescription.value ? (openBlock(), createElementBlock("span", _hoisted_5$1, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])])) : createCommentVNode("v-if", true)]),
|
|
220
|
+
hasEnd.value ? (openBlock(), createElementBlock("span", _hoisted_6$1, [renderSlot(_ctx.$slots, "endContent")])) : createCommentVNode("v-if", true)
|
|
221
|
+
], 40, _hoisted_1$2)) : (openBlock(), createBlock(_sfc_main$5, {
|
|
222
|
+
key: 1,
|
|
223
|
+
class: "astryx-dropdown-menu-item",
|
|
224
|
+
role: "menuitemcheckbox",
|
|
225
|
+
"aria-checked": checked.value,
|
|
226
|
+
"data-menu-size": unref(menuSize),
|
|
227
|
+
"data-variant": "default",
|
|
228
|
+
density: unref(density),
|
|
229
|
+
description: __props.description,
|
|
230
|
+
"is-disabled": __props.isDisabled,
|
|
231
|
+
label: __props.label,
|
|
232
|
+
"on-click": unref(handleClick),
|
|
233
|
+
tabindex: __props.isDisabled ? void 0 : -1,
|
|
234
|
+
onPointermove: unref(handlePointerMove)
|
|
235
|
+
}, createSlots({
|
|
236
|
+
marker: withCtx(() => [createVNode(_sfc_main$3, {
|
|
237
|
+
kind: "checkbox",
|
|
238
|
+
checked: checked.value,
|
|
239
|
+
"is-disabled": __props.isDisabled,
|
|
240
|
+
size: unref(controlSize)
|
|
241
|
+
}, null, 8, [
|
|
242
|
+
"checked",
|
|
243
|
+
"is-disabled",
|
|
244
|
+
"size"
|
|
245
|
+
])]),
|
|
246
|
+
_: 2
|
|
247
|
+
}, [
|
|
248
|
+
hasStart.value ? {
|
|
249
|
+
name: "startContent",
|
|
250
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$4, {
|
|
251
|
+
color: "secondary",
|
|
252
|
+
icon: __props.icon,
|
|
253
|
+
size: "sm"
|
|
254
|
+
}, null, 8, ["icon"])])]),
|
|
255
|
+
key: "0"
|
|
256
|
+
} : void 0,
|
|
257
|
+
unref(slots).label ? {
|
|
258
|
+
name: "label",
|
|
259
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "label")]),
|
|
260
|
+
key: "1"
|
|
261
|
+
} : void 0,
|
|
262
|
+
unref(slots).description ? {
|
|
263
|
+
name: "description",
|
|
264
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "description")]),
|
|
265
|
+
key: "2"
|
|
266
|
+
} : void 0,
|
|
267
|
+
hasEnd.value ? {
|
|
268
|
+
name: "endContent",
|
|
269
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "endContent")]),
|
|
270
|
+
key: "3"
|
|
271
|
+
} : void 0
|
|
272
|
+
]), 1032, [
|
|
273
|
+
"aria-checked",
|
|
274
|
+
"data-menu-size",
|
|
275
|
+
"density",
|
|
276
|
+
"description",
|
|
277
|
+
"is-disabled",
|
|
278
|
+
"label",
|
|
279
|
+
"on-click",
|
|
280
|
+
"tabindex",
|
|
281
|
+
"onPointermove"
|
|
282
|
+
]))], 2112);
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/DropdownMenu/DropdownMenuRadioGroup.vue
|
|
288
|
+
const _hoisted_1$1 = ["aria-label"];
|
|
289
|
+
const _sfc_main$1 = /*@__PURE__*/ defineComponent({
|
|
290
|
+
name: "AstryxDropdownMenuRadioGroup",
|
|
291
|
+
inheritAttrs: false,
|
|
292
|
+
__name: "DropdownMenuRadioGroup",
|
|
293
|
+
props: /*@__PURE__*/ mergeModels({
|
|
294
|
+
label: {},
|
|
295
|
+
hasCloseOnSelect: {
|
|
296
|
+
type: Boolean,
|
|
297
|
+
default: true
|
|
298
|
+
}
|
|
299
|
+
}, {
|
|
300
|
+
"modelValue": {},
|
|
301
|
+
"modelModifiers": {}
|
|
302
|
+
}),
|
|
303
|
+
emits: /*@__PURE__*/ mergeModels(["change"], ["update:modelValue"]),
|
|
304
|
+
setup(__props, { emit: __emit }) {
|
|
305
|
+
const props = __props;
|
|
306
|
+
const emit = __emit;
|
|
307
|
+
const selected = useModel(__props, "modelValue");
|
|
308
|
+
provide(dropdownMenuRadioGroupKey, {
|
|
309
|
+
hasCloseOnSelect: computed(() => props.hasCloseOnSelect),
|
|
310
|
+
select: (value) => {
|
|
311
|
+
selected.value = value;
|
|
312
|
+
emit("change", value);
|
|
313
|
+
},
|
|
314
|
+
value: computed(() => selected.value)
|
|
315
|
+
});
|
|
316
|
+
return (_ctx, _cache) => {
|
|
317
|
+
return openBlock(), createElementBlock("div", {
|
|
318
|
+
class: "astryx-dropdown-menu-radio-group",
|
|
319
|
+
role: "group",
|
|
320
|
+
"aria-label": __props.label
|
|
321
|
+
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$1);
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/DropdownMenu/DropdownMenuRadioItem.vue
|
|
327
|
+
const _hoisted_1 = [
|
|
328
|
+
"aria-checked",
|
|
329
|
+
"aria-disabled",
|
|
330
|
+
"data-disabled",
|
|
331
|
+
"data-size",
|
|
332
|
+
"tabindex"
|
|
333
|
+
];
|
|
334
|
+
const _hoisted_2 = {
|
|
335
|
+
key: 0,
|
|
336
|
+
class: "astryx-context-menu-item__start"
|
|
337
|
+
};
|
|
338
|
+
const _hoisted_3 = { class: "astryx-context-menu-item__content" };
|
|
339
|
+
const _hoisted_4 = {
|
|
340
|
+
key: 0,
|
|
341
|
+
class: "astryx-context-menu-item__label",
|
|
342
|
+
"data-menu-item-label": ""
|
|
343
|
+
};
|
|
344
|
+
const _hoisted_5 = {
|
|
345
|
+
key: 1,
|
|
346
|
+
class: "astryx-context-menu-item__description"
|
|
347
|
+
};
|
|
348
|
+
const _hoisted_6 = {
|
|
349
|
+
key: 1,
|
|
350
|
+
class: "astryx-context-menu-item__end"
|
|
351
|
+
};
|
|
352
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
353
|
+
name: "AstryxDropdownMenuRadioItem",
|
|
354
|
+
inheritAttrs: false,
|
|
355
|
+
__name: "DropdownMenuRadioItem",
|
|
356
|
+
props: {
|
|
357
|
+
value: {},
|
|
358
|
+
label: {},
|
|
359
|
+
description: {},
|
|
360
|
+
icon: {},
|
|
361
|
+
isDisabled: {
|
|
362
|
+
type: Boolean,
|
|
363
|
+
default: false
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
setup(__props) {
|
|
367
|
+
const props = __props;
|
|
368
|
+
const slots = useSlots();
|
|
369
|
+
const group = useDropdownMenuRadioGroup();
|
|
370
|
+
if (group == null) throw new Error("DropdownMenuRadioItem must be used within a DropdownMenuRadioGroup");
|
|
371
|
+
const isChecked = computed(() => group.value.value === props.value);
|
|
372
|
+
const { controlSize, density, handleClick, handlePointerMove, inContextMenu, menuSize } = useMenuSelectableRow({
|
|
373
|
+
hasCloseOnSelect: group.hasCloseOnSelect,
|
|
374
|
+
isDisabled: computed(() => props.isDisabled),
|
|
375
|
+
onActivate: () => group.select(props.value)
|
|
376
|
+
});
|
|
377
|
+
const hasStart = computed(() => slots.icon != null || props.icon != null);
|
|
378
|
+
const hasLabel = computed(() => slots.label != null || props.label != null);
|
|
379
|
+
const hasDescription = computed(() => slots.description != null || props.description != null);
|
|
380
|
+
const hasEnd = computed(() => slots.endContent != null);
|
|
381
|
+
return (_ctx, _cache) => {
|
|
382
|
+
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" eslint-disable-next-line vue-a11y/click-events-have-key-events, vue-a11y/interactive-supports-focus -- The menu owns Enter, Space, and the arrows. tabindex is -1 while the row is enabled and removed while disabled. "), unref(inContextMenu) ? (openBlock(), createElementBlock("div", {
|
|
383
|
+
key: 0,
|
|
384
|
+
class: "astryx-context-menu-item",
|
|
385
|
+
role: "menuitemradio",
|
|
386
|
+
"aria-checked": isChecked.value,
|
|
387
|
+
"aria-disabled": __props.isDisabled || void 0,
|
|
388
|
+
"data-disabled": __props.isDisabled || void 0,
|
|
389
|
+
"data-size": unref(menuSize),
|
|
390
|
+
tabindex: __props.isDisabled ? void 0 : -1,
|
|
391
|
+
onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args)),
|
|
392
|
+
onPointermove: _cache[1] || (_cache[1] = (...args) => unref(handlePointerMove) && unref(handlePointerMove)(...args))
|
|
393
|
+
}, [
|
|
394
|
+
createVNode(_sfc_main$3, {
|
|
395
|
+
kind: "radio",
|
|
396
|
+
checked: isChecked.value,
|
|
397
|
+
"is-disabled": __props.isDisabled,
|
|
398
|
+
size: unref(controlSize)
|
|
399
|
+
}, null, 8, [
|
|
400
|
+
"checked",
|
|
401
|
+
"is-disabled",
|
|
402
|
+
"size"
|
|
403
|
+
]),
|
|
404
|
+
hasStart.value ? (openBlock(), createElementBlock("span", _hoisted_2, [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$4, {
|
|
405
|
+
color: "secondary",
|
|
406
|
+
icon: __props.icon,
|
|
407
|
+
size: "sm"
|
|
408
|
+
}, null, 8, ["icon"])])])) : createCommentVNode("v-if", true),
|
|
409
|
+
createElementVNode("span", _hoisted_3, [hasLabel.value ? (openBlock(), createElementBlock("span", _hoisted_4, [renderSlot(_ctx.$slots, "label", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])])) : createCommentVNode("v-if", true), hasDescription.value ? (openBlock(), createElementBlock("span", _hoisted_5, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])])) : createCommentVNode("v-if", true)]),
|
|
410
|
+
hasEnd.value ? (openBlock(), createElementBlock("span", _hoisted_6, [renderSlot(_ctx.$slots, "endContent")])) : createCommentVNode("v-if", true)
|
|
411
|
+
], 40, _hoisted_1)) : (openBlock(), createBlock(_sfc_main$5, {
|
|
412
|
+
key: 1,
|
|
413
|
+
class: "astryx-dropdown-menu-item",
|
|
414
|
+
role: "menuitemradio",
|
|
415
|
+
"aria-checked": isChecked.value,
|
|
416
|
+
"data-menu-size": unref(menuSize),
|
|
417
|
+
"data-variant": "default",
|
|
418
|
+
density: unref(density),
|
|
419
|
+
description: __props.description,
|
|
420
|
+
"is-disabled": __props.isDisabled,
|
|
421
|
+
label: __props.label,
|
|
422
|
+
"on-click": unref(handleClick),
|
|
423
|
+
tabindex: __props.isDisabled ? void 0 : -1,
|
|
424
|
+
onPointermove: unref(handlePointerMove)
|
|
425
|
+
}, createSlots({
|
|
426
|
+
marker: withCtx(() => [createVNode(_sfc_main$3, {
|
|
427
|
+
kind: "radio",
|
|
428
|
+
checked: isChecked.value,
|
|
429
|
+
"is-disabled": __props.isDisabled,
|
|
430
|
+
size: unref(controlSize)
|
|
431
|
+
}, null, 8, [
|
|
432
|
+
"checked",
|
|
433
|
+
"is-disabled",
|
|
434
|
+
"size"
|
|
435
|
+
])]),
|
|
436
|
+
_: 2
|
|
437
|
+
}, [
|
|
438
|
+
hasStart.value ? {
|
|
439
|
+
name: "startContent",
|
|
440
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [createVNode(_sfc_main$4, {
|
|
441
|
+
color: "secondary",
|
|
442
|
+
icon: __props.icon,
|
|
443
|
+
size: "sm"
|
|
444
|
+
}, null, 8, ["icon"])])]),
|
|
445
|
+
key: "0"
|
|
446
|
+
} : void 0,
|
|
447
|
+
unref(slots).label ? {
|
|
448
|
+
name: "label",
|
|
449
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "label")]),
|
|
450
|
+
key: "1"
|
|
451
|
+
} : void 0,
|
|
452
|
+
unref(slots).description ? {
|
|
453
|
+
name: "description",
|
|
454
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "description")]),
|
|
455
|
+
key: "2"
|
|
456
|
+
} : void 0,
|
|
457
|
+
hasEnd.value ? {
|
|
458
|
+
name: "endContent",
|
|
459
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "endContent")]),
|
|
460
|
+
key: "3"
|
|
461
|
+
} : void 0
|
|
462
|
+
]), 1032, [
|
|
463
|
+
"aria-checked",
|
|
464
|
+
"data-menu-size",
|
|
465
|
+
"density",
|
|
466
|
+
"description",
|
|
467
|
+
"is-disabled",
|
|
468
|
+
"label",
|
|
469
|
+
"on-click",
|
|
470
|
+
"tabindex",
|
|
471
|
+
"onPointermove"
|
|
472
|
+
]))], 2112);
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/DropdownMenu/useMenuDrillIn.ts
|
|
478
|
+
const EMPTY_HOST = null;
|
|
479
|
+
function matchesQuery(query) {
|
|
480
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Drill-in state for one menu root.
|
|
484
|
+
*
|
|
485
|
+
* `query` is the same media query the root uses to choose a bottom sheet, so
|
|
486
|
+
* a submenu and its menu agree on what "a phone" means.
|
|
487
|
+
*/
|
|
488
|
+
function useMenuDrillIn(isOpen, query) {
|
|
489
|
+
const isCompactTouch = ref(false);
|
|
490
|
+
const viewStack = ref([]);
|
|
491
|
+
const host = ref(EMPTY_HOST);
|
|
492
|
+
watch(isOpen, (open) => {
|
|
493
|
+
if (open) {
|
|
494
|
+
isCompactTouch.value = matchesQuery(query);
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
if (viewStack.value.length > 0) viewStack.value = [];
|
|
498
|
+
}, { immediate: true });
|
|
499
|
+
function push(viewId) {
|
|
500
|
+
if (viewStack.value.includes(viewId)) return;
|
|
501
|
+
viewStack.value = [...viewStack.value, viewId];
|
|
502
|
+
}
|
|
503
|
+
function pop() {
|
|
504
|
+
if (viewStack.value.length === 0) return;
|
|
505
|
+
viewStack.value = viewStack.value.slice(0, -1);
|
|
506
|
+
}
|
|
507
|
+
return {
|
|
508
|
+
drillIn: computed(() => ({
|
|
509
|
+
host: host.value,
|
|
510
|
+
isCompactTouch: isCompactTouch.value,
|
|
511
|
+
pop,
|
|
512
|
+
push,
|
|
513
|
+
viewStack: viewStack.value
|
|
514
|
+
})),
|
|
515
|
+
host,
|
|
516
|
+
isDrilled: computed(() => viewStack.value.length > 0)
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
//#endregion
|
|
520
|
+
export { dropdownMenuContextKey as a, contextMenuContextKey as c, useContextMenuSize as d, _sfc_main$2 as i, submenuAncestorOpenKey as l, _sfc_main as n, useDropdownMenuContext as o, _sfc_main$1 as r, useDropdownMenuRadioGroup as s, useMenuDrillIn as t, useContextMenu as u };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { c as resolveWeekStart } from "./useDateRange-CIXoE_8k.js";
|
|
2
|
+
import { CalendarDate } from "@internationalized/date";
|
|
3
|
+
//#region src/composables/useMonthGrid.ts
|
|
4
|
+
function toISODate(date) {
|
|
5
|
+
const month = String(date.month).padStart(2, "0");
|
|
6
|
+
const day = String(date.day).padStart(2, "0");
|
|
7
|
+
return `${date.year}-${month}-${day}`;
|
|
8
|
+
}
|
|
9
|
+
function parseISODate(value) {
|
|
10
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
11
|
+
return new CalendarDate(year, month, day);
|
|
12
|
+
}
|
|
13
|
+
function buildMonthGrid(year, month, weekStartsOn) {
|
|
14
|
+
const first = new CalendarDate(year, month, 1);
|
|
15
|
+
const start = resolveWeekStart(weekStartsOn);
|
|
16
|
+
const offset = (first.toDate("UTC").getUTCDay() - start + 7) % 7;
|
|
17
|
+
let cursor = first.subtract({ days: offset });
|
|
18
|
+
const weeks = [];
|
|
19
|
+
for (let week = 0; week < 6; week += 1) {
|
|
20
|
+
const days = [];
|
|
21
|
+
for (let day = 0; day < 7; day += 1) {
|
|
22
|
+
days.push(toISODate(cursor));
|
|
23
|
+
cursor = cursor.add({ days: 1 });
|
|
24
|
+
}
|
|
25
|
+
weeks.push(days);
|
|
26
|
+
}
|
|
27
|
+
return weeks;
|
|
28
|
+
}
|
|
29
|
+
function addMonths(year, month, amount) {
|
|
30
|
+
const date = new CalendarDate(year, month, 1).add({ months: amount });
|
|
31
|
+
return {
|
|
32
|
+
year: date.year,
|
|
33
|
+
month: date.month
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function todayISODate() {
|
|
37
|
+
const now = /* @__PURE__ */ new Date();
|
|
38
|
+
const month = String(now.getMonth() + 1).padStart(2, "0");
|
|
39
|
+
const day = String(now.getDate()).padStart(2, "0");
|
|
40
|
+
return `${now.getFullYear()}-${month}-${day}`;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { todayISODate as a, toISODate as i, buildMonthGrid as n, parseISODate as r, addMonths as t };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
//#region src/composables/usePendingChange.ts
|
|
3
|
+
/**
|
|
4
|
+
* Runs a change action after the value is already committed.
|
|
5
|
+
* Overlapping calls stay busy until the last one settles.
|
|
6
|
+
*/
|
|
7
|
+
function usePendingChange(action) {
|
|
8
|
+
const pending = ref(0);
|
|
9
|
+
async function run(value) {
|
|
10
|
+
const next = action();
|
|
11
|
+
if (!next) return;
|
|
12
|
+
pending.value += 1;
|
|
13
|
+
try {
|
|
14
|
+
await next(value);
|
|
15
|
+
} catch {} finally {
|
|
16
|
+
pending.value -= 1;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
busy: computed(() => pending.value > 0),
|
|
21
|
+
run
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { usePendingChange as t };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
//#region src/DropdownMenu/useSubmenuMode.ts
|
|
3
|
+
/**
|
|
4
|
+
* Whether a submenu flies out beside its row or replaces the menu's rows.
|
|
5
|
+
*
|
|
6
|
+
* `adaptive` drills in only when the menu opened on a compact touch surface.
|
|
7
|
+
* That choice is sampled by the root when the menu opens, so the panel does
|
|
8
|
+
* not change shape while it is open.
|
|
9
|
+
*/
|
|
10
|
+
function useSubmenuMode(options) {
|
|
11
|
+
const isDrill = computed(() => {
|
|
12
|
+
const drill = options.drillIn.value;
|
|
13
|
+
if (drill == null || options.presentation.value === "flyout") return false;
|
|
14
|
+
if (options.presentation.value === "drill-in") return true;
|
|
15
|
+
return drill.isCompactTouch;
|
|
16
|
+
});
|
|
17
|
+
const isOnStack = computed(() => options.drillIn.value?.viewStack.includes(options.viewId) === true);
|
|
18
|
+
const isTop = computed(() => isOnStack.value && options.drillIn.value?.viewStack.at(-1) === options.viewId);
|
|
19
|
+
function openDrill() {
|
|
20
|
+
options.drillIn.value?.push(options.viewId);
|
|
21
|
+
}
|
|
22
|
+
/** Pop this view when it is the top of the stack. Returns whether it popped. */
|
|
23
|
+
function closeDrill() {
|
|
24
|
+
if (!isTop.value) return false;
|
|
25
|
+
options.drillIn.value?.pop();
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
closeDrill,
|
|
30
|
+
isDrill,
|
|
31
|
+
isOnStack,
|
|
32
|
+
isTop,
|
|
33
|
+
openDrill
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { useSubmenuMode as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryx-vue/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "Vue components for the unofficial astryx-vue community project.",
|
|
6
6
|
"author": "ShenQingchuan",
|
|
7
7
|
"license": "MIT",
|
|
@@ -92,6 +92,10 @@
|
|
|
92
92
|
"types": "./dist/Icon/plugin.d.ts",
|
|
93
93
|
"import": "./dist/Icon/plugin.js"
|
|
94
94
|
},
|
|
95
|
+
"./Indicator": {
|
|
96
|
+
"types": "./dist/Indicator/index.d.ts",
|
|
97
|
+
"import": "./dist/Indicator/index.js"
|
|
98
|
+
},
|
|
95
99
|
"./Layout": {
|
|
96
100
|
"types": "./dist/Layout/index.d.ts",
|
|
97
101
|
"import": "./dist/Layout/index.js"
|
|
@@ -108,6 +112,10 @@
|
|
|
108
112
|
"types": "./dist/Outline/index.d.ts",
|
|
109
113
|
"import": "./dist/Outline/index.js"
|
|
110
114
|
},
|
|
115
|
+
"./PowerSearch": {
|
|
116
|
+
"types": "./dist/PowerSearch/index.d.ts",
|
|
117
|
+
"import": "./dist/PowerSearch/index.js"
|
|
118
|
+
},
|
|
111
119
|
"./RadioList": {
|
|
112
120
|
"types": "./dist/RadioList/index.d.ts",
|
|
113
121
|
"import": "./dist/RadioList/index.js"
|