akar 1.18.0 → 1.20.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/autocomplete/autocomplete-input.js +122 -0
- package/dist/autocomplete/autocomplete-input.js.map +1 -0
- package/dist/autocomplete/autocomplete-root.js +253 -0
- package/dist/autocomplete/autocomplete-root.js.map +1 -0
- package/dist/checkbox/checkbox-group-root.js +1 -1
- package/dist/checkbox/checkbox-root.js +1 -1
- package/dist/combobox/combobox-content-impl.js +9 -2
- package/dist/combobox/combobox-content-impl.js.map +1 -1
- package/dist/combobox/combobox-content.js +4 -0
- package/dist/combobox/combobox-content.js.map +1 -1
- package/dist/combobox/combobox-root.js +1 -1
- package/dist/composables/use-window-splitter-panel-group-behavior.js +13 -9
- package/dist/composables/use-window-splitter-panel-group-behavior.js.map +1 -1
- package/dist/constant/components.js +18 -0
- package/dist/constant/components.js.map +1 -1
- package/dist/constant.d.ts +1 -0
- package/dist/constant.d.ts.map +1 -1
- package/dist/date/use-date-field.js +1 -1
- package/dist/date/use-date-field.js.map +1 -1
- package/dist/date-field/date-field-root.js +1 -1
- package/dist/date-range-field/date-range-field-root.js +1 -1
- package/dist/dialog/dialog-content-impl.js +1 -1
- package/dist/hover-card/hover-card-content-impl.js +1 -1
- package/dist/index.d.ts +1752 -1622
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -47
- package/dist/listbox/listbox-root.js +1 -1
- package/dist/listbox/listbox-virtualizer.js +1 -1
- package/dist/menu/menu-content-impl.js +1 -1
- package/dist/menu/menu-item-impl.js +1 -1
- package/dist/namespaced/index.cjs +19 -0
- package/dist/namespaced/index.d.cts +20 -2
- package/dist/namespaced/index.d.mts +20 -2
- package/dist/namespaced/index.mjs +20 -2
- package/dist/popover/popover-content-impl.js +1 -1
- package/dist/radio-group/radio-group-root.js +1 -1
- package/dist/range-calendar/range-calendar-cell-trigger.js +3 -1
- package/dist/range-calendar/range-calendar-cell-trigger.js.map +1 -1
- package/dist/range-calendar/range-calendar-grid.js +2 -1
- package/dist/range-calendar/range-calendar-grid.js.map +1 -1
- package/dist/range-calendar/range-calendar-root.js +17 -9
- package/dist/range-calendar/range-calendar-root.js.map +1 -1
- package/dist/range-calendar/use-range-calendar.js +16 -6
- package/dist/range-calendar/use-range-calendar.js.map +1 -1
- package/dist/select/select-content-impl.js +1 -1
- package/dist/select/select-root.js +1 -1
- package/dist/select/select-trigger.js +1 -1
- package/dist/shared/use-id.js +7 -4
- package/dist/shared/use-id.js.map +1 -1
- package/dist/splitter/splitter-group.js +143 -30
- package/dist/splitter/splitter-group.js.map +1 -1
- package/dist/splitter/splitter-panel.js +7 -2
- package/dist/splitter/splitter-panel.js.map +1 -1
- package/dist/time-field/time-field-root.js +1 -1
- package/dist/toast/toast-announce.js +4 -1
- package/dist/toast/toast-announce.js.map +1 -1
- package/dist/toggle-group/toggle-group-root.js +1 -1
- package/dist/tooltip/tooltip-content-impl.js +26 -19
- package/dist/tooltip/tooltip-content-impl.js.map +1 -1
- package/dist/tooltip/tooltip-content.js +1 -2
- package/dist/tooltip/tooltip-content.js.map +1 -1
- package/dist/tooltip/tooltip-provider.js +7 -2
- package/dist/tooltip/tooltip-provider.js.map +1 -1
- package/dist/utils/storage.js +7 -1
- package/dist/utils/storage.js.map +1 -1
- package/dist/utils/units.js +82 -0
- package/dist/utils/units.js.map +1 -0
- package/package.json +1 -1
- package/src/autocomplete/autocomplete-input.vue +124 -0
- package/src/autocomplete/autocomplete-root.vue +292 -0
- package/src/autocomplete/index.ts +74 -0
- package/src/combobox/combobox-content-impl.vue +13 -1
- package/src/index.ts +1 -0
- package/src/range-calendar/range-calendar-cell-trigger.vue +4 -2
- package/src/range-calendar/range-calendar-grid.vue +1 -0
- package/src/range-calendar/range-calendar-root.vue +27 -22
- package/src/range-calendar/use-range-calendar.ts +10 -12
- package/src/shared/date/use-date-field.ts +7 -3
- package/src/shared/use-id.ts +6 -8
- package/src/splitter/splitter-group.vue +249 -54
- package/src/splitter/splitter-panel.vue +12 -7
- package/src/splitter/utils/composables/use-window-splitter-panel-group-behavior.ts +18 -7
- package/src/splitter/utils/storage.ts +14 -0
- package/src/splitter/utils/units.ts +166 -0
- package/src/splitter/utils/validation.ts +3 -2
- package/src/toast/toast-announce.vue +4 -1
- package/src/tooltip/tooltip-content-impl.vue +18 -10
- package/src/tooltip/tooltip-content.vue +1 -3
- package/src/tooltip/tooltip-provider.vue +20 -3
|
@@ -4,8 +4,8 @@ import { useFormControl } from "../shared/use-form-control.js";
|
|
|
4
4
|
import { useForwardExpose } from "../shared/use-forward-expose.js";
|
|
5
5
|
import { APrimitive } from "../primitive/primitive.js";
|
|
6
6
|
import { useSingleOrMultipleValue } from "../shared/use-single-or-multiple-value.js";
|
|
7
|
-
import { roving_focus_group_default } from "../roving-focus/roving-focus-group.js";
|
|
8
7
|
import { visually_hidden_input_default } from "../visually-hidden/visually-hidden-input.js";
|
|
8
|
+
import { roving_focus_group_default } from "../roving-focus/roving-focus-group.js";
|
|
9
9
|
import { createBlock, createCommentVNode, createVNode, defineComponent, openBlock, renderSlot, resolveDynamicComponent, toRefs, unref, withCtx } from "vue";
|
|
10
10
|
|
|
11
11
|
//#region src/toggle-group/toggle-group-root.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { useForwardExpose } from "../shared/use-forward-expose.js";
|
|
2
|
+
import { popper_content_default } from "../popper/popper-content.js";
|
|
2
3
|
import { dismissable_layer_default } from "../dismissable-layer/dismissable-layer.js";
|
|
3
4
|
import { visually_hidden_default } from "../visually-hidden/visually-hidden.js";
|
|
4
|
-
import {
|
|
5
|
+
import { injectATooltipProviderContext } from "./tooltip-provider.js";
|
|
5
6
|
import { TOOLTIP_OPEN } from "./utils.js";
|
|
6
7
|
import { injectATooltipRootContext } from "./tooltip-root.js";
|
|
7
8
|
import { computed, createBlock, createTextVNode, createVNode, defineComponent, mergeProps, onMounted, openBlock, renderSlot, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
8
9
|
import { useEventListener } from "@vueuse/core";
|
|
10
|
+
import { defu } from "defu";
|
|
9
11
|
|
|
10
12
|
//#region src/tooltip/tooltip-content-impl.vue?vue&type=script&setup=true&lang.ts
|
|
11
13
|
var tooltip_content_impl_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
@@ -17,7 +19,8 @@ var tooltip_content_impl_vue_vue_type_script_setup_true_lang_default = /* @__PUR
|
|
|
17
19
|
},
|
|
18
20
|
asChild: {
|
|
19
21
|
type: Boolean,
|
|
20
|
-
required: false
|
|
22
|
+
required: false,
|
|
23
|
+
default: void 0
|
|
21
24
|
},
|
|
22
25
|
as: {
|
|
23
26
|
type: null,
|
|
@@ -25,8 +28,7 @@ var tooltip_content_impl_vue_vue_type_script_setup_true_lang_default = /* @__PUR
|
|
|
25
28
|
},
|
|
26
29
|
align: {
|
|
27
30
|
type: String,
|
|
28
|
-
required: false
|
|
29
|
-
default: "center"
|
|
31
|
+
required: false
|
|
30
32
|
},
|
|
31
33
|
alignOffset: {
|
|
32
34
|
type: Number,
|
|
@@ -34,43 +36,37 @@ var tooltip_content_impl_vue_vue_type_script_setup_true_lang_default = /* @__PUR
|
|
|
34
36
|
},
|
|
35
37
|
arrowPadding: {
|
|
36
38
|
type: Number,
|
|
37
|
-
required: false
|
|
38
|
-
default: 0
|
|
39
|
+
required: false
|
|
39
40
|
},
|
|
40
41
|
avoidCollisions: {
|
|
41
42
|
type: Boolean,
|
|
42
43
|
required: false,
|
|
43
|
-
default:
|
|
44
|
+
default: void 0
|
|
44
45
|
},
|
|
45
46
|
collisionBoundary: {
|
|
46
47
|
type: null,
|
|
47
|
-
required: false
|
|
48
|
-
default: () => []
|
|
48
|
+
required: false
|
|
49
49
|
},
|
|
50
50
|
collisionPadding: {
|
|
51
51
|
type: [Number, Object],
|
|
52
|
-
required: false
|
|
53
|
-
default: 0
|
|
52
|
+
required: false
|
|
54
53
|
},
|
|
55
54
|
hideWhenDetached: {
|
|
56
55
|
type: Boolean,
|
|
57
56
|
required: false,
|
|
58
|
-
default:
|
|
57
|
+
default: void 0
|
|
59
58
|
},
|
|
60
59
|
side: {
|
|
61
60
|
type: String,
|
|
62
|
-
required: false
|
|
63
|
-
default: "top"
|
|
61
|
+
required: false
|
|
64
62
|
},
|
|
65
63
|
sideOffset: {
|
|
66
64
|
type: Number,
|
|
67
|
-
required: false
|
|
68
|
-
default: 0
|
|
65
|
+
required: false
|
|
69
66
|
},
|
|
70
67
|
sticky: {
|
|
71
68
|
type: String,
|
|
72
|
-
required: false
|
|
73
|
-
default: "partial"
|
|
69
|
+
required: false
|
|
74
70
|
},
|
|
75
71
|
positionStrategy: {
|
|
76
72
|
type: String,
|
|
@@ -86,11 +82,22 @@ var tooltip_content_impl_vue_vue_type_script_setup_true_lang_default = /* @__PUR
|
|
|
86
82
|
const props = __props;
|
|
87
83
|
const emits = __emit;
|
|
88
84
|
const rootContext = injectATooltipRootContext();
|
|
85
|
+
const providerContext = injectATooltipProviderContext();
|
|
89
86
|
const { forwardRef, currentElement } = useForwardExpose();
|
|
90
87
|
const ariaLabel = computed(() => props.ariaLabel || currentElement.value?.textContent);
|
|
91
88
|
const popperContentProps = computed(() => {
|
|
92
89
|
const { ariaLabel: _,...restProps } = props;
|
|
93
|
-
return restProps
|
|
90
|
+
return defu(restProps, providerContext.content.value ?? {}, {
|
|
91
|
+
side: "top",
|
|
92
|
+
sideOffset: 0,
|
|
93
|
+
align: "center",
|
|
94
|
+
avoidCollisions: true,
|
|
95
|
+
collisionBoundary: [],
|
|
96
|
+
collisionPadding: 0,
|
|
97
|
+
arrowPadding: 0,
|
|
98
|
+
sticky: "partial",
|
|
99
|
+
hideWhenDetached: false
|
|
100
|
+
});
|
|
94
101
|
});
|
|
95
102
|
onMounted(() => {
|
|
96
103
|
useEventListener(window, "scroll", (event) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-content-impl.js","names":["$attrs"],"sources":["../../src/tooltip/tooltip-content-impl.vue","../../src/tooltip/tooltip-content-impl.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tooltip-content-impl.js","names":["$attrs"],"sources":["../../src/tooltip/tooltip-content-impl.vue","../../src/tooltip/tooltip-content-impl.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDA,MAAM,QAAQ;EAKd,MAAM,QAAQ;EAEd,MAAM,cAAc,2BAA2B;EAC/C,MAAM,kBAAkB,+BAA+B;EAEvD,MAAM,EAAE,YAAY,gBAAgB,GAAG,kBAAkB;EACzD,MAAM,YAAY,SAAS,MAAM,MAAM,aAAa,eAAe,OAAO,YAAY;EAEtF,MAAM,qBAAqB,SAAS,MAAM;GACxC,MAAM,EAAE,WAAW,EAAG,GAAG,WAAW,GAAG;AAEvC,UAAO,KAAK,WAAW,gBAAgB,QAAQ,SAAS,CAAE,GAAE;IAC1D,MAAM;IACN,YAAY;IACZ,OAAO;IACP,iBAAiB;IACjB,mBAAmB,CAAE;IACrB,kBAAkB;IAClB,cAAc;IACd,QAAQ;IACR,kBAAkB;GACnB,EAAmC;EACrC,EAAC;AAEF,YAAU,MAAM;AAEd,oBAAiB,QAAQ,UAAU,CAAC,UAAU;IAC5C,MAAM,SAAS,MAAM;AACrB,QAAI,QAAQ,SAAS,YAAY,QAAQ,MAAO,CAC9C,aAAY,SAAS;GAExB,EAAC;AAEF,oBAAiB,QAAQ,cAAc,YAAY,QAAQ;EAC5D,EAAC;;uBAIA,YAiCmB,MAAA,0BAAA,EAAA;IAhCjB,YAAA;IACC,kCAAgC;IAChC,iBAAe,OAAA,OAAA,OAAA,KAAA,CAAA,WAAE,MAAK,iBAAkB,OAAM;IAC9C,sBAAoB,OAAA,OAAA,OAAA,KAAA,CAAG,UAAK;SAAiB,MAAA,YAAW,CAAC,sBAAsB,SAAS,MAAA,YAAW,CAAC,QAAQ,OAAO,SAAS,MAAM,OAAM,CAA0B,OAAM,gBAAc;AAAU,WAAK,sBAAuB,MAAK;;IAMjO,gBAAa,OAAA,OAAA,OAAA,KAAA,cAAd,MAAA,CAAsB,GAAA,CAAA,SAAA,EAAA;IACrB,WAAO,OAAA,OAAA,OAAA,KAAA,CAAA,WAAE,MAAA,YAAW,CAAC,SAAO;;qBAE7B,MAmBiB,CAnBjB,YAmBiB,MAAA,uBAAA,EAnBjB,WAmBiB;KAlBd,KAAK,MAAA,WAAU;KACf,cAAY,MAAA,YAAW,CAAC,eAAe;;QAC3BA,KAAAA;KAAM,GAAK,mBAAA;IAAkB,GAAA,EACzC,OAAO;;;;;;IAMP,EAAA,EAAA,EAAA;sBAED,MAAQ,CAAR,WAAQ,KAAA,QAAA,UAAA,EACR,YAKkB,MAAA,wBAAA,EAAA;MAJf,IAAI,MAAA,YAAW,CAAC;MACjB,MAAK;;uBAEL,MAAe,iCAAZ,UAAA,MAAS,EAAA,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-content.js","names":[],"sources":["../../src/tooltip/tooltip-content.vue","../../src/tooltip/tooltip-content.vue"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tooltip-content.js","names":[],"sources":["../../src/tooltip/tooltip-content.vue","../../src/tooltip/tooltip-content.vue"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBA,MAAM,QAAQ;EACd,MAAM,QAAQ;EAEd,MAAM,cAAc,2BAA2B;EAC/C,MAAM,YAAY,qBAAqB,OAAO,MAAM;EACpD,MAAM,EAAE,YAAY,GAAG,kBAAkB;;uBAIvC,YAQY,MAAA,iBAAA,EAAA,EARA,SAAS,QAAA,cAAc,MAAA,YAAW,CAAC,KAAK;qBAClD,MAMY,eANZ,YAMY,wBALL,MAAA,YAAW,CAAC,wBAAwB,QAAQ,+BAAqB,kCAAuB,EAD/F,WAMY,EAJT,KAAK,MAAA,WAAU,CAAA,GACR,MAAA,UAAS,CAAA,EAAA;sBAEjB,MAAQ,CAAR,WAAQ,KAAA,QAAA,UAAA"}
|
|
@@ -36,11 +36,15 @@ var tooltip_provider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
36
36
|
type: Boolean,
|
|
37
37
|
required: false,
|
|
38
38
|
default: false
|
|
39
|
+
},
|
|
40
|
+
content: {
|
|
41
|
+
type: Object,
|
|
42
|
+
required: false
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
45
|
setup(__props) {
|
|
42
46
|
const props = __props;
|
|
43
|
-
const { delayDuration, skipDelayDuration, disableHoverableContent, disableClosingTrigger, ignoreNonKeyboardFocus, disabled } = toRefs(props);
|
|
47
|
+
const { delayDuration, skipDelayDuration, disableHoverableContent, disableClosingTrigger, ignoreNonKeyboardFocus, disabled, content } = toRefs(props);
|
|
44
48
|
useForwardExpose();
|
|
45
49
|
const isOpenDelayed = ref(true);
|
|
46
50
|
const isPointerInTransitRef = ref(false);
|
|
@@ -61,7 +65,8 @@ var tooltip_provider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
61
65
|
disableHoverableContent,
|
|
62
66
|
disableClosingTrigger,
|
|
63
67
|
disabled,
|
|
64
|
-
ignoreNonKeyboardFocus
|
|
68
|
+
ignoreNonKeyboardFocus,
|
|
69
|
+
content
|
|
65
70
|
});
|
|
66
71
|
return (_ctx, _cache) => {
|
|
67
72
|
return renderSlot(_ctx.$slots, "default");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip-provider.js","names":[],"sources":["../../src/tooltip/tooltip-provider.vue","../../src/tooltip/tooltip-provider.vue"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"tooltip-provider.js","names":[],"sources":["../../src/tooltip/tooltip-provider.vue","../../src/tooltip/tooltip-provider.vue"],"sourcesContent":[],"mappings":";;;;;;AAkBA,MAAa,CACX,+BACA,8BACD,GAAG,cAAsC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD7D,MAAM,QAAQ;EAMd,MAAM,EACJ,eACA,mBACA,yBACA,uBACA,wBACA,UACA,SACD,GAAG,OAAO,MAAM;AACjB,oBAAkB;EAElB,MAAM,gBAAgB,IAAI,KAAK;EAE/B,MAAM,wBAAwB,IAAI,MAAM;EAExC,MAAM,EAAE,OAAO,YAAY,MAAM,YAAY,GAAG,aAAa,MAAM;AACjE,iBAAc,QAAQ;EACvB,GAAE,mBAAmB,EAAE,WAAW,MAAO,EAAC;AAE3C,gCAA8B;GAC5B;GACA;GACA,SAAS;AACP,gBAAY;AACZ,kBAAc,QAAQ;GACvB;GACD,UAAU;AACR,gBAAY;GACb;GACD;GACA;GACA;GACA;GACA;GACA;EACD,EAAC;;UAIA,WAAQ,KAAA,QAAA,UAAA"}
|
package/dist/utils/storage.js
CHANGED
|
@@ -45,9 +45,15 @@ function savePanelGroupState(autoSaveId, panels, panelSizesBeforeCollapse, sizes
|
|
|
45
45
|
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
46
46
|
const panelKey = getPanelKey(panels);
|
|
47
47
|
const state = loadSerializedPanelGroupState(autoSaveId, storage) ?? {};
|
|
48
|
+
const sizeUnits = {};
|
|
49
|
+
panels.forEach((panel, index) => {
|
|
50
|
+
const unit = panel.constraints.sizeUnit ?? "%";
|
|
51
|
+
if (unit === "px") sizeUnits[index] = "px";
|
|
52
|
+
});
|
|
48
53
|
state[panelKey] = {
|
|
49
54
|
expandToSizes: Object.fromEntries(panelSizesBeforeCollapse.entries()),
|
|
50
|
-
layout: sizes
|
|
55
|
+
layout: sizes,
|
|
56
|
+
...Object.keys(sizeUnits).length > 0 && { sizeUnits }
|
|
51
57
|
};
|
|
52
58
|
try {
|
|
53
59
|
storage.setItem(panelGroupKey, JSON.stringify(state));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","names":["storageObject: PanelGroupStorage","name: string","value: string","autoSaveId: string","panels: Array<PanelData>","storage: PanelGroupStorage","panelSizesBeforeCollapse: Map<string, number>","sizes: Array<number>"],"sources":["../../src/splitter/utils/storage.ts"],"sourcesContent":[],"mappings":";AAOA,SAAgB,yBAAyBA,eAAkC;AACzE,KAAI;AACF,aAAW,iBAAiB,aAAa;AAEvC,iBAAc,UAAU,CAACC,SAAiB;AACxC,WAAO,aAAa,QAAQ,KAAK;GAClC;AACD,iBAAc,UAAU,CAACA,MAAcC,UAAkB;AACvD,iBAAa,QAAQ,MAAM,MAAM;GAClC;EACF,MACC,OAAM,IAAI,UAAU;CAEvB,SAAQ,OAAO;AACd,UAAQ,MAAM,MAAM;AAEpB,gBAAc,UAAU,MAAM;AAC9B,gBAAc,UAAU,MAAM,CAAE;CACjC;AACF;
|
|
1
|
+
{"version":3,"file":"storage.js","names":["storageObject: PanelGroupStorage","name: string","value: string","autoSaveId: string","panels: Array<PanelData>","storage: PanelGroupStorage","panelSizesBeforeCollapse: Map<string, number>","sizes: Array<number>","sizeUnits: { [panelIndex: number]: 'px' | '%' }"],"sources":["../../src/splitter/utils/storage.ts"],"sourcesContent":[],"mappings":";AAOA,SAAgB,yBAAyBA,eAAkC;AACzE,KAAI;AACF,aAAW,iBAAiB,aAAa;AAEvC,iBAAc,UAAU,CAACC,SAAiB;AACxC,WAAO,aAAa,QAAQ,KAAK;GAClC;AACD,iBAAc,UAAU,CAACA,MAAcC,UAAkB;AACvD,iBAAa,QAAQ,MAAM,MAAM;GAClC;EACF,MACC,OAAM,IAAI,UAAU;CAEvB,SAAQ,OAAO;AACd,UAAQ,MAAM,MAAM;AAEpB,gBAAc,UAAU,MAAM;AAC9B,gBAAc,UAAU,MAAM,CAAE;CACjC;AACF;AAgBD,SAAS,iBAAiBC,YAA4B;AACpD,QAAO,CAAC,KAAK,EAAE,YAAY;AAC5B;AAMD,SAAS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,OAAO;AACd,UAAQ,MAAM,MAAM;CACrB;AACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/splitter/utils/units.ts
|
|
2
|
+
function convertValueToPercent({ sizeUnit, groupSizeInPixels, value }) {
|
|
3
|
+
if (value == null) return value;
|
|
4
|
+
if (sizeUnit === "%") return value;
|
|
5
|
+
if (groupSizeInPixels == null || groupSizeInPixels === 0) return void 0;
|
|
6
|
+
return value / groupSizeInPixels * 100;
|
|
7
|
+
}
|
|
8
|
+
function convertPanelConstraintsToPercent({ panelDataArray, groupSizeInPixels }) {
|
|
9
|
+
const requiresMeasurement = panelDataArray.some((panelData) => (panelData.constraints.sizeUnit ?? "%") === "px");
|
|
10
|
+
if (requiresMeasurement && (!groupSizeInPixels || Number.isNaN(groupSizeInPixels))) return null;
|
|
11
|
+
return panelDataArray.map((panelData) => {
|
|
12
|
+
const constraints = panelData.constraints;
|
|
13
|
+
const sizeUnit = constraints.sizeUnit ?? "%";
|
|
14
|
+
const collapsedSize = convertValueToPercent({
|
|
15
|
+
groupSizeInPixels,
|
|
16
|
+
sizeUnit,
|
|
17
|
+
value: constraints.collapsedSize
|
|
18
|
+
});
|
|
19
|
+
const defaultSize = convertValueToPercent({
|
|
20
|
+
groupSizeInPixels,
|
|
21
|
+
sizeUnit,
|
|
22
|
+
value: constraints.defaultSize
|
|
23
|
+
});
|
|
24
|
+
const maxSize = convertValueToPercent({
|
|
25
|
+
groupSizeInPixels,
|
|
26
|
+
sizeUnit,
|
|
27
|
+
value: constraints.maxSize
|
|
28
|
+
});
|
|
29
|
+
const minSize = convertValueToPercent({
|
|
30
|
+
groupSizeInPixels,
|
|
31
|
+
sizeUnit,
|
|
32
|
+
value: constraints.minSize
|
|
33
|
+
});
|
|
34
|
+
return {
|
|
35
|
+
...constraints,
|
|
36
|
+
collapsedSize: collapsedSize ?? constraints.collapsedSize ?? 0,
|
|
37
|
+
defaultSize,
|
|
38
|
+
maxSize: maxSize ?? 100,
|
|
39
|
+
minSize: minSize ?? 0,
|
|
40
|
+
sizeUnit: "%"
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function hasPixelSizedPanel(panelDataArray) {
|
|
45
|
+
return panelDataArray.some((panelData) => (panelData.constraints.sizeUnit ?? "%") === "px");
|
|
46
|
+
}
|
|
47
|
+
function recalculateLayoutForPixelPanels({ layout, panelDataArray, prevGroupSize, nextGroupSize }) {
|
|
48
|
+
if (!hasPixelSizedPanel(panelDataArray)) return null;
|
|
49
|
+
if (prevGroupSize == null || nextGroupSize == null || prevGroupSize === 0 || nextGroupSize === 0 || Number.isNaN(prevGroupSize) || Number.isNaN(nextGroupSize)) return null;
|
|
50
|
+
const pixelPanelIndices = panelDataArray.reduce((indices, panelData, index) => {
|
|
51
|
+
if ((panelData.constraints.sizeUnit ?? "%") === "px") indices.push(index);
|
|
52
|
+
return indices;
|
|
53
|
+
}, []);
|
|
54
|
+
if (pixelPanelIndices.length === 0) return null;
|
|
55
|
+
const pixelIndexSet = new Set(pixelPanelIndices);
|
|
56
|
+
const nextLayout = layout.map((size) => size ?? 0);
|
|
57
|
+
const nextPixelPercents = pixelPanelIndices.map((index) => {
|
|
58
|
+
const prevPercent = layout[index] ?? 0;
|
|
59
|
+
const prevPixelSize = prevPercent / 100 * prevGroupSize;
|
|
60
|
+
return prevPixelSize / nextGroupSize * 100;
|
|
61
|
+
});
|
|
62
|
+
const totalNextPixelPercent = nextPixelPercents.reduce((sum, value) => sum + value, 0);
|
|
63
|
+
const prevPercentForPercentPanels = layout.reduce((sum, size, index) => {
|
|
64
|
+
if (pixelIndexSet.has(index)) return sum;
|
|
65
|
+
return sum + (size ?? 0);
|
|
66
|
+
}, 0);
|
|
67
|
+
const availableNextPercent = Math.max(0, 100 - totalNextPixelPercent);
|
|
68
|
+
const scaleFactor = prevPercentForPercentPanels > 0 ? availableNextPercent / prevPercentForPercentPanels : 0;
|
|
69
|
+
pixelPanelIndices.forEach((panelIndex, arrayIndex) => {
|
|
70
|
+
nextLayout[panelIndex] = nextPixelPercents[arrayIndex];
|
|
71
|
+
});
|
|
72
|
+
for (let index = 0; index < nextLayout.length; index++) {
|
|
73
|
+
if (pixelIndexSet.has(index)) continue;
|
|
74
|
+
const prevSize = layout[index] ?? 0;
|
|
75
|
+
nextLayout[index] = prevSize * scaleFactor;
|
|
76
|
+
}
|
|
77
|
+
return nextLayout;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//#endregion
|
|
81
|
+
export { convertPanelConstraintsToPercent, hasPixelSizedPanel, recalculateLayoutForPixelPanels };
|
|
82
|
+
//# sourceMappingURL=units.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"units.js","names":["panelDataArray: Array<PanelData>"],"sources":["../../src/splitter/utils/units.ts"],"sourcesContent":[],"mappings":";AAeA,SAAS,sBAAsB,EAAE,UAAU,mBAAmB,OAA4B,EAAsB;AAC9G,KAAI,SAAS,KACX,QAAO;AAGT,KAAI,aAAa,IACf,QAAO;AAGT,KAAI,qBAAqB,QAAQ,sBAAsB,EACrD;AAGF,QAAQ,QAAQ,oBAAqB;AACtC;AAED,SAAgB,iCAAiC,EAC/C,gBACA,mBACmC,EAAkC;CACrE,MAAM,sBAAsB,eAAe,KACzC,CAAC,eAAe,UAAU,YAAY,YAAY,SAAS,KAC5D;AAED,KAAI,yBAAyB,qBAAqB,OAAO,MAAM,kBAAkB,EAC/E,QAAO;AAGT,QAAO,eAAe,IAAI,CAAC,cAAc;EACvC,MAAM,cAAc,UAAU;EAC9B,MAAM,WAAW,YAAY,YAAY;EAEzC,MAAM,gBAAgB,sBAAsB;GAC1C;GACA;GACA,OAAO,YAAY;EACpB,EAAC;EAEF,MAAM,cAAc,sBAAsB;GACxC;GACA;GACA,OAAO,YAAY;EACpB,EAAC;EAEF,MAAM,UAAU,sBAAsB;GACpC;GACA;GACA,OAAO,YAAY;EACpB,EAAC;EAEF,MAAM,UAAU,sBAAsB;GACpC;GACA;GACA,O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vB;AAEJ,mBAAkB,QAAQ,CAAC,YAAY,eAAe;AACpD,aAAW,cAAc,kBAAkB;CAC5C,EAAC;AAEF,MAAK,IAAI,QAAQ,GAAG,QAAQ,WAAW,QAAQ,SAAS;AACtD,MAAI,cAAc,IAAI,MAAM,CAC1B;EAGF,MAAM,WAAW,OAAO,UAAU;AAClC,aAAW,SAAS,WAAW;CAChC;AAED,QAAO;AACR"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { AListboxFilterEmits, AListboxFilterProps } from '../listbox';
|
|
3
|
+
|
|
4
|
+
export type AAutocompleteInputEmits = AListboxFilterEmits;
|
|
5
|
+
export interface AAutocompleteInputProps extends AListboxFilterProps {}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { useVModel } from '@vueuse/core';
|
|
10
|
+
import { nextTick, onMounted, watch } from 'vue';
|
|
11
|
+
import { injectAComboboxRootContext } from '../combobox/combobox-root.vue';
|
|
12
|
+
import { AListboxFilter } from '../listbox';
|
|
13
|
+
import { injectAListboxRootContext } from '../listbox/listbox-root.vue';
|
|
14
|
+
import { usePrimitiveElement } from '../primitive';
|
|
15
|
+
import { injectAAutocompleteRootContext } from './autocomplete-root.vue';
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(
|
|
18
|
+
defineProps<AAutocompleteInputProps>(),
|
|
19
|
+
{
|
|
20
|
+
as: 'input',
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
const emits = defineEmits<AAutocompleteInputEmits>();
|
|
24
|
+
|
|
25
|
+
const rootContext = injectAComboboxRootContext();
|
|
26
|
+
const autocompleteContext = injectAAutocompleteRootContext();
|
|
27
|
+
const listboxContext = injectAListboxRootContext();
|
|
28
|
+
const { primitiveElement, currentElement } = usePrimitiveElement();
|
|
29
|
+
|
|
30
|
+
const modelValue = useVModel(
|
|
31
|
+
props,
|
|
32
|
+
'modelValue',
|
|
33
|
+
emits,
|
|
34
|
+
{
|
|
35
|
+
passive: (props.modelValue === undefined) as false,
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
if (autocompleteContext.modelValue.value) {
|
|
40
|
+
modelValue.value = autocompleteContext.modelValue.value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onMounted(() => {
|
|
44
|
+
if (currentElement.value) {
|
|
45
|
+
rootContext.onInputElementChange(currentElement.value as HTMLInputElement);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
function handleKeyDown(ev: KeyboardEvent) {
|
|
50
|
+
if (!rootContext.open.value) {
|
|
51
|
+
rootContext.onOpenChange(true);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function handleInput(event: InputEvent) {
|
|
56
|
+
const target = event.target as HTMLInputElement;
|
|
57
|
+
if (!rootContext.open.value) {
|
|
58
|
+
rootContext.onOpenChange(true);
|
|
59
|
+
nextTick(() => {
|
|
60
|
+
if (target.value) {
|
|
61
|
+
rootContext.filterSearch.value = target.value;
|
|
62
|
+
listboxContext.highlightFirstItem();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
rootContext.filterSearch.value = target.value;
|
|
67
|
+
}
|
|
68
|
+
// Autocomplete-specific: update root's modelValue with the typed text
|
|
69
|
+
autocompleteContext.modelValue.value = target.value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function handleFocus() {
|
|
73
|
+
if (rootContext.openOnFocus.value && !rootContext.open.value) {
|
|
74
|
+
rootContext.onOpenChange(true);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function handleClick() {
|
|
79
|
+
if (rootContext.openOnClick.value && !rootContext.open.value) {
|
|
80
|
+
rootContext.onOpenChange(true);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// When root's modelValue changes externally (e.g. item click, programmatic), sync the input display
|
|
85
|
+
watch(autocompleteContext.modelValue, (newVal) => {
|
|
86
|
+
const text = newVal ?? '';
|
|
87
|
+
if (modelValue.value !== text) {
|
|
88
|
+
modelValue.value = text;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
// Restore input text when root triggers resetSearchTerm (e.g. on blur with resetSearchTermOnBlur)
|
|
93
|
+
rootContext.onResetSearchTerm(() => {
|
|
94
|
+
modelValue.value = autocompleteContext.modelValue.value ?? '';
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
watch(rootContext.filterState, (_newValue, oldValue) => {
|
|
98
|
+
if (!rootContext.isVirtual.value && (oldValue.count === 0)) {
|
|
99
|
+
listboxContext.highlightFirstItem();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<AListboxFilter
|
|
106
|
+
ref="primitiveElement"
|
|
107
|
+
v-model="modelValue"
|
|
108
|
+
:as="as"
|
|
109
|
+
:as-child="asChild"
|
|
110
|
+
:auto-focus="autoFocus"
|
|
111
|
+
:disabled="disabled"
|
|
112
|
+
:aria-expanded="rootContext.open.value"
|
|
113
|
+
:aria-controls="rootContext.contentId"
|
|
114
|
+
aria-autocomplete="list"
|
|
115
|
+
role="combobox"
|
|
116
|
+
autocomplete="off"
|
|
117
|
+
@click="handleClick"
|
|
118
|
+
@input="handleInput"
|
|
119
|
+
@keydown.down.up.prevent="handleKeyDown"
|
|
120
|
+
@focus="handleFocus"
|
|
121
|
+
>
|
|
122
|
+
<slot />
|
|
123
|
+
</AListboxFilter>
|
|
124
|
+
</template>
|