@cupra/ui-kit 2.0.0-canary.62 → 2.0.0-canary.64
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/cjs/components/ds-accordion/ds-accordion.cjs +6 -6
- package/dist/cjs/components/ds-button/ds-button.cjs +43 -38
- package/dist/cjs/components/ds-button/styles/common.styles.cjs +41 -3
- package/dist/cjs/components/ds-chips/styles/common.styles.cjs +9 -2
- package/dist/cjs/components/ds-select/ds-select.cjs +4 -3
- package/dist/cjs/components/ds-slider/ds-slider.cjs +18 -18
- package/dist/cjs/components/ds-text-input/ds-text-input.cjs +3 -2
- package/dist/cjs/components/ds-textarea/ds-textarea.cjs +4 -3
- package/dist/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
- package/dist/cjs/mixins/inputStatesMixin.cjs +1 -1
- package/dist/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.cjs +2 -2
- package/dist/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.cjs +1 -1
- package/dist/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs +5 -0
- package/dist/cjs/utils/IconsManager.cjs +1 -1
- package/dist/cjs/utils/PubSub.cjs +1 -1
- package/dist/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
- package/dist/cjs/utils/concurrencyLimit.cjs +1 -0
- package/dist/cjs/utils/cssWithTokens.cjs +1 -1
- package/dist/cjs/utils/htmlWithTokens.cjs +1 -1
- package/dist/esm/components/ds-accordion/ds-accordion.js +4 -4
- package/dist/esm/components/ds-button/ds-button.js +90 -79
- package/dist/esm/components/ds-button/styles/common.styles.js +42 -4
- package/dist/esm/components/ds-chips/styles/common.styles.js +7 -0
- package/dist/esm/components/ds-select/ds-select.js +38 -32
- package/dist/esm/components/ds-slider/ds-slider.js +84 -67
- package/dist/esm/components/ds-text-input/ds-text-input.js +38 -30
- package/dist/esm/components/ds-textarea/ds-textarea.js +45 -37
- package/dist/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist/esm/mixins/inputStatesMixin.js +4 -3
- package/dist/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.js +17 -16
- package/dist/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js +4 -4
- package/dist/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.js +30 -0
- package/dist/esm/utils/IconsManager.js +1 -1
- package/dist/esm/utils/PubSub.js +1 -1
- package/dist/esm/utils/StylesRegistry/StylesRegistry.js +8 -6
- package/dist/esm/utils/concurrencyLimit.js +32 -0
- package/dist/esm/utils/cssWithTokens.js +1 -1
- package/dist/esm/utils/htmlWithTokens.js +1 -1
- package/dist/types/components/ds-accordion/ds-accordion.d.ts +1 -1
- package/dist/types/components/ds-button/ds-button.d.ts +2 -0
- package/dist/types/components/ds-button/ds-button.types.d.ts +1 -0
- package/dist/types/components/ds-select/ds-select.d.ts +2 -0
- package/dist/types/components/ds-select/ds-select.types.d.ts +1 -0
- package/dist/types/components/ds-slider/ds-slider.d.ts +7 -2
- package/dist/types/components/ds-slider/ds-slider.types.d.ts +18 -3
- package/dist/types/components/ds-text-input/ds-text-input.d.ts +2 -0
- package/dist/types/components/ds-text-input/ds-text-input.types.d.ts +1 -0
- package/dist/types/components/ds-textarea/ds-textarea.d.ts +2 -0
- package/dist/types/components/ds-textarea/ds-textarea.types.d.ts +1 -0
- package/dist/types/mixins/inputStatesMixin.d.ts +1 -0
- package/dist/types/utils/concurrencyLimit.d.ts +4 -0
- package/dist/types/utils/concurrencyLimit.test.d.ts +1 -0
- package/dist-react/cjs/components/ds-accordion/ds-accordion.cjs +6 -6
- package/dist-react/cjs/components/ds-button/ds-button.cjs +43 -38
- package/dist-react/cjs/components/ds-button/styles/common.styles.cjs +41 -3
- package/dist-react/cjs/components/ds-chips/styles/common.styles.cjs +9 -2
- package/dist-react/cjs/components/ds-select/ds-select.cjs +4 -3
- package/dist-react/cjs/components/ds-slider/ds-slider.cjs +18 -18
- package/dist-react/cjs/components/ds-text-input/ds-text-input.cjs +3 -2
- package/dist-react/cjs/components/ds-textarea/ds-textarea.cjs +4 -3
- package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
- package/dist-react/cjs/mixins/inputStatesMixin.cjs +1 -1
- package/dist-react/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.cjs +2 -2
- package/dist-react/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.cjs +1 -1
- package/dist-react/cjs/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.cjs +5 -0
- package/dist-react/cjs/utils/IconsManager.cjs +1 -1
- package/dist-react/cjs/utils/PubSub.cjs +1 -1
- package/dist-react/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
- package/dist-react/cjs/utils/concurrencyLimit.cjs +1 -0
- package/dist-react/cjs/utils/cssWithTokens.cjs +1 -1
- package/dist-react/cjs/utils/htmlWithTokens.cjs +1 -1
- package/dist-react/esm/components/ds-accordion/ds-accordion.js +4 -4
- package/dist-react/esm/components/ds-button/ds-button.js +90 -79
- package/dist-react/esm/components/ds-button/styles/common.styles.js +42 -4
- package/dist-react/esm/components/ds-chips/styles/common.styles.js +7 -0
- package/dist-react/esm/components/ds-select/ds-select.js +38 -32
- package/dist-react/esm/components/ds-slider/ds-slider.js +84 -67
- package/dist-react/esm/components/ds-text-input/ds-text-input.js +38 -30
- package/dist-react/esm/components/ds-textarea/ds-textarea.js +45 -37
- package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
- package/dist-react/esm/mixins/inputStatesMixin.js +4 -3
- package/dist-react/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive-helpers.js +17 -16
- package/dist-react/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directive.js +4 -4
- package/dist-react/esm/node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/live.js +30 -0
- package/dist-react/esm/utils/IconsManager.js +1 -1
- package/dist-react/esm/utils/PubSub.js +1 -1
- package/dist-react/esm/utils/StylesRegistry/StylesRegistry.js +8 -6
- package/dist-react/esm/utils/concurrencyLimit.js +32 -0
- package/dist-react/esm/utils/cssWithTokens.js +1 -1
- package/dist-react/esm/utils/htmlWithTokens.js +1 -1
- package/dist-react/types/components/ds-accordion/ds-accordion.d.ts +1 -1
- package/dist-react/types/components/ds-button/ds-button.d.ts +2 -0
- package/dist-react/types/components/ds-button/ds-button.types.d.ts +1 -0
- package/dist-react/types/components/ds-select/ds-select.d.ts +2 -0
- package/dist-react/types/components/ds-select/ds-select.types.d.ts +1 -0
- package/dist-react/types/components/ds-slider/ds-slider.d.ts +7 -2
- package/dist-react/types/components/ds-slider/ds-slider.types.d.ts +18 -3
- package/dist-react/types/components/ds-text-input/ds-text-input.d.ts +2 -0
- package/dist-react/types/components/ds-text-input/ds-text-input.types.d.ts +1 -0
- package/dist-react/types/components/ds-textarea/ds-textarea.d.ts +2 -0
- package/dist-react/types/components/ds-textarea/ds-textarea.types.d.ts +1 -0
- package/dist-react/types/mixins/inputStatesMixin.d.ts +1 -0
- package/dist-react/types/utils/concurrencyLimit.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { UiKitElement as
|
|
2
|
-
import { customUiKitElement as
|
|
3
|
-
import { ViewportMixin as
|
|
4
|
-
import { booleanConverter as
|
|
5
|
-
import { htmlWithTokens as
|
|
6
|
-
import { objectConverter as
|
|
1
|
+
import { UiKitElement as g } from "../base/UiKitElement.js";
|
|
2
|
+
import { customUiKitElement as f } from "../../decorators/customUiKitElement.js";
|
|
3
|
+
import { ViewportMixin as y } from "../../mixins/ViewportMixin.js";
|
|
4
|
+
import { booleanConverter as l } from "../../utils/booleanConverter.js";
|
|
5
|
+
import { htmlWithTokens as $ } from "../../utils/htmlWithTokens.js";
|
|
6
|
+
import { objectConverter as b } from "../../utils/objectConverter.js";
|
|
7
7
|
import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
|
|
8
|
-
import { nothing as u, html as
|
|
8
|
+
import { nothing as u, html as s } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
9
9
|
import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
10
|
-
import { property as
|
|
11
|
-
import { state as
|
|
10
|
+
import { property as i } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
11
|
+
import { state as v } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
12
12
|
import { choose as T } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/choose.js";
|
|
13
13
|
import { classMap as d } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
14
|
-
import { when as
|
|
15
|
-
import { buttonStyles as S, textStyles as
|
|
16
|
-
var
|
|
17
|
-
for (var
|
|
18
|
-
(m =
|
|
19
|
-
return
|
|
14
|
+
import { when as a } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/when.js";
|
|
15
|
+
import { buttonStyles as S, textStyles as x, loadingDotsStyles as P } from "./styles/common.styles.js";
|
|
16
|
+
var w = Object.defineProperty, C = Object.getOwnPropertyDescriptor, e = (o, r, h, p) => {
|
|
17
|
+
for (var n = p > 1 ? void 0 : p ? C(r, h) : r, c = o.length - 1, m; c >= 0; c--)
|
|
18
|
+
(m = o[c]) && (n = (p ? m(r, h, n) : m(n)) || n);
|
|
19
|
+
return p && n && w(r, h, n), n;
|
|
20
20
|
};
|
|
21
|
-
let t = class extends g
|
|
21
|
+
let t = class extends y(g) {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments), this.variant = "primary", this.mode = "light", this.size = "large", this.disabled = !1, this.destructive = !1, this.htmlTagName = "button", this.type = "button", this.iconPosition = "left", this.rounded = !1, this.fullWidth = !1, this.loading = !1;
|
|
24
24
|
}
|
|
@@ -26,11 +26,11 @@ let t = class extends g(f) {
|
|
|
26
26
|
this.closestForm = this.closest("form");
|
|
27
27
|
}
|
|
28
28
|
get classes() {
|
|
29
|
-
const
|
|
29
|
+
const o = typeof this.size == "string" ? this.size : this.size[this.viewport];
|
|
30
30
|
return {
|
|
31
31
|
button: !0,
|
|
32
32
|
custom: this.htmlTagName === "custom",
|
|
33
|
-
[
|
|
33
|
+
[o]: !!o,
|
|
34
34
|
[this.mode]: !!this.mode,
|
|
35
35
|
[this.variant]: !!this.variant,
|
|
36
36
|
rounded: this.rounded,
|
|
@@ -39,14 +39,14 @@ let t = class extends g(f) {
|
|
|
39
39
|
"full-width": this.fullWidth
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
handleClick(
|
|
43
|
-
if (this.href ||
|
|
44
|
-
const
|
|
42
|
+
handleClick(o) {
|
|
43
|
+
if (this.href || o.preventDefault(), this.closestForm && this.type === "submit") {
|
|
44
|
+
const r = new Event("submit", {
|
|
45
45
|
bubbles: !0,
|
|
46
46
|
composed: !0,
|
|
47
47
|
cancelable: !0
|
|
48
48
|
});
|
|
49
|
-
this.closestForm.dispatchEvent(
|
|
49
|
+
this.closestForm.dispatchEvent(r);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
get iconTemplate() {
|
|
@@ -56,7 +56,7 @@ let t = class extends g(f) {
|
|
|
56
56
|
}) : u;
|
|
57
57
|
}
|
|
58
58
|
get loadingTemplate() {
|
|
59
|
-
return this.loading ?
|
|
59
|
+
return this.loading ? s`
|
|
60
60
|
<span class="loading-dots">
|
|
61
61
|
<span>.</span>
|
|
62
62
|
<span>.</span>
|
|
@@ -64,8 +64,11 @@ let t = class extends g(f) {
|
|
|
64
64
|
</span>
|
|
65
65
|
` : u;
|
|
66
66
|
}
|
|
67
|
+
get contentTemplate() {
|
|
68
|
+
return this.loading && this.textLoading ? s`${this.textLoading}` : s`<slot></slot>`;
|
|
69
|
+
}
|
|
67
70
|
get cssTokens() {
|
|
68
|
-
return
|
|
71
|
+
return $`
|
|
69
72
|
<style>
|
|
70
73
|
:host{
|
|
71
74
|
color-scheme: ${this.mode};
|
|
@@ -78,60 +81,65 @@ let t = class extends g(f) {
|
|
|
78
81
|
</style>`;
|
|
79
82
|
}
|
|
80
83
|
render() {
|
|
81
|
-
return
|
|
84
|
+
return s`
|
|
82
85
|
${this.cssTokens}
|
|
83
86
|
${T(this.htmlTagName || "button", [
|
|
84
87
|
[
|
|
85
88
|
"button",
|
|
86
89
|
() => {
|
|
87
|
-
var
|
|
88
|
-
return
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
var o;
|
|
91
|
+
return s`
|
|
92
|
+
<div class=${d(this.classes)}>
|
|
93
|
+
<button
|
|
94
|
+
class="inner"
|
|
95
|
+
aria-label=${(o = this.textContent) == null ? void 0 : o.replace(/^\s+|\s+$/g, "")}
|
|
96
|
+
type=${this.type}
|
|
97
|
+
@click=${this.handleClick}
|
|
98
|
+
?disabled=${this.disabled}
|
|
99
|
+
>
|
|
100
|
+
${a(this.iconPosition === "left", () => s` ${this.iconTemplate} `)}
|
|
101
|
+
<span class="container">
|
|
102
|
+
${this.contentTemplate}
|
|
103
|
+
${this.loadingTemplate}
|
|
104
|
+
</span>
|
|
105
|
+
${a(this.iconPosition === "right", () => s` ${this.iconTemplate} `)}
|
|
106
|
+
</button>
|
|
107
|
+
</div>
|
|
103
108
|
`;
|
|
104
109
|
}
|
|
105
110
|
],
|
|
106
111
|
[
|
|
107
112
|
"a",
|
|
108
113
|
() => {
|
|
109
|
-
var
|
|
110
|
-
return
|
|
111
|
-
<
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
114
|
+
var o;
|
|
115
|
+
return s`
|
|
116
|
+
<div class=${d(this.classes)}>
|
|
117
|
+
<a
|
|
118
|
+
class="inner"
|
|
119
|
+
aria-label=${(o = this.textContent) == null ? void 0 : o.replace(/^\s+|\s+$/g, "")}
|
|
120
|
+
href=${this.href}
|
|
121
|
+
rel=${this.rel}
|
|
122
|
+
target=${this.target}
|
|
123
|
+
@click=${this.handleClick}
|
|
124
|
+
>
|
|
125
|
+
${a(this.iconPosition === "left", () => s`${this.iconTemplate}`)}
|
|
126
|
+
<span class="container">
|
|
127
|
+
${this.contentTemplate}
|
|
128
|
+
${this.loadingTemplate}
|
|
129
|
+
</span>
|
|
130
|
+
${a(this.iconPosition === "right", () => s`${this.iconTemplate}`)}
|
|
131
|
+
</a>
|
|
132
|
+
</div>
|
|
127
133
|
`;
|
|
128
134
|
}
|
|
129
135
|
],
|
|
130
136
|
[
|
|
131
137
|
"custom",
|
|
132
|
-
() =>
|
|
138
|
+
() => s`
|
|
133
139
|
<div class=${d(this.classes)}>
|
|
134
|
-
|
|
140
|
+
${a(this.iconPosition === "left", () => s`${this.iconTemplate}`)}
|
|
141
|
+
${this.loading && this.textLoading ? s`<span class="container">${this.textLoading}${this.loadingTemplate}</span>` : s`<slot></slot>${this.loadingTemplate}`}
|
|
142
|
+
${a(this.iconPosition === "right", () => s`${this.iconTemplate}`)}
|
|
135
143
|
</div>
|
|
136
144
|
`
|
|
137
145
|
]
|
|
@@ -139,57 +147,60 @@ let t = class extends g(f) {
|
|
|
139
147
|
`;
|
|
140
148
|
}
|
|
141
149
|
};
|
|
142
|
-
t.styles = [S,
|
|
150
|
+
t.styles = [S, x, P];
|
|
143
151
|
e([
|
|
144
|
-
|
|
152
|
+
i({ type: String })
|
|
145
153
|
], t.prototype, "variant", 2);
|
|
146
154
|
e([
|
|
147
|
-
|
|
155
|
+
i({ type: String, reflect: !0 })
|
|
148
156
|
], t.prototype, "mode", 2);
|
|
149
157
|
e([
|
|
150
|
-
|
|
158
|
+
i({ type: String, converter: b })
|
|
151
159
|
], t.prototype, "size", 2);
|
|
152
160
|
e([
|
|
153
|
-
|
|
161
|
+
i({ type: Boolean, converter: l })
|
|
154
162
|
], t.prototype, "disabled", 2);
|
|
155
163
|
e([
|
|
156
|
-
|
|
164
|
+
i({ type: Boolean, converter: l })
|
|
157
165
|
], t.prototype, "destructive", 2);
|
|
158
166
|
e([
|
|
159
|
-
|
|
167
|
+
i({ type: String, attribute: "icon-name" })
|
|
160
168
|
], t.prototype, "iconName", 2);
|
|
161
169
|
e([
|
|
162
|
-
|
|
170
|
+
i({ type: String, attribute: "html-tag-name" })
|
|
163
171
|
], t.prototype, "htmlTagName", 2);
|
|
164
172
|
e([
|
|
165
|
-
|
|
173
|
+
i({ type: String, reflect: !0 })
|
|
166
174
|
], t.prototype, "href", 2);
|
|
167
175
|
e([
|
|
168
|
-
|
|
176
|
+
i({ type: String, reflect: !0 })
|
|
169
177
|
], t.prototype, "rel", 2);
|
|
170
178
|
e([
|
|
171
|
-
|
|
179
|
+
i({ type: String, reflect: !0 })
|
|
172
180
|
], t.prototype, "target", 2);
|
|
173
181
|
e([
|
|
174
|
-
|
|
182
|
+
i({ type: String })
|
|
175
183
|
], t.prototype, "type", 2);
|
|
176
184
|
e([
|
|
177
|
-
|
|
185
|
+
i({ type: String, attribute: "icon-position" })
|
|
178
186
|
], t.prototype, "iconPosition", 2);
|
|
179
187
|
e([
|
|
180
|
-
|
|
188
|
+
i({ type: Boolean, converter: l })
|
|
181
189
|
], t.prototype, "rounded", 2);
|
|
182
190
|
e([
|
|
183
|
-
|
|
191
|
+
i({ type: Boolean, converter: l, attribute: "full-width" })
|
|
184
192
|
], t.prototype, "fullWidth", 2);
|
|
185
193
|
e([
|
|
186
|
-
|
|
194
|
+
i({ type: Boolean, converter: l })
|
|
187
195
|
], t.prototype, "loading", 2);
|
|
188
196
|
e([
|
|
189
|
-
|
|
197
|
+
i({ type: String, attribute: "text-loading" })
|
|
198
|
+
], t.prototype, "textLoading", 2);
|
|
199
|
+
e([
|
|
200
|
+
v()
|
|
190
201
|
], t.prototype, "closestForm", 2);
|
|
191
202
|
t = e([
|
|
192
|
-
|
|
203
|
+
f("ds-button")
|
|
193
204
|
], t);
|
|
194
205
|
export {
|
|
195
206
|
t as DsButton
|
|
@@ -2,7 +2,7 @@ import "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@li
|
|
|
2
2
|
import "../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
3
3
|
import "../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
4
4
|
import { css as t } from "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
|
|
5
|
-
const
|
|
5
|
+
const a = t`
|
|
6
6
|
:host {
|
|
7
7
|
display: contents;
|
|
8
8
|
}
|
|
@@ -22,6 +22,44 @@ const e = t`
|
|
|
22
22
|
.button.full-width {
|
|
23
23
|
width: 100%;
|
|
24
24
|
}
|
|
25
|
+
|
|
26
|
+
.inner,
|
|
27
|
+
.custom ::slotted(*) {
|
|
28
|
+
display: inline-flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
gap: var(--ui-kit-button-gap, 0);
|
|
34
|
+
padding: 0;
|
|
35
|
+
margin: 0;
|
|
36
|
+
background: transparent;
|
|
37
|
+
border: none;
|
|
38
|
+
color: inherit;
|
|
39
|
+
font: inherit;
|
|
40
|
+
text-transform: inherit;
|
|
41
|
+
letter-spacing: inherit;
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
cursor: inherit;
|
|
44
|
+
outline: none;
|
|
45
|
+
box-sizing: border-box;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.custom ::slotted(*) {
|
|
49
|
+
width: auto;
|
|
50
|
+
flex: 1;
|
|
51
|
+
min-width: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.custom ::slotted(*:disabled),
|
|
55
|
+
.custom.disabled ::slotted(*) {
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
cursor: default;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.custom ::slotted(*:focus-visible) {
|
|
61
|
+
outline: none;
|
|
62
|
+
}
|
|
25
63
|
`, s = t`
|
|
26
64
|
.naked.container {
|
|
27
65
|
display: inline-flex;
|
|
@@ -32,7 +70,7 @@ const e = t`
|
|
|
32
70
|
text-overflow: ellipsis;
|
|
33
71
|
white-space: nowrap;
|
|
34
72
|
}
|
|
35
|
-
`,
|
|
73
|
+
`, d = t`
|
|
36
74
|
.loading-dots {
|
|
37
75
|
display: inline-flex;
|
|
38
76
|
align-items: baseline;
|
|
@@ -110,7 +148,7 @@ const e = t`
|
|
|
110
148
|
}
|
|
111
149
|
`;
|
|
112
150
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
151
|
+
a as buttonStyles,
|
|
152
|
+
d as loadingDotsStyles,
|
|
115
153
|
s as textStyles
|
|
116
154
|
};
|
|
@@ -41,11 +41,18 @@ const e = o`
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
.scroll-button {
|
|
44
|
+
display: none;
|
|
44
45
|
position: absolute;
|
|
45
46
|
top: 0;
|
|
46
47
|
z-index: 2;
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
@media (min-width: 768px) {
|
|
51
|
+
.scroll-button {
|
|
52
|
+
display: block;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
.scroll-button.left {
|
|
50
57
|
left: 0;
|
|
51
58
|
}
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { UiKitElement as
|
|
2
|
-
import { customUiKitElement as
|
|
1
|
+
import { UiKitElement as y } from "../base/UiKitElement.js";
|
|
2
|
+
import { customUiKitElement as f } from "../../decorators/customUiKitElement.js";
|
|
3
|
+
import { booleanConverter as S } from "../../utils/booleanConverter.js";
|
|
3
4
|
import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
|
|
4
|
-
import { html as
|
|
5
|
+
import { html as c, nothing as O } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
|
|
5
6
|
import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
|
|
6
|
-
import { property as
|
|
7
|
-
import { state as
|
|
8
|
-
import { query as
|
|
7
|
+
import { property as h } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
|
|
8
|
+
import { state as d } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
|
|
9
|
+
import { query as b } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query.js";
|
|
9
10
|
import { queryAssignedElements as v } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js";
|
|
10
11
|
import { classMap as u } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
|
|
11
12
|
import { SelectKeyboardController as m } from "./controllers/SelectKeyboardController.js";
|
|
12
|
-
import { commonStyles as
|
|
13
|
-
var
|
|
14
|
-
for (var a = o > 1 ? void 0 : o ?
|
|
13
|
+
import { commonStyles as x } from "./styles/common.styles.js";
|
|
14
|
+
var I = Object.defineProperty, C = Object.getOwnPropertyDescriptor, n = (e, t, i, o) => {
|
|
15
|
+
for (var a = o > 1 ? void 0 : o ? C(t, i) : t, l = e.length - 1, r; l >= 0; l--)
|
|
15
16
|
(r = e[l]) && (a = (o ? r(t, i, a) : r(a)) || a);
|
|
16
|
-
return o && a &&
|
|
17
|
+
return o && a && I(t, i, a), a;
|
|
17
18
|
};
|
|
18
|
-
let s = class extends
|
|
19
|
+
let s = class extends y {
|
|
19
20
|
constructor() {
|
|
20
|
-
super(...arguments), this.mode = "light", this.size = "medium", this.variant = "primary", this._open = !1, this.nativeSelect = null, this.nativeLabel = null, this.nativeOptions = [], this.activeIndex = -1, this.hasForcedError = !1, this.handleMutations = (e) => {
|
|
21
|
+
super(...arguments), this.mode = "light", this.size = "medium", this.variant = "primary", this.readonly = !1, this._open = !1, this.nativeSelect = null, this.nativeLabel = null, this.nativeOptions = [], this.activeIndex = -1, this.hasForcedError = !1, this.handleMutations = (e) => {
|
|
21
22
|
e.forEach((t) => {
|
|
22
23
|
t.type === "childList" && this.syncNativeOptions();
|
|
23
24
|
}), this.requestUpdate();
|
|
24
25
|
}, this.syncNativeOptions = () => {
|
|
25
26
|
this.nativeOptions = Array.from(this.nativeSelect.options);
|
|
26
27
|
}, this.handleOpen = () => {
|
|
27
|
-
this._open = !0, this.activeIndex = this.findSelectedOptionIndex(), this.focusDisplaySelect();
|
|
28
|
+
this.readonly || (this._open = !0, this.activeIndex = this.findSelectedOptionIndex(), this.focusDisplaySelect());
|
|
28
29
|
}, this.handleClose = () => {
|
|
29
30
|
this._open = !1;
|
|
30
31
|
}, this.handleClickDisplaySelect = () => {
|
|
@@ -125,6 +126,7 @@ let s = class extends f {
|
|
|
125
126
|
container: !0,
|
|
126
127
|
open: this._open,
|
|
127
128
|
disabled: !!((e = this.nativeSelect) != null && e.disabled),
|
|
129
|
+
readonly: !!this.readonly,
|
|
128
130
|
filled: !!((i = (t = this.nativeOptions) == null ? void 0 : t.find((a) => a.selected && !a.hidden)) != null && i.selected),
|
|
129
131
|
invalid: !((o = this.nativeSelect) != null && o.validity.valid),
|
|
130
132
|
error: this.hasForcedError,
|
|
@@ -140,12 +142,13 @@ let s = class extends f {
|
|
|
140
142
|
return this._open;
|
|
141
143
|
}
|
|
142
144
|
render() {
|
|
143
|
-
return
|
|
145
|
+
return c`
|
|
144
146
|
<slot @slotchange=${this.initializeNativeSelect}></slot>
|
|
145
147
|
<div class=${u(this.containerClasses)}>
|
|
146
148
|
${this.displaySelectTemplate}
|
|
147
149
|
${this.optionsContainerTemplate}
|
|
148
150
|
<slot name="helper-text"></slot>
|
|
151
|
+
<slot name="readonly-text"></slot>
|
|
149
152
|
<slot name="forced-error" @slotchange=${this.handleChangeForcedError}></slot>
|
|
150
153
|
<slot name="invalid-error"></slot>
|
|
151
154
|
</div>
|
|
@@ -164,10 +167,10 @@ let s = class extends f {
|
|
|
164
167
|
if (l.nodeType !== 3)
|
|
165
168
|
return r;
|
|
166
169
|
if (l.textContent.trim() === "") return "";
|
|
167
|
-
const
|
|
168
|
-
return
|
|
170
|
+
const p = document.createElement("span");
|
|
171
|
+
return p.classList.add("text"), p.appendChild(r), p;
|
|
169
172
|
});
|
|
170
|
-
return
|
|
173
|
+
return c`
|
|
171
174
|
<div class="select-outline">
|
|
172
175
|
<div class="select-container">
|
|
173
176
|
<label id="display-label" class="label">${(o = this.nativeLabel) == null ? void 0 : o.innerText}</label>
|
|
@@ -195,17 +198,17 @@ let s = class extends f {
|
|
|
195
198
|
return this._open && this.activeIndex >= 0 ? `${s.ARIA_OPTION_PREFIX}${this.nativeOptions[this.activeIndex].value}` : "";
|
|
196
199
|
}
|
|
197
200
|
get optionsContainerTemplate() {
|
|
198
|
-
return
|
|
201
|
+
return c`
|
|
199
202
|
<div id="options-container" class="options-container" role="listbox">
|
|
200
203
|
${this.nativeOptions.map(
|
|
201
|
-
(e, t) => e.hidden ?
|
|
204
|
+
(e, t) => e.hidden ? O : this.renderOptionClone(e, t)
|
|
202
205
|
)}
|
|
203
206
|
</div>
|
|
204
207
|
`;
|
|
205
208
|
}
|
|
206
209
|
renderOptionClone(e, t) {
|
|
207
210
|
const i = Array.from(e.childNodes).map((o) => o.cloneNode(!0));
|
|
208
|
-
return
|
|
211
|
+
return c`
|
|
209
212
|
<div
|
|
210
213
|
id="${s.ARIA_OPTION_PREFIX}${e.value}"
|
|
211
214
|
class=${u({
|
|
@@ -225,34 +228,37 @@ let s = class extends f {
|
|
|
225
228
|
`;
|
|
226
229
|
}
|
|
227
230
|
};
|
|
228
|
-
s.styles = [
|
|
231
|
+
s.styles = [x];
|
|
229
232
|
s.ARIA_OPTION_PREFIX = "option-";
|
|
230
233
|
n([
|
|
231
|
-
|
|
234
|
+
h({ type: String })
|
|
232
235
|
], s.prototype, "mode", 2);
|
|
233
236
|
n([
|
|
234
|
-
|
|
237
|
+
h({ type: String })
|
|
235
238
|
], s.prototype, "size", 2);
|
|
236
239
|
n([
|
|
237
|
-
|
|
240
|
+
h({ type: String })
|
|
238
241
|
], s.prototype, "variant", 2);
|
|
239
242
|
n([
|
|
240
|
-
|
|
243
|
+
h({ type: Boolean, converter: S, reflect: !0 })
|
|
244
|
+
], s.prototype, "readonly", 2);
|
|
245
|
+
n([
|
|
246
|
+
d()
|
|
241
247
|
], s.prototype, "_open", 2);
|
|
242
248
|
n([
|
|
243
|
-
|
|
249
|
+
d()
|
|
244
250
|
], s.prototype, "nativeSelect", 2);
|
|
245
251
|
n([
|
|
246
|
-
|
|
252
|
+
d()
|
|
247
253
|
], s.prototype, "nativeLabel", 2);
|
|
248
254
|
n([
|
|
249
|
-
|
|
255
|
+
d()
|
|
250
256
|
], s.prototype, "nativeOptions", 2);
|
|
251
257
|
n([
|
|
252
|
-
|
|
258
|
+
d()
|
|
253
259
|
], s.prototype, "activeIndex", 2);
|
|
254
260
|
n([
|
|
255
|
-
|
|
261
|
+
d()
|
|
256
262
|
], s.prototype, "hasForcedError", 2);
|
|
257
263
|
n([
|
|
258
264
|
v({ slot: "", selector: "select", flatten: !0 })
|
|
@@ -264,10 +270,10 @@ n([
|
|
|
264
270
|
v({ slot: "forced-error", flatten: !0 })
|
|
265
271
|
], s.prototype, "forcedError", 2);
|
|
266
272
|
n([
|
|
267
|
-
|
|
273
|
+
b(".select")
|
|
268
274
|
], s.prototype, "displaySelect", 2);
|
|
269
275
|
s = n([
|
|
270
|
-
|
|
276
|
+
f("ds-select")
|
|
271
277
|
], s);
|
|
272
278
|
export {
|
|
273
279
|
s as DsSelect
|