kemet-ui 1.3.0 → 1.4.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 +3125 -968
- package/dist/components/kemet-accordion/kemet-accordion-panel.js +29 -31
- package/dist/components/kemet-accordion/kemet-accordion.js +12 -6
- package/dist/components/kemet-alert/kemet-alert.js +106 -0
- package/dist/components/kemet-alert/styles.js +104 -0
- package/dist/components/kemet-avatar/kemet-avatar.js +118 -0
- package/dist/components/kemet-avatar/kemet-avatars.js +41 -0
- package/dist/components/kemet-badge/kemet-badge.js +16 -12
- package/dist/components/kemet-button/kemet-button.js +42 -25
- package/dist/components/kemet-card/kemet-card.js +69 -0
- package/dist/components/kemet-card/styles.js +63 -0
- package/dist/components/kemet-carousel/kemet-carousel-current.js +13 -3
- package/dist/components/kemet-carousel/kemet-carousel-first.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-last.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-link.js +23 -17
- package/dist/components/kemet-carousel/kemet-carousel-next.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-prev.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-slide.js +14 -11
- package/dist/components/kemet-carousel/kemet-carousel-total.js +13 -3
- package/dist/components/kemet-carousel/kemet-carousel.js +63 -133
- package/dist/components/kemet-carousel/styles.js +66 -0
- package/dist/components/kemet-checkbox/kemet-checkbox.js +28 -35
- package/dist/components/kemet-combo/kemet-combo.js +43 -28
- package/dist/components/kemet-count/kemet-count.js +29 -40
- package/dist/components/kemet-draggable/kemet-draggable.js +21 -23
- package/dist/components/kemet-drawer/kemet-drawer.js +36 -35
- package/dist/components/kemet-drawer/{kemet-drawer.styles.js → styles.js} +0 -0
- package/dist/components/kemet-fab/kemet-fab.js +39 -138
- package/dist/components/kemet-fab/styles.js +95 -0
- package/dist/components/kemet-field/kemet-field.js +31 -40
- package/dist/components/kemet-flipcard/kemet-flipcard-trigger.js +12 -5
- package/dist/components/kemet-flipcard/kemet-flipcard.js +24 -4
- package/dist/components/kemet-icon/kemet-icon.js +19 -15
- package/dist/components/kemet-input/kemet-input.js +81 -174
- package/dist/components/kemet-modal/kemet-modal-close.js +13 -8
- package/dist/components/kemet-modal/kemet-modal.js +26 -21
- package/dist/components/kemet-modal/{kemet-modal.styles.js → styles.js} +0 -0
- package/dist/components/kemet-password/kemet-password.js +40 -132
- package/dist/components/kemet-password/styles.js +80 -0
- package/dist/components/kemet-popover/kemet-popover-close.js +13 -7
- package/dist/components/kemet-popover/kemet-popover.js +42 -51
- package/dist/components/kemet-popover/{kemet-popover.effects.styles.js → styles.effects.js} +0 -0
- package/dist/components/kemet-popover/{kemet-popover.tooltip.styles.js → styles.tooltip.js} +0 -0
- package/dist/components/kemet-radio/kemet-radio.js +35 -43
- package/dist/components/kemet-radio/kemet-radios.js +25 -34
- package/dist/components/kemet-rotator/kemet-rotator.js +18 -18
- package/dist/components/kemet-scroll-link/kemet-scroll-link.js +15 -13
- package/dist/components/kemet-scroll-nav/kemet-scroll-nav.js +19 -10
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-paginator.js +25 -30
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-slide.js +16 -9
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap.js +27 -15
- package/dist/components/kemet-select/kemet-option.js +17 -12
- package/dist/components/kemet-select/kemet-select.js +62 -102
- package/dist/components/kemet-sortable/kemet-sortable-item.js +11 -5
- package/dist/components/kemet-sortable/kemet-sortable.js +16 -14
- package/dist/components/kemet-svgs/kemet-svg.js +17 -15
- package/dist/components/kemet-svgs/kemet-svgs.js +11 -3
- package/dist/components/kemet-tabs/kemet-tab-panel.js +14 -6
- package/dist/components/kemet-tabs/kemet-tab.js +22 -25
- package/dist/components/kemet-tabs/kemet-tabs.js +43 -41
- package/dist/components/kemet-tabs/{kemet-tabs.styles.js → styles.js} +0 -0
- package/dist/components/kemet-textarea/kemet-textarea.js +25 -54
- package/dist/components/kemet-toggle/kemet-toggle.js +39 -38
- package/dist/components/kemet-tracker/kemet-tracker-step.js +49 -160
- package/dist/components/kemet-tracker/kemet-tracker.js +12 -12
- package/dist/components/kemet-tracker/styles.js +111 -0
- package/dist/components/kemet-upload/kemet-upload-file.js +35 -44
- package/dist/components/kemet-upload/kemet-upload.js +53 -95
- package/dist/components/kemet-upload/{kemet-upload-file.loaders.styles.js → styles.js} +0 -0
- package/dist/kemet-components.cjs +2821 -2455
- package/dist/kemet-components.js +2822 -2444
- package/dist/kemet-components.min.js +912 -674
- package/dist/utilities/misc/events.js +5 -0
- package/package.json +13 -11
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { stylesBase } from './styles.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.4.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-card
|
|
9
|
+
* @summary A highly configurable panel design to display media and information.
|
|
10
|
+
*
|
|
11
|
+
* @prop {boolean} center - Centers the elements in the card.
|
|
12
|
+
*
|
|
13
|
+
* @slot default - The contents of the alert.
|
|
14
|
+
* @slot header - The cards's header.
|
|
15
|
+
* @slot media - A slot for images, videos, or embeds.
|
|
16
|
+
* @slot caption - Text for the media slot.
|
|
17
|
+
* @slot footer - The card's footer.
|
|
18
|
+
*
|
|
19
|
+
*
|
|
20
|
+
* @csspart media - The media area of the card.
|
|
21
|
+
* @csspart body - The main contents of the card.
|
|
22
|
+
*
|
|
23
|
+
* @cssproperty --kemet-card-padding - The space around elements. Default: 1rem.
|
|
24
|
+
* @cssproperty --kemet-card-border-color - The color of the borders. Default: var(--kemet-color-gray4).
|
|
25
|
+
* @cssproperty --kemet-card-color - The color of the text. Default: var(--kemet-color-black).
|
|
26
|
+
* @cssproperty --kemet-card-max-width - The max width of the card. Default: 360px.
|
|
27
|
+
* @cssproperty --kemet-card-border - The border around the card. Default: 1px solid var(--kemet-card-border-color).
|
|
28
|
+
* @cssproperty --kemet-card-border-radius - The border radius of the card. Default: 0.
|
|
29
|
+
* @cssproperty --kemet-card-background-color - The background color. Default: var(--kemet-color-white).
|
|
30
|
+
* @cssproperty --kemet-card-body-padding - The body spacing. Default: var(--kemet-card-padding).
|
|
31
|
+
* @cssproperty --kemet-card-header-padding - The header spacing. Default: var(--kemet-card-padding).
|
|
32
|
+
* @cssproperty --kemet-card-header-border-bottom - The header border. Default: 1px solid var(--kemet-card-border-color).
|
|
33
|
+
* @cssproperty --kemet-card-caption-color - The caption text color. Default: var(--kemet-color-white).
|
|
34
|
+
* @cssproperty --kemet-card-caption-padding - The caption spacing. Default: calc(var(--kemet-card-padding) / 2) var(--kemet-card-padding).
|
|
35
|
+
* @cssproperty --kemet-card-caption-background-color - The caption background color. Default: rgba(0,0,0,0.5).
|
|
36
|
+
* @cssproperty --kemet-card-footer-padding - The footer spacing. Default: var(--kemet-card-padding).
|
|
37
|
+
* @cssproperty --kemet-card-footer-border-top - The footer border. Default: 1px solid var(--kemet-card-border-color).
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
export default class KemetCard extends LitElement {
|
|
42
|
+
static get styles() {
|
|
43
|
+
return [stylesBase];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static get properties() {
|
|
47
|
+
return {
|
|
48
|
+
center: { type: Boolean, reflect: true },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
render() {
|
|
53
|
+
return html`
|
|
54
|
+
<slot name="header"></slot>
|
|
55
|
+
<div class="media" part="media">
|
|
56
|
+
<slot name="media"></slot>
|
|
57
|
+
<slot name="caption"></slot>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="body" part="body">
|
|
60
|
+
<slot></slot>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<slot name="footer"></slot>
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// eslint-disable-next-line no-unused-expressions
|
|
69
|
+
customElements.get('kemet-card') || customElements.define('kemet-card', KemetCard);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const stylesBase = css`
|
|
4
|
+
*,
|
|
5
|
+
*::before,
|
|
6
|
+
*::after {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
--kemet-card-padding: 1rem;
|
|
12
|
+
--kemet-card-border-color: var(--kemet-color-gray4);
|
|
13
|
+
|
|
14
|
+
color: var(--kemet-card-color, var(--kemet-color-black));
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
max-width: var(--kemet-card-max-width, 360px);
|
|
18
|
+
border: var(--kemet-card-border, 1px solid var(--kemet-card-border-color));
|
|
19
|
+
border-radius: var(--kemet-card-border-radius, 0);
|
|
20
|
+
background-color: var(--kemet-card-background-color, var(--kemet-color-white));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([center]) {
|
|
24
|
+
align-items: center;
|
|
25
|
+
text-align: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.body {
|
|
29
|
+
padding: var(--kemet-card-body-padding, var(--kemet-card-padding));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.media {
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::slotted(*) {
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
::slotted(img) {
|
|
41
|
+
display: flex;
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
::slotted([slot="header"]) {
|
|
46
|
+
padding: var(--kemet-card-header-padding, var(--kemet-card-padding));
|
|
47
|
+
border-bottom: var(--kemet-card-header-border-bottom, 1px solid var(--kemet-card-border-color));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
::slotted([slot="caption"]) {
|
|
51
|
+
color: var(--kemet-card-caption-color, var(--kemet-color-white));
|
|
52
|
+
position: absolute;
|
|
53
|
+
bottom: 0;
|
|
54
|
+
width: 100%;
|
|
55
|
+
padding: var(--kemet-card-caption-padding, calc(var(--kemet-card-padding) / 2) var(--kemet-card-padding));
|
|
56
|
+
background-color: var(--kemet-card-caption-background-color, rgba(0,0,0,0.35));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
::slotted([slot="footer"]) {
|
|
60
|
+
padding: var(--kemet-card-footer-padding, var(--kemet-card-padding));
|
|
61
|
+
border-top: var(--kemet-card-footer-border-top, 1px solid var(--kemet-card-border-color));
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-carousel-current
|
|
9
|
+
* @summary Displays the active slide number.
|
|
10
|
+
*
|
|
11
|
+
* @prop {number} current - The current slide number.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
3
15
|
export class KemetCarouselCurrent extends LitElement {
|
|
4
16
|
static get styles() {
|
|
5
17
|
return [
|
|
@@ -13,9 +25,7 @@ export class KemetCarouselCurrent extends LitElement {
|
|
|
13
25
|
|
|
14
26
|
static get properties() {
|
|
15
27
|
return {
|
|
16
|
-
current: {
|
|
17
|
-
type: Number,
|
|
18
|
-
},
|
|
28
|
+
current: { type: Number },
|
|
19
29
|
};
|
|
20
30
|
}
|
|
21
31
|
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @since 1.1.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-carousel-first
|
|
10
|
+
* @summary A link to the first slide in the carousel.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} disabled - Deactivates the button.
|
|
13
|
+
*
|
|
14
|
+
* @event kemet-carousel-first
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
2
17
|
|
|
3
18
|
export class KemetCarouselFirst extends LitElement {
|
|
4
19
|
static get styles() {
|
|
@@ -17,10 +32,7 @@ export class KemetCarouselFirst extends LitElement {
|
|
|
17
32
|
|
|
18
33
|
static get properties() {
|
|
19
34
|
return {
|
|
20
|
-
disabled: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
reflect: true,
|
|
23
|
-
},
|
|
35
|
+
disabled: { type: Boolean, reflect: true },
|
|
24
36
|
};
|
|
25
37
|
}
|
|
26
38
|
|
|
@@ -34,11 +46,7 @@ export class KemetCarouselFirst extends LitElement {
|
|
|
34
46
|
|
|
35
47
|
first() {
|
|
36
48
|
if (!this.disabled) {
|
|
37
|
-
this
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
detail: this,
|
|
41
|
-
}));
|
|
49
|
+
emitEvent(this, 'kemet-carousel-first', this);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @since 1.1.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-carousel-last
|
|
10
|
+
* @summary A link to the last slide in the carousel..
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} disabled - Deactivates the button.
|
|
13
|
+
*
|
|
14
|
+
* @event kemet-carousel-last
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
2
17
|
|
|
3
18
|
export class KemetCarouselLast extends LitElement {
|
|
4
19
|
static get styles() {
|
|
@@ -17,10 +32,7 @@ export class KemetCarouselLast extends LitElement {
|
|
|
17
32
|
|
|
18
33
|
static get properties() {
|
|
19
34
|
return {
|
|
20
|
-
disabled: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
reflect: true,
|
|
23
|
-
},
|
|
35
|
+
disabled: { type: Boolean, reflect: true },
|
|
24
36
|
};
|
|
25
37
|
}
|
|
26
38
|
|
|
@@ -34,11 +46,7 @@ export class KemetCarouselLast extends LitElement {
|
|
|
34
46
|
|
|
35
47
|
last() {
|
|
36
48
|
if (!this.disabled) {
|
|
37
|
-
this
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
detail: this,
|
|
41
|
-
}));
|
|
49
|
+
emitEvent(this, 'kemet-carousel-last', this);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @since 1.1.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-carousel-link
|
|
10
|
+
* @summary Zero-based index link to a slide in the carousel.
|
|
11
|
+
*
|
|
12
|
+
* @prop {number} slide
|
|
13
|
+
* @prop {boolean} selected - Automatically applied when link is active slide.
|
|
14
|
+
* @prop {boolean} disabled - Deactivates the button.
|
|
15
|
+
*
|
|
16
|
+
* @event kemet-carousel-link
|
|
17
|
+
*
|
|
18
|
+
* @cssproperty --kemet-carousel-link-selected-color - The color of an selected link. Default: var(--kemet-color-primary).
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
2
21
|
|
|
3
22
|
export default class KemetCarouselLink extends LitElement {
|
|
4
23
|
static get properties() {
|
|
5
24
|
return {
|
|
6
|
-
slide: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
selected: {
|
|
11
|
-
type: Boolean,
|
|
12
|
-
reflect: true,
|
|
13
|
-
},
|
|
14
|
-
disabled: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
reflect: true,
|
|
17
|
-
},
|
|
25
|
+
slide: { type: Number, reflect: true },
|
|
26
|
+
selected: { type: Boolean, reflect: true },
|
|
27
|
+
disabled: { type: Boolean, reflect: true },
|
|
18
28
|
};
|
|
19
29
|
}
|
|
20
30
|
|
|
@@ -46,11 +56,7 @@ export default class KemetCarouselLink extends LitElement {
|
|
|
46
56
|
|
|
47
57
|
changed() {
|
|
48
58
|
if (!this.disabled) {
|
|
49
|
-
this
|
|
50
|
-
bubbles: true,
|
|
51
|
-
composed: true,
|
|
52
|
-
detail: this,
|
|
53
|
-
}));
|
|
59
|
+
emitEvent(this, 'kemet-carousel-link', this);
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @since 1.1.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-carousel-next
|
|
10
|
+
* @summary A link to the next slide in the carousel.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} disabled - Deactivates the button.
|
|
13
|
+
*
|
|
14
|
+
* @event kemet-carousel-next
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
2
17
|
|
|
3
18
|
export default class KemetCarouselNext extends LitElement {
|
|
4
19
|
static get styles() {
|
|
@@ -17,10 +32,7 @@ export default class KemetCarouselNext extends LitElement {
|
|
|
17
32
|
|
|
18
33
|
static get properties() {
|
|
19
34
|
return {
|
|
20
|
-
disabled: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
reflect: true,
|
|
23
|
-
},
|
|
35
|
+
disabled: { type: Boolean, reflect: true },
|
|
24
36
|
};
|
|
25
37
|
}
|
|
26
38
|
|
|
@@ -34,11 +46,7 @@ export default class KemetCarouselNext extends LitElement {
|
|
|
34
46
|
|
|
35
47
|
next() {
|
|
36
48
|
if (!this.disabled) {
|
|
37
|
-
this
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
detail: this,
|
|
41
|
-
}));
|
|
49
|
+
emitEvent(this, 'kemet-carousel-next', this);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @since 1.1.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-carousel-prev
|
|
10
|
+
* @summary A link to the previous slide in the carousel.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} disabled - Deactivates the button.
|
|
13
|
+
*
|
|
14
|
+
* @event kemet-carousel-prev
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
2
17
|
|
|
3
18
|
export class KemetCarouselPrev extends LitElement {
|
|
4
19
|
static get styles() {
|
|
@@ -17,10 +32,7 @@ export class KemetCarouselPrev extends LitElement {
|
|
|
17
32
|
|
|
18
33
|
static get properties() {
|
|
19
34
|
return {
|
|
20
|
-
disabled: {
|
|
21
|
-
type: Boolean,
|
|
22
|
-
reflect: true,
|
|
23
|
-
},
|
|
35
|
+
disabled: { type: Boolean, reflect: true },
|
|
24
36
|
};
|
|
25
37
|
}
|
|
26
38
|
|
|
@@ -34,11 +46,7 @@ export class KemetCarouselPrev extends LitElement {
|
|
|
34
46
|
|
|
35
47
|
prev() {
|
|
36
48
|
if (!this.disabled) {
|
|
37
|
-
this
|
|
38
|
-
bubbles: true,
|
|
39
|
-
composed: true,
|
|
40
|
-
detail: this,
|
|
41
|
-
}));
|
|
49
|
+
emitEvent(this, 'kemet-carousel-prev', this);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-carousel-slide
|
|
9
|
+
* @summary A container for a slide in the carousel.
|
|
10
|
+
*
|
|
11
|
+
* @prop {boolean} selected - Determines if the slide is selected.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
3
15
|
export default class KemetCarouselSlide extends LitElement {
|
|
4
16
|
static get styles() {
|
|
5
17
|
return [
|
|
@@ -20,17 +32,8 @@ export default class KemetCarouselSlide extends LitElement {
|
|
|
20
32
|
|
|
21
33
|
static get properties() {
|
|
22
34
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
selected: {
|
|
27
|
-
type: Boolean,
|
|
28
|
-
reflect: true,
|
|
29
|
-
},
|
|
30
|
-
'aria-hidden': {
|
|
31
|
-
type: String,
|
|
32
|
-
reflect: true,
|
|
33
|
-
},
|
|
35
|
+
selected: { type: Boolean, reflect: true },
|
|
36
|
+
'aria-hidden': { type: String, reflect: true },
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @since 1.1.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-carousel-total
|
|
9
|
+
* @summary Displays the total slide number.
|
|
10
|
+
*
|
|
11
|
+
* @prop {number} total - The total number of slides.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
3
15
|
export class KemetCarouselTotal extends LitElement {
|
|
4
16
|
static get styles() {
|
|
5
17
|
return [
|
|
@@ -13,9 +25,7 @@ export class KemetCarouselTotal extends LitElement {
|
|
|
13
25
|
|
|
14
26
|
static get properties() {
|
|
15
27
|
return {
|
|
16
|
-
total: {
|
|
17
|
-
type: Number,
|
|
18
|
-
},
|
|
28
|
+
total: { type: Number },
|
|
19
29
|
};
|
|
20
30
|
}
|
|
21
31
|
|
|
@@ -1,126 +1,71 @@
|
|
|
1
|
-
import { html,
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
import { stylesCarousel } from './styles.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @since 1.1.0
|
|
8
|
+
* @status stable
|
|
9
|
+
*
|
|
10
|
+
* @tagname kemet-carousel
|
|
11
|
+
* @summary The Carousel allows you to click or swipe through content.
|
|
12
|
+
*
|
|
13
|
+
* @prop {number} index - The current slide index.
|
|
14
|
+
* @prop {number} total - The total amount of slides.
|
|
15
|
+
* @prop {string} sliderWidth - The width of the slider.
|
|
16
|
+
* @prop {string} sliderTranslateX - The X position of the slider.
|
|
17
|
+
* @prop {boolean} inner - Displays the toolbar inside the carousel container.
|
|
18
|
+
* @prop {boolean} arrows - Determines whether or not to display arrows.
|
|
19
|
+
* @prop {object} options - Default options for the carousel.
|
|
20
|
+
* @prop {object} breakpoints - Options at different breakpoints for the carousel. Is mobile first.
|
|
21
|
+
*
|
|
22
|
+
* @event kemet-carousel-change-start - Fires with the a slide has begun to change.
|
|
23
|
+
* @event kemet-carousel-change-finished - Fires when a slide has changed and finished animating
|
|
24
|
+
*
|
|
25
|
+
* @slot slides - Place the slide elements here.
|
|
26
|
+
* @slot toolbar - Allows you to construct a toolbar within the carousel. Place things like pagination here.
|
|
27
|
+
* @slot prev - A slot for the previous arrow.
|
|
28
|
+
* @slot next - A slot for the next arrow.
|
|
29
|
+
* @slot information - Allows you to enter custom HTML such as a slide description to be used in the toolbar.
|
|
30
|
+
*
|
|
31
|
+
* @cssproperty --kemet-carousel-width - The width of the carousel. Default: 100%.
|
|
32
|
+
* @cssproperty --kemet-carousel-height - The height of the carousel. Default: auto.
|
|
33
|
+
* @cssproperty --kemet-carousel-toolbar-gap - The space between items in the toolbar. Default: 1rem.
|
|
34
|
+
* @cssproperty --kemet-carousel-toolbar-justify-content - The cross axis alignment of the toolbar. Default: center.
|
|
35
|
+
* @cssproperty --kemet-carousel-toolbar-padding - The padding of the toolbar. Default: 1rem.
|
|
36
|
+
* @cssproperty --kemet-carousel-toolbar-inner-width - The inner toolbar width. Default: 100%.
|
|
37
|
+
* @cssproperty --kemet-carousel-toolbar-inner-bottom - The bottom position of the inner toolbar. Default: 0.
|
|
38
|
+
* @cssproperty --kemet-carousel-toolbar-inner-top - The top position of the inner toolbar. Default: auto.
|
|
39
|
+
* @cssproperty --kemet-carousel-toolbar-inner-color - The inner toolbar text color. Default: var(--kemet-color-white).
|
|
40
|
+
* @cssproperty --kemet-carousel-toolbar-inner-background-color - The inner toolbar background color. Default: rgba(0, 0, 0, 0.4).
|
|
41
|
+
* @cssproperty --kemet-carousel-slides-border - The border around the slides. Default: 1px solid var(--kemet-color-gray1).
|
|
42
|
+
* @cssproperty --kemet-carousel-transition-speed - The transition speed of the slides. Default: 300ms.
|
|
43
|
+
* @cssproperty --kemet-carousel-arrows-opacity - The arrows start opacity. Default: 0.25.
|
|
44
|
+
* @cssproperty --kemet-carousel-arrows-opacity-hover - The arrows however opacity. Default: 1.
|
|
45
|
+
* @cssproperty --kemet-carousel-arrows-transition-speed - The arrows transition speed. Default: 300ms.
|
|
46
|
+
*
|
|
47
|
+
* @csspart container - Contains the slides and toolbar.
|
|
48
|
+
* @csspart slides - Wrapper for the slider.
|
|
49
|
+
* @csspart slider - Contains the slides.
|
|
50
|
+
* @csspart toolbar - Contains the toolbar.
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
2
53
|
|
|
3
54
|
export default class KemetCarousel extends LitElement {
|
|
4
55
|
static get styles() {
|
|
5
|
-
return
|
|
6
|
-
:host,
|
|
7
|
-
*,
|
|
8
|
-
*::before,
|
|
9
|
-
*::after {
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
:host {
|
|
14
|
-
position: relative;
|
|
15
|
-
display: grid;
|
|
16
|
-
grid-template-columns: minmax(0, 1fr);
|
|
17
|
-
align-items: center;
|
|
18
|
-
width: var(--kemet-carousel-width, 100%);
|
|
19
|
-
height: var(--kemet-carousel-height, auto);
|
|
20
|
-
overflow: visible;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
:host([arrows]) {
|
|
24
|
-
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.toolbar {
|
|
28
|
-
display: flex;
|
|
29
|
-
gap: var(--kemet-carousel-toolbar-gap, 1rem);
|
|
30
|
-
align-items: center;
|
|
31
|
-
justify-content: var(--kemet-carousel-toolbar-justify-content, center);
|
|
32
|
-
line-height: 1;
|
|
33
|
-
padding: var(--kemet-carousel-toolbar-padding, 1rem);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
:host([inner]) .toolbar {
|
|
37
|
-
width: var(--kemet-carousel-toolbar-inner-width, 100%);
|
|
38
|
-
position: absolute;
|
|
39
|
-
bottom: var(--kemet-carousel-toolbar-inner-bottom, 0);
|
|
40
|
-
top: var(--kemet-carousel-toolbar-inner-top, auto);
|
|
41
|
-
color: var(--kemet-carousel-toolbar-inner-color, var(--kemet-color-white));
|
|
42
|
-
background-color: var(--kemet-carousel-toolbar-inner-background-color, rgba(0, 0, 0, 0.4));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.slides {
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
position: relative;
|
|
48
|
-
padding: 1rem 0;
|
|
49
|
-
border: var(--kemet-carousel-slides-border, 1px solid var(--kemet-color-gray1));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.slider {
|
|
53
|
-
display: flex;
|
|
54
|
-
flex-wrap: nowrap;
|
|
55
|
-
transition: transform var(--kemet-carousel-transition-speed, 300ms) ease;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
::slotted([slot='next']),
|
|
59
|
-
::slotted([slot='prev']) {
|
|
60
|
-
opacity: var(--kemet-carousel-arrows-opacity, 0.25);
|
|
61
|
-
transition: opacity var(--kemet-carousel-arrows-transition-speed, 300ms) ease-in-out;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
:host(:hover) ::slotted([slot='next']),
|
|
65
|
-
:host(:hover) ::slotted([slot='prev']) {
|
|
66
|
-
opacity: var(--kemet-carousel-arrows-opacity-hover, 1);
|
|
67
|
-
}
|
|
68
|
-
`;
|
|
56
|
+
return [stylesCarousel];
|
|
69
57
|
}
|
|
70
58
|
|
|
71
59
|
static get properties() {
|
|
72
60
|
return {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
* The total amount of slides
|
|
82
|
-
*/
|
|
83
|
-
total: {
|
|
84
|
-
type: Number,
|
|
85
|
-
},
|
|
86
|
-
/**
|
|
87
|
-
* The width of the slider
|
|
88
|
-
*/
|
|
89
|
-
sliderWidth: {
|
|
90
|
-
type: String,
|
|
91
|
-
},
|
|
92
|
-
/**
|
|
93
|
-
* The X position of the slider
|
|
94
|
-
*/
|
|
95
|
-
sliderTranslateX: {
|
|
96
|
-
type: String,
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* Displays the toolbar inside the carousel container
|
|
100
|
-
*/
|
|
101
|
-
inner: {
|
|
102
|
-
type: Boolean,
|
|
103
|
-
reflect: true,
|
|
104
|
-
},
|
|
105
|
-
/**
|
|
106
|
-
* Determines whether or not to display arrows
|
|
107
|
-
*/
|
|
108
|
-
arrows: {
|
|
109
|
-
type: Boolean,
|
|
110
|
-
reflect: true,
|
|
111
|
-
},
|
|
112
|
-
/**
|
|
113
|
-
* Default options for the carousel
|
|
114
|
-
*/
|
|
115
|
-
options: {
|
|
116
|
-
type: Object,
|
|
117
|
-
},
|
|
118
|
-
/**
|
|
119
|
-
* Options are different breakpoints for the carousel. Is mobile first.
|
|
120
|
-
*/
|
|
121
|
-
breakpoints: {
|
|
122
|
-
type: Object,
|
|
123
|
-
},
|
|
61
|
+
index: { type: Number, reflect: true },
|
|
62
|
+
total: { type: Number },
|
|
63
|
+
sliderWidth: { type: String },
|
|
64
|
+
sliderTranslateX: { type: String },
|
|
65
|
+
inner: { type: Boolean, reflect: true },
|
|
66
|
+
arrows: { type: Boolean, reflect: true },
|
|
67
|
+
options: { type: Object },
|
|
68
|
+
breakpoints: { type: Object },
|
|
124
69
|
};
|
|
125
70
|
}
|
|
126
71
|
|
|
@@ -414,15 +359,7 @@ export default class KemetCarousel extends LitElement {
|
|
|
414
359
|
currentSlide.selected = true;
|
|
415
360
|
|
|
416
361
|
// notify consumers of slide change
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Fires with the a slide has begun to change
|
|
420
|
-
*/
|
|
421
|
-
this.dispatchEvent(new CustomEvent('kemet-carousel-change-start', {
|
|
422
|
-
bubbles: true,
|
|
423
|
-
composed: true,
|
|
424
|
-
detail: this,
|
|
425
|
-
}));
|
|
362
|
+
emitEvent(this, 'kemet-carousel-change-start', this);
|
|
426
363
|
|
|
427
364
|
// update information element
|
|
428
365
|
this.updateInformation();
|
|
@@ -458,14 +395,7 @@ export default class KemetCarousel extends LitElement {
|
|
|
458
395
|
currentElement.current = this.index + 1;
|
|
459
396
|
}
|
|
460
397
|
|
|
461
|
-
|
|
462
|
-
* Fires when a slide has changed and finished animating
|
|
463
|
-
*/
|
|
464
|
-
this.dispatchEvent(new CustomEvent('kemet-carousel-change-finished', {
|
|
465
|
-
bubbles: true,
|
|
466
|
-
composed: true,
|
|
467
|
-
detail: this,
|
|
468
|
-
}));
|
|
398
|
+
emitEvent(this, 'kemet-carousel-change-finished', this);
|
|
469
399
|
}
|
|
470
400
|
|
|
471
401
|
handleLink(event) {
|