kemet-ui 0.2.0 → 1.0.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/custom-elements.json +5546 -855
- package/dist/components/kemet-accordion-panel.js +178 -0
- package/dist/components/kemet-accordion.js +105 -72
- package/dist/components/kemet-badge.js +102 -0
- package/dist/components/kemet-button.js +230 -0
- package/dist/components/kemet-checkbox.js +298 -0
- package/dist/components/kemet-combo.js +207 -0
- package/dist/components/kemet-count.js +112 -0
- package/dist/components/kemet-draggable.js +19 -6
- package/dist/components/kemet-drawer.js +38 -15
- package/dist/components/kemet-drawer.styles.js +6 -0
- package/dist/components/kemet-field.js +233 -0
- package/dist/components/kemet-flipcard-trigger.js +4 -5
- package/dist/components/kemet-flipcard.js +26 -3
- package/dist/components/kemet-icon.js +19 -3
- package/dist/components/kemet-input.js +650 -0
- package/dist/components/kemet-modal-close.js +23 -4
- package/dist/components/kemet-modal.js +78 -13
- package/dist/components/kemet-modal.styles.js +14 -2
- package/dist/components/kemet-option.js +45 -0
- package/dist/components/kemet-popover-close.js +1 -1
- package/dist/components/kemet-popover.js +75 -12
- package/dist/components/kemet-radio.js +214 -0
- package/dist/components/kemet-radios.js +218 -0
- package/dist/components/kemet-rotator.js +23 -4
- package/dist/components/kemet-scroll-link.js +21 -2
- package/dist/components/kemet-scroll-nav.js +25 -2
- package/dist/components/kemet-scroll-snap-paginator.js +68 -26
- package/dist/components/kemet-scroll-snap-slide.js +23 -13
- package/dist/components/kemet-scroll-snap.js +31 -16
- package/dist/components/kemet-select.js +365 -0
- package/dist/components/kemet-svg.js +18 -2
- package/dist/components/kemet-svgs.js +7 -3
- package/dist/components/kemet-tab-panel.js +15 -1
- package/dist/components/kemet-tab.js +48 -1
- package/dist/components/kemet-tabs.js +289 -83
- package/dist/components/kemet-tabs.styles.js +200 -0
- package/dist/components/kemet-textarea.js +395 -0
- package/dist/components/kemet-toggle.js +225 -0
- package/dist/kemet-components.cjs +5128 -1200
- package/dist/kemet-components.js +5117 -1173
- package/dist/kemet-components.min.js +1536 -421
- package/dist/styles/kemet.components.css +12 -260
- package/dist/styles/kemet.components.css.map +1 -1
- package/dist/styles/kemet.core.css +2371 -503
- package/dist/styles/kemet.core.css.map +1 -1
- package/dist/styles/scss/components/_config.scss +0 -25
- package/dist/styles/scss/components/accordion.scss +4 -53
- package/dist/styles/scss/components/modal.scss +5 -9
- package/dist/styles/scss/components/scrollsnap.scss +0 -57
- package/dist/styles/scss/core/_config.scss +160 -3
- package/dist/styles/scss/core/_helpers.scss +109 -2
- package/dist/styles/scss/core/attributes.scss +16 -0
- package/dist/styles/scss/core/base.scss +38 -0
- package/dist/styles/scss/core/layout.scss +6 -5
- package/dist/styles/scss/kemet.components.scss +0 -2
- package/dist/styles/scss/kemet.core.scss +1 -2
- package/package.json +34 -56
- package/dist/components/kemet-carousel-link.js +0 -54
- package/dist/components/kemet-carousel-next.js +0 -46
- package/dist/components/kemet-carousel-prev.js +0 -46
- package/dist/components/kemet-carousel-slide.js +0 -83
- package/dist/components/kemet-carousel.js +0 -236
- package/dist/components/kemet-ratio.js +0 -61
- package/dist/styles/scss/components/flipcard.scss +0 -14
- package/dist/styles/scss/components/tabs.scss +0 -73
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { html, css, LitElement } from 'lit';
|
|
2
|
-
|
|
3
|
-
export class KemetCarousel extends LitElement {
|
|
4
|
-
static get styles() {
|
|
5
|
-
return css`
|
|
6
|
-
:host,
|
|
7
|
-
*,
|
|
8
|
-
*::before,
|
|
9
|
-
*::after {
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
:host {
|
|
14
|
-
position: relative;
|
|
15
|
-
display: block;
|
|
16
|
-
width: var(--kemet-carousel-width, 100%);
|
|
17
|
-
height: var(--kemet-carousel-height, 50vh);
|
|
18
|
-
overflow: visible;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
:host([hidden]) {
|
|
22
|
-
display: none;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
:host([pagination="top"]) {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
:host([pagination="left"]),
|
|
31
|
-
:host([pagination="right"]) {
|
|
32
|
-
display: flex;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.slides {
|
|
36
|
-
display: block;
|
|
37
|
-
position: relative;
|
|
38
|
-
top: 0;
|
|
39
|
-
left: 0;
|
|
40
|
-
z-index: 1;
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: 100%;
|
|
43
|
-
overflow: hidden;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
:host([pagination="top"]) .pagination,
|
|
47
|
-
:host([pagination="left"]) .pagination {
|
|
48
|
-
order: -1;
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static get properties() {
|
|
54
|
-
return {
|
|
55
|
-
index: {
|
|
56
|
-
type: Number,
|
|
57
|
-
reflect: true,
|
|
58
|
-
},
|
|
59
|
-
pagination: {
|
|
60
|
-
type: String,
|
|
61
|
-
reflect: true,
|
|
62
|
-
},
|
|
63
|
-
slideshow: {
|
|
64
|
-
type: Number,
|
|
65
|
-
},
|
|
66
|
-
useHash: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
attribute: 'use-hash',
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
constructor() {
|
|
74
|
-
super();
|
|
75
|
-
|
|
76
|
-
// managed properties
|
|
77
|
-
this.index = 0;
|
|
78
|
-
this.pagination = 'bottom';
|
|
79
|
-
this.slideshow = 0;
|
|
80
|
-
this.useHash = false;
|
|
81
|
-
|
|
82
|
-
// standard properties
|
|
83
|
-
this.slides = [];
|
|
84
|
-
this.links = [];
|
|
85
|
-
this.loaded = false;
|
|
86
|
-
|
|
87
|
-
// bindings
|
|
88
|
-
this.addEventListener('kemet-carousel-next', this.handleNext.bind(this));
|
|
89
|
-
this.addEventListener('kemet-carousel-prev', this.handlePrev.bind(this));
|
|
90
|
-
this.addEventListener('kemet-carousel-link', this.handleLink.bind(this));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
handleSlotChange() {
|
|
94
|
-
let elementIndex = 0;
|
|
95
|
-
const slides = this.querySelectorAll('kemet-carousel-slide');
|
|
96
|
-
const links = this.querySelectorAll('kemet-carousel-link');
|
|
97
|
-
|
|
98
|
-
links.forEach((link) => {
|
|
99
|
-
this.links.push(link);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// populate slide array
|
|
103
|
-
slides.forEach((slide) => {
|
|
104
|
-
slide.seen = this.index > elementIndex;
|
|
105
|
-
|
|
106
|
-
this.slides.push({
|
|
107
|
-
content: slide,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
elementIndex += 1;
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// fake firstUpdated because slotChange happens after it
|
|
114
|
-
if (!this.loaded) {
|
|
115
|
-
const hash = window.location.hash.replace('#', '');
|
|
116
|
-
const index = parseInt(hash, 10);
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
this.useHash // if the user is using hashes
|
|
120
|
-
&& Number.isInteger(index) // and index from hash is a number
|
|
121
|
-
&& index > -1 // and it's more than -1
|
|
122
|
-
&& index <= this.slides.length // but not more than the total number of slides
|
|
123
|
-
) {
|
|
124
|
-
this.index = hash;
|
|
125
|
-
} else {
|
|
126
|
-
this.index = 0;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
this.loaded = true;
|
|
130
|
-
this.updateIndex(this.index);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
updated() {
|
|
135
|
-
this.handleSlideShow();
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
render() {
|
|
139
|
-
return html`
|
|
140
|
-
<div class="slides" part="slides">
|
|
141
|
-
<slot name="slides" @slotchange="${this.handleSlotChange}"></slot>
|
|
142
|
-
</div>
|
|
143
|
-
|
|
144
|
-
<div class="pagination" part="pagination">
|
|
145
|
-
<slot name="pagination"></slot>
|
|
146
|
-
</div>
|
|
147
|
-
`;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
handleSlideShow() {
|
|
151
|
-
setTimeout(() => {
|
|
152
|
-
if (this.slideshow > 0) {
|
|
153
|
-
this.updateIndex(this.index + 1);
|
|
154
|
-
}
|
|
155
|
-
}, this.slideshow * 1000);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
handleNext() {
|
|
159
|
-
let newIndex = this.index + 1;
|
|
160
|
-
|
|
161
|
-
// reset to first slide
|
|
162
|
-
if (newIndex >= this.slides.length) newIndex = 0;
|
|
163
|
-
|
|
164
|
-
this.updateIndex(newIndex);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
handlePrev() {
|
|
168
|
-
let newIndex = this.index - 1;
|
|
169
|
-
|
|
170
|
-
// send them to the last slide
|
|
171
|
-
if (newIndex < 0) newIndex = this.slides.length - 1;
|
|
172
|
-
|
|
173
|
-
this.updateIndex(newIndex);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
updateIndex(newIndex) {
|
|
177
|
-
let currentSlide = this.slides[this.index];
|
|
178
|
-
let currentLink = this.links[newIndex];
|
|
179
|
-
|
|
180
|
-
// remove selected from all links
|
|
181
|
-
this.links.forEach((link) => {
|
|
182
|
-
link.selected = false;
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
// if current link is invalid assume it's the first link
|
|
186
|
-
if (!currentLink) {
|
|
187
|
-
[currentLink] = this.links;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// add selected to current link
|
|
191
|
-
if (currentLink) {
|
|
192
|
-
currentLink.selected = true;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
currentSlide.content.addEventListener('transitionend', this.handleTransitionEnd);
|
|
196
|
-
currentSlide.content.setAttribute('aria-hidden', 'true');
|
|
197
|
-
|
|
198
|
-
// correct for wrong index entered by users
|
|
199
|
-
if (newIndex > -1 && newIndex < this.slides.length) {
|
|
200
|
-
this.index = newIndex;
|
|
201
|
-
} else {
|
|
202
|
-
this.index = 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// update new slide
|
|
206
|
-
currentSlide = this.slides[this.index];
|
|
207
|
-
currentSlide.content.setAttribute('aria-hidden', 'false');
|
|
208
|
-
|
|
209
|
-
if (this.useHash) {
|
|
210
|
-
window.location.hash = `#${this.index}`;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// notify consumers of slide change
|
|
214
|
-
this.dispatchEvent(new CustomEvent('kemet-carousel-change-start', {
|
|
215
|
-
bubbles: true,
|
|
216
|
-
composed: true,
|
|
217
|
-
detail: this,
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
handleTransitionEnd(event) {
|
|
222
|
-
this.dispatchEvent(new CustomEvent('kemet-carousel-change-finished', {
|
|
223
|
-
bubbles: true,
|
|
224
|
-
composed: true,
|
|
225
|
-
detail: this.closest('kemet-carousel'),
|
|
226
|
-
}));
|
|
227
|
-
|
|
228
|
-
event.target.removeEventListener('transitionend', this.handleTransitionEnd);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
handleLink(event) {
|
|
232
|
-
this.updateIndex(event.detail.slide);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
window.customElements.define('kemet-carousel', KemetCarousel);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { html, css, LitElement } from 'lit';
|
|
2
|
-
|
|
3
|
-
export class KemetRatio extends LitElement {
|
|
4
|
-
static get styles() {
|
|
5
|
-
return css`
|
|
6
|
-
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
height: 0px;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
position: relative;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
#container {
|
|
14
|
-
position: absolute;
|
|
15
|
-
top: 0;
|
|
16
|
-
right: 0;
|
|
17
|
-
bottom: 0;
|
|
18
|
-
left: 0;
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static get properties() {
|
|
24
|
-
return {
|
|
25
|
-
aspectRatio: {
|
|
26
|
-
type: String,
|
|
27
|
-
reflect: true,
|
|
28
|
-
attribute: 'aspect-ratio',
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
super();
|
|
35
|
-
this.aspectRatio = '16:9';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
updated() {
|
|
39
|
-
this.setAspectRatio();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
render() {
|
|
43
|
-
return html`
|
|
44
|
-
<div id="container" part="container">
|
|
45
|
-
<slot @slotchange=${() => this.setAspectRatio()}></slot>
|
|
46
|
-
</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
setAspectRatio() {
|
|
51
|
-
// https://ratiobuddy.com
|
|
52
|
-
|
|
53
|
-
const getDimensions = this.aspectRatio.split(':');
|
|
54
|
-
const width = parseInt(getDimensions[0], 10);
|
|
55
|
-
const height = parseInt(getDimensions[1], 10);
|
|
56
|
-
|
|
57
|
-
this.style.paddingTop = width && height ? `${(height / width) * 100}%` : '56.25%';
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
window.customElements.define('kemet-ratio', KemetRatio);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
kemet-flipcard-trigger.full-image {
|
|
2
|
-
display: flex;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
kemet-flipcard-trigger.full-image img {
|
|
6
|
-
max-width: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
kemet-flipcard::part(front),
|
|
10
|
-
kemet-flipcard::part(back) {
|
|
11
|
-
border: 2px solid var(--kemet-color-primary);
|
|
12
|
-
border-radius: 1rem;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
@use 'config' as *;
|
|
2
|
-
|
|
3
|
-
kemet-tabs.horizontal [slot='links'] {
|
|
4
|
-
margin: 1rem 0;
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
justify-content: space-around;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@media screen and (min-width: 768px) {
|
|
11
|
-
kemet-tabs.horizontal [slot='links'] {
|
|
12
|
-
flex-direction: row;
|
|
13
|
-
border-bottom: 1px solid var(--kemet-color-primary);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
kemet-tabs.horizontal kemet-tab {
|
|
18
|
-
white-space: nowrap;
|
|
19
|
-
padding: 0.5rem 1rem;
|
|
20
|
-
border-left: 4px solid transparent;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@media screen and (min-width: 768px) {
|
|
24
|
-
kemet-tabs.horizontal kemet-tab {
|
|
25
|
-
padding: 1rem;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
kemet-tabs.horizontal kemet-tab[selected] {
|
|
30
|
-
border-left: 4px solid var(--kemet-color-primary);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@media screen and (min-width: 768px) {
|
|
34
|
-
kemet-tabs.horizontal kemet-tab[selected] {
|
|
35
|
-
border-left: 0;
|
|
36
|
-
border-bottom: 4px solid var(--kemet-color-primary);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
kemet-tabs.vertical {
|
|
42
|
-
display: flex;
|
|
43
|
-
flex-direction: column;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@media screen and (min-width: 768px) {
|
|
47
|
-
kemet-tabs.vertical {
|
|
48
|
-
flex-direction: row;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
kemet-tabs.vertical [slot='links'] {
|
|
53
|
-
display: flex;
|
|
54
|
-
flex-direction: column;
|
|
55
|
-
height: 100%;
|
|
56
|
-
justify-content: space-around;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@media screen and (min-width: 768px) {
|
|
60
|
-
kemet-tabs.vertical [slot='links'] {
|
|
61
|
-
min-width: 148px;
|
|
62
|
-
margin-right: 2rem;
|
|
63
|
-
border-right: 1px solid var(--kemet-color-primary);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
kemet-tabs.vertical kemet-tab {
|
|
68
|
-
padding: 1rem 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
kemet-tabs.vertical kemet-tab[selected] {
|
|
72
|
-
border-right: 4px solid var(--kemet-color-primary);
|
|
73
|
-
}
|