@dile/ui 3.23.0 → 3.24.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/components/checkbox/src/DileCheckbox.js +14 -5
- package/components/drop-file/src/DileDropFile.js +5 -3
- package/components/input/index.js +1 -1
- package/components/input/src/DileInput.js +9 -3
- package/components/input/src/DileInputMask.js +16 -0
- package/components/input/src/DileInputSearch.js +2 -0
- package/components/input/src/label-styles.js +15 -0
- package/components/input-suggestions/src/DileInputSuggestionsBase.js +6 -3
- package/components/number-picker/src/DileNumberPicker.js +6 -3
- package/components/number-picker/src/DileNumberPickerElement.js +2 -0
- package/components/order-switch/src/DileOrderSwitch.js +18 -2
- package/components/otp-input/src/DileOtpInput.js +6 -3
- package/components/radio-group/src/DileRadioGroup.js +6 -3
- package/components/rating-scale-question/src/DileRatingScaleQuestion.js +35 -3
- package/components/select/src/DileSelect.js +12 -4
- package/components/select/src/DileSelectAjax.js +8 -3
- package/components/select/src/DileSelectBoolean.js +9 -2
- package/components/select/src/DileSelectOverlay.js +6 -3
- package/components/select/src/DileSelectSearchableBase.js +8 -3
- package/components/switch/src/DileSwitch.js +3 -1
- package/components/textarea/src/DileTextarea.js +7 -3
- package/components/time-picker/src/DileTimePicker.js +680 -126
- package/components/wheel-picker/src/DileWheelPicker.js +17 -2
- package/lib/time/time.js +171 -0
- package/lib/time/time.test.js +63 -0
- package/mixins/form/index.js +2 -1
- package/mixins/form/src/DileForm.js +240 -1
- package/mixins/form/src/DileNativeValidity.js +195 -0
- package/mixins/overlay/src/DileOverlay.js +16 -0
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { html, css, LitElement } from "lit";
|
|
2
|
-
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
2
|
+
import { DileNativeValidity, DileEmmitChange } from '../../../mixins/form/index.js';
|
|
3
3
|
import '../select.js';
|
|
4
4
|
|
|
5
|
-
export class DileSelectBoolean extends DileEmmitChange(LitElement) {
|
|
5
|
+
export class DileSelectBoolean extends DileNativeValidity(DileEmmitChange(LitElement)) {
|
|
6
6
|
static get formAssociated() {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
|
@@ -20,6 +20,8 @@ export class DileSelectBoolean extends DileEmmitChange(LitElement) {
|
|
|
20
20
|
label: { type: String },
|
|
21
21
|
value: {},
|
|
22
22
|
name: { type: String, reflect: true },
|
|
23
|
+
/** Marks the field as required: shows the required indicator in the label and sets aria-required */
|
|
24
|
+
required: { type: Boolean, reflect: true },
|
|
23
25
|
disabled: { type: Boolean },
|
|
24
26
|
errored: { type: Boolean },
|
|
25
27
|
message: { type: String },
|
|
@@ -46,6 +48,7 @@ export class DileSelectBoolean extends DileEmmitChange(LitElement) {
|
|
|
46
48
|
<dile-select
|
|
47
49
|
label="${this.label || ''}"
|
|
48
50
|
?errored="${this.errored}"
|
|
51
|
+
?required="${this.required}"
|
|
49
52
|
message="${this.message || ''}"
|
|
50
53
|
?disabled="${this.disabled}"
|
|
51
54
|
quietOnStart
|
|
@@ -92,6 +95,10 @@ export class DileSelectBoolean extends DileEmmitChange(LitElement) {
|
|
|
92
95
|
|
|
93
96
|
_onInnerChange(e) {
|
|
94
97
|
e.stopPropagation();
|
|
98
|
+
// The inner select is emptied by clear() or a null value: keep the empty state
|
|
99
|
+
if (e.detail.value !== 'true' && e.detail.value !== 'false') {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
95
102
|
const boolValue = e.detail.value === 'true';
|
|
96
103
|
if (boolValue !== this.value) {
|
|
97
104
|
this.value = boolValue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from "lit";
|
|
2
2
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
3
|
-
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
3
|
+
import { DileNativeValidity, DileEmmitChange } from '../../../mixins/form/index.js';
|
|
4
4
|
import { DileOverlay } from '../../../mixins/overlay/index.js';
|
|
5
5
|
import { DileCloseDocumentClick } from '../../../mixins/close-document-click/index.js';
|
|
6
6
|
import { labelStyles, messageStyles } from '../../input/index.js';
|
|
@@ -11,7 +11,7 @@ const TYPEAHEAD_RESET_DELAY = 500;
|
|
|
11
11
|
const ICONLIB_FOLDERS = { material: 'material-icons', lucide: 'lucide-icons', fontawesome: 'fontawesome-icons' };
|
|
12
12
|
const warnedIcons = new Set();
|
|
13
13
|
|
|
14
|
-
export class DileSelectOverlay extends DileOverlay(DileCloseDocumentClick(DileEmmitChange(LitElement))) {
|
|
14
|
+
export class DileSelectOverlay extends DileOverlay(DileCloseDocumentClick(DileNativeValidity(DileEmmitChange(LitElement)))) {
|
|
15
15
|
static get styles() {
|
|
16
16
|
return [
|
|
17
17
|
labelStyles,
|
|
@@ -181,6 +181,8 @@ export class DileSelectOverlay extends DileOverlay(DileCloseDocumentClick(DileEm
|
|
|
181
181
|
accessibleLabel: { type: String },
|
|
182
182
|
value: { type: String },
|
|
183
183
|
name: { type: String, reflect: true },
|
|
184
|
+
/** Marks the field as required: shows the required indicator in the label and sets aria-required */
|
|
185
|
+
required: { type: Boolean, reflect: true },
|
|
184
186
|
disabled: { type: Boolean },
|
|
185
187
|
errored: { type: Boolean },
|
|
186
188
|
message: { type: String },
|
|
@@ -340,7 +342,7 @@ export class DileSelectOverlay extends DileOverlay(DileCloseDocumentClick(DileEm
|
|
|
340
342
|
const messageId = this.message ? `${this.selectId}-message` : null;
|
|
341
343
|
return html`
|
|
342
344
|
<div>${this.label
|
|
343
|
-
? html`<label for="trigger">${this.label}</label>`
|
|
345
|
+
? html`<label for="trigger" class="field-label">${this.label}</label>`
|
|
344
346
|
: ""
|
|
345
347
|
}<div class="select-wrapper">
|
|
346
348
|
${this.triggerTemplate}
|
|
@@ -371,6 +373,7 @@ export class DileSelectOverlay extends DileOverlay(DileCloseDocumentClick(DileEm
|
|
|
371
373
|
aria-controls="overlay"
|
|
372
374
|
aria-activedescendant="${ifDefined(this._activeIndex >= 0 ? this._optionId(this._activeIndex) : undefined)}"
|
|
373
375
|
aria-invalid="${this.errored}"
|
|
376
|
+
aria-required="${ifDefined(this.required ? 'true' : undefined)}"
|
|
374
377
|
aria-describedby="${ifDefined(this.message ? `${this.selectId}-message` : undefined)}"
|
|
375
378
|
?disabled="${this.disabled}"
|
|
376
379
|
tabindex="${this.hideTrigger ? '-1' : '0'}"
|
|
@@ -6,7 +6,7 @@ import '../../icon/icon.js';
|
|
|
6
6
|
import '../select-overlay.js';
|
|
7
7
|
import '../../input/input-search.js';
|
|
8
8
|
import { searchIcon, clearIcon } from '@dile/icons/index.js';
|
|
9
|
-
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
9
|
+
import { DileNativeValidity, DileEmmitChange } from '../../../mixins/form/index.js';
|
|
10
10
|
import { labelStyles } from '../../input/src/label-styles.js';
|
|
11
11
|
import { messageStyles } from '../../input/src/message-styles.js';
|
|
12
12
|
|
|
@@ -25,7 +25,7 @@ const OPTION_PARTS = ['option', 'option-highlighted', 'option-selected', 'option
|
|
|
25
25
|
* - resolveSelectedText(): set `selectedText` for the current `value` (initial value or set()).
|
|
26
26
|
* - selectedTextChangedEventName: name of the event fired when the selected text changes.
|
|
27
27
|
*/
|
|
28
|
-
export class DileSelectSearchableBase extends DileEmmitChange(LitElement) {
|
|
28
|
+
export class DileSelectSearchableBase extends DileNativeValidity(DileEmmitChange(LitElement)) {
|
|
29
29
|
|
|
30
30
|
static get styles() {
|
|
31
31
|
return [
|
|
@@ -146,6 +146,8 @@ export class DileSelectSearchableBase extends DileEmmitChange(LitElement) {
|
|
|
146
146
|
label: { type: String },
|
|
147
147
|
value: { type: String },
|
|
148
148
|
name: { type: String, reflect: true },
|
|
149
|
+
/** Marks the field as required: shows the required indicator in the label and sets aria-required */
|
|
150
|
+
required: { type: Boolean, reflect: true },
|
|
149
151
|
disabled: { type: Boolean },
|
|
150
152
|
errored: { type: Boolean },
|
|
151
153
|
data: { type: Array },
|
|
@@ -301,7 +303,7 @@ export class DileSelectSearchableBase extends DileEmmitChange(LitElement) {
|
|
|
301
303
|
return html`
|
|
302
304
|
<div>
|
|
303
305
|
${this.label
|
|
304
|
-
? html`<label for="${this.isSelected ? 'result' : 'search'}">${this.label}</label>`
|
|
306
|
+
? html`<label for="${this.isSelected ? 'result' : 'search'}" class="field-label">${this.label}</label>`
|
|
305
307
|
: ""}
|
|
306
308
|
${this.isSelected
|
|
307
309
|
? this.selectedTemplate
|
|
@@ -317,6 +319,7 @@ export class DileSelectSearchableBase extends DileEmmitChange(LitElement) {
|
|
|
317
319
|
<dile-input-search
|
|
318
320
|
id="result"
|
|
319
321
|
?errored=${this.errored}
|
|
322
|
+
?required=${this.required}
|
|
320
323
|
?disabled=${this.disabled}
|
|
321
324
|
value="${this.selectedText}"
|
|
322
325
|
readOnly
|
|
@@ -341,6 +344,7 @@ export class DileSelectSearchableBase extends DileEmmitChange(LitElement) {
|
|
|
341
344
|
aria-haspopup="listbox"
|
|
342
345
|
aria-expanded="${this.opened}"
|
|
343
346
|
aria-invalid="${this.errored}"
|
|
347
|
+
aria-required="${ifDefined(this.required ? 'true' : undefined)}"
|
|
344
348
|
aria-describedby="${ifDefined(this.message ? `${this.selectId}-message` : undefined)}"
|
|
345
349
|
placeholder="${this.placeholder}"
|
|
346
350
|
.value="${this.keyword}"
|
|
@@ -388,6 +392,7 @@ export class DileSelectSearchableBase extends DileEmmitChange(LitElement) {
|
|
|
388
392
|
<dile-select-overlay
|
|
389
393
|
id="elselect"
|
|
390
394
|
?hideTrigger=${this.hasSearchField}
|
|
395
|
+
?required=${this.required}
|
|
391
396
|
name="generated-select-field"
|
|
392
397
|
placeholder="${this.placeholder}"
|
|
393
398
|
?disabled=${this.disabled}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { DileCheckbox } from '../../checkbox/src/DileCheckbox.js';
|
|
3
|
+
import { requiredIndicatorStyles } from '../../input/src/label-styles.js';
|
|
3
4
|
|
|
4
5
|
export class DileSwitch extends DileCheckbox {
|
|
5
6
|
static styles = [
|
|
7
|
+
requiredIndicatorStyles,
|
|
6
8
|
css`
|
|
7
9
|
:host {
|
|
8
10
|
display: inline-block;
|
|
@@ -76,7 +78,7 @@ export class DileSwitch extends DileCheckbox {
|
|
|
76
78
|
|
|
77
79
|
get reactiveLabelsTemplate() {
|
|
78
80
|
return html`
|
|
79
|
-
<label class="label">
|
|
81
|
+
<label class="label field-label">
|
|
80
82
|
${this.checked
|
|
81
83
|
? this.checkedLabel
|
|
82
84
|
: this.uncheckedLabel
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
2
3
|
import { labelStyles, messageStyles } from '../../input/index.js';
|
|
3
|
-
import { DileEmmitChange } from '../../../mixins/form/index.js';
|
|
4
|
+
import { DileNativeValidity, DileEmmitChange } from '../../../mixins/form/index.js';
|
|
4
5
|
|
|
5
|
-
export class DileTextarea extends DileEmmitChange(LitElement) {
|
|
6
|
+
export class DileTextarea extends DileNativeValidity(DileEmmitChange(LitElement)) {
|
|
6
7
|
|
|
7
8
|
static get styles() {
|
|
8
9
|
return [
|
|
@@ -71,6 +72,8 @@ export class DileTextarea extends DileEmmitChange(LitElement) {
|
|
|
71
72
|
rows: { type: Number },
|
|
72
73
|
maxRows: { type: Number },
|
|
73
74
|
readonly: { type: Boolean },
|
|
75
|
+
/** Marks the field as required: shows the required indicator in the label and sets aria-required */
|
|
76
|
+
required: { type: Boolean, reflect: true },
|
|
74
77
|
disabled: {
|
|
75
78
|
type: Boolean,
|
|
76
79
|
reflect: true,
|
|
@@ -113,7 +116,7 @@ export class DileTextarea extends DileEmmitChange(LitElement) {
|
|
|
113
116
|
return html`
|
|
114
117
|
<main>
|
|
115
118
|
${this.label
|
|
116
|
-
? html`<label for="textArea">${this.label}</label>`
|
|
119
|
+
? html`<label for="textArea" class="field-label">${this.label}</label>`
|
|
117
120
|
: ""}
|
|
118
121
|
<section class="for-input">
|
|
119
122
|
<textarea
|
|
@@ -123,6 +126,7 @@ export class DileTextarea extends DileEmmitChange(LitElement) {
|
|
|
123
126
|
placeholder="${this.placeholder}"
|
|
124
127
|
?disabled="${this.disabled}"
|
|
125
128
|
?readonly="${this.readonly}"
|
|
129
|
+
aria-required="${ifDefined(this.required ? 'true' : undefined)}"
|
|
126
130
|
autocomplete="${this.disableAutocomplete ? "off" : "on"}"
|
|
127
131
|
.value="${this.value}"
|
|
128
132
|
class="${this.errored ? 'errored' : ''}"
|