kemet-ui 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +3125 -968
- package/dist/components/kemet-accordion/kemet-accordion-panel.js +29 -31
- package/dist/components/kemet-accordion/kemet-accordion.js +12 -6
- package/dist/components/kemet-alert/kemet-alert.js +106 -0
- package/dist/components/kemet-alert/styles.js +104 -0
- package/dist/components/kemet-avatar/kemet-avatar.js +118 -0
- package/dist/components/kemet-avatar/kemet-avatars.js +41 -0
- package/dist/components/kemet-badge/kemet-badge.js +16 -12
- package/dist/components/kemet-button/kemet-button.js +42 -25
- package/dist/components/kemet-card/kemet-card.js +69 -0
- package/dist/components/kemet-card/styles.js +63 -0
- package/dist/components/kemet-carousel/kemet-carousel-current.js +13 -3
- package/dist/components/kemet-carousel/kemet-carousel-first.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-last.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-link.js +23 -17
- package/dist/components/kemet-carousel/kemet-carousel-next.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-prev.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-slide.js +14 -11
- package/dist/components/kemet-carousel/kemet-carousel-total.js +13 -3
- package/dist/components/kemet-carousel/kemet-carousel.js +63 -133
- package/dist/components/kemet-carousel/styles.js +66 -0
- package/dist/components/kemet-checkbox/kemet-checkbox.js +28 -35
- package/dist/components/kemet-combo/kemet-combo.js +43 -28
- package/dist/components/kemet-count/kemet-count.js +29 -40
- package/dist/components/kemet-draggable/kemet-draggable.js +21 -23
- package/dist/components/kemet-drawer/kemet-drawer.js +36 -35
- package/dist/components/kemet-drawer/{kemet-drawer.styles.js → styles.js} +0 -0
- package/dist/components/kemet-fab/kemet-fab.js +39 -138
- package/dist/components/kemet-fab/styles.js +95 -0
- package/dist/components/kemet-field/kemet-field.js +31 -40
- package/dist/components/kemet-flipcard/kemet-flipcard-trigger.js +12 -5
- package/dist/components/kemet-flipcard/kemet-flipcard.js +24 -4
- package/dist/components/kemet-icon/kemet-icon.js +19 -15
- package/dist/components/kemet-input/kemet-input.js +81 -174
- package/dist/components/kemet-modal/kemet-modal-close.js +13 -8
- package/dist/components/kemet-modal/kemet-modal.js +26 -21
- package/dist/components/kemet-modal/{kemet-modal.styles.js → styles.js} +0 -0
- package/dist/components/kemet-password/kemet-password.js +40 -132
- package/dist/components/kemet-password/styles.js +80 -0
- package/dist/components/kemet-popover/kemet-popover-close.js +13 -7
- package/dist/components/kemet-popover/kemet-popover.js +42 -51
- package/dist/components/kemet-popover/{kemet-popover.effects.styles.js → styles.effects.js} +0 -0
- package/dist/components/kemet-popover/{kemet-popover.tooltip.styles.js → styles.tooltip.js} +0 -0
- package/dist/components/kemet-radio/kemet-radio.js +35 -43
- package/dist/components/kemet-radio/kemet-radios.js +25 -34
- package/dist/components/kemet-rotator/kemet-rotator.js +18 -18
- package/dist/components/kemet-scroll-link/kemet-scroll-link.js +15 -13
- package/dist/components/kemet-scroll-nav/kemet-scroll-nav.js +19 -10
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-paginator.js +25 -30
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-slide.js +16 -9
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap.js +27 -15
- package/dist/components/kemet-select/kemet-option.js +17 -12
- package/dist/components/kemet-select/kemet-select.js +62 -102
- package/dist/components/kemet-sortable/kemet-sortable-item.js +11 -5
- package/dist/components/kemet-sortable/kemet-sortable.js +16 -14
- package/dist/components/kemet-svgs/kemet-svg.js +17 -15
- package/dist/components/kemet-svgs/kemet-svgs.js +11 -3
- package/dist/components/kemet-tabs/kemet-tab-panel.js +14 -6
- package/dist/components/kemet-tabs/kemet-tab.js +22 -25
- package/dist/components/kemet-tabs/kemet-tabs.js +43 -41
- package/dist/components/kemet-tabs/{kemet-tabs.styles.js → styles.js} +0 -0
- package/dist/components/kemet-textarea/kemet-textarea.js +25 -54
- package/dist/components/kemet-toggle/kemet-toggle.js +39 -38
- package/dist/components/kemet-tracker/kemet-tracker-step.js +49 -160
- package/dist/components/kemet-tracker/kemet-tracker.js +12 -12
- package/dist/components/kemet-tracker/styles.js +111 -0
- package/dist/components/kemet-upload/kemet-upload-file.js +35 -44
- package/dist/components/kemet-upload/kemet-upload.js +53 -95
- package/dist/components/kemet-upload/{kemet-upload-file.loaders.styles.js → styles.js} +0 -0
- package/dist/kemet-components.cjs +2821 -2455
- package/dist/kemet-components.js +2822 -2444
- package/dist/kemet-components.min.js +912 -674
- package/dist/utilities/misc/events.js +5 -0
- package/package.json +13 -11
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
2
3
|
import '../kemet-icon/kemet-icon.js';
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-accordion-panel
|
|
10
|
+
* @summary A blade for an accordion.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} opened - Determines the opened state of the panel
|
|
13
|
+
* @prop {string} maxHeight - Sets the max height of the panel's body
|
|
14
|
+
* @prop {string} slug - Uniquely identifies a panel for accessibility purposes
|
|
15
|
+
*
|
|
16
|
+
* @slot trigger - The trigger button that opens and closes the panel.
|
|
17
|
+
* @slot body - The body content of the panel.
|
|
18
|
+
* @slot icon - The icon for the panel.
|
|
19
|
+
*
|
|
20
|
+
* @cssproperty --kemet-accordion-panel-transition-speed - The speed of the opening and closing effect. Default: 0.3s.
|
|
21
|
+
*
|
|
22
|
+
* @csspart trigger - Contains the trigger for the panel.
|
|
23
|
+
* @csspart body - Contains the body for the panel.
|
|
24
|
+
*
|
|
25
|
+
* @event kemet-accordion-panel-opened - Fires when a panel is opened
|
|
26
|
+
* @event kemet-accordion-panel-closed - Fires when a panel is closed
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
|
|
4
30
|
export default class KemetAccordionPanel extends LitElement {
|
|
5
31
|
static get styles() {
|
|
6
32
|
return [
|
|
@@ -43,23 +69,14 @@ export default class KemetAccordionPanel extends LitElement {
|
|
|
43
69
|
|
|
44
70
|
static get properties() {
|
|
45
71
|
return {
|
|
46
|
-
/**
|
|
47
|
-
* Determines the opened state of the panel
|
|
48
|
-
*/
|
|
49
72
|
opened: {
|
|
50
73
|
type: Boolean,
|
|
51
74
|
reflect: true,
|
|
52
75
|
},
|
|
53
|
-
/**
|
|
54
|
-
* Sets the max height of the panel's body
|
|
55
|
-
*/
|
|
56
76
|
maxHeight: {
|
|
57
77
|
type: String,
|
|
58
78
|
attribute: 'max-height',
|
|
59
79
|
},
|
|
60
|
-
/**
|
|
61
|
-
* Uniquely identifies a panel for accessibility purposes
|
|
62
|
-
*/
|
|
63
80
|
slug: {
|
|
64
81
|
type: String,
|
|
65
82
|
},
|
|
@@ -76,6 +93,7 @@ export default class KemetAccordionPanel extends LitElement {
|
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
firstUpdated() {
|
|
96
|
+
/** @internal */
|
|
79
97
|
this.focusableSelector = 'body, a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]';
|
|
80
98
|
this.bodyElement = this.querySelector('[slot="body"]');
|
|
81
99
|
this.bodyElementFirst = this.bodyElement.querySelector(':first-child');
|
|
@@ -88,32 +106,12 @@ export default class KemetAccordionPanel extends LitElement {
|
|
|
88
106
|
updated(prevProps) {
|
|
89
107
|
if (!prevProps.get('opened') && this.opened === true) {
|
|
90
108
|
this.maxHeight = `${this.bodyElement.offsetHeight}px`;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Fires when a panel is opened
|
|
94
|
-
*/
|
|
95
|
-
this.dispatchEvent(
|
|
96
|
-
new CustomEvent('kemet-accordion-panel-opened', {
|
|
97
|
-
bubbles: true,
|
|
98
|
-
composed: true,
|
|
99
|
-
detail: this,
|
|
100
|
-
}),
|
|
101
|
-
);
|
|
109
|
+
emitEvent(this, 'kemet-accordion-panel-opened', this);
|
|
102
110
|
}
|
|
103
111
|
|
|
104
112
|
if (prevProps.get('opened') && this.opened === false) {
|
|
105
113
|
this.maxHeight = '0px';
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Fires when a panel is closed
|
|
109
|
-
*/
|
|
110
|
-
this.dispatchEvent(
|
|
111
|
-
new CustomEvent('kemet-accordion-panel-closed', {
|
|
112
|
-
bubbles: true,
|
|
113
|
-
composed: true,
|
|
114
|
-
detail: this,
|
|
115
|
-
}),
|
|
116
|
-
);
|
|
114
|
+
emitEvent(this, 'kemet-accordion-panel-closed', this);
|
|
117
115
|
}
|
|
118
116
|
|
|
119
117
|
this.a11y();
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
* @status stable
|
|
6
|
+
*
|
|
7
|
+
* @tagname kemet-accordion
|
|
8
|
+
* @summary A component that acts like a standard accordion.
|
|
9
|
+
*
|
|
10
|
+
* @prop {number} currentPanel - The index value for the most recently opened panel
|
|
11
|
+
* @prop {boolean} togglePanels - Support for closing all inactive panels when one is opened
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
|
|
3
15
|
export default class KemetAccordion extends LitElement {
|
|
4
16
|
static get styles() {
|
|
5
17
|
return [
|
|
@@ -13,15 +25,9 @@ export default class KemetAccordion extends LitElement {
|
|
|
13
25
|
|
|
14
26
|
static get properties() {
|
|
15
27
|
return {
|
|
16
|
-
/**
|
|
17
|
-
* The index value for the most recently opened panel
|
|
18
|
-
*/
|
|
19
28
|
currentPanel: {
|
|
20
29
|
type: Number,
|
|
21
30
|
},
|
|
22
|
-
/**
|
|
23
|
-
* Support for closing all inactive panels when one is opened
|
|
24
|
-
*/
|
|
25
31
|
togglePanels: {
|
|
26
32
|
type: Boolean,
|
|
27
33
|
attribute: 'toggle-panels',
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
import { stylesBase } from './styles.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.4.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-alert
|
|
10
|
+
* @summary Calls out important messages and notifications.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} opened - Determines if the alert is opened or not.
|
|
13
|
+
* @prop {boolean} reveal - Fades in the alert when opened.
|
|
14
|
+
* @prop {boolean} closable - Adds a close button to the alert.
|
|
15
|
+
* @prop {string} borderStatus - Adds a border that indicates the status.
|
|
16
|
+
* @prop {boolean} hidden - Hides the element from document flow.
|
|
17
|
+
* @prop {string} overlay - Fixes the alert over content in specified position.
|
|
18
|
+
*
|
|
19
|
+
* @slot default - The contents of the alert.
|
|
20
|
+
*
|
|
21
|
+
* @event kemet-alert-opened - Fires when alert is opened.
|
|
22
|
+
* @event kemet-alert-closed - Fires when alert is closed.
|
|
23
|
+
*
|
|
24
|
+
* @csspart close - Container for the close button.
|
|
25
|
+
*
|
|
26
|
+
* @cssproperty --kemet-alert-padding - The padding on the alert. Default: 1rem.
|
|
27
|
+
* @cssproperty --kemet-alert-border-thickness - The thickness of the border. Default: 4px.
|
|
28
|
+
* @cssproperty --kemet-alert-status-color - The status color. Default: inherit.
|
|
29
|
+
* @cssproperty --kemet-alert-gap - The alert's gap. Default: var(--kemet-alert-padding).
|
|
30
|
+
* @cssproperty --kemet-alert-align-items - The alert's alignment. Default: center.
|
|
31
|
+
* @cssproperty --kemet-alert-border - The border around the alert. Default: 1px solid var(--kemet-color-gray2).
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
export default class KemetAlert extends LitElement {
|
|
36
|
+
static get styles() {
|
|
37
|
+
return [stylesBase];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static get properties() {
|
|
41
|
+
return {
|
|
42
|
+
opened: { type: Boolean, reflect: true },
|
|
43
|
+
reveal: { type: Boolean, reflect: true },
|
|
44
|
+
closable: { type: Boolean, reflect: true },
|
|
45
|
+
borderStatus: { type: String, reflect: true, attribute: 'border-status' },
|
|
46
|
+
hidden: { type: Boolean, reflect: true },
|
|
47
|
+
overlay: { type: String, reflect: true },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
shouldUpdate(prevProps) {
|
|
52
|
+
if (prevProps.has('opened') && !prevProps.get('opened')) {
|
|
53
|
+
this.hidden = false;
|
|
54
|
+
this.reveal = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
firstUpdated() {
|
|
61
|
+
this.handleMotion();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
updated(prevProps) {
|
|
65
|
+
if (!prevProps.get('opened') && this.opened === true) {
|
|
66
|
+
emitEvent(this, 'kemet-alert-opened', this);
|
|
67
|
+
} else {
|
|
68
|
+
emitEvent(this, 'kemet-alert-closed', this);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
render() {
|
|
73
|
+
return html`
|
|
74
|
+
<slot name="icon"></slot>
|
|
75
|
+
<div>
|
|
76
|
+
<slot></slot>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="close" part="close">
|
|
79
|
+
${this.makeCloseBtn()}
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
makeCloseBtn() {
|
|
85
|
+
if (this.closable) {
|
|
86
|
+
return html`<kemet-icon icon="x-lg" @click=${() => { this.opened = false; }}></kemet-icon>`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
handleMotion() {
|
|
93
|
+
this.addEventListener('transitionend', () => {
|
|
94
|
+
if (!this.opened) {
|
|
95
|
+
this.hidden = true;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
this.addEventListener('animationend', () => {
|
|
100
|
+
this.reveal = false;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// eslint-disable-next-line no-unused-expressions
|
|
106
|
+
customElements.get('kemet-alert') || customElements.define('kemet-alert', KemetAlert);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const stylesBase = css`
|
|
4
|
+
:host {
|
|
5
|
+
--kemet-alert-padding: 1rem;
|
|
6
|
+
--kemet-alert-border-thickness: 4px;
|
|
7
|
+
--kemet-alert-status-color: inherit;
|
|
8
|
+
|
|
9
|
+
display: flex;
|
|
10
|
+
grid-template-columns: auto 1fr auto;
|
|
11
|
+
gap: var(--kemet-alert-gap, var(--kemet-alert-padding));
|
|
12
|
+
align-items: var(--kemet-alert-align-items, center);
|
|
13
|
+
opacity: 0;
|
|
14
|
+
padding: var(--kemet-alert-padding);
|
|
15
|
+
border: var(--kemet-alert-border, 1px solid var(--kemet-color-gray2));
|
|
16
|
+
transition: opacity 300ms ease;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host([opened]) {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host([border-status="top"]) {
|
|
24
|
+
border-top: var(--kemet-alert-border-thickness) solid var(--kemet-alert-status-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([border-status="right"]) {
|
|
28
|
+
border-right: var(--kemet-alert-border-thickness) solid var(--kemet-alert-status-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([border-status="bottom"]) {
|
|
32
|
+
border-bottom: var(--kemet-alert-border-thickness) solid var(--kemet-alert-status-color);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([border-status="left"]) {
|
|
36
|
+
border-left: var(--kemet-alert-border-thickness) solid var(--kemet-alert-status-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([status="standard"]) {
|
|
40
|
+
--kemet-alert-status-color: var(--kemet-color-black);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
:host([status="primary"]) {
|
|
44
|
+
--kemet-alert-status-color: var(--kemet-color-primary);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
:host([status="success"]) {
|
|
48
|
+
--kemet-alert-status-color: var(--kemet-color-success);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:host([status="warning"]) {
|
|
52
|
+
--kemet-alert-status-color: var(--kemet-color-warning);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host([status="error"]) {
|
|
56
|
+
--kemet-alert-status-color: var(--kemet-color-error);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
:host([hidden]) {
|
|
60
|
+
display: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([reveal]) {
|
|
64
|
+
animation: fadeIn 300ms ease forwards;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([overlay]) {
|
|
68
|
+
position: fixed;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([overlay*="full"]) {
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([overlay*="top"]) {
|
|
76
|
+
top: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([overlay*="bottom"]) {
|
|
80
|
+
bottom: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host([overlay*="left"]) {
|
|
84
|
+
left: 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
:host([overlay*="right"]) {
|
|
88
|
+
right: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.close {
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
margin-left: auto;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
::slotted(kemet-icon) {
|
|
97
|
+
color: var(--kemet-alert-status-color);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@keyframes fadeIn {
|
|
101
|
+
from { opacity: 0; }
|
|
102
|
+
to { opacity: 1; }
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @since 1.4.0
|
|
5
|
+
* @status stable
|
|
6
|
+
*
|
|
7
|
+
* @tagname kemet-avatar
|
|
8
|
+
* @summary A representation of a person or thing.
|
|
9
|
+
*
|
|
10
|
+
* @prop {string} size - The size in pixels.
|
|
11
|
+
* @prop {string} image - Url to an image.
|
|
12
|
+
* @prop {string} label - Labels the avatar.
|
|
13
|
+
* @prop {string} initials - Initials of the user.
|
|
14
|
+
* @prop {boolean} circle - Displays in a circle.
|
|
15
|
+
* @prop {boolean} rounded - Displays with rounded corners
|
|
16
|
+
*
|
|
17
|
+
* @slot status - A slot for an icon or element that indicates the status of the avatar.
|
|
18
|
+
*
|
|
19
|
+
* @csspart initials - Contains the initials for the avatar.
|
|
20
|
+
*
|
|
21
|
+
* @cssproperty --kemet-avatar-color - The color of the text. Default: var(--kemet-color-white).
|
|
22
|
+
* @cssproperty --kemet-avatar-background-color - The color of the background. Default: var(--kemet-color-gray4).
|
|
23
|
+
* @cssproperty --kemet-avatar-rounded-radius - The border radius of the rounded type. Default: 1rem.
|
|
24
|
+
* @cssproperty --kemet-avatar-initials-margin - The space around the initials. Default: 1rem.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export default class KemetAvatar extends LitElement {
|
|
29
|
+
static get styles() {
|
|
30
|
+
return [
|
|
31
|
+
css`
|
|
32
|
+
*,
|
|
33
|
+
*::before,
|
|
34
|
+
*::after {
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
color: var(--kemet-avatar-color, var(--kemet-color-white));
|
|
41
|
+
position: relative;
|
|
42
|
+
background-color: var(--kemet-avatar-background-color, var(--kemet-color-gray4));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:host([circle]) {
|
|
46
|
+
border-radius: 50%;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host([circle]) > * {
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([rounded]) {
|
|
54
|
+
border-radius: var(--kemet-avatar-rounded-radius, 1rem);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
:host([rounded]) > * {
|
|
58
|
+
border-radius: var(--kemet-avatar-rounded-radius, 1rem);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.initials {
|
|
62
|
+
margin: var(--kemet-avatar-initials-margin, 1rem);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
::slotted(kemet-badge) {
|
|
66
|
+
position: absolute;
|
|
67
|
+
bottom: 0;
|
|
68
|
+
right: 0;
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static get properties() {
|
|
76
|
+
return {
|
|
77
|
+
size: { type: Number },
|
|
78
|
+
image: { type: String },
|
|
79
|
+
label: { type: String },
|
|
80
|
+
initials: { type: String },
|
|
81
|
+
circle: { type: Boolean, reflect: true },
|
|
82
|
+
rounded: { type: Boolean, reflect: true },
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
firstUpdated() {
|
|
87
|
+
this.makeSize();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
render() {
|
|
91
|
+
return html`
|
|
92
|
+
${this.makeContent()}
|
|
93
|
+
<slot name="status"></slot>
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
makeSize() {
|
|
98
|
+
if (this.size) {
|
|
99
|
+
this.style.width = `${this.size}px`;
|
|
100
|
+
this.style.height = `${this.size}px`;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
makeContent() {
|
|
105
|
+
if (this.image) {
|
|
106
|
+
return html`<img src=${this.image} alt=${this.label} />`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.initials) {
|
|
110
|
+
return html`<div part="initials" class="initials">${this.initials}</div>`;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return html`<slot></slot>`;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// eslint-disable-next-line no-unused-expressions
|
|
118
|
+
customElements.get('kemet-avatar') || customElements.define('kemet-avatar', KemetAvatar);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { html, css, LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @since 1.4.0
|
|
5
|
+
* @status stable
|
|
6
|
+
*
|
|
7
|
+
* @tagname kemet-avatars
|
|
8
|
+
* @summary Groups multiple avatars.
|
|
9
|
+
*
|
|
10
|
+
* @cssproperty --kemet-avatars-squeeze - The space between avatars. Default: -1.5rem.
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export default class KemetAvatars extends LitElement {
|
|
15
|
+
static get styles() {
|
|
16
|
+
return [
|
|
17
|
+
css`
|
|
18
|
+
*,
|
|
19
|
+
*::before,
|
|
20
|
+
*::after {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
::slotted(kemet-avatar:not(:first-of-type)) {
|
|
29
|
+
margin-left: var(--kemet-avatars-squeeze, -1.5rem);
|
|
30
|
+
}
|
|
31
|
+
`,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
render() {
|
|
36
|
+
return html`<slot></slot>`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// eslint-disable-next-line no-unused-expressions
|
|
41
|
+
customElements.get('kemet-avatars') || customElements.define('kemet-avatars', KemetAvatars);
|
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
* @status stable
|
|
6
|
+
*
|
|
7
|
+
* @tagname kemet-badge
|
|
8
|
+
* @summary Badges display the status of information.
|
|
9
|
+
*
|
|
10
|
+
* @prop {string} status - The status of the badge
|
|
11
|
+
* @prop {boolean} circle - Displays the badge in a circle
|
|
12
|
+
* @prop {boolean} pill - Rounds the corners on the badge
|
|
13
|
+
* @prop {number} circlePadding - Padding on the badge as a circle
|
|
14
|
+
*
|
|
15
|
+
* @cssproperty --kemet-badge-padding - The padding of the badge. Default: 10px.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
|
|
3
19
|
export default class KemetBadge extends LitElement {
|
|
4
20
|
static get styles() {
|
|
5
21
|
return [
|
|
@@ -46,30 +62,18 @@ export default class KemetBadge extends LitElement {
|
|
|
46
62
|
|
|
47
63
|
static get properties() {
|
|
48
64
|
return {
|
|
49
|
-
/**
|
|
50
|
-
* The status of the badge
|
|
51
|
-
*/
|
|
52
65
|
status: {
|
|
53
66
|
type: String,
|
|
54
67
|
reflect: true,
|
|
55
68
|
},
|
|
56
|
-
/**
|
|
57
|
-
* Displays the badge in a circle
|
|
58
|
-
*/
|
|
59
69
|
circle: {
|
|
60
70
|
type: Boolean,
|
|
61
71
|
reflect: true,
|
|
62
72
|
},
|
|
63
|
-
/**
|
|
64
|
-
* Rounds the corners on the badge
|
|
65
|
-
*/
|
|
66
73
|
pill: {
|
|
67
74
|
type: Boolean,
|
|
68
75
|
reflect: true,
|
|
69
76
|
},
|
|
70
|
-
/**
|
|
71
|
-
* Padding on the badge as a circle
|
|
72
|
-
*/
|
|
73
77
|
circlePadding: {
|
|
74
78
|
type: Number,
|
|
75
79
|
attribute: 'circle-padding',
|
|
@@ -2,6 +2,47 @@ import { html, css, LitElement } from 'lit';
|
|
|
2
2
|
import '../kemet-icon/kemet-icon.js';
|
|
3
3
|
import { FormSubmitController } from '../../utilities/controllers/forms.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-button
|
|
10
|
+
* @summary A versatile button that can be used either to submit a form, trigger an action, or link to content.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} active - Determines whether or not the button is active
|
|
13
|
+
* @prop {boolean} hover - Is true when the button is hovered
|
|
14
|
+
* @prop {boolean} focused - Is true when the button is focused
|
|
15
|
+
* @prop {string} link - The url a button should link too
|
|
16
|
+
* @prop {boolean} outlined - Outline style for a button
|
|
17
|
+
* @prop {boolean} disabled - Determines whether not a button is disabled
|
|
18
|
+
* @prop {string} type - Controls the type of button. standard | text | circle | rounded | pill
|
|
19
|
+
*
|
|
20
|
+
* @slot left - Allows you to place an icon to the left of the button text.
|
|
21
|
+
* @slot right - Allows you to place an icon to the right of the button text.
|
|
22
|
+
*
|
|
23
|
+
* @csspart button - The button or anchor element.
|
|
24
|
+
*
|
|
25
|
+
* @cssproperty --kemet-button-font-size - The font size. Default: inherit.
|
|
26
|
+
* @cssproperty --kemet-button-color - The text color. Default: --kemet-color-white.
|
|
27
|
+
* @cssproperty --kemet-button-width - The width. Default: auto.
|
|
28
|
+
* @cssproperty --kemet-button-height - The height. Default: auto.
|
|
29
|
+
* @cssproperty --kemet-button-border - The border. Default: 0.
|
|
30
|
+
* @cssproperty --kemet-button-border-radius - The border radius. Default: 0.
|
|
31
|
+
* @cssproperty --kemet-button-transition-speed - The transition speed of the hover effect. Default: 300ms.
|
|
32
|
+
* @cssproperty --kemet-button-background-color - The background color. Default: --kemet-color-primary.
|
|
33
|
+
* @cssproperty --kemet-button-hover-brightness - The brightness of the hover effect. Default: 1.25.
|
|
34
|
+
* @cssproperty --kemet-button-gap - The gap between the button and icons. Default: 0.5rem.
|
|
35
|
+
* @cssproperty --kemet-button-padding - The button padding. Default: 1rem 1.25rem.
|
|
36
|
+
* @cssproperty --kemet-button-hover-decoration - The decoration for a text button's hover. Default: underline.
|
|
37
|
+
* @cssproperty --kemet-button-circle-size - The diameter of a circle button. Default: 50px.
|
|
38
|
+
* @cssproperty --kemet-button-rounded-amount - The border radius of the rounded button. Default: 6px.
|
|
39
|
+
* @cssproperty --kemet-button-border-width - The width of the outline border. Default: 1px.
|
|
40
|
+
* @cssproperty --kemet-button-border-style - The style of the outline border. Default: solid.
|
|
41
|
+
* @cssproperty --kemet-button-border-color - The color of the outline border. Default: --kemet-color-primary.
|
|
42
|
+
* @cssproperty --kemet-button-disabled-opacity - The opacity of the disabled state. Default: 0.5.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
|
|
5
46
|
export default class KemetButton extends LitElement {
|
|
6
47
|
static get styles() {
|
|
7
48
|
return [
|
|
@@ -80,51 +121,29 @@ export default class KemetButton extends LitElement {
|
|
|
80
121
|
|
|
81
122
|
static get properties() {
|
|
82
123
|
return {
|
|
83
|
-
/**
|
|
84
|
-
* Determines whether or not the button is active
|
|
85
|
-
*/
|
|
86
124
|
active: {
|
|
87
125
|
type: Boolean,
|
|
88
126
|
reflect: true,
|
|
89
127
|
},
|
|
90
|
-
/**
|
|
91
|
-
* Is true when the button is hovered
|
|
92
|
-
*/
|
|
93
128
|
hover: {
|
|
94
129
|
type: Boolean,
|
|
95
130
|
reflect: true,
|
|
96
131
|
},
|
|
97
|
-
/**
|
|
98
|
-
* Is true when the button is focused
|
|
99
|
-
*/
|
|
100
132
|
focused: {
|
|
101
133
|
type: Boolean,
|
|
102
134
|
reflect: true,
|
|
103
135
|
},
|
|
104
|
-
/**
|
|
105
|
-
* The url a button should link too
|
|
106
|
-
*/
|
|
107
136
|
link: {
|
|
108
137
|
type: String,
|
|
109
138
|
},
|
|
110
|
-
/**
|
|
111
|
-
* Outline style for a button
|
|
112
|
-
*/
|
|
113
139
|
outlined: {
|
|
114
140
|
type: Boolean,
|
|
115
141
|
reflect: true,
|
|
116
142
|
},
|
|
117
|
-
/**
|
|
118
|
-
* Determines whether not a button is disabled
|
|
119
|
-
*/
|
|
120
143
|
disabled: {
|
|
121
144
|
type: Boolean,
|
|
122
145
|
reflect: true,
|
|
123
146
|
},
|
|
124
|
-
/**
|
|
125
|
-
* Controls the type of button
|
|
126
|
-
* standard | text | circle | rounded | pill
|
|
127
|
-
*/
|
|
128
147
|
type: {
|
|
129
148
|
type: String,
|
|
130
149
|
reflect: true,
|
|
@@ -145,9 +164,7 @@ export default class KemetButton extends LitElement {
|
|
|
145
164
|
this.outline = false;
|
|
146
165
|
this.disable = false;
|
|
147
166
|
|
|
148
|
-
/**
|
|
149
|
-
* Used only for form reactive controller
|
|
150
|
-
*/
|
|
167
|
+
/** @internal */
|
|
151
168
|
this.formSubmitController = new FormSubmitController(this);
|
|
152
169
|
}
|
|
153
170
|
|