@crowdstrike/glide-core 0.26.1 → 0.28.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/dist/accordion.d.ts +2 -2
- package/dist/accordion.js +1 -1
- package/dist/button-group.button.d.ts +2 -2
- package/dist/button-group.button.js +1 -1
- package/dist/button-group.d.ts +3 -3
- package/dist/button-group.js +1 -1
- package/dist/button.d.ts +2 -2
- package/dist/button.js +1 -1
- package/dist/checkbox-group.d.ts +3 -3
- package/dist/checkbox-group.js +9 -9
- package/dist/checkbox.d.ts +2 -3
- package/dist/checkbox.js +3 -3
- package/dist/checkbox.styles.js +8 -16
- package/dist/drawer.d.ts +2 -2
- package/dist/drawer.js +1 -1
- package/dist/dropdown.d.ts +17 -22
- package/dist/dropdown.js +102 -107
- package/dist/dropdown.option.d.ts +9 -9
- package/dist/dropdown.option.js +1 -1
- package/dist/dropdown.option.styles.js +16 -79
- package/dist/dropdown.styles.js +57 -74
- package/dist/form-controls-layout.d.ts +3 -3
- package/dist/form-controls-layout.js +1 -1
- package/dist/icon-button.d.ts +2 -2
- package/dist/icon-button.js +1 -1
- package/dist/icons/checked.js +1 -1
- package/dist/inline-alert.d.ts +2 -2
- package/dist/inline-alert.js +1 -1
- package/dist/input.d.ts +2 -2
- package/dist/input.js +2 -2
- package/dist/input.styles.js +9 -7
- package/dist/label.d.ts +2 -2
- package/dist/label.js +1 -1
- package/dist/label.styles.js +5 -1
- package/dist/library/assert-slot.d.ts +1 -1
- package/dist/library/assert-slot.test.js +22 -22
- package/dist/library/expect-window-error.js +1 -1
- package/dist/library/final.test.js +9 -9
- package/dist/library/form-control.d.ts +1 -1
- package/dist/library/localize.d.ts +5 -0
- package/dist/library/localize.test.js +6 -6
- package/dist/library/required.test.js +5 -5
- package/dist/library/unique-id.d.ts +2 -0
- package/dist/library/unique-id.js +1 -0
- package/dist/link.d.ts +2 -3
- package/dist/link.js +1 -1
- package/dist/link.styles.js +1 -1
- package/dist/menu.button.d.ts +2 -2
- package/dist/menu.button.js +1 -1
- package/dist/menu.button.styles.js +3 -3
- package/dist/menu.d.ts +3 -9
- package/dist/menu.js +1 -1
- package/dist/menu.link.d.ts +2 -2
- package/dist/menu.link.js +1 -1
- package/dist/menu.link.styles.js +3 -3
- package/dist/menu.options.d.ts +3 -4
- package/dist/menu.options.js +1 -1
- package/dist/menu.options.styles.js +3 -20
- package/dist/modal.d.ts +6 -6
- package/dist/modal.icon-button.d.ts +2 -2
- package/dist/modal.icon-button.js +1 -1
- package/dist/modal.js +1 -1
- package/dist/popover.d.ts +2 -2
- package/dist/popover.js +1 -1
- package/dist/radio-group.d.ts +3 -3
- package/dist/radio-group.js +6 -6
- package/dist/radio-group.radio.d.ts +2 -2
- package/dist/radio-group.radio.js +1 -1
- package/dist/slider.d.ts +116 -0
- package/dist/slider.js +168 -0
- package/dist/slider.styles.d.ts +2 -0
- package/dist/slider.styles.js +168 -0
- package/dist/spinner.d.ts +2 -2
- package/dist/spinner.js +1 -1
- package/dist/split-button.d.ts +4 -10
- package/dist/split-button.js +1 -1
- package/dist/split-button.primary-button.d.ts +2 -2
- package/dist/split-button.primary-button.js +1 -1
- package/dist/split-button.primary-button.styles.js +4 -14
- package/dist/split-button.primary-link.d.ts +2 -2
- package/dist/split-button.primary-link.js +1 -1
- package/dist/split-button.secondary-button.d.ts +3 -4
- package/dist/split-button.secondary-button.js +1 -1
- package/dist/split-button.secondary-button.styles.js +4 -15
- package/dist/styles/variables.css +1 -1
- package/dist/tab.d.ts +12 -4
- package/dist/tab.group.d.ts +4 -5
- package/dist/tab.group.js +1 -1
- package/dist/tab.group.styles.js +14 -16
- package/dist/tab.js +1 -1
- package/dist/tab.panel.d.ts +12 -5
- package/dist/tab.panel.js +1 -1
- package/dist/tag.d.ts +2 -4
- package/dist/tag.js +1 -1
- package/dist/tag.styles.js +7 -52
- package/dist/textarea.d.ts +2 -2
- package/dist/textarea.js +7 -7
- package/dist/textarea.styles.js +17 -2
- package/dist/toast.d.ts +3 -3
- package/dist/toast.js +1 -1
- package/dist/toast.toasts.d.ts +9 -9
- package/dist/toast.toasts.js +17 -17
- package/dist/toggle.d.ts +2 -2
- package/dist/toggle.js +1 -1
- package/dist/tooltip.container.d.ts +2 -2
- package/dist/tooltip.container.js +1 -1
- package/dist/tooltip.d.ts +3 -3
- package/dist/tooltip.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/fr.d.ts +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/ja.d.ts +1 -1
- package/dist/translations/ja.js +1 -1
- package/package.json +19 -18
@@ -23,29 +23,15 @@ import{css}from"lit";export default[css`
|
|
23
23
|
color: var(--glide-core-color-static-text-default);
|
24
24
|
display: flex;
|
25
25
|
flex-grow: 1;
|
26
|
+
font-family: var(--glide-core-typography-family-primary);
|
27
|
+
font-size: var(--glide-core-typography-size-body-default);
|
28
|
+
font-weight: var(--glide-core-typography-weight-regular);
|
26
29
|
overflow: hidden;
|
30
|
+
padding-inline-start: 0.625rem;
|
27
31
|
user-select: none;
|
28
32
|
|
29
|
-
|
30
|
-
|
31
|
-
font-size: var(--glide-core-typography-size-body-default);
|
32
|
-
font-weight: var(--glide-core-typography-weight-regular);
|
33
|
-
padding-inline-start: 0.625rem;
|
34
|
-
|
35
|
-
&:not(.count, .editable) {
|
36
|
-
padding-inline-end: var(--glide-core-spacing-base-sm);
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
&.small {
|
41
|
-
font-family: var(--glide-core-typography-family-primary);
|
42
|
-
font-size: var(--glide-core-typography-size-body-small);
|
43
|
-
font-weight: var(--glide-core-typography-weight-regular);
|
44
|
-
padding-inline-start: var(--glide-core-spacing-base-sm);
|
45
|
-
|
46
|
-
&:not(.count, .editable) {
|
47
|
-
padding-inline-end: var(--glide-core-spacing-base-xs);
|
48
|
-
}
|
33
|
+
&:not(.count, .editable) {
|
34
|
+
padding-inline-end: var(--glide-core-spacing-base-sm);
|
49
35
|
}
|
50
36
|
|
51
37
|
&.disabled {
|
@@ -57,33 +43,16 @@ import{css}from"lit";export default[css`
|
|
57
43
|
flex-grow: 1;
|
58
44
|
overflow: hidden;
|
59
45
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
}
|
64
|
-
|
65
|
-
&:not(.count, .editable) {
|
66
|
-
&::part(private-label-and-input-and-checkbox) {
|
67
|
-
padding-inline-end: var(--glide-core-spacing-base-sm);
|
68
|
-
}
|
69
|
-
}
|
46
|
+
&::part(private-label-and-input-and-checkbox) {
|
47
|
+
block-size: var(--private-option-height);
|
48
|
+
padding-inline-start: var(--glide-core-spacing-base-sm);
|
70
49
|
}
|
71
50
|
|
72
|
-
|
51
|
+
&:not(.count, .editable) {
|
73
52
|
&::part(private-label-and-input-and-checkbox) {
|
74
|
-
padding-inline-
|
75
|
-
}
|
76
|
-
|
77
|
-
&:not(.count, .editable) {
|
78
|
-
&::part(private-label-and-input-and-checkbox) {
|
79
|
-
padding-inline-end: var(--glide-core-spacing-base-xs);
|
80
|
-
}
|
53
|
+
padding-inline-end: var(--glide-core-spacing-base-sm);
|
81
54
|
}
|
82
55
|
}
|
83
|
-
|
84
|
-
&::part(private-label-and-input-and-checkbox) {
|
85
|
-
block-size: var(--private-option-height);
|
86
|
-
}
|
87
56
|
}
|
88
57
|
|
89
58
|
.indeterminate-icon {
|
@@ -91,47 +60,21 @@ import{css}from"lit";export default[css`
|
|
91
60
|
}
|
92
61
|
|
93
62
|
.icon-slot {
|
94
|
-
&.large {
|
95
|
-
&::slotted(*) {
|
96
|
-
block-size: 1rem;
|
97
|
-
inline-size: 1rem;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
&.small {
|
102
|
-
&::slotted(*) {
|
103
|
-
block-size: 0.75rem;
|
104
|
-
inline-size: 0.75rem;
|
105
|
-
}
|
106
|
-
}
|
107
|
-
|
108
63
|
&::slotted(*) {
|
109
64
|
align-items: center;
|
65
|
+
block-size: 1rem;
|
110
66
|
display: flex;
|
67
|
+
inline-size: 1rem;
|
111
68
|
padding-inline-end: var(--glide-core-spacing-base-xs);
|
112
69
|
}
|
113
70
|
}
|
114
71
|
|
115
72
|
.checkbox-icon-slot {
|
116
|
-
&.large {
|
117
|
-
&::slotted(*) {
|
118
|
-
block-size: 1rem;
|
119
|
-
inline-size: 1rem;
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
&.small {
|
124
|
-
&::slotted(*) {
|
125
|
-
block-size: 0.75rem;
|
126
|
-
inline-size: 0.75rem;
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
73
|
&::slotted(*) {
|
131
74
|
align-items: center;
|
132
|
-
block-size:
|
75
|
+
block-size: 1rem;
|
133
76
|
display: flex;
|
134
|
-
inline-size:
|
77
|
+
inline-size: 1rem;
|
135
78
|
}
|
136
79
|
}
|
137
80
|
|
@@ -178,13 +121,7 @@ import{css}from"lit";export default[css`
|
|
178
121
|
}
|
179
122
|
|
180
123
|
&:not(.count) {
|
181
|
-
|
182
|
-
padding-inline-end: var(--glide-core-spacing-base-sm);
|
183
|
-
}
|
184
|
-
|
185
|
-
&.small {
|
186
|
-
padding-inline-end: var(--glide-core-spacing-base-xs);
|
187
|
-
}
|
124
|
+
padding-inline-end: var(--glide-core-spacing-base-sm);
|
188
125
|
}
|
189
126
|
|
190
127
|
&:focus {
|
package/dist/dropdown.styles.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
import{css}from"lit";import
|
2
|
-
${
|
3
|
-
${opacityAndScaleAnimation(".options-and-footer:popover-open")}
|
1
|
+
import{css}from"lit";import opacityAndScaleAnimation from"./styles/opacity-and-scale-animation.js";import visuallyHidden from"./styles/visually-hidden.js";import skeleton from"./styles/skeleton.js";export default[css`
|
2
|
+
${opacityAndScaleAnimation(".options-and-feedback:popover-open")}
|
4
3
|
${skeleton(".loading-feedback")}
|
5
4
|
${visuallyHidden(".item-count")}
|
6
5
|
${visuallyHidden(".selected-option-labels")}
|
@@ -112,8 +111,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
112
111
|
}
|
113
112
|
}
|
114
113
|
|
115
|
-
.options-and-
|
114
|
+
.options-and-feedback {
|
116
115
|
--private-border-width: 1px;
|
116
|
+
--private-option-height: 1.75rem;
|
117
117
|
|
118
118
|
background-color: var(
|
119
119
|
--glide-core-private-color-dialog-and-modal-surface-container
|
@@ -146,14 +146,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
146
146
|
2 + var(--private-border-width) * 2
|
147
147
|
);
|
148
148
|
overflow: auto;
|
149
|
-
scroll-behavior: smooth;
|
150
149
|
|
151
|
-
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
&.small {
|
156
|
-
--private-option-height: 1.25rem;
|
150
|
+
@media (prefers-reduced-motion: no-preference) {
|
151
|
+
scroll-behavior: smooth;
|
157
152
|
}
|
158
153
|
|
159
154
|
&.hidden {
|
@@ -163,70 +158,9 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
163
158
|
|
164
159
|
.default-slot {
|
165
160
|
display: block;
|
166
|
-
padding: var(--glide-core-spacing-base-xxxs);
|
167
|
-
}
|
168
|
-
|
169
|
-
.footer {
|
170
|
-
background-color: var(--glide-core-color-static-surface-header);
|
171
|
-
display: none;
|
172
|
-
inline-size: calc(100% - var(--glide-core-spacing-base-xxxs) * 2);
|
173
|
-
inset-block-end: 0;
|
174
|
-
padding: var(--glide-core-spacing-base-xxxs);
|
175
|
-
|
176
|
-
/*
|
177
|
-
"sticky" is a little hack so that footer is absolutely positioned but
|
178
|
-
its space in layout is preserved, so it doesn't overlap the last option.
|
179
|
-
*/
|
180
|
-
position: sticky;
|
181
|
-
|
182
|
-
&.visible {
|
183
|
-
display: block;
|
184
|
-
}
|
185
|
-
}
|
186
|
-
|
187
|
-
.add-button {
|
188
|
-
align-items: center;
|
189
|
-
background-color: transparent;
|
190
|
-
border: none;
|
191
|
-
border-radius: var(--glide-core-rounding-base-radius-md);
|
192
|
-
display: flex;
|
193
|
-
font-family: var(--glide-core-typography-family-primary);
|
194
|
-
font-weight: var(--glide-core-typography-weight-regular);
|
195
|
-
inline-size: 100%;
|
196
|
-
line-height: 100%;
|
197
|
-
text-align: start;
|
198
|
-
|
199
|
-
&.large {
|
200
|
-
--private-size: 1rem;
|
201
|
-
|
202
|
-
column-gap: 0.625rem;
|
203
|
-
font-size: var(--glide-core-typography-size-body-default);
|
204
|
-
padding-block: 0.375rem;
|
205
|
-
padding-inline: var(--glide-core-spacing-base-sm);
|
206
|
-
}
|
207
|
-
|
208
|
-
&.small {
|
209
|
-
--private-size: 0.875rem;
|
210
|
-
|
211
|
-
column-gap: var(--glide-core-spacing-base-xs);
|
212
|
-
font-size: var(--glide-core-typography-size-body-small);
|
213
|
-
padding-block: var(--glide-core-spacing-base-xxxs);
|
214
|
-
padding-inline: var(--glide-core-spacing-base-xs);
|
215
|
-
}
|
216
|
-
|
217
|
-
&:focus {
|
218
|
-
outline: none;
|
219
|
-
}
|
220
|
-
|
221
|
-
&:focus-visible {
|
222
|
-
outline-offset: -2px;
|
223
|
-
}
|
224
161
|
|
225
|
-
&:
|
226
|
-
|
227
|
-
background-color: var(
|
228
|
-
--glide-core-color-interactive-surface-container--hover
|
229
|
-
);
|
162
|
+
&:not(.optionless) {
|
163
|
+
padding: var(--glide-core-spacing-base-xxxs);
|
230
164
|
}
|
231
165
|
}
|
232
166
|
|
@@ -392,6 +326,55 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
392
326
|
}
|
393
327
|
}
|
394
328
|
|
329
|
+
.add-button-container {
|
330
|
+
padding: var(--glide-core-spacing-base-xxxs);
|
331
|
+
|
332
|
+
/*
|
333
|
+
"sticky" is a little hack so it's absolutely positioned but its space
|
334
|
+
in layout is preserved, so it doesn't overlap the last option.
|
335
|
+
*/
|
336
|
+
position: sticky;
|
337
|
+
|
338
|
+
&.bordered {
|
339
|
+
border-block-start: 1px solid
|
340
|
+
var(--glide-core-color-static-stroke-secondary);
|
341
|
+
padding-block-start: var(--glide-core-spacing-base-xxxs);
|
342
|
+
}
|
343
|
+
}
|
344
|
+
|
345
|
+
.add-button {
|
346
|
+
align-items: center;
|
347
|
+
background-color: transparent;
|
348
|
+
block-size: var(--private-option-height);
|
349
|
+
border-radius: var(--glide-core-spacing-base-sm);
|
350
|
+
border-width: 0;
|
351
|
+
display: flex;
|
352
|
+
font-family: var(--glide-core-typography-family-primary);
|
353
|
+
font-size: var(--glide-core-typography-size-body-default);
|
354
|
+
inline-size: 100%;
|
355
|
+
max-inline-size: 21.875rem;
|
356
|
+
padding-inline: 0.625rem;
|
357
|
+
transition: background-color 100ms ease-in-out;
|
358
|
+
user-select: none;
|
359
|
+
white-space: nowrap;
|
360
|
+
|
361
|
+
&.active {
|
362
|
+
background-color: var(
|
363
|
+
--glide-core-color-interactive-surface-container--hover
|
364
|
+
);
|
365
|
+
}
|
366
|
+
}
|
367
|
+
|
368
|
+
.add-button-label {
|
369
|
+
font-weight: var(--glide-core-typography-weight-bold);
|
370
|
+
overflow-x: hidden;
|
371
|
+
text-overflow: ellipsis;
|
372
|
+
}
|
373
|
+
|
374
|
+
.add-button-description {
|
375
|
+
color: var(--glide-core-color-interactive-text-placeholder);
|
376
|
+
}
|
377
|
+
|
395
378
|
.description {
|
396
379
|
display: block;
|
397
380
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-form-controls-layout':
|
4
|
+
'glide-core-form-controls-layout': FormControlsLayout;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -10,9 +10,9 @@ declare global {
|
|
10
10
|
* @readonly
|
11
11
|
* @attr {string} [version]
|
12
12
|
*
|
13
|
-
* @slot {
|
13
|
+
* @slot {Checkbox | CheckboxGroup | Dropdown | Input | RadioGroup | Slider | TextArea}
|
14
14
|
*/
|
15
|
-
export default class
|
15
|
+
export default class FormControlsLayout extends LitElement {
|
16
16
|
#private;
|
17
17
|
static shadowRootOptions: ShadowRootInit;
|
18
18
|
static styles: import("lit").CSSResult[];
|
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(o,e,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,o,e,r){var s,i=arguments.length,l=i<3?o:null===r?r=Object.getOwnPropertyDescriptor(o,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,o,e,r);else for(var n=t.length-1;n>=0;n--)(s=t[n])&&(l=(i<3?s(l):i>3?s(o,e,l):s(o,e))||l);return i>3&&l&&Object.defineProperty(o,e,l),l};import{html,LitElement}from"lit";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import packageJson from"../package.json"with{type:"json"};import Checkbox from"./checkbox.js";import CheckboxGroup from"./checkbox-group.js";import Dropdown from"./dropdown.js";import Input from"./input.js";import RadioGroup from"./radio-group.js";import Slider from"./slider.js";import TextArea from"./textarea.js";import styles from"./form-controls-layout.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";let FormControlsLayout=class FormControlsLayout extends LitElement{constructor(){super(...arguments),this.version=packageJson.version,this.#t=createRef(),this.#o="left"}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}get split(){return this.#o}set split(t){if(this.#o=t,this.#t.value)for(const t of this.#t.value.assignedElements())"privateSplit"in t&&(t.privateSplit=this.split)}render(){return html`<div class="component"><slot @slotchange="${this.#e}" ${assertSlot([Checkbox,CheckboxGroup,Dropdown,Input,RadioGroup,Slider,TextArea])} ${ref(this.#t)}></slot></div>`}#t;#o;#e(){if(this.#t.value)for(const t of this.#t.value.assignedElements())if("privateSplit"in t&&(t.privateSplit=this.split),"orientation"in t&&"horizontal"!==t.orientation)throw new TypeError("Only horizontal controls are supported.")}};__decorate([property({reflect:!0})],FormControlsLayout.prototype,"split",null),__decorate([property({reflect:!0})],FormControlsLayout.prototype,"version",void 0),FormControlsLayout=__decorate([customElement("glide-core-form-controls-layout"),final],FormControlsLayout);export default FormControlsLayout;
|
package/dist/icon-button.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-icon-button':
|
4
|
+
'glide-core-icon-button': IconButton;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -18,7 +18,7 @@ declare global {
|
|
18
18
|
*
|
19
19
|
* @slot {Element} - An icon
|
20
20
|
*/
|
21
|
-
export default class
|
21
|
+
export default class IconButton extends LitElement {
|
22
22
|
#private;
|
23
23
|
static shadowRootOptions: ShadowRootInit;
|
24
24
|
static styles: import("lit").CSSResult[];
|
package/dist/icon-button.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,o,r){var i,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(s=(a<3?i(s):a>3?i(e,o,s):i(e,o))||s);return a>3&&s&&Object.defineProperty(e,o,s),s};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./icon-button.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,r){var i,a=arguments.length,s=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,r);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(s=(a<3?i(s):a>3?i(e,o,s):i(e,o))||s);return a>3&&s&&Object.defineProperty(e,o,s),s};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import packageJson from"../package.json"with{type:"json"};import styles from"./icon-button.styles.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let IconButton=class IconButton extends LitElement{constructor(){super(...arguments),this.ariaControls=null,this.ariaExpanded=null,this.ariaHasPopup=null,this.disabled=!1,this.variant="primary",this.version=packageJson.version,this.#t=null,this.#e=createRef(),this.#o=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,delegatesFocus:!0,mode:shadowRootMode}}static{this.styles=styles}get ariaDescription(){return this.#t}set ariaDescription(t){this.#t=t,this.#e.value&&(this.#e.value.ariaDescription=t)}click(){this.#e.value?.click()}firstUpdated(){this.#e.value&&this.ariaDescription&&(this.#e.value.ariaDescription=this.ariaDescription)}render(){return html`<button aria-controls="${ifDefined(this.ariaControls??void 0)}" aria-expanded="${ifDefined(this.ariaExpanded??void 0)}" aria-haspopup="${ifDefined(this.ariaHasPopup??void 0)}" aria-label="${ifDefined(this.label)}" class="${classMap({component:!0,primary:"primary"===this.variant,secondary:"secondary"===this.variant,tertiary:"tertiary"===this.variant})}" data-test="button" type="button" ?disabled="${this.disabled}" ${ref(this.#e)}><slot class="default-slot" ${assertSlot()} ${ref(this.#o)}></slot></button>`}#t;#e;#o};__decorate([property({reflect:!0}),required],IconButton.prototype,"label",void 0),__decorate([property({attribute:"aria-controls",reflect:!0,useDefault:!0})],IconButton.prototype,"ariaControls",void 0),__decorate([property({attribute:"aria-description",reflect:!0})],IconButton.prototype,"ariaDescription",null),__decorate([property({attribute:"aria-expanded",reflect:!0,useDefault:!0})],IconButton.prototype,"ariaExpanded",void 0),__decorate([property({attribute:"aria-haspopup",reflect:!0,useDefault:!0})],IconButton.prototype,"ariaHasPopup",void 0),__decorate([property({type:Boolean,reflect:!0})],IconButton.prototype,"disabled",void 0),__decorate([property({reflect:!0,useDefault:!0})],IconButton.prototype,"variant",void 0),__decorate([property({reflect:!0})],IconButton.prototype,"version",void 0),IconButton=__decorate([customElement("glide-core-icon-button"),final],IconButton);export default IconButton;
|
package/dist/icons/checked.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
import{html}from"lit";import{styleMap}from"lit/directives/style-map.js";export default html`<svg aria-hidden="true" fill="none" viewBox="0 0 24 24" style="${styleMap({height:"var(--private-size, 0.875rem)",width:"var(--private-size, 0.875rem)"})}"><path class="check" d="M20 6L9 17L4 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
1
|
+
import{html}from"lit";import{styleMap}from"lit/directives/style-map.js";export default html`<svg aria-hidden="true" fill="none" viewBox="0 0 24 24" style="${styleMap({height:"var(--private-size, 0.875rem)",width:"var(--private-size, 0.875rem)"})}"><path class="check" data-test="check" d="M20 6L9 17L4 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
|
package/dist/inline-alert.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { LitElement } from 'lit';
|
2
2
|
declare global {
|
3
3
|
interface HTMLElementTagNameMap {
|
4
|
-
'glide-core-inline-alert':
|
4
|
+
'glide-core-inline-alert': InlineAlert;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
/**
|
@@ -12,7 +12,7 @@ declare global {
|
|
12
12
|
*
|
13
13
|
* @slot {Element | string} - The content of the alert
|
14
14
|
*/
|
15
|
-
export default class
|
15
|
+
export default class InlineAlert extends LitElement {
|
16
16
|
#private;
|
17
17
|
static shadowRootOptions: ShadowRootInit;
|
18
18
|
static styles: import("lit").CSSResult[];
|
package/dist/inline-alert.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(n<3?r(a):n>3?r(t,i,a):r(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import packageJson from"../package.json"with{type:"json"};import styles from"./inline-alert.styles.js";import severityInformationalIcon from"./icons/severity-informational.js";import severityMediumIcon from"./icons/severity-medium.js";import severityCriticalIcon from"./icons/severity-critical.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";let
|
1
|
+
var __decorate=this&&this.__decorate||function(e,t,i,o){var r,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(n<3?r(a):n>3?r(t,i,a):r(t,i))||a);return n>3&&a&&Object.defineProperty(t,i,a),a};import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import packageJson from"../package.json"with{type:"json"};import styles from"./inline-alert.styles.js";import severityInformationalIcon from"./icons/severity-informational.js";import severityMediumIcon from"./icons/severity-medium.js";import severityCriticalIcon from"./icons/severity-critical.js";import assertSlot from"./library/assert-slot.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";let InlineAlert=class InlineAlert extends LitElement{constructor(){super(...arguments),this.variant="informational",this.version=packageJson.version,this.#e=100,this.#t=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}firstUpdated(){this.#t.value?.addEventListener("animationend",(()=>{this.#t.value?.classList.remove("added")}),{once:!0})}render(){return html`<div class="${classMap({component:!0,added:!0,[this.variant]:!0})}" role="alert" aria-labelledby="label" data-test="component" style="--private-animation-duration: ${this.#e}ms" ${ref(this.#t)}><div aria-hidden="true" class="${classMap({"icon-container":!0,[this.variant]:!0})}">${icons[this.variant]}</div><div id="label" class="content"><slot ${assertSlot()}></slot></div></div>`}#e;#t};__decorate([property({reflect:!0,useDefault:!0})],InlineAlert.prototype,"variant",void 0),__decorate([property({reflect:!0})],InlineAlert.prototype,"version",void 0),InlineAlert=__decorate([customElement("glide-core-inline-alert"),final],InlineAlert);export default InlineAlert;const icons={informational:severityInformationalIcon,medium:severityMediumIcon,high:html`<svg aria-hidden="true" viewBox="0 0 16 16" fill="none" style="${styleMap({height:"var(--private-size, 1rem)",width:"var(--private-size, 1rem)"})}"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.8924 1.33334H4.10768C3.75626 1.33333 3.45307 1.33332 3.20336 1.35372C2.93979 1.37525 2.67765 1.4228 2.42539 1.55132C2.04907 1.74307 1.74311 2.04903 1.55136 2.42536C1.42283 2.67761 1.37529 2.93976 1.35376 3.20332C1.33335 3.45303 1.33336 3.75619 1.33337 4.10762V11.8924C1.33336 12.2438 1.33335 12.547 1.35376 12.7967C1.37529 13.0603 1.42283 13.3224 1.55136 13.5747C1.74311 13.951 2.04907 14.2569 2.42539 14.4487C2.67765 14.5772 2.93979 14.6248 3.20336 14.6463C3.45307 14.6667 3.75624 14.6667 4.10766 14.6667H11.8924C12.2438 14.6667 12.547 14.6667 12.7967 14.6463C13.0603 14.6248 13.3224 14.5772 13.5747 14.4487C13.951 14.2569 14.257 13.951 14.4487 13.5747C14.5773 13.3224 14.6248 13.0603 14.6463 12.7967C14.6667 12.547 14.6667 12.2438 14.6667 11.8924V4.10763C14.6667 3.7562 14.6667 3.45303 14.6463 3.20332C14.6248 2.93976 14.5773 2.67761 14.4487 2.42536C14.257 2.04903 13.951 1.74307 13.5747 1.55132C13.3224 1.4228 13.0603 1.37525 12.7967 1.35372C12.547 1.33332 12.2438 1.33333 11.8924 1.33334ZM8.66671 5.33334C8.66671 4.96515 8.36823 4.66667 8.00004 4.66667C7.63185 4.66667 7.33337 4.96515 7.33337 5.33334V8C7.33337 8.36819 7.63185 8.66667 8.00004 8.66667C8.36823 8.66667 8.66671 8.36819 8.66671 8V5.33334ZM8.00004 10C7.63185 10 7.33337 10.2985 7.33337 10.6667C7.33337 11.0349 7.63185 11.3333 8.00004 11.3333H8.00671C8.3749 11.3333 8.67338 11.0349 8.67338 10.6667C8.67338 10.2985 8.3749 10 8.00671 10H8.00004Z" fill="currentColor"/></svg>`,critical:severityCriticalIcon};
|
package/dist/input.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { LitElement } from 'lit';
|
|
4
4
|
import type FormControl from './library/form-control.js';
|
5
5
|
declare global {
|
6
6
|
interface HTMLElementTagNameMap {
|
7
|
-
'glide-core-input':
|
7
|
+
'glide-core-input': Input;
|
8
8
|
}
|
9
9
|
}
|
10
10
|
/**
|
@@ -62,7 +62,7 @@ declare global {
|
|
62
62
|
* @param {ValidityStateFlags} [flags]
|
63
63
|
* @param {string} [message]
|
64
64
|
*/
|
65
|
-
export default class
|
65
|
+
export default class Input extends LitElement implements FormControl {
|
66
66
|
#private;
|
67
67
|
static formAssociated: boolean;
|
68
68
|
static shadowRootOptions: ShadowRootInit;
|
package/dist/input.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(t,e,i,s){var a,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(r=(o<3?a(r):o>3?a(e,i,r):a(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};import"./icon-button.js";import"./label.js";import{html,LitElement,nothing}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{styleMap}from"lit/directives/style-map.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import packageJson from"../package.json"with{type:"json"};import{LocalizeController}from"./library/localize.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import styles from"./input.styles.js";import xIcon from"./icons/x.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,i,s){var a,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(r=(o<3?a(r):o>3?a(e,i,r):a(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r};import"./icon-button.js";import"./label.js";import{html,LitElement,nothing}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{ifDefined}from"lit/directives/if-defined.js";import{styleMap}from"lit/directives/style-map.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{when}from"lit/directives/when.js";import packageJson from"../package.json"with{type:"json"};import{LocalizeController}from"./library/localize.js";import magnifyingGlassIcon from"./icons/magnifying-glass.js";import styles from"./input.styles.js";import xIcon from"./icons/x.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";import required from"./library/required.js";let Input=class Input extends LitElement{static{this.formAssociated=!0}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode,delegatesFocus:!0}}static{this.styles=styles}get form(){return this.#t.form}get validity(){return this.pattern&&this.pattern.length>0?(this.#t.setValidity({customError:Boolean(this.validityMessage),patternMismatch:Boolean(this.value&&!new RegExp(`^(?:${this.pattern})$`,"v").test(this.value)),valueMissing:Boolean(this.required&&!this.value)}," ",this.#e.value),this.#t.validity):!this.pattern&&this.#t.validity.patternMismatch?(this.#t.setValidity({}),this.#t.validity):!this.required||this.value||this.disabled?this.required&&this.#t.validity.valueMissing&&this.value?(this.#t.setValidity({}),this.#t.validity):(this.required||!this.#t.validity.valueMissing||this.value||this.#t.setValidity({}),this.#t.validity):(this.#t.setValidity({customError:Boolean(this.validityMessage),valueMissing:!0}," ",this.#e.value),this.#t.validity)}checkValidity(){this.isCheckingValidity=!0;const t=this.#t.checkValidity();return this.isCheckingValidity=!1,t}disconnectedCallback(){super.disconnectedCallback(),this.form?.removeEventListener("formdata",this.#i)}formAssociatedCallback(){this.form?.addEventListener("formdata",this.#i)}formResetCallback(){this.value=this.getAttribute("value")??""}render(){return html`
|
2
2
|
<glide-core-private-label
|
3
3
|
class=${classMap({left:"left"===this.privateSplit,middle:"middle"===this.privateSplit})}
|
4
4
|
label=${ifDefined(this.label)}
|
@@ -118,7 +118,7 @@ var __decorate=this&&this.__decorate||function(t,e,i,s){var a,o=arguments.length
|
|
118
118
|
`:nothing}
|
119
119
|
</div>
|
120
120
|
</glide-core-private-label>
|
121
|
-
`}reportValidity(){this.isReportValidityOrSubmit=!0;const t=this.#t.reportValidity();return this.requestUpdate(),t}resetValidityFeedback(){this.isReportValidityOrSubmit=!1}setCustomValidity(t){this.validityMessage=t,""===t?this.#t.setValidity({customError:!1},"",this.#e.value):this.#t.setValidity({customError:!0,patternMismatch:this.#t.validity.patternMismatch,valueMissing:this.#t.validity.valueMissing}," ",this.#e.value)}setValidity(t,e){this.validityMessage=e,this.#t.setValidity(t," ",this.#e.value)}constructor(){super(),this.autocapitalize="on",this.autocomplete="on",this.clearable=!1,this.disabled=!1,this.hideLabel=!1,this.name="",this.orientation="horizontal",this.passwordToggle=!1,this.pattern="",this.readonly=!1,this.required=!1,this.spellcheck=!1,this.type="text",this.value="",this.version=packageJson.version,this.hasFocus=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.passwordVisible=!1,this.#e=createRef(),this.#c=new LocalizeController(this),this.#i=({formData:t})=>{this.name&&this.value&&!this.disabled&&t.append(this.name,this.value)},this.#t=this.attachInternals(),this.addEventListener("invalid",(t=>{if(t?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#e;#t;#c;get#p(){return this.clearable&&!this.disabled&&!this.readonly}get#h(){return this.#p&&this.value.length>0}get#m(){return this.value.length}#i;get#a(){return Boolean(!this.disabled&&!this.readonly&&this.maxlength&&this.#m>this.maxlength)}get#s(){return!this.disabled&&!this.validity?.valid&&this.isReportValidityOrSubmit}#u(t){this.value="",this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.#e.value?.focus(),t.stopPropagation()}#r(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1,this.hasFocus=!1}#l(){this.#e.value?.value&&(this.value=this.#e.value?.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}#o(){this.hasFocus=!0}#n(){this.#e.value&&(this.value=this.#e.value.value)}#d(t){"Enter"===t.key&&this.form?.requestSubmit()}#y(){this.passwordVisible=!this.passwordVisible}};__decorate([property({reflect:!0}),required],
|
121
|
+
`}reportValidity(){this.isReportValidityOrSubmit=!0;const t=this.#t.reportValidity();return this.requestUpdate(),t}resetValidityFeedback(){this.isReportValidityOrSubmit=!1}setCustomValidity(t){this.validityMessage=t,""===t?this.#t.setValidity({customError:!1},"",this.#e.value):this.#t.setValidity({customError:!0,patternMismatch:this.#t.validity.patternMismatch,valueMissing:this.#t.validity.valueMissing}," ",this.#e.value)}setValidity(t,e){this.validityMessage=e,this.#t.setValidity(t," ",this.#e.value)}constructor(){super(),this.autocapitalize="on",this.autocomplete="on",this.clearable=!1,this.disabled=!1,this.hideLabel=!1,this.name="",this.orientation="horizontal",this.passwordToggle=!1,this.pattern="",this.readonly=!1,this.required=!1,this.spellcheck=!1,this.type="text",this.value="",this.version=packageJson.version,this.hasFocus=!1,this.isBlurring=!1,this.isCheckingValidity=!1,this.isReportValidityOrSubmit=!1,this.passwordVisible=!1,this.#e=createRef(),this.#c=new LocalizeController(this),this.#i=({formData:t})=>{this.name&&this.value&&!this.disabled&&t.append(this.name,this.value)},this.#t=this.attachInternals(),this.addEventListener("invalid",(t=>{if(t?.preventDefault(),this.isCheckingValidity||this.isBlurring)return;this.isReportValidityOrSubmit=!0;this.form?.querySelector(":invalid")===this&&this.focus()}))}#e;#t;#c;get#p(){return this.clearable&&!this.disabled&&!this.readonly}get#h(){return this.#p&&this.value.length>0}get#m(){return this.value.length}#i;get#a(){return Boolean(!this.disabled&&!this.readonly&&this.maxlength&&this.#m>this.maxlength)}get#s(){return!this.disabled&&!this.validity?.valid&&this.isReportValidityOrSubmit}#u(t){this.value="",this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),this.#e.value?.focus(),t.stopPropagation()}#r(){this.isBlurring=!0,this.reportValidity(),this.isBlurring=!1,this.hasFocus=!1}#l(){this.#e.value?.value&&(this.value=this.#e.value?.value),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}#o(){this.hasFocus=!0}#n(){this.#e.value&&(this.value=this.#e.value.value)}#d(t){"Enter"===t.key&&this.form?.requestSubmit()}#y(){this.passwordVisible=!this.passwordVisible}};__decorate([property({reflect:!0}),required],Input.prototype,"label",void 0),__decorate([property({reflect:!0,useDefault:!0})],Input.prototype,"autocapitalize",void 0),__decorate([property({reflect:!0,useDefault:!0})],Input.prototype,"autocomplete",void 0),__decorate([property({reflect:!0,type:Boolean})],Input.prototype,"clearable",void 0),__decorate([property({reflect:!0,type:Boolean})],Input.prototype,"disabled",void 0),__decorate([property({attribute:"hide-label",reflect:!0,type:Boolean})],Input.prototype,"hideLabel",void 0),__decorate([property({type:Number,converter:t=>t&&Number.parseInt(t,10),reflect:!0})],Input.prototype,"maxlength",void 0),__decorate([property({reflect:!0,useDefault:!0})],Input.prototype,"name",void 0),__decorate([property({reflect:!0,useDefault:!0})],Input.prototype,"orientation",void 0),__decorate([property({attribute:"password-toggle",reflect:!0,type:Boolean})],Input.prototype,"passwordToggle",void 0),__decorate([property({reflect:!0})],Input.prototype,"placeholder",void 0),__decorate([property({reflect:!0,useDefault:!0})],Input.prototype,"pattern",void 0),__decorate([property()],Input.prototype,"privateSplit",void 0),__decorate([property({reflect:!0,type:Boolean})],Input.prototype,"readonly",void 0),__decorate([property({reflect:!0,type:Boolean})],Input.prototype,"required",void 0),__decorate([property({reflect:!0,type:Boolean,useDefault:!0})],Input.prototype,"spellcheck",void 0),__decorate([property({reflect:!0})],Input.prototype,"tooltip",void 0),__decorate([property({reflect:!0,useDefault:!0})],Input.prototype,"type",void 0),__decorate([property()],Input.prototype,"value",void 0),__decorate([property({reflect:!0})],Input.prototype,"version",void 0),__decorate([state()],Input.prototype,"hasFocus",void 0),__decorate([state()],Input.prototype,"isBlurring",void 0),__decorate([state()],Input.prototype,"isCheckingValidity",void 0),__decorate([state()],Input.prototype,"isReportValidityOrSubmit",void 0),__decorate([state()],Input.prototype,"passwordVisible",void 0),__decorate([state()],Input.prototype,"validityMessage",void 0),Input=__decorate([customElement("glide-core-input"),final],Input);export default Input;const icons={eye:html`<svg
|
122
122
|
aria-hidden="true"
|
123
123
|
style=${styleMap({height:"1rem",width:"1rem"})}
|
124
124
|
fill="none"
|
package/dist/input.styles.js
CHANGED
@@ -42,17 +42,19 @@ import{css}from"lit";import visuallyHidden from"./styles/visually-hidden.js";exp
|
|
42
42
|
display: flex;
|
43
43
|
min-inline-size: 3.75rem;
|
44
44
|
padding-inline: var(--glide-core-spacing-base-sm);
|
45
|
+
transition: border-color 200ms ease-in-out;
|
45
46
|
|
46
|
-
&.focused
|
47
|
-
&:has(.input:hover) {
|
47
|
+
&.focused {
|
48
48
|
border-color: var(--glide-core-color-interactive-stroke-focus);
|
49
|
-
transition: border-color 200ms ease-in-out;
|
50
49
|
}
|
51
50
|
|
52
|
-
&:
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
&:not(.disabled, .error, .readonly) {
|
52
|
+
&:hover,
|
53
|
+
&:has(.input:hover) {
|
54
|
+
border-color: var(
|
55
|
+
--glide-core-color-interactive-stroke-primary--hover
|
56
|
+
);
|
57
|
+
}
|
56
58
|
}
|
57
59
|
|
58
60
|
&.error {
|
package/dist/label.d.ts
CHANGED
@@ -2,7 +2,7 @@ import './tooltip.js';
|
|
2
2
|
import { LitElement } from 'lit';
|
3
3
|
declare global {
|
4
4
|
interface HTMLElementTagNameMap {
|
5
|
-
'glide-core-private-label':
|
5
|
+
'glide-core-private-label': Label;
|
6
6
|
}
|
7
7
|
}
|
8
8
|
/**
|
@@ -20,7 +20,7 @@ declare global {
|
|
20
20
|
* @slot {Element | string} [description] - Additional information or context
|
21
21
|
* @slot {Element | string} [summary] - Additional information or context
|
22
22
|
*/
|
23
|
-
export default class
|
23
|
+
export default class Label extends LitElement {
|
24
24
|
#private;
|
25
25
|
static shadowRootOptions: ShadowRootInit;
|
26
26
|
static styles: import("lit").CSSResult[];
|
package/dist/label.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __decorate=this&&this.__decorate||function(e,
|
1
|
+
var __decorate=this&&this.__decorate||function(t,e,o,i){var l,r=arguments.length,s=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,o,i);else for(var a=t.length-1;a>=0;a--)(l=t[a])&&(s=(r<3?l(s):r>3?l(e,o,s):l(e,o))||s);return r>3&&s&&Object.defineProperty(e,o,s),s};import"./tooltip.js";import{html,LitElement}from"lit";import{classMap}from"lit/directives/class-map.js";import{createRef,ref}from"lit/directives/ref.js";import{customElement,property,state}from"lit/decorators.js";import{styleMap}from"lit/directives/style-map.js";import{ifDefined}from"lit/directives/if-defined.js";import{when}from"lit/directives/when.js";import styles from"./label.styles.js";import{LocalizeController}from"./library/localize.js";import assertSlot from"./library/assert-slot.js";import onResize from"./library/on-resize.js";import shadowRootMode from"./library/shadow-root-mode.js";import final from"./library/final.js";let Label=class Label extends LitElement{constructor(){super(...arguments),this.disabled=!1,this.error=!1,this.hide=!1,this.orientation="horizontal",this.required=!1,this.hasDescription=!1,this.hasSummarySlot=!1,this.isLabelTooltip=!1,this.#t=createRef(),this.#e=createRef(),this.#o=createRef(),this.#i=new LocalizeController(this),this.#l=createRef()}static{this.shadowRootOptions={...LitElement.shadowRootOptions,mode:shadowRootMode}}static{this.styles=styles}render(){return html`<div class="${classMap({component:!0,horizontal:"horizontal"===this.orientation,vertical:"vertical"===this.orientation,left:"left"===this.split,middle:"middle"===this.split,right:"right"===this.split,"hidden-label":this.hide})}"><div class="${classMap({tooltips:!0,hidden:this.hide,left:"left"===this.split,middle:"middle"===this.split,right:"right"===this.split})}" part="private-tooltips">${when(this.tooltip,(()=>html`<glide-core-tooltip class="${classMap({"optional-tooltip":!0,vertical:"vertical"===this.orientation,visible:!!this.tooltip})}" label="${ifDefined(this.tooltip)}" placement="${"vertical"===this.orientation?"right":"bottom"}"><button aria-label="${this.#i.term("tooltip")}" class="optional-tooltip-target" slot="target" type="button">${icons.information}</button></glide-core-tooltip>`))}<glide-core-tooltip class="label-tooltip" data-test="label-tooltip" label="${this.label??""}" placement="right" ?disabled="${!this.isLabelTooltip}" screenreader-hidden><div class="${classMap({label:!0,disabled:this.disabled})}" data-test="label" slot="target" @mouseover="${this.#r}" ${ref(this.#o)}><slot ${assertSlot()} ${ref(this.#t)}></slot></div></glide-core-tooltip>${this.required?html`<span aria-hidden="true" class="required-symbol" data-test="required-symbol">*</span>`:""}</div><div class="control-and-summary" part="private-control-and-summary"><slot class="${classMap({control:!0,error:this.error,disabled:this.disabled,vertical:"vertical"===this.orientation,summaryless:!this.hasSummarySlot,"hidden-label":this.hide})}" name="control" ${assertSlot()}></slot><slot class="${classMap({summary:!0,error:this.error})}" name="summary" @slotchange="${this.#s}" ${ref(this.#l)}></slot></div><slot class="${classMap({description:!0,content:this.hasDescription,error:this.error,tooltip:!!this.tooltip})}" id="description" name="description" ${onResize(this.#a.bind(this))} ${ref(this.#e)}></slot></div>`}#t;#e;#o;#i;#l;#a(){this.hasDescription=Boolean(this.#e.value&&this.#e.value.offsetHeight>0)}#r(){const t=this.#t.value?.assignedElements().at(0);t&&this.#o.value&&(this.isLabelTooltip=t.getBoundingClientRect().width>this.#o.value.getBoundingClientRect().width)}#s(){const t=this.#l.value?.assignedNodes({flatten:!0});this.hasSummarySlot=Boolean(t&&t.length>0)}};__decorate([property({reflect:!0,type:Boolean})],Label.prototype,"disabled",void 0),__decorate([property({reflect:!0,type:Boolean})],Label.prototype,"error",void 0),__decorate([property({reflect:!0,type:Boolean})],Label.prototype,"hide",void 0),__decorate([property({reflect:!0,useDefault:!0})],Label.prototype,"orientation",void 0),__decorate([property({reflect:!0,type:Boolean})],Label.prototype,"required",void 0),__decorate([property()],Label.prototype,"split",void 0),__decorate([property()],Label.prototype,"tooltip",void 0),__decorate([property()],Label.prototype,"label",void 0),__decorate([state()],Label.prototype,"hasDescription",void 0),__decorate([state()],Label.prototype,"hasSummarySlot",void 0),__decorate([state()],Label.prototype,"isLabelTooltip",void 0),Label=__decorate([customElement("glide-core-private-label"),final],Label);export default Label;const icons={information:html`<svg aria-hidden="true" style="${styleMap({height:"1rem",width:"1rem"})}" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="2"/><path d="M12 16L12 12" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="12" cy="8" r="1" fill="currentColor"/></svg>`};
|
package/dist/label.styles.js
CHANGED
@@ -38,7 +38,7 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
38
38
|
|
39
39
|
.tooltips {
|
40
40
|
align-items: center;
|
41
|
-
column-gap: var(--glide-core-spacing-base-
|
41
|
+
column-gap: var(--glide-core-spacing-base-xxs);
|
42
42
|
display: flex;
|
43
43
|
|
44
44
|
/*
|
@@ -129,6 +129,10 @@ import{css}from"lit";import focusOutline from"./styles/focus-outline.js";import
|
|
129
129
|
|
130
130
|
.required-symbol {
|
131
131
|
color: var(--glide-core-color-advisory-stroke-error-primary);
|
132
|
+
font-family: var(--glide-core-typography-family-primary);
|
133
|
+
font-size: var(--glide-core-typography-size-body-default);
|
134
|
+
font-weight: var(--glide-core-typography-weight-bold);
|
135
|
+
line-height: 100%;
|
132
136
|
}
|
133
137
|
|
134
138
|
.control-and-summary {
|
@@ -10,7 +10,7 @@ declare class AssertSlot extends Directive {
|
|
10
10
|
}
|
11
11
|
/**
|
12
12
|
* @param {(Element | Text)[] | null } nodes - An array of node constructors allowed in the slot or `null` is any constructor is allowed
|
13
|
-
* @param {boolean} [isOptional] - `false` by default. Set
|
13
|
+
* @param {boolean} [isOptional] - `false` by default. Set to `true` if the slot is optional
|
14
14
|
*/
|
15
15
|
declare const _default: (slotted?: ({
|
16
16
|
new (): Element;
|