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
|
@@ -2,6 +2,72 @@ 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-input
|
|
12
|
+
* @summary An enhanced input element.
|
|
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 or not 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. Default: 50px.
|
|
50
|
+
* @cssproperty -kemet-input-padding - The padding on the input. Default: 0.5rem 1rem.
|
|
51
|
+
* @cssproperty -kemet-input-border - The border of the input. Default: 1px solid var(--kemet-color-primary).
|
|
52
|
+
* @cssproperty -kemet-input-border-color-error - The border of the error state. Default: 1px solid var(--kemet-color-error).
|
|
53
|
+
* @cssproperty -kemet-input-border-color-success - The border of the success state. Default: 1px solid var(--kemet-color-success).
|
|
54
|
+
* @cssproperty -kemet-input-border-color-warning - The border of the warning state. Default: 1px solid var(--kemet-color-warning) |
|
|
55
|
+
* @cssproperty -kemet-input-icon-left-padding - The icon-left padding. Default: 3rem.
|
|
56
|
+
* @cssproperty -kemet-input-icon-right-padding - The icon-right padding. Default: 3rem.
|
|
57
|
+
* @cssproperty -kemet-input-border-radius-rounded - The border radius on rounded. Default: var(--kemet-border-radius).
|
|
58
|
+
* @cssproperty -kemet-input-border-filled - The border on filled. Default: none.
|
|
59
|
+
* @cssproperty -kemet-input-color-filled - The color on filled. Default: var(--kemet-color-white).
|
|
60
|
+
* @cssproperty -kemet-input-background-color-filled - The background-color on filled. Default: var(--kemet-color-primary).
|
|
61
|
+
* @cssproperty -kemet-input-background-color-error - The error state background color. Default: var(--kemet-color-error).
|
|
62
|
+
* @cssproperty -kemet-input-background-color-success - The success state background color. Default: var(--kemet-color-success).
|
|
63
|
+
* @cssproperty -kemet-input-background-color-warning - The warning state background color. Default: var(--kemet-color-warning).
|
|
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
|
+
*/
|
|
5
71
|
|
|
6
72
|
export default class KemetInput extends LitElement {
|
|
7
73
|
static get styles() {
|
|
@@ -122,209 +188,113 @@ export default class KemetInput extends LitElement {
|
|
|
122
188
|
|
|
123
189
|
static get properties() {
|
|
124
190
|
return {
|
|
125
|
-
/**
|
|
126
|
-
* Used for the id of the input. Should match the slug used in a control if applicable.
|
|
127
|
-
*/
|
|
128
191
|
slug: {
|
|
129
192
|
type: String,
|
|
130
193
|
},
|
|
131
|
-
/**
|
|
132
|
-
* The name of the input
|
|
133
|
-
*/
|
|
134
194
|
name: {
|
|
135
195
|
type: String,
|
|
136
196
|
},
|
|
137
|
-
/**
|
|
138
|
-
* The placeholder attribute
|
|
139
|
-
*/
|
|
140
197
|
placeholder: {
|
|
141
198
|
type: String,
|
|
142
199
|
},
|
|
143
|
-
/**
|
|
144
|
-
* The minlength attribute
|
|
145
|
-
*/
|
|
146
200
|
minlength: {
|
|
147
201
|
type: String,
|
|
148
202
|
},
|
|
149
|
-
/**
|
|
150
|
-
* The maxlength attribute
|
|
151
|
-
*/
|
|
152
203
|
maxlength: {
|
|
153
204
|
type: String,
|
|
154
205
|
},
|
|
155
|
-
/**
|
|
156
|
-
* The min attribute
|
|
157
|
-
*/
|
|
158
206
|
min: {
|
|
159
207
|
type: String,
|
|
160
208
|
},
|
|
161
|
-
/**
|
|
162
|
-
* The max attribute
|
|
163
|
-
*/
|
|
164
209
|
max: {
|
|
165
210
|
type: String,
|
|
166
211
|
},
|
|
167
|
-
/**
|
|
168
|
-
* The step attribute
|
|
169
|
-
*/
|
|
170
212
|
step: {
|
|
171
213
|
type: String,
|
|
172
214
|
},
|
|
173
|
-
/**
|
|
174
|
-
* The autocomplete attribute
|
|
175
|
-
*/
|
|
176
215
|
autocomplete: {
|
|
177
216
|
type: String,
|
|
178
217
|
},
|
|
179
|
-
/**
|
|
180
|
-
* The pattern attribute
|
|
181
|
-
*/
|
|
182
218
|
pattern: {
|
|
183
219
|
type: String,
|
|
184
220
|
},
|
|
185
|
-
/**
|
|
186
|
-
* The input mode attribute
|
|
187
|
-
*/
|
|
188
221
|
inputmode: {
|
|
189
222
|
type: String,
|
|
190
223
|
},
|
|
191
|
-
/**
|
|
192
|
-
* The autofocus attribute
|
|
193
|
-
*/
|
|
194
224
|
autofocus: {
|
|
195
225
|
type: Boolean,
|
|
196
226
|
},
|
|
197
|
-
/**
|
|
198
|
-
* The disable attribute
|
|
199
|
-
*/
|
|
200
227
|
disabled: {
|
|
201
228
|
type: Boolean,
|
|
202
229
|
reflect: true,
|
|
203
230
|
},
|
|
204
|
-
/**
|
|
205
|
-
* The readonly attribute
|
|
206
|
-
*/
|
|
207
231
|
readonly: {
|
|
208
232
|
type: Boolean,
|
|
209
233
|
},
|
|
210
|
-
/**
|
|
211
|
-
* The required attribute
|
|
212
|
-
*/
|
|
213
234
|
required: {
|
|
214
235
|
type: Boolean,
|
|
215
236
|
reflect: true,
|
|
216
237
|
},
|
|
217
|
-
/**
|
|
218
|
-
* The type of input
|
|
219
|
-
*/
|
|
220
238
|
type: {
|
|
221
239
|
type: String,
|
|
222
240
|
},
|
|
223
|
-
/**
|
|
224
|
-
* The input's value
|
|
225
|
-
*/
|
|
226
241
|
value: {
|
|
227
242
|
type: String,
|
|
228
243
|
},
|
|
229
|
-
/**
|
|
230
|
-
* States whether or not the input is invalid
|
|
231
|
-
*/
|
|
232
244
|
invalid: {
|
|
233
245
|
type: Boolean,
|
|
234
246
|
reflect: true,
|
|
235
247
|
},
|
|
236
|
-
/**
|
|
237
|
-
* The status of the input
|
|
238
|
-
*/
|
|
239
248
|
status: {
|
|
240
249
|
type: String,
|
|
241
250
|
reflect: true,
|
|
242
251
|
},
|
|
243
|
-
/**
|
|
244
|
-
* Activates validation on blur
|
|
245
|
-
*/
|
|
246
252
|
validateOnBlur: {
|
|
247
253
|
type: Boolean,
|
|
248
254
|
attribute: 'validate-on-blur',
|
|
249
255
|
},
|
|
250
|
-
/**
|
|
251
|
-
* Aria Autocomplete
|
|
252
|
-
*/
|
|
253
256
|
ariaAutoComplete: {
|
|
254
257
|
type: String,
|
|
255
258
|
attribute: 'aria-autocomplete',
|
|
256
259
|
},
|
|
257
|
-
/**
|
|
258
|
-
* Aria Controls
|
|
259
|
-
*/
|
|
260
260
|
ariaControls: {
|
|
261
261
|
type: String,
|
|
262
262
|
attribute: 'aria-controls',
|
|
263
263
|
},
|
|
264
|
-
/**
|
|
265
|
-
* Aria Active Descendant
|
|
266
|
-
*/
|
|
267
264
|
ariaActiveDescendant: {
|
|
268
265
|
type: String,
|
|
269
266
|
attribute: 'aria-activedescendant',
|
|
270
267
|
},
|
|
271
|
-
/**
|
|
272
|
-
* Displays rounded corners
|
|
273
|
-
*/
|
|
274
268
|
rounded: {
|
|
275
269
|
type: Boolean,
|
|
276
270
|
reflect: true,
|
|
277
271
|
},
|
|
278
|
-
/**
|
|
279
|
-
* Displays a filled input box
|
|
280
|
-
*/
|
|
281
272
|
filled: {
|
|
282
273
|
type: Boolean,
|
|
283
274
|
reflect: true,
|
|
284
275
|
},
|
|
285
|
-
/**
|
|
286
|
-
* Custom Icon to the right of the input
|
|
287
|
-
*/
|
|
288
276
|
iconRight: {
|
|
289
277
|
type: String,
|
|
290
278
|
reflect: true,
|
|
291
279
|
attribute: 'icon-right',
|
|
292
280
|
},
|
|
293
|
-
/**
|
|
294
|
-
* Custom Icon to the left of the input
|
|
295
|
-
*/
|
|
296
281
|
iconLeft: {
|
|
297
282
|
type: String,
|
|
298
283
|
reflect: true,
|
|
299
284
|
attribute: 'icon-left',
|
|
300
285
|
},
|
|
301
|
-
/**
|
|
302
|
-
* Size of the icons
|
|
303
|
-
*/
|
|
304
286
|
iconSize: {
|
|
305
287
|
type: Number,
|
|
306
288
|
},
|
|
307
|
-
/**
|
|
308
|
-
* The HTML5 validity object.
|
|
309
|
-
*/
|
|
310
289
|
validity: {
|
|
311
290
|
type: Object,
|
|
312
291
|
},
|
|
313
|
-
/**
|
|
314
|
-
* Manages password visibility
|
|
315
|
-
*/
|
|
316
292
|
isPasswordVisible: {
|
|
317
293
|
type: Boolean,
|
|
318
294
|
},
|
|
319
|
-
/**
|
|
320
|
-
* Input Type of keypress handled through handleInput(e)
|
|
321
|
-
*/
|
|
322
295
|
inputType: {
|
|
323
296
|
type: String,
|
|
324
297
|
},
|
|
325
|
-
/**
|
|
326
|
-
* Determines if the input is focused
|
|
327
|
-
*/
|
|
328
298
|
focused: {
|
|
329
299
|
type: Boolean,
|
|
330
300
|
reflect: true,
|
|
@@ -345,9 +315,7 @@ export default class KemetInput extends LitElement {
|
|
|
345
315
|
this.isPasswordVisible = false;
|
|
346
316
|
this.focused = false;
|
|
347
317
|
|
|
348
|
-
/**
|
|
349
|
-
* Used only for form reactive controller
|
|
350
|
-
*/
|
|
318
|
+
/** @internal */
|
|
351
319
|
this.formSubmitController = new FormSubmitController(this);
|
|
352
320
|
}
|
|
353
321
|
|
|
@@ -476,17 +444,7 @@ export default class KemetInput extends LitElement {
|
|
|
476
444
|
*/
|
|
477
445
|
handleFocus() {
|
|
478
446
|
this.focused = true;
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Fires when the input receives and loses focus
|
|
482
|
-
*/
|
|
483
|
-
this.dispatchEvent(
|
|
484
|
-
new CustomEvent('kemet-input-focused', {
|
|
485
|
-
bubbles: true,
|
|
486
|
-
composed: true,
|
|
487
|
-
detail: true,
|
|
488
|
-
}),
|
|
489
|
-
);
|
|
447
|
+
emitEvent(this, 'kemet-input-focused', true);
|
|
490
448
|
}
|
|
491
449
|
|
|
492
450
|
/**
|
|
@@ -500,17 +458,7 @@ export default class KemetInput extends LitElement {
|
|
|
500
458
|
}
|
|
501
459
|
|
|
502
460
|
this.focused = false;
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Fires when the input receives and loses focus
|
|
506
|
-
*/
|
|
507
|
-
this.dispatchEvent(
|
|
508
|
-
new CustomEvent('kemet-input-focused', {
|
|
509
|
-
bubbles: true,
|
|
510
|
-
composed: true,
|
|
511
|
-
detail: false,
|
|
512
|
-
}),
|
|
513
|
-
);
|
|
461
|
+
emitEvent(this, 'kemet-input-focused', false);
|
|
514
462
|
}
|
|
515
463
|
|
|
516
464
|
/**
|
|
@@ -525,23 +473,11 @@ export default class KemetInput extends LitElement {
|
|
|
525
473
|
this.status = 'standard';
|
|
526
474
|
this.validity = this.input.validity;
|
|
527
475
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
*/
|
|
534
|
-
this.dispatchEvent(
|
|
535
|
-
new CustomEvent('kemet-input-status', {
|
|
536
|
-
bubbles: true,
|
|
537
|
-
composed: true,
|
|
538
|
-
detail: {
|
|
539
|
-
status: 'standard',
|
|
540
|
-
validity: this.input.validity,
|
|
541
|
-
element: this,
|
|
542
|
-
},
|
|
543
|
-
}),
|
|
544
|
-
);
|
|
476
|
+
emitEvent(this, 'kemet-input-status', {
|
|
477
|
+
status: 'standard',
|
|
478
|
+
validity: this.input.validity,
|
|
479
|
+
element: this,
|
|
480
|
+
});
|
|
545
481
|
}
|
|
546
482
|
}
|
|
547
483
|
|
|
@@ -551,17 +487,7 @@ export default class KemetInput extends LitElement {
|
|
|
551
487
|
*/
|
|
552
488
|
handleInput() {
|
|
553
489
|
this.value = this.input.value;
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* Fires when the input receives input
|
|
557
|
-
*/
|
|
558
|
-
this.dispatchEvent(
|
|
559
|
-
new CustomEvent('kemet-input-input', {
|
|
560
|
-
bubbles: true,
|
|
561
|
-
composed: true,
|
|
562
|
-
detail: this.value,
|
|
563
|
-
}),
|
|
564
|
-
);
|
|
490
|
+
emitEvent(this, 'kemet-input-input', this.value);
|
|
565
491
|
}
|
|
566
492
|
|
|
567
493
|
/**
|
|
@@ -575,20 +501,11 @@ export default class KemetInput extends LitElement {
|
|
|
575
501
|
this.invalid = true;
|
|
576
502
|
this.status = 'error';
|
|
577
503
|
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
bubbles: true,
|
|
584
|
-
composed: true,
|
|
585
|
-
detail: {
|
|
586
|
-
status: 'error',
|
|
587
|
-
validity: this.input.validity,
|
|
588
|
-
element: this,
|
|
589
|
-
},
|
|
590
|
-
}),
|
|
591
|
-
);
|
|
504
|
+
emitEvent(this, 'kemet-input-status', {
|
|
505
|
+
status: 'error',
|
|
506
|
+
validity: this.input.validity,
|
|
507
|
+
element: this,
|
|
508
|
+
});
|
|
592
509
|
}
|
|
593
510
|
}
|
|
594
511
|
|
|
@@ -610,17 +527,7 @@ export default class KemetInput extends LitElement {
|
|
|
610
527
|
*/
|
|
611
528
|
handleClear() {
|
|
612
529
|
this.value = '';
|
|
613
|
-
|
|
614
|
-
/**
|
|
615
|
-
* Fires when the input receives input
|
|
616
|
-
*/
|
|
617
|
-
this.dispatchEvent(
|
|
618
|
-
new CustomEvent('kemet-input-input', {
|
|
619
|
-
bubbles: true,
|
|
620
|
-
composed: true,
|
|
621
|
-
detail: this.value,
|
|
622
|
-
}),
|
|
623
|
-
);
|
|
530
|
+
emitEvent(this, 'kemet-input-input', this.value);
|
|
624
531
|
}
|
|
625
532
|
|
|
626
533
|
/**
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { css, html, 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-modal-close
|
|
9
|
+
* @summary A close button for a modal.
|
|
10
|
+
*
|
|
11
|
+
* @event kemet-modal-close-pressed - Fires when the close button is pressed
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
2
14
|
|
|
3
15
|
export default class KemetModalClose extends LitElement {
|
|
4
16
|
static get styles() {
|
|
@@ -23,14 +35,7 @@ export default class KemetModalClose extends LitElement {
|
|
|
23
35
|
}
|
|
24
36
|
|
|
25
37
|
close() {
|
|
26
|
-
|
|
27
|
-
* Fires when the close button is pressed
|
|
28
|
-
*/
|
|
29
|
-
this.dispatchEvent(new CustomEvent('kemet-modal-close-pressed', {
|
|
30
|
-
bubbles: true,
|
|
31
|
-
composed: true,
|
|
32
|
-
detail: this,
|
|
33
|
-
}));
|
|
38
|
+
emitEvent(this, 'kemet-modal-close-press', this);
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { html, LitElement } 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-modal
|
|
10
|
+
* @summary A dialog that has many built in effects and flexible styles.
|
|
11
|
+
*
|
|
12
|
+
* @csspart content - The main contents of the modal.
|
|
13
|
+
* @csspart overlay - The surrounding scrim of the modal.
|
|
14
|
+
*
|
|
15
|
+
* @cssproperty --kemet-modal-content-min-width - The minimum width of the content. Default: 0.
|
|
16
|
+
* @cssproperty --kemet-modal-content-max-width - The maximum width of the content. Default: none.
|
|
17
|
+
* @cssproperty --kemet-modal-content-background-color - The background color of the content. Default: --kemet-color-white.
|
|
18
|
+
* @cssproperty --kemet-modal-content-mobile-min-width - The min with of the mobile content. Default: 100%.
|
|
19
|
+
* @cssproperty --kemet-modal-content-mobile-min-height - The min height of the mobile content. Default: 80vh.
|
|
20
|
+
*
|
|
21
|
+
* @event kemet-modal-opened - Fires when the modal opens
|
|
22
|
+
* @event kemet-modal-closed - Fires when the modal closes
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
3
25
|
|
|
4
26
|
export default class KemetModal extends LitElement {
|
|
5
27
|
static get styles() {
|
|
@@ -47,6 +69,7 @@ export default class KemetModal extends LitElement {
|
|
|
47
69
|
|
|
48
70
|
firstUpdated() {
|
|
49
71
|
// standard properties
|
|
72
|
+
/** @internal */
|
|
50
73
|
this.focusableSelector = 'body, a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]';
|
|
51
74
|
this.focusableElements = this.querySelectorAll(this.focusableSelector);
|
|
52
75
|
|
|
@@ -78,29 +101,11 @@ export default class KemetModal extends LitElement {
|
|
|
78
101
|
this.focusableElements[0]?.focus();
|
|
79
102
|
}, 100);
|
|
80
103
|
|
|
81
|
-
|
|
82
|
-
* Fires when the modal opens
|
|
83
|
-
*/
|
|
84
|
-
this.dispatchEvent(
|
|
85
|
-
new CustomEvent('kemet-modal-opened', {
|
|
86
|
-
bubbles: true,
|
|
87
|
-
composed: true,
|
|
88
|
-
detail: this,
|
|
89
|
-
}),
|
|
90
|
-
);
|
|
104
|
+
emitEvent(this, 'kemet-modal-opened', this);
|
|
91
105
|
}
|
|
92
106
|
|
|
93
107
|
if (prevProps.get('opened') && this.opened === false) {
|
|
94
|
-
|
|
95
|
-
* Fires when the modal closes
|
|
96
|
-
*/
|
|
97
|
-
this.dispatchEvent(
|
|
98
|
-
new CustomEvent('kemet-modal-closed', {
|
|
99
|
-
bubbles: true,
|
|
100
|
-
composed: true,
|
|
101
|
-
detail: this,
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
108
|
+
emitEvent(this, 'kemet-modal-closed', this);
|
|
104
109
|
}
|
|
105
110
|
|
|
106
111
|
this.isMobile();
|
|
File without changes
|
|
@@ -1,128 +1,45 @@
|
|
|
1
|
-
import { html,
|
|
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.2.0
|
|
7
|
+
* @status stable
|
|
8
|
+
*
|
|
9
|
+
* @tagname kemet-password
|
|
10
|
+
* @summary Gauges the strength of a password entered by the user.
|
|
11
|
+
*
|
|
12
|
+
* @prop {array} rules - An array of objects containing the rules the password must meet.
|
|
13
|
+
* @prop {boolean} show - Controls the display of the component.
|
|
14
|
+
* @prop {string} value - The value of the input component.
|
|
15
|
+
* @prop {string} message - A message that is above the rules.
|
|
16
|
+
* @prop {string} strength - The strength of the password. Weak | Better | Strong.
|
|
17
|
+
* @prop {string} icon
|
|
18
|
+
* @prop {number} iconSize
|
|
19
|
+
*
|
|
20
|
+
* @event kemet-password-status - Fires when there's a change in status.
|
|
21
|
+
*
|
|
22
|
+
* @csspart status - The status message.
|
|
23
|
+
* @csspart indicator - The strength indicator bars.
|
|
24
|
+
* @csspart message - A message to display to the user.
|
|
25
|
+
* @csspart rules - A description of rules to follow.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
2
28
|
|
|
3
29
|
export default class KemetPassword extends LitElement {
|
|
4
30
|
static get styles() {
|
|
5
|
-
return [
|
|
6
|
-
css`
|
|
7
|
-
:host {
|
|
8
|
-
color: inherit;
|
|
9
|
-
display: none;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
:host([show]) {
|
|
13
|
-
display: block;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
p {
|
|
17
|
-
margin: 1.6rem 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.status {
|
|
21
|
-
display: grid;
|
|
22
|
-
align-items: center;
|
|
23
|
-
grid-template-columns: 1fr auto;
|
|
24
|
-
line-height: 1;
|
|
25
|
-
margin-top: 0.8rem;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.status > span {
|
|
29
|
-
text-transform: capitalize;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.status--weak,
|
|
33
|
-
.status--better {
|
|
34
|
-
color: var(--kemet-color-error);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.status--strong {
|
|
38
|
-
color: var(--kemet-color-success);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.indicator {
|
|
42
|
-
display: flex;
|
|
43
|
-
gap: 0.4rem;
|
|
44
|
-
margin: 0;
|
|
45
|
-
list-style: none;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.indicator li {
|
|
49
|
-
width: 1.6rem;
|
|
50
|
-
height: 0.2rem;
|
|
51
|
-
background-color: var(--fds-color--gray2);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.status--weak .indicator li:nth-child(1) {
|
|
55
|
-
background-color: var(--kemet-color-error);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.status--better .indicator li:nth-child(1),
|
|
59
|
-
.status--better .indicator li:nth-child(2) {
|
|
60
|
-
background-color: var(--kemet-color-error);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.status--strong .indicator li {
|
|
64
|
-
background-color: var(--kemet-color-success);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.rules {
|
|
68
|
-
color: var(--kemet-color-primary);
|
|
69
|
-
list-style: none;
|
|
70
|
-
font-size: 90%;
|
|
71
|
-
padding-left: 2rem;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.rules li {
|
|
75
|
-
position: relative;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.rules kemet-icon {
|
|
79
|
-
color: var(--kemet-color-success);
|
|
80
|
-
position: absolute;
|
|
81
|
-
left: -2.4rem;
|
|
82
|
-
}
|
|
83
|
-
`,
|
|
84
|
-
];
|
|
31
|
+
return [stylesBase];
|
|
85
32
|
}
|
|
86
33
|
|
|
87
34
|
static get properties() {
|
|
88
35
|
return {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
* Controls the display of the component
|
|
97
|
-
*/
|
|
98
|
-
show: {
|
|
99
|
-
type: Boolean,
|
|
100
|
-
reflect: true,
|
|
101
|
-
},
|
|
102
|
-
/**
|
|
103
|
-
* The value of the input component
|
|
104
|
-
*/
|
|
105
|
-
value: {
|
|
106
|
-
type: String,
|
|
107
|
-
},
|
|
108
|
-
/**
|
|
109
|
-
* A message that is above the rules
|
|
110
|
-
*/
|
|
111
|
-
message: {
|
|
112
|
-
type: String,
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* The strength of the password. Weak | Better | Strong
|
|
116
|
-
*/
|
|
117
|
-
strength: {
|
|
118
|
-
type: String,
|
|
119
|
-
},
|
|
120
|
-
icon: {
|
|
121
|
-
type: String,
|
|
122
|
-
},
|
|
123
|
-
iconSize: {
|
|
124
|
-
type: Number,
|
|
125
|
-
},
|
|
36
|
+
rules: { type: Array },
|
|
37
|
+
show: { type: Boolean, reflect: true },
|
|
38
|
+
value: { type: String },
|
|
39
|
+
message: { type: String },
|
|
40
|
+
strength: { type: String },
|
|
41
|
+
icon: { type: String },
|
|
42
|
+
iconSize: { type: Number },
|
|
126
43
|
};
|
|
127
44
|
}
|
|
128
45
|
|
|
@@ -244,20 +161,11 @@ export default class KemetPassword extends LitElement {
|
|
|
244
161
|
this.status = 'success';
|
|
245
162
|
}
|
|
246
163
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
bubbles: true,
|
|
253
|
-
composed: true,
|
|
254
|
-
detail: {
|
|
255
|
-
status: this.status,
|
|
256
|
-
validity: { meetsPasswordCriteria: this.status === 'success' },
|
|
257
|
-
element: this,
|
|
258
|
-
},
|
|
259
|
-
}),
|
|
260
|
-
);
|
|
164
|
+
emitEvent(this, 'kemet-password-status', {
|
|
165
|
+
status: this.status,
|
|
166
|
+
validity: { meetsPasswordCriteria: this.status === 'success' },
|
|
167
|
+
element: this,
|
|
168
|
+
});
|
|
261
169
|
}, 1);
|
|
262
170
|
}
|
|
263
171
|
|