@getflip/swirl-components 0.87.5 → 0.88.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.
- package/components.json +25 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-app-layout_7.cjs.entry.js +76 -1
- package/dist/cjs/swirl-button.cjs.entry.js +4 -7
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-description-list-item.cjs.entry.js +1 -1
- package/dist/cjs/swirl-description-list.cjs.entry.js +1 -1
- package/dist/cjs/swirl-form-control.cjs.entry.js +4 -2
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/collection/components/swirl-button/swirl-button.css +19 -1
- package/dist/collection/components/swirl-button/swirl-button.js +20 -9
- package/dist/collection/components/swirl-description-list/swirl-description-list.js +1 -1
- package/dist/collection/components/swirl-description-list/swirl-description-list.spec.js +2 -2
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.js +1 -1
- package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.spec.js +5 -5
- package/dist/collection/components/swirl-form-control/swirl-form-control.css +91 -0
- package/dist/collection/components/swirl-form-control/swirl-form-control.js +4 -1
- package/dist/collection/components/swirl-form-control/swirl-form-control.spec.js +11 -8
- package/dist/collection/components/swirl-form-control/swirl-form-control.stories.js +6 -0
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +3 -1
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.spec.js +3 -2
- package/dist/components/assets/pdfjs/pdf.worker.min.js +0 -22
- package/dist/components/swirl-button2.js +5 -7
- package/dist/components/swirl-description-list-item.js +1 -1
- package/dist/components/swirl-description-list.js +1 -1
- package/dist/components/swirl-form-control.js +4 -2
- package/dist/components/swirl-resource-list-item2.js +76 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-app-layout_7.entry.js +76 -1
- package/dist/esm/swirl-button.entry.js +4 -7
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-description-list-item.entry.js +1 -1
- package/dist/esm/swirl-description-list.entry.js +1 -1
- package/dist/esm/swirl-form-control.entry.js +4 -2
- package/dist/swirl-components/p-31eb71e2.entry.js +1 -0
- package/dist/swirl-components/{p-c8870a5b.entry.js → p-447c92f7.entry.js} +1 -1
- package/dist/swirl-components/p-bebc9b0b.entry.js +1 -0
- package/dist/swirl-components/p-d82144bc.entry.js +1 -0
- package/dist/swirl-components/p-d8b37fe9.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-button/swirl-button.d.ts +1 -1
- package/dist/types/components/swirl-form-control/swirl-form-control.d.ts +1 -0
- package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/package.json +1 -1
- package/vscode-data.json +4 -0
- package/dist/swirl-components/p-34dcadc5.entry.js +0 -1
- package/dist/swirl-components/p-6131ad72.entry.js +0 -1
- package/dist/swirl-components/p-6cf1cf56.entry.js +0 -1
- package/dist/swirl-components/p-8153cd85.entry.js +0 -1
|
@@ -90,6 +90,14 @@
|
|
|
90
90
|
color: var(--s-icon-critical);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
.button--variant-ghost.button--pressed {
|
|
94
|
+
color: var(--s-text-highlight);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.button--variant-ghost.button--pressed .button__icon {
|
|
98
|
+
color: var(--s-icon-highlight);
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
.button--variant-ghost.button--size-l {
|
|
94
102
|
padding: var(--s-space-12) var(--s-space-20);
|
|
95
103
|
}
|
|
@@ -156,6 +164,16 @@
|
|
|
156
164
|
color: var(--s-icon-critical);
|
|
157
165
|
}
|
|
158
166
|
|
|
167
|
+
.button--variant-outline.button--pressed {
|
|
168
|
+
box-shadow: inset 0 0 0 var(--s-border-width-default)
|
|
169
|
+
var(--s-border-highlight);
|
|
170
|
+
color: var(--s-text-highlight);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.button--variant-outline.button--pressed .button__icon {
|
|
174
|
+
color: var(--s-icon-highlight);
|
|
175
|
+
}
|
|
176
|
+
|
|
159
177
|
.button--variant-outline.button--size-l {
|
|
160
178
|
padding: var(--s-space-12) var(--s-space-20);
|
|
161
179
|
}
|
|
@@ -165,7 +183,7 @@
|
|
|
165
183
|
}
|
|
166
184
|
|
|
167
185
|
.button--variant-outline .button__icon {
|
|
168
|
-
color: var(--s-icon-
|
|
186
|
+
color: var(--s-icon-strong);
|
|
169
187
|
}
|
|
170
188
|
|
|
171
189
|
.button--variant-plain {
|
|
@@ -23,6 +23,7 @@ export class SwirlButton {
|
|
|
23
23
|
this.label = undefined;
|
|
24
24
|
this.name = undefined;
|
|
25
25
|
this.pill = undefined;
|
|
26
|
+
this.pressed = undefined;
|
|
26
27
|
this.size = "m";
|
|
27
28
|
this.target = undefined;
|
|
28
29
|
this.type = "button";
|
|
@@ -36,8 +37,6 @@ export class SwirlButton {
|
|
|
36
37
|
}
|
|
37
38
|
componentDidRender() {
|
|
38
39
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
39
|
-
}
|
|
40
|
-
watchFormProp() {
|
|
41
40
|
this.updateFormAttribute();
|
|
42
41
|
}
|
|
43
42
|
disconnectedCallback() {
|
|
@@ -78,9 +77,10 @@ export class SwirlButton {
|
|
|
78
77
|
const className = classnames("button", `button--icon-position-${this.iconPosition}`, `button--intent-${this.intent}`, `button--size-${this.size}`, `button--variant-${this.variant}`, {
|
|
79
78
|
"button--icon-only": hideLabel,
|
|
80
79
|
"button--pill": this.pill,
|
|
80
|
+
"button--pressed": this.pressed,
|
|
81
81
|
});
|
|
82
82
|
const Tag = isLink ? "a" : "button";
|
|
83
|
-
return (h(Host, { style: { pointerEvents: this.disabled ? "none" : "" } }, h(Tag, { "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled && !isLink ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-haspopup": this.swirlAriaHaspopup, "aria-label": ariaLabel, class: className, disabled: isLink ? undefined : this.disabled, download: isLink ? undefined : this.download, form: isLink ? undefined : this.form, href: this.href, name: isLink ? undefined : this.name, ref: (el) => (this.buttonEl = el), target: isLink ? this.target : undefined, type: isLink ? undefined : this.type, value: isLink ? undefined : this.value }, this.icon && (h("span", { class: "button__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), !hideLabel && h("span", { class: "button__label" }, this.label))));
|
|
83
|
+
return (h(Host, { style: { pointerEvents: this.disabled ? "none" : "" } }, h(Tag, { "aria-controls": this.swirlAriaControls, "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled && !isLink ? "true" : undefined, "aria-expanded": this.swirlAriaExpanded, "aria-haspopup": this.swirlAriaHaspopup, "aria-label": ariaLabel, "aria-pressed": this.pressed ? "true" : undefined, class: className, disabled: isLink ? undefined : this.disabled, download: isLink ? undefined : this.download, form: isLink ? undefined : this.form, href: this.href, name: isLink ? undefined : this.name, ref: (el) => (this.buttonEl = el), target: isLink ? this.target : undefined, type: isLink ? undefined : this.type, value: isLink ? undefined : this.value }, this.icon && (h("span", { class: "button__icon", innerHTML: this.icon, ref: (el) => (this.iconEl = el) })), !hideLabel && h("span", { class: "button__label" }, this.label))));
|
|
84
84
|
}
|
|
85
85
|
static get is() { return "swirl-button"; }
|
|
86
86
|
static get encapsulation() { return "scoped"; }
|
|
@@ -380,6 +380,23 @@ export class SwirlButton {
|
|
|
380
380
|
"attribute": "pill",
|
|
381
381
|
"reflect": false
|
|
382
382
|
},
|
|
383
|
+
"pressed": {
|
|
384
|
+
"type": "boolean",
|
|
385
|
+
"mutable": false,
|
|
386
|
+
"complexType": {
|
|
387
|
+
"original": "boolean",
|
|
388
|
+
"resolved": "boolean",
|
|
389
|
+
"references": {}
|
|
390
|
+
},
|
|
391
|
+
"required": false,
|
|
392
|
+
"optional": true,
|
|
393
|
+
"docs": {
|
|
394
|
+
"tags": [],
|
|
395
|
+
"text": ""
|
|
396
|
+
},
|
|
397
|
+
"attribute": "pressed",
|
|
398
|
+
"reflect": false
|
|
399
|
+
},
|
|
383
400
|
"size": {
|
|
384
401
|
"type": "string",
|
|
385
402
|
"mutable": false,
|
|
@@ -486,10 +503,4 @@ export class SwirlButton {
|
|
|
486
503
|
};
|
|
487
504
|
}
|
|
488
505
|
static get elementRef() { return "el"; }
|
|
489
|
-
static get watchers() {
|
|
490
|
-
return [{
|
|
491
|
-
"propName": "form",
|
|
492
|
-
"methodName": "watchFormProp"
|
|
493
|
-
}];
|
|
494
|
-
}
|
|
495
506
|
}
|
|
@@ -4,7 +4,7 @@ import { h, Host } from "@stencil/core";
|
|
|
4
4
|
*/
|
|
5
5
|
export class SwirlDescriptionList {
|
|
6
6
|
render() {
|
|
7
|
-
return (h(Host, null, h("
|
|
7
|
+
return (h(Host, null, h("div", { class: "description-list", role: "list" }, h("slot", null))));
|
|
8
8
|
}
|
|
9
9
|
static get is() { return "swirl-description-list"; }
|
|
10
10
|
static get encapsulation() { return "shadow"; }
|
|
@@ -16,9 +16,9 @@ describe("swirl-description-list", () => {
|
|
|
16
16
|
expect(page.root).toEqualHtml(`
|
|
17
17
|
<swirl-description-list>
|
|
18
18
|
<mock:shadow-root>
|
|
19
|
-
<
|
|
19
|
+
<div class="description-list" role="list">
|
|
20
20
|
<slot></slot>
|
|
21
|
-
</
|
|
21
|
+
</div>
|
|
22
22
|
</mock:shadow-root>
|
|
23
23
|
<swirl-description-list-item term="Term #1">
|
|
24
24
|
A short description
|
package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.js
CHANGED
|
@@ -11,7 +11,7 @@ export class SwirlDescriptionListItem {
|
|
|
11
11
|
}
|
|
12
12
|
render() {
|
|
13
13
|
const className = classNames("description-list-item", `description-list-item--orientation-${this.orientation}`, { "description-list-item--bordered": this.bordered });
|
|
14
|
-
return (h(Host,
|
|
14
|
+
return (h(Host, { role: "listitem" }, h("div", { class: className, part: "description-list-item", role: "group" }, h("div", { class: "description-list-item__term", part: "description-list-item__term", role: "term" }, this.term), h("div", { class: "description-list-item__description", role: "definition" }, h("slot", null)))));
|
|
15
15
|
}
|
|
16
16
|
static get is() { return "swirl-description-list-item"; }
|
|
17
17
|
static get encapsulation() { return "shadow"; }
|
package/dist/collection/components/swirl-description-list-item/swirl-description-list-item.spec.js
CHANGED
|
@@ -7,13 +7,13 @@ describe("swirl-description-list-item", () => {
|
|
|
7
7
|
html: `<swirl-description-list-item term="Term">Description</swirl-description-list-item>`,
|
|
8
8
|
});
|
|
9
9
|
expect(page.root).toEqualHtml(`
|
|
10
|
-
<swirl-description-list-item term="Term">
|
|
10
|
+
<swirl-description-list-item role="listitem" term="Term">
|
|
11
11
|
<mock:shadow-root>
|
|
12
|
-
<div class="description-list-item description-list-item--bordered description-list-item--orientation-horizontal" part="description-list-item">
|
|
13
|
-
<
|
|
14
|
-
<
|
|
12
|
+
<div class="description-list-item description-list-item--bordered description-list-item--orientation-horizontal" part="description-list-item" role="group">
|
|
13
|
+
<div class="description-list-item__term" part="description-list-item__term" role="term">Term</div>
|
|
14
|
+
<div class="description-list-item__description" role="definition">
|
|
15
15
|
<slot></slot>
|
|
16
|
-
</
|
|
16
|
+
</div>
|
|
17
17
|
</div>
|
|
18
18
|
</mock:shadow-root>
|
|
19
19
|
Description
|
|
@@ -130,6 +130,10 @@
|
|
|
130
130
|
box-shadow: 0 0 0 var(--s-border-width-default) var(--s-border-critical);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
.form-control--invalid .form-control__prefix {
|
|
134
|
+
border-color: var(--s-border-critical);
|
|
135
|
+
}
|
|
136
|
+
|
|
133
137
|
.form-control--invalid .form-control__label {
|
|
134
138
|
border-color: var(--s-border-critical);
|
|
135
139
|
}
|
|
@@ -181,6 +185,46 @@
|
|
|
181
185
|
clip: rect(0, 0, 0, 0);
|
|
182
186
|
}
|
|
183
187
|
|
|
188
|
+
.form-control--has-prefix.form-control--label-position-outside .form-control__label {
|
|
189
|
+
position: static;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.form-control--has-prefix.form-control--has-focus:not(.form-control--disabled).form-control--invalid .form-control__label {
|
|
193
|
+
border-left-color: transparent;
|
|
194
|
+
box-shadow: 0 0 0 var(--s-border-width-default) var(--s-border-critical);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.form-control--has-prefix.form-control--has-focus:not(.form-control--disabled).form-control--invalid .form-control__prefix {
|
|
198
|
+
border-color: var(--s-border-critical);
|
|
199
|
+
box-shadow: 0 0 0 var(--s-border-width-default) var(--s-border-critical);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.form-control--has-prefix.form-control--has-focus:not(.form-control--disabled) .form-control__label {
|
|
203
|
+
border-left-color: transparent;
|
|
204
|
+
box-shadow: 0 0 0 var(--s-border-width-default) var(--s-border-highlight);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.form-control--has-prefix.form-control--has-focus:not(.form-control--disabled) .form-control__prefix {
|
|
208
|
+
border-color: var(--s-border-highlight);
|
|
209
|
+
border-right-color: transparent;
|
|
210
|
+
box-shadow: 0 0 0 var(--s-border-width-default) var(--s-border-highlight);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.form-control--has-prefix .form-control__label {
|
|
214
|
+
border-top-left-radius: 0;
|
|
215
|
+
border-bottom-left-radius: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.form-control--has-prefix .form-control__prefix {
|
|
219
|
+
display: flex;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.form-control__controls {
|
|
223
|
+
position: relative;
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: stretch;
|
|
226
|
+
}
|
|
227
|
+
|
|
184
228
|
.form-control__label {
|
|
185
229
|
position: relative;
|
|
186
230
|
display: flex;
|
|
@@ -208,6 +252,53 @@
|
|
|
208
252
|
transform: none;
|
|
209
253
|
}
|
|
210
254
|
|
|
255
|
+
.form-control__prefix {
|
|
256
|
+
z-index: 1;
|
|
257
|
+
display: none;
|
|
258
|
+
padding-right: var(--s-space-16);
|
|
259
|
+
padding-left: var(--s-space-16);
|
|
260
|
+
justify-content: center;
|
|
261
|
+
align-items: center;
|
|
262
|
+
border-top: var(--s-border-width-default) solid var(--s-border-strong);
|
|
263
|
+
border-bottom: var(--s-border-width-default) solid var(--s-border-strong);
|
|
264
|
+
border-left: var(--s-border-width-default) solid var(--s-border-strong);
|
|
265
|
+
border-top-left-radius: var(--s-border-radius-sm);
|
|
266
|
+
border-bottom-left-radius: var(--s-border-radius-sm);
|
|
267
|
+
background-color: var(--s-surface-raised-default);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.form-control__prefix::slotted(select) {
|
|
271
|
+
height: 100%;
|
|
272
|
+
margin-right: calc(-1 * var(--s-space-16));
|
|
273
|
+
margin-left: calc(-1 * var(--s-space-16));
|
|
274
|
+
padding-right: calc(var(--s-space-16) + 1.25rem);
|
|
275
|
+
padding-left: var(--s-space-16);
|
|
276
|
+
border: none;
|
|
277
|
+
color: var(--s-text-default);
|
|
278
|
+
background: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 12.4579C9.88889 12.4579 9.78472 12.4404 9.6875 12.4054C9.59027 12.3709 9.5 12.312 9.41666 12.2287L5.5625 8.37453C5.40972 8.22175 5.33694 8.03064 5.34416 7.8012C5.35083 7.57231 5.43055 7.38148 5.58333 7.2287C5.73611 7.07592 5.93055 6.99953 6.16666 6.99953C6.40277 6.99953 6.59722 7.07592 6.75 7.2287L10 10.4787L13.2708 7.20787C13.4236 7.05509 13.6147 6.98203 13.8442 6.9887C14.0731 6.99592 14.2639 7.07592 14.4167 7.2287C14.5694 7.38148 14.6458 7.57592 14.6458 7.81203C14.6458 8.04814 14.5694 8.24259 14.4167 8.39537L10.5833 12.2287C10.5 12.312 10.4097 12.3709 10.3125 12.4054C10.2153 12.4404 10.1111 12.4579 10 12.4579Z" fill="%236E6E6E"/></svg>');
|
|
279
|
+
background-color: transparent;
|
|
280
|
+
background-repeat: no-repeat;
|
|
281
|
+
background-position: right var(--s-space-8) center;
|
|
282
|
+
font: inherit;
|
|
283
|
+
line-height: var(--s-line-height-base);
|
|
284
|
+
cursor: pointer;
|
|
285
|
+
-webkit-appearance: none;
|
|
286
|
+
-moz-appearance: none;
|
|
287
|
+
appearance: none;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.form-control__prefix::slotted(select):focus {
|
|
291
|
+
outline: none;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px) {
|
|
295
|
+
|
|
296
|
+
.form-control__prefix::slotted(select) {
|
|
297
|
+
font-size: var(--s-font-size-sm);
|
|
298
|
+
line-height: var(--s-line-height-sm)
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
211
302
|
.form-control__description {
|
|
212
303
|
display: block;
|
|
213
304
|
margin-top: var(--s-space-4);
|
|
@@ -3,6 +3,7 @@ import classnames from "classnames";
|
|
|
3
3
|
import { getActiveElement } from "../../utils";
|
|
4
4
|
/**
|
|
5
5
|
* @slot slot - The input element, e.g. `<swirl-text-input></swirl-text-input>`
|
|
6
|
+
* @slot prefix - The prefix element, e.g. `<select slot="prefix">…</select>` or `<swirl-icon-poll></swirl-icon-poll>`
|
|
6
7
|
*/
|
|
7
8
|
export class SwirlFormControl {
|
|
8
9
|
constructor() {
|
|
@@ -108,6 +109,7 @@ export class SwirlFormControl {
|
|
|
108
109
|
render() {
|
|
109
110
|
const showErrorMessage = Boolean(this.errorMessage);
|
|
110
111
|
const showDescription = Boolean(this.description) && !showErrorMessage;
|
|
112
|
+
const hasPrefix = Boolean(this.el.querySelector('[slot="prefix"]'));
|
|
111
113
|
const hasValue = Array.isArray(this.inputValue)
|
|
112
114
|
? this.inputValue.length > 0
|
|
113
115
|
: Boolean(this.inputValue);
|
|
@@ -119,13 +121,14 @@ export class SwirlFormControl {
|
|
|
119
121
|
"form-control--has-character-counter": hasCharacterCounter,
|
|
120
122
|
"form-control--has-focus": this.hasFocus,
|
|
121
123
|
"form-control--has-placeholder": hasPlaceholder,
|
|
124
|
+
"form-control--has-prefix": hasPrefix,
|
|
122
125
|
"form-control--has-value": hasValue,
|
|
123
126
|
"form-control--hide-label": this.hideLabel,
|
|
124
127
|
"form-control--inline": this.inline,
|
|
125
128
|
"form-control--invalid": this.invalid,
|
|
126
129
|
"form-control--is-select": isSelect,
|
|
127
130
|
});
|
|
128
|
-
return (h(Host, { onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { class: className, role: "group" }, h("label", { class: "form-control__label" }, h("span", { class: "form-control__label-text" }, this.label), h("span", { class: "form-control__input" }, h("slot", null))), showDescription && (h("span", { class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { message: this.errorMessage, size: "s" }))))));
|
|
131
|
+
return (h(Host, { onFocusin: this.onFocusIn, onFocusout: this.onFocusOut, onKeyDown: this.onKeyDown }, h("div", { class: className, role: "group" }, h("span", { class: "form-control__controls" }, h("span", { class: "form-control__prefix" }, h("slot", { name: "prefix" })), h("label", { class: "form-control__label" }, h("span", { class: "form-control__label-text" }, this.label), h("span", { class: "form-control__input" }, h("slot", null)))), showDescription && (h("span", { class: "form-control__description", id: this.descriptionId }, this.description)), showErrorMessage && (h("span", { "aria-live": "polite", class: "form-control__error-message", id: this.descriptionId }, h("swirl-inline-error", { message: this.errorMessage, size: "s" }))))));
|
|
129
132
|
}
|
|
130
133
|
static get is() { return "swirl-form-control"; }
|
|
131
134
|
static get encapsulation() { return "scoped"; }
|
|
@@ -13,14 +13,17 @@ describe("swirl-form-control", () => {
|
|
|
13
13
|
expect(page.root).toEqualHtml(`
|
|
14
14
|
<swirl-form-control label="Label">
|
|
15
15
|
<div class="form-control form-control--label-position-inside" role="group">
|
|
16
|
-
<
|
|
17
|
-
<span class="form-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
<span class="form-control__controls">
|
|
17
|
+
<span class="form-control__prefix"></span>
|
|
18
|
+
<label class="form-control__label">
|
|
19
|
+
<span class="form-control__label-text">
|
|
20
|
+
Label
|
|
21
|
+
</span>
|
|
22
|
+
<span class="form-control__input">
|
|
23
|
+
<swirl-text-input label="Label"></swirl-text-input>
|
|
24
|
+
</span>
|
|
25
|
+
</label>
|
|
26
|
+
</span>
|
|
24
27
|
</div>
|
|
25
28
|
</swirl-form-control>
|
|
26
29
|
`);
|
|
@@ -16,6 +16,12 @@ const Template = (args) => {
|
|
|
16
16
|
const textInput = generateStoryElement("swirl-form-control", args);
|
|
17
17
|
textInput.innerHTML = `
|
|
18
18
|
<swirl-text-input clearable="true" type="text"></swirl-text-input>
|
|
19
|
+
<select slot="prefix">
|
|
20
|
+
<option>CH</option>
|
|
21
|
+
<option selected>DE</option>
|
|
22
|
+
<option>EN</option>
|
|
23
|
+
<option>FR</option>
|
|
24
|
+
</select>
|
|
19
25
|
`;
|
|
20
26
|
const numberInput = generateStoryElement("swirl-form-control", {
|
|
21
27
|
...args,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { h, Host, } from "@stencil/core";
|
|
2
2
|
import classnames from "classnames";
|
|
3
3
|
import { getDesktopMediaQuery } from "../../utils";
|
|
4
|
+
import { v4 as uuid } from "uuid";
|
|
4
5
|
/**
|
|
5
6
|
* @slot control - Used to add a menu button to the item
|
|
6
7
|
* @slot badges - Badges displayed inside the item
|
|
@@ -9,6 +10,7 @@ import { getDesktopMediaQuery } from "../../utils";
|
|
|
9
10
|
export class SwirlResourceListItem {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.desktopMediaQuery = getDesktopMediaQuery();
|
|
13
|
+
this.id = uuid();
|
|
12
14
|
this.desktopMediaQueryHandler = (event) => {
|
|
13
15
|
this.forceIconProps(event.matches);
|
|
14
16
|
this.updateIconSize(event.matches);
|
|
@@ -107,7 +109,7 @@ export class SwirlResourceListItem {
|
|
|
107
109
|
"resource-list-item--selectable": this.selectable,
|
|
108
110
|
"resource-list-item--show-control-on-focus": showControlOnFocus,
|
|
109
111
|
});
|
|
110
|
-
return (h(Host, { role: "row" }, h("div", { class: className, role: "gridcell" }, h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby":
|
|
112
|
+
return (h(Host, { role: "row" }, h("div", { class: className, role: "gridcell" }, h(Tag, { "aria-checked": ariaChecked, "aria-disabled": disabled ? "true" : undefined, "aria-labelledby": this.id, class: "resource-list-item__content", href: href, disabled: disabled, onClick: this.onClick, part: "resource-list-item__content", role: role, tabIndex: 0 }, this.hasMedia && (h("span", { class: "resource-list-item__media" }, h("slot", { name: "media" }))), h("span", { class: "resource-list-item__label-container" }, h("span", { class: "resource-list-item__label", id: this.id, innerHTML: this.label }), this.description && (h("span", { class: "resource-list-item__description" }, this.description))), showMeta && (h("span", { class: "resource-list-item__meta" }, h("span", { class: "resource-list-item__meta-text" }, this.meta), h("span", { class: "resource-list-item__badges" }, h("slot", { name: "badges" }))))), this.selectable && (h("span", { "aria-hidden": "true", class: "resource-list-item__checkbox" }, h("span", { class: "resource-list-item__checkbox-icon" }, this.checked && (h("swirl-icon-check-strong", null))))), h("span", { class: "resource-list-item__control" }, h("slot", { name: "control" })), showMenu && (h("swirl-popover-trigger", { popover: this.menuTriggerId }, h("swirl-button", { "aria-disabled": disabled ? "true" : undefined, class: "resource-list-item__menu-trigger", disabled: disabled, hideLabel: true, icon: "<swirl-icon-more-horizontal></swirl-icon-more-horizontal>", intent: "primary", label: this.menuTriggerLabel, onClick: this.onMenuTriggerClick })))), this.allowDrag && (h("button", { "aria-describedby": this.dragHandleDescription, "aria-label": `${this.dragHandleLabel} "${this.label}"`, class: "resource-list-item__drag-handle", onKeyDown: this.onDragHandleKeyDown, type: "button" }, h("swirl-icon-drag-handle", { size: this.iconSize })))));
|
|
111
113
|
}
|
|
112
114
|
static get is() { return "swirl-resource-list-item"; }
|
|
113
115
|
static get encapsulation() { return "scoped"; }
|
package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.spec.js
CHANGED
|
@@ -13,15 +13,16 @@ describe("swirl-resource-list-item", () => {
|
|
|
13
13
|
</swirl-resource-list-item>
|
|
14
14
|
`,
|
|
15
15
|
});
|
|
16
|
+
const id = page.root.querySelector("[id]").id;
|
|
16
17
|
expect(page.root).toEqualHtml(`
|
|
17
18
|
<swirl-resource-list-item description="Description" label="Label" role="row">
|
|
18
19
|
<div class="resource-list-item resource-list-item--interactive resource-list-item--label-weight-medium" role="gridcell">
|
|
19
|
-
<button aria-labelledby="
|
|
20
|
+
<button aria-labelledby="${id}" class="resource-list-item__content" part="resource-list-item__content" tabindex="0">
|
|
20
21
|
<span class="resource-list-item__media">
|
|
21
22
|
<swirl-avatar label="John Doe" src="https://picsum.photos/id/433/144/144" slot="media"></swirl-avatar>
|
|
22
23
|
</span>
|
|
23
24
|
<span class="resource-list-item__label-container">
|
|
24
|
-
<span class="resource-list-item__label" id="
|
|
25
|
+
<span class="resource-list-item__label" id="${id}">
|
|
25
26
|
Label
|
|
26
27
|
</span>
|
|
27
28
|
<span class="resource-list-item__description">
|