@astryx-vue/core 0.39.0 → 0.40.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-DnylRSpj.js → AlertDialog-McG6w72O.js} +4 -4
- 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-CqIYLEcx.js → Banner-CmWBciT7.js} +1 -1
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/BottomSheet/index.js +2 -2
- package/dist/BottomSheet-BOEmV4QT.js +527 -0
- package/dist/{BottomSheet-D37eNqz5.js → BottomSheet-BkBRbF1_.js} +1379 -192
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/{Breadcrumbs-BEzCPnoe.js → Breadcrumbs-D7dac2Vx.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +1 -1
- package/dist/{Button-DGIfLwqj.js → Button-pAwKXPpg.js} +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/ButtonGroup/index.js +1 -1
- package/dist/{ButtonGroup-CaQ7bir4.js → ButtonGroup-CuxHcLGQ.js} +2 -2
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Carousel/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel-DmeW51vC.js → Carousel-CS2e2A7m.js} +1 -1
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-whrqE8Zj.js → Chat-BpZRcgDp.js} +1 -1
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-CHO4Jz0m.js → CheckboxInput-DhacWPUS.js} +2 -2
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxListItem-C4dmrC_w.js → CheckboxListItem-D7PdrL6R.js} +3 -3
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.js +2 -2
- package/dist/{Code-D80SHrJx.js → Code-CpOHgCdF.js} +1 -1
- package/dist/{CodeBlock-vhMVY90M.js → CodeBlock-CkGp6dGF.js} +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-C-iXk7EB.js → CommandPalette-DiM8MlSa.js} +1 -1
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-BsdtBmd0.js → ComplexSelector-BmXhD8Oe.js} +2 -2
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +1 -1
- package/dist/{ContextMenu-GZkN9lf1.js → ContextMenu-DcqcObzD.js} +1 -1
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-Cb6eLrbU.js → DateInput-C3KNWKD5.js} +4 -4
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-BUFeQYJ6.js → DateRangeInput-C7qeaG20.js} +3 -3
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-r-MOwLs4.js → DateTimeInput-L0EZbgPe.js} +5 -5
- package/dist/Dialog/index.js +3 -3
- package/dist/{Dialog-BP2KWnEi.js → Dialog-DLg0POKn.js} +1 -1
- package/dist/{Dialog-BUl1lqE6.js → Dialog-iVqfWx9T.js} +1 -1
- package/dist/{DialogHeader-CPhEYbZ1.js → DialogHeader-B0B8oATV.js} +1 -1
- package/dist/Divider/index.d.ts +1 -1
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-C0ntt2L9.js → Drawer-C0x5HNmD.js} +2 -2
- package/dist/DropdownMenu/index.js +1 -1
- package/dist/{DropdownMenu-CSWLdtI4.js → DropdownMenu-pqhotFvD.js} +2 -2
- package/dist/Field/index.js +3 -3
- package/dist/{Field-BYAHZ4s7.js → Field-D3W-qMmn.js} +1 -1
- package/dist/{FieldInfoTip-6IHEEEJL.js → FieldInfoTip-K-cUaCBk.js} +1 -1
- package/dist/{FieldLabel-CHaeZROf.js → FieldLabel-CIe1tEyM.js} +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-DD3DvIT0.js → FileInput-Crb5znnx.js} +3 -3
- package/dist/Heading/index.d.ts +1 -1
- package/dist/HoverCard/index.d.ts +1 -1
- package/dist/IconButton/index.js +1 -1
- package/dist/{IconButton-CzU-cz_H.js → IconButton-Cug4YcFk.js} +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-Ckhg715K.js → InfoTip-Cu4a1mi4.js} +1 -1
- package/dist/{InputClearButton-Btjd5Lnk.js → InputClearButton-CgUhJflI.js} +1 -1
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-C388xPHC.js → InputGroup-BRsu7Tbv.js} +1 -1
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-CQhmsbhy.js → Lightbox-_RBPOxDZ.js} +1 -1
- package/dist/Link/index.d.ts +1 -1
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.js +1 -1
- package/dist/{ListItem-BEc2EF1u.js → ListItem-DZwU5RrZ.js} +1 -1
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-BkL2wt7F.js → Markdown-CiLkzTFi.js} +1 -1
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-pvuN9vfu.js → MoreMenu-BWuzaT3K.js} +2 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-sD97taHQ.js → MultiSelector-geUPBvlE.js} +3 -3
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-B3Y_NOui.js → NumberInput--sai94t9.js} +3 -3
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-BJKFuELz.js → Pagination-C10gbfyv.js} +2 -2
- package/dist/{PickerWheel-J5F_ecWb.js → PickerWheel-CpAyp6NS.js} +4 -3
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-CVZnqsUy.js → Popover-C6_p8KAA.js} +2 -2
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-BHTHVINR.js → PowerSearch-D47zbO7s.js} +18 -18
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-CvMj98z_.js → RadioGroup-C1VXRBSf.js} +2 -2
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioListItem-CptY2wdB.js → RadioListItem-DrAwYoOz.js} +1 -1
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SegmentedControl/index.js +1 -1
- package/dist/{SegmentedControl-DMxIY7uq.js → SegmentedControl-D9atngIc.js} +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-DhKtSP71.js → Selector-DFTryuh1.js} +2 -2
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-DOXNxEIp.js → SideNav-Bjk5ACqf.js} +1 -1
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-D5GYcH4S.js → Slider-rOwQQK6G.js} +1 -1
- package/dist/Stack/index.d.ts +1 -1
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-DDHf_9iJ.js → Switch-BBfZ6XqA.js} +2 -2
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-B49mlc0R.js → Table-D0yjxm9X.js} +9 -9
- package/dist/Text/index.d.ts +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-BSB5WIpK.js → TextArea-Cr00OL0D.js} +4 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-Ck-6Mtbt.js → TextInput-CVfvRHOa.js} +4 -4
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-Tg50Msul.js → Thumbnail-CJPZ299u.js} +1 -1
- package/dist/{TimeField-CLD_j1tX.js → TimeField-Csp1-lRo.js} +3 -3
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-DuijuQMd.js → TimeInput-B4JLpJ2N.js} +2 -2
- package/dist/Timer/index.d.ts +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-D8fyTuhk.js → Timestamp-BmH-CQ8p.js} +1 -1
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-51l_F_YA.js → Toast-Cuc1o3ph.js} +3 -5
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/ToggleButton/index.js +1 -1
- package/dist/{ToggleButton-_fEU63Nz.js → ToggleButton-BsAi9ln1.js} +3 -3
- 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-wWybLovw.js → Tokenizer-CXCnZtY3.js} +257 -175
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/Typeahead/index.js +1 -1
- package/dist/{Typeahead-DtNM4311.js → Typeahead-Csob3tst.js} +2 -2
- package/dist/composables/index.js +2 -2
- package/dist/{composables-D5840uKi.js → composables-DqaKLASV.js} +1 -1
- package/dist/{index-X4S7_dmq.d.ts → index-BA8exXNP.d.ts} +1 -1
- package/dist/{index-BgT6mH3U.d.ts → index-BB9acgK8.d.ts} +1 -1
- package/dist/{index-EyFu5eSZ.d.ts → index-BFPb14Xj.d.ts} +6 -6
- package/dist/{index-CEdoNcHF.d.ts → index-BfOs5BQj.d.ts} +2 -2
- package/dist/{index-DofC9Rll.d.ts → index-BtqvPjAf.d.ts} +1 -1
- package/dist/{index-waTkqxTz.d.ts → index-C89cIh4E.d.ts} +1 -1
- package/dist/{index-rdwI-mcm.d.ts → index-CtYlR9Cu.d.ts} +1 -1
- package/dist/{index--kbwaSXW.d.ts → index-CuW4AQ7M.d.ts} +1 -1
- package/dist/{index-C8wfe0Mr.d.ts → index-D05JGsT3.d.ts} +1 -1
- package/dist/{index-ZXDolNI1.d.ts → index-DN2b-w3H.d.ts} +50 -50
- package/dist/{index-DYabo8TI.d.ts → index-DPhQZXYw.d.ts} +1 -1
- package/dist/{index-J83fLEyo.d.ts → index-DgNCHxvu.d.ts} +2 -2
- package/dist/{index-DVX2jlTQ.d.ts → index-Ds4dOCSy.d.ts} +7 -4
- package/dist/{index-DXGoFpRN.d.ts → index-LvZ3vP29.d.ts} +1 -1
- package/dist/{index-Bk2SsmEu.d.ts → index-YP5WRwXH.d.ts} +3 -3
- package/dist/index.d.ts +16 -16
- package/dist/index.js +59 -59
- package/dist/{lazyBottomSheet-DUPKYGf1.js → lazyBottomSheet-0H4ih8Oh.js} +1 -1
- package/dist/{modalOutlet-BwR9AAlm.js → modalOutlet-C2nqIYUt.js} +7 -6
- package/dist/{useActionGroupTracking-DB5xIxPW.js → useActionGroupTracking-SVkaaOzz.js} +1 -1
- package/dist/{useInputStatusIcon-DJfhmCiH.js → useInputStatusIcon-CRG-be-K.js} +1 -1
- package/dist/{useTouchHitArea-DvKV21NY.js → useTouchHitArea-BdpeksgK.js} +225 -43
- package/package.json +1 -1
- package/styles/bottom-sheet.css +61 -19
- package/styles/date-input.css +76 -0
- package/styles/tokenizer.css +88 -0
- package/dist/BottomSheet-6W3izQzr.js +0 -203
- package/dist/{index-5FGt4HsB.d.ts → index-BqhgeAT4.d.ts} +1 -1
package/styles/tokenizer.css
CHANGED
|
@@ -235,6 +235,94 @@
|
|
|
235
235
|
transition: none;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
+
|
|
239
|
+
/*
|
|
240
|
+
* InputGroup 里的 Tokenizer:整行由组定高、画边框和焦点,Tokenizer 只留内容。
|
|
241
|
+
* 一行放不下就横向滚动,不换行,否则第二行会溢出组的边框;
|
|
242
|
+
* 只有标签和输入这条轨道在滚,结尾的控件是它的兄弟,不会被标签盖住。
|
|
243
|
+
*/
|
|
244
|
+
.astryx-input-group-field .astryx-tokenizer.in-group {
|
|
245
|
+
flex: 1;
|
|
246
|
+
width: 100%;
|
|
247
|
+
min-width: 0;
|
|
248
|
+
height: 100%;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.astryx-input-group-field .astryx-tokenizer.in-group .astryx-tokenizer-control {
|
|
252
|
+
flex-wrap: nowrap;
|
|
253
|
+
height: 100%;
|
|
254
|
+
min-height: 0;
|
|
255
|
+
border: 0;
|
|
256
|
+
border-radius: 0;
|
|
257
|
+
box-shadow: none;
|
|
258
|
+
background: transparent;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track {
|
|
262
|
+
--_fade-inset: calc(var(--astryx-spacing-1, 4px) + var(--astryx-spacing-6, 24px));
|
|
263
|
+
display: flex;
|
|
264
|
+
flex: 1 1 0;
|
|
265
|
+
align-items: center;
|
|
266
|
+
align-self: stretch;
|
|
267
|
+
min-width: 0;
|
|
268
|
+
/* 滚动容器在自己的内边距处裁切;向外撑回外框的内边距,标签的焦点环才有地方画。 */
|
|
269
|
+
margin: calc(-1 * var(--astryx-spacing-1, 4px));
|
|
270
|
+
padding: var(--astryx-spacing-1, 4px);
|
|
271
|
+
scrollbar-width: none;
|
|
272
|
+
scroll-padding-inline: var(--_fade-inset);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track-content {
|
|
276
|
+
display: flex;
|
|
277
|
+
flex: none;
|
|
278
|
+
align-items: center;
|
|
279
|
+
gap: var(--astryx-spacing-1, 4px);
|
|
280
|
+
/* 至少和轨道一样宽,输入框才能拿到标签剩下的地方;标签更多时才超出,轨道才有得滚。 */
|
|
281
|
+
min-width: 100%;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* 轨道里标签和输入框排成一行,不再各自占一个弹性行。 */
|
|
285
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-tokens {
|
|
286
|
+
display: flex;
|
|
287
|
+
flex: none;
|
|
288
|
+
flex-wrap: nowrap;
|
|
289
|
+
gap: var(--astryx-spacing-1, 4px);
|
|
290
|
+
max-width: none;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-tokens.is-collapsed {
|
|
294
|
+
flex: 1 1 auto;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/* 藏着标签的那一侧淡出,代替滚动条。 */
|
|
298
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track[data-scrollable-inline='true']:not([data-scroll-inline-start='true']):not([data-scroll-inline-end='true']) {
|
|
299
|
+
mask-image: linear-gradient(to right, transparent var(--astryx-spacing-1, 4px), black var(--_fade-inset), black calc(100% - var(--_fade-inset)), transparent calc(100% - var(--astryx-spacing-1, 4px)));
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track[data-scrollable-inline='true'][data-scroll-inline-start='true']:not([data-scroll-inline-end='true']) {
|
|
303
|
+
mask-image: linear-gradient(to left, transparent var(--astryx-spacing-1, 4px), black var(--_fade-inset));
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track[data-scrollable-inline='true'][data-scroll-inline-end='true']:not([data-scroll-inline-start='true']) {
|
|
307
|
+
mask-image: linear-gradient(to right, transparent var(--astryx-spacing-1, 4px), black var(--_fade-inset));
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* 从右往左排版:淡出的方向跟着翻过来。 */
|
|
311
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track:dir(rtl)[data-scrollable-inline='true'][data-scroll-inline-start='true']:not([data-scroll-inline-end='true']) {
|
|
312
|
+
mask-image: linear-gradient(to right, transparent var(--astryx-spacing-1, 4px), black var(--_fade-inset));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track:dir(rtl)[data-scrollable-inline='true'][data-scroll-inline-end='true']:not([data-scroll-inline-start='true']) {
|
|
316
|
+
mask-image: linear-gradient(to left, transparent var(--astryx-spacing-1, 4px), black var(--_fade-inset));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* 强制颜色下滚动条回来了,淡出让位。 */
|
|
320
|
+
@media (forced-colors: active) {
|
|
321
|
+
.astryx-tokenizer.in-group .astryx-tokenizer-track {
|
|
322
|
+
mask-image: none;
|
|
323
|
+
scrollbar-width: thin;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
238
326
|
}
|
|
239
327
|
|
|
240
328
|
/* 不分层:输入框的焦点由外框承担,避免文档页再套一层品牌绿环。 */
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { a as focusSheetOnOpen, i as bottomSheetSwitcherKey, r as useSheetLayerDismiss } from "./BottomSheet-D37eNqz5.js";
|
|
2
|
-
import { r as provideNestedLayerMountTarget } from "./mount-7R_s-bHB.js";
|
|
3
|
-
import { t as isImeKeyEvent } from "./ime-VY8-80S8.js";
|
|
4
|
-
import { t as useFocusTrap } from "./useFocusTrap-Bj9GskLh.js";
|
|
5
|
-
import { t as useScrollLock } from "./scrollLock-CoVg9lLU.js";
|
|
6
|
-
import { n as restoreLayerFocus, r as trackLayerFocus, t as isLayerFocusStranded } from "./layerFocusReturn-uixUCSc8.js";
|
|
7
|
-
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, getCurrentInstance, mergeModels, mergeProps, nextTick, onBeforeUnmount, onMounted, openBlock, provide, ref, renderSlot, shallowRef, useModel, useTemplateRef, watch } from "vue";
|
|
8
|
-
import "../styles/bottom-sheet.css";
|
|
9
|
-
//#region src/BottomSheet/BottomSheetSwitcher.vue
|
|
10
|
-
const _hoisted_1 = [
|
|
11
|
-
"data-settled",
|
|
12
|
-
"aria-label",
|
|
13
|
-
"aria-modal"
|
|
14
|
-
];
|
|
15
|
-
const _hoisted_2 = {
|
|
16
|
-
ref: "layerHost",
|
|
17
|
-
class: "astryx-bottom-sheet__layer-host"
|
|
18
|
-
};
|
|
19
|
-
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
20
|
-
name: "AstryxBottomSheetSwitcher",
|
|
21
|
-
inheritAttrs: false,
|
|
22
|
-
__name: "BottomSheetSwitcher",
|
|
23
|
-
props: /*@__PURE__*/ mergeModels({
|
|
24
|
-
label: {},
|
|
25
|
-
purpose: {},
|
|
26
|
-
hasScrim: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
default: true
|
|
29
|
-
}
|
|
30
|
-
}, {
|
|
31
|
-
"activeSheet": { default: null },
|
|
32
|
-
"activeSheetModifiers": {}
|
|
33
|
-
}),
|
|
34
|
-
emits: /*@__PURE__*/ mergeModels(["cancel"], ["update:activeSheet"]),
|
|
35
|
-
setup(__props, { emit: __emit }) {
|
|
36
|
-
const props = __props;
|
|
37
|
-
const emit = __emit;
|
|
38
|
-
const activeSheet = useModel(__props, "activeSheet");
|
|
39
|
-
const retainedId = ref(null);
|
|
40
|
-
const alignmentOffset = ref(0);
|
|
41
|
-
const sheets = shallowRef(/* @__PURE__ */ new Map());
|
|
42
|
-
const dialog = useTemplateRef("dialog");
|
|
43
|
-
provideNestedLayerMountTarget(useTemplateRef("layerHost"));
|
|
44
|
-
const isScrollLocked = ref(false);
|
|
45
|
-
const isSettled = ref(getCurrentInstance()?.vnode.el != null && activeSheet.value != null);
|
|
46
|
-
let focusRecord = null;
|
|
47
|
-
let handoffTimer;
|
|
48
|
-
useScrollLock(isScrollLocked);
|
|
49
|
-
function registration(id) {
|
|
50
|
-
return id == null ? void 0 : sheets.value.get(id);
|
|
51
|
-
}
|
|
52
|
-
const activeElement = computed(() => registration(activeSheet.value)?.getElement() ?? null);
|
|
53
|
-
const flowPurpose = computed(() => props.purpose ?? registration(activeSheet.value)?.purpose() ?? "info");
|
|
54
|
-
const dialogLabel = computed(() => props.label ?? registration(activeSheet.value)?.label() ?? "Bottom sheet");
|
|
55
|
-
useFocusTrap({
|
|
56
|
-
container: activeElement,
|
|
57
|
-
isEnabled: computed(() => activeSheet.value != null && props.hasScrim)
|
|
58
|
-
});
|
|
59
|
-
function setActive(id) {
|
|
60
|
-
const previous = activeSheet.value;
|
|
61
|
-
if (previous === id) return;
|
|
62
|
-
if (handoffTimer != null) clearTimeout(handoffTimer);
|
|
63
|
-
if (previous != null && id != null) {
|
|
64
|
-
retainedId.value = previous;
|
|
65
|
-
alignmentOffset.value = 0;
|
|
66
|
-
activeSheet.value = id;
|
|
67
|
-
nextTick(() => {
|
|
68
|
-
const previousHeight = registration(previous)?.getElement()?.offsetHeight ?? 0;
|
|
69
|
-
const nextHeight = registration(id)?.getElement()?.offsetHeight ?? 0;
|
|
70
|
-
alignmentOffset.value = Math.max(0, previousHeight - nextHeight);
|
|
71
|
-
});
|
|
72
|
-
handoffTimer = setTimeout(() => {
|
|
73
|
-
if (retainedId.value === previous) {
|
|
74
|
-
retainedId.value = null;
|
|
75
|
-
alignmentOffset.value = 0;
|
|
76
|
-
}
|
|
77
|
-
}, 420);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
retainedId.value = null;
|
|
81
|
-
alignmentOffset.value = 0;
|
|
82
|
-
activeSheet.value = id;
|
|
83
|
-
}
|
|
84
|
-
function register(id, entry) {
|
|
85
|
-
const next = new Map(sheets.value);
|
|
86
|
-
next.set(id, entry);
|
|
87
|
-
sheets.value = next;
|
|
88
|
-
}
|
|
89
|
-
function unregister(id) {
|
|
90
|
-
const next = new Map(sheets.value);
|
|
91
|
-
next.delete(id);
|
|
92
|
-
sheets.value = next;
|
|
93
|
-
}
|
|
94
|
-
provide(bottomSheetSwitcherKey, {
|
|
95
|
-
activeId: activeSheet,
|
|
96
|
-
retainedId,
|
|
97
|
-
alignmentOffset,
|
|
98
|
-
setActive,
|
|
99
|
-
register,
|
|
100
|
-
unregister
|
|
101
|
-
});
|
|
102
|
-
function openDialog() {
|
|
103
|
-
const element = dialog.value;
|
|
104
|
-
if (!element) return;
|
|
105
|
-
if (!element.open) {
|
|
106
|
-
focusRecord?.stop();
|
|
107
|
-
focusRecord = trackLayerFocus({ getLayer: () => dialog.value });
|
|
108
|
-
if (props.hasScrim) element.showModal();
|
|
109
|
-
else element.show();
|
|
110
|
-
}
|
|
111
|
-
isScrollLocked.value = props.hasScrim;
|
|
112
|
-
nextTick(() => focusSheetOnOpen(activeElement.value, true));
|
|
113
|
-
}
|
|
114
|
-
function returnFocus(record, wasStranded) {
|
|
115
|
-
if (wasStranded) restoreLayerFocus(record, {
|
|
116
|
-
layer: null,
|
|
117
|
-
name: "BottomSheetSwitcher"
|
|
118
|
-
});
|
|
119
|
-
record.stop();
|
|
120
|
-
}
|
|
121
|
-
function closeDialog() {
|
|
122
|
-
const record = focusRecord;
|
|
123
|
-
focusRecord = null;
|
|
124
|
-
const wasStranded = record != null && isLayerFocusStranded(record, dialog.value);
|
|
125
|
-
dialog.value?.close();
|
|
126
|
-
if (record != null) returnFocus(record, wasStranded);
|
|
127
|
-
isScrollLocked.value = false;
|
|
128
|
-
retainedId.value = null;
|
|
129
|
-
alignmentOffset.value = 0;
|
|
130
|
-
}
|
|
131
|
-
function requestClose() {
|
|
132
|
-
if (flowPurpose.value === "required") return;
|
|
133
|
-
setActive(null);
|
|
134
|
-
}
|
|
135
|
-
const flowVisible = computed(() => activeSheet.value != null || retainedId.value != null);
|
|
136
|
-
const layerEscape = computed(() => {
|
|
137
|
-
if (activeSheet.value == null || flowPurpose.value === "required") return "block";
|
|
138
|
-
if (!props.hasScrim) return "ignore";
|
|
139
|
-
return "close";
|
|
140
|
-
});
|
|
141
|
-
const layer = useSheetLayerDismiss({
|
|
142
|
-
isActive: flowVisible,
|
|
143
|
-
escape: layerEscape,
|
|
144
|
-
getContainer: () => dialog.value ?? null,
|
|
145
|
-
isPresent: () => dialog.value?.open ?? false,
|
|
146
|
-
onDismiss: requestClose
|
|
147
|
-
});
|
|
148
|
-
function onKeydown(event) {
|
|
149
|
-
if (event.key !== "Escape" || !layer.isTop()) return;
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
if (isImeKeyEvent(event)) return;
|
|
152
|
-
requestClose();
|
|
153
|
-
}
|
|
154
|
-
function onCancel(event) {
|
|
155
|
-
if (event.target !== dialog.value) return;
|
|
156
|
-
emit("cancel", event);
|
|
157
|
-
if (event.defaultPrevented) return;
|
|
158
|
-
event.preventDefault();
|
|
159
|
-
if (!layer.isTop()) return;
|
|
160
|
-
requestClose();
|
|
161
|
-
}
|
|
162
|
-
function onDialogClick(event) {
|
|
163
|
-
if (event.target !== event.currentTarget) return;
|
|
164
|
-
if (props.hasScrim && flowPurpose.value === "info") setActive(null);
|
|
165
|
-
}
|
|
166
|
-
watch(activeSheet, (id, previous) => {
|
|
167
|
-
if (previous != null) isSettled.value = false;
|
|
168
|
-
if (id) openDialog();
|
|
169
|
-
else closeDialog();
|
|
170
|
-
}, { flush: "post" });
|
|
171
|
-
onMounted(() => {
|
|
172
|
-
if (activeSheet.value) openDialog();
|
|
173
|
-
});
|
|
174
|
-
onBeforeUnmount(() => {
|
|
175
|
-
const record = focusRecord;
|
|
176
|
-
focusRecord = null;
|
|
177
|
-
if (record != null) {
|
|
178
|
-
const wasStranded = isLayerFocusStranded(record, dialog.value);
|
|
179
|
-
queueMicrotask(() => returnFocus(record, wasStranded));
|
|
180
|
-
}
|
|
181
|
-
if (handoffTimer != null) clearTimeout(handoffTimer);
|
|
182
|
-
isScrollLocked.value = false;
|
|
183
|
-
});
|
|
184
|
-
return (_ctx, _cache) => {
|
|
185
|
-
return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" eslint-disable-next-line vue-a11y/no-static-element-interactions -- 点在对话框空白处才关闭;键盘用 Escape,不给对话框再加一个按钮。 "), createElementVNode("dialog", mergeProps(_ctx.$attrs, {
|
|
186
|
-
ref_key: "dialog",
|
|
187
|
-
ref: dialog,
|
|
188
|
-
class: ["astryx-bottom-sheet-dialog astryx-bottom-sheet-switcher", {
|
|
189
|
-
"astryx-bottom-sheet-dialog--scrim": __props.hasScrim,
|
|
190
|
-
"astryx-bottom-sheet-dialog--closing": activeSheet.value == null
|
|
191
|
-
}],
|
|
192
|
-
"data-settled": isSettled.value || void 0,
|
|
193
|
-
"aria-label": dialogLabel.value,
|
|
194
|
-
"aria-modal": isScrollLocked.value && activeSheet.value != null ? "true" : void 0,
|
|
195
|
-
onCancel,
|
|
196
|
-
onClick: onDialogClick,
|
|
197
|
-
onKeydown
|
|
198
|
-
}), [renderSlot(_ctx.$slots, "default"), createElementVNode("div", _hoisted_2, null, 512)], 16, _hoisted_1)], 2112);
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
//#endregion
|
|
203
|
-
export { _sfc_main as t };
|
|
@@ -43,8 +43,8 @@ declare const __VLS_base: import("vue").DefineComponent<TokenProps, {}, {}, {},
|
|
|
43
43
|
onRemove?: ((event: Event) => any) | undefined;
|
|
44
44
|
}>, {
|
|
45
45
|
size: TokenSize;
|
|
46
|
-
disabled: boolean;
|
|
47
46
|
labelHidden: boolean;
|
|
47
|
+
disabled: boolean;
|
|
48
48
|
color: "default" | "blue" | "cyan" | "gray" | "green" | "orange" | "pink" | "purple" | "red" | "teal" | "yellow";
|
|
49
49
|
removable: boolean;
|
|
50
50
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|