@studiometa/ui 0.2.2 → 0.2.5
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 +8 -13
- package/atoms/AnchorScrollTo/AnchorScrollTo.js +1 -26
- package/atoms/Cursor/Cursor.cjs +14 -22
- package/atoms/Cursor/Cursor.d.ts +2 -2
- package/atoms/Cursor/Cursor.js +1 -103
- package/atoms/Figure/Figure.cjs +20 -16
- package/atoms/Figure/Figure.d.ts +19 -1
- package/atoms/Figure/Figure.js +1 -27
- package/atoms/Figure/FigureTwicPics.cjs +72 -0
- package/atoms/Figure/FigureTwicPics.d.ts +48 -0
- package/atoms/Figure/FigureTwicPics.js +1 -0
- package/atoms/Figure/index.cjs +31 -0
- package/atoms/Figure/index.d.ts +2 -0
- package/atoms/Figure/index.js +1 -0
- package/atoms/LargeText/LargeText.cjs +36 -28
- package/atoms/LargeText/LargeText.d.ts +27 -4
- package/atoms/LargeText/LargeText.js +1 -48
- package/atoms/LazyInclude/LazyInclude.cjs +8 -13
- package/atoms/LazyInclude/LazyInclude.d.ts +4 -4
- package/atoms/LazyInclude/LazyInclude.js +1 -46
- package/atoms/Prefetch/AbstractPrefetch.cjs +8 -13
- package/atoms/Prefetch/AbstractPrefetch.d.ts +1 -1
- package/atoms/Prefetch/AbstractPrefetch.js +1 -58
- package/atoms/Prefetch/PrefetchWhenOver.cjs +12 -34
- package/atoms/Prefetch/PrefetchWhenOver.d.ts +1 -1
- package/atoms/Prefetch/PrefetchWhenOver.js +1 -35
- package/atoms/Prefetch/PrefetchWhenVisible.cjs +12 -34
- package/atoms/Prefetch/PrefetchWhenVisible.d.ts +1 -1
- package/atoms/Prefetch/PrefetchWhenVisible.js +1 -36
- package/atoms/Prefetch/index.cjs +9 -16
- package/atoms/Prefetch/index.js +1 -8
- package/atoms/ScrollAnimation/AbstractScrollAnimation.cjs +126 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.d.ts +133 -0
- package/atoms/ScrollAnimation/AbstractScrollAnimation.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimation.cjs +51 -0
- package/atoms/ScrollAnimation/ScrollAnimation.d.ts +55 -0
- package/atoms/ScrollAnimation/ScrollAnimation.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.cjs +51 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.d.ts +13 -0
- package/atoms/ScrollAnimation/ScrollAnimationChild.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.cjs +41 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.d.ts +6 -0
- package/atoms/ScrollAnimation/ScrollAnimationChildWithEase.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.cjs +48 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.d.ts +35 -0
- package/atoms/ScrollAnimation/ScrollAnimationParent.js +1 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.cjs +41 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.d.ts +6 -0
- package/atoms/ScrollAnimation/ScrollAnimationWithEase.js +1 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.cjs +70 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.d.ts +11 -0
- package/atoms/ScrollAnimation/animationScrollWithEase.js +1 -0
- package/atoms/ScrollAnimation/index.cjs +41 -0
- package/atoms/ScrollAnimation/index.d.ts +7 -0
- package/atoms/ScrollAnimation/index.js +1 -0
- package/atoms/index.cjs +13 -19
- package/atoms/index.d.ts +2 -1
- package/atoms/index.js +1 -13
- package/index.cjs +11 -15
- package/index.js +1 -3
- package/molecules/Accordion/Accordion.cjs +12 -34
- package/molecules/Accordion/Accordion.js +1 -35
- package/molecules/Accordion/AccordionCore.cjs +8 -13
- package/molecules/Accordion/AccordionCore.d.ts +2 -2
- package/molecules/Accordion/AccordionCore.js +1 -34
- package/molecules/Accordion/AccordionItem.cjs +70 -114
- package/molecules/Accordion/AccordionItem.d.ts +7 -6
- package/molecules/Accordion/AccordionItem.js +1 -178
- package/molecules/Menu/Menu.cjs +148 -0
- package/molecules/Menu/Menu.d.ts +140 -0
- package/molecules/Menu/Menu.js +1 -0
- package/molecules/Menu/MenuBtn.cjs +53 -0
- package/molecules/Menu/MenuBtn.d.ts +39 -0
- package/molecules/Menu/MenuBtn.js +1 -0
- package/molecules/Menu/MenuList.cjs +134 -0
- package/molecules/Menu/MenuList.d.ts +101 -0
- package/molecules/Menu/MenuList.js +1 -0
- package/molecules/Menu/index.cjs +33 -0
- package/molecules/Menu/index.d.ts +3 -0
- package/molecules/Menu/index.js +1 -0
- package/molecules/Modal/Modal.cjs +42 -71
- package/molecules/Modal/Modal.d.ts +5 -5
- package/molecules/Modal/Modal.js +1 -150
- package/molecules/Modal/ModalWithTransition.cjs +13 -43
- package/molecules/Modal/ModalWithTransition.js +1 -69
- package/molecules/Panel/Panel.cjs +42 -76
- package/molecules/Panel/Panel.js +1 -117
- package/molecules/Slider/AbstractSliderChild.cjs +10 -20
- package/molecules/Slider/AbstractSliderChild.d.ts +6 -2
- package/molecules/Slider/AbstractSliderChild.js +1 -43
- package/molecules/Slider/Slider.cjs +14 -24
- package/molecules/Slider/Slider.d.ts +6 -6
- package/molecules/Slider/Slider.js +1 -209
- package/molecules/Slider/SliderBtn.cjs +9 -16
- package/molecules/Slider/SliderBtn.d.ts +1 -1
- package/molecules/Slider/SliderBtn.js +1 -34
- package/molecules/Slider/SliderCount.cjs +9 -16
- package/molecules/Slider/SliderCount.js +1 -19
- package/molecules/Slider/SliderDots.cjs +9 -16
- package/molecules/Slider/SliderDots.js +1 -24
- package/molecules/Slider/SliderDrag.cjs +8 -13
- package/molecules/Slider/SliderDrag.js +1 -19
- package/molecules/Slider/SliderItem.cjs +14 -37
- package/molecules/Slider/SliderItem.js +1 -105
- package/molecules/Slider/SliderProgress.cjs +9 -16
- package/molecules/Slider/SliderProgress.js +1 -23
- package/molecules/Slider/index.cjs +9 -16
- package/molecules/Slider/index.js +1 -18
- package/molecules/Sticky/Sticky.cjs +11 -19
- package/molecules/Sticky/Sticky.d.ts +8 -8
- package/molecules/Sticky/Sticky.js +1 -107
- package/molecules/TableOfContent/TableOfContent.cjs +9 -16
- package/molecules/TableOfContent/TableOfContent.d.ts +1 -1
- package/molecules/TableOfContent/TableOfContent.js +1 -42
- package/molecules/TableOfContent/TableOfContentAnchor.cjs +8 -13
- package/molecules/TableOfContent/TableOfContentAnchor.js +1 -39
- package/molecules/TableOfContent/index.cjs +9 -16
- package/molecules/TableOfContent/index.js +1 -6
- package/molecules/Tabs/Tabs.cjs +54 -82
- package/molecules/Tabs/Tabs.d.ts +5 -4
- package/molecules/Tabs/Tabs.js +1 -126
- package/molecules/index.cjs +13 -18
- package/molecules/index.d.ts +1 -0
- package/molecules/index.js +1 -18
- package/organisms/Frame/Frame.cjs +67 -98
- package/organisms/Frame/Frame.d.ts +3 -3
- package/organisms/Frame/Frame.js +1 -171
- package/organisms/Frame/FrameAnchor.cjs +8 -13
- package/organisms/Frame/FrameAnchor.js +1 -22
- package/organisms/Frame/FrameForm.cjs +8 -13
- package/organisms/Frame/FrameForm.js +1 -22
- package/organisms/Frame/FrameTarget.cjs +31 -73
- package/organisms/Frame/FrameTarget.js +1 -109
- package/organisms/Frame/index.cjs +9 -16
- package/organisms/Frame/index.js +1 -10
- package/organisms/index.cjs +9 -13
- package/organisms/index.js +1 -1
- package/package.json +3 -4
- package/primitives/Draggable/Draggable.cjs +15 -28
- package/primitives/Draggable/Draggable.d.ts +0 -5
- package/primitives/Draggable/Draggable.js +1 -38
- package/primitives/Sentinel/Sentinel.cjs +8 -13
- package/primitives/Sentinel/Sentinel.js +1 -15
- package/primitives/Transition/Transition.cjs +12 -17
- package/primitives/Transition/Transition.d.ts +2 -4
- package/primitives/Transition/Transition.js +1 -45
- package/primitives/index.cjs +9 -16
- package/primitives/index.js +1 -8
|
@@ -2,74 +2,34 @@ var __create = Object.create;
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
11
|
-
var __objRest = (source, exclude) => {
|
|
12
|
-
var target = {};
|
|
13
|
-
for (var prop in source)
|
|
14
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
15
|
-
target[prop] = source[prop];
|
|
16
|
-
if (source != null && __getOwnPropSymbols)
|
|
17
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
18
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
19
|
-
target[prop] = source[prop];
|
|
20
|
-
}
|
|
21
|
-
return target;
|
|
22
|
-
};
|
|
23
8
|
var __export = (target, all) => {
|
|
24
9
|
for (var name in all)
|
|
25
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
11
|
};
|
|
27
|
-
var
|
|
28
|
-
if (
|
|
29
|
-
for (let key of __getOwnPropNames(
|
|
30
|
-
if (!__hasOwnProp.call(
|
|
31
|
-
__defProp(
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
32
17
|
}
|
|
33
|
-
return
|
|
34
|
-
};
|
|
35
|
-
var __toESM = (module2, isNodeMode) => {
|
|
36
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
return to;
|
|
37
19
|
};
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
41
|
-
};
|
|
42
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
22
|
var __publicField = (obj, key, value) => {
|
|
44
23
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
45
24
|
return value;
|
|
46
25
|
};
|
|
47
|
-
var __async = (__this, __arguments, generator) => {
|
|
48
|
-
return new Promise((resolve, reject) => {
|
|
49
|
-
var fulfilled = (value) => {
|
|
50
|
-
try {
|
|
51
|
-
step(generator.next(value));
|
|
52
|
-
} catch (e) {
|
|
53
|
-
reject(e);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var rejected = (value) => {
|
|
57
|
-
try {
|
|
58
|
-
step(generator.throw(value));
|
|
59
|
-
} catch (e) {
|
|
60
|
-
reject(e);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
64
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
26
|
|
|
68
27
|
// packages/ui/molecules/Accordion/AccordionItem.js
|
|
69
28
|
var AccordionItem_exports = {};
|
|
70
29
|
__export(AccordionItem_exports, {
|
|
71
30
|
default: () => AccordionItem
|
|
72
31
|
});
|
|
32
|
+
module.exports = __toCommonJS(AccordionItem_exports);
|
|
73
33
|
var import_deepmerge = __toESM(require("deepmerge"), 1);
|
|
74
34
|
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
75
35
|
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
@@ -94,7 +54,7 @@ var _AccordionItem = class extends import_js_toolkit.Base {
|
|
|
94
54
|
this.$refs.content.setAttribute("id", this.contentId);
|
|
95
55
|
const { isOpen } = this.$options;
|
|
96
56
|
this.updateAttributes(isOpen);
|
|
97
|
-
const
|
|
57
|
+
const { container, ...otherStyles } = this.$options.styles;
|
|
98
58
|
const refs = this.$refs;
|
|
99
59
|
Object.entries(otherStyles).filter(([refName]) => refs[refName]).forEach(([refName, { open, closed } = { open: "", closed: "" }]) => {
|
|
100
60
|
(0, import_utils.transition)(refs[refName], { to: isOpen ? open : closed }, "keep");
|
|
@@ -120,69 +80,65 @@ var _AccordionItem = class extends import_js_toolkit.Base {
|
|
|
120
80
|
this.$refs.content.setAttribute("aria-hidden", isOpen ? "false" : "true");
|
|
121
81
|
this.$refs.btn.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
122
82
|
}
|
|
123
|
-
open() {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
]);
|
|
152
|
-
});
|
|
83
|
+
async open() {
|
|
84
|
+
if (this.$options.isOpen) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.$log("open");
|
|
88
|
+
this.$emit("open");
|
|
89
|
+
this.$options.isOpen = true;
|
|
90
|
+
this.updateAttributes(this.$options.isOpen);
|
|
91
|
+
this.$refs.container.style.visibility = "";
|
|
92
|
+
const { container, ...otherStyles } = this.$options.styles;
|
|
93
|
+
const refs = this.$refs;
|
|
94
|
+
await Promise.all([
|
|
95
|
+
(0, import_utils.transition)(refs.container, {
|
|
96
|
+
from: { height: "0" },
|
|
97
|
+
active: container.active,
|
|
98
|
+
to: { height: `${refs.content.offsetHeight}px` }
|
|
99
|
+
}).then(() => {
|
|
100
|
+
if (this.$options.isOpen) {
|
|
101
|
+
refs.content.style.position = "";
|
|
102
|
+
}
|
|
103
|
+
return Promise.resolve();
|
|
104
|
+
}),
|
|
105
|
+
...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(([refName, { open, active, closed } = { open: "", active: "", closed: "" }]) => (0, import_utils.transition)(refs[refName], {
|
|
106
|
+
from: closed,
|
|
107
|
+
active,
|
|
108
|
+
to: open
|
|
109
|
+
}, "keep"))
|
|
110
|
+
]);
|
|
153
111
|
}
|
|
154
|
-
close() {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
]);
|
|
185
|
-
});
|
|
112
|
+
async close() {
|
|
113
|
+
if (!this.$options.isOpen) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
this.$log("close");
|
|
117
|
+
this.$emit("close");
|
|
118
|
+
this.$options.isOpen = false;
|
|
119
|
+
const height = this.$refs.container.offsetHeight;
|
|
120
|
+
this.$refs.content.style.position = "absolute";
|
|
121
|
+
const { container, ...otherStyles } = this.$options.styles;
|
|
122
|
+
const refs = this.$refs;
|
|
123
|
+
await Promise.all([
|
|
124
|
+
(0, import_utils.transition)(refs.container, {
|
|
125
|
+
from: { height: `${height}px` },
|
|
126
|
+
active: container.active,
|
|
127
|
+
to: { height: "0" }
|
|
128
|
+
}).then(() => {
|
|
129
|
+
if (!this.$options.isOpen) {
|
|
130
|
+
refs.container.style.height = "0";
|
|
131
|
+
refs.container.style.visibility = "invisible";
|
|
132
|
+
this.updateAttributes(this.$options.isOpen);
|
|
133
|
+
}
|
|
134
|
+
return Promise.resolve();
|
|
135
|
+
}),
|
|
136
|
+
...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(([refName, { open, active, closed } = { open: "", active: "", closed: "" }]) => (0, import_utils.transition)(refs[refName], {
|
|
137
|
+
from: open,
|
|
138
|
+
active,
|
|
139
|
+
to: closed
|
|
140
|
+
}, "keep"))
|
|
141
|
+
]);
|
|
186
142
|
}
|
|
187
143
|
};
|
|
188
144
|
var AccordionItem = _AccordionItem;
|
|
@@ -200,9 +156,9 @@ __publicField(AccordionItem, "config", {
|
|
|
200
156
|
active: "",
|
|
201
157
|
closed: ""
|
|
202
158
|
}
|
|
203
|
-
})
|
|
159
|
+
}),
|
|
160
|
+
merge: true
|
|
204
161
|
}
|
|
205
162
|
}
|
|
206
163
|
});
|
|
207
|
-
module.exports = __toCommonJS(AccordionItem_exports);
|
|
208
164
|
if (module.exports.default) module.exports = module.exports.default;
|
|
@@ -52,6 +52,7 @@ export default class AccordionItem extends Base {
|
|
|
52
52
|
* @return {AccordionItemStylesOption}
|
|
53
53
|
*/
|
|
54
54
|
default: () => AccordionItemStylesOption;
|
|
55
|
+
merge: boolean;
|
|
55
56
|
};
|
|
56
57
|
};
|
|
57
58
|
};
|
|
@@ -59,17 +60,17 @@ export default class AccordionItem extends Base {
|
|
|
59
60
|
* Add aria-attributes on mounted.
|
|
60
61
|
* @this {AccordionItemInterface}
|
|
61
62
|
*/
|
|
62
|
-
mounted(): void;
|
|
63
|
+
mounted(this: AccordionItemInterface): void;
|
|
63
64
|
/**
|
|
64
65
|
* Remove styles on destroy.
|
|
65
66
|
* @this {AccordionItemInterface}
|
|
66
67
|
*/
|
|
67
|
-
destroyed(): void;
|
|
68
|
+
destroyed(this: AccordionItemInterface): void;
|
|
68
69
|
/**
|
|
69
70
|
* Handler for the click event on the `btn` ref.
|
|
70
71
|
* @this {AccordionItemInterface}
|
|
71
72
|
*/
|
|
72
|
-
onBtnClick(): void;
|
|
73
|
+
onBtnClick(this: AccordionItemInterface): void;
|
|
73
74
|
/**
|
|
74
75
|
* Get the content ID.
|
|
75
76
|
* @return {String}
|
|
@@ -81,17 +82,17 @@ export default class AccordionItem extends Base {
|
|
|
81
82
|
* @this {AccordionItemInterface}
|
|
82
83
|
* @param {Boolean} isOpen The state of the item.
|
|
83
84
|
*/
|
|
84
|
-
updateAttributes(isOpen: boolean): void;
|
|
85
|
+
updateAttributes(this: AccordionItemInterface, isOpen: boolean): void;
|
|
85
86
|
/**
|
|
86
87
|
* Open an item.
|
|
87
88
|
* @this {AccordionItemInterface}
|
|
88
89
|
*/
|
|
89
|
-
open(): Promise<void>;
|
|
90
|
+
open(this: AccordionItemInterface): Promise<void>;
|
|
90
91
|
/**
|
|
91
92
|
* Close an item.
|
|
92
93
|
* @this {AccordionItemInterface}
|
|
93
94
|
*/
|
|
94
|
-
close(): Promise<void>;
|
|
95
|
+
close(this: AccordionItemInterface): Promise<void>;
|
|
95
96
|
}
|
|
96
97
|
export type BaseOptions = import('@studiometa/js-toolkit/Base').BaseOptions;
|
|
97
98
|
export type AccordionInterface = import('./AccordionCore.js').AccordionInterface;
|
|
@@ -1,178 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __objRest = (source, exclude) => {
|
|
7
|
-
var target = {};
|
|
8
|
-
for (var prop in source)
|
|
9
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
10
|
-
target[prop] = source[prop];
|
|
11
|
-
if (source != null && __getOwnPropSymbols)
|
|
12
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
13
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
14
|
-
target[prop] = source[prop];
|
|
15
|
-
}
|
|
16
|
-
return target;
|
|
17
|
-
};
|
|
18
|
-
var __publicField = (obj, key, value) => {
|
|
19
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
20
|
-
return value;
|
|
21
|
-
};
|
|
22
|
-
var __async = (__this, __arguments, generator) => {
|
|
23
|
-
return new Promise((resolve, reject) => {
|
|
24
|
-
var fulfilled = (value) => {
|
|
25
|
-
try {
|
|
26
|
-
step(generator.next(value));
|
|
27
|
-
} catch (e) {
|
|
28
|
-
reject(e);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
var rejected = (value) => {
|
|
32
|
-
try {
|
|
33
|
-
step(generator.throw(value));
|
|
34
|
-
} catch (e) {
|
|
35
|
-
reject(e);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
39
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
import deepmerge from "deepmerge";
|
|
43
|
-
import { Base } from "@studiometa/js-toolkit";
|
|
44
|
-
import { transition } from "@studiometa/js-toolkit/utils";
|
|
45
|
-
import Accordion from "./AccordionCore.js";
|
|
46
|
-
const _AccordionItem = class extends Base {
|
|
47
|
-
mounted() {
|
|
48
|
-
if (this.$parent && this.$parent instanceof Accordion && this.$parent.$options.item) {
|
|
49
|
-
Object.entries(this.$parent.$options.item).forEach(([key, value]) => {
|
|
50
|
-
if (key in this.$options) {
|
|
51
|
-
const type = _AccordionItem.config.options[key].type || _AccordionItem.config.options[key];
|
|
52
|
-
if (type === Array || type === Object) {
|
|
53
|
-
this.$options[key] = deepmerge(this.$options[key], value);
|
|
54
|
-
} else {
|
|
55
|
-
this.$options[key] = value;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
this.$refs.btn.setAttribute("id", this.$id);
|
|
61
|
-
this.$refs.btn.setAttribute("aria-controls", this.contentId);
|
|
62
|
-
this.$refs.content.setAttribute("aria-labelledby", this.$id);
|
|
63
|
-
this.$refs.content.setAttribute("id", this.contentId);
|
|
64
|
-
const { isOpen } = this.$options;
|
|
65
|
-
this.updateAttributes(isOpen);
|
|
66
|
-
const _a = this.$options.styles, { container } = _a, otherStyles = __objRest(_a, ["container"]);
|
|
67
|
-
const refs = this.$refs;
|
|
68
|
-
Object.entries(otherStyles).filter(([refName]) => refs[refName]).forEach(([refName, { open, closed } = { open: "", closed: "" }]) => {
|
|
69
|
-
transition(refs[refName], { to: isOpen ? open : closed }, "keep");
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
destroyed() {
|
|
73
|
-
this.$refs.container.style.visibility = "";
|
|
74
|
-
this.$refs.container.style.height = "";
|
|
75
|
-
}
|
|
76
|
-
onBtnClick() {
|
|
77
|
-
if (this.$options.isOpen) {
|
|
78
|
-
this.close();
|
|
79
|
-
} else {
|
|
80
|
-
this.open();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
get contentId() {
|
|
84
|
-
return `content-${this.$id}`;
|
|
85
|
-
}
|
|
86
|
-
updateAttributes(isOpen) {
|
|
87
|
-
this.$refs.container.style.visibility = isOpen ? "" : "invisible";
|
|
88
|
-
this.$refs.container.style.height = isOpen ? "" : "0";
|
|
89
|
-
this.$refs.content.setAttribute("aria-hidden", isOpen ? "false" : "true");
|
|
90
|
-
this.$refs.btn.setAttribute("aria-expanded", isOpen ? "true" : "false");
|
|
91
|
-
}
|
|
92
|
-
open() {
|
|
93
|
-
return __async(this, null, function* () {
|
|
94
|
-
if (this.$options.isOpen) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
this.$log("open");
|
|
98
|
-
this.$emit("open");
|
|
99
|
-
this.$options.isOpen = true;
|
|
100
|
-
this.updateAttributes(this.$options.isOpen);
|
|
101
|
-
this.$refs.container.style.visibility = "";
|
|
102
|
-
const _a = this.$options.styles, { container } = _a, otherStyles = __objRest(_a, ["container"]);
|
|
103
|
-
const refs = this.$refs;
|
|
104
|
-
yield Promise.all([
|
|
105
|
-
transition(refs.container, {
|
|
106
|
-
from: { height: "0" },
|
|
107
|
-
active: container.active,
|
|
108
|
-
to: { height: `${refs.content.offsetHeight}px` }
|
|
109
|
-
}).then(() => {
|
|
110
|
-
if (this.$options.isOpen) {
|
|
111
|
-
refs.content.style.position = "";
|
|
112
|
-
}
|
|
113
|
-
return Promise.resolve();
|
|
114
|
-
}),
|
|
115
|
-
...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(([refName, { open, active, closed } = { open: "", active: "", closed: "" }]) => transition(refs[refName], {
|
|
116
|
-
from: closed,
|
|
117
|
-
active,
|
|
118
|
-
to: open
|
|
119
|
-
}, "keep"))
|
|
120
|
-
]);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
close() {
|
|
124
|
-
return __async(this, null, function* () {
|
|
125
|
-
if (!this.$options.isOpen) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
this.$log("close");
|
|
129
|
-
this.$emit("close");
|
|
130
|
-
this.$options.isOpen = false;
|
|
131
|
-
const height = this.$refs.container.offsetHeight;
|
|
132
|
-
this.$refs.content.style.position = "absolute";
|
|
133
|
-
const _a = this.$options.styles, { container } = _a, otherStyles = __objRest(_a, ["container"]);
|
|
134
|
-
const refs = this.$refs;
|
|
135
|
-
yield Promise.all([
|
|
136
|
-
transition(refs.container, {
|
|
137
|
-
from: { height: `${height}px` },
|
|
138
|
-
active: container.active,
|
|
139
|
-
to: { height: "0" }
|
|
140
|
-
}).then(() => {
|
|
141
|
-
if (!this.$options.isOpen) {
|
|
142
|
-
refs.container.style.height = "0";
|
|
143
|
-
refs.container.style.visibility = "invisible";
|
|
144
|
-
this.updateAttributes(this.$options.isOpen);
|
|
145
|
-
}
|
|
146
|
-
return Promise.resolve();
|
|
147
|
-
}),
|
|
148
|
-
...Object.entries(otherStyles).filter(([refName]) => refs[refName]).map(([refName, { open, active, closed } = { open: "", active: "", closed: "" }]) => transition(refs[refName], {
|
|
149
|
-
from: open,
|
|
150
|
-
active,
|
|
151
|
-
to: closed
|
|
152
|
-
}, "keep"))
|
|
153
|
-
]);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
let AccordionItem = _AccordionItem;
|
|
158
|
-
__publicField(AccordionItem, "config", {
|
|
159
|
-
name: "AccordionItem",
|
|
160
|
-
refs: ["btn", "content", "container"],
|
|
161
|
-
emits: ["open", "close"],
|
|
162
|
-
options: {
|
|
163
|
-
isOpen: Boolean,
|
|
164
|
-
styles: {
|
|
165
|
-
type: Object,
|
|
166
|
-
default: () => ({
|
|
167
|
-
container: {
|
|
168
|
-
open: "",
|
|
169
|
-
active: "",
|
|
170
|
-
closed: ""
|
|
171
|
-
}
|
|
172
|
-
})
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
export {
|
|
177
|
-
AccordionItem as default
|
|
178
|
-
};
|
|
1
|
+
import a from"deepmerge";import{Base as l}from"@studiometa/js-toolkit";import{transition as r}from"@studiometa/js-toolkit/utils";import f from"./AccordionCore.js";class c extends l{static config={name:"AccordionItem",refs:["btn","content","container"],emits:["open","close"],options:{isOpen:Boolean,styles:{type:Object,default:()=>({container:{open:"",active:"",closed:""}}),merge:!0}}};mounted(){this.$parent&&this.$parent instanceof f&&this.$parent.$options.item&&Object.entries(this.$parent.$options.item).forEach(([t,o])=>{if(t in this.$options){const n=c.config.options[t].type||c.config.options[t];n===Array||n===Object?this.$options[t]=a(this.$options[t],o):this.$options[t]=o}}),this.$refs.btn.setAttribute("id",this.$id),this.$refs.btn.setAttribute("aria-controls",this.contentId),this.$refs.content.setAttribute("aria-labelledby",this.$id),this.$refs.content.setAttribute("id",this.contentId);const{isOpen:i}=this.$options;this.updateAttributes(i);const{container:h,...s}=this.$options.styles,e=this.$refs;Object.entries(s).filter(([t])=>e[t]).forEach(([t,{open:o,closed:n}={open:"",closed:""}])=>{r(e[t],{to:i?o:n},"keep")})}destroyed(){this.$refs.container.style.visibility="",this.$refs.container.style.height=""}onBtnClick(){this.$options.isOpen?this.close():this.open()}get contentId(){return`content-${this.$id}`}updateAttributes(i){this.$refs.container.style.visibility=i?"":"invisible",this.$refs.container.style.height=i?"":"0",this.$refs.content.setAttribute("aria-hidden",i?"false":"true"),this.$refs.btn.setAttribute("aria-expanded",i?"true":"false")}async open(){if(this.$options.isOpen)return;this.$log("open"),this.$emit("open"),this.$options.isOpen=!0,this.updateAttributes(this.$options.isOpen),this.$refs.container.style.visibility="";const{container:i,...h}=this.$options.styles,s=this.$refs;await Promise.all([r(s.container,{from:{height:"0"},active:i.active,to:{height:`${s.content.offsetHeight}px`}}).then(()=>(this.$options.isOpen&&(s.content.style.position=""),Promise.resolve())),...Object.entries(h).filter(([e])=>s[e]).map(([e,{open:t,active:o,closed:n}={open:"",active:"",closed:""}])=>r(s[e],{from:n,active:o,to:t},"keep"))])}async close(){if(!this.$options.isOpen)return;this.$log("close"),this.$emit("close"),this.$options.isOpen=!1;const i=this.$refs.container.offsetHeight;this.$refs.content.style.position="absolute";const{container:h,...s}=this.$options.styles,e=this.$refs;await Promise.all([r(e.container,{from:{height:`${i}px`},active:h.active,to:{height:"0"}}).then(()=>(this.$options.isOpen||(e.container.style.height="0",e.container.style.visibility="invisible",this.updateAttributes(this.$options.isOpen)),Promise.resolve())),...Object.entries(s).filter(([t])=>e[t]).map(([t,{open:o,active:n,closed:p}={open:"",active:"",closed:""}])=>r(e[t],{from:o,active:n,to:p},"keep"))])}}export{c as default};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __publicField = (obj, key, value) => {
|
|
23
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
+
return value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// packages/ui/molecules/Menu/Menu.js
|
|
28
|
+
var Menu_exports = {};
|
|
29
|
+
__export(Menu_exports, {
|
|
30
|
+
default: () => Menu
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(Menu_exports);
|
|
33
|
+
var import_js_toolkit = require("@studiometa/js-toolkit");
|
|
34
|
+
var import_utils = require("@studiometa/js-toolkit/utils");
|
|
35
|
+
var import_MenuBtn = __toESM(require("./MenuBtn.cjs"), 1);
|
|
36
|
+
var import_MenuList = __toESM(require("./MenuList.cjs"), 1);
|
|
37
|
+
var _Menu = class extends import_js_toolkit.Base {
|
|
38
|
+
getDirectChildren(name) {
|
|
39
|
+
if (!this.$children[name]) {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
if (!this.$children.Menu) {
|
|
43
|
+
return this.$children[name];
|
|
44
|
+
}
|
|
45
|
+
return this.$children[name].filter((child) => this.$children.Menu.every((menu) => menu.$children[name] ? !menu.$children[name].includes(child) : true));
|
|
46
|
+
}
|
|
47
|
+
get menuList() {
|
|
48
|
+
return this.getDirectChildren("MenuList")[0];
|
|
49
|
+
}
|
|
50
|
+
get menuBtn() {
|
|
51
|
+
return this.getDirectChildren("MenuBtn")[0];
|
|
52
|
+
}
|
|
53
|
+
get shouldReactOnClick() {
|
|
54
|
+
return this.$options.mode === "click";
|
|
55
|
+
}
|
|
56
|
+
get isHover() {
|
|
57
|
+
return this.menuBtn.isHover || this.menuList.isHover;
|
|
58
|
+
}
|
|
59
|
+
mounted() {
|
|
60
|
+
if (!this.menuBtn || !this.menuList) {
|
|
61
|
+
this.$destroy();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.menuBtn.$el.setAttribute("aria-controls", this.$id);
|
|
65
|
+
this.menuList.$el.setAttribute("id", this.$id);
|
|
66
|
+
this.menuList.close();
|
|
67
|
+
}
|
|
68
|
+
keyed({ ENTER, ESC, isUp }) {
|
|
69
|
+
if (!isUp) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (ESC) {
|
|
73
|
+
this.close();
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!this.shouldReactOnClick) {
|
|
77
|
+
const hasFocusElementWithin = document.activeElement === this.menuBtn.$el;
|
|
78
|
+
if (ENTER && hasFocusElementWithin) {
|
|
79
|
+
this.toggle();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
onMenuBtnBtnClick(event, index) {
|
|
84
|
+
if (this.$children.MenuBtn[index] === this.menuBtn && this.shouldReactOnClick) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
this.toggle();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
onMenuBtnBtnMouseenter(event, index) {
|
|
90
|
+
if (this.$children.MenuBtn[index] === this.menuBtn && !this.shouldReactOnClick) {
|
|
91
|
+
this.open();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
onMenuBtnBtnMouseleave() {
|
|
95
|
+
if (this.shouldReactOnClick) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
(0, import_utils.nextTick)(() => {
|
|
99
|
+
if (!this.isHover) {
|
|
100
|
+
this.close();
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
onMenuListItemsMouseleave() {
|
|
105
|
+
if (this.shouldReactOnClick) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
(0, import_utils.nextTick)(() => {
|
|
109
|
+
if (!this.isHover) {
|
|
110
|
+
this.close();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
onMenuListItemsOpen(index) {
|
|
115
|
+
const targetMenu = this.$children.MenuList[index];
|
|
116
|
+
this.$children.MenuList.forEach((menuItem) => {
|
|
117
|
+
if (!menuItem.$el.contains(targetMenu.$el)) {
|
|
118
|
+
menuItem.close();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
close() {
|
|
123
|
+
this.menuList.close();
|
|
124
|
+
}
|
|
125
|
+
open() {
|
|
126
|
+
this.menuList.open();
|
|
127
|
+
}
|
|
128
|
+
toggle() {
|
|
129
|
+
this.menuList.toggle();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
var Menu = _Menu;
|
|
133
|
+
__publicField(Menu, "config", {
|
|
134
|
+
name: "Menu",
|
|
135
|
+
debug: true,
|
|
136
|
+
components: {
|
|
137
|
+
MenuBtn: import_MenuBtn.default,
|
|
138
|
+
MenuList: import_MenuList.default,
|
|
139
|
+
Menu: _Menu
|
|
140
|
+
},
|
|
141
|
+
options: {
|
|
142
|
+
mode: {
|
|
143
|
+
type: String,
|
|
144
|
+
default: "click"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
if (module.exports.default) module.exports = module.exports.default;
|