kemet-ui 1.0.0 → 1.2.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 +1605 -225
- package/dist/components/{kemet-accordion-panel.js → kemet-accordion/kemet-accordion-panel.js} +0 -0
- package/dist/components/{kemet-accordion.js → kemet-accordion/kemet-accordion.js} +0 -0
- package/dist/components/{kemet-badge.js → kemet-badge/kemet-badge.js} +0 -0
- package/dist/components/{kemet-button.js → kemet-button/kemet-button.js} +0 -0
- package/dist/components/kemet-carousel/kemet-carousel-current.js +36 -0
- package/dist/components/kemet-carousel/kemet-carousel-first.js +47 -0
- package/dist/components/kemet-carousel/kemet-carousel-last.js +47 -0
- package/dist/components/kemet-carousel/kemet-carousel-link.js +59 -0
- package/dist/components/kemet-carousel/kemet-carousel-next.js +47 -0
- package/dist/components/kemet-carousel/kemet-carousel-prev.js +47 -0
- package/dist/components/kemet-carousel/kemet-carousel-slide.js +51 -0
- package/dist/components/kemet-carousel/kemet-carousel-total.js +36 -0
- package/dist/components/kemet-carousel/kemet-carousel.js +492 -0
- package/dist/components/{kemet-checkbox.js → kemet-checkbox/kemet-checkbox.js} +0 -0
- package/dist/components/{kemet-combo.js → kemet-combo/kemet-combo.js} +0 -0
- package/dist/components/{kemet-count.js → kemet-count/kemet-count.js} +0 -0
- package/dist/components/{kemet-draggable.js → kemet-draggable/kemet-draggable.js} +0 -0
- package/dist/components/{kemet-drawer.js → kemet-drawer/kemet-drawer.js} +0 -0
- package/dist/components/{kemet-drawer.styles.js → kemet-drawer/kemet-drawer.styles.js} +0 -0
- package/dist/components/kemet-fab/kemet-fab.js +209 -0
- package/dist/components/{kemet-field.js → kemet-field/kemet-field.js} +0 -0
- package/dist/components/{kemet-flipcard-trigger.js → kemet-flipcard/kemet-flipcard-trigger.js} +0 -0
- package/dist/components/{kemet-flipcard.js → kemet-flipcard/kemet-flipcard.js} +0 -0
- package/dist/components/{kemet-icon.js → kemet-icon/kemet-icon.js} +0 -0
- package/dist/components/{kemet-input.js → kemet-input/kemet-input.js} +15 -4
- package/dist/components/{kemet-modal-close.js → kemet-modal/kemet-modal-close.js} +0 -0
- package/dist/components/{kemet-modal.js → kemet-modal/kemet-modal.js} +0 -0
- package/dist/components/{kemet-modal.styles.js → kemet-modal/kemet-modal.styles.js} +0 -0
- package/dist/components/kemet-password/kemet-password.js +278 -0
- package/dist/components/{kemet-popover-close.js → kemet-popover/kemet-popover-close.js} +0 -0
- package/dist/components/{kemet-popover.effects.styles.js → kemet-popover/kemet-popover.effects.styles.js} +0 -0
- package/dist/components/{kemet-popover.js → kemet-popover/kemet-popover.js} +0 -0
- package/dist/components/{kemet-popover.tooltip.styles.js → kemet-popover/kemet-popover.tooltip.styles.js} +0 -0
- package/dist/components/{kemet-radio.js → kemet-radio/kemet-radio.js} +0 -0
- package/dist/components/{kemet-radios.js → kemet-radio/kemet-radios.js} +0 -0
- package/dist/components/{kemet-rotator.js → kemet-rotator/kemet-rotator.js} +0 -0
- package/dist/components/{kemet-scroll-link.js → kemet-scroll-link/kemet-scroll-link.js} +0 -0
- package/dist/components/{kemet-scroll-nav.js → kemet-scroll-nav/kemet-scroll-nav.js} +0 -0
- package/dist/components/{kemet-scroll-snap-paginator.js → kemet-scroll-snap/kemet-scroll-snap-paginator.js} +0 -0
- package/dist/components/{kemet-scroll-snap-slide.js → kemet-scroll-snap/kemet-scroll-snap-slide.js} +0 -0
- package/dist/components/{kemet-scroll-snap.js → kemet-scroll-snap/kemet-scroll-snap.js} +0 -0
- package/dist/components/{kemet-option.js → kemet-select/kemet-option.js} +0 -0
- package/dist/components/{kemet-select.js → kemet-select/kemet-select.js} +0 -0
- package/dist/components/{kemet-svg.js → kemet-svgs/kemet-svg.js} +0 -0
- package/dist/components/{kemet-svgs.js → kemet-svgs/kemet-svgs.js} +0 -0
- package/dist/components/{kemet-tab-panel.js → kemet-tabs/kemet-tab-panel.js} +0 -0
- package/dist/components/{kemet-tab.js → kemet-tabs/kemet-tab.js} +0 -0
- package/dist/components/{kemet-tabs.js → kemet-tabs/kemet-tabs.js} +0 -0
- package/dist/components/{kemet-tabs.styles.js → kemet-tabs/kemet-tabs.styles.js} +0 -0
- package/dist/components/{kemet-textarea.js → kemet-textarea/kemet-textarea.js} +0 -0
- package/dist/components/{kemet-toggle.js → kemet-toggle/kemet-toggle.js} +0 -0
- package/dist/components/kemet-tracker/kemet-tracker-step.js +239 -0
- package/dist/components/kemet-tracker/kemet-tracker.js +76 -0
- package/dist/kemet-components.cjs +1809 -140
- package/dist/kemet-components.js +1805 -141
- package/dist/kemet-components.min.js +574 -87
- package/dist/styles/components/_config.scss +4 -0
- package/dist/styles/{scss/components → components}/accordion.scss +0 -0
- package/dist/styles/{scss/components → components}/drawer.scss +2 -2
- package/dist/styles/{scss/components → components}/modal.scss +0 -0
- package/dist/styles/{scss/components → components}/scrollsnap.scss +0 -0
- package/dist/styles/{scss/core → core}/_config.scss +22 -22
- package/dist/styles/{scss/core → core}/_helpers.scss +7 -3
- package/dist/styles/{scss/core → core}/attributes.scss +0 -0
- package/dist/styles/{scss/core → core}/base.scss +0 -0
- package/dist/styles/{scss/core → core}/layout.scss +0 -0
- package/dist/styles/kemet.components.css +1 -80
- package/dist/styles/kemet.components.css.map +1 -1
- package/dist/styles/{scss/kemet.components.scss → kemet.components.scss} +0 -1
- package/dist/styles/kemet.core.css +1 -1
- package/dist/styles/kemet.core.css.map +1 -1
- package/dist/styles/{scss/kemet.core.scss → kemet.core.scss} +0 -0
- package/dist/utilities/controllers/forms.js +123 -0
- package/package.json +5 -3
- package/dist/styles/scss/components/_config.scss +0 -4
- package/dist/styles/scss/components/carousel.scss +0 -64
package/dist/kemet-components.js
CHANGED
|
@@ -459,6 +459,107 @@ class KemetAccordion extends s$1 {
|
|
|
459
459
|
// eslint-disable-next-line no-unused-expressions
|
|
460
460
|
customElements.get('kemet-accordion') || customElements.define('kemet-accordion', KemetAccordion);
|
|
461
461
|
|
|
462
|
+
class KemetBadge extends s$1 {
|
|
463
|
+
static get styles() {
|
|
464
|
+
return [
|
|
465
|
+
r$3`
|
|
466
|
+
:host {
|
|
467
|
+
display: inline-flex;
|
|
468
|
+
align-items: center;
|
|
469
|
+
justify-content: center;
|
|
470
|
+
padding: var(--kemet-badge-padding, 10px);
|
|
471
|
+
line-height: 1;
|
|
472
|
+
color: var(--kemet-color-white);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
:host([status='primary']) {
|
|
476
|
+
background-color: var(--kemet-color-primary);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
:host([status='success']) {
|
|
480
|
+
background-color: var(--kemet-color-success);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
:host([status='standard']) {
|
|
484
|
+
background-color: var(--kemet-color-gray6);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
:host([status='warning']) {
|
|
488
|
+
background-color: var(--kemet-color-warning);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
:host([status='error']) {
|
|
492
|
+
background-color: var(--kemet-color-error);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
:host([circle]) {
|
|
496
|
+
border-radius: 50%;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
:host([pill]) {
|
|
500
|
+
border-radius: 99rem;
|
|
501
|
+
}
|
|
502
|
+
`,
|
|
503
|
+
];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
static get properties() {
|
|
507
|
+
return {
|
|
508
|
+
/**
|
|
509
|
+
* The status of the badge
|
|
510
|
+
*/
|
|
511
|
+
status: {
|
|
512
|
+
type: String,
|
|
513
|
+
reflect: true,
|
|
514
|
+
},
|
|
515
|
+
/**
|
|
516
|
+
* Displays the badge in a circle
|
|
517
|
+
*/
|
|
518
|
+
circle: {
|
|
519
|
+
type: Boolean,
|
|
520
|
+
reflect: true,
|
|
521
|
+
},
|
|
522
|
+
/**
|
|
523
|
+
* Rounds the corners on the badge
|
|
524
|
+
*/
|
|
525
|
+
pill: {
|
|
526
|
+
type: Boolean,
|
|
527
|
+
reflect: true,
|
|
528
|
+
},
|
|
529
|
+
/**
|
|
530
|
+
* Padding on the badge as a circle
|
|
531
|
+
*/
|
|
532
|
+
circlePadding: {
|
|
533
|
+
type: Number,
|
|
534
|
+
attribute: 'circle-padding',
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
constructor() {
|
|
540
|
+
super();
|
|
541
|
+
|
|
542
|
+
this.status = 'primary';
|
|
543
|
+
this.pill = false;
|
|
544
|
+
this.circle = false;
|
|
545
|
+
this.circlePadding = 0;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
render() {
|
|
549
|
+
return $`<slot @slotchange=${() => this.handleSlotChange()}></slot>`;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
handleSlotChange() {
|
|
553
|
+
if (this.circle) {
|
|
554
|
+
this.style.height = `${this.offsetWidth + this.circlePadding}px`;
|
|
555
|
+
this.style.width = `${this.offsetWidth + this.circlePadding}px`;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// eslint-disable-next-line no-unused-expressions
|
|
561
|
+
customElements.get('kemet-badge') || customElements.define('kemet-badge', KemetBadge);
|
|
562
|
+
|
|
462
563
|
class FormSubmitController {
|
|
463
564
|
host;
|
|
464
565
|
form;
|
|
@@ -504,10 +605,10 @@ class FormSubmitController {
|
|
|
504
605
|
if (!disabled && typeof name === 'string' && typeof value !== 'undefined') {
|
|
505
606
|
if (Array.isArray(value)) {
|
|
506
607
|
value.forEach((val) => {
|
|
507
|
-
event.formData
|
|
608
|
+
event.formData?.append(name, val.toString());
|
|
508
609
|
});
|
|
509
610
|
} else {
|
|
510
|
-
event.formData
|
|
611
|
+
event.formData?.append(name, value.toString());
|
|
511
612
|
}
|
|
512
613
|
}
|
|
513
614
|
}
|
|
@@ -516,6 +617,8 @@ class FormSubmitController {
|
|
|
516
617
|
const disabled = this.options.disabled(this.host);
|
|
517
618
|
const checkValidity = this.options.checkValidity;
|
|
518
619
|
|
|
620
|
+
this.form = this.options.form(this.host);
|
|
621
|
+
|
|
519
622
|
if (this.form && !this.form.noValidate && !disabled && !checkValidity(this.host)) {
|
|
520
623
|
event.preventDefault();
|
|
521
624
|
event.stopImmediatePropagation();
|
|
@@ -808,106 +911,858 @@ class KemetButton extends s$1 {
|
|
|
808
911
|
// eslint-disable-next-line no-unused-expressions
|
|
809
912
|
customElements.get('kemet-button') || customElements.define('kemet-button', KemetButton);
|
|
810
913
|
|
|
811
|
-
class
|
|
914
|
+
class KemetCarouselCurrent extends s$1 {
|
|
812
915
|
static get styles() {
|
|
813
916
|
return [
|
|
814
917
|
r$3`
|
|
815
918
|
:host {
|
|
816
|
-
display: inline-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
919
|
+
display: inline-block;
|
|
920
|
+
}
|
|
921
|
+
`,
|
|
922
|
+
];
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
static get properties() {
|
|
926
|
+
return {
|
|
927
|
+
current: {
|
|
928
|
+
type: Number,
|
|
929
|
+
},
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
firstUpdated() {
|
|
934
|
+
this.carousel = this.closest('kemet-carousel');
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
updated() {
|
|
938
|
+
this.current = this.carousel.index + 1;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
render() {
|
|
942
|
+
return $`${this.current}`;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
// eslint-disable-next-line no-unused-expressions
|
|
947
|
+
customElements.get('kemet-carousel-current') || customElements.define('kemet-carousel-current', KemetCarouselCurrent);
|
|
948
|
+
|
|
949
|
+
class KemetCarouselFirst extends s$1 {
|
|
950
|
+
static get styles() {
|
|
951
|
+
return [
|
|
952
|
+
r$3`
|
|
953
|
+
:host {
|
|
954
|
+
cursor: pointer;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
:host([disabled]) {
|
|
958
|
+
cursor: not-allowed;
|
|
959
|
+
}
|
|
960
|
+
`,
|
|
961
|
+
];
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
static get properties() {
|
|
965
|
+
return {
|
|
966
|
+
disabled: {
|
|
967
|
+
type: Boolean,
|
|
968
|
+
reflect: true,
|
|
969
|
+
},
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
render() {
|
|
974
|
+
return $`
|
|
975
|
+
<span tabindex="0" @keyup=${() => this.first()} @click=${() => this.first()}>
|
|
976
|
+
<slot></slot>
|
|
977
|
+
</span>
|
|
978
|
+
`;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
first() {
|
|
982
|
+
if (!this.disabled) {
|
|
983
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-first', {
|
|
984
|
+
bubbles: true,
|
|
985
|
+
composed: true,
|
|
986
|
+
detail: this,
|
|
987
|
+
}));
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// eslint-disable-next-line no-unused-expressions
|
|
993
|
+
customElements.get('kemet-carousel-first') || customElements.define('kemet-carousel-first', KemetCarouselFirst);
|
|
994
|
+
|
|
995
|
+
class KemetCarouselLast extends s$1 {
|
|
996
|
+
static get styles() {
|
|
997
|
+
return [
|
|
998
|
+
r$3`
|
|
999
|
+
:host {
|
|
1000
|
+
cursor: pointer;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
:host([disabled]) {
|
|
1004
|
+
cursor: not-allowed;
|
|
1005
|
+
}
|
|
1006
|
+
`,
|
|
1007
|
+
];
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
static get properties() {
|
|
1011
|
+
return {
|
|
1012
|
+
disabled: {
|
|
1013
|
+
type: Boolean,
|
|
1014
|
+
reflect: true,
|
|
1015
|
+
},
|
|
1016
|
+
};
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
render() {
|
|
1020
|
+
return $`
|
|
1021
|
+
<span tabindex="0" @keyup=${() => this.last()} @click=${() => this.last()}>
|
|
1022
|
+
<slot></slot>
|
|
1023
|
+
</span>
|
|
1024
|
+
`;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
last() {
|
|
1028
|
+
if (!this.disabled) {
|
|
1029
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-last', {
|
|
1030
|
+
bubbles: true,
|
|
1031
|
+
composed: true,
|
|
1032
|
+
detail: this,
|
|
1033
|
+
}));
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1039
|
+
customElements.get('kemet-carousel-last') || customElements.define('kemet-carousel-last', KemetCarouselLast);
|
|
1040
|
+
|
|
1041
|
+
class KemetCarouselLink extends s$1 {
|
|
1042
|
+
static get properties() {
|
|
1043
|
+
return {
|
|
1044
|
+
slide: {
|
|
1045
|
+
type: Number,
|
|
1046
|
+
reflect: true,
|
|
1047
|
+
},
|
|
1048
|
+
selected: {
|
|
1049
|
+
type: Boolean,
|
|
1050
|
+
reflect: true,
|
|
1051
|
+
},
|
|
1052
|
+
disabled: {
|
|
1053
|
+
type: Boolean,
|
|
1054
|
+
reflect: true,
|
|
1055
|
+
},
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
static get styles() {
|
|
1060
|
+
return [
|
|
1061
|
+
r$3`
|
|
1062
|
+
:host([selected]) {
|
|
1063
|
+
color: var(--kemet-carousel-link-selected-color, var(--kemet-color-primary));
|
|
822
1064
|
}
|
|
823
1065
|
|
|
824
|
-
:host([
|
|
825
|
-
|
|
826
|
-
}
|
|
1066
|
+
:host(:not([selected])) {
|
|
1067
|
+
cursor: pointer;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
:host([disabled]) {
|
|
1071
|
+
cursor: not-allowed;
|
|
1072
|
+
}
|
|
1073
|
+
`,
|
|
1074
|
+
];
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
render() {
|
|
1078
|
+
return $`
|
|
1079
|
+
<span tabindex="0" @keyup=${() => this.changed()} @click=${() => this.changed()}>
|
|
1080
|
+
<slot></slot>
|
|
1081
|
+
</span>
|
|
1082
|
+
`;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
changed() {
|
|
1086
|
+
if (!this.disabled) {
|
|
1087
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-link', {
|
|
1088
|
+
bubbles: true,
|
|
1089
|
+
composed: true,
|
|
1090
|
+
detail: this,
|
|
1091
|
+
}));
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1097
|
+
customElements.get('kemet-carousel-link') || customElements.define('kemet-carousel-link', KemetCarouselLink);
|
|
1098
|
+
|
|
1099
|
+
class KemetCarouselNext extends s$1 {
|
|
1100
|
+
static get styles() {
|
|
1101
|
+
return [
|
|
1102
|
+
r$3`
|
|
1103
|
+
:host {
|
|
1104
|
+
cursor: pointer;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
:host([disabled]) {
|
|
1108
|
+
cursor: not-allowed;
|
|
1109
|
+
}
|
|
1110
|
+
`,
|
|
1111
|
+
];
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
static get properties() {
|
|
1115
|
+
return {
|
|
1116
|
+
disabled: {
|
|
1117
|
+
type: Boolean,
|
|
1118
|
+
reflect: true,
|
|
1119
|
+
},
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
render() {
|
|
1124
|
+
return $`
|
|
1125
|
+
<span tabindex="0" @keyup=${() => this.next()} @click=${() => this.next()}>
|
|
1126
|
+
<slot></slot>
|
|
1127
|
+
</span>
|
|
1128
|
+
`;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
next() {
|
|
1132
|
+
if (!this.disabled) {
|
|
1133
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-next', {
|
|
1134
|
+
bubbles: true,
|
|
1135
|
+
composed: true,
|
|
1136
|
+
detail: this,
|
|
1137
|
+
}));
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1143
|
+
customElements.get('kemet-carousel-next') || customElements.define('kemet-carousel-next', KemetCarouselNext);
|
|
1144
|
+
|
|
1145
|
+
class KemetCarouselPrev extends s$1 {
|
|
1146
|
+
static get styles() {
|
|
1147
|
+
return [
|
|
1148
|
+
r$3`
|
|
1149
|
+
:host {
|
|
1150
|
+
cursor: pointer;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
:host([disabled]) {
|
|
1154
|
+
cursor: not-allowed;
|
|
1155
|
+
}
|
|
1156
|
+
`,
|
|
1157
|
+
];
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
static get properties() {
|
|
1161
|
+
return {
|
|
1162
|
+
disabled: {
|
|
1163
|
+
type: Boolean,
|
|
1164
|
+
reflect: true,
|
|
1165
|
+
},
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
render() {
|
|
1170
|
+
return $`
|
|
1171
|
+
<span tabindex="0" @keyup=${() => this.prev()} @click=${() => this.prev()}>
|
|
1172
|
+
<slot></slot>
|
|
1173
|
+
</span>
|
|
1174
|
+
`;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
prev() {
|
|
1178
|
+
if (!this.disabled) {
|
|
1179
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-prev', {
|
|
1180
|
+
bubbles: true,
|
|
1181
|
+
composed: true,
|
|
1182
|
+
detail: this,
|
|
1183
|
+
}));
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1189
|
+
customElements.get('kemet-carousel-prev') || customElements.define('kemet-carousel-prev', KemetCarouselPrev);
|
|
1190
|
+
|
|
1191
|
+
class KemetCarouselSlide extends s$1 {
|
|
1192
|
+
static get styles() {
|
|
1193
|
+
return [
|
|
1194
|
+
r$3`
|
|
1195
|
+
:host,
|
|
1196
|
+
:host *,
|
|
1197
|
+
:host *::before,
|
|
1198
|
+
*::after {
|
|
1199
|
+
box-sizing: border-box;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
:host {
|
|
1203
|
+
flex: 0 0 auto;
|
|
1204
|
+
}
|
|
1205
|
+
`,
|
|
1206
|
+
];
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
static get properties() {
|
|
1210
|
+
return {
|
|
1211
|
+
/**
|
|
1212
|
+
* Determines if the slide is selected
|
|
1213
|
+
*/
|
|
1214
|
+
selected: {
|
|
1215
|
+
type: Boolean,
|
|
1216
|
+
reflect: true,
|
|
1217
|
+
},
|
|
1218
|
+
'aria-hidden': {
|
|
1219
|
+
type: String,
|
|
1220
|
+
reflect: true,
|
|
1221
|
+
},
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
constructor() {
|
|
1226
|
+
super();
|
|
1227
|
+
this.selected = false;
|
|
1228
|
+
this['aria-hidden'] = 'true';
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
render() {
|
|
1232
|
+
return $`
|
|
1233
|
+
<slot></slot>
|
|
1234
|
+
`;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1239
|
+
customElements.get('kemet-carousel-slide') || customElements.define('kemet-carousel-slide', KemetCarouselSlide);
|
|
1240
|
+
|
|
1241
|
+
class KemetCarouselTotal extends s$1 {
|
|
1242
|
+
static get styles() {
|
|
1243
|
+
return [
|
|
1244
|
+
r$3`
|
|
1245
|
+
:host {
|
|
1246
|
+
display: inline-block;
|
|
1247
|
+
}
|
|
1248
|
+
`,
|
|
1249
|
+
];
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
static get properties() {
|
|
1253
|
+
return {
|
|
1254
|
+
total: {
|
|
1255
|
+
type: Number,
|
|
1256
|
+
},
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
firstUpdated() {
|
|
1261
|
+
this.carousel = this.closest('kemet-carousel');
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
updated() {
|
|
1265
|
+
this.total = this.carousel.total;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
render() {
|
|
1269
|
+
return $`${this.total}`;
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1274
|
+
customElements.get('kemet-carousel-total') || customElements.define('kemet-carousel-total', KemetCarouselTotal);
|
|
1275
|
+
|
|
1276
|
+
class KemetCarousel extends s$1 {
|
|
1277
|
+
static get styles() {
|
|
1278
|
+
return r$3`
|
|
1279
|
+
:host,
|
|
1280
|
+
*,
|
|
1281
|
+
*::before,
|
|
1282
|
+
*::after {
|
|
1283
|
+
box-sizing: border-box;
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
:host {
|
|
1287
|
+
position: relative;
|
|
1288
|
+
display: grid;
|
|
1289
|
+
grid-template-columns: minmax(0, 1fr);
|
|
1290
|
+
align-items: center;
|
|
1291
|
+
width: var(--kemet-carousel-width, 100%);
|
|
1292
|
+
height: var(--kemet-carousel-height, auto);
|
|
1293
|
+
overflow: visible;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
:host([arrows]) {
|
|
1297
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
.toolbar {
|
|
1301
|
+
display: flex;
|
|
1302
|
+
gap: var(--kemet-carousel-toolbar-gap, 1rem);
|
|
1303
|
+
align-items: center;
|
|
1304
|
+
justify-content: var(--kemet-carousel-toolbar-justify-content, center);
|
|
1305
|
+
line-height: 1;
|
|
1306
|
+
padding: var(--kemet-carousel-toolbar-padding, 1rem);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
:host([inner]) .toolbar {
|
|
1310
|
+
width: var(--kemet-carousel-toolbar-inner-width, 100%);
|
|
1311
|
+
position: absolute;
|
|
1312
|
+
bottom: var(--kemet-carousel-toolbar-inner-bottom, 0);
|
|
1313
|
+
top: var(--kemet-carousel-toolbar-inner-top, auto);
|
|
1314
|
+
color: var(--kemet-carousel-toolbar-inner-color, var(--kemet-color-white));
|
|
1315
|
+
background-color: var(--kemet-carousel-toolbar-inner-background-color, rgba(0, 0, 0, 0.4));
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
.slides {
|
|
1319
|
+
overflow: hidden;
|
|
1320
|
+
position: relative;
|
|
1321
|
+
padding: 1rem 0;
|
|
1322
|
+
border: var(--kemet-carousel-slides-border, 1px solid var(--kemet-color-gray1));
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
.slider {
|
|
1326
|
+
display: flex;
|
|
1327
|
+
flex-wrap: nowrap;
|
|
1328
|
+
transition: transform var(--kemet-carousel-transition-speed, 300ms) ease;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
::slotted([slot='next']),
|
|
1332
|
+
::slotted([slot='prev']) {
|
|
1333
|
+
opacity: var(--kemet-carousel-arrows-opacity, 0.25);
|
|
1334
|
+
transition: opacity var(--kemet-carousel-arrows-transition-speed, 300ms) ease-in-out;
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
:host(:hover) ::slotted([slot='next']),
|
|
1338
|
+
:host(:hover) ::slotted([slot='prev']) {
|
|
1339
|
+
opacity: var(--kemet-carousel-arrows-opacity-hover, 1);
|
|
1340
|
+
}
|
|
1341
|
+
`;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
static get properties() {
|
|
1345
|
+
return {
|
|
1346
|
+
/**
|
|
1347
|
+
* The current slide index.
|
|
1348
|
+
*/
|
|
1349
|
+
index: {
|
|
1350
|
+
type: Number,
|
|
1351
|
+
reflect: true,
|
|
1352
|
+
},
|
|
1353
|
+
/**
|
|
1354
|
+
* The total amount of slides
|
|
1355
|
+
*/
|
|
1356
|
+
total: {
|
|
1357
|
+
type: Number,
|
|
1358
|
+
},
|
|
1359
|
+
/**
|
|
1360
|
+
* The width of the slider
|
|
1361
|
+
*/
|
|
1362
|
+
sliderWidth: {
|
|
1363
|
+
type: String,
|
|
1364
|
+
},
|
|
1365
|
+
/**
|
|
1366
|
+
* The X position of the slider
|
|
1367
|
+
*/
|
|
1368
|
+
sliderTranslateX: {
|
|
1369
|
+
type: String,
|
|
1370
|
+
},
|
|
1371
|
+
/**
|
|
1372
|
+
* Displays the toolbar inside the carousel container
|
|
1373
|
+
*/
|
|
1374
|
+
inner: {
|
|
1375
|
+
type: Boolean,
|
|
1376
|
+
reflect: true,
|
|
1377
|
+
},
|
|
1378
|
+
/**
|
|
1379
|
+
* Determines whether or not to display arrows
|
|
1380
|
+
*/
|
|
1381
|
+
arrows: {
|
|
1382
|
+
type: Boolean,
|
|
1383
|
+
reflect: true,
|
|
1384
|
+
},
|
|
1385
|
+
/**
|
|
1386
|
+
* Default options for the carousel
|
|
1387
|
+
*/
|
|
1388
|
+
options: {
|
|
1389
|
+
type: Object,
|
|
1390
|
+
},
|
|
1391
|
+
/**
|
|
1392
|
+
* Options are different breakpoints for the carousel. Is mobile first.
|
|
1393
|
+
*/
|
|
1394
|
+
breakpoints: {
|
|
1395
|
+
type: Object,
|
|
1396
|
+
},
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
constructor() {
|
|
1401
|
+
super();
|
|
1402
|
+
|
|
1403
|
+
// managed properties
|
|
1404
|
+
this.index = 0;
|
|
1405
|
+
this.total = 0;
|
|
1406
|
+
this.sliderWidth = 'auto';
|
|
1407
|
+
this.sliderTranslateX = '0';
|
|
1408
|
+
this.inner = false;
|
|
1409
|
+
this.arrows = false;
|
|
1410
|
+
this.options = {
|
|
1411
|
+
perView: 1,
|
|
1412
|
+
perMove: 1,
|
|
1413
|
+
gap: 12,
|
|
1414
|
+
slideshow: 0,
|
|
1415
|
+
rewind: true,
|
|
1416
|
+
center: false,
|
|
1417
|
+
};
|
|
1418
|
+
this.breakpoints = {
|
|
1419
|
+
768: {
|
|
1420
|
+
perView: 2,
|
|
1421
|
+
gap: 24,
|
|
1422
|
+
rewind: false,
|
|
1423
|
+
},
|
|
1424
|
+
1280: {
|
|
1425
|
+
perView: 2.5,
|
|
1426
|
+
center: true,
|
|
1427
|
+
},
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
// bindings
|
|
1431
|
+
this.addEventListener('kemet-carousel-first', this.handleFirst.bind(this));
|
|
1432
|
+
this.addEventListener('kemet-carousel-last', this.handleLast.bind(this));
|
|
1433
|
+
this.addEventListener('kemet-carousel-next', this.handleNext.bind(this));
|
|
1434
|
+
this.addEventListener('kemet-carousel-prev', this.handlePrev.bind(this));
|
|
1435
|
+
this.addEventListener('kemet-carousel-link', this.handleLink.bind(this));
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
firstUpdated() {
|
|
1439
|
+
// standard properties
|
|
1440
|
+
this.slides = [];
|
|
1441
|
+
this.links = [];
|
|
1442
|
+
|
|
1443
|
+
// elements
|
|
1444
|
+
this.containerElement = this.shadowRoot.querySelector('[part="container"]');
|
|
1445
|
+
this.slidesElement = this.shadowRoot.querySelector('[part="slides"]');
|
|
1446
|
+
this.sliderElement = this.shadowRoot.querySelector('[part="slider"]');
|
|
1447
|
+
this.toolbarElement = this.shadowRoot.querySelector('[part="toolbar"]');
|
|
1448
|
+
this.toolbarSlotElement = this.querySelector('[slot="toolbar"]');
|
|
1449
|
+
this.informationElement = this.querySelector('kemet-carousel-information');
|
|
1450
|
+
|
|
1451
|
+
// events
|
|
1452
|
+
window.addEventListener('resize', () => {
|
|
1453
|
+
this.setSlideSize();
|
|
1454
|
+
this.setToolbarSize();
|
|
1455
|
+
this.updateIndex(this.index);
|
|
1456
|
+
});
|
|
1457
|
+
|
|
1458
|
+
this.sliderElement.addEventListener('transitionend', this.handleTransitionEnd.bind(this));
|
|
1459
|
+
|
|
1460
|
+
// methods
|
|
1461
|
+
this.swipeMove = (event) => {
|
|
1462
|
+
event.preventDefault();
|
|
1463
|
+
|
|
1464
|
+
const pageX = event.touches ? event.touches[0].pageX : event.pageX;
|
|
1465
|
+
const currentSlide = this.slides[this.index];
|
|
1466
|
+
|
|
1467
|
+
this.sliderTranslateX = `${pageX - this.startX - currentSlide.offsetLeft}px`;
|
|
1468
|
+
};
|
|
1469
|
+
|
|
1470
|
+
this.handleSlideShow = () => {
|
|
1471
|
+
if (this.getOption('slideshow') > 0) {
|
|
1472
|
+
this.updateIndex(this.index + 1);
|
|
1473
|
+
clearTimeout(this.handleSlideShow);
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
// setup
|
|
1478
|
+
this.setSlideSize();
|
|
1479
|
+
this.goToSlide(this.index);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
updated(prevProps) {
|
|
1483
|
+
this.setSlideSize();
|
|
1484
|
+
this.setToolbarSize();
|
|
1485
|
+
|
|
1486
|
+
if (prevProps.has('index')) {
|
|
1487
|
+
this.updateIndex(this.index);
|
|
1488
|
+
setTimeout(this.handleSlideShow, this.getOption('slideshow') * 1000);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
render() {
|
|
1493
|
+
return $`
|
|
1494
|
+
<slot name="prev" @slotchange=${this.handleArrows}></slot>
|
|
1495
|
+
<div class="container" part="container">
|
|
1496
|
+
<section
|
|
1497
|
+
class="slides"
|
|
1498
|
+
part="slides"
|
|
1499
|
+
@mousedown=${this.swipeStart}
|
|
1500
|
+
@mouseup=${this.swipeEnd}
|
|
1501
|
+
@touchstart=${this.swipeStart}
|
|
1502
|
+
@touchend=${this.swipeEnd}
|
|
1503
|
+
@mouseleave=${this.swipeLeave}
|
|
1504
|
+
>
|
|
1505
|
+
<div class="slider" part="slider" style="width:${this.sliderWidth}; transform:translateX(${this.sliderTranslateX});">
|
|
1506
|
+
<slot name="slides" @slotchange="${this.handleSlotChange}"></slot>
|
|
1507
|
+
</div>
|
|
1508
|
+
</section>
|
|
1509
|
+
${this.makeToolbar()}
|
|
1510
|
+
</div>
|
|
1511
|
+
<slot name="next" @slotchange=${this.handleArrows}></slot>
|
|
1512
|
+
`;
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
swipeStart(event) {
|
|
1516
|
+
this.startX = event.touches ? event.touches[0].pageX : event.pageX;
|
|
1517
|
+
|
|
1518
|
+
this.addEventListener('mousemove', this.swipeMove);
|
|
1519
|
+
this.addEventListener('touchmove', this.swipeMove);
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
swipeEnd(event) {
|
|
1523
|
+
this.updateIndex(this.swipeUpdate(event));
|
|
1524
|
+
this.removeEventListener('mousemove', this.swipeMove, false);
|
|
1525
|
+
this.removeEventListener('touchmove', this.swipeMove, false);
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
swipeUpdate(event) {
|
|
1529
|
+
const pageX = event.changedTouches ? event.changedTouches[0].pageX : event.pageX;
|
|
1530
|
+
const direction = this.startX > pageX ? 'right' : 'left';
|
|
1531
|
+
const threshold = this.slidesElement.offsetWidth / 3;
|
|
1532
|
+
const diff = this.startX - pageX;
|
|
1533
|
+
const shouldUpdate = Math.abs(diff) > threshold;
|
|
1534
|
+
|
|
1535
|
+
let { index } = this;
|
|
1536
|
+
|
|
1537
|
+
if (shouldUpdate && direction === 'right') {
|
|
1538
|
+
index = this.index >= this.slides.length - 1 ? this.index : this.index + 1;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
if (shouldUpdate && direction === 'left') {
|
|
1542
|
+
index = this.index < 1 ? 0 : this.index - 1;
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
return index;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
swipeLeave() {
|
|
1549
|
+
this.updateIndex(this.index);
|
|
1550
|
+
this.removeEventListener('mousemove', this.swipeMove, false);
|
|
1551
|
+
this.removeEventListener('touchmove', this.swipeMove, false);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
setSlideSize() {
|
|
1555
|
+
this.slideWidth = this.containerElement.offsetWidth / this.getOption('perView');
|
|
1556
|
+
|
|
1557
|
+
this.slides.forEach((slide) => {
|
|
1558
|
+
slide.style.marginLeft = `${this.getOption('gap') / 2}px`;
|
|
1559
|
+
slide.style.marginRight = `${this.getOption('gap') / 2}px`;
|
|
1560
|
+
slide.style.width = `${this.slideWidth - this.getOption('gap')}px`;
|
|
1561
|
+
});
|
|
1562
|
+
|
|
1563
|
+
this.sliderWidth = `${this.slideWidth * this.slides.length}px`;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
setToolbarSize() {
|
|
1567
|
+
if (this.inner && this.toolbarElement) {
|
|
1568
|
+
const width = this.slidesElement.offsetWidth;
|
|
1569
|
+
this.toolbarElement.style.width = `${width}px`;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1573
|
+
makeToolbar() {
|
|
1574
|
+
if (this.toolbarSlotElement) {
|
|
1575
|
+
return $`
|
|
1576
|
+
<section class="toolbar" part="toolbar">
|
|
1577
|
+
<slot name="toolbar"></slot>
|
|
1578
|
+
</section>
|
|
1579
|
+
`;
|
|
1580
|
+
}
|
|
1581
|
+
|
|
1582
|
+
return null;
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
handleSlotChange() {
|
|
1586
|
+
const slides = this.querySelectorAll('kemet-carousel-slide');
|
|
1587
|
+
const links = this.querySelectorAll('kemet-carousel-link');
|
|
1588
|
+
|
|
1589
|
+
// handle slides
|
|
1590
|
+
slides.forEach((slide) => {
|
|
1591
|
+
this.slides.push(slide);
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
this.updateInformation();
|
|
1595
|
+
this.total = slides.length;
|
|
1596
|
+
slides[this.index].selected = true;
|
|
1597
|
+
|
|
1598
|
+
// handle links
|
|
1599
|
+
links.forEach((link) => {
|
|
1600
|
+
this.links.push(link);
|
|
1601
|
+
});
|
|
1602
|
+
}
|
|
1603
|
+
|
|
1604
|
+
handleArrows() {
|
|
1605
|
+
this.arrows = true;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
handleFirst() {
|
|
1609
|
+
this.updateIndex(0);
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
handleLast() {
|
|
1613
|
+
this.updateIndex(this.slides.length - 1);
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
handleNext() {
|
|
1617
|
+
let newIndex = this.index + this.getOption('perMove');
|
|
1618
|
+
|
|
1619
|
+
if (newIndex >= this.slides.length) {
|
|
1620
|
+
if (this.getOption('rewind')) {
|
|
1621
|
+
newIndex = 0;
|
|
1622
|
+
} else {
|
|
1623
|
+
newIndex = this.index;
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
this.updateIndex(newIndex);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
handlePrev() {
|
|
1631
|
+
let newIndex = this.index - this.getOption('perMove');
|
|
1632
|
+
|
|
1633
|
+
// send them to the last slide
|
|
1634
|
+
if (newIndex < 0) {
|
|
1635
|
+
if (this.getOption('rewind')) {
|
|
1636
|
+
newIndex = this.slides.length - 1;
|
|
1637
|
+
} else {
|
|
1638
|
+
newIndex = this.index;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
this.updateIndex(newIndex);
|
|
1643
|
+
}
|
|
827
1644
|
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
1645
|
+
updateIndex(newIndex) {
|
|
1646
|
+
let currentSlide = this.slides[this.index];
|
|
1647
|
+
let currentLink = this.links[newIndex];
|
|
831
1648
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1649
|
+
// remove selected from all links
|
|
1650
|
+
this.links.forEach((link) => {
|
|
1651
|
+
link.selected = false;
|
|
1652
|
+
});
|
|
835
1653
|
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1654
|
+
// if current link is invalid assume it's the first link
|
|
1655
|
+
if (!currentLink) {
|
|
1656
|
+
[currentLink] = this.links;
|
|
1657
|
+
}
|
|
839
1658
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1659
|
+
// add selected to current link
|
|
1660
|
+
if (currentLink) {
|
|
1661
|
+
currentLink.selected = true;
|
|
1662
|
+
}
|
|
843
1663
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}
|
|
1664
|
+
if (currentSlide) {
|
|
1665
|
+
currentSlide.setAttribute('aria-hidden', 'true');
|
|
847
1666
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
1667
|
+
// correct for invalid indexes
|
|
1668
|
+
if (newIndex > -1 && newIndex < this.slides.length) {
|
|
1669
|
+
this.index = newIndex;
|
|
1670
|
+
} else {
|
|
1671
|
+
// eslint-disable-next-line no-console
|
|
1672
|
+
console.warn('An invalid index number was entered. The kemet-carousel has been reset to the first slide.');
|
|
1673
|
+
this.index = 0;
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
// move
|
|
1677
|
+
this.goToSlide(this.index);
|
|
1678
|
+
|
|
1679
|
+
// update new slide
|
|
1680
|
+
currentSlide = this.slides[this.index];
|
|
1681
|
+
currentSlide.setAttribute('aria-hidden', 'false');
|
|
1682
|
+
|
|
1683
|
+
this.slides.forEach((slide) => {
|
|
1684
|
+
slide.selected = false;
|
|
1685
|
+
});
|
|
1686
|
+
|
|
1687
|
+
currentSlide.selected = true;
|
|
1688
|
+
|
|
1689
|
+
// notify consumers of slide change
|
|
854
1690
|
|
|
855
|
-
static get properties() {
|
|
856
|
-
return {
|
|
857
|
-
/**
|
|
858
|
-
* The status of the badge
|
|
859
|
-
*/
|
|
860
|
-
status: {
|
|
861
|
-
type: String,
|
|
862
|
-
reflect: true,
|
|
863
|
-
},
|
|
864
|
-
/**
|
|
865
|
-
* Displays the badge in a circle
|
|
866
|
-
*/
|
|
867
|
-
circle: {
|
|
868
|
-
type: Boolean,
|
|
869
|
-
reflect: true,
|
|
870
|
-
},
|
|
871
|
-
/**
|
|
872
|
-
* Rounds the corners on the badge
|
|
873
|
-
*/
|
|
874
|
-
pill: {
|
|
875
|
-
type: Boolean,
|
|
876
|
-
reflect: true,
|
|
877
|
-
},
|
|
878
1691
|
/**
|
|
879
|
-
*
|
|
1692
|
+
* Fires with the a slide has begun to change
|
|
880
1693
|
*/
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1694
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-change-start', {
|
|
1695
|
+
bubbles: true,
|
|
1696
|
+
composed: true,
|
|
1697
|
+
detail: this,
|
|
1698
|
+
}));
|
|
1699
|
+
|
|
1700
|
+
// update information element
|
|
1701
|
+
this.updateInformation();
|
|
1702
|
+
}
|
|
886
1703
|
}
|
|
887
1704
|
|
|
888
|
-
|
|
889
|
-
|
|
1705
|
+
updateInformation() {
|
|
1706
|
+
this.informationSlot = this.slides[this.index].querySelector('[slot="information"]');
|
|
890
1707
|
|
|
891
|
-
this.
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1708
|
+
if (this.informationElement) {
|
|
1709
|
+
if (this.informationSlot) {
|
|
1710
|
+
this.informationElement.innerHTML = this.informationSlot.outerHTML;
|
|
1711
|
+
} else {
|
|
1712
|
+
this.informationElement.innerHTML = '';
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
895
1715
|
}
|
|
896
1716
|
|
|
897
|
-
|
|
898
|
-
|
|
1717
|
+
goToSlide(index) {
|
|
1718
|
+
if (this.getOption('center') === true) {
|
|
1719
|
+
const slidesCenter = this.slidesElement.offsetWidth / 2;
|
|
1720
|
+
const slideX = this.slideWidth * index;
|
|
1721
|
+
this.sliderTranslateX = `${slideX - (slideX - slidesCenter) - this.slideWidth / 2 - slideX}px`;
|
|
1722
|
+
} else {
|
|
1723
|
+
this.sliderTranslateX = `${(this.slideWidth * index) * -1}px`;
|
|
1724
|
+
}
|
|
899
1725
|
}
|
|
900
1726
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1727
|
+
handleTransitionEnd() {
|
|
1728
|
+
const currentElement = this.querySelector('kemet-carousel-current');
|
|
1729
|
+
|
|
1730
|
+
if (currentElement) {
|
|
1731
|
+
currentElement.current = this.index + 1;
|
|
905
1732
|
}
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Fires when a slide has changed and finished animating
|
|
1736
|
+
*/
|
|
1737
|
+
this.dispatchEvent(new CustomEvent('kemet-carousel-change-finished', {
|
|
1738
|
+
bubbles: true,
|
|
1739
|
+
composed: true,
|
|
1740
|
+
detail: this,
|
|
1741
|
+
}));
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
handleLink(event) {
|
|
1745
|
+
this.updateIndex(event.detail.slide);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
getOption(option) {
|
|
1749
|
+
const breakpoints = Object.keys(this.breakpoints);
|
|
1750
|
+
let value = this.options[option];
|
|
1751
|
+
|
|
1752
|
+
breakpoints.forEach((breakpoint) => {
|
|
1753
|
+
if (window.matchMedia(`(min-width: ${breakpoint}px)`).matches && this.breakpoints[breakpoint][option] !== undefined) {
|
|
1754
|
+
value = this.breakpoints[breakpoint][option];
|
|
1755
|
+
}
|
|
1756
|
+
|
|
1757
|
+
return value;
|
|
1758
|
+
});
|
|
1759
|
+
|
|
1760
|
+
return value;
|
|
906
1761
|
}
|
|
907
1762
|
}
|
|
908
1763
|
|
|
909
1764
|
// eslint-disable-next-line no-unused-expressions
|
|
910
|
-
customElements.get('kemet-
|
|
1765
|
+
customElements.get('kemet-carousel') || customElements.define('kemet-carousel', KemetCarousel);
|
|
911
1766
|
|
|
912
1767
|
/**
|
|
913
1768
|
* @license
|
|
@@ -2087,26 +2942,234 @@ class KemetDrawer extends s$1 {
|
|
|
2087
2942
|
}
|
|
2088
2943
|
}
|
|
2089
2944
|
|
|
2090
|
-
render() {
|
|
2091
|
-
return $`
|
|
2092
|
-
<section class="off-canvas" part="container">
|
|
2093
|
-
<nav class="off-canvas__nav" part="drawer" title="Drawer">
|
|
2094
|
-
<slot name="navigation"></slot>
|
|
2095
|
-
</nav>
|
|
2096
|
-
<div class="off-canvas__pusher" part="pusher">
|
|
2097
|
-
<main class="off-canvas__content" part="content">
|
|
2098
|
-
<div class="off-canvas__wrapper" part="wrapper">
|
|
2099
|
-
<slot name="content"></slot>
|
|
2100
|
-
</div>
|
|
2101
|
-
</main>
|
|
2102
|
-
</div>
|
|
2103
|
-
</section>
|
|
2104
|
-
`;
|
|
2945
|
+
render() {
|
|
2946
|
+
return $`
|
|
2947
|
+
<section class="off-canvas" part="container">
|
|
2948
|
+
<nav class="off-canvas__nav" part="drawer" title="Drawer">
|
|
2949
|
+
<slot name="navigation"></slot>
|
|
2950
|
+
</nav>
|
|
2951
|
+
<div class="off-canvas__pusher" part="pusher">
|
|
2952
|
+
<main class="off-canvas__content" part="content">
|
|
2953
|
+
<div class="off-canvas__wrapper" part="wrapper">
|
|
2954
|
+
<slot name="content"></slot>
|
|
2955
|
+
</div>
|
|
2956
|
+
</main>
|
|
2957
|
+
</div>
|
|
2958
|
+
</section>
|
|
2959
|
+
`;
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
|
|
2963
|
+
// eslint-disable-next-line no-unused-expressions
|
|
2964
|
+
customElements.get('kemet-drawer') || customElements.define('kemet-drawer', KemetDrawer);
|
|
2965
|
+
|
|
2966
|
+
class KemetFAB extends s$1 {
|
|
2967
|
+
static get styles() {
|
|
2968
|
+
return [
|
|
2969
|
+
r$3`
|
|
2970
|
+
:host {
|
|
2971
|
+
--kemet-fab-size: 50px;
|
|
2972
|
+
|
|
2973
|
+
display: inline-block;
|
|
2974
|
+
position: relative;
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
button {
|
|
2978
|
+
color: var(--kemet-fab-color, var(--kemet-color-white));
|
|
2979
|
+
font-size: inherit;
|
|
2980
|
+
display: inline-flex;
|
|
2981
|
+
padding: 0;
|
|
2982
|
+
position: relative;
|
|
2983
|
+
min-height: var(--kemet-fab-size);
|
|
2984
|
+
min-width: var(--kemet-fab-size);
|
|
2985
|
+
max-width: var(--kemet-fab-size);
|
|
2986
|
+
align-items: center;
|
|
2987
|
+
justify-content: flex-start;
|
|
2988
|
+
transition: all 0.4s ease;
|
|
2989
|
+
border: none;
|
|
2990
|
+
background-color: var(--kemet-fab-background-color, var(--kemet-color-primary));
|
|
2991
|
+
}
|
|
2992
|
+
|
|
2993
|
+
:host([outlined]) button {
|
|
2994
|
+
color: var(--kemet-fab-outlined-color, var(--kemet-color-primary));
|
|
2995
|
+
border: var(--kemet-fab-outlined-border, 1px solid var(--kemet-color-primary));
|
|
2996
|
+
background-color: transparent;
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
:host([pill]) button {
|
|
3000
|
+
border-radius: var(--kemet-fab-pill-radius, 10rem);
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
button::before {
|
|
3004
|
+
content: '';
|
|
3005
|
+
position: absolute;
|
|
3006
|
+
top: 0;
|
|
3007
|
+
left: 0;
|
|
3008
|
+
right: 0;
|
|
3009
|
+
bottom: 0;
|
|
3010
|
+
z-index: -1;
|
|
3011
|
+
width: 100%;
|
|
3012
|
+
height: 100%;
|
|
3013
|
+
transition: background-color 0.3s ease-in-out;
|
|
3014
|
+
background-color: var(--kemet-fab-background-color, var(--kemet-color-primary));
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3017
|
+
:host([pill]) button::before {
|
|
3018
|
+
border-radius: var(--kemet-fab-pill-radius, 10rem);
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
:host([outlined]) button::before {
|
|
3022
|
+
border: var(--kemet-fab-outline-border, 1px solid var(--kemet-color-primary));
|
|
3023
|
+
background-color: transparent;
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
:host([expanded]) button {
|
|
3027
|
+
max-width: 99rem;
|
|
3028
|
+
padding: 0 1.35rem 0 0.25rem;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
:host([disabled]) button {
|
|
3032
|
+
opacity: 0.5;
|
|
3033
|
+
cursor: not-allowed;
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
.icon {
|
|
3037
|
+
width: var(--kemet-fab-size);
|
|
3038
|
+
height: var(--kemet-fab-size);
|
|
3039
|
+
display: flex;
|
|
3040
|
+
flex: 0 0 auto;
|
|
3041
|
+
align-items: center;
|
|
3042
|
+
justify-content: center;
|
|
3043
|
+
}
|
|
3044
|
+
|
|
3045
|
+
.text {
|
|
3046
|
+
color: var(--kemet-fab-color, var(--kemet-color-white));
|
|
3047
|
+
z-index: 1;
|
|
3048
|
+
white-space: nowrap;
|
|
3049
|
+
pointer-events: none;
|
|
3050
|
+
opacity: 0;
|
|
3051
|
+
transition: opacity 0.2s ease-in-out;
|
|
3052
|
+
}
|
|
3053
|
+
|
|
3054
|
+
:host([outlined]) .text {
|
|
3055
|
+
color: var(--kemet-fab-outlined-color, var(--kemet-color-primary));
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
:host([expanded]) .text {
|
|
3059
|
+
opacity: 1;
|
|
3060
|
+
}
|
|
3061
|
+
`,
|
|
3062
|
+
];
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
static get properties() {
|
|
3066
|
+
return {
|
|
3067
|
+
/**
|
|
3068
|
+
* The expanded state of the button
|
|
3069
|
+
*/
|
|
3070
|
+
expanded: {
|
|
3071
|
+
type: Boolean,
|
|
3072
|
+
reflect: true,
|
|
3073
|
+
},
|
|
3074
|
+
/**
|
|
3075
|
+
* Outline style for a button
|
|
3076
|
+
*/
|
|
3077
|
+
outlined: {
|
|
3078
|
+
type: Boolean,
|
|
3079
|
+
reflect: true,
|
|
3080
|
+
},
|
|
3081
|
+
/**
|
|
3082
|
+
* Determines whether not a button is disabled
|
|
3083
|
+
*/
|
|
3084
|
+
disabled: {
|
|
3085
|
+
type: Boolean,
|
|
3086
|
+
reflect: true,
|
|
3087
|
+
},
|
|
3088
|
+
/**
|
|
3089
|
+
* Displays the fab with rounded corners
|
|
3090
|
+
*/
|
|
3091
|
+
pill: {
|
|
3092
|
+
type: Boolean,
|
|
3093
|
+
reflect: true,
|
|
3094
|
+
},
|
|
3095
|
+
/**
|
|
3096
|
+
* The distance, in pixels, where the fab should automatically expand
|
|
3097
|
+
*/
|
|
3098
|
+
expandPoint: {
|
|
3099
|
+
type: Number,
|
|
3100
|
+
attribute: 'expand-point',
|
|
3101
|
+
},
|
|
3102
|
+
/**
|
|
3103
|
+
* The distance, in pixels, where the fab should automatically collapse
|
|
3104
|
+
*/
|
|
3105
|
+
collapsePoint: {
|
|
3106
|
+
type: Number,
|
|
3107
|
+
attribute: 'collapse-point',
|
|
3108
|
+
},
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
constructor() {
|
|
3113
|
+
super();
|
|
3114
|
+
|
|
3115
|
+
this.outlined = false;
|
|
3116
|
+
this.disabled = false;
|
|
3117
|
+
this.expanded = false;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3120
|
+
firstUpdated() {
|
|
3121
|
+
// events
|
|
3122
|
+
window.addEventListener('scroll', this.handleScroll.bind(this));
|
|
3123
|
+
this.addEventListener('mouseover', this.handleMouseOver.bind(this));
|
|
3124
|
+
this.addEventListener('mouseout', this.handleMouseOut.bind(this));
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
render() {
|
|
3128
|
+
return $`
|
|
3129
|
+
<button class="button" part="button" ?disabled=${this.disabled} aria-disabled=${this.disabled ? 'true' : 'false'}>
|
|
3130
|
+
<span class="icon" part="icon">
|
|
3131
|
+
<slot name="icon"></slot>
|
|
3132
|
+
</span>
|
|
3133
|
+
<span class="text" part="text">
|
|
3134
|
+
<slot></slot>
|
|
3135
|
+
</span>
|
|
3136
|
+
</button>
|
|
3137
|
+
`;
|
|
3138
|
+
}
|
|
3139
|
+
|
|
3140
|
+
handleMouseOver() {
|
|
3141
|
+
if (!this.disabled) {
|
|
3142
|
+
this.expanded = true;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
handleMouseOut() {
|
|
3147
|
+
if (!this.disabled) {
|
|
3148
|
+
this.expanded = false;
|
|
3149
|
+
}
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
handleScroll() {
|
|
3153
|
+
if (window.scrollY > this.expandPoint) {
|
|
3154
|
+
this.expanded = true;
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
if (window.scrollY < this.expandPoint) {
|
|
3158
|
+
this.expanded = false;
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
if (window.scrollY > this.collapsePoint) {
|
|
3162
|
+
this.expanded = false;
|
|
3163
|
+
}
|
|
3164
|
+
|
|
3165
|
+
if (window.scrollY < this.collapsePoint) {
|
|
3166
|
+
this.expanded = true;
|
|
3167
|
+
}
|
|
2105
3168
|
}
|
|
2106
3169
|
}
|
|
2107
3170
|
|
|
2108
3171
|
// eslint-disable-next-line no-unused-expressions
|
|
2109
|
-
customElements.get('kemet-
|
|
3172
|
+
customElements.get('kemet-fab') || customElements.define('kemet-fab', KemetFAB);
|
|
2110
3173
|
|
|
2111
3174
|
class KemetField extends s$1 {
|
|
2112
3175
|
static get styles() {
|
|
@@ -2889,6 +3952,13 @@ class KemetInput extends s$1 {
|
|
|
2889
3952
|
inputType: {
|
|
2890
3953
|
type: String,
|
|
2891
3954
|
},
|
|
3955
|
+
/**
|
|
3956
|
+
* Determines if the input is focused
|
|
3957
|
+
*/
|
|
3958
|
+
focused: {
|
|
3959
|
+
type: Boolean,
|
|
3960
|
+
reflect: true,
|
|
3961
|
+
},
|
|
2892
3962
|
};
|
|
2893
3963
|
}
|
|
2894
3964
|
|
|
@@ -2903,6 +3973,7 @@ class KemetInput extends s$1 {
|
|
|
2903
3973
|
this.iconSize = 20;
|
|
2904
3974
|
this.validateOnBlur = false;
|
|
2905
3975
|
this.isPasswordVisible = false;
|
|
3976
|
+
this.focused = false;
|
|
2906
3977
|
|
|
2907
3978
|
/**
|
|
2908
3979
|
* Used only for form reactive controller
|
|
@@ -2916,6 +3987,10 @@ class KemetInput extends s$1 {
|
|
|
2916
3987
|
this.field = this.closest('kemet-field');
|
|
2917
3988
|
this.form = this.closest('form');
|
|
2918
3989
|
this.slug = this.field ? this.field.slug : 'input';
|
|
3990
|
+
|
|
3991
|
+
if (this.field) {
|
|
3992
|
+
this.field.addEventListener('fmc-password-status', event => this.handleStatus(event));
|
|
3993
|
+
}
|
|
2919
3994
|
}
|
|
2920
3995
|
|
|
2921
3996
|
render() {
|
|
@@ -3030,7 +4105,7 @@ class KemetInput extends s$1 {
|
|
|
3030
4105
|
* @private
|
|
3031
4106
|
*/
|
|
3032
4107
|
handleFocus() {
|
|
3033
|
-
this.
|
|
4108
|
+
this.focused = true;
|
|
3034
4109
|
|
|
3035
4110
|
/**
|
|
3036
4111
|
* Fires when the input receives and loses focus
|
|
@@ -3054,7 +4129,7 @@ class KemetInput extends s$1 {
|
|
|
3054
4129
|
this.validity = this.input.validity;
|
|
3055
4130
|
}
|
|
3056
4131
|
|
|
3057
|
-
this.
|
|
4132
|
+
this.focused = false;
|
|
3058
4133
|
|
|
3059
4134
|
/**
|
|
3060
4135
|
* Fires when the input receives and loses focus
|
|
@@ -3104,8 +4179,7 @@ class KemetInput extends s$1 {
|
|
|
3104
4179
|
* Handles when the input receives input
|
|
3105
4180
|
* @private
|
|
3106
4181
|
*/
|
|
3107
|
-
handleInput(
|
|
3108
|
-
this.inputType = e.inputType;
|
|
4182
|
+
handleInput() {
|
|
3109
4183
|
this.value = this.input.value;
|
|
3110
4184
|
|
|
3111
4185
|
/**
|
|
@@ -3596,66 +4670,343 @@ class KemetModal extends s$1 {
|
|
|
3596
4670
|
this.focusableElements[0].focus();
|
|
3597
4671
|
}, 100);
|
|
3598
4672
|
|
|
3599
|
-
/**
|
|
3600
|
-
* Fires when the modal opens
|
|
3601
|
-
*/
|
|
3602
|
-
this.dispatchEvent(
|
|
3603
|
-
new CustomEvent('kemet-modal-opened', {
|
|
3604
|
-
bubbles: true,
|
|
3605
|
-
composed: true,
|
|
3606
|
-
detail: this,
|
|
3607
|
-
}),
|
|
3608
|
-
);
|
|
3609
|
-
}
|
|
4673
|
+
/**
|
|
4674
|
+
* Fires when the modal opens
|
|
4675
|
+
*/
|
|
4676
|
+
this.dispatchEvent(
|
|
4677
|
+
new CustomEvent('kemet-modal-opened', {
|
|
4678
|
+
bubbles: true,
|
|
4679
|
+
composed: true,
|
|
4680
|
+
detail: this,
|
|
4681
|
+
}),
|
|
4682
|
+
);
|
|
4683
|
+
}
|
|
4684
|
+
|
|
4685
|
+
if (prevProps.get('opened') && this.opened === false) {
|
|
4686
|
+
/**
|
|
4687
|
+
* Fires when the modal closes
|
|
4688
|
+
*/
|
|
4689
|
+
this.dispatchEvent(
|
|
4690
|
+
new CustomEvent('kemet-modal-closed', {
|
|
4691
|
+
bubbles: true,
|
|
4692
|
+
composed: true,
|
|
4693
|
+
detail: this,
|
|
4694
|
+
}),
|
|
4695
|
+
);
|
|
4696
|
+
}
|
|
4697
|
+
|
|
4698
|
+
this.isMobile();
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4701
|
+
render() {
|
|
4702
|
+
return $`
|
|
4703
|
+
<div class="content" part="content">
|
|
4704
|
+
<slot></slot>
|
|
4705
|
+
</div>
|
|
4706
|
+
<div class="overlay" part="overlay"></div>
|
|
4707
|
+
`;
|
|
4708
|
+
}
|
|
4709
|
+
|
|
4710
|
+
isMobile() {
|
|
4711
|
+
const mediaQuery = window.matchMedia(`(max-width: ${this.breakpoint})`);
|
|
4712
|
+
this.mobile = mediaQuery.matches;
|
|
4713
|
+
}
|
|
4714
|
+
|
|
4715
|
+
handleFocusableDown(event) {
|
|
4716
|
+
const firstFocusable = this.focusableElements[0];
|
|
4717
|
+
const lastFocusable = this.focusableElements[this.focusableElements.length - 1];
|
|
4718
|
+
|
|
4719
|
+
if (event.key === 'Tab') {
|
|
4720
|
+
if (event.shiftKey && document.activeElement === firstFocusable) {
|
|
4721
|
+
event.preventDefault();
|
|
4722
|
+
lastFocusable.focus();
|
|
4723
|
+
} else if (!event.shiftKey && document.activeElement === lastFocusable) {
|
|
4724
|
+
event.preventDefault();
|
|
4725
|
+
firstFocusable.focus();
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
}
|
|
4730
|
+
|
|
4731
|
+
// eslint-disable-next-line no-unused-expressions
|
|
4732
|
+
customElements.get('kemet-modal') || customElements.define('kemet-modal', KemetModal);
|
|
4733
|
+
|
|
4734
|
+
class KemetPassword extends s$1 {
|
|
4735
|
+
static get styles() {
|
|
4736
|
+
return [
|
|
4737
|
+
r$3`
|
|
4738
|
+
:host {
|
|
4739
|
+
color: inherit;
|
|
4740
|
+
display: none;
|
|
4741
|
+
}
|
|
4742
|
+
|
|
4743
|
+
:host([show]) {
|
|
4744
|
+
display: block;
|
|
4745
|
+
}
|
|
4746
|
+
|
|
4747
|
+
p {
|
|
4748
|
+
margin: 1.6rem 0;
|
|
4749
|
+
}
|
|
4750
|
+
|
|
4751
|
+
.status {
|
|
4752
|
+
display: grid;
|
|
4753
|
+
align-items: center;
|
|
4754
|
+
grid-template-columns: 1fr auto;
|
|
4755
|
+
line-height: 1;
|
|
4756
|
+
margin-top: 0.8rem;
|
|
4757
|
+
}
|
|
4758
|
+
|
|
4759
|
+
.status > span {
|
|
4760
|
+
text-transform: capitalize;
|
|
4761
|
+
}
|
|
4762
|
+
|
|
4763
|
+
.status--weak,
|
|
4764
|
+
.status--better {
|
|
4765
|
+
color: var(--kemet-color-error);
|
|
4766
|
+
}
|
|
4767
|
+
|
|
4768
|
+
.status--strong {
|
|
4769
|
+
color: var(--kemet-color-success);
|
|
4770
|
+
}
|
|
4771
|
+
|
|
4772
|
+
.indicator {
|
|
4773
|
+
display: flex;
|
|
4774
|
+
gap: 0.4rem;
|
|
4775
|
+
margin: 0;
|
|
4776
|
+
list-style: none;
|
|
4777
|
+
}
|
|
4778
|
+
|
|
4779
|
+
.indicator li {
|
|
4780
|
+
width: 1.6rem;
|
|
4781
|
+
height: 0.2rem;
|
|
4782
|
+
background-color: var(--fds-color--gray2);
|
|
4783
|
+
}
|
|
4784
|
+
|
|
4785
|
+
.status--weak .indicator li:nth-child(1) {
|
|
4786
|
+
background-color: var(--kemet-color-error);
|
|
4787
|
+
}
|
|
4788
|
+
|
|
4789
|
+
.status--better .indicator li:nth-child(1),
|
|
4790
|
+
.status--better .indicator li:nth-child(2) {
|
|
4791
|
+
background-color: var(--kemet-color-error);
|
|
4792
|
+
}
|
|
4793
|
+
|
|
4794
|
+
.status--strong .indicator li {
|
|
4795
|
+
background-color: var(--kemet-color-success);
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4798
|
+
.rules {
|
|
4799
|
+
color: var(--kemet-color-primary);
|
|
4800
|
+
list-style: none;
|
|
4801
|
+
font-size: 90%;
|
|
4802
|
+
padding-left: 2rem;
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4805
|
+
.rules li {
|
|
4806
|
+
position: relative;
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
.rules kemet-icon {
|
|
4810
|
+
color: var(--kemet-color-success);
|
|
4811
|
+
position: absolute;
|
|
4812
|
+
left: -2.4rem;
|
|
4813
|
+
}
|
|
4814
|
+
`,
|
|
4815
|
+
];
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4818
|
+
static get properties() {
|
|
4819
|
+
return {
|
|
4820
|
+
/**
|
|
4821
|
+
* An array of objects containing the rules the password must meet
|
|
4822
|
+
*/
|
|
4823
|
+
rules: {
|
|
4824
|
+
type: Array,
|
|
4825
|
+
},
|
|
4826
|
+
/**
|
|
4827
|
+
* Controls the display of the component
|
|
4828
|
+
*/
|
|
4829
|
+
show: {
|
|
4830
|
+
type: Boolean,
|
|
4831
|
+
reflect: true,
|
|
4832
|
+
},
|
|
4833
|
+
/**
|
|
4834
|
+
* The value of the input component
|
|
4835
|
+
*/
|
|
4836
|
+
value: {
|
|
4837
|
+
type: String,
|
|
4838
|
+
},
|
|
4839
|
+
/**
|
|
4840
|
+
* A message that is above the rules
|
|
4841
|
+
*/
|
|
4842
|
+
message: {
|
|
4843
|
+
type: String,
|
|
4844
|
+
},
|
|
4845
|
+
/**
|
|
4846
|
+
* The strength of the password. Weak | Better | Strong
|
|
4847
|
+
*/
|
|
4848
|
+
strength: {
|
|
4849
|
+
type: String,
|
|
4850
|
+
},
|
|
4851
|
+
icon: {
|
|
4852
|
+
type: String,
|
|
4853
|
+
},
|
|
4854
|
+
iconSize: {
|
|
4855
|
+
type: Number,
|
|
4856
|
+
},
|
|
4857
|
+
};
|
|
4858
|
+
}
|
|
4859
|
+
|
|
4860
|
+
constructor() {
|
|
4861
|
+
super();
|
|
4862
|
+
|
|
4863
|
+
// managed properties
|
|
4864
|
+
this.rules = [
|
|
4865
|
+
{ pattern: '(?=.{8,}$)', message: 'At least 8 characters long' },
|
|
4866
|
+
{ pattern: '(?=.*[a-z])(?=.*[A-Z])', message: 'Uppercase and lowercase' },
|
|
4867
|
+
{ pattern: '(?=.*[0-9])', message: 'At least one number (0-9)' },
|
|
4868
|
+
];
|
|
4869
|
+
this.message = 'Please make sure you meet all the requirements.';
|
|
4870
|
+
this.icon = 'check2';
|
|
4871
|
+
this.iconSize = 16;
|
|
4872
|
+
}
|
|
4873
|
+
|
|
4874
|
+
firstUpdated() {
|
|
4875
|
+
// standard properties
|
|
4876
|
+
this.field = this.closest('kemet-field');
|
|
4877
|
+
this.input = this.field.querySelector('[slot="input"]');
|
|
4878
|
+
|
|
4879
|
+
// managed properties
|
|
4880
|
+
this.slug = this.field.slug;
|
|
4881
|
+
|
|
4882
|
+
// events listeners
|
|
4883
|
+
this.input.addEventListener('kemet-input-input', this.handleInput.bind(this));
|
|
4884
|
+
}
|
|
4885
|
+
|
|
4886
|
+
render() {
|
|
4887
|
+
return $`
|
|
4888
|
+
<div role="alert" aria-live="assertive">
|
|
4889
|
+
<div class="status status--${this.strength}" part="status">
|
|
4890
|
+
<span>${this.strength}</span>
|
|
4891
|
+
<ul class="indicator" part="indicator">
|
|
4892
|
+
<li></li>
|
|
4893
|
+
<li></li>
|
|
4894
|
+
<li></li>
|
|
4895
|
+
</ul>
|
|
4896
|
+
</div>
|
|
4897
|
+
<p class="message" part="message">${this.message}</p>
|
|
4898
|
+
<ul class="rules" part="rules">
|
|
4899
|
+
${this.makeRules()}
|
|
4900
|
+
</ul>
|
|
4901
|
+
</div>
|
|
4902
|
+
`;
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4905
|
+
/**
|
|
4906
|
+
* Makes the list of rules
|
|
4907
|
+
* @private
|
|
4908
|
+
* @returns {templateResults} the criteria rules
|
|
4909
|
+
*/
|
|
4910
|
+
makeRules() {
|
|
4911
|
+
if (this.input) {
|
|
4912
|
+
const rules = this.rules.map((rule, index) => {
|
|
4913
|
+
const regExp = new RegExp(rule.pattern);
|
|
4914
|
+
const meetsCriteria = regExp.test(this.input.value);
|
|
4915
|
+
this.rules[index].meetsCriteria = meetsCriteria;
|
|
4916
|
+
return $`<li>${this.makeCheckIcon(meetsCriteria)} ${rule.message}</li>`;
|
|
4917
|
+
});
|
|
4918
|
+
|
|
4919
|
+
return rules;
|
|
4920
|
+
}
|
|
4921
|
+
|
|
4922
|
+
return null;
|
|
4923
|
+
}
|
|
4924
|
+
|
|
4925
|
+
/**
|
|
4926
|
+
* Makes the check icon if the criteria has been met
|
|
4927
|
+
* @param {boolean} meetsCriteria
|
|
4928
|
+
* @private
|
|
4929
|
+
* @returns {templateResults} an icon component
|
|
4930
|
+
*/
|
|
4931
|
+
makeCheckIcon(meetsCriteria) {
|
|
4932
|
+
if (meetsCriteria) {
|
|
4933
|
+
return $`<kemet-icon icon=${this.icon} size=${this.iconSize}></kemet-icon>`;
|
|
4934
|
+
}
|
|
4935
|
+
|
|
4936
|
+
return null;
|
|
4937
|
+
}
|
|
4938
|
+
|
|
4939
|
+
/**
|
|
4940
|
+
* Handles the kemet-input-input event
|
|
4941
|
+
* @param {*} event
|
|
4942
|
+
* @private
|
|
4943
|
+
*/
|
|
4944
|
+
handleInput(event) {
|
|
4945
|
+
this.value = event.detail;
|
|
4946
|
+
this.setStrength();
|
|
4947
|
+
this.visibility();
|
|
4948
|
+
}
|
|
4949
|
+
|
|
4950
|
+
/**
|
|
4951
|
+
* Determines the strength of the password
|
|
4952
|
+
* @private
|
|
4953
|
+
*/
|
|
4954
|
+
setStrength() {
|
|
4955
|
+
// We use a setTimeout here because makeRules adds the meetsCriteria
|
|
4956
|
+
// property to the rules. We need that to be set by render() before
|
|
4957
|
+
// setting the Strength because the percentage calc is based on it
|
|
4958
|
+
setTimeout(() => {
|
|
4959
|
+
const totalRules = this.rules.length;
|
|
4960
|
+
const metRules = this.rules.filter(rule => rule.meetsCriteria).length;
|
|
4961
|
+
const metRulesPercentage = Math.round((metRules / totalRules) * 100) / 100;
|
|
4962
|
+
|
|
4963
|
+
if (metRulesPercentage <= 0.33) {
|
|
4964
|
+
this.strength = 'weak';
|
|
4965
|
+
this.status = 'error';
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
if (metRulesPercentage > 0.33 && metRulesPercentage <= 0.67) {
|
|
4969
|
+
this.strength = 'better';
|
|
4970
|
+
this.status = 'error';
|
|
4971
|
+
}
|
|
4972
|
+
|
|
4973
|
+
if (metRulesPercentage > 0.67) {
|
|
4974
|
+
this.strength = 'strong';
|
|
4975
|
+
this.status = 'success';
|
|
4976
|
+
}
|
|
3610
4977
|
|
|
3611
|
-
if (prevProps.get('opened') && this.opened === false) {
|
|
3612
4978
|
/**
|
|
3613
|
-
* Fires when
|
|
4979
|
+
* Fires when there's a change in status.
|
|
3614
4980
|
*/
|
|
3615
4981
|
this.dispatchEvent(
|
|
3616
|
-
new CustomEvent('kemet-
|
|
4982
|
+
new CustomEvent('kemet-password-status', {
|
|
3617
4983
|
bubbles: true,
|
|
3618
4984
|
composed: true,
|
|
3619
|
-
detail:
|
|
4985
|
+
detail: {
|
|
4986
|
+
status: this.status,
|
|
4987
|
+
validity: { meetsPasswordCriteria: this.status === 'success' },
|
|
4988
|
+
element: this,
|
|
4989
|
+
},
|
|
3620
4990
|
}),
|
|
3621
4991
|
);
|
|
3622
|
-
}
|
|
3623
|
-
|
|
3624
|
-
this.isMobile();
|
|
3625
|
-
}
|
|
3626
|
-
|
|
3627
|
-
render() {
|
|
3628
|
-
return $`
|
|
3629
|
-
<div class="content" part="content">
|
|
3630
|
-
<slot></slot>
|
|
3631
|
-
</div>
|
|
3632
|
-
<div class="overlay" part="overlay"></div>
|
|
3633
|
-
`;
|
|
3634
|
-
}
|
|
3635
|
-
|
|
3636
|
-
isMobile() {
|
|
3637
|
-
const mediaQuery = window.matchMedia(`(max-width: ${this.breakpoint})`);
|
|
3638
|
-
this.mobile = mediaQuery.matches;
|
|
4992
|
+
}, 1);
|
|
3639
4993
|
}
|
|
3640
4994
|
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
event.preventDefault();
|
|
3651
|
-
firstFocusable.focus();
|
|
3652
|
-
}
|
|
4995
|
+
/**
|
|
4996
|
+
* Determines whether to show or hide the component
|
|
4997
|
+
* @private
|
|
4998
|
+
*/
|
|
4999
|
+
visibility() {
|
|
5000
|
+
if (this.value.length > 0) {
|
|
5001
|
+
this.show = true;
|
|
5002
|
+
} else {
|
|
5003
|
+
this.show = false;
|
|
3653
5004
|
}
|
|
3654
5005
|
}
|
|
3655
5006
|
}
|
|
3656
5007
|
|
|
3657
5008
|
// eslint-disable-next-line no-unused-expressions
|
|
3658
|
-
customElements.get('kemet-
|
|
5009
|
+
customElements.get('kemet-password') || customElements.define('kemet-password', KemetPassword);
|
|
3659
5010
|
|
|
3660
5011
|
const keyCodes$1 = {
|
|
3661
5012
|
ENTER: 13,
|
|
@@ -7899,4 +9250,317 @@ class KemetToggle extends s$1 {
|
|
|
7899
9250
|
// eslint-disable-next-line no-unused-expressions
|
|
7900
9251
|
customElements.get('kemet-toggle') || customElements.define('kemet-toggle', KemetToggle);
|
|
7901
9252
|
|
|
7902
|
-
|
|
9253
|
+
class KemetTrackerStep extends s$1 {
|
|
9254
|
+
static get styles() {
|
|
9255
|
+
return [
|
|
9256
|
+
r$3`
|
|
9257
|
+
:host {
|
|
9258
|
+
--kemet-tracker-step-dot-size: 50px;
|
|
9259
|
+
--kemet-tracker-step-dot-size-mobile: 25px;
|
|
9260
|
+
--kemet-tracker-step-dot-gap: 4px;
|
|
9261
|
+
--kemet-tracker-step-standard-line-weight: 1px;
|
|
9262
|
+
--kemet-tracker-step-completed-line-weight: 3px;
|
|
9263
|
+
--kemet-tracker-step-dot-transition: all 300ms ease-in-out;
|
|
9264
|
+
|
|
9265
|
+
position: relative;
|
|
9266
|
+
width: 100%;
|
|
9267
|
+
text-align: center;
|
|
9268
|
+
}
|
|
9269
|
+
|
|
9270
|
+
.dot {
|
|
9271
|
+
font-size: var(--kemet-tracker-step-dot-font-size, 90%);
|
|
9272
|
+
color: var(--kemet-tracker-step-dot-color, var(--kemet-color-primary));
|
|
9273
|
+
display: flex;
|
|
9274
|
+
align-items: center;
|
|
9275
|
+
justify-content: center;
|
|
9276
|
+
margin: 0 auto;
|
|
9277
|
+
position: relative;
|
|
9278
|
+
z-index: 1;
|
|
9279
|
+
width: var(--kemet-tracker-step-dot-size);
|
|
9280
|
+
height: var(--kemet-tracker-step-dot-size);
|
|
9281
|
+
border-radius: 100%;
|
|
9282
|
+
transition: var(--kemet-tracker-step-dot-transition);
|
|
9283
|
+
background-color: var(--kemet-tracker-step-dot-background-color, var(--kemet-color-white));
|
|
9284
|
+
}
|
|
9285
|
+
|
|
9286
|
+
.dot::after {
|
|
9287
|
+
content: "";
|
|
9288
|
+
width: unset;
|
|
9289
|
+
height: unset;
|
|
9290
|
+
position: absolute;
|
|
9291
|
+
top: var(--kemet-tracker-step-dot-gap);
|
|
9292
|
+
left: var(--kemet-tracker-step-dot-gap);
|
|
9293
|
+
right: var(--kemet-tracker-step-dot-gap);
|
|
9294
|
+
bottom: var(--kemet-tracker-step-dot-gap);
|
|
9295
|
+
z-index: -1;
|
|
9296
|
+
border-radius: 100%;
|
|
9297
|
+
transition: var(--kemet-tracker-step-dot-transition);
|
|
9298
|
+
border: var(--kemet-tracker-step-dot-border, 1px solid var(--kemet-color-primary));
|
|
9299
|
+
background-color: var(--kemet-tracker-step-dot-fill-color, transparent);
|
|
9300
|
+
}
|
|
9301
|
+
|
|
9302
|
+
:host([completed]) .dot {
|
|
9303
|
+
color: var(--kemet-tracker-step-completed-color, var(--kemet-color-white));
|
|
9304
|
+
}
|
|
9305
|
+
|
|
9306
|
+
:host([completed]) .dot::after {
|
|
9307
|
+
border: 0;
|
|
9308
|
+
background-color: var(--kemet-tracker-step-completed-fill-color, var(--kemet-color-success));
|
|
9309
|
+
}
|
|
9310
|
+
|
|
9311
|
+
:host([current]) .dot.animate {
|
|
9312
|
+
color: var(--kemet-tracker-step-current-color, var(--kemet-color-white));
|
|
9313
|
+
}
|
|
9314
|
+
|
|
9315
|
+
:host([current]) .dot.animate::after {
|
|
9316
|
+
border: 0;
|
|
9317
|
+
background-color: var(--kemet-tracker-step-current-fill-color, var(--kemet-color-primary));
|
|
9318
|
+
}
|
|
9319
|
+
|
|
9320
|
+
:host([mobile]) .dot {
|
|
9321
|
+
width: var(--kemet-tracker-step-dot-size-mobile);
|
|
9322
|
+
height: var(--kemet-tracker-step-dot-size-mobile);
|
|
9323
|
+
}
|
|
9324
|
+
|
|
9325
|
+
.line {
|
|
9326
|
+
display: block;
|
|
9327
|
+
position: absolute;
|
|
9328
|
+
left: 50%;
|
|
9329
|
+
right: 0;
|
|
9330
|
+
bottom: 0;
|
|
9331
|
+
width: 100%;
|
|
9332
|
+
|
|
9333
|
+
/* standard */
|
|
9334
|
+
top: calc((var(--kemet-tracker-step-dot-size) - var(--kemet-tracker-step-standard-line-weight)) / 2);
|
|
9335
|
+
height: var(--kemet-tracker-step-standard-line-weight);
|
|
9336
|
+
background-color: var(--kemet-tracker-step-line-color, var(--kemet-color-primary));
|
|
9337
|
+
}
|
|
9338
|
+
|
|
9339
|
+
.line.completed {
|
|
9340
|
+
width: 100%;
|
|
9341
|
+
transform: scaleX(0);
|
|
9342
|
+
transform-origin: left center;
|
|
9343
|
+
top: calc((var(--kemet-tracker-step-dot-size) - var(--kemet-tracker-step-completed-line-weight)) / 2);
|
|
9344
|
+
height: var(--kemet-tracker-step-completed-line-weight);
|
|
9345
|
+
background-color: var(--kemet-tracker-step-completed-line-color, var(--kemet-color-primary));
|
|
9346
|
+
animation-name: grow;
|
|
9347
|
+
animation-delay: 1s;
|
|
9348
|
+
animation-duration: 600ms;
|
|
9349
|
+
animation-fill-mode: forwards;
|
|
9350
|
+
}
|
|
9351
|
+
|
|
9352
|
+
:host([mobile]) .line {
|
|
9353
|
+
top: calc((var(--kemet-tracker-step-dot-size-mobile) - var(--kemet-tracker-step-standard-line-weight)) / 2);
|
|
9354
|
+
}
|
|
9355
|
+
|
|
9356
|
+
:host([mobile]) .line.completed {
|
|
9357
|
+
top: calc((var(--kemet-tracker-step-dot-size-mobile) - var(--kemet-tracker-step-completed-line-weight)) / 2);
|
|
9358
|
+
}
|
|
9359
|
+
|
|
9360
|
+
@keyframes grow {
|
|
9361
|
+
from { transform: scaleX(0); }
|
|
9362
|
+
to { transform: scaleX(1); }
|
|
9363
|
+
}
|
|
9364
|
+
`,
|
|
9365
|
+
];
|
|
9366
|
+
}
|
|
9367
|
+
|
|
9368
|
+
static get properties() {
|
|
9369
|
+
return {
|
|
9370
|
+
/**
|
|
9371
|
+
* The current step number
|
|
9372
|
+
*/
|
|
9373
|
+
step: {
|
|
9374
|
+
type: Number,
|
|
9375
|
+
},
|
|
9376
|
+
/**
|
|
9377
|
+
* Determines whether or not a step renders as complete
|
|
9378
|
+
*/
|
|
9379
|
+
completed: {
|
|
9380
|
+
type: Boolean,
|
|
9381
|
+
reflect: true,
|
|
9382
|
+
},
|
|
9383
|
+
/**
|
|
9384
|
+
* Determines whether or not a step renders as the current step
|
|
9385
|
+
*/
|
|
9386
|
+
current: {
|
|
9387
|
+
type: Boolean,
|
|
9388
|
+
reflect: true,
|
|
9389
|
+
},
|
|
9390
|
+
/**
|
|
9391
|
+
* Is automatically added to the last step
|
|
9392
|
+
*/
|
|
9393
|
+
last: {
|
|
9394
|
+
type: Boolean,
|
|
9395
|
+
reflect: true,
|
|
9396
|
+
},
|
|
9397
|
+
/**
|
|
9398
|
+
* Determines if a step should render as mobile
|
|
9399
|
+
*/
|
|
9400
|
+
mobile: {
|
|
9401
|
+
type: Boolean,
|
|
9402
|
+
reflect: true,
|
|
9403
|
+
},
|
|
9404
|
+
/**
|
|
9405
|
+
* Hides the label inside of a dot
|
|
9406
|
+
*/
|
|
9407
|
+
hideDotContent: {
|
|
9408
|
+
type: Boolean,
|
|
9409
|
+
reflect: true,
|
|
9410
|
+
attribute: 'hide-dot-content',
|
|
9411
|
+
},
|
|
9412
|
+
/**
|
|
9413
|
+
* The icon size for the completed check mark
|
|
9414
|
+
*/
|
|
9415
|
+
completedSize: {
|
|
9416
|
+
type: Number,
|
|
9417
|
+
},
|
|
9418
|
+
};
|
|
9419
|
+
}
|
|
9420
|
+
|
|
9421
|
+
constructor() {
|
|
9422
|
+
super();
|
|
9423
|
+
this.completedSize = 16;
|
|
9424
|
+
}
|
|
9425
|
+
|
|
9426
|
+
firstUpdated() {
|
|
9427
|
+
this.tracker = this.closest('kemet-tracker');
|
|
9428
|
+
}
|
|
9429
|
+
|
|
9430
|
+
render() {
|
|
9431
|
+
return $`
|
|
9432
|
+
${this.makeLine()}
|
|
9433
|
+
${this.makeCompletedLine()}
|
|
9434
|
+
<div class="dot" part="dot">${this.makeDotContent()}</div>
|
|
9435
|
+
${this.makeSlotContent()}
|
|
9436
|
+
`;
|
|
9437
|
+
}
|
|
9438
|
+
|
|
9439
|
+
makeLine() {
|
|
9440
|
+
if (!this.last) {
|
|
9441
|
+
return $`<div class="line" part="line"></div>`;
|
|
9442
|
+
}
|
|
9443
|
+
|
|
9444
|
+
return null;
|
|
9445
|
+
}
|
|
9446
|
+
|
|
9447
|
+
makeCompletedLine() {
|
|
9448
|
+
if (this.completed && !this.last) {
|
|
9449
|
+
return $`<div class="line completed" part="completed-line" @animationend=${() => this.handleCompletedLineEnd()}></div>`;
|
|
9450
|
+
}
|
|
9451
|
+
|
|
9452
|
+
return null;
|
|
9453
|
+
}
|
|
9454
|
+
|
|
9455
|
+
makeDotContent() {
|
|
9456
|
+
if (this.completed && !this.mobile && !this.hideDotContent) {
|
|
9457
|
+
return $`
|
|
9458
|
+
<kemet-icon icon="check2" size=${this.completedSize}></kemet-icon>
|
|
9459
|
+
`;
|
|
9460
|
+
}
|
|
9461
|
+
|
|
9462
|
+
if (!this.mobile && !this.hideDotContent) {
|
|
9463
|
+
return $`
|
|
9464
|
+
<span>${this.step}/${this.tracker?.total}</span>
|
|
9465
|
+
`;
|
|
9466
|
+
}
|
|
9467
|
+
|
|
9468
|
+
return null;
|
|
9469
|
+
}
|
|
9470
|
+
|
|
9471
|
+
makeSlotContent() {
|
|
9472
|
+
if (!this.mobile) {
|
|
9473
|
+
return $`<slot></slot>`;
|
|
9474
|
+
}
|
|
9475
|
+
|
|
9476
|
+
return null;
|
|
9477
|
+
}
|
|
9478
|
+
|
|
9479
|
+
handleCompletedLineEnd() {
|
|
9480
|
+
const currentDot = this.tracker.querySelector('[current]').shadowRoot.querySelector('.dot');
|
|
9481
|
+
|
|
9482
|
+
if (currentDot) {
|
|
9483
|
+
currentDot.classList.add('animate');
|
|
9484
|
+
}
|
|
9485
|
+
}
|
|
9486
|
+
}
|
|
9487
|
+
|
|
9488
|
+
// eslint-disable-next-line no-unused-expressions
|
|
9489
|
+
customElements.get('kemet-tracker-step') || customElements.define('kemet-tracker-step', KemetTrackerStep);
|
|
9490
|
+
|
|
9491
|
+
class KemetTracker extends s$1 {
|
|
9492
|
+
static get styles() {
|
|
9493
|
+
return [
|
|
9494
|
+
r$3`
|
|
9495
|
+
:host {
|
|
9496
|
+
display: flex;
|
|
9497
|
+
justify-content: center;
|
|
9498
|
+
align-items: flex-start;
|
|
9499
|
+
}
|
|
9500
|
+
`,
|
|
9501
|
+
];
|
|
9502
|
+
}
|
|
9503
|
+
|
|
9504
|
+
static get properties() {
|
|
9505
|
+
return {
|
|
9506
|
+
/**
|
|
9507
|
+
* The total number of steps
|
|
9508
|
+
*/
|
|
9509
|
+
total: {
|
|
9510
|
+
type: Number,
|
|
9511
|
+
},
|
|
9512
|
+
/**
|
|
9513
|
+
* The point at which the tracker goes from mobile to standard
|
|
9514
|
+
*/
|
|
9515
|
+
breakpoint: {
|
|
9516
|
+
type: String,
|
|
9517
|
+
},
|
|
9518
|
+
};
|
|
9519
|
+
}
|
|
9520
|
+
|
|
9521
|
+
constructor() {
|
|
9522
|
+
super();
|
|
9523
|
+
this.breakpoint = '767px';
|
|
9524
|
+
}
|
|
9525
|
+
|
|
9526
|
+
firstUpdated() {
|
|
9527
|
+
// elements
|
|
9528
|
+
this.steps = this.querySelectorAll('kemet-tracker-step');
|
|
9529
|
+
|
|
9530
|
+
// methods exe
|
|
9531
|
+
this.isMobile();
|
|
9532
|
+
|
|
9533
|
+
// events
|
|
9534
|
+
window.addEventListener('resize', () => {
|
|
9535
|
+
this.isMobile();
|
|
9536
|
+
});
|
|
9537
|
+
}
|
|
9538
|
+
|
|
9539
|
+
render() {
|
|
9540
|
+
return $`<slot @slotchange=${() => this.handleSlotChange()}></slot>`;
|
|
9541
|
+
}
|
|
9542
|
+
|
|
9543
|
+
handleSlotChange() {
|
|
9544
|
+
this.total = this.steps.length;
|
|
9545
|
+
|
|
9546
|
+
this.steps.forEach((step, index) => {
|
|
9547
|
+
step.step = index + 1;
|
|
9548
|
+
if (step.step === this.total) {
|
|
9549
|
+
step.last = true;
|
|
9550
|
+
}
|
|
9551
|
+
});
|
|
9552
|
+
}
|
|
9553
|
+
|
|
9554
|
+
isMobile() {
|
|
9555
|
+
const mediaQuery = window.matchMedia(`(max-width: ${this.breakpoint})`);
|
|
9556
|
+
|
|
9557
|
+
this.steps.forEach((step) => {
|
|
9558
|
+
step.mobile = mediaQuery.matches;
|
|
9559
|
+
});
|
|
9560
|
+
}
|
|
9561
|
+
}
|
|
9562
|
+
|
|
9563
|
+
// eslint-disable-next-line no-unused-expressions
|
|
9564
|
+
customElements.get('kemet-tracker') || customElements.define('kemet-tracker', KemetTracker);
|
|
9565
|
+
|
|
9566
|
+
export { KemetCarouselCurrent, KemetCarouselFirst, KemetCarouselLast, KemetCarouselPrev, KemetCarouselTotal, customTooltip, fade, fall, flipHorizontal, flipVertical, scale, sign, slide, stylesKemetTabs, superScaled, tooltip };
|