@getflip/swirl-components 0.81.2 → 0.81.4
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 +7 -2
- package/dist/cjs/swirl-date-input.cjs.entry.js +7 -1
- package/dist/cjs/swirl-modal.cjs.entry.js +5 -0
- package/dist/cjs/swirl-search.cjs.entry.js +6 -0
- package/dist/cjs/swirl-select.cjs.entry.js +1 -1
- package/dist/cjs/swirl-tag.cjs.entry.js +1 -1
- package/dist/cjs/swirl-text-input.cjs.entry.js +6 -0
- package/dist/cjs/swirl-time-input.cjs.entry.js +7 -1
- package/dist/collection/components/swirl-date-input/swirl-date-input.js +7 -1
- package/dist/collection/components/swirl-modal/swirl-modal.js +5 -0
- package/dist/collection/components/swirl-modal/swirl-modal.stories.js +1 -1
- package/dist/collection/components/swirl-search/swirl-search.js +6 -0
- package/dist/collection/components/swirl-select/swirl-select.css +7 -2
- package/dist/collection/components/swirl-tag/swirl-tag.js +1 -1
- package/dist/collection/components/swirl-tag/swirl-tag.spec.js +1 -1
- package/dist/collection/components/swirl-text-input/swirl-text-input.js +6 -0
- package/dist/collection/components/swirl-text-input/swirl-text-input.spec.js +1 -4
- package/dist/collection/components/swirl-time-input/swirl-time-input.js +7 -1
- package/dist/components/swirl-date-input.js +7 -1
- package/dist/components/swirl-modal.js +5 -0
- package/dist/components/swirl-search.js +6 -0
- package/dist/components/swirl-select.js +1 -1
- package/dist/components/swirl-tag2.js +1 -1
- package/dist/components/swirl-text-input2.js +6 -0
- package/dist/components/swirl-time-input.js +7 -1
- package/dist/esm/swirl-date-input.entry.js +7 -1
- package/dist/esm/swirl-modal.entry.js +5 -0
- package/dist/esm/swirl-search.entry.js +6 -0
- package/dist/esm/swirl-select.entry.js +1 -1
- package/dist/esm/swirl-tag.entry.js +1 -1
- package/dist/esm/swirl-text-input.entry.js +6 -0
- package/dist/esm/swirl-time-input.entry.js +7 -1
- package/dist/swirl-components/{p-a7568135.entry.js → p-1181ed47.entry.js} +3 -3
- package/dist/swirl-components/p-58cce5bc.entry.js +1 -0
- package/dist/swirl-components/{p-3abcd491.entry.js → p-75a0a157.entry.js} +1 -1
- package/dist/swirl-components/p-8570aa37.entry.js +1 -0
- package/dist/swirl-components/p-888c8874.entry.js +1 -0
- package/dist/swirl-components/p-95b5a85e.entry.js +1 -0
- package/dist/swirl-components/p-d5c14ee5.entry.js +1 -0
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-date-input/swirl-date-input.d.ts +1 -0
- package/dist/types/components/swirl-modal/swirl-modal.d.ts +1 -0
- package/dist/types/components/swirl-time-input/swirl-time-input.d.ts +1 -0
- package/package.json +1 -1
- package/dist/swirl-components/p-251884ec.entry.js +0 -1
- package/dist/swirl-components/p-2d5438ae.entry.js +0 -1
- package/dist/swirl-components/p-67770da3.entry.js +0 -1
- package/dist/swirl-components/p-86e6482b.entry.js +0 -1
- package/dist/swirl-components/p-9d9427ab.entry.js +0 -1
package/components.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2023-08-
|
|
2
|
+
"timestamp": "2023-08-04T09:48:36",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "3.3.1",
|
|
@@ -23686,7 +23686,12 @@
|
|
|
23686
23686
|
"listeners": [],
|
|
23687
23687
|
"styles": [],
|
|
23688
23688
|
"slots": [],
|
|
23689
|
-
"parts": [
|
|
23689
|
+
"parts": [
|
|
23690
|
+
{
|
|
23691
|
+
"name": "tag",
|
|
23692
|
+
"docs": ""
|
|
23693
|
+
}
|
|
23694
|
+
],
|
|
23690
23695
|
"dependents": [
|
|
23691
23696
|
"swirl-select"
|
|
23692
23697
|
],
|
|
@@ -73,6 +73,12 @@ const SwirlDateInput = class {
|
|
|
73
73
|
this.setupMask();
|
|
74
74
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
75
75
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
76
|
+
// see https://stackoverflow.com/a/27314017
|
|
77
|
+
if (this.autoFocus) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
this.inputEl.focus();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
disconnectedCallback() {
|
|
78
84
|
var _a, _b, _c;
|
|
@@ -111,7 +117,7 @@ const SwirlDateInput = class {
|
|
|
111
117
|
const className = index$1.classnames("date-input", {
|
|
112
118
|
"date-input--inline": this.inline,
|
|
113
119
|
});
|
|
114
|
-
return (index.h(index.Host, null, index.h("div", { class: className }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), index.h("swirl-popover-trigger", { popover: `popover-${this.id}` }, index.h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, index.h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (index.h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, index.h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
120
|
+
return (index.h(index.Host, null, index.h("div", { class: className }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), index.h("swirl-popover-trigger", { popover: `popover-${this.id}` }, index.h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, index.h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (index.h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, index.h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
115
121
|
}
|
|
116
122
|
get el() { return index.getElement(this); }
|
|
117
123
|
static get watchers() { return {
|
|
@@ -1236,6 +1236,7 @@ const SwirlModal = class {
|
|
|
1236
1236
|
// wait for animation
|
|
1237
1237
|
setTimeout(() => {
|
|
1238
1238
|
this.focusTrap.activate();
|
|
1239
|
+
this.handleAutoFocus();
|
|
1239
1240
|
}, 200);
|
|
1240
1241
|
}
|
|
1241
1242
|
else {
|
|
@@ -1275,6 +1276,10 @@ const SwirlModal = class {
|
|
|
1275
1276
|
updateHeaderToolsStatus() {
|
|
1276
1277
|
this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
|
|
1277
1278
|
}
|
|
1279
|
+
handleAutoFocus() {
|
|
1280
|
+
var _a;
|
|
1281
|
+
(_a = this.modalEl.querySelector("input[autofocus]")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1282
|
+
}
|
|
1278
1283
|
lockBodyScroll() {
|
|
1279
1284
|
bodyScrollLock_esm.disableBodyScroll(this.scrollContainer);
|
|
1280
1285
|
}
|
|
@@ -49,6 +49,12 @@ const SwirlSearch = class {
|
|
|
49
49
|
componentDidLoad() {
|
|
50
50
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
51
51
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
52
|
+
// see https://stackoverflow.com/a/27314017
|
|
53
|
+
if (this.autoFocus) {
|
|
54
|
+
setTimeout(() => {
|
|
55
|
+
this.input.focus();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
52
58
|
}
|
|
53
59
|
disconnectedCallback() {
|
|
54
60
|
var _a, _b;
|
|
@@ -6,7 +6,7 @@ const index = require('./index-506fe4ea.js');
|
|
|
6
6
|
const index$1 = require('./index-2ddd0598.js');
|
|
7
7
|
const utils = require('./utils-c00c09b9.js');
|
|
8
8
|
|
|
9
|
-
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;visibility:hidden;width:100%;height:100%}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.
|
|
9
|
+
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;visibility:hidden;width:100%;height:100%}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.25rem;margin:0;padding:0;padding-right:calc(1.5rem + var(--s-space-8));border:none;background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:left;white-space:nowrap;text-overflow:ellipsis;cursor:default}.select__input.sc-swirl-select:focus{outline:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__multi-select-values.sc-swirl-select{display:none;overflow:hidden;width:100%;min-height:1.25rem;padding-right:calc(1.5rem + var(--s-space-8));flex-wrap:wrap;gap:var(--s-space-8)}.select__multi-select-values.sc-swirl-select .sc-swirl-select::part(tag){height:1.25rem;padding:0 var(--s-space-4)}.select__indicator.sc-swirl-select{position:absolute;top:50%;right:0;display:inline-flex;color:var(--s-icon-default);transform:translateY(calc(-50% - var(--s-space-8)))}";
|
|
10
10
|
|
|
11
11
|
const SwirlSelect = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -22,7 +22,7 @@ const SwirlTag = class {
|
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
24
|
const className = index$1.classnames("tag", `tag--intent-${this.intent}`);
|
|
25
|
-
return (index.h(index.Host, null, index.h("span", { class: className }, this.label, this.removable && (index.h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, index.h("swirl-icon-close", { size: 16 }))))));
|
|
25
|
+
return (index.h(index.Host, null, index.h("span", { class: className, part: "tag" }, this.label, this.removable && (index.h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, index.h("swirl-icon-close", { size: 16 }))))));
|
|
26
26
|
}
|
|
27
27
|
get el() { return index.getElement(this); }
|
|
28
28
|
};
|
|
@@ -113,6 +113,12 @@ const SwirlTextInput = class {
|
|
|
113
113
|
componentDidLoad() {
|
|
114
114
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
115
115
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
116
|
+
// see https://stackoverflow.com/a/27314017
|
|
117
|
+
if (this.autoFocus) {
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
this.inputEl.focus();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
116
122
|
}
|
|
117
123
|
componentDidRender() {
|
|
118
124
|
this.adjustInputSize();
|
|
@@ -81,6 +81,12 @@ const SwirlTimeInput = class {
|
|
|
81
81
|
this.setupMask();
|
|
82
82
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
83
83
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
84
|
+
// see https://stackoverflow.com/a/27314017
|
|
85
|
+
if (this.autoFocus) {
|
|
86
|
+
setTimeout(() => {
|
|
87
|
+
this.inputEl.focus();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
91
|
disconnectedCallback() {
|
|
86
92
|
var _a, _b, _c;
|
|
@@ -119,7 +125,7 @@ const SwirlTimeInput = class {
|
|
|
119
125
|
const className = index$1.classnames("time-input", {
|
|
120
126
|
"time-input--inline": this.inline,
|
|
121
127
|
});
|
|
122
|
-
return (index.h(index.Host, null, index.h("div", { class: className }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), index.h("span", { class: "time-input__icon" }, index.h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
128
|
+
return (index.h(index.Host, null, index.h("div", { class: className }, index.h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), index.h("span", { class: "time-input__icon" }, index.h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
123
129
|
}
|
|
124
130
|
get el() { return index.getElement(this); }
|
|
125
131
|
static get watchers() { return {
|
|
@@ -65,6 +65,12 @@ export class SwirlDateInput {
|
|
|
65
65
|
this.setupMask();
|
|
66
66
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
67
67
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
68
|
+
// see https://stackoverflow.com/a/27314017
|
|
69
|
+
if (this.autoFocus) {
|
|
70
|
+
setTimeout(() => {
|
|
71
|
+
this.inputEl.focus();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
68
74
|
}
|
|
69
75
|
disconnectedCallback() {
|
|
70
76
|
var _a, _b, _c;
|
|
@@ -103,7 +109,7 @@ export class SwirlDateInput {
|
|
|
103
109
|
const className = classnames("date-input", {
|
|
104
110
|
"date-input--inline": this.inline,
|
|
105
111
|
});
|
|
106
|
-
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { popover: `popover-${this.id}` }, h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
112
|
+
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { popover: `popover-${this.id}` }, h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
107
113
|
}
|
|
108
114
|
static get is() { return "swirl-date-input"; }
|
|
109
115
|
static get encapsulation() { return "scoped"; }
|
|
@@ -89,6 +89,7 @@ export class SwirlModal {
|
|
|
89
89
|
// wait for animation
|
|
90
90
|
setTimeout(() => {
|
|
91
91
|
this.focusTrap.activate();
|
|
92
|
+
this.handleAutoFocus();
|
|
92
93
|
}, 200);
|
|
93
94
|
}
|
|
94
95
|
else {
|
|
@@ -128,6 +129,10 @@ export class SwirlModal {
|
|
|
128
129
|
updateHeaderToolsStatus() {
|
|
129
130
|
this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
|
|
130
131
|
}
|
|
132
|
+
handleAutoFocus() {
|
|
133
|
+
var _a;
|
|
134
|
+
(_a = this.modalEl.querySelector("input[autofocus]")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
135
|
+
}
|
|
131
136
|
lockBodyScroll() {
|
|
132
137
|
disableBodyScroll(this.scrollContainer);
|
|
133
138
|
}
|
|
@@ -50,7 +50,7 @@ const Template = (args) => {
|
|
|
50
50
|
</swirl-text>
|
|
51
51
|
|
|
52
52
|
<swirl-box padding-block-start="0" padding-block-end="16" slot="header-tools">
|
|
53
|
-
<swirl-search label="Search"></swirl-search>
|
|
53
|
+
<swirl-search auto-focus label="Search"></swirl-search>
|
|
54
54
|
</div>
|
|
55
55
|
`;
|
|
56
56
|
container.append(trigger, element);
|
|
@@ -37,6 +37,12 @@ export class SwirlSearch {
|
|
|
37
37
|
componentDidLoad() {
|
|
38
38
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
39
39
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
40
|
+
// see https://stackoverflow.com/a/27314017
|
|
41
|
+
if (this.autoFocus) {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
this.input.focus();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
disconnectedCallback() {
|
|
42
48
|
var _a, _b;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
display: block;
|
|
49
49
|
overflow: hidden;
|
|
50
50
|
width: 100%;
|
|
51
|
-
height: 1.
|
|
51
|
+
height: 1.25rem;
|
|
52
52
|
margin: 0;
|
|
53
53
|
padding: 0;
|
|
54
54
|
padding-right: calc(1.5rem + var(--s-space-8));
|
|
@@ -78,12 +78,17 @@
|
|
|
78
78
|
display: none;
|
|
79
79
|
overflow: hidden;
|
|
80
80
|
width: 100%;
|
|
81
|
-
min-height: 1.
|
|
81
|
+
min-height: 1.25rem;
|
|
82
82
|
padding-right: calc(1.5rem + var(--s-space-8));
|
|
83
83
|
flex-wrap: wrap;
|
|
84
84
|
gap: var(--s-space-8);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
.select__multi-select-values ::part(tag) {
|
|
88
|
+
height: 1.25rem;
|
|
89
|
+
padding: 0 var(--s-space-4);
|
|
90
|
+
}
|
|
91
|
+
|
|
87
92
|
.select__indicator {
|
|
88
93
|
position: absolute;
|
|
89
94
|
top: 50%;
|
|
@@ -13,7 +13,7 @@ export class SwirlTag {
|
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
15
|
const className = classnames("tag", `tag--intent-${this.intent}`);
|
|
16
|
-
return (h(Host, null, h("span", { class: className }, this.label, this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
16
|
+
return (h(Host, null, h("span", { class: className, part: "tag" }, this.label, this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
17
17
|
}
|
|
18
18
|
static get is() { return "swirl-tag"; }
|
|
19
19
|
static get encapsulation() { return "shadow"; }
|
|
@@ -102,6 +102,12 @@ export class SwirlTextInput {
|
|
|
102
102
|
componentDidLoad() {
|
|
103
103
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
104
104
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
105
|
+
// see https://stackoverflow.com/a/27314017
|
|
106
|
+
if (this.autoFocus) {
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
this.inputEl.focus();
|
|
109
|
+
});
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
componentDidRender() {
|
|
107
113
|
this.adjustInputSize();
|
|
@@ -5,7 +5,6 @@ describe("swirl-text-input", () => {
|
|
|
5
5
|
const page = await newSpecPage({
|
|
6
6
|
components: [SwirlTextInput],
|
|
7
7
|
html: `<swirl-text-input
|
|
8
|
-
auto-focus="true"
|
|
9
8
|
disabled="true"
|
|
10
9
|
swirl-aria-describedby="id"
|
|
11
10
|
invalid="true"
|
|
@@ -17,8 +16,7 @@ describe("swirl-text-input", () => {
|
|
|
17
16
|
</swirl-text-input>`,
|
|
18
17
|
});
|
|
19
18
|
expect(page.root).toEqualHtml(`
|
|
20
|
-
<swirl-text-input
|
|
21
|
-
disabled="true"
|
|
19
|
+
<swirl-text-input disabled="true"
|
|
22
20
|
swirl-aria-describedby="id"
|
|
23
21
|
invalid="true"
|
|
24
22
|
mode="decimal"
|
|
@@ -31,7 +29,6 @@ describe("swirl-text-input", () => {
|
|
|
31
29
|
aria-disabled="true"
|
|
32
30
|
aria-invalid="true"
|
|
33
31
|
autocomplete="on"
|
|
34
|
-
autofocus=""
|
|
35
32
|
class="text-input__input"
|
|
36
33
|
disabled=""
|
|
37
34
|
inputmode="decimal"
|
|
@@ -73,6 +73,12 @@ export class SwirlTimeInput {
|
|
|
73
73
|
this.setupMask();
|
|
74
74
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
75
75
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
76
|
+
// see https://stackoverflow.com/a/27314017
|
|
77
|
+
if (this.autoFocus) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
this.inputEl.focus();
|
|
80
|
+
});
|
|
81
|
+
}
|
|
76
82
|
}
|
|
77
83
|
disconnectedCallback() {
|
|
78
84
|
var _a, _b, _c;
|
|
@@ -111,7 +117,7 @@ export class SwirlTimeInput {
|
|
|
111
117
|
const className = classnames("time-input", {
|
|
112
118
|
"time-input--inline": this.inline,
|
|
113
119
|
});
|
|
114
|
-
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
120
|
+
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
115
121
|
}
|
|
116
122
|
static get is() { return "swirl-time-input"; }
|
|
117
123
|
static get encapsulation() { return "scoped"; }
|
|
@@ -75,6 +75,12 @@ const SwirlDateInput$1 = /*@__PURE__*/ proxyCustomElement(class SwirlDateInput e
|
|
|
75
75
|
this.setupMask();
|
|
76
76
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
77
77
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
78
|
+
// see https://stackoverflow.com/a/27314017
|
|
79
|
+
if (this.autoFocus) {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
this.inputEl.focus();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
disconnectedCallback() {
|
|
80
86
|
var _a, _b, _c;
|
|
@@ -113,7 +119,7 @@ const SwirlDateInput$1 = /*@__PURE__*/ proxyCustomElement(class SwirlDateInput e
|
|
|
113
119
|
const className = classnames("date-input", {
|
|
114
120
|
"date-input--inline": this.inline,
|
|
115
121
|
});
|
|
116
|
-
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { popover: `popover-${this.id}` }, h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
122
|
+
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { popover: `popover-${this.id}` }, h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
117
123
|
}
|
|
118
124
|
get el() { return this; }
|
|
119
125
|
static get watchers() { return {
|
|
@@ -1237,6 +1237,7 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
1237
1237
|
// wait for animation
|
|
1238
1238
|
setTimeout(() => {
|
|
1239
1239
|
this.focusTrap.activate();
|
|
1240
|
+
this.handleAutoFocus();
|
|
1240
1241
|
}, 200);
|
|
1241
1242
|
}
|
|
1242
1243
|
else {
|
|
@@ -1276,6 +1277,10 @@ const SwirlModal$1 = /*@__PURE__*/ proxyCustomElement(class SwirlModal extends H
|
|
|
1276
1277
|
updateHeaderToolsStatus() {
|
|
1277
1278
|
this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
|
|
1278
1279
|
}
|
|
1280
|
+
handleAutoFocus() {
|
|
1281
|
+
var _a;
|
|
1282
|
+
(_a = this.modalEl.querySelector("input[autofocus]")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1283
|
+
}
|
|
1279
1284
|
lockBodyScroll() {
|
|
1280
1285
|
disableBodyScroll(this.scrollContainer);
|
|
1281
1286
|
}
|
|
@@ -48,6 +48,12 @@ const SwirlSearch$1 = /*@__PURE__*/ proxyCustomElement(class SwirlSearch extends
|
|
|
48
48
|
componentDidLoad() {
|
|
49
49
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
50
50
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
51
|
+
// see https://stackoverflow.com/a/27314017
|
|
52
|
+
if (this.autoFocus) {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
this.input.focus();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
51
57
|
}
|
|
52
58
|
disconnectedCallback() {
|
|
53
59
|
var _a, _b;
|
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$4 } from './swirl-popover-trigger2.js';
|
|
|
10
10
|
import { d as defineCustomElement$3 } from './swirl-tag2.js';
|
|
11
11
|
import { d as defineCustomElement$2 } from './swirl-visually-hidden2.js';
|
|
12
12
|
|
|
13
|
-
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;visibility:hidden;width:100%;height:100%}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.
|
|
13
|
+
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;visibility:hidden;width:100%;height:100%}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.25rem;margin:0;padding:0;padding-right:calc(1.5rem + var(--s-space-8));border:none;background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:left;white-space:nowrap;text-overflow:ellipsis;cursor:default}.select__input.sc-swirl-select:focus{outline:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__multi-select-values.sc-swirl-select{display:none;overflow:hidden;width:100%;min-height:1.25rem;padding-right:calc(1.5rem + var(--s-space-8));flex-wrap:wrap;gap:var(--s-space-8)}.select__multi-select-values.sc-swirl-select .sc-swirl-select::part(tag){height:1.25rem;padding:0 var(--s-space-4)}.select__indicator.sc-swirl-select{position:absolute;top:50%;right:0;display:inline-flex;color:var(--s-icon-default);transform:translateY(calc(-50% - var(--s-space-8)))}";
|
|
14
14
|
|
|
15
15
|
const SwirlSelect$1 = /*@__PURE__*/ proxyCustomElement(class SwirlSelect extends HTMLElement {
|
|
16
16
|
constructor() {
|
|
@@ -21,7 +21,7 @@ const SwirlTag = /*@__PURE__*/ proxyCustomElement(class SwirlTag extends HTMLEle
|
|
|
21
21
|
}
|
|
22
22
|
render() {
|
|
23
23
|
const className = classnames("tag", `tag--intent-${this.intent}`);
|
|
24
|
-
return (h(Host, null, h("span", { class: className }, this.label, this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
24
|
+
return (h(Host, null, h("span", { class: className, part: "tag" }, this.label, this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
25
25
|
}
|
|
26
26
|
get el() { return this; }
|
|
27
27
|
static get style() { return swirlTagCss; }
|
|
@@ -115,6 +115,12 @@ const SwirlTextInput = /*@__PURE__*/ proxyCustomElement(class SwirlTextInput ext
|
|
|
115
115
|
componentDidLoad() {
|
|
116
116
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
117
117
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
118
|
+
// see https://stackoverflow.com/a/27314017
|
|
119
|
+
if (this.autoFocus) {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
this.inputEl.focus();
|
|
122
|
+
});
|
|
123
|
+
}
|
|
118
124
|
}
|
|
119
125
|
componentDidRender() {
|
|
120
126
|
this.adjustInputSize();
|
|
@@ -79,6 +79,12 @@ const SwirlTimeInput$1 = /*@__PURE__*/ proxyCustomElement(class SwirlTimeInput e
|
|
|
79
79
|
this.setupMask();
|
|
80
80
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
81
81
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
82
|
+
// see https://stackoverflow.com/a/27314017
|
|
83
|
+
if (this.autoFocus) {
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.inputEl.focus();
|
|
86
|
+
});
|
|
87
|
+
}
|
|
82
88
|
}
|
|
83
89
|
disconnectedCallback() {
|
|
84
90
|
var _a, _b, _c;
|
|
@@ -117,7 +123,7 @@ const SwirlTimeInput$1 = /*@__PURE__*/ proxyCustomElement(class SwirlTimeInput e
|
|
|
117
123
|
const className = classnames("time-input", {
|
|
118
124
|
"time-input--inline": this.inline,
|
|
119
125
|
});
|
|
120
|
-
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
126
|
+
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
121
127
|
}
|
|
122
128
|
get el() { return this; }
|
|
123
129
|
static get watchers() { return {
|
|
@@ -69,6 +69,12 @@ const SwirlDateInput = class {
|
|
|
69
69
|
this.setupMask();
|
|
70
70
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
71
71
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
72
|
+
// see https://stackoverflow.com/a/27314017
|
|
73
|
+
if (this.autoFocus) {
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
this.inputEl.focus();
|
|
76
|
+
});
|
|
77
|
+
}
|
|
72
78
|
}
|
|
73
79
|
disconnectedCallback() {
|
|
74
80
|
var _a, _b, _c;
|
|
@@ -107,7 +113,7 @@ const SwirlDateInput = class {
|
|
|
107
113
|
const className = classnames("date-input", {
|
|
108
114
|
"date-input--inline": this.inline,
|
|
109
115
|
});
|
|
110
|
-
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { popover: `popover-${this.id}` }, h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
116
|
+
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "date-input__input", disabled: this.disabled, id: this.id, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("swirl-popover-trigger", { popover: `popover-${this.id}` }, h("button", { "aria-label": this.datePickerTriggerLabel, class: "date-input__date-picker-button", disabled: this.disabled, type: "button" }, h("swirl-icon-today", { size: this.iconSize })))), !this.disabled && (h("swirl-popover", { animation: "scale-in-y", id: `popover-${this.id}`, label: this.datePickerLabel, placement: "bottom-end", ref: (el) => (this.pickerPopover = el) }, h("swirl-date-picker", { labels: this.labels, locale: this.locale, onValueChange: this.onPickDate, value: dateValue })))));
|
|
111
117
|
}
|
|
112
118
|
get el() { return getElement(this); }
|
|
113
119
|
static get watchers() { return {
|
|
@@ -1232,6 +1232,7 @@ const SwirlModal = class {
|
|
|
1232
1232
|
// wait for animation
|
|
1233
1233
|
setTimeout(() => {
|
|
1234
1234
|
this.focusTrap.activate();
|
|
1235
|
+
this.handleAutoFocus();
|
|
1235
1236
|
}, 200);
|
|
1236
1237
|
}
|
|
1237
1238
|
else {
|
|
@@ -1271,6 +1272,10 @@ const SwirlModal = class {
|
|
|
1271
1272
|
updateHeaderToolsStatus() {
|
|
1272
1273
|
this.hasHeaderTools = Boolean(this.el.querySelector('[slot="header-tools"]'));
|
|
1273
1274
|
}
|
|
1275
|
+
handleAutoFocus() {
|
|
1276
|
+
var _a;
|
|
1277
|
+
(_a = this.modalEl.querySelector("input[autofocus]")) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1278
|
+
}
|
|
1274
1279
|
lockBodyScroll() {
|
|
1275
1280
|
disableBodyScroll(this.scrollContainer);
|
|
1276
1281
|
}
|
|
@@ -45,6 +45,12 @@ const SwirlSearch = class {
|
|
|
45
45
|
componentDidLoad() {
|
|
46
46
|
this.forceIconProps(this.desktopMediaQuery.matches);
|
|
47
47
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
48
|
+
// see https://stackoverflow.com/a/27314017
|
|
49
|
+
if (this.autoFocus) {
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
this.input.focus();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
disconnectedCallback() {
|
|
50
56
|
var _a, _b;
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement
|
|
|
2
2
|
import { c as classnames } from './index-d280dafb.js';
|
|
3
3
|
import { q as querySelectorAllDeep } from './utils-bc84f36e.js';
|
|
4
4
|
|
|
5
|
-
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;visibility:hidden;width:100%;height:100%}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.
|
|
5
|
+
const swirlSelectCss = ".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;visibility:hidden;width:100%;height:100%}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.25rem;margin:0;padding:0;padding-right:calc(1.5rem + var(--s-space-8));border:none;background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:left;white-space:nowrap;text-overflow:ellipsis;cursor:default}.select__input.sc-swirl-select:focus{outline:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__multi-select-values.sc-swirl-select{display:none;overflow:hidden;width:100%;min-height:1.25rem;padding-right:calc(1.5rem + var(--s-space-8));flex-wrap:wrap;gap:var(--s-space-8)}.select__multi-select-values.sc-swirl-select .sc-swirl-select::part(tag){height:1.25rem;padding:0 var(--s-space-4)}.select__indicator.sc-swirl-select{position:absolute;top:50%;right:0;display:inline-flex;color:var(--s-icon-default);transform:translateY(calc(-50% - var(--s-space-8)))}";
|
|
6
6
|
|
|
7
7
|
const SwirlSelect = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -18,7 +18,7 @@ const SwirlTag = class {
|
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
const className = classnames("tag", `tag--intent-${this.intent}`);
|
|
21
|
-
return (h(Host, null, h("span", { class: className }, this.label, this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
21
|
+
return (h(Host, null, h("span", { class: className, part: "tag" }, this.label, this.removable && (h("button", { "aria-label": this.removalButtonLabel, class: "tag__removal-button", onClick: this.onRemove, tabIndex: this.el.ariaHidden === "true" ? -1 : undefined, type: "button" }, h("swirl-icon-close", { size: 16 }))))));
|
|
22
22
|
}
|
|
23
23
|
get el() { return getElement(this); }
|
|
24
24
|
};
|
|
@@ -109,6 +109,12 @@ const SwirlTextInput = class {
|
|
|
109
109
|
componentDidLoad() {
|
|
110
110
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
111
111
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
112
|
+
// see https://stackoverflow.com/a/27314017
|
|
113
|
+
if (this.autoFocus) {
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
this.inputEl.focus();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
112
118
|
}
|
|
113
119
|
componentDidRender() {
|
|
114
120
|
this.adjustInputSize();
|
|
@@ -77,6 +77,12 @@ const SwirlTimeInput = class {
|
|
|
77
77
|
this.setupMask();
|
|
78
78
|
this.updateIconSize(this.desktopMediaQuery.matches);
|
|
79
79
|
this.desktopMediaQuery.onchange = this.desktopMediaQueryHandler;
|
|
80
|
+
// see https://stackoverflow.com/a/27314017
|
|
81
|
+
if (this.autoFocus) {
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
this.inputEl.focus();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
80
86
|
}
|
|
81
87
|
disconnectedCallback() {
|
|
82
88
|
var _a, _b, _c;
|
|
@@ -115,7 +121,7 @@ const SwirlTimeInput = class {
|
|
|
115
121
|
const className = classnames("time-input", {
|
|
116
122
|
"time-input--inline": this.inline,
|
|
117
123
|
});
|
|
118
|
-
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
124
|
+
return (h(Host, null, h("div", { class: className }, h("input", { "aria-describedby": this.swirlAriaDescribedby, "aria-disabled": this.disabled ? "true" : undefined, "aria-invalid": ariaInvalid, autoFocus: this.autoFocus, class: "time-input__input", disabled: this.disabled, id: this.id, onBlur: this.onBlur, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: (el) => (this.inputEl = el), required: this.required, type: "text", value: displayValue }), h("span", { class: "time-input__icon" }, h("swirl-icon-time-outlined", { size: this.iconSize })))));
|
|
119
125
|
}
|
|
120
126
|
get el() { return getElement(this); }
|
|
121
127
|
static get watchers() { return {
|