@studiometa/ui 0.2.12 → 0.2.14
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/atoms/AnchorScrollTo/AnchorScrollTo.cjs +3 -3
- package/atoms/AnchorScrollTo/AnchorScrollTo.d.ts +8 -15
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +26 -1
- package/atoms/AnchorScrollTo/index.cjs +20 -0
- package/atoms/AnchorScrollTo/index.d.ts +1 -0
- package/atoms/AnchorScrollTo/index.js +1 -0
- package/atoms/Cursor/Cursor.cjs +16 -9
- package/atoms/Cursor/Cursor.d.ts +19 -117
- package/atoms/Cursor/Cursor.js +111 -1
- package/atoms/Cursor/index.cjs +20 -0
- package/atoms/Cursor/index.d.ts +1 -0
- package/atoms/Cursor/index.js +1 -0
- package/atoms/Figure/Figure.cjs +15 -9
- package/atoms/Figure/Figure.d.ts +18 -53
- package/atoms/Figure/Figure.js +56 -1
- package/atoms/Figure/FigureTwicPics.cjs +10 -10
- package/atoms/Figure/FigureTwicPics.d.ts +16 -37
- package/atoms/Figure/FigureTwicPics.js +51 -1
- package/atoms/Figure/index.cjs +4 -14
- package/atoms/Figure/index.d.ts +2 -2
- package/atoms/Figure/index.js +2 -1
- package/atoms/LargeText/LargeText.cjs +17 -10
- package/atoms/LargeText/LargeText.d.ts +19 -40
- package/atoms/LargeText/LargeText.js +68 -1
- package/atoms/LargeText/index.cjs +20 -0
- package/atoms/LargeText/index.d.ts +1 -0
- package/atoms/LargeText/index.js +1 -0
- package/atoms/LazyInclude/LazyInclude.cjs +2 -2
- package/atoms/LazyInclude/LazyInclude.d.ts +17 -36
- package/atoms/LazyInclude/LazyInclude.js +46 -1
- package/atoms/LazyInclude/index.cjs +20 -0
- package/atoms/LazyInclude/index.d.ts +1 -0
- package/atoms/LazyInclude/index.js +1 -0
- package/atoms/Prefetch/AbstractPrefetch.cjs +6 -6
- package/atoms/Prefetch/AbstractPrefetch.d.ts +12 -35
- package/atoms/Prefetch/AbstractPrefetch.js +58 -1
- package/atoms/Prefetch/PrefetchWhenOver.cjs +5 -8
- package/atoms/Prefetch/PrefetchWhenOver.d.ts +8 -14
- package/atoms/Prefetch/PrefetchWhenOver.js +19 -1
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +5 -8
- package/atoms/Prefetch/PrefetchWhenVisible.d.ts +10 -14
- package/atoms/Prefetch/PrefetchWhenVisible.js +20 -1
- package/atoms/Prefetch/index.cjs +5 -16
- package/atoms/Prefetch/index.d.ts +3 -3
- package/atoms/Prefetch/index.js +3 -1
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +17 -14
- package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +19 -89
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js +67 -1
- package/atoms/ScrollAnimation/ScrollAnimation.cjs +5 -14
- package/atoms/ScrollAnimation/ScrollAnimation.d.ts +13 -51
- package/atoms/ScrollAnimation/ScrollAnimation.js +21 -1
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +37 -14
- package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +19 -6
- package/atoms/ScrollAnimation/ScrollAnimationChild.js +53 -1
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +6 -9
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +8 -2
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +17 -1
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +8 -8
- package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +14 -26
- package/atoms/ScrollAnimation/ScrollAnimationParent.js +27 -1
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +6 -9
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +15 -2
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +17 -1
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs +24 -16
- package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +10 -8
- package/atoms/ScrollAnimation/animationScrollWithEase.js +36 -1
- package/atoms/ScrollAnimation/index.cjs +9 -24
- package/atoms/ScrollAnimation/index.d.ts +7 -7
- package/atoms/ScrollAnimation/index.js +7 -1
- package/atoms/ScrollReveal/ScrollReveal.cjs +7 -4
- package/atoms/ScrollReveal/ScrollReveal.d.ts +16 -59
- package/atoms/ScrollReveal/ScrollReveal.js +54 -1
- package/atoms/ScrollReveal/index.cjs +3 -12
- package/atoms/ScrollReveal/index.d.ts +1 -1
- package/atoms/ScrollReveal/index.js +1 -1
- package/atoms/index.cjs +5 -18
- package/atoms/index.d.ts +8 -8
- package/atoms/index.js +8 -1
- package/decorators/index.cjs +3 -12
- package/decorators/index.d.ts +1 -1
- package/decorators/index.js +1 -1
- package/decorators/withTransition.cjs +44 -29
- package/decorators/withTransition.d.ts +21 -33
- package/decorators/withTransition.js +60 -1
- package/index.cjs +1 -1
- package/index.d.ts +5 -5
- package/index.js +5 -1
- package/molecules/Accordion/Accordion.cjs +7 -10
- package/molecules/Accordion/Accordion.d.ts +5 -23
- package/molecules/Accordion/Accordion.js +19 -1
- package/molecules/Accordion/AccordionCore.cjs +6 -8
- package/molecules/Accordion/AccordionCore.d.ts +22 -70
- package/molecules/Accordion/AccordionCore.js +32 -1
- package/molecules/Accordion/AccordionItem.cjs +39 -23
- package/molecules/Accordion/AccordionItem.d.ts +24 -94
- package/molecules/Accordion/AccordionItem.js +153 -1
- package/molecules/Accordion/index.cjs +21 -0
- package/molecules/Accordion/index.d.ts +2 -0
- package/molecules/Accordion/index.js +2 -0
- package/molecules/Menu/Menu.cjs +6 -10
- package/molecules/Menu/Menu.d.ts +24 -84
- package/molecules/Menu/Menu.js +114 -1
- package/molecules/Menu/MenuBtn.cjs +7 -5
- package/molecules/Menu/MenuBtn.d.ts +7 -9
- package/molecules/Menu/MenuBtn.js +30 -1
- package/molecules/Menu/MenuList.cjs +13 -11
- package/molecules/Menu/MenuList.d.ts +16 -53
- package/molecules/Menu/MenuList.js +113 -1
- package/molecules/Menu/index.cjs +5 -16
- package/molecules/Menu/index.d.ts +3 -3
- package/molecules/Menu/index.js +3 -1
- package/molecules/Modal/Modal.cjs +42 -13
- package/molecules/Modal/Modal.d.ts +69 -140
- package/molecules/Modal/Modal.js +163 -1
- package/molecules/Modal/ModalWithTransition.cjs +4 -7
- package/molecules/Modal/ModalWithTransition.d.ts +6 -22
- package/molecules/Modal/ModalWithTransition.js +46 -1
- package/molecules/Modal/index.cjs +21 -0
- package/molecules/Modal/index.d.ts +2 -0
- package/molecules/Modal/index.js +2 -0
- package/molecules/Panel/Panel.cjs +41 -26
- package/molecules/Panel/Panel.d.ts +22 -21
- package/molecules/Panel/Panel.js +108 -1
- package/molecules/Panel/index.cjs +20 -0
- package/molecules/Panel/index.d.ts +1 -0
- package/molecules/Panel/index.js +1 -0
- package/molecules/Slider/AbstractSliderChild.cjs +7 -9
- package/molecules/Slider/AbstractSliderChild.d.ts +11 -30
- package/molecules/Slider/AbstractSliderChild.js +48 -1
- package/molecules/Slider/Slider.cjs +46 -30
- package/molecules/Slider/Slider.d.ts +40 -157
- package/molecules/Slider/Slider.js +279 -1
- package/molecules/Slider/SliderBtn.cjs +4 -7
- package/molecules/Slider/SliderBtn.d.ts +12 -23
- package/molecules/Slider/SliderBtn.js +34 -1
- package/molecules/Slider/SliderCount.cjs +4 -7
- package/molecules/Slider/SliderCount.d.ts +10 -16
- package/molecules/Slider/SliderCount.js +19 -1
- package/molecules/Slider/SliderDots.cjs +8 -8
- package/molecules/Slider/SliderDots.d.ts +11 -31
- package/molecules/Slider/SliderDots.js +32 -1
- package/molecules/Slider/SliderDrag.cjs +2 -2
- package/molecules/Slider/SliderDrag.d.ts +12 -30
- package/molecules/Slider/SliderDrag.js +34 -1
- package/molecules/Slider/SliderItem.cjs +12 -6
- package/molecules/Slider/SliderItem.d.ts +21 -33
- package/molecules/Slider/SliderItem.js +93 -1
- package/molecules/Slider/SliderProgress.cjs +4 -7
- package/molecules/Slider/SliderProgress.d.ts +10 -25
- package/molecules/Slider/SliderProgress.js +26 -1
- package/molecules/Slider/index.cjs +10 -26
- package/molecules/Slider/index.d.ts +8 -8
- package/molecules/Slider/index.js +8 -1
- package/molecules/Sticky/Sticky.cjs +16 -10
- package/molecules/Sticky/Sticky.d.ts +30 -68
- package/molecules/Sticky/Sticky.js +110 -1
- package/molecules/Sticky/index.cjs +20 -0
- package/molecules/Sticky/index.d.ts +1 -0
- package/molecules/Sticky/index.js +1 -0
- package/molecules/TableOfContent/TableOfContent.cjs +5 -8
- package/molecules/TableOfContent/TableOfContent.d.ts +19 -41
- package/molecules/TableOfContent/TableOfContent.js +42 -1
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +9 -5
- package/molecules/TableOfContent/TableOfContentAnchor.d.ts +14 -17
- package/molecules/TableOfContent/TableOfContentAnchor.js +43 -1
- package/molecules/TableOfContent/index.cjs +4 -14
- package/molecules/TableOfContent/index.d.ts +2 -2
- package/molecules/TableOfContent/index.js +2 -1
- package/molecules/Tabs/Tabs.cjs +42 -22
- package/molecules/Tabs/Tabs.d.ts +28 -90
- package/molecules/Tabs/Tabs.js +123 -1
- package/molecules/Tabs/index.cjs +20 -0
- package/molecules/Tabs/index.d.ts +1 -0
- package/molecules/Tabs/index.js +1 -0
- package/molecules/index.cjs +7 -24
- package/molecules/index.d.ts +9 -10
- package/molecules/index.js +9 -1
- package/organisms/Frame/Frame.cjs +20 -43
- package/organisms/Frame/Frame.d.ts +21 -98
- package/organisms/Frame/Frame.js +161 -1
- package/organisms/Frame/FrameAnchor.cjs +2 -2
- package/organisms/Frame/FrameAnchor.d.ts +7 -16
- package/organisms/Frame/FrameAnchor.js +18 -1
- package/organisms/Frame/FrameForm.cjs +2 -2
- package/organisms/Frame/FrameForm.d.ts +10 -16
- package/organisms/Frame/FrameForm.js +18 -1
- package/organisms/Frame/FrameTarget.cjs +15 -7
- package/organisms/Frame/FrameTarget.d.ts +17 -26
- package/organisms/Frame/FrameTarget.js +79 -1
- package/organisms/Frame/index.cjs +6 -18
- package/organisms/Frame/index.d.ts +4 -4
- package/organisms/Frame/index.js +4 -1
- package/organisms/index.cjs +1 -1
- package/organisms/index.d.ts +1 -1
- package/organisms/index.js +1 -1
- package/package.json +2 -2
- package/primitives/Draggable/Draggable.cjs +9 -6
- package/primitives/Draggable/Draggable.d.ts +10 -11
- package/primitives/Draggable/Draggable.js +33 -1
- package/primitives/Draggable/index.cjs +20 -0
- package/primitives/Draggable/index.d.ts +1 -0
- package/primitives/Draggable/index.js +1 -0
- package/primitives/Sentinel/Sentinel.cjs +2 -2
- package/primitives/Sentinel/Sentinel.d.ts +6 -5
- package/primitives/Sentinel/Sentinel.js +15 -1
- package/primitives/Sentinel/index.cjs +20 -0
- package/primitives/Sentinel/index.d.ts +1 -0
- package/primitives/Sentinel/index.js +1 -0
- package/primitives/Transition/Transition.cjs +12 -3
- package/primitives/Transition/Transition.d.ts +13 -7
- package/primitives/Transition/Transition.js +16 -1
- package/primitives/Transition/index.cjs +20 -0
- package/primitives/Transition/index.d.ts +1 -0
- package/primitives/Transition/index.js +1 -0
- package/primitives/index.cjs +5 -16
- package/primitives/index.d.ts +3 -3
- package/primitives/index.js +3 -1
|
@@ -1,122 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @property {String|Partial<CSSStyleDeclaration>} closed
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {Partial<Record<'open'|'active'|'closed', string|Partial<CSSStyleDeclaration>>>} AccordionItemStates
|
|
19
|
-
* @typedef {Partial<Record<keyof AccordionItemRefs, AccordionItemStates>>} AccordionItemStylesOption
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {Object} AccordionItemOptions
|
|
23
|
-
* @property {Boolean} isOpen
|
|
24
|
-
* @property {AccordionItemStylesOption} styles
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} AccordionItemPrivateInterface
|
|
28
|
-
* @property {AccordionItemOptions} $options
|
|
29
|
-
* @property {AccordionItemRefs} $refs
|
|
30
|
-
* @property {Accordion & AccordionInterface} $parent
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {AccordionItem & AccordionItemPrivateInterface} AccordionItemInterface
|
|
34
|
-
*/
|
|
1
|
+
import { Base, BaseConfig } from '@studiometa/js-toolkit';
|
|
2
|
+
import type { BaseProps } from '@studiometa/js-toolkit';
|
|
3
|
+
declare type AccordionItemStates = Partial<Record<'open' | 'active' | 'closed', string | Partial<CSSStyleDeclaration>>>;
|
|
4
|
+
export interface AccordionItemProps extends BaseProps {
|
|
5
|
+
$refs: {
|
|
6
|
+
btn: HTMLElement;
|
|
7
|
+
content: HTMLElement;
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
};
|
|
10
|
+
$options: {
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
styles: Partial<Record<keyof AccordionItemProps['$refs'], AccordionItemStates>>;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
35
15
|
/**
|
|
36
16
|
* AccordionItem class.
|
|
37
17
|
*/
|
|
38
|
-
export
|
|
18
|
+
export declare class AccordionItem<T extends BaseProps = BaseProps> extends Base<T & AccordionItemProps> {
|
|
39
19
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @return {Object}
|
|
20
|
+
* Config.
|
|
42
21
|
*/
|
|
43
|
-
static config:
|
|
44
|
-
name: string;
|
|
45
|
-
refs: string[];
|
|
46
|
-
emits: string[];
|
|
47
|
-
options: {
|
|
48
|
-
isOpen: BooleanConstructor;
|
|
49
|
-
styles: {
|
|
50
|
-
type: ObjectConstructor;
|
|
51
|
-
/**
|
|
52
|
-
* @return {AccordionItemStylesOption}
|
|
53
|
-
*/
|
|
54
|
-
default: () => AccordionItemStylesOption;
|
|
55
|
-
merge: boolean;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
22
|
+
static config: BaseConfig;
|
|
59
23
|
/**
|
|
60
24
|
* Add aria-attributes on mounted.
|
|
61
|
-
* @this {AccordionItemInterface}
|
|
62
25
|
*/
|
|
63
|
-
mounted(
|
|
26
|
+
mounted(): void;
|
|
64
27
|
/**
|
|
65
28
|
* Remove styles on destroy.
|
|
66
|
-
* @this {AccordionItemInterface}
|
|
67
29
|
*/
|
|
68
|
-
destroyed(
|
|
30
|
+
destroyed(): void;
|
|
69
31
|
/**
|
|
70
32
|
* Handler for the click event on the `btn` ref.
|
|
71
|
-
* @this {AccordionItemInterface}
|
|
72
33
|
*/
|
|
73
|
-
onBtnClick(
|
|
34
|
+
onBtnClick(): void;
|
|
74
35
|
/**
|
|
75
36
|
* Get the content ID.
|
|
76
|
-
* @return {String}
|
|
77
37
|
*/
|
|
78
38
|
get contentId(): string;
|
|
79
39
|
/**
|
|
80
40
|
* Update the refs' attributes according to the given type.
|
|
81
|
-
*
|
|
82
|
-
* @this {AccordionItemInterface}
|
|
83
|
-
* @param {Boolean} isOpen The state of the item.
|
|
84
41
|
*/
|
|
85
|
-
updateAttributes(
|
|
42
|
+
updateAttributes(isOpen: boolean): void;
|
|
86
43
|
/**
|
|
87
44
|
* Open an item.
|
|
88
|
-
* @this {AccordionItemInterface}
|
|
89
45
|
*/
|
|
90
|
-
open(
|
|
46
|
+
open(): Promise<void>;
|
|
91
47
|
/**
|
|
92
48
|
* Close an item.
|
|
93
|
-
* @this {AccordionItemInterface}
|
|
94
49
|
*/
|
|
95
|
-
close(
|
|
50
|
+
close(): Promise<void>;
|
|
96
51
|
}
|
|
97
|
-
export
|
|
98
|
-
export type AccordionInterface = import('./AccordionCore.js').AccordionInterface;
|
|
99
|
-
export type AccordionItemRefs = {
|
|
100
|
-
btn: HTMLElement;
|
|
101
|
-
content: HTMLElement;
|
|
102
|
-
container: HTMLElement;
|
|
103
|
-
};
|
|
104
|
-
export type StylesOption = {
|
|
105
|
-
open: string | Partial<CSSStyleDeclaration>;
|
|
106
|
-
active: string | Partial<CSSStyleDeclaration>;
|
|
107
|
-
closed: string | Partial<CSSStyleDeclaration>;
|
|
108
|
-
};
|
|
109
|
-
export type AccordionItemStates = Partial<Record<'open' | 'active' | 'closed', string | Partial<CSSStyleDeclaration>>>;
|
|
110
|
-
export type AccordionItemStylesOption = Partial<Record<keyof AccordionItemRefs, AccordionItemStates>>;
|
|
111
|
-
export type AccordionItemOptions = {
|
|
112
|
-
isOpen: boolean;
|
|
113
|
-
styles: AccordionItemStylesOption;
|
|
114
|
-
};
|
|
115
|
-
export type AccordionItemPrivateInterface = {
|
|
116
|
-
$options: AccordionItemOptions;
|
|
117
|
-
$refs: AccordionItemRefs;
|
|
118
|
-
$parent: Accordion & AccordionInterface;
|
|
119
|
-
};
|
|
120
|
-
export type AccordionItemInterface = AccordionItem & AccordionItemPrivateInterface;
|
|
121
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
122
|
-
import Accordion from "./AccordionCore.js";
|
|
52
|
+
export {};
|
|
@@ -1 +1,153 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import deepmerge from "deepmerge";
|
|
8
|
+
import { Base } from "@studiometa/js-toolkit";
|
|
9
|
+
import { transition } from "@studiometa/js-toolkit/utils";
|
|
10
|
+
import { AccordionCore as Accordion } from "./AccordionCore.js";
|
|
11
|
+
const _AccordionItem = class extends Base {
|
|
12
|
+
mounted() {
|
|
13
|
+
if (this.$parent && this.$parent instanceof Accordion && this.$parent.$options.item) {
|
|
14
|
+
Object.entries(this.$parent.$options.item).forEach(([key, value]) => {
|
|
15
|
+
var _a;
|
|
16
|
+
if (key in this.$options) {
|
|
17
|
+
const type = (_a = _AccordionItem.config.options[key].type) != null ? _a : _AccordionItem.config.options[key];
|
|
18
|
+
if (type === Array || type === Object) {
|
|
19
|
+
this.$options[key] = deepmerge(this.$options[key], value);
|
|
20
|
+
} else {
|
|
21
|
+
this.$options[key] = value;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
this.$refs.btn.setAttribute("id", this.$id);
|
|
27
|
+
this.$refs.btn.setAttribute("aria-controls", this.contentId);
|
|
28
|
+
this.$refs.content.setAttribute("aria-labelledby", this.$id);
|
|
29
|
+
this.$refs.content.setAttribute("id", this.contentId);
|
|
30
|
+
const { isOpen } = this.$options;
|
|
31
|
+
this.updateAttributes(isOpen);
|
|
32
|
+
const { container, ...otherStyles } = this.$options.styles;
|
|
33
|
+
const { $refs } = this;
|
|
34
|
+
Object.entries(otherStyles).filter(([refName]) => $refs[refName]).forEach(([refName, { open, closed } = { open: "", closed: "" }]) => {
|
|
35
|
+
transition($refs[refName], { to: isOpen ? open : closed }, "keep");
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
destroyed() {
|
|
39
|
+
this.$refs.container.style.visibility = "";
|
|
40
|
+
this.$refs.container.style.height = "";
|
|
41
|
+
}
|
|
42
|
+
onBtnClick() {
|
|
43
|
+
if (this.$options.isOpen) {
|
|
44
|
+
this.close();
|
|
45
|
+
} else {
|
|
46
|
+
this.open();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
get contentId() {
|
|
50
|
+
return `content-${this.$id}`;
|
|
51
|
+
}
|
|
52
|
+
updateAttributes(isOpen) {
|
|
53
|
+
this.$refs.container.style.visibility = isOpen ? "" : "invisible";
|
|
54
|
+
this.$refs.container.style.height = isOpen ? "" : "0";
|
|
55
|
+
this.$refs.content.setAttribute("aria-hidden", isOpen ? "false" : "true");
|
|
56
|
+
this.$refs.btn.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
57
|
+
}
|
|
58
|
+
async open() {
|
|
59
|
+
if (this.$options.isOpen) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.$log("open");
|
|
63
|
+
this.$emit("open");
|
|
64
|
+
this.$options.isOpen = true;
|
|
65
|
+
this.updateAttributes(this.$options.isOpen);
|
|
66
|
+
this.$refs.container.style.visibility = "";
|
|
67
|
+
const { container, ...otherStyles } = this.$options.styles;
|
|
68
|
+
const { $refs } = this;
|
|
69
|
+
await Promise.all([
|
|
70
|
+
transition($refs.container, {
|
|
71
|
+
from: { height: "0" },
|
|
72
|
+
active: container.active,
|
|
73
|
+
to: { height: `${$refs.content.offsetHeight}px` }
|
|
74
|
+
}).then(() => {
|
|
75
|
+
if (this.$options.isOpen) {
|
|
76
|
+
$refs.content.style.position = "";
|
|
77
|
+
}
|
|
78
|
+
return Promise.resolve();
|
|
79
|
+
}),
|
|
80
|
+
...Object.entries(otherStyles).filter(([refName]) => $refs[refName]).map(
|
|
81
|
+
([refName, { open, active, closed } = { open: "", active: "", closed: "" }]) => transition(
|
|
82
|
+
$refs[refName],
|
|
83
|
+
{
|
|
84
|
+
from: closed,
|
|
85
|
+
active,
|
|
86
|
+
to: open
|
|
87
|
+
},
|
|
88
|
+
"keep"
|
|
89
|
+
)
|
|
90
|
+
)
|
|
91
|
+
]);
|
|
92
|
+
}
|
|
93
|
+
async close() {
|
|
94
|
+
if (!this.$options.isOpen) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
this.$log("close");
|
|
98
|
+
this.$emit("close");
|
|
99
|
+
this.$options.isOpen = false;
|
|
100
|
+
const height = this.$refs.container.offsetHeight;
|
|
101
|
+
this.$refs.content.style.position = "absolute";
|
|
102
|
+
const { container, ...otherStyles } = this.$options.styles;
|
|
103
|
+
const refs = this.$refs;
|
|
104
|
+
await Promise.all([
|
|
105
|
+
transition(refs.container, {
|
|
106
|
+
from: { height: `${height}px` },
|
|
107
|
+
active: container.active,
|
|
108
|
+
to: { height: "0" }
|
|
109
|
+
}).then(() => {
|
|
110
|
+
if (!this.$options.isOpen) {
|
|
111
|
+
refs.container.style.height = "0";
|
|
112
|
+
refs.container.style.visibility = "invisible";
|
|
113
|
+
this.updateAttributes(this.$options.isOpen);
|
|
114
|
+
}
|
|
115
|
+
return Promise.resolve();
|
|
116
|
+
}),
|
|
117
|
+
...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(
|
|
118
|
+
([refName, { open, active, closed } = { open: "", active: "", closed: "" }]) => transition(
|
|
119
|
+
refs[refName],
|
|
120
|
+
{
|
|
121
|
+
from: open,
|
|
122
|
+
active,
|
|
123
|
+
to: closed
|
|
124
|
+
},
|
|
125
|
+
"keep"
|
|
126
|
+
)
|
|
127
|
+
)
|
|
128
|
+
]);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
let AccordionItem = _AccordionItem;
|
|
132
|
+
__publicField(AccordionItem, "config", {
|
|
133
|
+
name: "AccordionItem",
|
|
134
|
+
refs: ["btn", "content", "container"],
|
|
135
|
+
emits: ["open", "close"],
|
|
136
|
+
options: {
|
|
137
|
+
isOpen: Boolean,
|
|
138
|
+
styles: {
|
|
139
|
+
type: Object,
|
|
140
|
+
default: () => ({
|
|
141
|
+
container: {
|
|
142
|
+
open: "",
|
|
143
|
+
active: "",
|
|
144
|
+
closed: ""
|
|
145
|
+
}
|
|
146
|
+
}),
|
|
147
|
+
merge: true
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
export {
|
|
152
|
+
AccordionItem
|
|
153
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// packages/ui/molecules/Accordion/index.ts
|
|
17
|
+
var Accordion_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(Accordion_exports);
|
|
19
|
+
__reExport(Accordion_exports, require("./Accordion.cjs"), module.exports);
|
|
20
|
+
__reExport(Accordion_exports, require("./AccordionItem.cjs"), module.exports);
|
|
21
|
+
if (module.exports.default) module.exports = module.exports.default;
|
package/molecules/Menu/Menu.cjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
6
|
var __export = (target, all) => {
|
|
@@ -17,23 +15,22 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
21
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
19
|
var __publicField = (obj, key, value) => {
|
|
23
20
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
21
|
return value;
|
|
25
22
|
};
|
|
26
23
|
|
|
27
|
-
// packages/ui/molecules/Menu/Menu.
|
|
24
|
+
// packages/ui/molecules/Menu/Menu.ts
|
|
28
25
|
var Menu_exports = {};
|
|
29
26
|
__export(Menu_exports, {
|
|
30
|
-
|
|
27
|
+
Menu: () => Menu
|
|
31
28
|
});
|
|
32
29
|
module.exports = __toCommonJS(Menu_exports);
|
|
33
30
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
34
31
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
35
|
-
var import_MenuBtn =
|
|
36
|
-
var import_MenuList =
|
|
32
|
+
var import_MenuBtn = require("./MenuBtn.cjs");
|
|
33
|
+
var import_MenuList = require("./MenuList.cjs");
|
|
37
34
|
var _Menu = class extends import_js_toolkit.Base {
|
|
38
35
|
get menuList() {
|
|
39
36
|
return (0, import_js_toolkit.getDirectChildren)(this, "Menu", "MenuList")[0];
|
|
@@ -123,10 +120,9 @@ var _Menu = class extends import_js_toolkit.Base {
|
|
|
123
120
|
var Menu = _Menu;
|
|
124
121
|
__publicField(Menu, "config", {
|
|
125
122
|
name: "Menu",
|
|
126
|
-
debug: true,
|
|
127
123
|
components: {
|
|
128
|
-
MenuBtn: import_MenuBtn.
|
|
129
|
-
MenuList: import_MenuList.
|
|
124
|
+
MenuBtn: import_MenuBtn.MenuBtn,
|
|
125
|
+
MenuList: import_MenuList.MenuList,
|
|
130
126
|
Menu: _Menu
|
|
131
127
|
},
|
|
132
128
|
options: {
|
package/molecules/Menu/Menu.d.ts
CHANGED
|
@@ -1,140 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Base } from '@studiometa/js-toolkit';
|
|
2
|
+
import type { BaseConfig, BaseProps, KeyServiceProps } from '@studiometa/js-toolkit';
|
|
3
|
+
import { MenuBtn } from './MenuBtn.js';
|
|
4
|
+
import { MenuList } from './MenuList.js';
|
|
5
|
+
export interface MenuProps extends BaseProps {
|
|
6
|
+
$children: {
|
|
7
|
+
Menu: Menu[];
|
|
8
|
+
MenutBtn: MenuBtn[];
|
|
9
|
+
MenuList: MenuList[];
|
|
10
|
+
};
|
|
11
|
+
$options: {
|
|
12
|
+
mode: 'click' | 'hover';
|
|
13
|
+
};
|
|
14
|
+
}
|
|
13
15
|
/**
|
|
14
16
|
* Menu class.
|
|
15
17
|
*/
|
|
16
|
-
export
|
|
18
|
+
export declare class Menu<T extends BaseProps = BaseProps> extends Base<T & MenuProps> {
|
|
17
19
|
/**
|
|
18
20
|
* Config.
|
|
19
21
|
*/
|
|
20
|
-
static config:
|
|
21
|
-
name: string;
|
|
22
|
-
debug: boolean;
|
|
23
|
-
components: {
|
|
24
|
-
MenuBtn: typeof MenuBtn;
|
|
25
|
-
MenuList: typeof MenuList;
|
|
26
|
-
Menu: typeof Menu;
|
|
27
|
-
};
|
|
28
|
-
options: {
|
|
29
|
-
mode: {
|
|
30
|
-
type: StringConstructor;
|
|
31
|
-
default: string;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
22
|
+
static config: BaseConfig;
|
|
35
23
|
/**
|
|
36
24
|
* Get the first `MenuList` instance.
|
|
37
|
-
*
|
|
38
|
-
* @this {MenuInterface}
|
|
39
|
-
* @returns {MenuList}
|
|
40
25
|
*/
|
|
41
26
|
get menuList(): MenuList;
|
|
42
27
|
/**
|
|
43
28
|
* Get the first `MenuBtn` instance.
|
|
44
|
-
*
|
|
45
|
-
* @this {MenuInterface}
|
|
46
|
-
* @returns {MenuBtn}
|
|
47
29
|
*/
|
|
48
30
|
get menuBtn(): MenuBtn;
|
|
49
31
|
/**
|
|
50
|
-
*
|
|
32
|
+
* Test which mode to use.
|
|
51
33
|
*/
|
|
52
34
|
get shouldReactOnClick(): boolean;
|
|
53
35
|
/**
|
|
54
36
|
* Wether the button or the items are hovered.
|
|
55
|
-
*
|
|
56
|
-
* @returns {boolean}
|
|
57
37
|
*/
|
|
58
38
|
get isHover(): boolean;
|
|
59
39
|
/**
|
|
60
40
|
* Set attributes on mounted, destroy the component if it is missing required
|
|
61
41
|
* child components.
|
|
62
|
-
*
|
|
63
|
-
* @returns {void}
|
|
64
42
|
*/
|
|
65
43
|
mounted(): void;
|
|
66
44
|
/**
|
|
67
45
|
* Keyboard management.
|
|
68
|
-
*
|
|
69
|
-
* @param {import('@studiometa/js-toolkit/services/key').KeyServiceProps} options
|
|
70
|
-
* @returns {void}
|
|
71
46
|
*/
|
|
72
|
-
keyed({ ENTER, ESC, isUp }:
|
|
47
|
+
keyed({ ENTER, ESC, isUp }: KeyServiceProps): void;
|
|
73
48
|
/**
|
|
74
|
-
* Toggle menu items on button click
|
|
75
|
-
*
|
|
76
|
-
* @this {MenuInterface}
|
|
77
|
-
* @param {number} index
|
|
78
|
-
* @param {MouseEvent} event
|
|
79
|
-
* @returns {void}
|
|
49
|
+
* Toggle menu items on button click.
|
|
80
50
|
*/
|
|
81
|
-
onMenuBtnClick(
|
|
51
|
+
onMenuBtnClick(index: number, event: MouseEvent): void;
|
|
82
52
|
/**
|
|
83
53
|
* Open menu items on button mouse enter.
|
|
84
|
-
*
|
|
85
|
-
* @this {MenuInterface}
|
|
86
|
-
* @param {number} index
|
|
87
|
-
* @returns {void}
|
|
88
54
|
*/
|
|
89
|
-
onMenuBtnMouseenter(
|
|
55
|
+
onMenuBtnMouseenter(index: number): void;
|
|
90
56
|
/**
|
|
91
57
|
* Close menu items on button mouse leave.
|
|
92
|
-
*
|
|
93
|
-
* @this {MenuInterface}
|
|
94
|
-
* @returns {void}
|
|
95
58
|
*/
|
|
96
|
-
onMenuBtnMouseleave(
|
|
59
|
+
onMenuBtnMouseleave(): void;
|
|
97
60
|
/**
|
|
98
61
|
* Close menu items on button mouse leave.
|
|
99
|
-
*
|
|
100
|
-
* @this {MenuInterface}
|
|
101
|
-
* @returns {void}
|
|
102
62
|
*/
|
|
103
|
-
onMenuListMouseleave(
|
|
63
|
+
onMenuListMouseleave(): void;
|
|
104
64
|
/**
|
|
105
65
|
* Close other non-parent menu items on menu items open.
|
|
106
|
-
*
|
|
107
|
-
* @this {MenuInterface}
|
|
108
|
-
* @param {number} index
|
|
109
|
-
* @returns {void}
|
|
110
66
|
*/
|
|
111
|
-
onMenuListItemsOpen(
|
|
67
|
+
onMenuListItemsOpen(index: number): void;
|
|
112
68
|
/**
|
|
113
69
|
* Close the menu.
|
|
114
|
-
* @returns {void}
|
|
115
70
|
*/
|
|
116
71
|
close(): void;
|
|
117
72
|
/**
|
|
118
73
|
* Open the menu.
|
|
119
|
-
* @returns {void}
|
|
120
74
|
*/
|
|
121
75
|
open(): void;
|
|
122
76
|
/**
|
|
123
77
|
* Toggle the menu.
|
|
124
|
-
* @returns {void}
|
|
125
78
|
*/
|
|
126
79
|
toggle(): void;
|
|
127
80
|
}
|
|
128
|
-
export type MenuInterface = Menu & {
|
|
129
|
-
$children: {
|
|
130
|
-
Menu: Menu[];
|
|
131
|
-
MenuBtn: MenuBtn[];
|
|
132
|
-
MenuList: MenuList[];
|
|
133
|
-
};
|
|
134
|
-
$options: {
|
|
135
|
-
mode: 'click' | 'hover';
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
139
|
-
import MenuList from "./MenuList.js";
|
|
140
|
-
import MenuBtn from "./MenuBtn.js";
|
package/molecules/Menu/Menu.js
CHANGED
|
@@ -1 +1,114 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { Base, isDirectChild, getDirectChildren } from "@studiometa/js-toolkit";
|
|
8
|
+
import { nextTick } from "@studiometa/js-toolkit/utils";
|
|
9
|
+
import { MenuBtn } from "./MenuBtn.js";
|
|
10
|
+
import { MenuList } from "./MenuList.js";
|
|
11
|
+
const _Menu = class extends Base {
|
|
12
|
+
get menuList() {
|
|
13
|
+
return getDirectChildren(this, "Menu", "MenuList")[0];
|
|
14
|
+
}
|
|
15
|
+
get menuBtn() {
|
|
16
|
+
return getDirectChildren(this, "Menu", "MenuBtn")[0];
|
|
17
|
+
}
|
|
18
|
+
get shouldReactOnClick() {
|
|
19
|
+
return this.$options.mode === "click";
|
|
20
|
+
}
|
|
21
|
+
get isHover() {
|
|
22
|
+
return this.menuBtn.isHover || this.menuList.isHover;
|
|
23
|
+
}
|
|
24
|
+
mounted() {
|
|
25
|
+
if (!this.menuBtn || !this.menuList) {
|
|
26
|
+
this.$destroy();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
this.menuBtn.$el.setAttribute("aria-controls", this.$id);
|
|
30
|
+
this.menuList.$el.setAttribute("id", this.$id);
|
|
31
|
+
this.menuList.close();
|
|
32
|
+
}
|
|
33
|
+
keyed({ ENTER, ESC, isUp }) {
|
|
34
|
+
if (!isUp) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (ESC) {
|
|
38
|
+
this.close();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!this.shouldReactOnClick) {
|
|
42
|
+
const hasFocusElementWithin = document.activeElement === this.menuBtn.$el;
|
|
43
|
+
if (ENTER && hasFocusElementWithin) {
|
|
44
|
+
this.toggle();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
onMenuBtnClick(index, event) {
|
|
49
|
+
if (isDirectChild(this, "Menu", "MenuBtn", this.$children.MenuBtn[index]) && this.shouldReactOnClick) {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
this.toggle();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
onMenuBtnMouseenter(index) {
|
|
55
|
+
if (this.$children.MenuBtn[index] === this.menuBtn && !this.shouldReactOnClick) {
|
|
56
|
+
this.open();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
onMenuBtnMouseleave() {
|
|
60
|
+
if (this.shouldReactOnClick) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
nextTick(() => {
|
|
64
|
+
if (!this.isHover) {
|
|
65
|
+
this.close();
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
onMenuListMouseleave() {
|
|
70
|
+
if (this.shouldReactOnClick) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
nextTick(() => {
|
|
74
|
+
if (!this.isHover) {
|
|
75
|
+
this.close();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
onMenuListItemsOpen(index) {
|
|
80
|
+
const targetMenu = this.$children.MenuList[index];
|
|
81
|
+
this.$children.MenuList.forEach((menuItem) => {
|
|
82
|
+
if (!menuItem.$el.contains(targetMenu.$el)) {
|
|
83
|
+
menuItem.close();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
close() {
|
|
88
|
+
this.menuList.close();
|
|
89
|
+
}
|
|
90
|
+
open() {
|
|
91
|
+
this.menuList.open();
|
|
92
|
+
}
|
|
93
|
+
toggle() {
|
|
94
|
+
this.menuList.toggle();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
let Menu = _Menu;
|
|
98
|
+
__publicField(Menu, "config", {
|
|
99
|
+
name: "Menu",
|
|
100
|
+
components: {
|
|
101
|
+
MenuBtn,
|
|
102
|
+
MenuList,
|
|
103
|
+
Menu: _Menu
|
|
104
|
+
},
|
|
105
|
+
options: {
|
|
106
|
+
mode: {
|
|
107
|
+
type: String,
|
|
108
|
+
default: "click"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
export {
|
|
113
|
+
Menu
|
|
114
|
+
};
|