sit-onyx 1.0.0-beta.76 → 1.0.0-beta.78
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/components/OnyxMoreList/OnyxMoreList.vue.d.ts +17 -9
- package/dist/components/OnyxMoreList/types.d.ts +0 -9
- package/dist/composables/useMoreList.d.ts +48 -51
- package/dist/composables/useResizeObserver.d.ts +11 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +1582 -1580
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/styles/mixins/input.scss +28 -2
|
@@ -3,34 +3,42 @@ declare function __VLS_template(): {
|
|
|
3
3
|
attrs: Partial<{}>;
|
|
4
4
|
slots: Readonly<{
|
|
5
5
|
/**
|
|
6
|
-
* List of components to render. Each child must implement the `
|
|
6
|
+
* List of components to render. Each child must implement the `useMoreListChild()` composable.
|
|
7
7
|
*/
|
|
8
|
-
default(
|
|
8
|
+
default(props: {
|
|
9
|
+
attributes: object;
|
|
10
|
+
}): unknown;
|
|
9
11
|
/**
|
|
10
12
|
* Slot to display at the end if not all default slot elements fit in the available width.
|
|
11
13
|
*/
|
|
12
|
-
more(props: MoreListSlotBindings
|
|
14
|
+
more(props: MoreListSlotBindings & {
|
|
15
|
+
attributes: object;
|
|
16
|
+
}): unknown;
|
|
13
17
|
}> & {
|
|
14
18
|
/**
|
|
15
|
-
* List of components to render. Each child must implement the `
|
|
19
|
+
* List of components to render. Each child must implement the `useMoreListChild()` composable.
|
|
16
20
|
*/
|
|
17
|
-
default(
|
|
21
|
+
default(props: {
|
|
22
|
+
attributes: object;
|
|
23
|
+
}): unknown;
|
|
18
24
|
/**
|
|
19
25
|
* Slot to display at the end if not all default slot elements fit in the available width.
|
|
20
26
|
*/
|
|
21
|
-
more(props: MoreListSlotBindings
|
|
27
|
+
more(props: MoreListSlotBindings & {
|
|
28
|
+
attributes: object;
|
|
29
|
+
}): unknown;
|
|
22
30
|
};
|
|
23
31
|
refs: {
|
|
24
|
-
parentRef:
|
|
32
|
+
parentRef: HTMLDivElement;
|
|
25
33
|
};
|
|
26
|
-
rootEl:
|
|
34
|
+
rootEl: HTMLDivElement;
|
|
27
35
|
};
|
|
28
36
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
29
37
|
declare const __VLS_component: import("vue").DefineComponent<OnyxMoreListProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
38
|
visibilityChange: (args_0: MoreListSlotBindings) => any;
|
|
31
39
|
}, string, import("vue").PublicProps, Readonly<OnyxMoreListProps> & Readonly<{
|
|
32
40
|
onVisibilityChange?: ((args_0: MoreListSlotBindings) => any) | undefined;
|
|
33
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {},
|
|
41
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
34
42
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
35
43
|
export default _default;
|
|
36
44
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import type { MoreListInjectionKey } from "../../composables/useMoreList";
|
|
2
2
|
export type OnyxMoreListProps = {
|
|
3
|
-
/**
|
|
4
|
-
* Component to render (e.g. `<ul>` or `<div>`).
|
|
5
|
-
*/
|
|
6
|
-
is: string;
|
|
7
3
|
/**
|
|
8
4
|
* Injection key to use. Must match the one used in the child components.
|
|
9
5
|
* Will not be reactive so it must not be changed.
|
|
10
6
|
*/
|
|
11
7
|
injectionKey: MoreListInjectionKey;
|
|
12
|
-
/**
|
|
13
|
-
* Whether the intersection observer should be disabled (e.g. when more feature is currently not needed due to mobile layout).
|
|
14
|
-
* Can increase performance.
|
|
15
|
-
*/
|
|
16
|
-
disabled?: boolean;
|
|
17
8
|
};
|
|
18
9
|
export type MoreListSlotBindings = {
|
|
19
10
|
/**
|
|
@@ -1,40 +1,22 @@
|
|
|
1
1
|
import { type InjectionKey, type Ref } from "vue";
|
|
2
|
-
|
|
3
|
-
* Template ref of either a native HTML element or a custom Vue component.
|
|
4
|
-
*/
|
|
5
|
-
export type HTMLOrInstanceRef = Element | {
|
|
6
|
-
$el: Element;
|
|
7
|
-
} | null | undefined;
|
|
2
|
+
import { type VueTemplateRefElement } from "./useResizeObserver";
|
|
8
3
|
/**
|
|
9
4
|
* Injection key for providing "more" data to child components of a list to e.g. render a "+3 more" indicator.
|
|
10
5
|
*/
|
|
11
|
-
export type MoreListInjectionKey = InjectionKey<
|
|
12
|
-
/**
|
|
13
|
-
* Map of components in the list. Key = unique ID, value = component template ref
|
|
14
|
-
*/
|
|
15
|
-
components: Map<string, Ref<HTMLOrInstanceRef>>;
|
|
16
|
-
/**
|
|
17
|
-
* List of component IDs that are currently fully visible.
|
|
18
|
-
*/
|
|
19
|
-
visibleElements: Ref<string[]>;
|
|
20
|
-
/**
|
|
21
|
-
* Whether the intersection observer should be disabled (e.g. when more feature is currently not needed due to mobile layout).
|
|
22
|
-
*/
|
|
23
|
-
disabled: Ref<boolean>;
|
|
24
|
-
}>;
|
|
6
|
+
export type MoreListInjectionKey = InjectionKey<ReturnType<typeof useMoreList>>;
|
|
25
7
|
export type UseMoreListOptions = {
|
|
26
8
|
/**
|
|
27
|
-
* Vue template ref for the parent element containing the list of components.
|
|
9
|
+
* Vue template ref for the parent element containing the more indicator as well as the list of components.
|
|
28
10
|
*/
|
|
29
|
-
parentRef: Ref<
|
|
11
|
+
parentRef: Ref<VueTemplateRefElement>;
|
|
30
12
|
/**
|
|
31
|
-
*
|
|
13
|
+
* Vue template ref for the element containing the list of components.
|
|
32
14
|
*/
|
|
33
|
-
|
|
15
|
+
listRef: Ref<VueTemplateRefElement>;
|
|
34
16
|
/**
|
|
35
|
-
*
|
|
17
|
+
* Vue template ref for the more indicator element that might be shown if not all elements are visible.
|
|
36
18
|
*/
|
|
37
|
-
|
|
19
|
+
moreIndicatorRef: Ref<VueTemplateRefElement>;
|
|
38
20
|
};
|
|
39
21
|
/**
|
|
40
22
|
* Composable for managing a list of components where e.g. a "+3" more indicator should be shown if not all components
|
|
@@ -44,30 +26,45 @@ export type UseMoreListOptions = {
|
|
|
44
26
|
*
|
|
45
27
|
* ```vue
|
|
46
28
|
* <script lang="ts" setup>
|
|
47
|
-
* import { ref,
|
|
48
|
-
* import {
|
|
49
|
-
* import OnyxNavButton from "../OnyxNavBar/modules/OnyxNavButton/OnyxNavButton.vue";
|
|
29
|
+
* import { provide, ref, watch } from "vue";
|
|
30
|
+
* import { useMoreList, NAV_BAR_MORE_LIST_INJECTION_KEY } from "sit-onyx";
|
|
50
31
|
*
|
|
51
32
|
* const parentRef = ref<HTMLElement>();
|
|
52
|
-
* const
|
|
33
|
+
* const listRef = ref<HTMLElement>();
|
|
34
|
+
* const moreIndicatorRef = ref<HTMLElement>();
|
|
53
35
|
*
|
|
54
|
-
* const
|
|
36
|
+
* const more = useMoreList({ parentRef, listRef, moreIndicatorRef });
|
|
37
|
+
* provide(NAV_BAR_MORE_LIST_INJECTION_KEY, more);
|
|
55
38
|
* </script>
|
|
56
39
|
*
|
|
57
40
|
* <template>
|
|
58
|
-
* <div ref="parentRef" class="
|
|
59
|
-
* <
|
|
41
|
+
* <div ref="parentRef" class="more-list">
|
|
42
|
+
* <div ref="listRef" class="more-list__elements">
|
|
43
|
+
* <OnyxNavButton v-for="i in 16" ref="componentRefs" :key="i" :label="`Nav button ${i}`" />
|
|
44
|
+
* </div>
|
|
45
|
+
*
|
|
46
|
+
* <div ref="moreIndicatorRef" class="more-list__indicator">
|
|
47
|
+
* +{{ more.hiddenElements.value.length }} more
|
|
48
|
+
* </div>
|
|
60
49
|
* </div>
|
|
61
50
|
* </template>
|
|
62
51
|
*
|
|
63
52
|
* <style lang="scss">
|
|
64
|
-
*
|
|
53
|
+
* .more-list {
|
|
54
|
+
* display: flex;
|
|
55
|
+
* align-items: center;
|
|
56
|
+
* gap: var(--onyx-spacing-4xs);
|
|
65
57
|
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
58
|
+
* &__elements {
|
|
59
|
+
* display: inherit;
|
|
60
|
+
* align-items: inherit;
|
|
61
|
+
* gap: inherit;
|
|
70
62
|
* overflow-x: clip;
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* &__indicator {
|
|
66
|
+
* min-width: max-content;
|
|
67
|
+
* max-width: 100%;
|
|
71
68
|
* }
|
|
72
69
|
* }
|
|
73
70
|
* </style>
|
|
@@ -81,38 +78,38 @@ export declare const useMoreList: (options: UseMoreListOptions) => {
|
|
|
81
78
|
/**
|
|
82
79
|
* IDs of currently fully or partially hidden components in the list.
|
|
83
80
|
*/
|
|
84
|
-
hiddenElements:
|
|
81
|
+
hiddenElements: Ref<string[], string[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Map of widths for all components in the list. Key = component ID.
|
|
84
|
+
* Components in the list must inject this map and add a ref for their width to it.
|
|
85
|
+
*
|
|
86
|
+
* @see `useMoreListChild()`
|
|
87
|
+
*/
|
|
88
|
+
componentMap: import("vue").Reactive<Map<string, number>>;
|
|
85
89
|
};
|
|
86
90
|
/**
|
|
87
|
-
* Composable that must be implemented in all list children when using `
|
|
91
|
+
* Composable that must be implemented in all list children when using `useMoreList` to correctly observe the visibility of the elements.
|
|
88
92
|
*
|
|
89
93
|
* @example
|
|
90
94
|
*
|
|
91
95
|
* ```vue
|
|
92
96
|
* <script lang="ts" setup
|
|
93
|
-
* const { componentRef, isVisible } =
|
|
97
|
+
* const { componentRef, isVisible } = useMoreListChild();
|
|
94
98
|
* </script>
|
|
95
99
|
*
|
|
96
100
|
* <template
|
|
97
|
-
* <div
|
|
101
|
+
* <div v-show="isVisible" ref="componentRef"> Your content... </div>
|
|
98
102
|
* </template>
|
|
99
|
-
*
|
|
100
|
-
* <style>
|
|
101
|
-
* .hidden {
|
|
102
|
-
* visibility: hidden;
|
|
103
|
-
* }
|
|
104
|
-
* </style>
|
|
105
103
|
* ```
|
|
106
104
|
*/
|
|
107
105
|
export declare const useMoreListChild: (injectionKey: MoreListInjectionKey) => {
|
|
108
106
|
/**
|
|
109
107
|
* Component template ref.
|
|
110
108
|
*/
|
|
111
|
-
componentRef: Ref<
|
|
109
|
+
componentRef: Ref<VueTemplateRefElement, VueTemplateRefElement>;
|
|
112
110
|
/**
|
|
113
111
|
* Whether the component is currently visible.
|
|
114
|
-
* Should hide itself visually (e.g. using "
|
|
115
|
-
* Do not use v-if, v-show or "display: none" since the more feature does not work then when resizing
|
|
112
|
+
* Should hide itself visually (e.g. using `v-show="isVisible"`).
|
|
116
113
|
*/
|
|
117
114
|
isVisible: import("vue").ComputedRef<boolean>;
|
|
118
115
|
};
|
|
@@ -7,7 +7,17 @@ export type UseResizeObserverOptions = {
|
|
|
7
7
|
*/
|
|
8
8
|
box?: ResizeObserverBoxOptions;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Template ref of either a native HTML element or a custom Vue component.
|
|
12
|
+
*/
|
|
13
|
+
export type VueTemplateRefElement = Element | {
|
|
14
|
+
$el: Element;
|
|
15
|
+
} | null | undefined;
|
|
16
|
+
export declare const useResizeObserver: (target?: Ref<VueTemplateRefElement>, options?: UseResizeObserverOptions) => {
|
|
11
17
|
width: Ref<number, number>;
|
|
12
18
|
height: Ref<number, number>;
|
|
13
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Gets the native HTML element of a template ref.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getTemplateRefElement: (ref: VueTemplateRefElement) => Element | undefined;
|