kemet-ui 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +2144 -1522
- package/dist/{components/kemet-accordion/styles.js → styles/elements/accordion.ts} +4 -3
- package/dist/{components/kemet-alert/styles.js → styles/elements/alert.ts} +53 -3
- package/dist/{components/kemet-avatar/styles.js → styles/elements/avatar.ts} +26 -12
- package/dist/styles/elements/badge.ts +92 -0
- package/dist/{components/kemet-button/styles.js → styles/elements/button.ts} +32 -13
- package/dist/{components/kemet-card/styles.js → styles/elements/card.ts} +3 -3
- package/dist/{components/kemet-carousel/styles.js → styles/elements/carousel.ts} +2 -2
- package/dist/{components/kemet-checkbox/styles.js → styles/elements/checkbox.ts} +2 -2
- package/dist/{components/kemet-combo/styles.js → styles/elements/combo.ts} +2 -2
- package/dist/{components/kemet-drawer/styles.js → styles/elements/drawer.ts} +5 -3
- package/dist/{components/kemet-fab/styles.js → styles/elements/fab.ts} +2 -2
- package/dist/{components/kemet-field/styles.js → styles/elements/field.ts} +2 -14
- package/dist/{components/kemet-flipcard/styles.js → styles/elements/flipcard.ts} +2 -2
- package/dist/styles/elements/icon-lucide.ts +7 -0
- package/dist/{components/kemet-input/styles.js → styles/elements/input.ts} +36 -12
- package/dist/{components/kemet-modal/styles.js → styles/elements/modal.ts} +27 -6
- package/dist/{components/kemet-multi-input/styles.js → styles/elements/multi-input.ts} +41 -3
- package/dist/{components/kemet-password/styles.js → styles/elements/password.ts} +3 -3
- package/dist/{components/kemet-popper/styles.effects.js → styles/elements/popper.ts} +52 -9
- package/dist/{components/kemet-radio/styles.js → styles/elements/radio.ts} +4 -3
- package/dist/{components/kemet-rotator/styles.js → styles/elements/rotator.ts} +2 -2
- package/dist/{components/kemet-scroll-nav/styles.js → styles/elements/scroll-nav.ts} +2 -2
- package/dist/{components/kemet-scroll-snap/styles.js → styles/elements/scroll-snap.ts} +4 -3
- package/dist/{components/kemet-select/styles.js → styles/elements/select.ts} +34 -10
- package/dist/{components/kemet-sortable/styles.js → styles/elements/sortable.ts} +4 -3
- package/dist/{components/kemet-tabs/styles.js → styles/elements/tabs.ts} +7 -5
- package/dist/{components/kemet-textarea/styles.js → styles/elements/textarea.ts} +29 -4
- package/dist/{components/kemet-timer/styles.js → styles/elements/timer.ts} +4 -3
- package/dist/{components/kemet-toggle/styles.js → styles/elements/toggle.ts} +2 -2
- package/dist/{components/kemet-tooltip/styles.js → styles/elements/tooltip.ts} +2 -2
- package/dist/{components/kemet-tracker/styles.js → styles/elements/tracker.ts} +2 -2
- package/dist/{components/kemet-upload/styles.js → styles/elements/upload.ts} +6 -4
- package/dist/styles/kemet.base.css +1 -1
- package/dist/styles/kemet.base.css.map +1 -1
- package/dist/styles/kemet.core.css +1 -1
- package/dist/styles/kemet.core.css.map +1 -1
- package/dist/styles/shared/_helpers.scss +19 -18
- package/package.json +71 -88
- package/types/global.d.ts +3 -0
- package/types/jsx.d.ts +140 -0
- package/dist/components/kemet-accordion/docs/stories.d.ts +0 -12
- package/dist/components/kemet-accordion/docs/stories.js +0 -99
- package/dist/components/kemet-accordion/docs/stories.js.map +0 -1
- package/dist/components/kemet-accordion/kemet-accordion-panel.d.ts +0 -50
- package/dist/components/kemet-accordion/kemet-accordion-panel.js +0 -137
- package/dist/components/kemet-accordion/kemet-accordion-panel.js.map +0 -1
- package/dist/components/kemet-accordion/kemet-accordion.d.ts +0 -38
- package/dist/components/kemet-accordion/kemet-accordion.js +0 -138
- package/dist/components/kemet-accordion/kemet-accordion.js.map +0 -1
- package/dist/components/kemet-accordion/spec.d.ts +0 -2
- package/dist/components/kemet-accordion/spec.js +0 -132
- package/dist/components/kemet-accordion/spec.js.map +0 -1
- package/dist/components/kemet-accordion/styles.d.ts +0 -2
- package/dist/components/kemet-accordion/styles.js.map +0 -1
- package/dist/components/kemet-alert/docs/stories.d.ts +0 -21
- package/dist/components/kemet-alert/docs/stories.js +0 -222
- package/dist/components/kemet-alert/docs/stories.js.map +0 -1
- package/dist/components/kemet-alert/kemet-alert.d.ts +0 -51
- package/dist/components/kemet-alert/kemet-alert.js +0 -111
- package/dist/components/kemet-alert/kemet-alert.js.map +0 -1
- package/dist/components/kemet-alert/spec.d.ts +0 -1
- package/dist/components/kemet-alert/spec.js +0 -35
- package/dist/components/kemet-alert/spec.js.map +0 -1
- package/dist/components/kemet-alert/styles.d.ts +0 -1
- package/dist/components/kemet-alert/styles.js.map +0 -1
- package/dist/components/kemet-alert/types.d.ts +0 -1
- package/dist/components/kemet-alert/types.js +0 -2
- package/dist/components/kemet-alert/types.js.map +0 -1
- package/dist/components/kemet-avatar/docs/stories.d.ts +0 -15
- package/dist/components/kemet-avatar/docs/stories.js +0 -108
- package/dist/components/kemet-avatar/docs/stories.js.map +0 -1
- package/dist/components/kemet-avatar/kemet-avatar.d.ts +0 -43
- package/dist/components/kemet-avatar/kemet-avatar.js +0 -78
- package/dist/components/kemet-avatar/kemet-avatar.js.map +0 -1
- package/dist/components/kemet-avatar/kemet-avatars.d.ts +0 -20
- package/dist/components/kemet-avatar/kemet-avatars.js +0 -25
- package/dist/components/kemet-avatar/kemet-avatars.js.map +0 -1
- package/dist/components/kemet-avatar/spec.d.ts +0 -1
- package/dist/components/kemet-avatar/spec.js +0 -26
- package/dist/components/kemet-avatar/spec.js.map +0 -1
- package/dist/components/kemet-avatar/styles.d.ts +0 -2
- package/dist/components/kemet-avatar/styles.js.map +0 -1
- package/dist/components/kemet-badge/docs/stories.d.ts +0 -15
- package/dist/components/kemet-badge/docs/stories.js +0 -76
- package/dist/components/kemet-badge/docs/stories.js.map +0 -1
- package/dist/components/kemet-badge/kemet-badge.d.ts +0 -31
- package/dist/components/kemet-badge/kemet-badge.js +0 -55
- package/dist/components/kemet-badge/kemet-badge.js.map +0 -1
- package/dist/components/kemet-badge/spec.d.ts +0 -1
- package/dist/components/kemet-badge/spec.js +0 -21
- package/dist/components/kemet-badge/spec.js.map +0 -1
- package/dist/components/kemet-badge/styles.d.ts +0 -1
- package/dist/components/kemet-badge/styles.js +0 -42
- package/dist/components/kemet-badge/styles.js.map +0 -1
- package/dist/components/kemet-badge/types.d.ts +0 -1
- package/dist/components/kemet-badge/types.js +0 -2
- package/dist/components/kemet-badge/types.js.map +0 -1
- package/dist/components/kemet-button/docs/stories.d.ts +0 -21
- package/dist/components/kemet-button/docs/stories.js +0 -112
- package/dist/components/kemet-button/docs/stories.js.map +0 -1
- package/dist/components/kemet-button/kemet-button.d.ts +0 -89
- package/dist/components/kemet-button/kemet-button.js +0 -155
- package/dist/components/kemet-button/kemet-button.js.map +0 -1
- package/dist/components/kemet-button/spec.d.ts +0 -1
- package/dist/components/kemet-button/spec.js +0 -49
- package/dist/components/kemet-button/spec.js.map +0 -1
- package/dist/components/kemet-button/styles.d.ts +0 -1
- package/dist/components/kemet-button/styles.js.map +0 -1
- package/dist/components/kemet-button/types.d.ts +0 -1
- package/dist/components/kemet-button/types.js +0 -2
- package/dist/components/kemet-button/types.js.map +0 -1
- package/dist/components/kemet-card/docs/stories.d.ts +0 -19
- package/dist/components/kemet-card/docs/stories.js +0 -120
- package/dist/components/kemet-card/docs/stories.js.map +0 -1
- package/dist/components/kemet-card/kemet-card.d.ts +0 -47
- package/dist/components/kemet-card/kemet-card.js +0 -65
- package/dist/components/kemet-card/kemet-card.js.map +0 -1
- package/dist/components/kemet-card/spec.d.ts +0 -1
- package/dist/components/kemet-card/spec.js +0 -31
- package/dist/components/kemet-card/spec.js.map +0 -1
- package/dist/components/kemet-card/styles.d.ts +0 -1
- package/dist/components/kemet-card/styles.js.map +0 -1
- package/dist/components/kemet-carousel/docs/stories.d.ts +0 -23
- package/dist/components/kemet-carousel/docs/stories.js +0 -180
- package/dist/components/kemet-carousel/docs/stories.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-current.d.ts +0 -26
- package/dist/components/kemet-carousel/kemet-carousel-current.js +0 -44
- package/dist/components/kemet-carousel/kemet-carousel-current.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-first.d.ts +0 -26
- package/dist/components/kemet-carousel/kemet-carousel-first.js +0 -57
- package/dist/components/kemet-carousel/kemet-carousel-first.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-last.d.ts +0 -26
- package/dist/components/kemet-carousel/kemet-carousel-last.js +0 -57
- package/dist/components/kemet-carousel/kemet-carousel-last.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-link.d.ts +0 -32
- package/dist/components/kemet-carousel/kemet-carousel-link.js +0 -74
- package/dist/components/kemet-carousel/kemet-carousel-link.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-next.d.ts +0 -26
- package/dist/components/kemet-carousel/kemet-carousel-next.js +0 -57
- package/dist/components/kemet-carousel/kemet-carousel-next.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-prev.d.ts +0 -26
- package/dist/components/kemet-carousel/kemet-carousel-prev.js +0 -57
- package/dist/components/kemet-carousel/kemet-carousel-prev.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-slide.d.ts +0 -29
- package/dist/components/kemet-carousel/kemet-carousel-slide.js +0 -53
- package/dist/components/kemet-carousel/kemet-carousel-slide.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel-total.d.ts +0 -26
- package/dist/components/kemet-carousel/kemet-carousel-total.js +0 -44
- package/dist/components/kemet-carousel/kemet-carousel-total.js.map +0 -1
- package/dist/components/kemet-carousel/kemet-carousel.d.ts +0 -118
- package/dist/components/kemet-carousel/kemet-carousel.js +0 -429
- package/dist/components/kemet-carousel/kemet-carousel.js.map +0 -1
- package/dist/components/kemet-carousel/spec.d.ts +0 -10
- package/dist/components/kemet-carousel/spec.js +0 -168
- package/dist/components/kemet-carousel/spec.js.map +0 -1
- package/dist/components/kemet-carousel/styles.d.ts +0 -1
- package/dist/components/kemet-carousel/styles.js.map +0 -1
- package/dist/components/kemet-checkbox/docs/stories.d.ts +0 -13
- package/dist/components/kemet-checkbox/docs/stories.js +0 -45
- package/dist/components/kemet-checkbox/docs/stories.js.map +0 -1
- package/dist/components/kemet-checkbox/kemet-checkbox.d.ts +0 -71
- package/dist/components/kemet-checkbox/kemet-checkbox.js +0 -192
- package/dist/components/kemet-checkbox/kemet-checkbox.js.map +0 -1
- package/dist/components/kemet-checkbox/spec.d.ts +0 -1
- package/dist/components/kemet-checkbox/spec.js +0 -33
- package/dist/components/kemet-checkbox/spec.js.map +0 -1
- package/dist/components/kemet-checkbox/styles.d.ts +0 -1
- package/dist/components/kemet-checkbox/styles.js.map +0 -1
- package/dist/components/kemet-checkbox/types.d.ts +0 -15
- package/dist/components/kemet-checkbox/types.js +0 -2
- package/dist/components/kemet-checkbox/types.js.map +0 -1
- package/dist/components/kemet-combo/docs/stories.d.ts +0 -11
- package/dist/components/kemet-combo/docs/stories.js +0 -32
- package/dist/components/kemet-combo/docs/stories.js.map +0 -1
- package/dist/components/kemet-combo/kemet-combo.d.ts +0 -51
- package/dist/components/kemet-combo/kemet-combo.js +0 -163
- package/dist/components/kemet-combo/kemet-combo.js.map +0 -1
- package/dist/components/kemet-combo/spec.d.ts +0 -3
- package/dist/components/kemet-combo/spec.js +0 -46
- package/dist/components/kemet-combo/spec.js.map +0 -1
- package/dist/components/kemet-combo/styles.d.ts +0 -1
- package/dist/components/kemet-combo/styles.js.map +0 -1
- package/dist/components/kemet-count/docs/stories.d.ts +0 -11
- package/dist/components/kemet-count/docs/stories.js +0 -36
- package/dist/components/kemet-count/docs/stories.js.map +0 -1
- package/dist/components/kemet-count/kemet-count.d.ts +0 -39
- package/dist/components/kemet-count/kemet-count.js +0 -98
- package/dist/components/kemet-count/kemet-count.js.map +0 -1
- package/dist/components/kemet-count/spec.d.ts +0 -4
- package/dist/components/kemet-count/spec.js +0 -45
- package/dist/components/kemet-count/spec.js.map +0 -1
- package/dist/components/kemet-draggable/docs/stories.d.ts +0 -10
- package/dist/components/kemet-draggable/docs/stories.js +0 -25
- package/dist/components/kemet-draggable/docs/stories.js.map +0 -1
- package/dist/components/kemet-draggable/kemet-draggable.d.ts +0 -49
- package/dist/components/kemet-draggable/kemet-draggable.js +0 -138
- package/dist/components/kemet-draggable/kemet-draggable.js.map +0 -1
- package/dist/components/kemet-draggable/spec.d.ts +0 -1
- package/dist/components/kemet-draggable/spec.js +0 -30
- package/dist/components/kemet-draggable/spec.js.map +0 -1
- package/dist/components/kemet-drawer/docs/stories.d.ts +0 -16
- package/dist/components/kemet-drawer/docs/stories.js +0 -90
- package/dist/components/kemet-drawer/docs/stories.js.map +0 -1
- package/dist/components/kemet-drawer/kemet-drawer.d.ts +0 -48
- package/dist/components/kemet-drawer/kemet-drawer.js +0 -95
- package/dist/components/kemet-drawer/kemet-drawer.js.map +0 -1
- package/dist/components/kemet-drawer/spec.d.ts +0 -1
- package/dist/components/kemet-drawer/spec.js +0 -21
- package/dist/components/kemet-drawer/spec.js.map +0 -1
- package/dist/components/kemet-drawer/styles.d.ts +0 -2
- package/dist/components/kemet-drawer/styles.js.map +0 -1
- package/dist/components/kemet-drawer/types.d.ts +0 -2
- package/dist/components/kemet-drawer/types.js +0 -2
- package/dist/components/kemet-drawer/types.js.map +0 -1
- package/dist/components/kemet-fab/docs/stories.d.ts +0 -14
- package/dist/components/kemet-fab/docs/stories.js +0 -78
- package/dist/components/kemet-fab/docs/stories.js.map +0 -1
- package/dist/components/kemet-fab/kemet-fab.d.ts +0 -49
- package/dist/components/kemet-fab/kemet-fab.js +0 -101
- package/dist/components/kemet-fab/kemet-fab.js.map +0 -1
- package/dist/components/kemet-fab/spec.d.ts +0 -2
- package/dist/components/kemet-fab/spec.js +0 -43
- package/dist/components/kemet-fab/spec.js.map +0 -1
- package/dist/components/kemet-fab/styles.d.ts +0 -1
- package/dist/components/kemet-fab/styles.js.map +0 -1
- package/dist/components/kemet-fab/types.d.ts +0 -8
- package/dist/components/kemet-fab/types.js +0 -2
- package/dist/components/kemet-fab/types.js.map +0 -1
- package/dist/components/kemet-field/docs/stories.d.ts +0 -15
- package/dist/components/kemet-field/docs/stories.js +0 -55
- package/dist/components/kemet-field/docs/stories.js.map +0 -1
- package/dist/components/kemet-field/kemet-field.d.ts +0 -61
- package/dist/components/kemet-field/kemet-field.js +0 -139
- package/dist/components/kemet-field/kemet-field.js.map +0 -1
- package/dist/components/kemet-field/spec.d.ts +0 -2
- package/dist/components/kemet-field/spec.js +0 -38
- package/dist/components/kemet-field/spec.js.map +0 -1
- package/dist/components/kemet-field/styles.d.ts +0 -1
- package/dist/components/kemet-field/styles.js.map +0 -1
- package/dist/components/kemet-field/types.d.ts +0 -13
- package/dist/components/kemet-field/types.js +0 -2
- package/dist/components/kemet-field/types.js.map +0 -1
- package/dist/components/kemet-flipcard/docs/stories.d.ts +0 -14
- package/dist/components/kemet-flipcard/docs/stories.js +0 -60
- package/dist/components/kemet-flipcard/docs/stories.js.map +0 -1
- package/dist/components/kemet-flipcard/kemet-flipcard-trigger.d.ts +0 -21
- package/dist/components/kemet-flipcard/kemet-flipcard-trigger.js +0 -41
- package/dist/components/kemet-flipcard/kemet-flipcard-trigger.js.map +0 -1
- package/dist/components/kemet-flipcard/kemet-flipcard.d.ts +0 -52
- package/dist/components/kemet-flipcard/kemet-flipcard.js +0 -129
- package/dist/components/kemet-flipcard/kemet-flipcard.js.map +0 -1
- package/dist/components/kemet-flipcard/spec.d.ts +0 -3
- package/dist/components/kemet-flipcard/spec.js +0 -38
- package/dist/components/kemet-flipcard/spec.js.map +0 -1
- package/dist/components/kemet-flipcard/styles.d.ts +0 -1
- package/dist/components/kemet-flipcard/styles.js.map +0 -1
- package/dist/components/kemet-flipcard/types.d.ts +0 -7
- package/dist/components/kemet-flipcard/types.js +0 -2
- package/dist/components/kemet-flipcard/types.js.map +0 -1
- package/dist/components/kemet-icon/docs/stories.d.ts +0 -9
- package/dist/components/kemet-icon/docs/stories.js +0 -27
- package/dist/components/kemet-icon/docs/stories.js.map +0 -1
- package/dist/components/kemet-icon/kemet-icon.d.ts +0 -28
- package/dist/components/kemet-icon/kemet-icon.js +0 -114
- package/dist/components/kemet-icon/kemet-icon.js.map +0 -1
- package/dist/components/kemet-icon/spec.d.ts +0 -1
- package/dist/components/kemet-icon/spec.js +0 -69
- package/dist/components/kemet-icon/spec.js.map +0 -1
- package/dist/components/kemet-icon/styles.d.ts +0 -1
- package/dist/components/kemet-icon/styles.js +0 -9
- package/dist/components/kemet-icon/styles.js.map +0 -1
- package/dist/components/kemet-icon/types.d.ts +0 -5
- package/dist/components/kemet-icon/types.js +0 -2
- package/dist/components/kemet-icon/types.js.map +0 -1
- package/dist/components/kemet-input/docs/stories.d.ts +0 -13
- package/dist/components/kemet-input/docs/stories.js +0 -83
- package/dist/components/kemet-input/docs/stories.js.map +0 -1
- package/dist/components/kemet-input/kemet-input.d.ts +0 -174
- package/dist/components/kemet-input/kemet-input.js +0 -397
- package/dist/components/kemet-input/kemet-input.js.map +0 -1
- package/dist/components/kemet-input/spec.d.ts +0 -1
- package/dist/components/kemet-input/spec.js +0 -83
- package/dist/components/kemet-input/spec.js.map +0 -1
- package/dist/components/kemet-input/styles.d.ts +0 -1
- package/dist/components/kemet-input/styles.js.map +0 -1
- package/dist/components/kemet-input/types.d.ts +0 -35
- package/dist/components/kemet-input/types.js +0 -2
- package/dist/components/kemet-input/types.js.map +0 -1
- package/dist/components/kemet-modal/docs/stories.d.ts +0 -12
- package/dist/components/kemet-modal/docs/stories.js +0 -58
- package/dist/components/kemet-modal/docs/stories.js.map +0 -1
- package/dist/components/kemet-modal/kemet-modal-close.d.ts +0 -21
- package/dist/components/kemet-modal/kemet-modal-close.js +0 -40
- package/dist/components/kemet-modal/kemet-modal-close.js.map +0 -1
- package/dist/components/kemet-modal/kemet-modal.d.ts +0 -59
- package/dist/components/kemet-modal/kemet-modal.js +0 -150
- package/dist/components/kemet-modal/kemet-modal.js.map +0 -1
- package/dist/components/kemet-modal/styles.d.ts +0 -2
- package/dist/components/kemet-modal/styles.js.map +0 -1
- package/dist/components/kemet-modal/types.d.ts +0 -8
- package/dist/components/kemet-modal/types.js +0 -2
- package/dist/components/kemet-modal/types.js.map +0 -1
- package/dist/components/kemet-multi-input/docs/stories.d.ts +0 -8
- package/dist/components/kemet-multi-input/docs/stories.js +0 -33
- package/dist/components/kemet-multi-input/docs/stories.js.map +0 -1
- package/dist/components/kemet-multi-input/kemet-multi-input.d.ts +0 -116
- package/dist/components/kemet-multi-input/kemet-multi-input.js +0 -193
- package/dist/components/kemet-multi-input/kemet-multi-input.js.map +0 -1
- package/dist/components/kemet-multi-input/styles.d.ts +0 -1
- package/dist/components/kemet-multi-input/styles.js.map +0 -1
- package/dist/components/kemet-multi-input/types.d.ts +0 -5
- package/dist/components/kemet-multi-input/types.js +0 -2
- package/dist/components/kemet-multi-input/types.js.map +0 -1
- package/dist/components/kemet-password/docs/stories.d.ts +0 -10
- package/dist/components/kemet-password/docs/stories.js +0 -29
- package/dist/components/kemet-password/docs/stories.js.map +0 -1
- package/dist/components/kemet-password/kemet-password.d.ts +0 -83
- package/dist/components/kemet-password/kemet-password.js +0 -155
- package/dist/components/kemet-password/kemet-password.js.map +0 -1
- package/dist/components/kemet-password/styles.d.ts +0 -1
- package/dist/components/kemet-password/styles.js.map +0 -1
- package/dist/components/kemet-password/types.d.ts +0 -10
- package/dist/components/kemet-password/types.js +0 -2
- package/dist/components/kemet-password/types.js.map +0 -1
- package/dist/components/kemet-popper/docs/stories.d.ts +0 -12
- package/dist/components/kemet-popper/docs/stories.js +0 -65
- package/dist/components/kemet-popper/docs/stories.js.map +0 -1
- package/dist/components/kemet-popper/kemet-popper-close.d.ts +0 -22
- package/dist/components/kemet-popper/kemet-popper-close.js +0 -48
- package/dist/components/kemet-popper/kemet-popper-close.js.map +0 -1
- package/dist/components/kemet-popper/kemet-popper.d.ts +0 -72
- package/dist/components/kemet-popper/kemet-popper.js +0 -173
- package/dist/components/kemet-popper/kemet-popper.js.map +0 -1
- package/dist/components/kemet-popper/styles.d.ts +0 -1
- package/dist/components/kemet-popper/styles.effects.d.ts +0 -8
- package/dist/components/kemet-popper/styles.effects.js.map +0 -1
- package/dist/components/kemet-popper/styles.js +0 -37
- package/dist/components/kemet-popper/styles.js.map +0 -1
- package/dist/components/kemet-popper/types.d.ts +0 -3
- package/dist/components/kemet-popper/types.js +0 -2
- package/dist/components/kemet-popper/types.js.map +0 -1
- package/dist/components/kemet-radio/docs/stories.d.ts +0 -12
- package/dist/components/kemet-radio/docs/stories.js +0 -44
- package/dist/components/kemet-radio/docs/stories.js.map +0 -1
- package/dist/components/kemet-radio/kemet-radio.d.ts +0 -57
- package/dist/components/kemet-radio/kemet-radio.js +0 -130
- package/dist/components/kemet-radio/kemet-radio.js.map +0 -1
- package/dist/components/kemet-radio/kemet-radios.d.ts +0 -50
- package/dist/components/kemet-radio/kemet-radios.js +0 -149
- package/dist/components/kemet-radio/kemet-radios.js.map +0 -1
- package/dist/components/kemet-radio/spec.d.ts +0 -3
- package/dist/components/kemet-radio/spec.js +0 -67
- package/dist/components/kemet-radio/spec.js.map +0 -1
- package/dist/components/kemet-radio/styles.d.ts +0 -2
- package/dist/components/kemet-radio/styles.js.map +0 -1
- package/dist/components/kemet-radio/types.d.ts +0 -20
- package/dist/components/kemet-radio/types.js +0 -2
- package/dist/components/kemet-radio/types.js.map +0 -1
- package/dist/components/kemet-rotator/docs/stories.d.ts +0 -10
- package/dist/components/kemet-rotator/docs/stories.js +0 -34
- package/dist/components/kemet-rotator/docs/stories.js.map +0 -1
- package/dist/components/kemet-rotator/kemet-rotator.d.ts +0 -40
- package/dist/components/kemet-rotator/kemet-rotator.js +0 -121
- package/dist/components/kemet-rotator/kemet-rotator.js.map +0 -1
- package/dist/components/kemet-rotator/styles.d.ts +0 -1
- package/dist/components/kemet-rotator/styles.js.map +0 -1
- package/dist/components/kemet-rotator/types.d.ts +0 -9
- package/dist/components/kemet-rotator/types.js +0 -2
- package/dist/components/kemet-rotator/types.js.map +0 -1
- package/dist/components/kemet-scroll-link/docs/stories.d.ts +0 -9
- package/dist/components/kemet-scroll-link/docs/stories.js +0 -97
- package/dist/components/kemet-scroll-link/docs/stories.js.map +0 -1
- package/dist/components/kemet-scroll-link/kemet-scroll-link.d.ts +0 -31
- package/dist/components/kemet-scroll-link/kemet-scroll-link.js +0 -83
- package/dist/components/kemet-scroll-link/kemet-scroll-link.js.map +0 -1
- package/dist/components/kemet-scroll-link/types.d.ts +0 -6
- package/dist/components/kemet-scroll-link/types.js +0 -2
- package/dist/components/kemet-scroll-link/types.js.map +0 -1
- package/dist/components/kemet-scroll-nav/docs/stories.d.ts +0 -10
- package/dist/components/kemet-scroll-nav/docs/stories.js +0 -162
- package/dist/components/kemet-scroll-nav/docs/stories.js.map +0 -1
- package/dist/components/kemet-scroll-nav/kemet-scroll-nav.d.ts +0 -34
- package/dist/components/kemet-scroll-nav/kemet-scroll-nav.js +0 -65
- package/dist/components/kemet-scroll-nav/kemet-scroll-nav.js.map +0 -1
- package/dist/components/kemet-scroll-nav/styles.d.ts +0 -1
- package/dist/components/kemet-scroll-nav/styles.js.map +0 -1
- package/dist/components/kemet-scroll-nav/types.d.ts +0 -6
- package/dist/components/kemet-scroll-nav/types.js +0 -2
- package/dist/components/kemet-scroll-nav/types.js.map +0 -1
- package/dist/components/kemet-scroll-snap/docs/stories.d.ts +0 -17
- package/dist/components/kemet-scroll-snap/docs/stories.js +0 -121
- package/dist/components/kemet-scroll-snap/docs/stories.js.map +0 -1
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-paginator.d.ts +0 -45
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-paginator.js +0 -120
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-paginator.js.map +0 -1
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-slide.d.ts +0 -30
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-slide.js +0 -53
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-slide.js.map +0 -1
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap.d.ts +0 -47
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap.js +0 -117
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap.js.map +0 -1
- package/dist/components/kemet-scroll-snap/styles.d.ts +0 -2
- package/dist/components/kemet-scroll-snap/styles.js.map +0 -1
- package/dist/components/kemet-scroll-snap/types.d.ts +0 -20
- package/dist/components/kemet-scroll-snap/types.js +0 -2
- package/dist/components/kemet-scroll-snap/types.js.map +0 -1
- package/dist/components/kemet-select/docs/stories.d.ts +0 -13
- package/dist/components/kemet-select/docs/stories.js +0 -49
- package/dist/components/kemet-select/docs/stories.js.map +0 -1
- package/dist/components/kemet-select/kemet-option.d.ts +0 -29
- package/dist/components/kemet-select/kemet-option.js +0 -45
- package/dist/components/kemet-select/kemet-option.js.map +0 -1
- package/dist/components/kemet-select/kemet-select.d.ts +0 -119
- package/dist/components/kemet-select/kemet-select.js +0 -198
- package/dist/components/kemet-select/kemet-select.js.map +0 -1
- package/dist/components/kemet-select/spec.d.ts +0 -3
- package/dist/components/kemet-select/spec.js +0 -53
- package/dist/components/kemet-select/spec.js.map +0 -1
- package/dist/components/kemet-select/styles.d.ts +0 -1
- package/dist/components/kemet-select/styles.js.map +0 -1
- package/dist/components/kemet-select/types.d.ts +0 -20
- package/dist/components/kemet-select/types.js +0 -2
- package/dist/components/kemet-select/types.js.map +0 -1
- package/dist/components/kemet-sortable/docs/stories.d.ts +0 -10
- package/dist/components/kemet-sortable/docs/stories.js +0 -29
- package/dist/components/kemet-sortable/docs/stories.js.map +0 -1
- package/dist/components/kemet-sortable/kemet-sortable-item.d.ts +0 -21
- package/dist/components/kemet-sortable/kemet-sortable-item.js +0 -30
- package/dist/components/kemet-sortable/kemet-sortable-item.js.map +0 -1
- package/dist/components/kemet-sortable/kemet-sortable.d.ts +0 -25
- package/dist/components/kemet-sortable/kemet-sortable.js +0 -77
- package/dist/components/kemet-sortable/kemet-sortable.js.map +0 -1
- package/dist/components/kemet-sortable/styles.d.ts +0 -2
- package/dist/components/kemet-sortable/styles.js.map +0 -1
- package/dist/components/kemet-sortable/types.d.ts +0 -3
- package/dist/components/kemet-sortable/types.js +0 -2
- package/dist/components/kemet-sortable/types.js.map +0 -1
- package/dist/components/kemet-svgs/docs/stories.d.ts +0 -10
- package/dist/components/kemet-svgs/docs/stories.js +0 -67
- package/dist/components/kemet-svgs/docs/stories.js.map +0 -1
- package/dist/components/kemet-svgs/kemet-svg.d.ts +0 -38
- package/dist/components/kemet-svgs/kemet-svg.js +0 -97
- package/dist/components/kemet-svgs/kemet-svg.js.map +0 -1
- package/dist/components/kemet-svgs/kemet-svgs.d.ts +0 -27
- package/dist/components/kemet-svgs/kemet-svgs.js +0 -51
- package/dist/components/kemet-svgs/kemet-svgs.js.map +0 -1
- package/dist/components/kemet-svgs/types.d.ts +0 -10
- package/dist/components/kemet-svgs/types.js +0 -2
- package/dist/components/kemet-svgs/types.js.map +0 -1
- package/dist/components/kemet-tabs/docs/stories.d.ts +0 -18
- package/dist/components/kemet-tabs/docs/stories.js +0 -142
- package/dist/components/kemet-tabs/docs/stories.js.map +0 -1
- package/dist/components/kemet-tabs/kemet-tab-panel.d.ts +0 -28
- package/dist/components/kemet-tabs/kemet-tab-panel.js +0 -55
- package/dist/components/kemet-tabs/kemet-tab-panel.js.map +0 -1
- package/dist/components/kemet-tabs/kemet-tab.d.ts +0 -38
- package/dist/components/kemet-tabs/kemet-tab.js +0 -82
- package/dist/components/kemet-tabs/kemet-tab.js.map +0 -1
- package/dist/components/kemet-tabs/kemet-tabs.d.ts +0 -100
- package/dist/components/kemet-tabs/kemet-tabs.js +0 -487
- package/dist/components/kemet-tabs/kemet-tabs.js.map +0 -1
- package/dist/components/kemet-tabs/styles.d.ts +0 -3
- package/dist/components/kemet-tabs/styles.js.map +0 -1
- package/dist/components/kemet-tabs/types.d.ts +0 -27
- package/dist/components/kemet-tabs/types.js +0 -2
- package/dist/components/kemet-tabs/types.js.map +0 -1
- package/dist/components/kemet-textarea/docs/stories.d.ts +0 -12
- package/dist/components/kemet-textarea/docs/stories.js +0 -58
- package/dist/components/kemet-textarea/docs/stories.js.map +0 -1
- package/dist/components/kemet-textarea/kemet-textarea.d.ts +0 -123
- package/dist/components/kemet-textarea/kemet-textarea.js +0 -293
- package/dist/components/kemet-textarea/kemet-textarea.js.map +0 -1
- package/dist/components/kemet-textarea/spec.d.ts +0 -3
- package/dist/components/kemet-textarea/spec.js +0 -69
- package/dist/components/kemet-textarea/spec.js.map +0 -1
- package/dist/components/kemet-textarea/styles.d.ts +0 -1
- package/dist/components/kemet-textarea/styles.js.map +0 -1
- package/dist/components/kemet-textarea/types.d.ts +0 -20
- package/dist/components/kemet-textarea/types.js +0 -2
- package/dist/components/kemet-textarea/types.js.map +0 -1
- package/dist/components/kemet-timer/docs/stories.d.ts +0 -10
- package/dist/components/kemet-timer/docs/stories.js +0 -40
- package/dist/components/kemet-timer/docs/stories.js.map +0 -1
- package/dist/components/kemet-timer/kemet-timer-display.d.ts +0 -25
- package/dist/components/kemet-timer/kemet-timer-display.js +0 -65
- package/dist/components/kemet-timer/kemet-timer-display.js.map +0 -1
- package/dist/components/kemet-timer/kemet-timer.d.ts +0 -36
- package/dist/components/kemet-timer/kemet-timer.js +0 -103
- package/dist/components/kemet-timer/kemet-timer.js.map +0 -1
- package/dist/components/kemet-timer/styles.d.ts +0 -2
- package/dist/components/kemet-timer/styles.js.map +0 -1
- package/dist/components/kemet-timer/types.d.ts +0 -1
- package/dist/components/kemet-timer/types.js +0 -2
- package/dist/components/kemet-timer/types.js.map +0 -1
- package/dist/components/kemet-toggle/docs/stories.d.ts +0 -11
- package/dist/components/kemet-toggle/docs/stories.js +0 -43
- package/dist/components/kemet-toggle/docs/stories.js.map +0 -1
- package/dist/components/kemet-toggle/kemet-toggle.d.ts +0 -60
- package/dist/components/kemet-toggle/kemet-toggle.js +0 -130
- package/dist/components/kemet-toggle/kemet-toggle.js.map +0 -1
- package/dist/components/kemet-toggle/spec.d.ts +0 -1
- package/dist/components/kemet-toggle/spec.js +0 -46
- package/dist/components/kemet-toggle/spec.js.map +0 -1
- package/dist/components/kemet-toggle/styles.d.ts +0 -1
- package/dist/components/kemet-toggle/styles.js.map +0 -1
- package/dist/components/kemet-toggle/types.d.ts +0 -10
- package/dist/components/kemet-toggle/types.js +0 -2
- package/dist/components/kemet-toggle/types.js.map +0 -1
- package/dist/components/kemet-tooltip/docs/stories.d.ts +0 -14
- package/dist/components/kemet-tooltip/docs/stories.js +0 -97
- package/dist/components/kemet-tooltip/docs/stories.js.map +0 -1
- package/dist/components/kemet-tooltip/kemet-tooltip.d.ts +0 -33
- package/dist/components/kemet-tooltip/kemet-tooltip.js +0 -69
- package/dist/components/kemet-tooltip/kemet-tooltip.js.map +0 -1
- package/dist/components/kemet-tooltip/styles.d.ts +0 -1
- package/dist/components/kemet-tooltip/styles.js.map +0 -1
- package/dist/components/kemet-tooltip/types.d.ts +0 -3
- package/dist/components/kemet-tooltip/types.js +0 -2
- package/dist/components/kemet-tooltip/types.js.map +0 -1
- package/dist/components/kemet-tracker/docs/stories.d.ts +0 -11
- package/dist/components/kemet-tracker/docs/stories.js +0 -42
- package/dist/components/kemet-tracker/docs/stories.js.map +0 -1
- package/dist/components/kemet-tracker/kemet-tracker-step.d.ts +0 -63
- package/dist/components/kemet-tracker/kemet-tracker-step.js +0 -127
- package/dist/components/kemet-tracker/kemet-tracker-step.js.map +0 -1
- package/dist/components/kemet-tracker/kemet-tracker.d.ts +0 -27
- package/dist/components/kemet-tracker/kemet-tracker.js +0 -70
- package/dist/components/kemet-tracker/kemet-tracker.js.map +0 -1
- package/dist/components/kemet-tracker/styles.d.ts +0 -1
- package/dist/components/kemet-tracker/styles.js.map +0 -1
- package/dist/components/kemet-tracker/types.d.ts +0 -13
- package/dist/components/kemet-tracker/types.js +0 -2
- package/dist/components/kemet-tracker/types.js.map +0 -1
- package/dist/components/kemet-upload/docs/stories.d.ts +0 -10
- package/dist/components/kemet-upload/docs/stories.js +0 -52
- package/dist/components/kemet-upload/docs/stories.js.map +0 -1
- package/dist/components/kemet-upload/kemet-upload-file.d.ts +0 -46
- package/dist/components/kemet-upload/kemet-upload-file.js +0 -109
- package/dist/components/kemet-upload/kemet-upload-file.js.map +0 -1
- package/dist/components/kemet-upload/kemet-upload.d.ts +0 -58
- package/dist/components/kemet-upload/kemet-upload.js +0 -149
- package/dist/components/kemet-upload/kemet-upload.js.map +0 -1
- package/dist/components/kemet-upload/styles.d.ts +0 -3
- package/dist/components/kemet-upload/styles.js.map +0 -1
- package/dist/components/kemet-upload/types.d.ts +0 -21
- package/dist/components/kemet-upload/types.js +0 -2
- package/dist/components/kemet-upload/types.js.map +0 -1
- package/dist/kemet-components.bundle.js +0 -83
- package/dist/kemet-components.bundle.js.map +0 -1
- package/dist/kemet-components.cjs +0 -12149
- package/dist/kemet-components.js +0 -12147
- package/dist/styles/components/_config.scss +0 -4
- package/dist/styles/components/accordion.scss +0 -9
- package/dist/styles/components/scrollsnap.scss +0 -11
- package/dist/styles/kemet.components.css +0 -23
- package/dist/styles/kemet.components.css.map +0 -1
- package/dist/styles/kemet.components.scss +0 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utilities/controllers/forms.d.ts +0 -11
- package/dist/utilities/controllers/forms.js +0 -100
- package/dist/utilities/controllers/forms.js.map +0 -1
- package/dist/utilities/controllers/forms.spec.d.ts +0 -2
- package/dist/utilities/controllers/forms.spec.js +0 -36
- package/dist/utilities/controllers/forms.spec.js.map +0 -1
- package/dist/utilities/misc/constants.d.ts +0 -5
- package/dist/utilities/misc/constants.js +0 -6
- package/dist/utilities/misc/constants.js.map +0 -1
- package/dist/utilities/misc/drag.d.ts +0 -6
- package/dist/utilities/misc/drag.js +0 -63
- package/dist/utilities/misc/drag.js.map +0 -1
- package/dist/utilities/misc/events.d.ts +0 -1
- package/dist/utilities/misc/events.js +0 -4
- package/dist/utilities/misc/events.js.map +0 -1
- package/index.js +0 -1
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { html, LitElement } from 'lit';
|
|
3
|
-
import { customElement, property, query, state, } from 'lit/decorators.js';
|
|
4
|
-
import { live } from 'lit/directives/live.js';
|
|
5
|
-
import { stylesBase } from './styles';
|
|
6
|
-
import { emitEvent } from '../../utilities/misc/events';
|
|
7
|
-
/**
|
|
8
|
-
* @since 3.1.0
|
|
9
|
-
* @status stable
|
|
10
|
-
*
|
|
11
|
-
* @tagname kemet-multi-input
|
|
12
|
-
* @summary An input element that accepts multiple items from a combo.
|
|
13
|
-
*
|
|
14
|
-
* @prop {string} slug - Used for the id of the input. Should match the slug used in a control if applicable.
|
|
15
|
-
* @prop {string} name - The name of the input
|
|
16
|
-
* @prop {string} placeholder - The placeholder attribute
|
|
17
|
-
* @prop {string} minlength - The minlength attribute
|
|
18
|
-
* @prop {string} maxlength - The maxlength attribute
|
|
19
|
-
* @prop {string} min - The min attribute
|
|
20
|
-
* @prop {string} max - The max attribute
|
|
21
|
-
* @prop {string} step - The step attribute
|
|
22
|
-
* @prop {string} autocomplete - The autocomplete attribute
|
|
23
|
-
* @prop {string} pattern - The pattern attribute
|
|
24
|
-
* @prop {string} inputmode - The input mode attribute
|
|
25
|
-
* @prop {boolean} autofocus - The autofocus attribute
|
|
26
|
-
* @prop {boolean} disabled - The disable attribute
|
|
27
|
-
* @prop {boolean} readonly - The readonly attribute
|
|
28
|
-
* @prop {boolean} required - The required attribute
|
|
29
|
-
* @prop {string} type - The type of input
|
|
30
|
-
* @prop {string} value - The input's value
|
|
31
|
-
* @prop {boolean} invalid - States whether the input is invalid
|
|
32
|
-
* @prop {string} status - The status of the input
|
|
33
|
-
* @prop {boolean} validateOnBlur - Activates validation on blur
|
|
34
|
-
* @prop {string} ariaAutoComplete - Aria Autocomplete
|
|
35
|
-
* @prop {string} ariaControls - Aria Controls
|
|
36
|
-
* @prop {string} ariaActiveDescendant - Aria Active Descendant
|
|
37
|
-
* @prop {boolean} rounded - Displays rounded corners
|
|
38
|
-
* @prop {boolean} filled - Displays a filled input box
|
|
39
|
-
* @prop {string} iconRight - Custom Icon to the right of the input
|
|
40
|
-
* @prop {string} iconLeft - Custom Icon to the left of the input
|
|
41
|
-
* @prop {number} iconSize - Size of the icons
|
|
42
|
-
* @prop {object} validity - The HTML5 validity object.
|
|
43
|
-
* @prop {boolean} isPasswordVisible - Manages password visibility
|
|
44
|
-
* @prop {string} inputType - Input Type of keypress handled through handleInput(e)
|
|
45
|
-
* @prop {boolean} focused - Determines if the input is focused
|
|
46
|
-
*
|
|
47
|
-
* @csspart input
|
|
48
|
-
*
|
|
49
|
-
* @cssproperty --kemet-input-height - The height of the input.
|
|
50
|
-
* @cssproperty --kemet-input-padding - The padding on the input.
|
|
51
|
-
* @cssproperty --kemet-input-border - The border of the input.
|
|
52
|
-
* @cssproperty --kemet-input-border-color-error - The border of the error state.
|
|
53
|
-
* @cssproperty --kemet-input-border-color-success - The border of the success state.
|
|
54
|
-
* @cssproperty --kemet-input-border-color-warning - The border of the warning state.
|
|
55
|
-
* @cssproperty --kemet-input-icon-left-padding - The icon-left padding.
|
|
56
|
-
* @cssproperty --kemet-input-icon-right-padding - The icon-right padding.
|
|
57
|
-
* @cssproperty --kemet-input-border-radius-rounded - The border radius on rounded.
|
|
58
|
-
* @cssproperty --kemet-input-border-filled - The border on filled.
|
|
59
|
-
* @cssproperty --kemet-input-color-filled - The color on filled.
|
|
60
|
-
* @cssproperty --kemet-input-background-color-filled - The background-color on filled.
|
|
61
|
-
* @cssproperty --kemet-input-background-color-error - The error state background color.
|
|
62
|
-
* @cssproperty --kemet-input-background-color-success - The success state background color.
|
|
63
|
-
* @cssproperty --kemet-input-background-color-warning - The warning state background color.
|
|
64
|
-
*
|
|
65
|
-
* @event kemet-input-focused - Fires when the input receives and loses focus
|
|
66
|
-
* @event kemet-input-status Fires when there's a change in status. This event includes an object that reports: 1) the status. 2) HTML5 validity object. 3) the component element.
|
|
67
|
-
* Use the validity object to support custom validation messages.
|
|
68
|
-
* @event kemet-input-input - Fires when the input receives input
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
let KemetMultiInput = class KemetMultiInput extends LitElement {
|
|
72
|
-
constructor() {
|
|
73
|
-
/** @internal */
|
|
74
|
-
// formSubmitController: FormSubmitController;
|
|
75
|
-
super(...arguments);
|
|
76
|
-
this.rounded = false;
|
|
77
|
-
this.name = 'input';
|
|
78
|
-
this.value = '';
|
|
79
|
-
this.selections = [];
|
|
80
|
-
}
|
|
81
|
-
firstUpdated() {
|
|
82
|
-
// elements
|
|
83
|
-
this.field = this.closest('kemet-field');
|
|
84
|
-
this.combo = this.field.querySelector('kemet-combo');
|
|
85
|
-
if (this.combo) {
|
|
86
|
-
this.combo.addEventListener('kemet-combo-selection', (event) => this.addComboItem(event));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
updated() {
|
|
90
|
-
if (this.chips)
|
|
91
|
-
this.calculatePadding();
|
|
92
|
-
}
|
|
93
|
-
render() {
|
|
94
|
-
return html `
|
|
95
|
-
<div>
|
|
96
|
-
<input
|
|
97
|
-
part="input"
|
|
98
|
-
id="input"
|
|
99
|
-
name=${this.name}
|
|
100
|
-
@input=${this.handleInput}
|
|
101
|
-
@focus=${this.handleFocus}
|
|
102
|
-
.value=${live(this.value)}
|
|
103
|
-
/>
|
|
104
|
-
${this.makeSelections()}
|
|
105
|
-
</div>
|
|
106
|
-
`;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Handles when a selection is made from a combo
|
|
110
|
-
* @private
|
|
111
|
-
* @param event
|
|
112
|
-
*/
|
|
113
|
-
addComboItem(event) {
|
|
114
|
-
this.value = '';
|
|
115
|
-
const isPresent = this.selections.find(selection => selection.id === event.detail.id);
|
|
116
|
-
if (!isPresent)
|
|
117
|
-
this.selections = [...this.selections, event.detail];
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Handles when the input receives input
|
|
121
|
-
* @private
|
|
122
|
-
*/
|
|
123
|
-
handleInput(event) {
|
|
124
|
-
emitEvent(this, 'kemet-input-input', event.target.value);
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Handles when the input is focused
|
|
128
|
-
*/
|
|
129
|
-
handleFocus(event) {
|
|
130
|
-
emitEvent(this, 'kemet-multi-input-focus', event.target.value);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Renders the chips from the selections of the combo
|
|
134
|
-
* @private
|
|
135
|
-
*/
|
|
136
|
-
makeSelections() {
|
|
137
|
-
const selections = this.selections.map(selection => html `
|
|
138
|
-
<li part="chip">
|
|
139
|
-
<span>${selection.text}</span>
|
|
140
|
-
<button @click=${this.handleRemoveChip}>×</button>
|
|
141
|
-
</li>
|
|
142
|
-
`);
|
|
143
|
-
if (this.selections) {
|
|
144
|
-
return html `<ul part="chips">${selections}</ul>`;
|
|
145
|
-
}
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* calculates padding to properly place the cursor of the input
|
|
150
|
-
* @private
|
|
151
|
-
*/
|
|
152
|
-
calculatePadding() {
|
|
153
|
-
this.paddingLeft = this.chips.offsetWidth + 16;
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* handle removing a chip from the selections
|
|
157
|
-
* @private
|
|
158
|
-
*/
|
|
159
|
-
handleRemoveChip(event) {
|
|
160
|
-
const text = event.target.closest('[part=chip]').querySelector('span').innerText;
|
|
161
|
-
this.selections = this.selections.filter(selection => selection.text !== text);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
KemetMultiInput.styles = [stylesBase];
|
|
165
|
-
__decorate([
|
|
166
|
-
property({ type: Boolean })
|
|
167
|
-
], KemetMultiInput.prototype, "rounded", void 0);
|
|
168
|
-
__decorate([
|
|
169
|
-
property({ type: String })
|
|
170
|
-
], KemetMultiInput.prototype, "name", void 0);
|
|
171
|
-
__decorate([
|
|
172
|
-
state()
|
|
173
|
-
], KemetMultiInput.prototype, "value", void 0);
|
|
174
|
-
__decorate([
|
|
175
|
-
state()
|
|
176
|
-
], KemetMultiInput.prototype, "selections", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
state()
|
|
179
|
-
], KemetMultiInput.prototype, "paddingLeft", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
state()
|
|
182
|
-
], KemetMultiInput.prototype, "field", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
state()
|
|
185
|
-
], KemetMultiInput.prototype, "combo", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
query('[part=chips]')
|
|
188
|
-
], KemetMultiInput.prototype, "chips", void 0);
|
|
189
|
-
KemetMultiInput = __decorate([
|
|
190
|
-
customElement('kemet-multi-input')
|
|
191
|
-
], KemetMultiInput);
|
|
192
|
-
export default KemetMultiInput;
|
|
193
|
-
//# sourceMappingURL=kemet-multi-input.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kemet-multi-input.js","sourceRoot":"","sources":["../../../src/components/kemet-multi-input/kemet-multi-input.ts"],"names":[],"mappings":"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","sourcesContent":["import { html, LitElement } from 'lit';\nimport {\n customElement, property, query, state,\n} from 'lit/decorators.js';\nimport { live } from 'lit/directives/live.js';\nimport { stylesBase } from './styles';\nimport { emitEvent } from '../../utilities/misc/events';\nimport { IComboSelection } from './types';\n\n/**\n * @since 3.1.0\n * @status stable\n *\n * @tagname kemet-multi-input\n * @summary An input element that accepts multiple items from a combo.\n *\n * @prop {string} slug - Used for the id of the input. Should match the slug used in a control if applicable.\n * @prop {string} name - The name of the input\n * @prop {string} placeholder - The placeholder attribute\n * @prop {string} minlength - The minlength attribute\n * @prop {string} maxlength - The maxlength attribute\n * @prop {string} min - The min attribute\n * @prop {string} max - The max attribute\n * @prop {string} step - The step attribute\n * @prop {string} autocomplete - The autocomplete attribute\n * @prop {string} pattern - The pattern attribute\n * @prop {string} inputmode - The input mode attribute\n * @prop {boolean} autofocus - The autofocus attribute\n * @prop {boolean} disabled - The disable attribute\n * @prop {boolean} readonly - The readonly attribute\n * @prop {boolean} required - The required attribute\n * @prop {string} type - The type of input\n * @prop {string} value - The input's value\n * @prop {boolean} invalid - States whether the input is invalid\n * @prop {string} status - The status of the input\n * @prop {boolean} validateOnBlur - Activates validation on blur\n * @prop {string} ariaAutoComplete - Aria Autocomplete\n * @prop {string} ariaControls - Aria Controls\n * @prop {string} ariaActiveDescendant - Aria Active Descendant\n * @prop {boolean} rounded - Displays rounded corners\n * @prop {boolean} filled - Displays a filled input box\n * @prop {string} iconRight - Custom Icon to the right of the input\n * @prop {string} iconLeft - Custom Icon to the left of the input\n * @prop {number} iconSize - Size of the icons\n * @prop {object} validity - The HTML5 validity object.\n * @prop {boolean} isPasswordVisible - Manages password visibility\n * @prop {string} inputType - Input Type of keypress handled through handleInput(e)\n * @prop {boolean} focused - Determines if the input is focused\n *\n * @csspart input\n *\n * @cssproperty --kemet-input-height - The height of the input.\n * @cssproperty --kemet-input-padding - The padding on the input.\n * @cssproperty --kemet-input-border - The border of the input.\n * @cssproperty --kemet-input-border-color-error - The border of the error state.\n * @cssproperty --kemet-input-border-color-success - The border of the success state.\n * @cssproperty --kemet-input-border-color-warning - The border of the warning state.\n * @cssproperty --kemet-input-icon-left-padding - The icon-left padding.\n * @cssproperty --kemet-input-icon-right-padding - The icon-right padding.\n * @cssproperty --kemet-input-border-radius-rounded - The border radius on rounded.\n * @cssproperty --kemet-input-border-filled - The border on filled.\n * @cssproperty --kemet-input-color-filled - The color on filled.\n * @cssproperty --kemet-input-background-color-filled - The background-color on filled.\n * @cssproperty --kemet-input-background-color-error - The error state background color.\n * @cssproperty --kemet-input-background-color-success - The success state background color.\n * @cssproperty --kemet-input-background-color-warning - The warning state background color.\n *\n * @event kemet-input-focused - Fires when the input receives and loses focus\n * @event kemet-input-status Fires when there's a change in status. This event includes an object that reports: 1) the status. 2) HTML5 validity object. 3) the component element.\n * Use the validity object to support custom validation messages.\n * @event kemet-input-input - Fires when the input receives input\n *\n */\n\n@customElement('kemet-multi-input')\nexport default class KemetMultiInput extends LitElement {\n /** @internal */\n // formSubmitController: FormSubmitController;\n\n static styles = [stylesBase];\n\n @property({ type: Boolean })\n rounded: boolean = false;\n\n @property({ type: String })\n name: string = 'input';\n\n @state()\n value: string = '';\n\n @state()\n selections: IComboSelection[] = [];\n\n @state()\n paddingLeft: number;\n\n @state()\n field;\n\n @state()\n combo;\n\n @query('[part=chips]')\n chips;\n\n firstUpdated() {\n // elements\n this.field = this.closest('kemet-field');\n this.combo = this.field.querySelector('kemet-combo');\n\n if (this.combo) {\n this.combo.addEventListener('kemet-combo-selection', (event: CustomEvent) => this.addComboItem(event));\n }\n }\n\n updated() {\n if (this.chips) this.calculatePadding();\n }\n\n render() {\n return html`\n <div>\n <input\n part=\"input\"\n id=\"input\"\n name=${this.name}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n .value=${live(this.value)}\n />\n ${this.makeSelections()}\n </div>\n `;\n }\n\n /**\n * Handles when a selection is made from a combo\n * @private\n * @param event\n */\n\n addComboItem(event: CustomEvent) {\n this.value = '';\n const isPresent = this.selections.find(selection => selection.id === event.detail.id);\n if (!isPresent) this.selections = [...this.selections, event.detail];\n }\n\n /**\n * Handles when the input receives input\n * @private\n */\n handleInput(event) {\n emitEvent(this, 'kemet-input-input', event.target.value);\n }\n\n /**\n * Handles when the input is focused\n */\n handleFocus(event) {\n emitEvent(this, 'kemet-multi-input-focus', event.target.value);\n }\n\n /**\n * Renders the chips from the selections of the combo\n * @private\n */\n makeSelections() {\n const selections = this.selections.map(selection => html`\n <li part=\"chip\">\n <span>${selection.text}</span>\n <button @click=${this.handleRemoveChip}>×</button>\n </li>\n `);\n\n if (this.selections) {\n return html`<ul part=\"chips\">${selections}</ul>`;\n }\n\n return null;\n }\n\n /**\n * calculates padding to properly place the cursor of the input\n * @private\n */\n calculatePadding() {\n this.paddingLeft = this.chips.offsetWidth + 16;\n }\n\n /**\n * handle removing a chip from the selections\n * @private\n */\n handleRemoveChip(event) {\n const text = event.target.closest('[part=chip]').querySelector('span').innerText;\n this.selections = this.selections.filter(selection => selection.text !== text);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kemet-multi-input': KemetMultiInput\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const stylesBase: import("lit").CSSResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/kemet-multi-input/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoF5B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const stylesBase = css`\n :host {\n --kemet-input-height: 50px;\n --kemet-input-padding: 0.5rem 1rem;\n --kemet-input-border: 1px solid rgb(var(--kemet-color-foreground));\n --kemet-input-border-radius-rounded: var(--kemet-border-radius-lg);\n --kemet-input-border-filled: none;\n --kemet-input-color-filled: rgb(var(--kemet-color-white));\n --kemet-input-background-color-filled: rgb(var(--kemet-color-primary));\n --kemet-input-color-filled: rgb(var(--kemet-color-white));\n --kemet-input-background-color-error: rgb(var(--kemet-color-error));\n --kemet-input-background-color-success: rgb(var(--kemet-color-success));\n --kemet-input-background-color-warning: rgb(var(--kemet-color-warning));\n\n --kemet-multi-input-chip-color: rgb(var(--kemet-color-background));\n --kemet-multi-input-chip-background: rgb(var(--kemet-color-foreground));\n\n position: relative;\n display: block;\n }\n\n input {\n color: rgb(var(--kemet-color-text));\n display: block;\n font-size: 1rem;\n width: 100%;\n height: var(--kemet-input-height);\n padding: var(--kemet-input-padding);\n border: var(--kemet-input-border);\n appearance: none;\n box-sizing: border-box;\n background-color: transparent;\n }\n\n :host([disabled]) input {\n opacity: 0.5;\n }\n\n :host([rounded]) input {\n border-radius: var(--kemet-input-border-radius-rounded);\n }\n\n :host([filled]) input {\n border: var(--kemet-input-border-filled);\n color: var(--kemet-input-color-filled);\n background-color: var(--kemet-input-background-color-filled);\n }\n\n div {\n display: flex;\n gap: 1rem;\n flex-direction: column;\n }\n\n ul {\n display: flex;\n gap: 0.5rem;\n margin: 0;\n padding: 0;\n list-style: none;\n flex-wrap: wrap;\n }\n\n li {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n padding: 0.25rem 0.5rem;\n color: var(--kemet-multi-input-chip-color);\n background-color: var(--kemet-multi-input-chip-background);\n }\n\n :host([rounded]) li {\n border-radius: var(--kemet-input-border-radius-rounded);\n }\n\n button {\n color: inherit;\n cursor: pointer;\n font-size: 1.25rem;\n padding: 0;\n border: 0;\n background-color: transparent\n }\n`;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/kemet-multi-input/types.ts"],"names":[],"mappings":"","sourcesContent":["export interface IComboSelection {\n element: HTMLUListElement;\n text: string;\n id: string;\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
-
import '../kemet-password';
|
|
3
|
-
import '../../kemet-input/kemet-input';
|
|
4
|
-
import '../../kemet-tabs/kemet-tabs';
|
|
5
|
-
import '../../kemet-tabs/kemet-tab';
|
|
6
|
-
import '../../kemet-tabs/kemet-tab-panel';
|
|
7
|
-
declare const meta: Meta;
|
|
8
|
-
export default meta;
|
|
9
|
-
type Story = StoryObj;
|
|
10
|
-
export declare const Standard: Story;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import '../kemet-password';
|
|
3
|
-
import '../../kemet-input/kemet-input';
|
|
4
|
-
import '../../kemet-tabs/kemet-tabs';
|
|
5
|
-
import '../../kemet-tabs/kemet-tab';
|
|
6
|
-
import '../../kemet-tabs/kemet-tab-panel';
|
|
7
|
-
const meta = {
|
|
8
|
-
title: 'Components / Password',
|
|
9
|
-
component: 'kemet-password',
|
|
10
|
-
args: {
|
|
11
|
-
rules: [
|
|
12
|
-
{ pattern: '(?=.{8,}$)', message: 'At least 8 characters long' },
|
|
13
|
-
{ pattern: '(?=.*[a-z])(?=.*[A-Z])', message: 'Uppercase and lowercase' },
|
|
14
|
-
{ pattern: '(?=.*[0-9])', message: 'At least one number (0-9)' },
|
|
15
|
-
],
|
|
16
|
-
message: 'Please make sure you meet all the requirements.',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
export default meta;
|
|
20
|
-
const Template = (args) => html `
|
|
21
|
-
<kemet-field slug="new-password" label="New Password">
|
|
22
|
-
<kemet-input slot="input" type="password" name="new-password"></kemet-input>
|
|
23
|
-
<kemet-password slot="component" message=${args.message} .rules=${args.rules}></kemet-password>
|
|
24
|
-
</kemet-field>
|
|
25
|
-
`;
|
|
26
|
-
export const Standard = {
|
|
27
|
-
render: (args) => Template(args),
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stories.js","sourceRoot":"","sources":["../../../../src/components/kemet-password/docs/stories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAG3B,OAAO,mBAAmB,CAAC;AAE3B,OAAO,+BAA+B,CAAC;AACvC,OAAO,6BAA6B,CAAC;AACrC,OAAO,4BAA4B,CAAC;AACpC,OAAO,kCAAkC,CAAC;AAE1C,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,uBAAuB;IAC9B,SAAS,EAAE,gBAAgB;IAC3B,IAAI,EAAE;QACJ,KAAK,EAAE;YACL,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,4BAA4B,EAAE;YAChE,EAAE,OAAO,EAAE,wBAAwB,EAAE,OAAO,EAAE,yBAAyB,EAAE;YACzE,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,2BAA2B,EAAE;SACjE;QACD,OAAO,EAAE,iDAAiD;KAC3D;CACF,CAAC;AACF,eAAe,IAAI,CAAC;AAIpB,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAA;;;+CAGgB,IAAI,CAAC,OAAO,WAAW,IAAI,CAAC,KAAK;;CAE/E,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,MAAM,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;CACtC,CAAC","sourcesContent":["import { html } from 'lit';\nimport type { Meta, StoryObj } from '@storybook/web-components';\n\nimport '../kemet-password';\n\nimport '../../kemet-input/kemet-input';\nimport '../../kemet-tabs/kemet-tabs';\nimport '../../kemet-tabs/kemet-tab';\nimport '../../kemet-tabs/kemet-tab-panel';\n\nconst meta: Meta = {\n title: 'Components / Password',\n component: 'kemet-password',\n args: {\n rules: [\n { pattern: '(?=.{8,}$)', message: 'At least 8 characters long' },\n { pattern: '(?=.*[a-z])(?=.*[A-Z])', message: 'Uppercase and lowercase' },\n { pattern: '(?=.*[0-9])', message: 'At least one number (0-9)' },\n ],\n message: 'Please make sure you meet all the requirements.',\n },\n};\nexport default meta;\n\ntype Story = StoryObj;\n\nconst Template = (args) => html`\n <kemet-field slug=\"new-password\" label=\"New Password\">\n <kemet-input slot=\"input\" type=\"password\" name=\"new-password\"></kemet-input>\n <kemet-password slot=\"component\" message=${args.message} .rules=${args.rules}></kemet-password>\n </kemet-field>\n`;\n\nexport const Standard: Story = {\n render: (args: any) => Template(args),\n};\n"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
-
import { KemetFieldInterface } from '../kemet-field/types';
|
|
3
|
-
import { KemetInputInterface } from '../kemet-input/types';
|
|
4
|
-
import { KemetTextareaInterface } from '../kemet-textarea/types';
|
|
5
|
-
import { TypeStatus } from './types';
|
|
6
|
-
/**
|
|
7
|
-
* @since 1.2.0
|
|
8
|
-
* @status stable
|
|
9
|
-
*
|
|
10
|
-
* @tagname kemet-password
|
|
11
|
-
* @summary Gauges the strength of a password entered by the user.
|
|
12
|
-
*
|
|
13
|
-
* @prop {array} rules - An array of objects containing the rules the password must meet.
|
|
14
|
-
* @prop {boolean} show - Controls the display of the component.
|
|
15
|
-
* @prop {string} value - The value of the input component.
|
|
16
|
-
* @prop {string} message - A message that is above the rules.
|
|
17
|
-
* @prop {string} strength - The strength of the password. Weak | Better | Strong.
|
|
18
|
-
* @prop {string} icon
|
|
19
|
-
* @prop {number} iconSize
|
|
20
|
-
*
|
|
21
|
-
* @event kemet-password-status - Fires when there's a change in status.
|
|
22
|
-
*
|
|
23
|
-
* @csspart status - The status message.
|
|
24
|
-
* @csspart indicator - The strength indicator bars.
|
|
25
|
-
* @csspart message - A message to display to the user.
|
|
26
|
-
* @csspart rules - A description of rules to follow.
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
interface IOptions {
|
|
30
|
-
pattern: string;
|
|
31
|
-
message: string;
|
|
32
|
-
meetsCriteria?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export default class KemetPassword extends LitElement {
|
|
35
|
-
static styles: import("lit").CSSResult[];
|
|
36
|
-
rules: IOptions[];
|
|
37
|
-
show: boolean;
|
|
38
|
-
value: string;
|
|
39
|
-
message: string;
|
|
40
|
-
strength: string;
|
|
41
|
-
icon: string;
|
|
42
|
-
iconSize: number;
|
|
43
|
-
status: TypeStatus;
|
|
44
|
-
field: KemetFieldInterface;
|
|
45
|
-
input: KemetInputInterface | KemetTextareaInterface;
|
|
46
|
-
firstUpdated(): void;
|
|
47
|
-
render(): TemplateResult<1>;
|
|
48
|
-
/**
|
|
49
|
-
* Makes the list of rules
|
|
50
|
-
* @private
|
|
51
|
-
* @returns {TemplateResult<1>[]} the criteria rules
|
|
52
|
-
*/
|
|
53
|
-
makeRules(): TemplateResult<1>[];
|
|
54
|
-
/**
|
|
55
|
-
* Makes the check icon if the criteria has been met
|
|
56
|
-
* @param {boolean} meetsCriteria
|
|
57
|
-
* @private
|
|
58
|
-
* @returns {TemplateResult} an icon component
|
|
59
|
-
*/
|
|
60
|
-
makeCheckIcon(meetsCriteria: boolean): TemplateResult;
|
|
61
|
-
/**
|
|
62
|
-
* Handles the kemet-input-input event
|
|
63
|
-
* @param {*} event
|
|
64
|
-
* @private
|
|
65
|
-
*/
|
|
66
|
-
handleInput(event: CustomEvent): void;
|
|
67
|
-
/**
|
|
68
|
-
* Determines the strength of the password
|
|
69
|
-
* @private
|
|
70
|
-
*/
|
|
71
|
-
setStrength(): void;
|
|
72
|
-
/**
|
|
73
|
-
* Determines whether to show or hide the component
|
|
74
|
-
* @private
|
|
75
|
-
*/
|
|
76
|
-
visibility(): void;
|
|
77
|
-
}
|
|
78
|
-
declare global {
|
|
79
|
-
interface HTMLElementTagNameMap {
|
|
80
|
-
'kemet-password': KemetPassword;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
export {};
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { html, LitElement } from 'lit';
|
|
3
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
-
import { emitEvent } from '../../utilities/misc/events';
|
|
5
|
-
import { stylesBase } from './styles';
|
|
6
|
-
let KemetPassword = class KemetPassword extends LitElement {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.rules = [
|
|
10
|
-
{ pattern: '(?=.{8,}$)', message: 'At least 8 characters long' },
|
|
11
|
-
{ pattern: '(?=.*[a-z])(?=.*[A-Z])', message: 'Uppercase and lowercase' },
|
|
12
|
-
{ pattern: '(?=.*[0-9])', message: 'At least one number (0-9)' },
|
|
13
|
-
];
|
|
14
|
-
this.message = 'Please make sure you meet all the requirements.';
|
|
15
|
-
this.icon = 'check2';
|
|
16
|
-
this.iconSize = 16;
|
|
17
|
-
}
|
|
18
|
-
firstUpdated() {
|
|
19
|
-
// elements
|
|
20
|
-
this.field = this.closest('kemet-field');
|
|
21
|
-
this.input = this.field.querySelector('[slot="input"]');
|
|
22
|
-
// events listeners
|
|
23
|
-
this.input.addEventListener('kemet-input-input', this.handleInput.bind(this));
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
return html `
|
|
27
|
-
<div role="alert" aria-live="assertive">
|
|
28
|
-
<div class="status status--${this.strength}" part="status">
|
|
29
|
-
<span>${this.strength}</span>
|
|
30
|
-
<ul class="indicator" part="indicator">
|
|
31
|
-
<li></li>
|
|
32
|
-
<li></li>
|
|
33
|
-
<li></li>
|
|
34
|
-
</ul>
|
|
35
|
-
</div>
|
|
36
|
-
<p class="message" part="message">${this.message}</p>
|
|
37
|
-
<ul class="rules" part="rules">
|
|
38
|
-
${this.makeRules()}
|
|
39
|
-
</ul>
|
|
40
|
-
</div>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Makes the list of rules
|
|
45
|
-
* @private
|
|
46
|
-
* @returns {TemplateResult<1>[]} the criteria rules
|
|
47
|
-
*/
|
|
48
|
-
makeRules() {
|
|
49
|
-
if (this.input) {
|
|
50
|
-
return this.rules.map((rule, index) => {
|
|
51
|
-
const regExp = new RegExp(rule.pattern);
|
|
52
|
-
const meetsCriteria = regExp.test(this.input.value);
|
|
53
|
-
this.rules[index].meetsCriteria = meetsCriteria;
|
|
54
|
-
return html `<li>${this.makeCheckIcon(meetsCriteria)} ${rule.message}</li>`;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Makes the check icon if the criteria has been met
|
|
61
|
-
* @param {boolean} meetsCriteria
|
|
62
|
-
* @private
|
|
63
|
-
* @returns {TemplateResult} an icon component
|
|
64
|
-
*/
|
|
65
|
-
makeCheckIcon(meetsCriteria) {
|
|
66
|
-
if (meetsCriteria) {
|
|
67
|
-
return html `<kemet-icon icon=${this.icon} size=${this.iconSize}></kemet-icon>`;
|
|
68
|
-
}
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Handles the kemet-input-input event
|
|
73
|
-
* @param {*} event
|
|
74
|
-
* @private
|
|
75
|
-
*/
|
|
76
|
-
handleInput(event) {
|
|
77
|
-
this.value = event.detail;
|
|
78
|
-
this.setStrength();
|
|
79
|
-
this.visibility();
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Determines the strength of the password
|
|
83
|
-
* @private
|
|
84
|
-
*/
|
|
85
|
-
setStrength() {
|
|
86
|
-
// We use a setTimeout here because makeRules adds the meetsCriteria
|
|
87
|
-
// property to the rules. We need that to be set by render() before
|
|
88
|
-
// setting the Strength because the percentage calc is based on it
|
|
89
|
-
setTimeout(() => {
|
|
90
|
-
const totalRules = this.rules.length;
|
|
91
|
-
const metRules = this.rules.filter(rule => rule.meetsCriteria).length;
|
|
92
|
-
const metRulesPercentage = Math.round((metRules / totalRules) * 100) / 100;
|
|
93
|
-
if (metRulesPercentage <= 0.33) {
|
|
94
|
-
this.strength = 'weak';
|
|
95
|
-
this.status = 'error';
|
|
96
|
-
}
|
|
97
|
-
if (metRulesPercentage > 0.33 && metRulesPercentage <= 0.67) {
|
|
98
|
-
this.strength = 'better';
|
|
99
|
-
this.status = 'error';
|
|
100
|
-
}
|
|
101
|
-
if (metRulesPercentage > 0.67) {
|
|
102
|
-
this.strength = 'strong';
|
|
103
|
-
this.status = 'success';
|
|
104
|
-
}
|
|
105
|
-
emitEvent(this, 'kemet-password-status', {
|
|
106
|
-
status: this.status,
|
|
107
|
-
validity: { meetsPasswordCriteria: this.status === 'success' },
|
|
108
|
-
element: this,
|
|
109
|
-
});
|
|
110
|
-
}, 1);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Determines whether to show or hide the component
|
|
114
|
-
* @private
|
|
115
|
-
*/
|
|
116
|
-
visibility() {
|
|
117
|
-
this.show = this.value.length > 0;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
KemetPassword.styles = [stylesBase];
|
|
121
|
-
__decorate([
|
|
122
|
-
property({ type: Array })
|
|
123
|
-
], KemetPassword.prototype, "rules", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
property({ type: Boolean, reflect: true })
|
|
126
|
-
], KemetPassword.prototype, "show", void 0);
|
|
127
|
-
__decorate([
|
|
128
|
-
property({ type: String })
|
|
129
|
-
], KemetPassword.prototype, "value", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
property({ type: String })
|
|
132
|
-
], KemetPassword.prototype, "message", void 0);
|
|
133
|
-
__decorate([
|
|
134
|
-
property({ type: String })
|
|
135
|
-
], KemetPassword.prototype, "strength", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
property({ type: String })
|
|
138
|
-
], KemetPassword.prototype, "icon", void 0);
|
|
139
|
-
__decorate([
|
|
140
|
-
property({ type: Number })
|
|
141
|
-
], KemetPassword.prototype, "iconSize", void 0);
|
|
142
|
-
__decorate([
|
|
143
|
-
state()
|
|
144
|
-
], KemetPassword.prototype, "status", void 0);
|
|
145
|
-
__decorate([
|
|
146
|
-
state()
|
|
147
|
-
], KemetPassword.prototype, "field", void 0);
|
|
148
|
-
__decorate([
|
|
149
|
-
state()
|
|
150
|
-
], KemetPassword.prototype, "input", void 0);
|
|
151
|
-
KemetPassword = __decorate([
|
|
152
|
-
customElement('kemet-password')
|
|
153
|
-
], KemetPassword);
|
|
154
|
-
export default KemetPassword;
|
|
155
|
-
//# sourceMappingURL=kemet-password.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kemet-password.js","sourceRoot":"","sources":["../../../src/components/kemet-password/kemet-password.ts"],"names":[],"mappings":"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","sourcesContent":["import { html, LitElement, TemplateResult } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { emitEvent } from '../../utilities/misc/events';\nimport { KemetFieldInterface } from '../kemet-field/types';\nimport { KemetInputInterface } from '../kemet-input/types';\nimport { KemetTextareaInterface } from '../kemet-textarea/types';\nimport { stylesBase } from './styles';\nimport { TypeStatus } from './types';\n\n/**\n * @since 1.2.0\n * @status stable\n *\n * @tagname kemet-password\n * @summary Gauges the strength of a password entered by the user.\n *\n * @prop {array} rules - An array of objects containing the rules the password must meet.\n * @prop {boolean} show - Controls the display of the component.\n * @prop {string} value - The value of the input component.\n * @prop {string} message - A message that is above the rules.\n * @prop {string} strength - The strength of the password. Weak | Better | Strong.\n * @prop {string} icon\n * @prop {number} iconSize\n *\n * @event kemet-password-status - Fires when there's a change in status.\n *\n * @csspart status - The status message.\n * @csspart indicator - The strength indicator bars.\n * @csspart message - A message to display to the user.\n * @csspart rules - A description of rules to follow.\n *\n */\n\ninterface IOptions {\n pattern: string;\n message: string;\n meetsCriteria?: boolean;\n}\n\n@customElement('kemet-password')\nexport default class KemetPassword extends LitElement {\n static styles = [stylesBase];\n\n @property({ type: Array })\n rules: IOptions[] = [\n { pattern: '(?=.{8,}$)', message: 'At least 8 characters long' },\n { pattern: '(?=.*[a-z])(?=.*[A-Z])', message: 'Uppercase and lowercase' },\n { pattern: '(?=.*[0-9])', message: 'At least one number (0-9)' },\n ];\n\n @property({ type: Boolean, reflect: true })\n show: boolean;\n\n @property({ type: String })\n value: string;\n\n @property({ type: String })\n message: string = 'Please make sure you meet all the requirements.';\n\n @property({ type: String })\n strength: string;\n\n @property({ type: String })\n icon: string = 'check2';\n\n @property({ type: Number })\n iconSize: number = 16;\n\n @state()\n status: TypeStatus;\n\n @state()\n field: KemetFieldInterface;\n\n @state()\n input: KemetInputInterface | KemetTextareaInterface;\n\n firstUpdated() {\n // elements\n this.field = this.closest('kemet-field');\n this.input = this.field.querySelector('[slot=\"input\"]');\n\n // events listeners\n this.input.addEventListener('kemet-input-input', this.handleInput.bind(this));\n }\n\n render() {\n return html`\n <div role=\"alert\" aria-live=\"assertive\">\n <div class=\"status status--${this.strength}\" part=\"status\">\n <span>${this.strength}</span>\n <ul class=\"indicator\" part=\"indicator\">\n <li></li>\n <li></li>\n <li></li>\n </ul>\n </div>\n <p class=\"message\" part=\"message\">${this.message}</p>\n <ul class=\"rules\" part=\"rules\">\n ${this.makeRules()}\n </ul>\n </div>\n `;\n }\n\n /**\n * Makes the list of rules\n * @private\n * @returns {TemplateResult<1>[]} the criteria rules\n */\n makeRules(): TemplateResult<1>[] {\n if (this.input) {\n return this.rules.map((rule, index) => {\n const regExp = new RegExp(rule.pattern);\n const meetsCriteria = regExp.test(this.input.value);\n this.rules[index].meetsCriteria = meetsCriteria;\n return html`<li>${this.makeCheckIcon(meetsCriteria)} ${rule.message}</li>`;\n });\n }\n\n return null;\n }\n\n /**\n * Makes the check icon if the criteria has been met\n * @param {boolean} meetsCriteria\n * @private\n * @returns {TemplateResult} an icon component\n */\n makeCheckIcon(meetsCriteria: boolean): TemplateResult {\n if (meetsCriteria) {\n return html`<kemet-icon icon=${this.icon} size=${this.iconSize}></kemet-icon>`;\n }\n\n return null;\n }\n\n /**\n * Handles the kemet-input-input event\n * @param {*} event\n * @private\n */\n handleInput(event: CustomEvent) {\n this.value = event.detail;\n this.setStrength();\n this.visibility();\n }\n\n /**\n * Determines the strength of the password\n * @private\n */\n setStrength() {\n // We use a setTimeout here because makeRules adds the meetsCriteria\n // property to the rules. We need that to be set by render() before\n // setting the Strength because the percentage calc is based on it\n setTimeout(() => {\n const totalRules = this.rules.length;\n const metRules = this.rules.filter(rule => rule.meetsCriteria).length;\n const metRulesPercentage = Math.round((metRules / totalRules) * 100) / 100;\n\n if (metRulesPercentage <= 0.33) {\n this.strength = 'weak';\n this.status = 'error';\n }\n\n if (metRulesPercentage > 0.33 && metRulesPercentage <= 0.67) {\n this.strength = 'better';\n this.status = 'error';\n }\n\n if (metRulesPercentage > 0.67) {\n this.strength = 'strong';\n this.status = 'success';\n }\n\n emitEvent(this, 'kemet-password-status', {\n status: this.status,\n validity: { meetsPasswordCriteria: this.status === 'success' },\n element: this,\n });\n }, 1);\n }\n\n /**\n * Determines whether to show or hide the component\n * @private\n */\n visibility() {\n this.show = this.value.length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'kemet-password': KemetPassword\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const stylesBase: import("lit").CSSResult;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/kemet-password/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6E5B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const stylesBase = css`\n :host {\n color: inherit;\n display: none;\n }\n\n :host([show]) {\n display: block;\n }\n\n p {\n margin: 1.6rem 0;\n }\n\n .status {\n display: grid;\n align-items: center;\n grid-template-columns: 1fr auto;\n line-height: 1;\n margin-top: 0.8rem;\n }\n\n .status > span {\n text-transform: capitalize;\n }\n\n .status--weak,\n .status--better {\n color: rgb(var(--kemet-color-error));\n }\n\n .status--strong {\n color: rgb(var(--kemet-color-success));\n }\n\n .indicator {\n display: flex;\n gap: 0.4rem;\n margin: 0;\n list-style: none;\n }\n\n .indicator li {\n width: 1.6rem;\n height: 0.2rem;\n }\n\n .status--weak .indicator li:nth-child(1) {\n background-color: rgb(var(--kemet-color-error));\n }\n\n .status--better .indicator li:nth-child(1),\n .status--better .indicator li:nth-child(2) {\n background-color: rgb(var(--kemet-color-error));\n }\n\n .status--strong .indicator li {\n background-color: rgb(var(--kemet-color-success));\n }\n\n .rules {\n color: rgb(var(--kemet-color-foreground));\n line-height: 1.5;\n list-style: none;\n font-size: 90%;\n padding-left: 2rem;\n }\n\n .rules li {\n position: relative;\n }\n\n .rules kemet-icon {\n color: rgb(var(--kemet-color-success));\n position: absolute;\n left: -2rem;\n }\n`;\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type TypeStatus = 'standard' | 'error' | 'success' | 'warning';
|
|
2
|
-
export interface KemetPasswordInterface extends HTMLElement {
|
|
3
|
-
rules?: any[];
|
|
4
|
-
show?: boolean;
|
|
5
|
-
value?: string;
|
|
6
|
-
message?: string;
|
|
7
|
-
strength?: string;
|
|
8
|
-
icon?: string;
|
|
9
|
-
iconSize?: number;
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/kemet-password/types.ts"],"names":[],"mappings":"","sourcesContent":["export type TypeStatus = 'standard' | 'error' | 'success' | 'warning';\n\nexport interface KemetPasswordInterface extends HTMLElement {\n rules?: any[],\n show?: boolean,\n value?: string,\n message?: string,\n strength?: string,\n icon?: string,\n iconSize?: number,\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
2
|
-
import '../kemet-popper';
|
|
3
|
-
import '../kemet-popper-close';
|
|
4
|
-
import '../../kemet-tabs/kemet-tabs';
|
|
5
|
-
import '../../kemet-tabs/kemet-tab';
|
|
6
|
-
import '../../kemet-tabs/kemet-tab-panel';
|
|
7
|
-
import '../../kemet-button/kemet-button';
|
|
8
|
-
declare const meta: Meta;
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj;
|
|
11
|
-
export declare const Standard: Story;
|
|
12
|
-
export declare const OnClick: Story;
|