@nova-design-system/nova-react 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -58
- package/dist/cjs/collapse.animation-acda1bf5-BuORVmQv.js +214 -0
- package/dist/cjs/{constants-a857c476-Cj2b-su0.js → constants-d0f19e7b-s0SCO_vi.js} +5 -0
- package/dist/cjs/fade.animation-eb454088-Bma0SpTf.js +724 -0
- package/dist/cjs/{index-jBgPO7HC.js → index-Jgn7NELT.js} +2090 -1681
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/{nv-accordion-item.entry-BUb_Apy8.js → nv-accordion-item.entry-C7vVmDCg.js} +74 -40
- package/dist/cjs/nv-accordion.entry-CFynyAOo.js +178 -0
- package/dist/cjs/{nv-alert.entry-nzJu8E5h.js → nv-alert.entry-C_FMs0Yi.js} +20 -20
- package/dist/cjs/{nv-avatar.entry-BPp1d-QO.js → nv-avatar.entry-BvjSzIHn.js} +7 -7
- package/dist/cjs/{nv-badge_2.entry-Bk56p4jv.js → nv-badge_2.entry-CLNvgVtj.js} +11 -11
- package/dist/cjs/{nv-breadcrumb.entry-DB3zR7FC.js → nv-breadcrumb.entry-Ch2Cvr_a.js} +1 -1
- package/dist/cjs/{nv-breadcrumbs.entry-CoGgEsro.js → nv-breadcrumbs.entry-DmH8AGIm.js} +1 -1
- package/dist/cjs/{nv-button.entry-psZ3_t6i.js → nv-button.entry-B0lusQ2w.js} +7 -7
- package/dist/cjs/{nv-buttongroup.entry-cNenBx1F.js → nv-buttongroup.entry-DLVCcdh9.js} +1 -1
- package/dist/cjs/{nv-calendar.entry-nkrORr_V.js → nv-calendar.entry-BmX0f_Or.js} +20 -16
- package/dist/cjs/{nv-col.entry-D4mInxLU.js → nv-col.entry-lysICYEC.js} +1 -1
- package/dist/cjs/{nv-datagrid.entry-D50O7eyc.js → nv-datagrid.entry-vG3h5dj3.js} +6 -6
- package/dist/cjs/{nv-datagridcolumn.entry-BuGX-3ev.js → nv-datagridcolumn.entry-9NynF9K-.js} +1 -1
- package/dist/cjs/{nv-dialog.entry-yiZIq-TV.js → nv-dialog.entry-Ctsz1K-O.js} +3 -3
- package/dist/cjs/{nv-dialogfooter_2.entry-C9ykJQK6.js → nv-dialogfooter_2.entry-B17HEgyc.js} +10 -7
- package/dist/cjs/{nv-fieldcheckbox.entry-CCRvvFJ3.js → nv-fieldcheckbox.entry-DMiADwqV.js} +1 -1
- package/dist/cjs/{nv-fielddate.entry-C4k6k980.js → nv-fielddate.entry-D3X6Jl3u.js} +1 -1
- package/dist/cjs/{nv-fielddaterange.entry-BhfV2KCd.js → nv-fielddaterange.entry-C8_SFFXW.js} +1 -1
- package/dist/cjs/{nv-fielddropdown.entry-Xkkvl_gb.js → nv-fielddropdown.entry-BiBR8Qgs.js} +1 -1
- package/dist/cjs/{nv-fielddropdownitem.entry-Ckwq6k6r.js → nv-fielddropdownitem.entry-DQ8QK4AS.js} +1 -1
- package/dist/cjs/{nv-fieldmultiselect.entry-D4PgRSFv.js → nv-fieldmultiselect.entry-J5VTOPum.js} +1 -31
- package/dist/cjs/{nv-fieldnumber.entry-BEnJ81XX.js → nv-fieldnumber.entry-Djpg1HMq.js} +2 -2
- package/dist/cjs/{nv-fieldpassword.entry-elzveqP8.js → nv-fieldpassword.entry-DKT9Xn5H.js} +1 -1
- package/dist/cjs/{nv-fieldradio.entry-xJpdsXGo.js → nv-fieldradio.entry-CPYf3K2o.js} +1 -1
- package/dist/cjs/{nv-fieldselect.entry-DVyO7LMD.js → nv-fieldselect.entry-DnbL7aZB.js} +1 -1
- package/dist/cjs/{nv-fieldslider.entry-O4TFO-Rl.js → nv-fieldslider.entry-CNRJuo7v.js} +25 -17
- package/dist/cjs/{nv-fieldtext.entry-p-9GEp1g.js → nv-fieldtext.entry-B9lIHck7.js} +1 -1
- package/dist/cjs/{nv-fieldtextarea.entry-Cvik8cci.js → nv-fieldtextarea.entry-B2EDj8cm.js} +1 -1
- package/dist/cjs/{nv-fieldtime.entry-mnsDon9M.js → nv-fieldtime.entry-CpoXpAPx.js} +60 -60
- package/dist/cjs/{nv-icon.entry-CrgnozDL.js → nv-icon.entry-DbOeEd4f.js} +7 -7
- package/dist/cjs/{nv-iconbutton_2.entry-M5EY3-1s.js → nv-iconbutton_2.entry-DR_wR73O.js} +1 -1
- package/dist/cjs/{nv-menu.entry-D7bORqXp.js → nv-menu.entry-DB_G8hS_.js} +1 -1
- package/dist/cjs/{nv-menuitem.entry-CaN6qNoB.js → nv-menuitem.entry-PBCNIzPI.js} +1 -1
- package/dist/cjs/nv-notification.entry-CyumbQS_.js +178 -0
- package/dist/cjs/{nv-popover.entry-DGeXSyhZ.js → nv-popover.entry-ttESQMgj.js} +9 -9
- package/dist/cjs/{nv-row.entry-B17DsCjM.js → nv-row.entry-DPEGaFeS.js} +2 -2
- package/dist/cjs/{nv-stack.entry-Dv3YU4nJ.js → nv-stack.entry-CTPwlz23.js} +2 -2
- package/dist/cjs/{nv-table.entry-BILyG-43.js → nv-table.entry-Dv1mZKcu.js} +3 -3
- package/dist/cjs/{nv-tablecolumn.entry-II6Z_gdO.js → nv-tablecolumn.entry-DrAaeHm-.js} +1 -1
- package/dist/cjs/{nv-toggle.entry-5Wmww2Cd.js → nv-toggle.entry-D2TRd371.js} +3 -3
- package/dist/cjs/{nv-togglebutton.entry-Dnmfrj0O.js → nv-togglebutton.entry-D95qOQ1K.js} +2 -2
- package/dist/cjs/{nv-togglebuttongroup.entry-C9mplQcb.js → nv-togglebuttongroup.entry-BNvyZgbh.js} +2 -2
- package/dist/cjs/{nv-tooltip.entry-CcUQrjAv.js → nv-tooltip.entry-oOw6EmyL.js} +2 -2
- package/dist/cjs/{stylefire.es-74da334a-y0piPjlz.js → style-value-types.es-f5d10b79-D0QCM8OB.js} +50 -694
- package/dist/cjs/{timeline.animation-adf35ecb-CE6Dsdxr.js → timeline.animation-79215cd4-KteJaZPb.js} +19 -0
- package/dist/generated/components.js +8 -0
- package/dist/generated/components.server.js +18 -1
- package/dist/types/generated/components.d.ts +5 -0
- package/dist/types/generated/components.server.d.ts +5 -0
- package/package.json +1 -1
- package/dist/cjs/collapse.animation-16e3af45-CChx_tQJ.js +0 -84
- package/dist/cjs/fade.animation-71e8e34c-BAw_TYsB.js +0 -68
- package/dist/cjs/nv-accordion.entry-hi3M0POV.js +0 -164
package/dist/cjs/{timeline.animation-adf35ecb-CE6Dsdxr.js → timeline.animation-79215cd4-KteJaZPb.js}
RENAMED
|
@@ -19,5 +19,24 @@ const timeline = (...animations) => ({
|
|
|
19
19
|
return animations.reduce((promise, animation) => promise.then(() => animation()), Promise.resolve());
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
|
+
/**
|
|
23
|
+
* Will execute a series of animation promises in parallel.
|
|
24
|
+
* This is useful for running multiple animations simultaneously.
|
|
25
|
+
*
|
|
26
|
+
* @param {Array<() => Promise<void>>} animations - The array of animation functions.
|
|
27
|
+
* @returns {Object} - An object with a `start` method to begin the parallel animations.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* const { fadeOut } = useFade(this.ref);
|
|
31
|
+
* const { slideOut } = useSlide(this.containerRef);
|
|
32
|
+
*
|
|
33
|
+
* parallel(fadeOut, slideOut).start();
|
|
34
|
+
*/
|
|
35
|
+
const parallel = (...animations) => ({
|
|
36
|
+
start: () => {
|
|
37
|
+
return Promise.all(animations.map(animation => animation()));
|
|
38
|
+
},
|
|
39
|
+
});
|
|
22
40
|
|
|
41
|
+
exports.parallel = parallel;
|
|
23
42
|
exports.timeline = timeline;
|
|
@@ -35,6 +35,7 @@ import { NvIconbutton as NvIconbuttonElement, defineCustomElement as defineNvIco
|
|
|
35
35
|
import { NvLoader as NvLoaderElement, defineCustomElement as defineNvLoader } from "@nova-design-system/nova-webcomponents/dist/components/nv-loader.js";
|
|
36
36
|
import { NvMenu as NvMenuElement, defineCustomElement as defineNvMenu } from "@nova-design-system/nova-webcomponents/dist/components/nv-menu.js";
|
|
37
37
|
import { NvMenuitem as NvMenuitemElement, defineCustomElement as defineNvMenuitem } from "@nova-design-system/nova-webcomponents/dist/components/nv-menuitem.js";
|
|
38
|
+
import { NvNotification as NvNotificationElement, defineCustomElement as defineNvNotification } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification.js";
|
|
38
39
|
import { NvPopover as NvPopoverElement, defineCustomElement as defineNvPopover } from "@nova-design-system/nova-webcomponents/dist/components/nv-popover.js";
|
|
39
40
|
import { NvRow as NvRowElement, defineCustomElement as defineNvRow } from "@nova-design-system/nova-webcomponents/dist/components/nv-row.js";
|
|
40
41
|
import { NvStack as NvStackElement, defineCustomElement as defineNvStack } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
|
|
@@ -326,6 +327,13 @@ export const NvMenuitem = createComponent({
|
|
|
326
327
|
events: { onMenuitemSelected: 'menuitemSelected' },
|
|
327
328
|
defineCustomElement: defineNvMenuitem
|
|
328
329
|
});
|
|
330
|
+
export const NvNotification = createComponent({
|
|
331
|
+
tagName: 'nv-notification',
|
|
332
|
+
elementClass: NvNotificationElement,
|
|
333
|
+
react: React,
|
|
334
|
+
events: { onHiddenChanged: 'hiddenChanged' },
|
|
335
|
+
defineCustomElement: defineNvNotification
|
|
336
|
+
});
|
|
329
337
|
export const NvPopover = createComponent({
|
|
330
338
|
tagName: 'nv-popover',
|
|
331
339
|
elementClass: NvPopoverElement,
|
|
@@ -128,7 +128,9 @@ export const NvCalendar = createComponent({
|
|
|
128
128
|
shortcutsPlacement: 'shortcuts-placement',
|
|
129
129
|
selectionType: 'selection-type',
|
|
130
130
|
showActions: 'show-actions',
|
|
131
|
-
showWeekNumbers: 'show-week-numbers'
|
|
131
|
+
showWeekNumbers: 'show-week-numbers',
|
|
132
|
+
cancelLabel: 'cancel-label',
|
|
133
|
+
primaryLabel: 'primary-label'
|
|
132
134
|
},
|
|
133
135
|
hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
|
|
134
136
|
serializeShadowRoot
|
|
@@ -646,6 +648,21 @@ export const NvMenuitem = createComponent({
|
|
|
646
648
|
hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
|
|
647
649
|
serializeShadowRoot
|
|
648
650
|
});
|
|
651
|
+
export const NvNotification = createComponent({
|
|
652
|
+
tagName: 'nv-notification',
|
|
653
|
+
properties: {
|
|
654
|
+
uid: 'uid',
|
|
655
|
+
feedback: 'feedback',
|
|
656
|
+
emphasis: 'emphasis',
|
|
657
|
+
heading: 'heading',
|
|
658
|
+
message: 'message',
|
|
659
|
+
icon: 'icon',
|
|
660
|
+
dismissible: 'dismissible',
|
|
661
|
+
hidden: 'hidden'
|
|
662
|
+
},
|
|
663
|
+
hydrateModule: import('@nova-design-system/nova-webcomponents/hydrate'),
|
|
664
|
+
serializeShadowRoot
|
|
665
|
+
});
|
|
649
666
|
export const NvPopover = createComponent({
|
|
650
667
|
tagName: 'nv-popover',
|
|
651
668
|
properties: {
|
|
@@ -35,6 +35,7 @@ import { NvIconbutton as NvIconbuttonElement } from "@nova-design-system/nova-we
|
|
|
35
35
|
import { NvLoader as NvLoaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-loader.js";
|
|
36
36
|
import { NvMenu as NvMenuElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menu.js";
|
|
37
37
|
import { NvMenuitem as NvMenuitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menuitem.js";
|
|
38
|
+
import { NvNotification as NvNotificationElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification.js";
|
|
38
39
|
import { NvPopover as NvPopoverElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-popover.js";
|
|
39
40
|
import { NvRow as NvRowElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-row.js";
|
|
40
41
|
import { NvStack as NvStackElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
|
|
@@ -205,6 +206,10 @@ export type NvMenuitemEvents = {
|
|
|
205
206
|
}>>;
|
|
206
207
|
};
|
|
207
208
|
export declare const NvMenuitem: StencilReactComponent<NvMenuitemElement, NvMenuitemEvents>;
|
|
209
|
+
export type NvNotificationEvents = {
|
|
210
|
+
onHiddenChanged: EventName<CustomEvent<boolean>>;
|
|
211
|
+
};
|
|
212
|
+
export declare const NvNotification: StencilReactComponent<NvNotificationElement, NvNotificationEvents>;
|
|
208
213
|
export type NvPopoverEvents = {
|
|
209
214
|
onOpenChanged: EventName<CustomEvent<boolean>>;
|
|
210
215
|
};
|
|
@@ -35,6 +35,7 @@ import { NvIconbutton as NvIconbuttonElement } from "@nova-design-system/nova-we
|
|
|
35
35
|
import { NvLoader as NvLoaderElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-loader.js";
|
|
36
36
|
import { NvMenu as NvMenuElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menu.js";
|
|
37
37
|
import { NvMenuitem as NvMenuitemElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-menuitem.js";
|
|
38
|
+
import { NvNotification as NvNotificationElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-notification.js";
|
|
38
39
|
import { NvPopover as NvPopoverElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-popover.js";
|
|
39
40
|
import { NvRow as NvRowElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-row.js";
|
|
40
41
|
import { NvStack as NvStackElement } from "@nova-design-system/nova-webcomponents/dist/components/nv-stack.js";
|
|
@@ -207,6 +208,10 @@ export type NvMenuitemEvents = {
|
|
|
207
208
|
}>>;
|
|
208
209
|
};
|
|
209
210
|
export declare const NvMenuitem: StencilReactComponent<NvMenuitemElement, NvMenuitemEvents>;
|
|
211
|
+
export type NvNotificationEvents = {
|
|
212
|
+
onHiddenChanged: EventName<CustomEvent<boolean>>;
|
|
213
|
+
};
|
|
214
|
+
export declare const NvNotification: StencilReactComponent<NvNotificationElement, NvNotificationEvents>;
|
|
210
215
|
export type NvPopoverEvents = {
|
|
211
216
|
onOpenChanged: EventName<CustomEvent<boolean>>;
|
|
212
217
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nova-design-system/nova-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Nova is a design system created by Elia Group to empower creators to efficiently build solutions that people love to use.",
|
|
5
5
|
"author": "Elia Group",
|
|
6
6
|
"homepage": "https://nova.eliagroup.io",
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var stylefire_es74da334a = require('./stylefire.es-74da334a-y0piPjlz.js');
|
|
4
|
-
|
|
5
|
-
const useCollapse = (node, { duration } = { duration: 200 }) => {
|
|
6
|
-
const nodeStyler = stylefire_es74da334a.index(node);
|
|
7
|
-
/**
|
|
8
|
-
* Will set the overflow to hidden, and animate the max height to 0. Make sure
|
|
9
|
-
* the element has no border or y padding set, otherwise the animation will
|
|
10
|
-
* not work as expected.
|
|
11
|
-
*/
|
|
12
|
-
function collapse() {
|
|
13
|
-
return new Promise(resolve => {
|
|
14
|
-
const height = node.getBoundingClientRect().height;
|
|
15
|
-
nodeStyler.set({ overflow: 'hidden' });
|
|
16
|
-
stylefire_es74da334a.animate({
|
|
17
|
-
from: height,
|
|
18
|
-
to: 0,
|
|
19
|
-
duration,
|
|
20
|
-
onUpdate: value => {
|
|
21
|
-
nodeStyler.set({
|
|
22
|
-
maxHeight: value,
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
onComplete: () => {
|
|
26
|
-
resolve();
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Apply the collapsed styles without animating, useful when initial state
|
|
33
|
-
* is collapsed.
|
|
34
|
-
*/
|
|
35
|
-
function setCollapsed() {
|
|
36
|
-
node.style.maxHeight = '0';
|
|
37
|
-
node.style.overflow = 'hidden';
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Apply the expanded styles without animating, useful when initial state
|
|
41
|
-
* is expanded.
|
|
42
|
-
*/
|
|
43
|
-
function setExpanded() {
|
|
44
|
-
node.style.maxHeight = '';
|
|
45
|
-
node.style.overflow = '';
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Will set the overflow to hidden, and animate the max height to the value
|
|
49
|
-
* of the scrollHeight. Make sure the element has no border or y padding set,
|
|
50
|
-
* otherwise the animation will not work as expected. Once complete, the
|
|
51
|
-
* max-height and overflow style properties will be removed.
|
|
52
|
-
*/
|
|
53
|
-
function expand() {
|
|
54
|
-
return new Promise(resolve => {
|
|
55
|
-
const scrollHeight = node.scrollHeight;
|
|
56
|
-
nodeStyler.set({
|
|
57
|
-
overflow: 'hidden',
|
|
58
|
-
});
|
|
59
|
-
stylefire_es74da334a.animate({
|
|
60
|
-
from: 0,
|
|
61
|
-
to: scrollHeight,
|
|
62
|
-
duration,
|
|
63
|
-
onUpdate: value => {
|
|
64
|
-
nodeStyler.set({
|
|
65
|
-
maxHeight: value,
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
onComplete: () => {
|
|
69
|
-
node.style.removeProperty('max-height');
|
|
70
|
-
node.style.removeProperty('overflow');
|
|
71
|
-
resolve();
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
collapse,
|
|
78
|
-
expand,
|
|
79
|
-
setCollapsed,
|
|
80
|
-
setExpanded,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
exports.useCollapse = useCollapse;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var stylefire_es74da334a = require('./stylefire.es-74da334a-y0piPjlz.js');
|
|
4
|
-
|
|
5
|
-
const useFade = (node, { duration } = { duration: 200 }) => {
|
|
6
|
-
const nodeStyler = stylefire_es74da334a.index(node);
|
|
7
|
-
/**
|
|
8
|
-
* Will animate the opacity to 1, and removes the opacity style attribute once
|
|
9
|
-
* complete.
|
|
10
|
-
*/
|
|
11
|
-
function fadeIn() {
|
|
12
|
-
return new Promise(resolve => {
|
|
13
|
-
stylefire_es74da334a.animate({
|
|
14
|
-
from: { opacity: 0 },
|
|
15
|
-
to: { opacity: 1 },
|
|
16
|
-
duration,
|
|
17
|
-
onUpdate(latest) {
|
|
18
|
-
nodeStyler.set({ opacity: latest.opacity });
|
|
19
|
-
},
|
|
20
|
-
onComplete() {
|
|
21
|
-
resolve();
|
|
22
|
-
node.style.removeProperty('opacity');
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Applies the fadeOut styles without animating, useful when initial state
|
|
29
|
-
* is hidden.
|
|
30
|
-
*/
|
|
31
|
-
function setFadeOut() {
|
|
32
|
-
node.style.opacity = '0';
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Applies the fadeIn styles without animating, useful when initial state
|
|
36
|
-
* is visible.
|
|
37
|
-
*/
|
|
38
|
-
function setFadeIn() {
|
|
39
|
-
node.style.opacity = '1';
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Will animate the opacity to 0, once complete, the opacity style attribute
|
|
43
|
-
* will stay on the element.
|
|
44
|
-
*/
|
|
45
|
-
function fadeOut() {
|
|
46
|
-
return new Promise(resolve => {
|
|
47
|
-
stylefire_es74da334a.animate({
|
|
48
|
-
from: { opacity: 1 },
|
|
49
|
-
to: { opacity: 0 },
|
|
50
|
-
duration,
|
|
51
|
-
onUpdate(latest) {
|
|
52
|
-
nodeStyler.set({ opacity: latest.opacity });
|
|
53
|
-
},
|
|
54
|
-
onComplete() {
|
|
55
|
-
resolve();
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return {
|
|
61
|
-
fadeIn,
|
|
62
|
-
fadeOut,
|
|
63
|
-
setFadeOut,
|
|
64
|
-
setFadeIn,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
exports.useFade = useFade;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-jBgPO7HC.js');
|
|
4
|
-
require('react');
|
|
5
|
-
|
|
6
|
-
const nvAccordionCss = "nv-accordion{display:block;border:var(--spacing-px) solid var(--color-content-low-border);border-radius:var(--radius-rounded-lg)}nv-accordion .nv-accordion__footer{padding:var(--spacing-3);background:var(--color-level-05-background);border-radius:0 0 var(--radius-rounded-lg) var(--radius-rounded-lg);margin-top:calc(var(--spacing-px) * -1);border-top:var(--spacing-px) solid var(--color-content-low-border)}nv-accordion .nv-accordion__footer:empty{display:none}";
|
|
7
|
-
const NvAccordionStyle0 = nvAccordionCss;
|
|
8
|
-
|
|
9
|
-
const NvAccordion = class {
|
|
10
|
-
constructor(hostRef) {
|
|
11
|
-
index.registerInstance(this, hostRef);
|
|
12
|
-
this.openChanged = index.createEvent(this, "openChanged");
|
|
13
|
-
/****************************************************************************/
|
|
14
|
-
//#region PROPERTIES
|
|
15
|
-
/**
|
|
16
|
-
* Data to display as a list of items (title, subtitle, content).
|
|
17
|
-
*/
|
|
18
|
-
this.data = [];
|
|
19
|
-
/**
|
|
20
|
-
* Expansion mode: 'accordion' (single open) or 'multi' (multiple open)
|
|
21
|
-
*/
|
|
22
|
-
this.mode = 'accordion';
|
|
23
|
-
//#endregion PROPERTIES
|
|
24
|
-
/****************************************************************************/
|
|
25
|
-
//#region STATE
|
|
26
|
-
/**
|
|
27
|
-
* Internal index of open items (not exposed)
|
|
28
|
-
*/
|
|
29
|
-
this.internalOpenIndexes = [];
|
|
30
|
-
}
|
|
31
|
-
//#endregion EVENTS
|
|
32
|
-
/****************************************************************************/
|
|
33
|
-
//#region METHODS
|
|
34
|
-
/**
|
|
35
|
-
* Opens an item by its index (Public API)
|
|
36
|
-
* @param {number} index Index of the item to open
|
|
37
|
-
*/
|
|
38
|
-
async open(index) {
|
|
39
|
-
this.toggleItem(index, true);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Closes an item by its index (Public API)
|
|
43
|
-
* @param {number} index Index of the item to close
|
|
44
|
-
*/
|
|
45
|
-
async close(index) {
|
|
46
|
-
this.toggleItem(index, false);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Toggles an item's state (internal)
|
|
50
|
-
* @param {number} index Item index
|
|
51
|
-
* @param {boolean} [forceOpen] Force open (true) or close (false)
|
|
52
|
-
*/
|
|
53
|
-
toggleItem(index, forceOpen) {
|
|
54
|
-
let openIndexes = this.openIndexes !== undefined
|
|
55
|
-
? [...this.openIndexes]
|
|
56
|
-
: [...(this.internalOpenIndexes || [])];
|
|
57
|
-
const isOpen = openIndexes.includes(index);
|
|
58
|
-
if (this.mode === 'accordion') {
|
|
59
|
-
openIndexes = forceOpen === false || isOpen ? [] : [index];
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
if (forceOpen === false) {
|
|
63
|
-
openIndexes = openIndexes.filter(i => i !== index);
|
|
64
|
-
}
|
|
65
|
-
else if (!isOpen) {
|
|
66
|
-
openIndexes.push(index);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
this.internalOpenIndexes = openIndexes;
|
|
70
|
-
this.openChanged.emit({ openIndexes });
|
|
71
|
-
if (this.openIndexes !== undefined) {
|
|
72
|
-
this.openIndexes =
|
|
73
|
-
this.mode === 'accordion'
|
|
74
|
-
? [openIndexes[0]].filter(x => x !== undefined)
|
|
75
|
-
: [...openIndexes];
|
|
76
|
-
}
|
|
77
|
-
// Update child elements state - for both data and slot usage
|
|
78
|
-
this.updateChildrenState();
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Updates the open state of child elements based on internalOpenIndexes
|
|
82
|
-
*/
|
|
83
|
-
async updateChildrenState() {
|
|
84
|
-
// Force a re-render by updating the state
|
|
85
|
-
this.internalOpenIndexes = [...(this.internalOpenIndexes || [])];
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Listens to itemToggle events from nv-accordion-item elements
|
|
89
|
-
* @param {CustomEvent<boolean>} event Event emitted by nv-accordion-item
|
|
90
|
-
*/
|
|
91
|
-
onItemToggle(event) {
|
|
92
|
-
// Find the index of the item that emitted the event
|
|
93
|
-
const items = Array.from(this.el.querySelectorAll('nv-accordion-item'));
|
|
94
|
-
const targetItem = event.target;
|
|
95
|
-
const index = items.indexOf(targetItem);
|
|
96
|
-
if (index !== -1) {
|
|
97
|
-
// If the event comes from an item that is opening, handle accordion mode
|
|
98
|
-
if (event.detail === true) {
|
|
99
|
-
if (this.mode === 'accordion') {
|
|
100
|
-
// Close all other items
|
|
101
|
-
items.forEach((item, i) => {
|
|
102
|
-
if (i !== index && item.open) {
|
|
103
|
-
item.open = false;
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
this.internalOpenIndexes = [index];
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
// Add index to internalOpenIndexes if not already present
|
|
110
|
-
if (!this.internalOpenIndexes.includes(index)) {
|
|
111
|
-
this.internalOpenIndexes = [...this.internalOpenIndexes, index];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
// If the item is closing, remove it from internalOpenIndexes
|
|
117
|
-
this.internalOpenIndexes = this.internalOpenIndexes.filter(i => i !== index);
|
|
118
|
-
}
|
|
119
|
-
// Emit openChanged event
|
|
120
|
-
this.openChanged.emit({ openIndexes: this.internalOpenIndexes });
|
|
121
|
-
if (this.openIndexes !== undefined) {
|
|
122
|
-
this.openIndexes =
|
|
123
|
-
this.mode === 'accordion'
|
|
124
|
-
? [this.internalOpenIndexes[0]].filter(x => x !== undefined)
|
|
125
|
-
: [...this.internalOpenIndexes];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
//#endregion METHODS
|
|
130
|
-
/****************************************************************************/
|
|
131
|
-
//#region WATCHERS
|
|
132
|
-
//#endregion WATCHERS
|
|
133
|
-
/****************************************************************************/
|
|
134
|
-
//#region LIFECYCLE
|
|
135
|
-
componentWillLoad() {
|
|
136
|
-
if (this.openIndexes !== undefined) {
|
|
137
|
-
this.internalOpenIndexes = [...this.openIndexes];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
componentDidLoad() {
|
|
141
|
-
// If using direct child elements, initialize their state
|
|
142
|
-
if (!this.data || this.data.length === 0) {
|
|
143
|
-
this.updateChildrenState();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
componentWillUpdate() {
|
|
147
|
-
if (this.openIndexes !== undefined) {
|
|
148
|
-
this.internalOpenIndexes = [...this.openIndexes];
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
//#endregion LIFECYCLE
|
|
152
|
-
/****************************************************************************/
|
|
153
|
-
//#region RENDER
|
|
154
|
-
render() {
|
|
155
|
-
return (index.h(index.Host, { key: 'a6cb21b274024a00e60e0d0db780f25fab6e5bc2', role: "list", class: "nv-accordion" }, this.data && this.data.length > 0 ? (this.data.map((item, i) => {
|
|
156
|
-
var _a;
|
|
157
|
-
return (index.h("nv-accordion-item", { key: (_a = item.id) !== null && _a !== void 0 ? _a : i, itemTitle: item.title, disabled: item.disabled, open: (this.internalOpenIndexes || []).includes(i) }, item.subtitle ? (index.h("div", { slot: "header" }, index.h("div", { class: "nv-accordion-item__header-content" }, index.h("span", { class: "nv-accordion-item__title" }, item.title), index.h("span", { class: "nv-accordion-item__subtitle" }, item.subtitle)))) : null, index.h("div", { slot: "content" }, item.content), item.footer && index.h("div", { slot: "footer" }, item.footer)));
|
|
158
|
-
})) : (index.h("slot", null))));
|
|
159
|
-
}
|
|
160
|
-
get el() { return index.getElement(this); }
|
|
161
|
-
};
|
|
162
|
-
NvAccordion.style = NvAccordionStyle0;
|
|
163
|
-
|
|
164
|
-
exports.nv_accordion = NvAccordion;
|