kemet-ui 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +3125 -968
- package/dist/components/kemet-accordion/kemet-accordion-panel.js +29 -31
- package/dist/components/kemet-accordion/kemet-accordion.js +12 -6
- package/dist/components/kemet-alert/kemet-alert.js +106 -0
- package/dist/components/kemet-alert/styles.js +104 -0
- package/dist/components/kemet-avatar/kemet-avatar.js +118 -0
- package/dist/components/kemet-avatar/kemet-avatars.js +41 -0
- package/dist/components/kemet-badge/kemet-badge.js +16 -12
- package/dist/components/kemet-button/kemet-button.js +42 -25
- package/dist/components/kemet-card/kemet-card.js +69 -0
- package/dist/components/kemet-card/styles.js +63 -0
- package/dist/components/kemet-carousel/kemet-carousel-current.js +13 -3
- package/dist/components/kemet-carousel/kemet-carousel-first.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-last.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-link.js +23 -17
- package/dist/components/kemet-carousel/kemet-carousel-next.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-prev.js +17 -9
- package/dist/components/kemet-carousel/kemet-carousel-slide.js +14 -11
- package/dist/components/kemet-carousel/kemet-carousel-total.js +13 -3
- package/dist/components/kemet-carousel/kemet-carousel.js +63 -133
- package/dist/components/kemet-carousel/styles.js +66 -0
- package/dist/components/kemet-checkbox/kemet-checkbox.js +28 -35
- package/dist/components/kemet-combo/kemet-combo.js +43 -28
- package/dist/components/kemet-count/kemet-count.js +29 -40
- package/dist/components/kemet-draggable/kemet-draggable.js +21 -23
- package/dist/components/kemet-drawer/kemet-drawer.js +36 -35
- package/dist/components/kemet-drawer/{kemet-drawer.styles.js → styles.js} +0 -0
- package/dist/components/kemet-fab/kemet-fab.js +39 -138
- package/dist/components/kemet-fab/styles.js +95 -0
- package/dist/components/kemet-field/kemet-field.js +31 -40
- package/dist/components/kemet-flipcard/kemet-flipcard-trigger.js +12 -5
- package/dist/components/kemet-flipcard/kemet-flipcard.js +24 -4
- package/dist/components/kemet-icon/kemet-icon.js +19 -15
- package/dist/components/kemet-input/kemet-input.js +81 -174
- package/dist/components/kemet-modal/kemet-modal-close.js +13 -8
- package/dist/components/kemet-modal/kemet-modal.js +26 -21
- package/dist/components/kemet-modal/{kemet-modal.styles.js → styles.js} +0 -0
- package/dist/components/kemet-password/kemet-password.js +40 -132
- package/dist/components/kemet-password/styles.js +80 -0
- package/dist/components/kemet-popover/kemet-popover-close.js +13 -7
- package/dist/components/kemet-popover/kemet-popover.js +42 -51
- package/dist/components/kemet-popover/{kemet-popover.effects.styles.js → styles.effects.js} +0 -0
- package/dist/components/kemet-popover/{kemet-popover.tooltip.styles.js → styles.tooltip.js} +0 -0
- package/dist/components/kemet-radio/kemet-radio.js +35 -43
- package/dist/components/kemet-radio/kemet-radios.js +25 -34
- package/dist/components/kemet-rotator/kemet-rotator.js +18 -18
- package/dist/components/kemet-scroll-link/kemet-scroll-link.js +15 -13
- package/dist/components/kemet-scroll-nav/kemet-scroll-nav.js +19 -10
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-paginator.js +25 -30
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap-slide.js +16 -9
- package/dist/components/kemet-scroll-snap/kemet-scroll-snap.js +27 -15
- package/dist/components/kemet-select/kemet-option.js +17 -12
- package/dist/components/kemet-select/kemet-select.js +62 -102
- package/dist/components/kemet-sortable/kemet-sortable-item.js +11 -5
- package/dist/components/kemet-sortable/kemet-sortable.js +16 -14
- package/dist/components/kemet-svgs/kemet-svg.js +17 -15
- package/dist/components/kemet-svgs/kemet-svgs.js +11 -3
- package/dist/components/kemet-tabs/kemet-tab-panel.js +14 -6
- package/dist/components/kemet-tabs/kemet-tab.js +22 -25
- package/dist/components/kemet-tabs/kemet-tabs.js +43 -41
- package/dist/components/kemet-tabs/{kemet-tabs.styles.js → styles.js} +0 -0
- package/dist/components/kemet-textarea/kemet-textarea.js +25 -54
- package/dist/components/kemet-toggle/kemet-toggle.js +39 -38
- package/dist/components/kemet-tracker/kemet-tracker-step.js +49 -160
- package/dist/components/kemet-tracker/kemet-tracker.js +12 -12
- package/dist/components/kemet-tracker/styles.js +111 -0
- package/dist/components/kemet-upload/kemet-upload-file.js +35 -44
- package/dist/components/kemet-upload/kemet-upload.js +53 -95
- package/dist/components/kemet-upload/{kemet-upload-file.loaders.styles.js → styles.js} +0 -0
- package/dist/kemet-components.cjs +2821 -2455
- package/dist/kemet-components.js +2822 -2444
- package/dist/kemet-components.min.js +912 -674
- package/dist/utilities/misc/events.js +5 -0
- package/package.json +13 -11
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export const stylesCarousel = css`
|
|
4
|
+
:host,
|
|
5
|
+
*,
|
|
6
|
+
*::before,
|
|
7
|
+
*::after {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host {
|
|
12
|
+
position: relative;
|
|
13
|
+
display: grid;
|
|
14
|
+
grid-template-columns: minmax(0, 1fr);
|
|
15
|
+
align-items: center;
|
|
16
|
+
width: var(--kemet-carousel-width, 100%);
|
|
17
|
+
height: var(--kemet-carousel-height, auto);
|
|
18
|
+
overflow: visible;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([arrows]) {
|
|
22
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.toolbar {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: var(--kemet-carousel-toolbar-gap, 1rem);
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: var(--kemet-carousel-toolbar-justify-content, center);
|
|
30
|
+
line-height: 1;
|
|
31
|
+
padding: var(--kemet-carousel-toolbar-padding, 1rem);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([inner]) .toolbar {
|
|
35
|
+
width: var(--kemet-carousel-toolbar-inner-width, 100%);
|
|
36
|
+
position: absolute;
|
|
37
|
+
bottom: var(--kemet-carousel-toolbar-inner-bottom, 0);
|
|
38
|
+
top: var(--kemet-carousel-toolbar-inner-top, auto);
|
|
39
|
+
color: var(--kemet-carousel-toolbar-inner-color, var(--kemet-color-white));
|
|
40
|
+
background-color: var(--kemet-carousel-toolbar-inner-background-color, rgba(0, 0, 0, 0.4));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.slides {
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
position: relative;
|
|
46
|
+
padding: 1rem 0;
|
|
47
|
+
border: var(--kemet-carousel-slides-border, 1px solid var(--kemet-color-gray1));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.slider {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-wrap: nowrap;
|
|
53
|
+
transition: transform var(--kemet-carousel-transition-speed, 300ms) ease;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
::slotted([slot='next']),
|
|
57
|
+
::slotted([slot='prev']) {
|
|
58
|
+
opacity: var(--kemet-carousel-arrows-opacity, 0.25);
|
|
59
|
+
transition: opacity var(--kemet-carousel-arrows-transition-speed, 300ms) ease-in-out;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:host(:hover) ::slotted([slot='next']),
|
|
63
|
+
:host(:hover) ::slotted([slot='prev']) {
|
|
64
|
+
opacity: var(--kemet-carousel-arrows-opacity-hover, 1);
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
@@ -2,6 +2,30 @@ import { html, css, LitElement } from 'lit';
|
|
|
2
2
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
3
|
import { live } from 'lit/directives/live.js';
|
|
4
4
|
import { FormSubmitController } from '../../utilities/controllers/forms.js';
|
|
5
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @since 1.0.0
|
|
9
|
+
* @status stable
|
|
10
|
+
*
|
|
11
|
+
* @tagname kemet-checkbox
|
|
12
|
+
* @summary An enhanced checkbox.
|
|
13
|
+
*
|
|
14
|
+
* @csspart label - The label element.
|
|
15
|
+
* @csspart text - The the label's text.
|
|
16
|
+
* @csspart mark - The icon of the check mark.
|
|
17
|
+
*
|
|
18
|
+
* @cssproperty --kemet-checkbox-size - The width and height of the checkbox. Default: 18px.
|
|
19
|
+
* @cssproperty --kemet-checkbox-color - The color of the checkbox's mark. Default: var(--kemet-color-primary).
|
|
20
|
+
* @cssproperty --kemet-checkbox-border - The border of the checkbox. Default: 1px solid var(--kemet-color-primary).
|
|
21
|
+
* @cssproperty --kemet-checkbox-border-radius - The border radius of the checkbox. Default: 4px.
|
|
22
|
+
* @cssproperty --kemet-checkbox-filled-color - The filled color of the checkbox's mark. Default: var(--kemet-color-white).
|
|
23
|
+
* @cssproperty --kemet-checkbox-filled-background-color - The filled background color. Default: var(--kemet-color-primary).
|
|
24
|
+
*
|
|
25
|
+
* @event kemet-checkbox-change - Fires when the state of the checkbox changes
|
|
26
|
+
* @event kemet-checkbox-focused - Fires when the checkbox loses or receives focus
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
5
29
|
|
|
6
30
|
export default class KemetCheckbox extends LitElement {
|
|
7
31
|
static get styles() {
|
|
@@ -151,9 +175,7 @@ export default class KemetCheckbox extends LitElement {
|
|
|
151
175
|
this.filled = false;
|
|
152
176
|
this.status = 'standard';
|
|
153
177
|
|
|
154
|
-
/**
|
|
155
|
-
* Used only for form reactive controller
|
|
156
|
-
*/
|
|
178
|
+
/** @internal */
|
|
157
179
|
this.formSubmitController = new FormSubmitController(this);
|
|
158
180
|
}
|
|
159
181
|
|
|
@@ -194,46 +216,17 @@ export default class KemetCheckbox extends LitElement {
|
|
|
194
216
|
handleClick() {
|
|
195
217
|
this.checked = !this.checked;
|
|
196
218
|
this.indeterminate = false;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Fires when the state of the checkbox changes
|
|
200
|
-
*/
|
|
201
|
-
this.dispatchEvent(
|
|
202
|
-
new CustomEvent('kemet-checkbox-change', {
|
|
203
|
-
bubbles: true,
|
|
204
|
-
composed: true,
|
|
205
|
-
detail: this,
|
|
206
|
-
}),
|
|
207
|
-
);
|
|
219
|
+
emitEvent(this, 'kemet-checkbox-change', this);
|
|
208
220
|
}
|
|
209
221
|
|
|
210
222
|
handleBlur() {
|
|
211
223
|
this.focused = false;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Fires when the checkbox loses or receives focus
|
|
215
|
-
*/
|
|
216
|
-
this.dispatchEvent(
|
|
217
|
-
new CustomEvent('kemet-checkbox-focused', {
|
|
218
|
-
bubbles: true,
|
|
219
|
-
composed: true,
|
|
220
|
-
detail: false,
|
|
221
|
-
}),
|
|
222
|
-
);
|
|
224
|
+
emitEvent(this, 'kemet-checkbox-focused', false);
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
handleFocus() {
|
|
226
228
|
this.focused = true;
|
|
227
|
-
|
|
228
|
-
* Fires when the checkbox loses or receives focus
|
|
229
|
-
*/
|
|
230
|
-
this.dispatchEvent(
|
|
231
|
-
new CustomEvent('kemet-checkbox-focused', {
|
|
232
|
-
bubbles: true,
|
|
233
|
-
composed: true,
|
|
234
|
-
detail: true,
|
|
235
|
-
}),
|
|
236
|
-
);
|
|
229
|
+
emitEvent(this, 'kemet-checkbox-focused', true);
|
|
237
230
|
}
|
|
238
231
|
|
|
239
232
|
handleChange() {
|
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-combo
|
|
9
|
+
* @summary Allows the user to select a choice filtered through an Input. May only be used as a component of Field.
|
|
10
|
+
*
|
|
11
|
+
* @prop {string} slug - Uniquely identifies the component. Should match the slug used in a control.
|
|
12
|
+
* @prop {array} options - An array of items listed for the combo box
|
|
13
|
+
* @prop {boolean} show - Controls the display of the combo box
|
|
14
|
+
*
|
|
15
|
+
* @csspart combobox - The combo's container element.
|
|
16
|
+
* @csspart listbox - The list element in the combo.
|
|
17
|
+
*
|
|
18
|
+
* @cssproperty --kemet-combo-width - The width of the combo box. Default: calc(100% - 2px).
|
|
19
|
+
* @cssproperty --kemet-combo-margin - The margins on the combo box. Default: 1rem auto.
|
|
20
|
+
* @cssproperty --kemet-combo-max-height - The max height of the combo box. Default: calc(5 * 3rem).
|
|
21
|
+
* @cssproperty --kemet-combo-border - The border of the combo box. Default: 1px solid var(--kemet-color-primary).
|
|
22
|
+
* @cssproperty --kemet-combo-border-radius - The border radius of the combo box. Default: var(--kemet-border-radius).
|
|
23
|
+
* @cssproperty --kemet-combo-background-color - The background color of the combo box. Default: var(--kemet-color-white).
|
|
24
|
+
* @cssproperty --kemet-combo-shadow - The shadow of the combo box. Default: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1).
|
|
25
|
+
* @cssproperty --kemet-combo-hover-color - The hover item's text color. Default: var(--kemet-color-white).
|
|
26
|
+
* @cssproperty --kemet-combo-hover-background-color - The hover item's background color. Default: var(--kemet-color-primary).
|
|
27
|
+
*
|
|
28
|
+
* @event kemet-combo-selection - Fires when a selection has been made
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
2
31
|
|
|
3
32
|
export default class KemetCombo extends LitElement {
|
|
4
33
|
static get styles() {
|
|
@@ -50,27 +79,16 @@ export default class KemetCombo extends LitElement {
|
|
|
50
79
|
|
|
51
80
|
static get properties() {
|
|
52
81
|
return {
|
|
53
|
-
/**
|
|
54
|
-
* Uniquely identifies the component. Should match the slug used in a control.
|
|
55
|
-
*/
|
|
56
82
|
slug: {
|
|
57
83
|
type: String,
|
|
58
84
|
},
|
|
59
|
-
/**
|
|
60
|
-
* An array of items listed for the combo box
|
|
61
|
-
*/
|
|
62
85
|
options: {
|
|
63
86
|
type: Array,
|
|
64
87
|
},
|
|
65
|
-
/**
|
|
66
|
-
* Used internally
|
|
67
|
-
*/
|
|
88
|
+
/** @internal */
|
|
68
89
|
filteredOptions: {
|
|
69
90
|
type: Array,
|
|
70
91
|
},
|
|
71
|
-
/**
|
|
72
|
-
* Controls the display of the combo box
|
|
73
|
-
*/
|
|
74
92
|
show: {
|
|
75
93
|
type: Boolean,
|
|
76
94
|
reflect: true,
|
|
@@ -78,6 +96,11 @@ export default class KemetCombo extends LitElement {
|
|
|
78
96
|
};
|
|
79
97
|
}
|
|
80
98
|
|
|
99
|
+
constructor() {
|
|
100
|
+
super();
|
|
101
|
+
this.options = [];
|
|
102
|
+
}
|
|
103
|
+
|
|
81
104
|
firstUpdated() {
|
|
82
105
|
// standard properties
|
|
83
106
|
this.field = this.closest('kemet-field');
|
|
@@ -95,13 +118,14 @@ export default class KemetCombo extends LitElement {
|
|
|
95
118
|
return html`
|
|
96
119
|
<div
|
|
97
120
|
role="combobox"
|
|
121
|
+
part="combobox"
|
|
98
122
|
aria-expanded=${this.show}
|
|
99
123
|
aria-controls="${this.slug}-listbox"
|
|
100
124
|
aria-haspopup="listbox"
|
|
101
125
|
id="${this.slug}-combobox"
|
|
102
126
|
aria-label="${this.field?.label}"
|
|
103
127
|
>
|
|
104
|
-
<ul role="listbox" aria-labelledby="${this.slug}-label" id="${this.slug}-listbox">
|
|
128
|
+
<ul role="listbox" aria-labelledby="${this.slug}-label" id="${this.slug}-listbox" part="listbox">
|
|
105
129
|
${this.makeOptions()}
|
|
106
130
|
</ul>
|
|
107
131
|
</div>
|
|
@@ -111,7 +135,7 @@ export default class KemetCombo extends LitElement {
|
|
|
111
135
|
makeOptions() {
|
|
112
136
|
if (this.input) {
|
|
113
137
|
this.filteredOptions = this.options.filter(
|
|
114
|
-
option => option.toLowerCase().indexOf(this.input.value
|
|
138
|
+
option => option.toLowerCase().indexOf(this.input.value?.toLowerCase()) !== -1,
|
|
115
139
|
);
|
|
116
140
|
|
|
117
141
|
const options = this.filteredOptions.map(
|
|
@@ -147,20 +171,11 @@ export default class KemetCombo extends LitElement {
|
|
|
147
171
|
this.input.value = event.target.innerText;
|
|
148
172
|
this.show = false;
|
|
149
173
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
bubbles: true,
|
|
156
|
-
composed: true,
|
|
157
|
-
detail: {
|
|
158
|
-
element: event.target,
|
|
159
|
-
text: event.target.innerText,
|
|
160
|
-
id: event.target.getAttribute('id'),
|
|
161
|
-
},
|
|
162
|
-
}),
|
|
163
|
-
);
|
|
174
|
+
emitEvent(this, 'kemet-combo-section', {
|
|
175
|
+
element: event.target,
|
|
176
|
+
text: event.target.innerText,
|
|
177
|
+
id: event.target.getAttribute('id'),
|
|
178
|
+
});
|
|
164
179
|
}
|
|
165
180
|
|
|
166
181
|
handleOptionKeyDown(event) {
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-count
|
|
9
|
+
* @summary Maintains a character count for a input field. Is to be used only in the component slot of a Field component.
|
|
10
|
+
*
|
|
11
|
+
* @prop {string} message - The text label shown to users
|
|
12
|
+
* @prop {number} remaining - The number of characters remaining
|
|
13
|
+
* @prop {number} limit - The maximum number of characters allowed
|
|
14
|
+
* @prop {boolean} validateImmediately - Set to true if the field should validate as soon as the character limit is reached
|
|
15
|
+
*
|
|
16
|
+
* @cssproperty --kemet-count-font-size - The font size. Default: 90%.
|
|
17
|
+
*
|
|
18
|
+
* @event kemet-count-status - Fires when there's a change in status.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
2
21
|
|
|
3
22
|
export default class KemetCount extends LitElement {
|
|
4
23
|
static get styles() {
|
|
@@ -15,27 +34,15 @@ export default class KemetCount extends LitElement {
|
|
|
15
34
|
|
|
16
35
|
static get properties() {
|
|
17
36
|
return {
|
|
18
|
-
/**
|
|
19
|
-
* The text label shown to users
|
|
20
|
-
*/
|
|
21
37
|
message: {
|
|
22
38
|
type: String,
|
|
23
39
|
},
|
|
24
|
-
/**
|
|
25
|
-
* The number of characters remaining
|
|
26
|
-
*/
|
|
27
40
|
remaining: {
|
|
28
41
|
type: Number,
|
|
29
42
|
},
|
|
30
|
-
/**
|
|
31
|
-
* The maximum number of characters allowed
|
|
32
|
-
*/
|
|
33
43
|
limit: {
|
|
34
44
|
type: Number,
|
|
35
45
|
},
|
|
36
|
-
/**
|
|
37
|
-
* Set to true if the field should validate as soon as the character limit is reached
|
|
38
|
-
*/
|
|
39
46
|
validateImmediately: {
|
|
40
47
|
type: Boolean,
|
|
41
48
|
attribute: 'validate-immediately',
|
|
@@ -62,39 +69,21 @@ export default class KemetCount extends LitElement {
|
|
|
62
69
|
this.inputSlot.status = 'error';
|
|
63
70
|
this.inputSlot.invalid = true;
|
|
64
71
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
bubbles: true,
|
|
71
|
-
composed: true,
|
|
72
|
-
detail: {
|
|
73
|
-
status: 'error',
|
|
74
|
-
validity: nativeElement.validity,
|
|
75
|
-
element: this.inputSlot,
|
|
76
|
-
},
|
|
77
|
-
}),
|
|
78
|
-
);
|
|
72
|
+
emitEvent(this, 'kemet-count-status', {
|
|
73
|
+
status: 'error',
|
|
74
|
+
validity: nativeElement.validity,
|
|
75
|
+
element: this.inputSlot,
|
|
76
|
+
});
|
|
79
77
|
}
|
|
80
78
|
} else {
|
|
81
79
|
this.inputSlot.status = 'standard';
|
|
82
80
|
nativeElement.checkValidity();
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
bubbles: true,
|
|
90
|
-
composed: true,
|
|
91
|
-
detail: {
|
|
92
|
-
status: 'standard',
|
|
93
|
-
validity: nativeElement.validity,
|
|
94
|
-
element: this.inputSlot,
|
|
95
|
-
},
|
|
96
|
-
}),
|
|
97
|
-
);
|
|
82
|
+
emitEvent(this, 'kemet-count-status', {
|
|
83
|
+
status: 'standard',
|
|
84
|
+
validity: nativeElement.validity,
|
|
85
|
+
element: this.inputSlot,
|
|
86
|
+
});
|
|
98
87
|
}
|
|
99
88
|
}
|
|
100
89
|
});
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { html, css, LitElement } from 'lit';
|
|
2
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
* @status stable
|
|
7
|
+
*
|
|
8
|
+
* @tagname kemet-draggable
|
|
9
|
+
* @summary A draggable element with the ability to remember its position.
|
|
10
|
+
*
|
|
11
|
+
* @prop {string} memory - A unique identifier used to store the element's position in local storage.
|
|
12
|
+
* @prop {string} top - The elements top position in pixels.
|
|
13
|
+
* @prop {string} left - The element's left position in pixels.
|
|
14
|
+
* @prop {boolean} measure - If set to true, will measure the width and height of the element's content and apply it to the host element.
|
|
15
|
+
*
|
|
16
|
+
* @event kemet-draggable-start
|
|
17
|
+
* @event kemet-draggable-stop
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
2
20
|
|
|
3
21
|
export default class KemetDraggable extends LitElement {
|
|
4
22
|
static get styles() {
|
|
@@ -15,28 +33,15 @@ export default class KemetDraggable extends LitElement {
|
|
|
15
33
|
|
|
16
34
|
static get properties() {
|
|
17
35
|
return {
|
|
18
|
-
/**
|
|
19
|
-
* A unique identifier used to store the element's position in local storage.
|
|
20
|
-
*/
|
|
21
36
|
memory: {
|
|
22
37
|
type: String,
|
|
23
38
|
},
|
|
24
|
-
/**
|
|
25
|
-
* The elements top position in pixels.
|
|
26
|
-
*/
|
|
27
39
|
top: {
|
|
28
40
|
type: String,
|
|
29
41
|
},
|
|
30
|
-
/**
|
|
31
|
-
* The element's left position in pixels.
|
|
32
|
-
*/
|
|
33
42
|
left: {
|
|
34
43
|
type: String,
|
|
35
44
|
},
|
|
36
|
-
/**
|
|
37
|
-
* If set to true, will measure the width and height
|
|
38
|
-
* of the element's content and apply it to the host element.
|
|
39
|
-
*/
|
|
40
45
|
measure: {
|
|
41
46
|
type: Boolean,
|
|
42
47
|
},
|
|
@@ -54,6 +59,7 @@ export default class KemetDraggable extends LitElement {
|
|
|
54
59
|
|
|
55
60
|
firstUpdated() {
|
|
56
61
|
// standard properties
|
|
62
|
+
/** @internal */
|
|
57
63
|
this.position1 = 0;
|
|
58
64
|
this.position2 = 0;
|
|
59
65
|
this.position3 = 0;
|
|
@@ -93,11 +99,7 @@ export default class KemetDraggable extends LitElement {
|
|
|
93
99
|
document.addEventListener('mouseup', this.mouseUp);
|
|
94
100
|
document.addEventListener('mousemove', this.mouseMove);
|
|
95
101
|
|
|
96
|
-
this
|
|
97
|
-
bubbles: true,
|
|
98
|
-
composed: true,
|
|
99
|
-
detail: this,
|
|
100
|
-
}));
|
|
102
|
+
emitEvent(this, 'kemet-draggable-start', this);
|
|
101
103
|
}
|
|
102
104
|
|
|
103
105
|
drag(event) {
|
|
@@ -125,11 +127,7 @@ export default class KemetDraggable extends LitElement {
|
|
|
125
127
|
localStorage.setItem(this.memory, JSON.stringify(savedPosition));
|
|
126
128
|
}
|
|
127
129
|
|
|
128
|
-
this
|
|
129
|
-
bubbles: true,
|
|
130
|
-
composed: true,
|
|
131
|
-
detail: this,
|
|
132
|
-
}));
|
|
130
|
+
emitEvent(this, 'kemet-draggable-stop', this);
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
measureContent() {
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
import { LitElement, html } from 'lit';
|
|
2
|
-
import { stylesBase, stylesEffects } from './
|
|
2
|
+
import { stylesBase, stylesEffects } from './styles.js';
|
|
3
|
+
import { emitEvent } from '../../utilities/misc/events.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @since 1.0.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-drawer
|
|
10
|
+
* @summary A component that adds an off-canvas menu with different effects.
|
|
11
|
+
*
|
|
12
|
+
* @prop {boolean} opened - Determines if the drawer is opened or not.
|
|
13
|
+
* @prop {string} effect - The animation effect for opening and closing the drawer. Values include: (slide | reveal | push | scale)
|
|
14
|
+
* @prop {string} side - Allows you to control which side the drawer opens from. Values include: (left | right | top | bottom)
|
|
15
|
+
* @prop {boolean} overlay - Adds a overlay over the content section of the Drawer when opened
|
|
16
|
+
*
|
|
17
|
+
* @slot navigation - The off-screen nav area of your app or site
|
|
18
|
+
* @slot content - The main content area of your app or site.
|
|
19
|
+
*
|
|
20
|
+
* @csspart container
|
|
21
|
+
* @csspart drawer
|
|
22
|
+
* @csspart pusher
|
|
23
|
+
* @csspart content
|
|
24
|
+
* @csspart wrapper
|
|
25
|
+
*
|
|
26
|
+
* @cssproperty --kemet-drawer-width - The width of the drawer. Default: 300px.
|
|
27
|
+
* @cssproperty --kemet-drawer-height - The height of the drawer. Default: 100%.
|
|
28
|
+
* @cssproperty --kemet-drawer-color - The text color of the drawer. Default: #fafafa.
|
|
29
|
+
* @cssproperty --kemet-drawer-background-color - The background color of the drawer. Default: #202020.
|
|
30
|
+
* @cssproperty --kemet-drawer-overlay-color - The color of the overlay. Default: rgba(0, 0, 0, 0.2).
|
|
31
|
+
*
|
|
32
|
+
* @event kemet-drawer-opened - Fires when the drawer opens.
|
|
33
|
+
* @event kemet-drawer-closed - Fires when the drawer closes.
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
3
36
|
|
|
4
37
|
export default class KemetDrawer extends LitElement {
|
|
5
38
|
static get styles() {
|
|
@@ -8,32 +41,18 @@ export default class KemetDrawer extends LitElement {
|
|
|
8
41
|
|
|
9
42
|
static get properties() {
|
|
10
43
|
return {
|
|
11
|
-
/**
|
|
12
|
-
* Determines if the drawer is opened or not.
|
|
13
|
-
*/
|
|
14
44
|
opened: {
|
|
15
45
|
type: Boolean,
|
|
16
46
|
reflect: true,
|
|
17
47
|
},
|
|
18
|
-
/**
|
|
19
|
-
* The animation effect for opening and closing the drawer.
|
|
20
|
-
* Values include: (slide | reveal | push | scale)
|
|
21
|
-
*/
|
|
22
48
|
effect: {
|
|
23
49
|
type: String,
|
|
24
50
|
reflect: true,
|
|
25
51
|
},
|
|
26
|
-
/**
|
|
27
|
-
* Allows you to control which side the drawer opens from.
|
|
28
|
-
* Values include: (left | right | top | bottom)
|
|
29
|
-
*/
|
|
30
52
|
side: {
|
|
31
53
|
type: String,
|
|
32
54
|
reflect: true,
|
|
33
55
|
},
|
|
34
|
-
/**
|
|
35
|
-
* Adds a overlay over the content section of the Drawer when opened
|
|
36
|
-
*/
|
|
37
56
|
overlay: {
|
|
38
57
|
type: Boolean,
|
|
39
58
|
reflect: true,
|
|
@@ -61,29 +80,11 @@ export default class KemetDrawer extends LitElement {
|
|
|
61
80
|
|
|
62
81
|
updated(prevProps) {
|
|
63
82
|
if (!prevProps.get('opened') && this.opened === true) {
|
|
64
|
-
|
|
65
|
-
* Fires when the drawer opens.
|
|
66
|
-
*/
|
|
67
|
-
this.dispatchEvent(
|
|
68
|
-
new CustomEvent('kemet-drawer-opened', {
|
|
69
|
-
bubbles: true,
|
|
70
|
-
composed: true,
|
|
71
|
-
detail: this,
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
83
|
+
emitEvent(this, 'kemet-drawer-opened', this);
|
|
74
84
|
}
|
|
75
85
|
|
|
76
86
|
if (prevProps.get('opened') && this.opened === false) {
|
|
77
|
-
|
|
78
|
-
* Fires when the drawer closes.
|
|
79
|
-
*/
|
|
80
|
-
this.dispatchEvent(
|
|
81
|
-
new CustomEvent('kemet-drawer-closed', {
|
|
82
|
-
bubbles: true,
|
|
83
|
-
composed: true,
|
|
84
|
-
detail: this,
|
|
85
|
-
}),
|
|
86
|
-
);
|
|
87
|
+
emitEvent(this, 'kemet-drawer-closed', this);
|
|
87
88
|
}
|
|
88
89
|
}
|
|
89
90
|
|
|
File without changes
|