@vueland/ui 0.0.2 → 0.0.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/README.md +55 -45
- package/dist/components/CApp/CApp.js +2 -2
- package/dist/components/CAutocomplete/CAutocomplete.js +23 -6
- package/dist/components/CCheckbox/CCheckbox.js +1 -1
- package/dist/components/CDateInput/CDateInput.js +0 -1
- package/dist/components/CDatePicker/index4.js +1 -1
- package/dist/components/CDatePicker/index6.js +1 -1
- package/dist/components/CDialog/index.js +1 -1
- package/dist/components/CDialog/index2.js +1 -1
- package/dist/components/CInput/CInput.js +23 -14
- package/dist/components/CList/CList.js +36 -17
- package/dist/components/CList/CListItem.js +15 -10
- package/dist/components/CMenu/CMenu.js +29 -31
- package/dist/components/CSelect/CSelect.js +26 -6
- package/dist/components/CTextField/CTextField.js +1 -1
- package/dist/components/CTooltip/CTooltip.js +12 -8
- package/dist/components/CTooltip/index.js +2 -2
- package/dist/components/CTooltip/index2.js +5 -0
- package/dist/components/index.d.ts +174 -188
- package/dist/components/index.js +1 -1
- package/dist/composables/index.d.ts +124 -590
- package/dist/composables/index.js +11 -6
- package/dist/composables/use-activator.js +1 -13
- package/dist/composables/{use-app-scroll.js → use-application-scroll.js} +2 -2
- package/dist/composables/use-aria-activator.js +15 -0
- package/dist/composables/use-aria-dialog.js +16 -0
- package/dist/composables/use-aria-field.js +18 -0
- package/dist/composables/use-aria-listbox.js +14 -0
- package/dist/composables/use-aria-toggle.js +15 -0
- package/dist/composables/use-auto-position.js +51 -51
- package/dist/composables/use-breakpoints.js +8 -0
- package/dist/composables/use-delay-actions.js +9 -8
- package/dist/composables/use-display.js +4 -4
- package/dist/composables/use-presets.js +1 -3
- package/dist/constants/aria.js +32 -0
- package/dist/constants/index.d.ts +78 -37
- package/dist/constants/index.js +1 -0
- package/dist/css/lib.css +1 -0
- package/dist/css/utils/_grid.css +1 -0
- package/dist/css/utils/_grid.js +3 -0
- package/dist/css/utils/_radius.css +1 -1
- package/dist/css/utils/_typography.css +1 -1
- package/dist/library.js +5 -5
- package/dist/scss/lib.scss +26 -0
- package/dist/scss/styles.scss +1 -0
- package/dist/scss/utils/_grid.scss +173 -0
- package/dist/scss/utils/_radius.scss +4 -4
- package/dist/scss/utils/_typography.scss +13 -0
- package/dist/styles.css +1 -1
- package/dist/temp-types/src/components/CAutocomplete/CAutocomplete.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CAutocomplete/CAutocomplete.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CCheckbox/CCheckbox.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CCheckbox/CheckboxElement.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CDateInput/CDateInput.vue.d.ts +2 -2
- package/dist/temp-types/src/components/CDateInput/CDateInput.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CGrid/CRow.d.ts +1 -1
- package/dist/temp-types/src/components/CInput/CInput.vue.d.ts +2 -2
- package/dist/temp-types/src/components/CInput/CInput.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CInput/types.d.ts +2 -2
- package/dist/temp-types/src/components/CInput/types.d.ts.map +1 -1
- package/dist/temp-types/src/components/CList/CList.vue.d.ts +5 -1
- package/dist/temp-types/src/components/CList/CList.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CList/CListItem.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CList/types.d.ts +3 -1
- package/dist/temp-types/src/components/CList/types.d.ts.map +1 -1
- package/dist/temp-types/src/components/CMenu/CMenu.vue.d.ts +4 -4
- package/dist/temp-types/src/components/CMenu/CMenu.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CMenu/types.d.ts +2 -2
- package/dist/temp-types/src/components/CMenu/types.d.ts.map +1 -1
- package/dist/temp-types/src/components/CRadio/CRadio.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CSelect/CSelect.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CSelect/CSelect.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CSelectControl/CSelectControl.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CTextField/CTextField.vue.d.ts +1 -1
- package/dist/temp-types/src/components/CTextField/CTextField.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CTextField/types.d.ts +1 -1
- package/dist/temp-types/src/components/CTooltip/CTooltip.vue.d.ts +3 -1
- package/dist/temp-types/src/components/CTooltip/CTooltip.vue.d.ts.map +1 -1
- package/dist/temp-types/src/components/CTooltip/index.d.ts +7 -1
- package/dist/temp-types/src/components/CTooltip/index.d.ts.map +1 -1
- package/dist/temp-types/src/composables/index.d.ts +7 -2
- package/dist/temp-types/src/composables/index.d.ts.map +1 -1
- package/dist/temp-types/src/composables/use-activator.d.ts +0 -153
- package/dist/temp-types/src/composables/use-activator.d.ts.map +1 -1
- package/dist/temp-types/src/composables/{use-app-scroll.d.ts → use-application-scroll.d.ts} +2 -2
- package/dist/temp-types/src/composables/use-application-scroll.d.ts.map +1 -0
- package/dist/temp-types/src/composables/use-aria-activator.d.ts +8 -0
- package/dist/temp-types/src/composables/use-aria-activator.d.ts.map +1 -0
- package/dist/temp-types/src/composables/use-aria-dialog.d.ts +9 -0
- package/dist/temp-types/src/composables/use-aria-dialog.d.ts.map +1 -0
- package/dist/temp-types/src/composables/use-aria-field.d.ts +13 -0
- package/dist/temp-types/src/composables/use-aria-field.d.ts.map +1 -0
- package/dist/temp-types/src/composables/use-aria-listbox.d.ts +8 -0
- package/dist/temp-types/src/composables/use-aria-listbox.d.ts.map +1 -0
- package/dist/temp-types/src/composables/use-aria-toggle.d.ts +11 -0
- package/dist/temp-types/src/composables/use-aria-toggle.d.ts.map +1 -0
- package/dist/temp-types/src/composables/use-auto-position.d.ts +4 -284
- package/dist/temp-types/src/composables/use-auto-position.d.ts.map +1 -1
- package/dist/temp-types/src/composables/use-breakpoints.d.ts +1 -0
- package/dist/temp-types/src/composables/use-breakpoints.d.ts.map +1 -1
- package/dist/temp-types/src/composables/use-delay-actions.d.ts +0 -26
- package/dist/temp-types/src/composables/use-delay-actions.d.ts.map +1 -1
- package/dist/temp-types/src/composables/use-display.d.ts +22 -49
- package/dist/temp-types/src/composables/use-display.d.ts.map +1 -1
- package/dist/temp-types/src/composables/use-presets.d.ts +0 -14
- package/dist/temp-types/src/composables/use-presets.d.ts.map +1 -1
- package/dist/temp-types/src/constants/aria.d.ts +35 -0
- package/dist/temp-types/src/constants/aria.d.ts.map +1 -0
- package/dist/temp-types/src/constants/index.d.ts +1 -0
- package/dist/temp-types/src/constants/index.d.ts.map +1 -1
- package/dist/temp-types/src/constants/provide-keys.d.ts +3 -5
- package/dist/temp-types/src/constants/provide-keys.d.ts.map +1 -1
- package/dist/temp-types/src/utils/aria.d.ts +36 -0
- package/dist/temp-types/src/utils/aria.d.ts.map +1 -0
- package/dist/temp-types/src/utils/index.d.ts +1 -1
- package/dist/temp-types/src/utils/index.d.ts.map +1 -1
- package/dist/temp-types/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/aria.js +95 -0
- package/dist/utils/index.d.ts +40 -38
- package/dist/utils/index.js +1 -1
- package/package.json +5 -5
- package/dist/composables/use-menu-presets.js +0 -17
- package/dist/css/themes/default-theme.css +0 -1
- package/dist/scss/themes/default-theme.scss +0 -25
- package/dist/temp-types/src/composables/use-app-scroll.d.ts.map +0 -1
- package/dist/temp-types/src/composables/use-menu-presets.d.ts +0 -7
- package/dist/temp-types/src/composables/use-menu-presets.d.ts.map +0 -1
- package/dist/temp-types/src/utils/props-factory.d.ts +0 -37
- package/dist/temp-types/src/utils/props-factory.d.ts.map +0 -1
- package/dist/utils/props-factory.js +0 -25
- /package/dist/css/{themes/default-theme.js → lib.js} +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { useAppScroll } from './use-app-scroll.js';
|
|
1
|
+
export { useActivator } from './use-activator.js';
|
|
3
2
|
export { useApplication } from './use-application.js';
|
|
4
|
-
export {
|
|
3
|
+
export { useApplicationScroll } from './use-application-scroll.js';
|
|
4
|
+
export { useAriaActivator } from './use-aria-activator.js';
|
|
5
|
+
export { useAriaDialog } from './use-aria-dialog.js';
|
|
6
|
+
export { useAriaField } from './use-aria-field.js';
|
|
7
|
+
export { useAriaListbox } from './use-aria-listbox.js';
|
|
8
|
+
export { useAriaToggle } from './use-aria-toggle.js';
|
|
9
|
+
export { useAutoPosition } from './use-auto-position.js';
|
|
5
10
|
export { useAutocomplete } from './use-autocomplete.js';
|
|
11
|
+
export { useBreakpoints } from './use-breakpoints.js';
|
|
6
12
|
export { useButtonPresets } from './use-button-presets.js';
|
|
7
13
|
export { useCore } from './use-core.js';
|
|
8
|
-
export {
|
|
14
|
+
export { useDelayedActions } from './use-delay-actions.js';
|
|
9
15
|
export { createDialogsStack, useDialogsStack } from './use-dialogs-stack.js';
|
|
10
16
|
export { breakpoints, useDisplay } from './use-display.js';
|
|
11
17
|
export { useEffect } from './use-effect.js';
|
|
@@ -15,10 +21,9 @@ export { useId } from './use-id.js';
|
|
|
15
21
|
export { useInputPresets } from './use-input-presets.js';
|
|
16
22
|
export { useKeyboard } from './use-keyboard.js';
|
|
17
23
|
export { useMenu } from './use-menu.js';
|
|
18
|
-
export { useMenuPresets } from './use-menu-presets.js';
|
|
19
24
|
export { useNormalizedItems } from './use-normalized-items.js';
|
|
20
25
|
export { clearOverlayStack, useOverlayStack } from './use-overlay-stack.js';
|
|
21
|
-
export {
|
|
26
|
+
export { usePresets } from './use-presets.js';
|
|
22
27
|
export { useSelectControl } from './use-select-control.js';
|
|
23
28
|
export { useSelectedChips } from './use-selected-chips.js';
|
|
24
29
|
export { useToggle } from './use-toggle.js';
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { shallowRef, computed, unref, markRaw } from 'vue';
|
|
2
|
-
import { propsFactory } from '../utils/props-factory.js';
|
|
3
2
|
|
|
4
|
-
const makeActivatorProps = propsFactory({
|
|
5
|
-
closeOnClick: Boolean,
|
|
6
|
-
openOnClick: Boolean,
|
|
7
|
-
openOnHover: Boolean,
|
|
8
|
-
closeOnLeave: Boolean,
|
|
9
|
-
openOnFocus: Boolean,
|
|
10
|
-
activator: {
|
|
11
|
-
type: null,
|
|
12
|
-
default: void 0
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
3
|
function useActivator(props) {
|
|
16
4
|
const activatorEl = shallowRef(props.activator);
|
|
17
5
|
const element = computed(() => getActivator());
|
|
@@ -46,4 +34,4 @@ function useActivator(props) {
|
|
|
46
34
|
};
|
|
47
35
|
}
|
|
48
36
|
|
|
49
|
-
export {
|
|
37
|
+
export { useActivator };
|
|
@@ -2,7 +2,7 @@ import { shallowReactive, shallowRef, computed, unref } from 'vue';
|
|
|
2
2
|
import { convertToUnit } from '../utils/convert-to-unit.js';
|
|
3
3
|
import { IN_BROWSER } from '../utils/globals.js';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function useApplicationScroll() {
|
|
6
6
|
const state = shallowReactive({ blockScroll: false });
|
|
7
7
|
const appRef = shallowRef();
|
|
8
8
|
let savedScrollTop = 0;
|
|
@@ -48,4 +48,4 @@ function useAppScroll() {
|
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export {
|
|
51
|
+
export { useApplicationScroll };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { ariaExpandable } from '../utils/aria.js';
|
|
3
|
+
|
|
4
|
+
function useAriaActivator(state) {
|
|
5
|
+
return computed(() => {
|
|
6
|
+
var _a;
|
|
7
|
+
const s = state();
|
|
8
|
+
return ariaExpandable(s.expanded, {
|
|
9
|
+
haspopup: (_a = s.haspopup) != null ? _a : true,
|
|
10
|
+
controls: s.controls
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useAriaActivator };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { ariaDescribedBy, ariaLabelledBy, ariaModal } from '../utils/aria.js';
|
|
3
|
+
|
|
4
|
+
function useAriaDialog(state = () => ({})) {
|
|
5
|
+
return computed(() => {
|
|
6
|
+
var _a;
|
|
7
|
+
const s = state();
|
|
8
|
+
return {
|
|
9
|
+
...ariaModal((_a = s.modal) != null ? _a : true),
|
|
10
|
+
...ariaLabelledBy(s.labelledBy),
|
|
11
|
+
...ariaDescribedBy(s.describedBy)
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { useAriaDialog };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { ariaDisabled, ariaReadonly, ariaErrorMessage, ariaInvalid, ariaDescribedBy, ariaLabelledBy } from '../utils/aria.js';
|
|
3
|
+
|
|
4
|
+
function useAriaField(state) {
|
|
5
|
+
return computed(() => {
|
|
6
|
+
const s = state();
|
|
7
|
+
return {
|
|
8
|
+
...ariaLabelledBy(s.label ? `${s.fieldId}-label` : void 0),
|
|
9
|
+
...ariaDescribedBy(s.hasDetails ? `${s.fieldId}-details` : void 0),
|
|
10
|
+
...ariaInvalid(s.hasError),
|
|
11
|
+
...ariaErrorMessage(s.errorMessage && s.hasDetails ? `${s.fieldId}-details` : void 0),
|
|
12
|
+
...ariaReadonly(s.readonly),
|
|
13
|
+
...ariaDisabled(s.disabled)
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { useAriaField };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { ariaActiveDescendant, ariaMultiselectable } from '../utils/aria.js';
|
|
3
|
+
|
|
4
|
+
function useAriaListbox(state) {
|
|
5
|
+
return computed(() => {
|
|
6
|
+
const s = state();
|
|
7
|
+
return {
|
|
8
|
+
...ariaMultiselectable(s.multiple),
|
|
9
|
+
...ariaActiveDescendant(s.activeDescendant)
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useAriaListbox };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { ariaRequired, ariaDisabled, ariaPressed, ariaChecked } from '../utils/aria.js';
|
|
3
|
+
|
|
4
|
+
function useAriaToggle(state) {
|
|
5
|
+
return computed(() => {
|
|
6
|
+
const s = state();
|
|
7
|
+
return {
|
|
8
|
+
...s.mode === "button" ? ariaPressed(s.checked) : ariaChecked(s.checked),
|
|
9
|
+
...ariaDisabled(s.disabled),
|
|
10
|
+
...ariaRequired(s.required)
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useAriaToggle };
|
|
@@ -2,23 +2,22 @@ import { ref, shallowRef, computed, unref, watch, onBeforeUnmount, nextTick } fr
|
|
|
2
2
|
import { isDef } from '../helpers/index.js';
|
|
3
3
|
import { useApplication } from './use-application.js';
|
|
4
4
|
import { IN_BROWSER } from '../utils/globals.js';
|
|
5
|
-
import { propsFactory } from '../utils/props-factory.js';
|
|
6
5
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
const SCREEN_EDGE_OFFSET = 10;
|
|
7
|
+
const REVERSE_SIDE = {
|
|
8
|
+
top: "bottom",
|
|
9
|
+
bottom: "top",
|
|
10
|
+
left: "right",
|
|
11
|
+
right: "left"
|
|
12
|
+
};
|
|
13
|
+
function parseSide(align) {
|
|
14
|
+
return align == null ? void 0 : align.split("-")[0];
|
|
15
|
+
}
|
|
16
|
+
function parseCross(align) {
|
|
17
|
+
if (!align) return void 0;
|
|
18
|
+
const idx = align.indexOf("-");
|
|
19
|
+
return idx === -1 ? void 0 : align.slice(idx + 1);
|
|
20
|
+
}
|
|
22
21
|
function resolveElement(value) {
|
|
23
22
|
var _a;
|
|
24
23
|
if (!value) {
|
|
@@ -68,9 +67,12 @@ function useAutoPosition(props, activatorEl) {
|
|
|
68
67
|
const contentRef = shallowRef();
|
|
69
68
|
const offsetX = computed(() => Number(props.offsetX) || 0);
|
|
70
69
|
const offsetY = computed(() => Number(props.offsetY) || 0);
|
|
71
|
-
const
|
|
70
|
+
const side = computed(() => parseSide(props.align));
|
|
71
|
+
const cross = computed(() => parseCross(props.align));
|
|
72
|
+
const isHorizontalSide = computed(() => unref(side) === "left" || unref(side) === "right");
|
|
72
73
|
const isReverseStrategy = computed(() => props.strategy === "reverse");
|
|
73
74
|
let frameId = 0;
|
|
75
|
+
let updateInFlight = false;
|
|
74
76
|
const getActivatorElement = () => {
|
|
75
77
|
return resolveElement(unref(activatorEl));
|
|
76
78
|
};
|
|
@@ -133,45 +135,40 @@ function useAutoPosition(props, activatorEl) {
|
|
|
133
135
|
isBeyondBottom: top + height > bottomEdge
|
|
134
136
|
};
|
|
135
137
|
};
|
|
136
|
-
const getBaseTop = () => {
|
|
138
|
+
const getBaseTop = (s = unref(side), c = unref(cross)) => {
|
|
137
139
|
if (isDef(props.positionY)) {
|
|
138
140
|
return props.positionY + unref(offsetY);
|
|
139
141
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return unref(activator).top + unref(offsetY);
|
|
142
|
+
const act = unref(activator);
|
|
143
|
+
const cnt = unref(content);
|
|
144
|
+
if (s === "top") return act.top - cnt.height - unref(offsetY);
|
|
145
|
+
if (s === "bottom") return act.top + act.height + unref(offsetY);
|
|
146
|
+
if (c === "center") return act.top + act.height / 2 - cnt.height / 2;
|
|
147
|
+
return act.top + unref(offsetY);
|
|
147
148
|
};
|
|
148
|
-
const getBaseLeft = () => {
|
|
149
|
+
const getBaseLeft = (s = unref(side), c = unref(cross)) => {
|
|
149
150
|
if (isDef(props.positionX)) {
|
|
150
151
|
return props.positionX + unref(offsetX);
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return
|
|
153
|
+
const act = unref(activator);
|
|
154
|
+
const cnt = unref(content);
|
|
155
|
+
if (s === "left") return act.left - cnt.width - unref(offsetX);
|
|
156
|
+
if (s === "right") return act.left + act.width + unref(offsetX);
|
|
157
|
+
if (c === "center") return act.left + act.width / 2 - cnt.width / 2;
|
|
158
|
+
if (c === "right") return act.left + act.width - cnt.width;
|
|
159
|
+
return act.left + unref(offsetX);
|
|
159
160
|
};
|
|
160
161
|
const getReversedTop = () => {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (props.bottom) {
|
|
165
|
-
return unref(activator).top - unref(content).height - unref(offsetY);
|
|
162
|
+
const s = unref(side);
|
|
163
|
+
if (s && !unref(isHorizontalSide)) {
|
|
164
|
+
return getBaseTop(REVERSE_SIDE[s]);
|
|
166
165
|
}
|
|
167
166
|
return getBaseTop();
|
|
168
167
|
};
|
|
169
168
|
const getReversedLeft = () => {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (props.right) {
|
|
174
|
-
return unref(activator).left - unref(content).width - unref(offsetX);
|
|
169
|
+
const s = unref(side);
|
|
170
|
+
if (s && unref(isHorizontalSide)) {
|
|
171
|
+
return getBaseLeft(REVERSE_SIDE[s]);
|
|
175
172
|
}
|
|
176
173
|
return getBaseLeft();
|
|
177
174
|
};
|
|
@@ -207,7 +204,7 @@ function useAutoPosition(props, activatorEl) {
|
|
|
207
204
|
if (!isBeyondTop && !isBeyondBottom) {
|
|
208
205
|
return top;
|
|
209
206
|
}
|
|
210
|
-
if (!unref(isReverseStrategy) || unref(
|
|
207
|
+
if (!unref(isReverseStrategy) || unref(isHorizontalSide)) {
|
|
211
208
|
return clampTopToViewport(top);
|
|
212
209
|
}
|
|
213
210
|
return getReversedTop();
|
|
@@ -218,7 +215,7 @@ function useAutoPosition(props, activatorEl) {
|
|
|
218
215
|
if (!isBeyondLeft && !isBeyondRight) {
|
|
219
216
|
return left;
|
|
220
217
|
}
|
|
221
|
-
if (!unref(isReverseStrategy) || !unref(
|
|
218
|
+
if (!unref(isReverseStrategy) || !unref(isHorizontalSide)) {
|
|
222
219
|
return clampLeftToViewport(left);
|
|
223
220
|
}
|
|
224
221
|
return getReversedLeft();
|
|
@@ -253,13 +250,17 @@ function useAutoPosition(props, activatorEl) {
|
|
|
253
250
|
});
|
|
254
251
|
};
|
|
255
252
|
const update = async () => {
|
|
253
|
+
updateInFlight = true;
|
|
254
|
+
cancelScheduledUpdate();
|
|
256
255
|
setActivatorDimensions();
|
|
257
256
|
await nextTick();
|
|
258
257
|
if (!setContentDimensions()) {
|
|
258
|
+
updateInFlight = false;
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
261
|
await nextTick();
|
|
262
262
|
applyPosition();
|
|
263
|
+
updateInFlight = false;
|
|
263
264
|
};
|
|
264
265
|
if (IN_BROWSER) {
|
|
265
266
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
@@ -274,7 +275,9 @@ function useAutoPosition(props, activatorEl) {
|
|
|
274
275
|
}
|
|
275
276
|
current.width = width;
|
|
276
277
|
current.height = height;
|
|
277
|
-
|
|
278
|
+
if (!updateInFlight) {
|
|
279
|
+
scheduleUpdate();
|
|
280
|
+
}
|
|
278
281
|
});
|
|
279
282
|
watch(
|
|
280
283
|
() => resolveElement(unref(activatorEl)),
|
|
@@ -302,10 +305,7 @@ function useAutoPosition(props, activatorEl) {
|
|
|
302
305
|
() => [
|
|
303
306
|
props.positionX,
|
|
304
307
|
props.positionY,
|
|
305
|
-
props.
|
|
306
|
-
props.bottom,
|
|
307
|
-
props.left,
|
|
308
|
-
props.right,
|
|
308
|
+
props.align,
|
|
309
309
|
props.offsetX,
|
|
310
310
|
props.offsetY,
|
|
311
311
|
props.strategy
|
|
@@ -325,4 +325,4 @@ function useAutoPosition(props, activatorEl) {
|
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
export {
|
|
328
|
+
export { useAutoPosition };
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { isDef } from '../helpers/index.js';
|
|
2
|
-
import { propsFactory } from '../utils/props-factory.js';
|
|
3
2
|
|
|
4
|
-
const makeDelayProps = propsFactory({
|
|
5
|
-
openDelay: [Number, String],
|
|
6
|
-
closeDelay: [Number, String]
|
|
7
|
-
});
|
|
8
3
|
function useDelayedActions(props) {
|
|
4
|
+
let openTimer;
|
|
5
|
+
let closeTimer;
|
|
9
6
|
const openDelay = (fn) => {
|
|
10
|
-
|
|
7
|
+
clearTimeout(closeTimer);
|
|
8
|
+
clearTimeout(openTimer);
|
|
9
|
+
openTimer = setTimeout(fn, isDef(props.openDelay) ? +props.openDelay : 0);
|
|
11
10
|
};
|
|
12
11
|
const closeDelay = (fn) => {
|
|
13
|
-
|
|
12
|
+
clearTimeout(openTimer);
|
|
13
|
+
clearTimeout(closeTimer);
|
|
14
|
+
closeTimer = setTimeout(fn, isDef(props.closeDelay) ? +props.closeDelay : 0);
|
|
14
15
|
};
|
|
15
16
|
return {
|
|
16
17
|
openDelay,
|
|
@@ -18,4 +19,4 @@ function useDelayedActions(props) {
|
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
export {
|
|
22
|
+
export { useDelayedActions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { shallowReactive, shallowRef, watchEffect, unref, toRefs } from 'vue';
|
|
2
2
|
import { BreakpointLabels } from '../enums/BreakpointLabels.js';
|
|
3
3
|
import { IN_BROWSER } from '../utils/globals.js';
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ const breakpoints = {
|
|
|
11
11
|
[BreakpointLabels.XXL]: 2560
|
|
12
12
|
};
|
|
13
13
|
function useDisplay() {
|
|
14
|
-
const state =
|
|
14
|
+
const state = shallowReactive({
|
|
15
15
|
xxl: false,
|
|
16
16
|
xl: false,
|
|
17
17
|
lg: false,
|
|
@@ -68,12 +68,12 @@ function useDisplay() {
|
|
|
68
68
|
state.smAndLess = screen <= sm && screen > xs;
|
|
69
69
|
});
|
|
70
70
|
return {
|
|
71
|
-
...toRefs(state)
|
|
72
|
-
update
|
|
71
|
+
...toRefs(state)
|
|
73
72
|
};
|
|
74
73
|
};
|
|
75
74
|
return {
|
|
76
75
|
state,
|
|
76
|
+
update,
|
|
77
77
|
createDisplay
|
|
78
78
|
};
|
|
79
79
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { computed } from 'vue';
|
|
2
2
|
import { useCore } from './use-core.js';
|
|
3
|
-
import { propsFactory } from '../utils/props-factory.js';
|
|
4
3
|
|
|
5
|
-
const makePresetProps = propsFactory({ preset: String });
|
|
6
4
|
function usePresets(props) {
|
|
7
5
|
const core = useCore();
|
|
8
6
|
return computed(() => {
|
|
@@ -11,4 +9,4 @@ function usePresets(props) {
|
|
|
11
9
|
});
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
export {
|
|
12
|
+
export { usePresets };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const ARIA = {
|
|
2
|
+
EXPANDED: "aria-expanded",
|
|
3
|
+
HASPOPUP: "aria-haspopup",
|
|
4
|
+
CONTROLS: "aria-controls",
|
|
5
|
+
LABEL: "aria-label",
|
|
6
|
+
LABELLEDBY: "aria-labelledby",
|
|
7
|
+
DESCRIBEDBY: "aria-describedby",
|
|
8
|
+
ERRORMESSAGE: "aria-errormessage",
|
|
9
|
+
HIDDEN: "aria-hidden",
|
|
10
|
+
DISABLED: "aria-disabled",
|
|
11
|
+
INVALID: "aria-invalid",
|
|
12
|
+
READONLY: "aria-readonly",
|
|
13
|
+
SELECTED: "aria-selected",
|
|
14
|
+
MULTISELECTABLE: "aria-multiselectable",
|
|
15
|
+
REQUIRED: "aria-required",
|
|
16
|
+
LIVE: "aria-live",
|
|
17
|
+
ATOMIC: "aria-atomic",
|
|
18
|
+
BUSY: "aria-busy",
|
|
19
|
+
CURRENT: "aria-current",
|
|
20
|
+
PRESSED: "aria-pressed",
|
|
21
|
+
CHECKED: "aria-checked",
|
|
22
|
+
VALUENOW: "aria-valuenow",
|
|
23
|
+
VALUEMIN: "aria-valuemin",
|
|
24
|
+
VALUEMAX: "aria-valuemax",
|
|
25
|
+
VALUETEXT: "aria-valuetext",
|
|
26
|
+
MODAL: "aria-modal",
|
|
27
|
+
ACTIVEDESCENDANT: "aria-activedescendant",
|
|
28
|
+
AUTOCOMPLETE: "aria-autocomplete",
|
|
29
|
+
ORIENTATION: "aria-orientation"
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { ARIA };
|
|
@@ -1,4 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ref, ShallowRef, ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare const ARIA: {
|
|
4
|
+
readonly EXPANDED: "aria-expanded";
|
|
5
|
+
readonly HASPOPUP: "aria-haspopup";
|
|
6
|
+
readonly CONTROLS: "aria-controls";
|
|
7
|
+
readonly LABEL: "aria-label";
|
|
8
|
+
readonly LABELLEDBY: "aria-labelledby";
|
|
9
|
+
readonly DESCRIBEDBY: "aria-describedby";
|
|
10
|
+
readonly ERRORMESSAGE: "aria-errormessage";
|
|
11
|
+
readonly HIDDEN: "aria-hidden";
|
|
12
|
+
readonly DISABLED: "aria-disabled";
|
|
13
|
+
readonly INVALID: "aria-invalid";
|
|
14
|
+
readonly READONLY: "aria-readonly";
|
|
15
|
+
readonly SELECTED: "aria-selected";
|
|
16
|
+
readonly MULTISELECTABLE: "aria-multiselectable";
|
|
17
|
+
readonly REQUIRED: "aria-required";
|
|
18
|
+
readonly LIVE: "aria-live";
|
|
19
|
+
readonly ATOMIC: "aria-atomic";
|
|
20
|
+
readonly BUSY: "aria-busy";
|
|
21
|
+
readonly CURRENT: "aria-current";
|
|
22
|
+
readonly PRESSED: "aria-pressed";
|
|
23
|
+
readonly CHECKED: "aria-checked";
|
|
24
|
+
readonly VALUENOW: "aria-valuenow";
|
|
25
|
+
readonly VALUEMIN: "aria-valuemin";
|
|
26
|
+
readonly VALUEMAX: "aria-valuemax";
|
|
27
|
+
readonly VALUETEXT: "aria-valuetext";
|
|
28
|
+
readonly MODAL: "aria-modal";
|
|
29
|
+
readonly ACTIVEDESCENDANT: "aria-activedescendant";
|
|
30
|
+
readonly AUTOCOMPLETE: "aria-autocomplete";
|
|
31
|
+
readonly ORIENTATION: "aria-orientation";
|
|
32
|
+
};
|
|
33
|
+
type AriaKey = typeof ARIA[keyof typeof ARIA];
|
|
34
|
+
type AriaHaspopup = 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
35
|
+
type AriaLive = 'off' | 'polite' | 'assertive';
|
|
36
|
+
type AriaCurrent = 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
2
37
|
|
|
3
38
|
declare const FIELD_ATTRS: Set<string>;
|
|
4
39
|
|
|
@@ -122,6 +157,42 @@ type ApplicationApi = {
|
|
|
122
157
|
getScrollLeft(): number;
|
|
123
158
|
};
|
|
124
159
|
|
|
160
|
+
interface Breakpoints {
|
|
161
|
+
xxl: boolean;
|
|
162
|
+
xl: boolean;
|
|
163
|
+
lg: boolean;
|
|
164
|
+
md: boolean;
|
|
165
|
+
sm: boolean;
|
|
166
|
+
xs: boolean;
|
|
167
|
+
xlAndLess: boolean;
|
|
168
|
+
lgAndLess: boolean;
|
|
169
|
+
mdAndLess: boolean;
|
|
170
|
+
smAndLess: boolean;
|
|
171
|
+
xlAndUp: boolean;
|
|
172
|
+
lgAndUp: boolean;
|
|
173
|
+
mdAndUp: boolean;
|
|
174
|
+
smAndUp: boolean;
|
|
175
|
+
}
|
|
176
|
+
type Display = {
|
|
177
|
+
[k in keyof Breakpoints]: Ref<boolean>;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
type DialogStackItem = {
|
|
181
|
+
id: number;
|
|
182
|
+
component: any;
|
|
183
|
+
props?: Record<string, any>;
|
|
184
|
+
};
|
|
185
|
+
interface DialogsStackAPI {
|
|
186
|
+
stack: ShallowRef<DialogStackItem[]>;
|
|
187
|
+
current: ComputedRef<DialogStackItem | undefined>;
|
|
188
|
+
openDialog: (options: {
|
|
189
|
+
component: () => Promise<any>;
|
|
190
|
+
props?: Record<string, any>;
|
|
191
|
+
}) => Promise<number>;
|
|
192
|
+
closeDialog: (id?: number) => void;
|
|
193
|
+
closeAll: () => void;
|
|
194
|
+
}
|
|
195
|
+
|
|
125
196
|
type ValidatorFn = () => boolean | Promise<boolean>;
|
|
126
197
|
type ResetFn = () => void;
|
|
127
198
|
interface FormAPI {
|
|
@@ -138,53 +209,23 @@ type ListItemControls = {
|
|
|
138
209
|
};
|
|
139
210
|
type ListAPI<T = any> = {
|
|
140
211
|
role: ComputedRef<CListRole>;
|
|
141
|
-
|
|
212
|
+
listId: string;
|
|
213
|
+
register(controls: ListItemControls): number;
|
|
142
214
|
unregister(controls: ListItemControls): void;
|
|
143
215
|
select(value: T): void;
|
|
144
216
|
unselect(value: T): void;
|
|
145
217
|
isActive(value: T): boolean;
|
|
218
|
+
setDescendant(id: string | undefined): void;
|
|
146
219
|
};
|
|
147
220
|
|
|
148
|
-
type DialogStackItem = {
|
|
149
|
-
id: number;
|
|
150
|
-
component: any;
|
|
151
|
-
props?: Record<string, any>;
|
|
152
|
-
};
|
|
153
|
-
interface DialogsStackAPI {
|
|
154
|
-
stack: ShallowRef<DialogStackItem[]>;
|
|
155
|
-
current: ComputedRef<DialogStackItem | undefined>;
|
|
156
|
-
openDialog: (options: {
|
|
157
|
-
component: () => Promise<any>;
|
|
158
|
-
props?: Record<string, any>;
|
|
159
|
-
}) => Promise<number>;
|
|
160
|
-
closeDialog: (id?: number) => void;
|
|
161
|
-
closeAll: () => void;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
interface AppBreakpoints {
|
|
165
|
-
xxl: MaybeRef<boolean>;
|
|
166
|
-
xl: MaybeRef<boolean>;
|
|
167
|
-
lg: MaybeRef<boolean>;
|
|
168
|
-
md: MaybeRef<boolean>;
|
|
169
|
-
sm: MaybeRef<boolean>;
|
|
170
|
-
xs: MaybeRef<boolean>;
|
|
171
|
-
xlAndLess: MaybeRef<boolean>;
|
|
172
|
-
lgAndLess: MaybeRef<boolean>;
|
|
173
|
-
mdAndLess: MaybeRef<boolean>;
|
|
174
|
-
smAndLess: MaybeRef<boolean>;
|
|
175
|
-
xlAndUp: MaybeRef<boolean>;
|
|
176
|
-
lgAndUp: MaybeRef<boolean>;
|
|
177
|
-
mdAndUp: MaybeRef<boolean>;
|
|
178
|
-
smAndUp: MaybeRef<boolean>;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
221
|
declare const $FORM_API_KEY: InjectionKey<FormAPI>;
|
|
182
222
|
declare const $LIST_API_KEY: InjectionKey<ListAPI>;
|
|
183
223
|
declare const $MENU_API_KEY: InjectionKey<any>;
|
|
184
224
|
declare const $APP_API_KEY: InjectionKey<ApplicationApi>;
|
|
185
225
|
declare const $SELECT_CONTROL_API_KEY: InjectionKey<any>;
|
|
186
|
-
declare const $BREAKPOINTS_KEY: InjectionKey<
|
|
226
|
+
declare const $BREAKPOINTS_KEY: InjectionKey<Display>;
|
|
187
227
|
declare const $VUELAND_UI_KEY: InjectionKey<any>;
|
|
188
228
|
declare const $DIALOGS_STACK_API_KEY: InjectionKey<DialogsStackAPI>;
|
|
189
229
|
|
|
190
|
-
export { $APP_API_KEY, $BREAKPOINTS_KEY, $DIALOGS_STACK_API_KEY, $FORM_API_KEY, $LIST_API_KEY, $MENU_API_KEY, $SELECT_CONTROL_API_KEY, $VUELAND_UI_KEY, ALIASES, BREAKPOINTS, FIELD_ATTRS, ICONS };
|
|
230
|
+
export { $APP_API_KEY, $BREAKPOINTS_KEY, $DIALOGS_STACK_API_KEY, $FORM_API_KEY, $LIST_API_KEY, $MENU_API_KEY, $SELECT_CONTROL_API_KEY, $VUELAND_UI_KEY, ALIASES, ARIA, BREAKPOINTS, FIELD_ATTRS, ICONS };
|
|
231
|
+
export type { AriaCurrent, AriaHaspopup, AriaKey, AriaLive };
|
package/dist/constants/index.js
CHANGED