@dile/ui 2.28.0 → 3.0.1

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.
@@ -19,6 +19,7 @@ export class DileButtonIcon extends DileButton {
19
19
  --dile-icon-color: var(--dile-button-icon-color, var(--dile-on-primary-color, #ffffff));
20
20
  }
21
21
  dile-icon {
22
+ --dile-icon-size: var(--dile-button-icon-size, calc(var(--dile-button-font-size, 1rem) * 1.125));
22
23
  margin-right: var(--dile-button-icon-separation, 0.3rem);
23
24
  }
24
25
  button:hover {
@@ -3,7 +3,7 @@ import { DileEmmitChange } from '../../../mixins/form/index.js';
3
3
  import { DileOverlay } from '../../../mixins/overlay/index.js';
4
4
  import { DileCloseDocumentClick } from '../../../mixins/close-document-click/index.js';
5
5
  import { DileCloseOnEscPressed } from '../../../mixins/close-on-esc-pressed/index.js';
6
- import { messageStyles } from '../../input/index.js';
6
+ import { labelStyles, messageStyles } from '../../input/index.js';
7
7
  import { normalizeHex, hexToHsv, hsvToHex } from '../../../lib/color/colorConversion.js';
8
8
 
9
9
  export class DileColorPicker extends DileOverlay(
@@ -133,6 +133,7 @@ export class DileColorPicker extends DileOverlay(
133
133
 
134
134
  static get styles() {
135
135
  return [
136
+ labelStyles,
136
137
  messageStyles,
137
138
  css`
138
139
  * {
@@ -142,13 +143,6 @@ export class DileColorPicker extends DileOverlay(
142
143
  display: inline-block;
143
144
  margin-bottom: 10px;
144
145
  }
145
- label {
146
- display: block;
147
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
148
- font-size: var(--dile-input-label-font-size, 1em);
149
- color: var(--dile-input-label-color, #59e);
150
- font-weight: var(--dile-input-label-font-weight, normal);
151
- }
152
146
  #trigger {
153
147
  padding: 0;
154
148
  width: var(--dile-color-picker-swatch-size, 2em);
@@ -167,7 +161,7 @@ export class DileColorPicker extends DileOverlay(
167
161
  #trigger:focus-visible {
168
162
  outline: none;
169
163
  border-width: var(--dile-color-picker-swatch-focus-border-width, 3px);
170
- border-color: var(--dile-input-focus-border-color, #6af);
164
+ border-color: var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
171
165
  }
172
166
  #overlay {
173
167
  display: none;
@@ -198,7 +192,7 @@ export class DileColorPicker extends DileOverlay(
198
192
  cursor: crosshair;
199
193
  }
200
194
  #sv-square:focus-visible {
201
- outline: 2px solid var(--dile-input-focus-border-color, #6af);
195
+ outline: 2px solid var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
202
196
  outline-offset: 2px;
203
197
  }
204
198
  .sv-thumb {
@@ -288,7 +282,7 @@ export class DileColorPicker extends DileOverlay(
288
282
  }
289
283
  .hex-input:focus {
290
284
  outline: none;
291
- border-color: var(--dile-input-focus-border-color, #6af);
285
+ border-color: var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
292
286
  }
293
287
  .hex-input.errored {
294
288
  border-color: var(--dile-color-picker-error-border-color, #c00);
@@ -1,11 +1,13 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import '../file-preview.js';
3
3
  import '../../button/button.js';
4
+ import { labelStyles } from '../../input/src/label-styles.js';
4
5
  import { messageStyles } from '../../input/src/message-styles.js';
5
6
  import { DileEmmitChange } from '../../../mixins/form/index.js';
6
7
 
7
8
  export class DileDropFile extends DileEmmitChange(LitElement) {
8
9
  static styles = [
10
+ labelStyles,
9
11
  messageStyles,
10
12
  css`
11
13
  * { box-sizing: border-box; }
@@ -41,13 +43,6 @@ export class DileDropFile extends DileEmmitChange(LitElement) {
41
43
  display: none;
42
44
  }
43
45
 
44
- label {
45
- display: block;
46
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
47
- font-size: var(--dile-input-label-font-size, 1em);
48
- color: var(--dile-input-label-color, #59e);
49
- font-weight: var(--dile-input-label-font-weight, normal);
50
- }
51
46
  main {
52
47
  width: var(--dile-input-section-width, 100%);
53
48
  }
@@ -5,5 +5,6 @@ export { DileInputMoney } from './src/DileInputMoney.js';
5
5
  export { DileInputNumberMask } from './src/DileInputNumberMask.js';
6
6
  export { DileInputPercentage } from './src/DileInputPercentage.js';
7
7
  export { DileInputSearch } from './src/DileInputSearch.js';
8
+ export { labelStyles } from './src/label-styles.js';
8
9
  export { messageStyles } from './src/message-styles.js';
9
10
  export { Mask } from './src/Mask.js';
@@ -1,5 +1,6 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
+ import { labelStyles } from './label-styles.js';
3
4
  import { messageStyles } from './message-styles.js';
4
5
 
5
6
  export class DileInput extends DileEmmitChange(LitElement) {
@@ -76,7 +77,7 @@ export class DileInput extends DileEmmitChange(LitElement) {
76
77
  this.disableAutocomplete = false;
77
78
  this.name = '';
78
79
  this.type = 'text';
79
- this.types = ['text', 'password', 'email', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime', 'datetime-local', 'month', 'week'];
80
+ this.types = ['text', 'password', 'email', 'number', 'tel', 'url', 'search', 'date', 'time', 'datetime', 'datetime-local', 'month', 'week'];
80
81
  this.internals = this.attachInternals();
81
82
  }
82
83
 
@@ -95,6 +96,7 @@ export class DileInput extends DileEmmitChange(LitElement) {
95
96
 
96
97
  static get styles() {
97
98
  return [
99
+ labelStyles,
98
100
  messageStyles,
99
101
  css`
100
102
  * {
@@ -110,13 +112,6 @@ export class DileInput extends DileEmmitChange(LitElement) {
110
112
  main {
111
113
  width: var(--dile-input-section-width, 100%);
112
114
  }
113
- label {
114
- display: block;
115
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
116
- font-size: var(--dile-input-label-font-size, 1em);
117
- color: var(--dile-input-label-color, #59e);
118
- font-weight: var(--dile-input-label-font-weight, normal);
119
- }
120
115
  input {
121
116
  box-sizing: border-box;
122
117
  border-radius: var(--dile-input-border-radius, 5px);
@@ -131,8 +126,9 @@ export class DileInput extends DileEmmitChange(LitElement) {
131
126
  flex-grow: 1;
132
127
  }
133
128
  input:focus {
134
- outline: none;
135
- border-color: var(--dile-input-focus-border-color, #6af)
129
+ outline: var(--dile-input-focus-ring-width, 3px) solid var(--dile-input-focus-ring-color, rgba(102, 170, 255, 0.5));
130
+ outline-offset: calc(-1 * var(--dile-input-focus-ring-width, 3px));
131
+ border-color: var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
136
132
  }
137
133
  input::placeholder {
138
134
  color: var(--dile-input-placeholder-color, #ccc);
@@ -152,13 +148,13 @@ export class DileInput extends DileEmmitChange(LitElement) {
152
148
  }
153
149
  .labelright {
154
150
  margin-left: var(--dile-input-label-right-margin-left, 10px);
155
- color: var(--dile-input-label-color, #59e);
151
+ color: var(--dile-input-label-color, var(--dile-on-background-color, #59e));
156
152
  font-size: var(--dile-input-label-right-font-size, 1.2em);
157
153
  }
158
154
  `
159
155
  ];
160
156
  }
161
-
157
+
162
158
  render() {
163
159
  return html`
164
160
  <main>
@@ -180,8 +176,8 @@ export class DileInput extends DileEmmitChange(LitElement) {
180
176
  @input="${this._input}"
181
177
  @blur="${this.doBlur}"
182
178
  @focus="${this.doFocus}"
183
- />
184
- ${this.labelRight
179
+ />
180
+ ${this.labelRight
185
181
  ? html`<span class="labelright">${this.labelRight}</span>`
186
182
  : ''
187
183
  }
@@ -193,7 +189,7 @@ export class DileInput extends DileEmmitChange(LitElement) {
193
189
 
194
190
  get messageTemplate() {
195
191
  return html`
196
- ${this.message
192
+ ${this.message
197
193
  ? html`<div class="message ${this.errored ? 'errored-msg' : ''}"><span>${this.message}</span></div>`
198
194
  : ''
199
195
  }
@@ -212,10 +208,10 @@ export class DileInput extends DileEmmitChange(LitElement) {
212
208
  _input(e) {
213
209
  this.value = e.target.value;
214
210
  if (this.hideErrorOnInput && this.errored) {
215
- this.clearError();
211
+ this.clearError();
216
212
  }
217
213
  }
218
-
214
+
219
215
  clearError() {
220
216
  this.errored = false;
221
217
  this.message = '';
@@ -249,4 +245,4 @@ export class DileInput extends DileEmmitChange(LitElement) {
249
245
  focus() {
250
246
  this.el.focus();
251
247
  }
252
- }
248
+ }
@@ -18,7 +18,7 @@ export class DileInputSearch extends LitElement {
18
18
  background-color: var(--dile-input-background-color, #fff);
19
19
  }
20
20
  div:focus-within {
21
- border-color: var(--dile-input-focus-border-color, #6af);
21
+ border-color: var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
22
22
  }
23
23
  input {
24
24
  flex-grow: 1;
@@ -0,0 +1,11 @@
1
+ import { css } from 'lit';
2
+
3
+ export const labelStyles = css`
4
+ label, .label {
5
+ display: block;
6
+ margin-bottom: var(--dile-input-label-margin-bottom, 4px);
7
+ font-size: var(--dile-input-label-font-size, 1em);
8
+ color: var(--dile-input-label-color, var(--dile-on-background-color, #59e));
9
+ font-weight: var(--dile-input-label-font-weight, normal);
10
+ }
11
+ `;
@@ -1,10 +1,12 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
3
  import '../number-picker-element.js';
4
+ import { labelStyles } from '../../input/src/label-styles.js';
4
5
  import { messageStyles } from '../../input/src/message-styles.js';
5
6
 
6
7
  export class DileNumberPicker extends DileEmmitChange(LitElement) {
7
8
  static styles = [
9
+ labelStyles,
8
10
  messageStyles,
9
11
  css`
10
12
  :host {
@@ -14,13 +16,6 @@ export class DileNumberPicker extends DileEmmitChange(LitElement) {
14
16
  * {
15
17
  box-sizing: border-box;
16
18
  }
17
- label {
18
- display: block;
19
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
20
- font-size: var(--dile-input-label-font-size, 1em);
21
- color: var(--dile-input-label-color, #59e);
22
- font-weight: var(--dile-input-label-font-weight, normal);
23
- }
24
19
  `
25
20
  ];
26
21
 
@@ -1,6 +1,6 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
- import { messageStyles } from '../../input/index.js';
3
+ import { labelStyles, messageStyles } from '../../input/index.js';
4
4
  import { sanitizeOtpValue } from '../../../lib/otp/sanitizeOtpValue.js';
5
5
 
6
6
  export class DileOtpInput extends DileEmmitChange(LitElement) {
@@ -106,6 +106,7 @@ export class DileOtpInput extends DileEmmitChange(LitElement) {
106
106
 
107
107
  static get styles() {
108
108
  return [
109
+ labelStyles,
109
110
  messageStyles,
110
111
  css`
111
112
  * {
@@ -118,13 +119,6 @@ export class DileOtpInput extends DileEmmitChange(LitElement) {
118
119
  main {
119
120
  width: var(--dile-otp-input-section-width, auto);
120
121
  }
121
- label {
122
- display: block;
123
- margin-bottom: var(--dile-otp-input-label-margin-bottom, 4px);
124
- font-size: var(--dile-otp-input-label-font-size, 1em);
125
- color: var(--dile-otp-input-label-color, #59e);
126
- font-weight: var(--dile-otp-input-label-font-weight, normal);
127
- }
128
122
  section.for-input {
129
123
  display: flex;
130
124
  gap: var(--dile-otp-input-gap, 8px);
@@ -143,7 +137,7 @@ export class DileOtpInput extends DileEmmitChange(LitElement) {
143
137
  }
144
138
  input:focus {
145
139
  outline: none;
146
- border-color: var(--dile-otp-input-focus-border-color, #6af);
140
+ border-color: var(--dile-otp-input-focus-border-color, var(--dile-link-color, #6af));
147
141
  }
148
142
  input:disabled {
149
143
  background-color: #f5f5f5;
@@ -2,21 +2,16 @@ import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
3
  import '../radio.js';
4
4
  import '../../input/input-message.js';
5
+ import { labelStyles } from '../../input/index.js';
5
6
 
6
7
  export class DileRadioGroup extends DileEmmitChange(LitElement) {
7
8
  static styles = [
9
+ labelStyles,
8
10
  css`
9
11
  :host {
10
12
  display: block;
11
13
  margin-bottom: 10px;
12
14
  }
13
- .label {
14
- display: block;
15
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
16
- font-size: var(--dile-input-label-font-size, 1em);
17
- color: var(--dile-input-label-color, #59e);
18
- font-weight: var(--dile-input-label-font-weight, normal);
19
- }
20
15
  :host([disabled]) {
21
16
  --dile-radio-icon-color: var(--dile-radio-disabled-icon-color, #ccc);
22
17
  }
@@ -1,11 +1,14 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
3
  import '../../input/input-message.js';
4
+ import { labelStyles } from '../../input/index.js';
4
5
 
5
6
  export class DileRange extends DileEmmitChange(LitElement) {
6
7
 
7
8
  static get styles() {
8
- return css`
9
+ return [
10
+ labelStyles,
11
+ css`
9
12
  :host {
10
13
  display: block;
11
14
  margin-bottom: 10px;
@@ -15,14 +18,6 @@ export class DileRange extends DileEmmitChange(LitElement) {
15
18
  --dile-range-line-color: var(--dile-range-line-errored-color, #c00);
16
19
  }
17
20
 
18
- label {
19
- display: block;
20
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
21
- font-size: var(--dile-input-label-font-size, 1em);
22
- color: var(--dile-input-label-color, #59e);
23
- font-weight: var(--dile-input-label-font-weight, normal);
24
- }
25
-
26
21
  /*********** Baseline, reset styles ***********/
27
22
  input[type="range"] {
28
23
  -webkit-appearance: none;
@@ -87,7 +82,8 @@ export class DileRange extends DileEmmitChange(LitElement) {
87
82
  }
88
83
 
89
84
 
90
- `;
85
+ `
86
+ ];
91
87
  }
92
88
 
93
89
  static get formAssociated() {
@@ -1,10 +1,11 @@
1
1
  import { html, css, LitElement } from "lit";
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
- import { messageStyles } from '../../input/index.js';
3
+ import { labelStyles, messageStyles } from '../../input/index.js';
4
4
 
5
5
  export class DileSelect extends DileEmmitChange(LitElement) {
6
6
  static get styles() {
7
7
  return [
8
+ labelStyles,
8
9
  messageStyles,
9
10
  css`
10
11
  :host {
@@ -14,13 +15,6 @@ export class DileSelect extends DileEmmitChange(LitElement) {
14
15
  * {
15
16
  box-sizing: border-box;
16
17
  }
17
- label {
18
- display: block;
19
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
20
- font-size: var(--dile-input-label-font-size, 1em);
21
- color: var(--dile-input-label-color, #59e);
22
- font-weight: var(--dile-input-label-font-weight, normal);
23
- }
24
18
  ::slotted(select) {
25
19
  box-sizing: border-box;
26
20
  width: var(--dile-input-width, 100%);
@@ -42,9 +36,10 @@ export class DileSelect extends DileEmmitChange(LitElement) {
42
36
  ::slotted(select.dark) {
43
37
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20256%20448%22%20enable-background%3D%22new%200%200%20256%20448%22%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E.arrow%7Bfill%3A%23ffffff%3B%7D%3C%2Fstyle%3E%3Cpath%20class%3D%22arrow%22%20d%3D%22M255.9%20168c0-4.2-1.6-7.9-4.8-11.2-3.2-3.2-6.9-4.8-11.2-4.8H16c-4.2%200-7.9%201.6-11.2%204.8S0%20163.8%200%20168c0%204.4%201.6%208.2%204.8%2011.4l112%20112c3.1%203.1%206.8%204.6%2011.2%204.6%204.4%200%208.2-1.5%2011.4-4.6l112-112c3-3.2%204.5-7%204.5-11.4z%22%2F%3E%3C%2Fsvg%3E%0A");
44
38
  }
45
- ::slotted(select):focus {
46
- outline: none;
47
- border-color: var(--dile-input-focus-border-color, #6af);
39
+ :host(:focus-within) ::slotted(select) {
40
+ outline: var(--dile-input-focus-ring-width, 3px) solid var(--dile-input-focus-ring-color, rgba(102, 170, 255, 0.5));
41
+ outline-offset: calc(-1 * var(--dile-input-focus-ring-width, 3px));
42
+ border-color: var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
48
43
  }
49
44
  ::slotted(select.errored) {
50
45
  border-color: var(--dile-input-error-border-color, #c00);
@@ -3,6 +3,7 @@ import '../../input/input-search.js';
3
3
  import '../../spinner/spinner-horizontal.js';
4
4
  import { DileEmmitChange } from '../../../mixins/form/index.js';
5
5
  import '../select.js';
6
+ import { labelStyles } from '../../input/src/label-styles.js';
6
7
  import { messageStyles } from '../../input/src/message-styles.js';
7
8
 
8
9
 
@@ -10,6 +11,7 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
10
11
 
11
12
  static get styles() {
12
13
  return [
14
+ labelStyles,
13
15
  messageStyles,
14
16
  css`
15
17
  * {
@@ -23,13 +25,6 @@ export class DileSelectAjax extends DileEmmitChange(LitElement) {
23
25
  #result {
24
26
  margin-bottom: 0.5rem;
25
27
  }
26
- label {
27
- display: block;
28
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
29
- font-size: var(--dile-input-label-font-size, 1em);
30
- color: var(--dile-input-label-color, #59e);
31
- font-weight: var(--dile-input-label-font-weight, normal);
32
- }
33
28
  .anchor {
34
29
  margin-top: 0.5rem;
35
30
  position: relative;
@@ -1,23 +1,18 @@
1
1
  import { LitElement, html, css } from 'lit';
2
- import { messageStyles } from '../../input/index.js';
2
+ import { labelStyles, messageStyles } from '../../input/index.js';
3
3
  import { DileEmmitChange } from '../../../mixins/form/index.js';
4
4
 
5
5
  export class DileTextarea extends DileEmmitChange(LitElement) {
6
6
 
7
7
  static get styles() {
8
8
  return [
9
- messageStyles,
9
+ labelStyles,
10
+ messageStyles,
10
11
  css`
11
12
  :host {
12
13
  display: block;
13
14
  margin-bottom: 10px;
14
15
  }
15
- label {
16
- margin-bottom: var(--dile-textarea-label-margin-bottom, 4px);
17
- color: var(--dile-textarea-label-color, #59e);
18
- font-size: var(--dile-textarea-label-font-size, 1em);
19
- font-weight: var(--dile-textarea-label-font-weight, normal);
20
- }
21
16
 
22
17
  textarea {
23
18
  border: var(--dile-textarea-border, 1px solid #888);
@@ -32,6 +27,12 @@ export class DileTextarea extends DileEmmitChange(LitElement) {
32
27
  line-height: 1.5rem;
33
28
  }
34
29
 
30
+ textarea:focus {
31
+ outline: var(--dile-input-focus-ring-width, 3px) solid var(--dile-input-focus-ring-color, rgba(102, 170, 255, 0.5));
32
+ outline-offset: calc(-1 * var(--dile-input-focus-ring-width, 3px));
33
+ border-color: var(--dile-input-focus-border-color, var(--dile-link-color, #6af));
34
+ }
35
+
35
36
  textarea::placeholder {
36
37
  color: var(--dile-textarea-placeholder-color, #999);
37
38
  }
@@ -1,23 +1,18 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { DileEmmitChange } from '../../../mixins/form/index.js';
3
3
  import '../../number-picker/number-picker-element.js';
4
+ import { labelStyles } from '../../input/src/label-styles.js';
4
5
  import { messageStyles } from '../../input/src/message-styles.js';
5
6
 
6
7
  export class DileTimePicker extends DileEmmitChange(LitElement) {
7
8
  static styles = [
9
+ labelStyles,
8
10
  messageStyles,
9
11
  css`
10
12
  :host {
11
13
  display: block;
12
14
  margin-bottom: 10px;
13
15
  }
14
- label {
15
- display: block;
16
- margin-bottom: var(--dile-input-label-margin-bottom, 4px);
17
- font-size: var(--dile-input-label-font-size, 1em);
18
- color: var(--dile-input-label-color, #59e);
19
- font-weight: var(--dile-input-label-font-weight, normal);
20
- }
21
16
  section {
22
17
  display: flex;
23
18
  gap: 0.5rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dile/ui",
3
- "version": "2.28.0",
3
+ "version": "3.0.1",
4
4
  "description": "UI Core components from dile-components.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,5 +27,5 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "d90ac8ac1b524d3591fc65ac57a6156131a940bb"
30
+ "gitHead": "46b1b4d084b5e7d6433f41928f195ff11df59af3"
31
31
  }