vanduo-framework 1.1.8
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/LICENSE +35 -0
- package/README.md +205 -0
- package/css/components/alerts.css +224 -0
- package/css/components/avatar.css +275 -0
- package/css/components/badges.css +230 -0
- package/css/components/breadcrumbs.css +146 -0
- package/css/components/button-group.css +82 -0
- package/css/components/buttons.css +530 -0
- package/css/components/cards.css +304 -0
- package/css/components/chips.css +259 -0
- package/css/components/code-snippet.css +555 -0
- package/css/components/collapsible.css +267 -0
- package/css/components/collections.css +253 -0
- package/css/components/doc-search.css +464 -0
- package/css/components/doc-tabs.css +38 -0
- package/css/components/draggable.css +317 -0
- package/css/components/dropdown.css +266 -0
- package/css/components/footer.css +375 -0
- package/css/components/forms.css +1774 -0
- package/css/components/image-box.css +279 -0
- package/css/components/modals.css +285 -0
- package/css/components/navbar.css +530 -0
- package/css/components/pagination.css +186 -0
- package/css/components/preloader.css +340 -0
- package/css/components/progress.css +107 -0
- package/css/components/sidenav.css +301 -0
- package/css/components/skeleton.css +241 -0
- package/css/components/spinner.css +144 -0
- package/css/components/tabs.css +327 -0
- package/css/components/theme-customizer.css +835 -0
- package/css/components/toast.css +357 -0
- package/css/components/tooltips.css +270 -0
- package/css/core/colors.css +1017 -0
- package/css/core/fonts.css +266 -0
- package/css/core/grid.css +1699 -0
- package/css/core/helpers.css +2202 -0
- package/css/core/reset.css +128 -0
- package/css/core/tokens.css +213 -0
- package/css/core/typography.css +405 -0
- package/css/core/vd-aliases.css +47 -0
- package/css/effects/parallax.css +113 -0
- package/css/icons/icons-all.css +23 -0
- package/css/icons/icons.css +25 -0
- package/css/utilities/media.css +167 -0
- package/css/utilities/print.css +111 -0
- package/css/utilities/shadow.css +243 -0
- package/css/utilities/table.css +381 -0
- package/css/utilities/transforms.css +71 -0
- package/css/utilities/transitions.css +87 -0
- package/css/vanduo.css +80 -0
- package/dist/build-info.json +6 -0
- package/dist/fonts/fira-sans/fira-sans-bold.woff2 +0 -0
- package/dist/fonts/fira-sans/fira-sans-medium.woff2 +0 -0
- package/dist/fonts/fira-sans/fira-sans-regular.woff2 +0 -0
- package/dist/fonts/ibm-plex/ibm-plex-sans-bold.woff2 +0 -0
- package/dist/fonts/ibm-plex/ibm-plex-sans-medium.woff2 +0 -0
- package/dist/fonts/ibm-plex/ibm-plex-sans-regular.woff2 +0 -0
- package/dist/fonts/inter/inter-bold.woff2 +0 -0
- package/dist/fonts/inter/inter-medium.woff2 +0 -0
- package/dist/fonts/inter/inter-regular.woff2 +0 -0
- package/dist/fonts/inter/inter-semibold.woff2 +0 -0
- package/dist/fonts/jetbrains-mono/jetbrains-mono-bold.woff2 +0 -0
- package/dist/fonts/jetbrains-mono/jetbrains-mono-regular.woff2 +0 -0
- package/dist/fonts/open-sans/open-sans-bold.woff2 +0 -0
- package/dist/fonts/open-sans/open-sans-medium.woff2 +0 -0
- package/dist/fonts/open-sans/open-sans-regular.woff2 +0 -0
- package/dist/fonts/rubik/rubik-bold.woff2 +0 -0
- package/dist/fonts/rubik/rubik-medium.woff2 +0 -0
- package/dist/fonts/rubik/rubik-regular.woff2 +0 -0
- package/dist/fonts/source-sans/source-sans-bold.woff2 +0 -0
- package/dist/fonts/source-sans/source-sans-regular.woff2 +0 -0
- package/dist/fonts/source-sans/source-sans-semibold.woff2 +0 -0
- package/dist/fonts/titillium-web/titillium-web-bold.woff2 +0 -0
- package/dist/fonts/titillium-web/titillium-web-regular.woff2 +0 -0
- package/dist/fonts/titillium-web/titillium-web-semibold.woff2 +0 -0
- package/dist/fonts/ubuntu/ubuntu-bold.woff2 +0 -0
- package/dist/fonts/ubuntu/ubuntu-medium.woff2 +0 -0
- package/dist/fonts/ubuntu/ubuntu-regular.woff2 +0 -0
- package/dist/icons/phosphor/LICENSE +21 -0
- package/dist/icons/phosphor/bold/Phosphor-Bold.ttf +0 -0
- package/dist/icons/phosphor/bold/Phosphor-Bold.woff +0 -0
- package/dist/icons/phosphor/bold/Phosphor-Bold.woff2 +0 -0
- package/dist/icons/phosphor/bold/style.css +4627 -0
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.ttf +0 -0
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.woff +0 -0
- package/dist/icons/phosphor/duotone/Phosphor-Duotone.woff2 +0 -0
- package/dist/icons/phosphor/duotone/style.css +12115 -0
- package/dist/icons/phosphor/fill/Phosphor-Fill.ttf +0 -0
- package/dist/icons/phosphor/fill/Phosphor-Fill.woff +0 -0
- package/dist/icons/phosphor/fill/Phosphor-Fill.woff2 +0 -0
- package/dist/icons/phosphor/fill/style.css +4627 -0
- package/dist/icons/phosphor/light/Phosphor-Light.ttf +0 -0
- package/dist/icons/phosphor/light/Phosphor-Light.woff +0 -0
- package/dist/icons/phosphor/light/Phosphor-Light.woff2 +0 -0
- package/dist/icons/phosphor/light/style.css +4627 -0
- package/dist/icons/phosphor/regular/Phosphor.ttf +0 -0
- package/dist/icons/phosphor/regular/Phosphor.woff +0 -0
- package/dist/icons/phosphor/regular/Phosphor.woff2 +0 -0
- package/dist/icons/phosphor/regular/style.css +4627 -0
- package/dist/icons/phosphor/thin/Phosphor-Thin.ttf +0 -0
- package/dist/icons/phosphor/thin/Phosphor-Thin.woff +0 -0
- package/dist/icons/phosphor/thin/Phosphor-Thin.woff2 +0 -0
- package/dist/icons/phosphor/thin/style.css +4627 -0
- package/dist/vanduo.cjs.js +5569 -0
- package/dist/vanduo.cjs.js.map +7 -0
- package/dist/vanduo.cjs.min.js +48 -0
- package/dist/vanduo.cjs.min.js.map +7 -0
- package/dist/vanduo.css +60666 -0
- package/dist/vanduo.css.map +1 -0
- package/dist/vanduo.esm.js +5548 -0
- package/dist/vanduo.esm.js.map +7 -0
- package/dist/vanduo.esm.min.js +48 -0
- package/dist/vanduo.esm.min.js.map +7 -0
- package/dist/vanduo.js +5545 -0
- package/dist/vanduo.js.map +7 -0
- package/dist/vanduo.min.css +2 -0
- package/dist/vanduo.min.css.map +1 -0
- package/dist/vanduo.min.js +48 -0
- package/dist/vanduo.min.js.map +7 -0
- package/fonts/fira-sans/fira-sans-bold.woff2 +0 -0
- package/fonts/fira-sans/fira-sans-medium.woff2 +0 -0
- package/fonts/fira-sans/fira-sans-regular.woff2 +0 -0
- package/fonts/ibm-plex/ibm-plex-sans-bold.woff2 +0 -0
- package/fonts/ibm-plex/ibm-plex-sans-medium.woff2 +0 -0
- package/fonts/ibm-plex/ibm-plex-sans-regular.woff2 +0 -0
- package/fonts/inter/inter-bold.woff2 +0 -0
- package/fonts/inter/inter-medium.woff2 +0 -0
- package/fonts/inter/inter-regular.woff2 +0 -0
- package/fonts/inter/inter-semibold.woff2 +0 -0
- package/fonts/jetbrains-mono/jetbrains-mono-bold.woff2 +0 -0
- package/fonts/jetbrains-mono/jetbrains-mono-regular.woff2 +0 -0
- package/fonts/open-sans/open-sans-bold.woff2 +0 -0
- package/fonts/open-sans/open-sans-medium.woff2 +0 -0
- package/fonts/open-sans/open-sans-regular.woff2 +0 -0
- package/fonts/rubik/rubik-bold.woff2 +0 -0
- package/fonts/rubik/rubik-medium.woff2 +0 -0
- package/fonts/rubik/rubik-regular.woff2 +0 -0
- package/fonts/source-sans/source-sans-bold.woff2 +0 -0
- package/fonts/source-sans/source-sans-regular.woff2 +0 -0
- package/fonts/source-sans/source-sans-semibold.woff2 +0 -0
- package/fonts/titillium-web/titillium-web-bold.woff2 +0 -0
- package/fonts/titillium-web/titillium-web-regular.woff2 +0 -0
- package/fonts/titillium-web/titillium-web-semibold.woff2 +0 -0
- package/fonts/ubuntu/ubuntu-bold.woff2 +0 -0
- package/fonts/ubuntu/ubuntu-medium.woff2 +0 -0
- package/fonts/ubuntu/ubuntu-regular.woff2 +0 -0
- package/icons/phosphor/LICENSE +21 -0
- package/icons/phosphor/bold/Phosphor-Bold.ttf +0 -0
- package/icons/phosphor/bold/Phosphor-Bold.woff +0 -0
- package/icons/phosphor/bold/Phosphor-Bold.woff2 +0 -0
- package/icons/phosphor/bold/style.css +4627 -0
- package/icons/phosphor/duotone/Phosphor-Duotone.ttf +0 -0
- package/icons/phosphor/duotone/Phosphor-Duotone.woff +0 -0
- package/icons/phosphor/duotone/Phosphor-Duotone.woff2 +0 -0
- package/icons/phosphor/duotone/style.css +12115 -0
- package/icons/phosphor/fill/Phosphor-Fill.ttf +0 -0
- package/icons/phosphor/fill/Phosphor-Fill.woff +0 -0
- package/icons/phosphor/fill/Phosphor-Fill.woff2 +0 -0
- package/icons/phosphor/fill/style.css +4627 -0
- package/icons/phosphor/light/Phosphor-Light.ttf +0 -0
- package/icons/phosphor/light/Phosphor-Light.woff +0 -0
- package/icons/phosphor/light/Phosphor-Light.woff2 +0 -0
- package/icons/phosphor/light/style.css +4627 -0
- package/icons/phosphor/regular/Phosphor.ttf +0 -0
- package/icons/phosphor/regular/Phosphor.woff +0 -0
- package/icons/phosphor/regular/Phosphor.woff2 +0 -0
- package/icons/phosphor/regular/style.css +4627 -0
- package/icons/phosphor/thin/Phosphor-Thin.ttf +0 -0
- package/icons/phosphor/thin/Phosphor-Thin.woff +0 -0
- package/icons/phosphor/thin/Phosphor-Thin.woff2 +0 -0
- package/icons/phosphor/thin/style.css +4627 -0
- package/js/components/code-snippet.js +639 -0
- package/js/components/collapsible.js +226 -0
- package/js/components/doc-search.js +936 -0
- package/js/components/draggable.js +725 -0
- package/js/components/dropdown.js +362 -0
- package/js/components/font-switcher.js +253 -0
- package/js/components/grid.js +279 -0
- package/js/components/image-box.js +372 -0
- package/js/components/modals.js +367 -0
- package/js/components/navbar.js +264 -0
- package/js/components/pagination.js +286 -0
- package/js/components/parallax.js +216 -0
- package/js/components/preloader.js +183 -0
- package/js/components/select.js +444 -0
- package/js/components/sidenav.js +303 -0
- package/js/components/tabs.js +303 -0
- package/js/components/theme-customizer.js +784 -0
- package/js/components/theme-switcher.js +183 -0
- package/js/components/toast.js +343 -0
- package/js/components/tooltips.js +306 -0
- package/js/index.js +52 -0
- package/js/utils/helpers.js +306 -0
- package/js/utils/lifecycle.js +135 -0
- package/js/vanduo.js +120 -0
- package/package.json +78 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vanduo Framework - Collapsible Component
|
|
3
|
+
* JavaScript functionality for collapsible/accordion components
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
(function() {
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Collapsible Component
|
|
11
|
+
*/
|
|
12
|
+
const Collapsible = {
|
|
13
|
+
// Store initialized containers and their cleanup functions
|
|
14
|
+
instances: new Map(),
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Initialize collapsible components
|
|
18
|
+
*/
|
|
19
|
+
init: function() {
|
|
20
|
+
const collapsibles = document.querySelectorAll('.vd-collapsible, .accordion');
|
|
21
|
+
|
|
22
|
+
collapsibles.forEach(container => {
|
|
23
|
+
if (this.instances.has(container)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.initCollapsible(container);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Initialize a collapsible container
|
|
32
|
+
* @param {HTMLElement} container - Collapsible container
|
|
33
|
+
*/
|
|
34
|
+
initCollapsible: function(container) {
|
|
35
|
+
const isAccordion = container.classList.contains('accordion');
|
|
36
|
+
const items = container.querySelectorAll('.vd-collapsible-item, .accordion-item');
|
|
37
|
+
const cleanupFunctions = [];
|
|
38
|
+
|
|
39
|
+
items.forEach(item => {
|
|
40
|
+
const header = item.querySelector('.vd-collapsible-header, .accordion-header');
|
|
41
|
+
const body = item.querySelector('.vd-collapsible-body, .accordion-body');
|
|
42
|
+
const trigger = item.querySelector('.vd-collapsible-trigger, .accordion-trigger') || header;
|
|
43
|
+
|
|
44
|
+
if (!header || !body) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Set initial state
|
|
49
|
+
if (item.classList.contains('is-open')) {
|
|
50
|
+
this.openItem(item, body, false);
|
|
51
|
+
} else {
|
|
52
|
+
this.closeItem(item, body, false);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Add click handler
|
|
56
|
+
const clickHandler = (e) => {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
this.toggleItem(item, body, container, isAccordion);
|
|
59
|
+
};
|
|
60
|
+
trigger.addEventListener('click', clickHandler);
|
|
61
|
+
cleanupFunctions.push(() => trigger.removeEventListener('click', clickHandler));
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
this.instances.set(container, { cleanup: cleanupFunctions });
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Toggle collapsible item
|
|
69
|
+
* @param {HTMLElement} item - Collapsible item
|
|
70
|
+
* @param {HTMLElement} body - Collapsible body
|
|
71
|
+
* @param {HTMLElement} container - Collapsible container
|
|
72
|
+
* @param {boolean} isAccordion - Whether in accordion mode
|
|
73
|
+
*/
|
|
74
|
+
toggleItem: function(item, body, container, isAccordion) {
|
|
75
|
+
const isOpen = item.classList.contains('is-open');
|
|
76
|
+
|
|
77
|
+
if (isOpen) {
|
|
78
|
+
this.closeItem(item, body);
|
|
79
|
+
} else {
|
|
80
|
+
// If accordion mode, close other open items
|
|
81
|
+
if (isAccordion) {
|
|
82
|
+
const otherOpenItems = container.querySelectorAll('.vd-collapsible-item.is-open, .accordion-item.is-open');
|
|
83
|
+
otherOpenItems.forEach(otherItem => {
|
|
84
|
+
if (otherItem !== item) {
|
|
85
|
+
const otherBody = otherItem.querySelector('.vd-collapsible-body, .accordion-body');
|
|
86
|
+
this.closeItem(otherItem, otherBody);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.openItem(item, body);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Open collapsible item
|
|
97
|
+
* @param {HTMLElement} item - Collapsible item
|
|
98
|
+
* @param {HTMLElement} body - Collapsible body
|
|
99
|
+
* @param {boolean} animate - Whether to animate
|
|
100
|
+
*/
|
|
101
|
+
openItem: function(item, body, animate = true) {
|
|
102
|
+
if (!animate) {
|
|
103
|
+
body.style.transition = 'none';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
item.classList.add('is-open');
|
|
107
|
+
item.setAttribute('aria-expanded', 'true');
|
|
108
|
+
|
|
109
|
+
// Set max-height to actual height
|
|
110
|
+
const height = body.scrollHeight;
|
|
111
|
+
body.style.maxHeight = `${height}px`;
|
|
112
|
+
|
|
113
|
+
// Reset transition after a brief delay
|
|
114
|
+
if (!animate) {
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
body.style.transition = '';
|
|
117
|
+
}, 0);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Dispatch event
|
|
121
|
+
item.dispatchEvent(new CustomEvent('collapsible:open', { bubbles: true }));
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Close collapsible item
|
|
126
|
+
* @param {HTMLElement} item - Collapsible item
|
|
127
|
+
* @param {HTMLElement} body - Collapsible body
|
|
128
|
+
* @param {boolean} animate - Whether to animate
|
|
129
|
+
*/
|
|
130
|
+
closeItem: function(item, body, animate = true) {
|
|
131
|
+
if (!animate) {
|
|
132
|
+
body.style.transition = 'none';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
item.classList.remove('is-open');
|
|
136
|
+
item.setAttribute('aria-expanded', 'false');
|
|
137
|
+
body.style.maxHeight = '0';
|
|
138
|
+
|
|
139
|
+
// Reset transition after a brief delay
|
|
140
|
+
if (!animate) {
|
|
141
|
+
setTimeout(() => {
|
|
142
|
+
body.style.transition = '';
|
|
143
|
+
}, 0);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Dispatch event
|
|
147
|
+
item.dispatchEvent(new CustomEvent('collapsible:close', { bubbles: true }));
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Open item programmatically
|
|
152
|
+
* @param {HTMLElement|string} item - Collapsible item or selector
|
|
153
|
+
*/
|
|
154
|
+
open: function(item) {
|
|
155
|
+
const el = typeof item === 'string' ? document.querySelector(item) : item;
|
|
156
|
+
if (el) {
|
|
157
|
+
const body = el.querySelector('.vd-collapsible-body, .accordion-body');
|
|
158
|
+
if (body) {
|
|
159
|
+
this.openItem(el, body);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Close item programmatically
|
|
166
|
+
* @param {HTMLElement|string} item - Collapsible item or selector
|
|
167
|
+
*/
|
|
168
|
+
close: function(item) {
|
|
169
|
+
const el = typeof item === 'string' ? document.querySelector(item) : item;
|
|
170
|
+
if (el) {
|
|
171
|
+
const body = el.querySelector('.vd-collapsible-body, .accordion-body');
|
|
172
|
+
if (body) {
|
|
173
|
+
this.closeItem(el, body);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Toggle item programmatically
|
|
180
|
+
* @param {HTMLElement|string} item - Collapsible item or selector
|
|
181
|
+
*/
|
|
182
|
+
toggle: function(item) {
|
|
183
|
+
const el = typeof item === 'string' ? document.querySelector(item) : item;
|
|
184
|
+
if (el) {
|
|
185
|
+
const body = el.querySelector('.vd-collapsible-body, .accordion-body');
|
|
186
|
+
const container = el.closest('.vd-collapsible, .accordion');
|
|
187
|
+
const isAccordion = container && container.classList.contains('accordion');
|
|
188
|
+
|
|
189
|
+
if (body) {
|
|
190
|
+
this.toggleItem(el, body, container, isAccordion);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Destroy a collapsible instance and clean up event listeners
|
|
197
|
+
* @param {HTMLElement} container - Collapsible container
|
|
198
|
+
*/
|
|
199
|
+
destroy: function(container) {
|
|
200
|
+
const instance = this.instances.get(container);
|
|
201
|
+
if (!instance) return;
|
|
202
|
+
|
|
203
|
+
instance.cleanup.forEach(fn => fn());
|
|
204
|
+
this.instances.delete(container);
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Destroy all collapsible instances
|
|
209
|
+
*/
|
|
210
|
+
destroyAll: function() {
|
|
211
|
+
this.instances.forEach((instance, container) => {
|
|
212
|
+
this.destroy(container);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
// Register with Vanduo framework if available
|
|
218
|
+
if (typeof window.Vanduo !== 'undefined') {
|
|
219
|
+
window.Vanduo.register('collapsible', Collapsible);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Expose globally
|
|
223
|
+
window.VanduoCollapsible = Collapsible;
|
|
224
|
+
|
|
225
|
+
})();
|
|
226
|
+
|