@nuralyui/collapse 0.0.7 → 0.0.9
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/bundle.js +676 -0
- package/collapse.component.d.ts +94 -0
- package/collapse.component.js +324 -0
- package/collapse.component.js.map +1 -0
- package/collapse.style.d.ts +11 -0
- package/collapse.style.js +234 -0
- package/collapse.style.js.map +1 -0
- package/collapse.type.d.ts +79 -0
- package/collapse.type.js +11 -0
- package/collapse.type.js.map +1 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +16 -2
- package/react.d.ts +1 -1
- package/react.js +2 -2
- package/react.js.map +1 -1
- package/demo/hy-collapse-demo.d.ts +0 -8
- package/demo/hy-collapse-demo.d.ts.map +0 -1
- package/demo/hy-collapse-demo.js +0 -55
- package/demo/hy-collapse-demo.js.map +0 -1
- package/hy-collapse.component.d.ts +0 -10
- package/hy-collapse.component.d.ts.map +0 -1
- package/hy-collapse.component.js +0 -71
- package/hy-collapse.component.js.map +0 -1
- package/hy-collapse.style.d.ts +0 -2
- package/hy-collapse.style.d.ts.map +0 -1
- package/hy-collapse.style.js +0 -121
- package/hy-collapse.style.js.map +0 -1
- package/hy-collapse.type.d.ts +0 -12
- package/hy-collapse.type.d.ts.map +0 -1
- package/hy-collapse.type.js +0 -2
- package/hy-collapse.type.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/react.d.ts.map +0 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* Collapse component styles using theme variables
|
|
9
|
+
* Follows NuralyUI architecture with clean CSS variable usage
|
|
10
|
+
*/
|
|
11
|
+
export const styles = css `
|
|
12
|
+
:host {
|
|
13
|
+
display: block;
|
|
14
|
+
width: 100%;
|
|
15
|
+
|
|
16
|
+
/* Force CSS custom property inheritance to ensure theme switching works properly */
|
|
17
|
+
color: var(--nuraly-color-text);
|
|
18
|
+
background-color: var(--nuraly-color-background);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Force re-evaluation of theme-dependent properties on theme change */
|
|
22
|
+
:host([data-theme]) {
|
|
23
|
+
color: inherit;
|
|
24
|
+
background-color: inherit;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.collapse-container {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
gap: var(--nuraly-spacing-collapse-gap);
|
|
31
|
+
border: var(--nuraly-color-collapse-border);
|
|
32
|
+
border-radius: var(--nuraly-border-radius-collapse);
|
|
33
|
+
background-color: var(--nuraly-color-collapse-bordered-background);
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.collapse-section {
|
|
38
|
+
position: relative;
|
|
39
|
+
border-bottom: 1px solid var(--nuraly-color-collapse-border);
|
|
40
|
+
transition: var(--nuraly-transition-collapse);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.collapse-section:last-child {
|
|
44
|
+
border-bottom: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.collapse-section--disabled {
|
|
48
|
+
opacity: var(--nuraly-opacity-collapse-disabled);
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.collapse-section--non-collapsible .collapse-header {
|
|
53
|
+
cursor: default;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.collapse-section--animating .collapse-content {
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Header Styles */
|
|
61
|
+
.collapse-header {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
padding: var(--nuraly-spacing-collapse-padding);
|
|
66
|
+
background-color: var(--nuraly-color-collapse-header-background);
|
|
67
|
+
color: var(--nuraly-color-collapse-header-text);
|
|
68
|
+
font-weight: var(--nuraly-font-collapse-header-weight);
|
|
69
|
+
font-size: var(--nuraly-font-collapse-header-size);
|
|
70
|
+
line-height: var(--nuraly-font-collapse-header-line-height);
|
|
71
|
+
border: none;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
user-select: none;
|
|
74
|
+
transition: var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);
|
|
75
|
+
border-radius: var(--nuraly-border-radius-collapse-header);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.collapse-header--clickable:hover {
|
|
79
|
+
background-color: var(--nuraly-color-collapse-header-background-hover);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.collapse-header--clickable:active {
|
|
83
|
+
background-color: var(--nuraly-color-collapse-header-background-active);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.collapse-header--expanded {
|
|
87
|
+
background-color: var(--nuraly-color-collapse-header-background-expanded);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.collapse-header--disabled {
|
|
91
|
+
color: var(--nuraly-color-collapse-header-text-disabled);
|
|
92
|
+
cursor: not-allowed;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.collapse-header:focus-visible {
|
|
96
|
+
outline: 2px solid var(--nuraly-color-collapse-focus-outline);
|
|
97
|
+
outline-offset: 2px;
|
|
98
|
+
box-shadow: var(--nuraly-shadow-collapse-focus);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.collapse-header-text {
|
|
102
|
+
flex: 1;
|
|
103
|
+
text-align: left;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.collapse-header-right {
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
gap: var(--nuraly-spacing-collapse-header-right-gap, 0.5rem);
|
|
110
|
+
margin-left: var(--nuraly-spacing-collapse-header-right-margin, 0.75rem);
|
|
111
|
+
color: var(--nuraly-color-collapse-header-right-text, inherit);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.collapse-header-right > * {
|
|
115
|
+
flex-shrink: 0;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Icon Styles */
|
|
119
|
+
.collapse-icon {
|
|
120
|
+
display: flex;
|
|
121
|
+
align-items: center;
|
|
122
|
+
justify-content: center;
|
|
123
|
+
width: var(--nuraly-collapse-icon-size);
|
|
124
|
+
height: var(--nuraly-collapse-icon-size);
|
|
125
|
+
color: var(--nuraly-color-collapse-icon);
|
|
126
|
+
transition: var(--nuraly-collapse-icon-transition);
|
|
127
|
+
transform-origin: center;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.collapse-header--disabled .collapse-icon {
|
|
131
|
+
color: var(--nuraly-color-collapse-icon-disabled);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Content Styles */
|
|
135
|
+
.collapse-content {
|
|
136
|
+
background-color: var(--nuraly-color-collapse-content-background);
|
|
137
|
+
border-radius: var(--nuraly-border-radius-collapse-content);
|
|
138
|
+
transition: var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.collapse-content-inner {
|
|
142
|
+
padding: var(--nuraly-spacing-collapse-content-padding);
|
|
143
|
+
color: var(--nuraly-color-collapse-content-text);
|
|
144
|
+
font-weight: var(--nuraly-font-collapse-content-weight);
|
|
145
|
+
font-size: var(--nuraly-font-collapse-content-size);
|
|
146
|
+
line-height: var(--nuraly-font-collapse-content-line-height);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Size Variants */
|
|
150
|
+
:host([size="small"]) .collapse-header {
|
|
151
|
+
padding: var(--nuraly-spacing-collapse-small-padding);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
:host([size="small"]) .collapse-content-inner {
|
|
155
|
+
padding: var(--nuraly-spacing-collapse-small-content-padding);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:host([size="medium"]) .collapse-header {
|
|
159
|
+
padding: var(--nuraly-spacing-collapse-medium-padding);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
:host([size="medium"]) .collapse-content-inner {
|
|
163
|
+
padding: var(--nuraly-spacing-collapse-medium-content-padding);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:host([size="large"]) .collapse-header {
|
|
167
|
+
padding: var(--nuraly-spacing-collapse-large-padding);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
:host([size="large"]) .collapse-content-inner {
|
|
171
|
+
padding: var(--nuraly-spacing-collapse-large-content-padding);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* Variant Styles */
|
|
175
|
+
:host([variant="default"]) .collapse-container {
|
|
176
|
+
background-color: var(--nuraly-color-collapse-content-background);
|
|
177
|
+
border: 1px solid var(--nuraly-color-collapse-border);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:host([variant="bordered"]) .collapse-container {
|
|
181
|
+
background-color: var(--nuraly-color-collapse-bordered-background);
|
|
182
|
+
border: 2px solid var(--nuraly-color-collapse-bordered-border);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:host([variant="ghost"]) .collapse-container {
|
|
186
|
+
background-color: var(--nuraly-color-collapse-ghost-background);
|
|
187
|
+
border: 1px solid var(--nuraly-color-collapse-ghost-border);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
:host([variant="ghost"]) .collapse-header:hover {
|
|
191
|
+
background-color: var(--nuraly-color-collapse-ghost-hover);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* Accordion Mode */
|
|
195
|
+
:host([accordion]) .collapse-section {
|
|
196
|
+
border-bottom: 1px solid var(--nuraly-color-collapse-border);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* Shadow Variants */
|
|
200
|
+
:host(:not([variant="ghost"])) .collapse-container {
|
|
201
|
+
box-shadow: var(--nuraly-shadow-collapse);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
:host(:not([variant="ghost"])) .collapse-container:hover {
|
|
205
|
+
box-shadow: var(--nuraly-shadow-collapse-hover);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Accessibility */
|
|
209
|
+
@media (prefers-reduced-motion: reduce) {
|
|
210
|
+
.collapse-header,
|
|
211
|
+
.collapse-icon,
|
|
212
|
+
.collapse-content,
|
|
213
|
+
.collapse-section {
|
|
214
|
+
transition: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.collapse-icon--expanded {
|
|
218
|
+
transform: none;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* High Contrast Mode */
|
|
223
|
+
@media (prefers-contrast: high) {
|
|
224
|
+
.collapse-header {
|
|
225
|
+
border: 2px solid var(--nuraly-color-collapse-border-focus);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.collapse-header:focus-visible {
|
|
229
|
+
outline: 3px solid var(--nuraly-color-collapse-focus-outline);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
`;
|
|
233
|
+
// Export the styles for the collapse component
|
|
234
|
+
//# sourceMappingURL=collapse.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapse.style.js","sourceRoot":"","sources":["../../../src/components/collapse/collapse.style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6NxB,CAAC;AAEF,+CAA+C","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { css } from 'lit';\n\n/**\n * Collapse component styles using theme variables\n * Follows NuralyUI architecture with clean CSS variable usage\n */\nexport const styles = css`\n :host {\n display: block;\n width: 100%;\n \n /* Force CSS custom property inheritance to ensure theme switching works properly */\n color: var(--nuraly-color-text);\n background-color: var(--nuraly-color-background);\n }\n\n /* Force re-evaluation of theme-dependent properties on theme change */\n :host([data-theme]) {\n color: inherit;\n background-color: inherit;\n }\n\n .collapse-container {\n display: flex;\n flex-direction: column;\n gap: var(--nuraly-spacing-collapse-gap);\n border: var(--nuraly-color-collapse-border);\n border-radius: var(--nuraly-border-radius-collapse);\n background-color: var(--nuraly-color-collapse-bordered-background);\n overflow: hidden;\n }\n\n .collapse-section {\n position: relative;\n border-bottom: 1px solid var(--nuraly-color-collapse-border);\n transition: var(--nuraly-transition-collapse);\n }\n\n .collapse-section:last-child {\n border-bottom: none;\n }\n\n .collapse-section--disabled {\n opacity: var(--nuraly-opacity-collapse-disabled);\n pointer-events: none;\n }\n\n .collapse-section--non-collapsible .collapse-header {\n cursor: default;\n }\n\n .collapse-section--animating .collapse-content {\n overflow: hidden;\n }\n\n /* Header Styles */\n .collapse-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: var(--nuraly-spacing-collapse-padding);\n background-color: var(--nuraly-color-collapse-header-background);\n color: var(--nuraly-color-collapse-header-text);\n font-weight: var(--nuraly-font-collapse-header-weight);\n font-size: var(--nuraly-font-collapse-header-size);\n line-height: var(--nuraly-font-collapse-header-line-height);\n border: none;\n cursor: pointer;\n user-select: none;\n transition: var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);\n border-radius: var(--nuraly-border-radius-collapse-header);\n }\n\n .collapse-header--clickable:hover {\n background-color: var(--nuraly-color-collapse-header-background-hover);\n }\n\n .collapse-header--clickable:active {\n background-color: var(--nuraly-color-collapse-header-background-active);\n }\n\n .collapse-header--expanded {\n background-color: var(--nuraly-color-collapse-header-background-expanded);\n }\n\n .collapse-header--disabled {\n color: var(--nuraly-color-collapse-header-text-disabled);\n cursor: not-allowed;\n }\n\n .collapse-header:focus-visible {\n outline: 2px solid var(--nuraly-color-collapse-focus-outline);\n outline-offset: 2px;\n box-shadow: var(--nuraly-shadow-collapse-focus);\n }\n\n .collapse-header-text {\n flex: 1;\n text-align: left;\n }\n\n .collapse-header-right {\n display: flex;\n align-items: center;\n gap: var(--nuraly-spacing-collapse-header-right-gap, 0.5rem);\n margin-left: var(--nuraly-spacing-collapse-header-right-margin, 0.75rem);\n color: var(--nuraly-color-collapse-header-right-text, inherit);\n }\n\n .collapse-header-right > * {\n flex-shrink: 0;\n }\n\n /* Icon Styles */\n .collapse-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--nuraly-collapse-icon-size);\n height: var(--nuraly-collapse-icon-size);\n color: var(--nuraly-color-collapse-icon);\n transition: var(--nuraly-collapse-icon-transition);\n transform-origin: center;\n }\n\n .collapse-header--disabled .collapse-icon {\n color: var(--nuraly-color-collapse-icon-disabled);\n }\n\n /* Content Styles */\n .collapse-content {\n background-color: var(--nuraly-color-collapse-content-background);\n border-radius: var(--nuraly-border-radius-collapse-content);\n transition: var(--nuraly-collapse-transition-duration) var(--nuraly-collapse-transition-easing);\n }\n\n .collapse-content-inner {\n padding: var(--nuraly-spacing-collapse-content-padding);\n color: var(--nuraly-color-collapse-content-text);\n font-weight: var(--nuraly-font-collapse-content-weight);\n font-size: var(--nuraly-font-collapse-content-size);\n line-height: var(--nuraly-font-collapse-content-line-height);\n }\n\n /* Size Variants */\n :host([size=\"small\"]) .collapse-header {\n padding: var(--nuraly-spacing-collapse-small-padding);\n }\n\n :host([size=\"small\"]) .collapse-content-inner {\n padding: var(--nuraly-spacing-collapse-small-content-padding);\n }\n\n :host([size=\"medium\"]) .collapse-header {\n padding: var(--nuraly-spacing-collapse-medium-padding);\n }\n\n :host([size=\"medium\"]) .collapse-content-inner {\n padding: var(--nuraly-spacing-collapse-medium-content-padding);\n }\n\n :host([size=\"large\"]) .collapse-header {\n padding: var(--nuraly-spacing-collapse-large-padding);\n }\n\n :host([size=\"large\"]) .collapse-content-inner {\n padding: var(--nuraly-spacing-collapse-large-content-padding);\n }\n\n /* Variant Styles */\n :host([variant=\"default\"]) .collapse-container {\n background-color: var(--nuraly-color-collapse-content-background);\n border: 1px solid var(--nuraly-color-collapse-border);\n }\n\n :host([variant=\"bordered\"]) .collapse-container {\n background-color: var(--nuraly-color-collapse-bordered-background);\n border: 2px solid var(--nuraly-color-collapse-bordered-border);\n }\n\n :host([variant=\"ghost\"]) .collapse-container {\n background-color: var(--nuraly-color-collapse-ghost-background);\n border: 1px solid var(--nuraly-color-collapse-ghost-border);\n }\n\n :host([variant=\"ghost\"]) .collapse-header:hover {\n background-color: var(--nuraly-color-collapse-ghost-hover);\n }\n\n /* Accordion Mode */\n :host([accordion]) .collapse-section {\n border-bottom: 1px solid var(--nuraly-color-collapse-border);\n }\n\n /* Shadow Variants */\n :host(:not([variant=\"ghost\"])) .collapse-container {\n box-shadow: var(--nuraly-shadow-collapse);\n }\n\n :host(:not([variant=\"ghost\"])) .collapse-container:hover {\n box-shadow: var(--nuraly-shadow-collapse-hover);\n }\n\n /* Accessibility */\n @media (prefers-reduced-motion: reduce) {\n .collapse-header,\n .collapse-icon,\n .collapse-content,\n .collapse-section {\n transition: none;\n }\n \n .collapse-icon--expanded {\n transform: none;\n }\n }\n\n /* High Contrast Mode */\n @media (prefers-contrast: high) {\n .collapse-header {\n border: 2px solid var(--nuraly-color-collapse-border-focus);\n }\n \n .collapse-header:focus-visible {\n outline: 3px solid var(--nuraly-color-collapse-focus-outline);\n }\n }\n`;\n\n// Export the styles for the collapse component\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { TemplateResult } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* Collapse component types and enums following NuralyUI architecture patterns
|
|
9
|
+
*/
|
|
10
|
+
export declare const EMPTY_STRING = "";
|
|
11
|
+
export declare const enum CollapseSize {
|
|
12
|
+
Small = "small",
|
|
13
|
+
Medium = "medium",
|
|
14
|
+
Large = "large"
|
|
15
|
+
}
|
|
16
|
+
export declare const enum CollapseVariant {
|
|
17
|
+
Default = "default",
|
|
18
|
+
Bordered = "bordered",
|
|
19
|
+
Ghost = "ghost"
|
|
20
|
+
}
|
|
21
|
+
export declare const enum CollapseAnimation {
|
|
22
|
+
None = "none",
|
|
23
|
+
Slide = "slide",
|
|
24
|
+
Fade = "fade"
|
|
25
|
+
}
|
|
26
|
+
export interface CollapseSection {
|
|
27
|
+
/** Unique identifier for the section */
|
|
28
|
+
id?: string;
|
|
29
|
+
/** Header content (text, HTML string, or TemplateResult) */
|
|
30
|
+
header: string | TemplateResult;
|
|
31
|
+
/** Content to display when expanded - supports plain text, HTML string, or TemplateResult */
|
|
32
|
+
content: string | TemplateResult;
|
|
33
|
+
/** Optional slot name for header content (alternative to header property) */
|
|
34
|
+
headerSlot?: string;
|
|
35
|
+
/** Optional slot name for content (alternative to content property) */
|
|
36
|
+
contentSlot?: string;
|
|
37
|
+
/** Optional content for the right side of the header (icons, menu, badges, etc.) */
|
|
38
|
+
headerRight?: string | TemplateResult;
|
|
39
|
+
/** Optional slot name for header right content (alternative to headerRight property) */
|
|
40
|
+
headerRightSlot?: string;
|
|
41
|
+
/** Whether the section is initially open */
|
|
42
|
+
open?: boolean;
|
|
43
|
+
/** Whether the section can be collapsed/expanded */
|
|
44
|
+
collapsible?: boolean;
|
|
45
|
+
/** Whether this section is disabled */
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
/** Custom CSS classes for the section */
|
|
48
|
+
className?: string;
|
|
49
|
+
/** Header icon configuration */
|
|
50
|
+
headerIcon?: string;
|
|
51
|
+
/** Custom expand/collapse icons */
|
|
52
|
+
expandIcon?: string;
|
|
53
|
+
collapseIcon?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface CollapseAccordionConfig {
|
|
56
|
+
/** Whether to allow multiple sections open at once */
|
|
57
|
+
allowMultiple?: boolean;
|
|
58
|
+
/** Whether to collapse others when one is opened */
|
|
59
|
+
collapsible?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface CollapseSectionToggleEvent {
|
|
62
|
+
/** Index of the toggled section */
|
|
63
|
+
index: number;
|
|
64
|
+
/** Section data */
|
|
65
|
+
section: CollapseSection;
|
|
66
|
+
/** Whether the section is now open */
|
|
67
|
+
isOpen: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface CollapseBeforeToggleEvent {
|
|
70
|
+
/** Index of the section about to be toggled */
|
|
71
|
+
index: number;
|
|
72
|
+
/** Section data */
|
|
73
|
+
section: CollapseSection;
|
|
74
|
+
/** Current open state */
|
|
75
|
+
isOpen: boolean;
|
|
76
|
+
/** Function to prevent the toggle */
|
|
77
|
+
preventDefault: () => void;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=collapse.type.d.ts.map
|
package/collapse.type.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Collapse component types and enums following NuralyUI architecture patterns
|
|
8
|
+
*/
|
|
9
|
+
// Constants
|
|
10
|
+
export const EMPTY_STRING = '';
|
|
11
|
+
//# sourceMappingURL=collapse.type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collapse.type.js","sourceRoot":"","sources":["../../../src/components/collapse/collapse.type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AAEH,YAAY;AACZ,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { TemplateResult } from 'lit';\n\n/**\n * Collapse component types and enums following NuralyUI architecture patterns\n */\n\n// Constants\nexport const EMPTY_STRING = '';\n\n// Enum for collapse sizes\nexport const enum CollapseSize {\n Small = 'small',\n Medium = 'medium',\n Large = 'large'\n}\n\n// Enum for collapse variant types\nexport const enum CollapseVariant {\n Default = 'default',\n Bordered = 'bordered',\n Ghost = 'ghost'\n}\n\n// Enum for animation types\nexport const enum CollapseAnimation {\n None = 'none',\n Slide = 'slide',\n Fade = 'fade'\n}\n\n// Enhanced section interface\nexport interface CollapseSection {\n /** Unique identifier for the section */\n id?: string;\n /** Header content (text, HTML string, or TemplateResult) */\n header: string | TemplateResult;\n /** Content to display when expanded - supports plain text, HTML string, or TemplateResult */\n content: string | TemplateResult;\n /** Optional slot name for header content (alternative to header property) */\n headerSlot?: string;\n /** Optional slot name for content (alternative to content property) */\n contentSlot?: string;\n /** Optional content for the right side of the header (icons, menu, badges, etc.) */\n headerRight?: string | TemplateResult;\n /** Optional slot name for header right content (alternative to headerRight property) */\n headerRightSlot?: string;\n /** Whether the section is initially open */\n open?: boolean;\n /** Whether the section can be collapsed/expanded */\n collapsible?: boolean;\n /** Whether this section is disabled */\n disabled?: boolean;\n /** Custom CSS classes for the section */\n className?: string;\n /** Header icon configuration */\n headerIcon?: string;\n /** Custom expand/collapse icons */\n expandIcon?: string;\n collapseIcon?: string;\n}\n\n// Configuration for accordion behavior\nexport interface CollapseAccordionConfig {\n /** Whether to allow multiple sections open at once */\n allowMultiple?: boolean;\n /** Whether to collapse others when one is opened */\n collapsible?: boolean;\n}\n\n// Event detail interfaces\nexport interface CollapseSectionToggleEvent {\n /** Index of the toggled section */\n index: number;\n /** Section data */\n section: CollapseSection;\n /** Whether the section is now open */\n isOpen: boolean;\n}\n\nexport interface CollapseBeforeToggleEvent {\n /** Index of the section about to be toggled */\n index: number;\n /** Section data */\n section: CollapseSection;\n /** Current open state */\n isOpen: boolean;\n /** Function to prevent the toggle */\n preventDefault: () => void;\n}\n"]}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './collapse.component.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './collapse.component.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/collapse/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/collapse/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from './collapse.component.js';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuralyui/collapse",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,5 +8,19 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
9
|
},
|
|
10
10
|
"author": "Labidi Aymen",
|
|
11
|
-
"license": "ISC"
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"./bundle": {
|
|
17
|
+
"import": "./bundle.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"bundle.js",
|
|
22
|
+
"*.js",
|
|
23
|
+
"*.d.ts",
|
|
24
|
+
"*.js.map"
|
|
25
|
+
]
|
|
12
26
|
}
|
package/react.d.ts
CHANGED
package/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createComponent } from '@lit-labs/react';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { HyCollapse } from './
|
|
3
|
+
import { HyCollapse } from './collapse.component.js';
|
|
4
4
|
export const HyCollapseComponent = createComponent({
|
|
5
|
-
tagName: '
|
|
5
|
+
tagName: 'nr-collapse',
|
|
6
6
|
elementClass: HyCollapse,
|
|
7
7
|
react: React,
|
|
8
8
|
events: {
|
package/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/collapse/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../src/components/collapse/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;IACjD,OAAO,EAAE,aAAa;IACtB,YAAY,EAAE,UAAU;IACxB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;CACF,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit-labs/react';\nimport * as React from 'react';\nimport { HyCollapse } from './collapse.component.js';\n\nexport const HyCollapseComponent = createComponent({\n tagName: 'nr-collapse',\n elementClass: HyCollapse,\n react: React,\n events: {\n toggle: 'toggle',\n change: 'change',\n },\n});\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import '../hy-collapse.component';
|
|
3
|
-
import '../../icon/icon.component';
|
|
4
|
-
import '../../select/demo/select-demo';
|
|
5
|
-
export declare class HyCollapseDemo extends LitElement {
|
|
6
|
-
render(): import("lit").TemplateResult<1>;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=hy-collapse-demo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-collapse-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/collapse/demo/hy-collapse-demo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAErC,OAAO,0BAA0B,CAAC;AAClC,OAAO,2BAA2B,CAAC;AACnC,OAAO,+BAA+B,CAAC;AACvC,qBACa,cAAe,SAAQ,UAAU;IACnC,MAAM;CAqChB"}
|
package/demo/hy-collapse-demo.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, html } from 'lit';
|
|
8
|
-
import { customElement } from 'lit/decorators.js';
|
|
9
|
-
import '../hy-collapse.component';
|
|
10
|
-
import '../../icon/icon.component';
|
|
11
|
-
import '../../select/demo/select-demo';
|
|
12
|
-
let HyCollapseDemo = class HyCollapseDemo extends LitElement {
|
|
13
|
-
render() {
|
|
14
|
-
return html `
|
|
15
|
-
Default size
|
|
16
|
-
<hy-collapse
|
|
17
|
-
.sections=${[
|
|
18
|
-
{
|
|
19
|
-
header: 'Section 1',
|
|
20
|
-
content: html ` <hy-select-demo></hy-select-demo> `,
|
|
21
|
-
open: false,
|
|
22
|
-
},
|
|
23
|
-
{ header: 'Section 2', content: 'Content for section 2', open: true, collapsible: false },
|
|
24
|
-
{ header: 'Section 3', content: 'Content for section 3', open: false },
|
|
25
|
-
{ header: 'Section 4', content: 'Content for section 4', open: true, collapsible: true },
|
|
26
|
-
]}
|
|
27
|
-
></hy-collapse>
|
|
28
|
-
|
|
29
|
-
Small size
|
|
30
|
-
<hy-collapse
|
|
31
|
-
.size=${'small'}
|
|
32
|
-
.sections=${[
|
|
33
|
-
{ header: 'Section 2', content: 'Content for section 2', open: true, collapsible: false },
|
|
34
|
-
{ header: 'Section 3', content: 'Content for section 3', open: false },
|
|
35
|
-
{ header: 'Section 4', content: 'Content for section 4', open: true, collapsible: true },
|
|
36
|
-
]}
|
|
37
|
-
></hy-collapse>
|
|
38
|
-
|
|
39
|
-
Large size
|
|
40
|
-
<hy-collapse
|
|
41
|
-
.size=${'large'}
|
|
42
|
-
.sections=${[
|
|
43
|
-
{ header: 'Section 2', content: 'Content for section 2', open: true, collapsible: false },
|
|
44
|
-
{ header: 'Section 3', content: 'Content for section 3', open: false },
|
|
45
|
-
{ header: 'Section 4', content: 'Content for section 4', collapsible: true },
|
|
46
|
-
]}
|
|
47
|
-
></hy-collapse>
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
HyCollapseDemo = __decorate([
|
|
52
|
-
customElement('hy-collapse-demo')
|
|
53
|
-
], HyCollapseDemo);
|
|
54
|
-
export { HyCollapseDemo };
|
|
55
|
-
//# sourceMappingURL=hy-collapse-demo.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-collapse-demo.js","sourceRoot":"","sources":["../../../../src/components/collapse/demo/hy-collapse-demo.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,0BAA0B,CAAC;AAClC,OAAO,2BAA2B,CAAC;AACnC,OAAO,+BAA+B,CAAC;AAEvC,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IACnC,MAAM;QACb,OAAO,IAAI,CAAA;;;oBAGK;YACV;gBACE,MAAM,EAAE,WAAW;gBACnB,OAAO,EAAE,IAAI,CAAA,qCAAqC;gBAClD,IAAI,EAAE,KAAK;aACZ;YACD,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAC;YACvF,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,KAAK,EAAC;YACpE,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAC;SACvF;;;;;gBAKO,OAAO;oBACH;YACV,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAC;YACvF,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,KAAK,EAAC;YACpE,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAC;SACvF;;;;;gBAKO,OAAO;oBACH;YACV,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAC;YACvF,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,IAAI,EAAE,KAAK,EAAC;YACpE,EAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,IAAI,EAAC;SAC3E;;KAEJ,CAAC;IACJ,CAAC;CACF,CAAA;AAtCY,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAsC1B;SAtCY,cAAc","sourcesContent":["import {LitElement, html} from 'lit';\nimport {customElement} from 'lit/decorators.js';\nimport '../hy-collapse.component';\nimport '../../icon/icon.component';\nimport '../../select/demo/select-demo';\n@customElement('hy-collapse-demo')\nexport class HyCollapseDemo extends LitElement {\n override render() {\n return html`\n Default size\n <hy-collapse\n .sections=${[\n {\n header: 'Section 1',\n content: html` <hy-select-demo></hy-select-demo> `,\n open: false,\n },\n {header: 'Section 2', content: 'Content for section 2', open: true, collapsible: false},\n {header: 'Section 3', content: 'Content for section 3', open: false},\n {header: 'Section 4', content: 'Content for section 4', open: true, collapsible: true},\n ]}\n ></hy-collapse>\n\n Small size\n <hy-collapse\n .size=${'small'}\n .sections=${[\n {header: 'Section 2', content: 'Content for section 2', open: true, collapsible: false},\n {header: 'Section 3', content: 'Content for section 3', open: false},\n {header: 'Section 4', content: 'Content for section 4', open: true, collapsible: true},\n ]}\n ></hy-collapse>\n\n Large size\n <hy-collapse\n .size=${'large'}\n .sections=${[\n {header: 'Section 2', content: 'Content for section 2', open: true, collapsible: false},\n {header: 'Section 3', content: 'Content for section 3', open: false},\n {header: 'Section 4', content: 'Content for section 4', collapsible: true},\n ]}\n ></hy-collapse>\n `;\n }\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
|
-
import { CollapseSize, ISection } from './hy-collapse.type.js';
|
|
3
|
-
export declare class HyCollapse extends LitElement {
|
|
4
|
-
static styles: import("lit").CSSResult;
|
|
5
|
-
sections: ISection[];
|
|
6
|
-
size: CollapseSize;
|
|
7
|
-
toggleSection(index: number): void;
|
|
8
|
-
render(): import("lit").TemplateResult<1>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=hy-collapse.component.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-collapse.component.d.ts","sourceRoot":"","sources":["../../../src/components/collapse/hy-collapse.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAO,MAAM,KAAK,CAAC;AAGrC,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,uBAAuB,CAAC;AAI7D,qBACa,UAAW,SAAQ,UAAU;IACxC,OAAgB,MAAM,0BAAU;IAEP,QAAQ,EAAE,QAAQ,EAAE,CAAM;IACvC,IAAI,eAAwB;IAExC,aAAa,CAAC,KAAK,EAAE,MAAM;IAQlB,MAAM;CAqChB"}
|
package/hy-collapse.component.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { LitElement, html } from 'lit';
|
|
8
|
-
import { styles } from './hy-collapse.style.js';
|
|
9
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
-
import { map } from 'lit/directives/map.js';
|
|
11
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
12
|
-
let HyCollapse = class HyCollapse extends LitElement {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.sections = [];
|
|
16
|
-
this.size = "default" /* CollapseSize.Default */;
|
|
17
|
-
}
|
|
18
|
-
toggleSection(index) {
|
|
19
|
-
const section = this.sections[index];
|
|
20
|
-
if (section.collapsible != false) {
|
|
21
|
-
this.sections = this.sections.map((section, i) => (i === index ? Object.assign(Object.assign({}, section), { open: !section.open }) : section));
|
|
22
|
-
}
|
|
23
|
-
this.dispatchEvent(new CustomEvent('section-toggled', { detail: { index } }));
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
return html `
|
|
27
|
-
${map(this.sections, (section, index) => html `
|
|
28
|
-
<div
|
|
29
|
-
class="
|
|
30
|
-
collapse-section
|
|
31
|
-
${classMap({
|
|
32
|
-
'collapse-small': this.size == "small" /* CollapseSize.Small */,
|
|
33
|
-
'collapse-large': this.size == "large" /* CollapseSize.Large */,
|
|
34
|
-
})}
|
|
35
|
-
"
|
|
36
|
-
>
|
|
37
|
-
<hy-label
|
|
38
|
-
class="
|
|
39
|
-
header
|
|
40
|
-
${classMap({
|
|
41
|
-
'disabled-header': section.collapsible == false,
|
|
42
|
-
'collapsed-header': section.open == true,
|
|
43
|
-
'fold-header': section.open != true
|
|
44
|
-
})}
|
|
45
|
-
"
|
|
46
|
-
@mousedown="${() => this.toggleSection(index)}"
|
|
47
|
-
>
|
|
48
|
-
${html `<hy-icon
|
|
49
|
-
class="collapse-icon"
|
|
50
|
-
name="${section.open && section.collapsible != false ? 'chevron-down' : 'chevron-right'}"
|
|
51
|
-
></hy-icon>`}
|
|
52
|
-
${section.header}
|
|
53
|
-
</hy-label>
|
|
54
|
-
${section.open && section.collapsible != false ? html `<div class="content">${section.content}</div>` : ''}
|
|
55
|
-
</div>
|
|
56
|
-
`)}
|
|
57
|
-
`;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
HyCollapse.styles = styles;
|
|
61
|
-
__decorate([
|
|
62
|
-
property({ type: Array })
|
|
63
|
-
], HyCollapse.prototype, "sections", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
property()
|
|
66
|
-
], HyCollapse.prototype, "size", void 0);
|
|
67
|
-
HyCollapse = __decorate([
|
|
68
|
-
customElement('hy-collapse')
|
|
69
|
-
], HyCollapse);
|
|
70
|
-
export { HyCollapse };
|
|
71
|
-
//# sourceMappingURL=hy-collapse.component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-collapse.component.js","sourceRoot":"","sources":["../../../src/components/collapse/hy-collapse.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAC,MAAM,KAAK,CAAC;AACrC,OAAO,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAAC,GAAG,EAAC,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AAGrD,IAAa,UAAU,GAAvB,MAAa,UAAW,SAAQ,UAAU;IAA1C;;QAG2B,aAAQ,GAAe,EAAE,CAAC;QACvC,SAAI,wCAAwB;IA+C1C,CAAC;IA7CC,aAAa,CAAC,KAAa;QACzB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,EAAE;YAChC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,iCAAK,OAAO,KAAE,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,IAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;SAChH;QACD,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,iBAAiB,EAAE,EAAC,MAAM,EAAE,EAAC,KAAK,EAAC,EAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA;QACP,GAAG,CACH,IAAI,CAAC,QAAQ,EACb,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAA;;;;YAIpB,QAAQ,CAAC;YACP,gBAAgB,EAAE,IAAI,CAAC,IAAI,oCAAsB;YACjD,gBAAgB,EAAE,IAAI,CAAC,IAAI,oCAAsB;SAClD,CAAC;;;;;;gBAME,QAAQ,CAAC;YACT,iBAAiB,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;YAC/C,kBAAkB,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;YACxC,aAAa,EAAE,OAAO,CAAC,IAAI,IAAI,IAAI;SACpC,CAAC;;4BAEY,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;;gBAE3C,IAAI,CAAA;;wBAEI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe;0BAC7E;gBACV,OAAO,CAAC,MAAM;;cAEhB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,wBAAwB,OAAO,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE;;SAE5G,CACF;KACF,CAAC;IACJ,CAAC;CACF,CAAA;AAlDiB,iBAAM,GAAG,MAAO,CAAA;AAEP;IAAxB,QAAQ,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;4CAA2B;AACvC;IAAX,QAAQ,EAAE;wCAA6B;AAJ7B,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAmDtB;SAnDY,UAAU","sourcesContent":["import {LitElement, html} from 'lit';\nimport {styles} from './hy-collapse.style.js';\nimport {customElement, property} from 'lit/decorators.js';\nimport {CollapseSize, ISection} from './hy-collapse.type.js';\nimport {map} from 'lit/directives/map.js';\nimport {classMap} from 'lit/directives/class-map.js';\n\n@customElement('hy-collapse')\nexport class HyCollapse extends LitElement {\n static override styles = styles;\n\n @property({type: Array}) sections: ISection[] = [];\n @property() size = CollapseSize.Default;\n\n toggleSection(index: number) {\n const section = this.sections[index];\n if (section.collapsible != false) {\n this.sections = this.sections.map((section, i) => (i === index ? {...section, open: !section.open} : section));\n }\n this.dispatchEvent(new CustomEvent('section-toggled', {detail: {index}}));\n }\n\n override render() {\n return html`\n ${map(\n this.sections,\n (section, index) => html`\n <div\n class=\"\n collapse-section\n ${classMap({\n 'collapse-small': this.size == CollapseSize.Small,\n 'collapse-large': this.size == CollapseSize.Large,\n })}\n \"\n >\n <hy-label\n class=\"\n header\n ${classMap({\n 'disabled-header': section.collapsible == false,\n 'collapsed-header': section.open == true,\n 'fold-header': section.open != true\n })}\n \"\n @mousedown=\"${() => this.toggleSection(index)}\"\n >\n ${html`<hy-icon\n class=\"collapse-icon\"\n name=\"${section.open && section.collapsible != false ? 'chevron-down' : 'chevron-right'}\"\n ></hy-icon>`}\n ${section.header}\n </hy-label>\n ${section.open && section.collapsible != false ? html`<div class=\"content\">${section.content}</div>` : ''}\n </div>\n `\n )}\n `;\n }\n}\n"]}
|
package/hy-collapse.style.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hy-collapse.style.d.ts","sourceRoot":"","sources":["../../../src/components/collapse/hy-collapse.style.ts"],"names":[],"mappings":"AAwHA,eAAO,MAAM,MAAM,yBAAiB,CAAC"}
|