@sondor-technology/sondor-components 1.0.1-develop.13 → 1.0.1-develop.15
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/components/alert/alert.constants.d.ts +3 -0
- package/dist/components/alert/alert.constants.d.ts.map +1 -0
- package/dist/components/alert/alert.constants.js +2 -0
- package/dist/components/alert/alert.constants.js.map +1 -0
- package/dist/components/alert/alert.d.ts +4 -3
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +21 -11
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/badge/badge.constants.d.ts +3 -0
- package/dist/components/badge/badge.constants.d.ts.map +1 -0
- package/dist/components/badge/badge.constants.js +2 -0
- package/dist/components/badge/badge.constants.js.map +1 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +3 -2
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/button/button.constants.d.ts +7 -0
- package/dist/components/button/button.constants.d.ts.map +1 -0
- package/dist/components/button/button.constants.js +4 -0
- package/dist/components/button/button.constants.js.map +1 -0
- package/dist/components/button/button.d.ts +8 -4
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +181 -137
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +1 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/button-group.js +17 -21
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +36 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +439 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/checkbox/checkbox.constants.d.ts +3 -0
- package/dist/components/checkbox/checkbox.constants.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.constants.js +2 -0
- package/dist/components/checkbox/checkbox.constants.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +21 -5
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +7 -7
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/code-block.js +130 -66
- package/dist/components/code-block/code-block.js.map +1 -0
- package/dist/components/content-card/content-card.d.ts.map +1 -1
- package/dist/components/content-card/content-card.js +10 -15
- package/dist/components/content-card/content-card.js.map +1 -0
- package/dist/components/cron-builder/cron-builder.d.ts +34 -0
- package/dist/components/cron-builder/cron-builder.d.ts.map +1 -0
- package/dist/components/cron-builder/cron-builder.js +456 -0
- package/dist/components/cron-builder/cron-builder.js.map +1 -0
- package/dist/components/divider/divider.constants.d.ts +5 -0
- package/dist/components/divider/divider.constants.d.ts.map +1 -0
- package/dist/components/divider/divider.constants.js +3 -0
- package/dist/components/divider/divider.constants.js.map +1 -0
- package/dist/components/divider/divider.d.ts +4 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/divider.js +18 -9
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +73 -30
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/field/field.d.ts +2 -2
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/field.js +8 -9
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/footer/footer.d.ts +8 -1
- package/dist/components/footer/footer.d.ts.map +1 -1
- package/dist/components/footer/footer.js +42 -12
- package/dist/components/footer/footer.js.map +1 -0
- package/dist/components/form/form-step.js +1 -0
- package/dist/components/form/form-step.js.map +1 -0
- package/dist/components/form/form.d.ts +3 -0
- package/dist/components/form/form.d.ts.map +1 -1
- package/dist/components/form/form.js +109 -69
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/grid/grid-row.d.ts +3 -3
- package/dist/components/grid/grid-row.d.ts.map +1 -1
- package/dist/components/grid/grid-row.js +36 -22
- package/dist/components/grid/grid-row.js.map +1 -0
- package/dist/components/grid/grid.d.ts +2 -2
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/grid/grid.js +5 -2
- package/dist/components/grid/grid.js.map +1 -0
- package/dist/components/icon/icon-paths.d.ts +161 -86
- package/dist/components/icon/icon-paths.d.ts.map +1 -1
- package/dist/components/icon/icon-paths.js +176 -106
- package/dist/components/icon/icon-paths.js.map +1 -0
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +6 -5
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/input/input.d.ts +10 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +59 -43
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/link/link.d.ts +6 -6
- package/dist/components/link/link.d.ts.map +1 -1
- package/dist/components/link/link.js +42 -19
- package/dist/components/link/link.js.map +1 -0
- package/dist/components/metadata/metadata.d.ts +3 -3
- package/dist/components/metadata/metadata.d.ts.map +1 -1
- package/dist/components/metadata/metadata.js +23 -20
- package/dist/components/metadata/metadata.js.map +1 -0
- package/dist/components/modal/modal.d.ts +4 -16
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +99 -62
- package/dist/components/modal/modal.js.map +1 -0
- package/dist/components/page-layout/page-layout.d.ts +4 -3
- package/dist/components/page-layout/page-layout.d.ts.map +1 -1
- package/dist/components/page-layout/page-layout.js +95 -68
- package/dist/components/page-layout/page-layout.js.map +1 -0
- package/dist/components/pin-input/pin-input.d.ts +33 -0
- package/dist/components/pin-input/pin-input.d.ts.map +1 -0
- package/dist/components/pin-input/pin-input.js +253 -0
- package/dist/components/pin-input/pin-input.js.map +1 -0
- package/dist/components/popover/popover.d.ts +26 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +196 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/radio/radio.d.ts +8 -0
- package/dist/components/radio/radio.d.ts.map +1 -1
- package/dist/components/radio/radio.js +8 -12
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +6 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +44 -18
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/router/router.d.ts +5 -7
- package/dist/components/router/router.d.ts.map +1 -1
- package/dist/components/router/router.js +54 -38
- package/dist/components/router/router.js.map +1 -0
- package/dist/components/select/select.d.ts +5 -4
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +40 -9
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +3 -2
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +10 -13
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/switch/switch.d.ts +12 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/switch/switch.js +28 -22
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/data-table.d.ts +3 -25
- package/dist/components/table/data-table.d.ts.map +1 -1
- package/dist/components/table/data-table.js +211 -146
- package/dist/components/table/data-table.js.map +1 -0
- package/dist/components/table/table.d.ts +3 -3
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +39 -20
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tab-panel.d.ts +3 -1
- package/dist/components/tabs/tab-panel.d.ts.map +1 -1
- package/dist/components/tabs/tab-panel.js +21 -11
- package/dist/components/tabs/tab-panel.js.map +1 -0
- package/dist/components/tabs/tab.d.ts +5 -1
- package/dist/components/tabs/tab.d.ts.map +1 -1
- package/dist/components/tabs/tab.js +46 -28
- package/dist/components/tabs/tab.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +4 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +76 -13
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +13 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +59 -13
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.constants.d.ts +3 -0
- package/dist/components/theme-toggle/theme-toggle.constants.d.ts.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.constants.js +2 -0
- package/dist/components/theme-toggle/theme-toggle.constants.js.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts +3 -2
- package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -1
- package/dist/components/theme-toggle/theme-toggle.js +46 -19
- package/dist/components/theme-toggle/theme-toggle.js.map +1 -0
- package/dist/components/time-picker/time-picker.d.ts +38 -0
- package/dist/components/time-picker/time-picker.d.ts.map +1 -0
- package/dist/components/time-picker/time-picker.js +280 -0
- package/dist/components/time-picker/time-picker.js.map +1 -0
- package/dist/components/toggle-group/toggle-button.d.ts +23 -0
- package/dist/components/toggle-group/toggle-button.d.ts.map +1 -0
- package/dist/components/toggle-group/toggle-button.js +115 -0
- package/dist/components/toggle-group/toggle-button.js.map +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +32 -0
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group/toggle-group.js +150 -0
- package/dist/components/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +33 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.js +293 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts +5 -2
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -1
- package/dist/components/vertical-nav/vertical-nav-group.js +50 -14
- package/dist/components/vertical-nav/vertical-nav-group.js.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +3 -2
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -1
- package/dist/components/vertical-nav/vertical-nav-item.js +30 -8
- package/dist/components/vertical-nav/vertical-nav-item.js.map +1 -0
- package/dist/styles/index.css +49 -17
- package/dist/styles/reset.js +1 -0
- package/dist/styles/reset.js.map +1 -0
- package/package.json +30 -1
- package/src/components/alert/alert.constants.ts +2 -0
- package/src/components/alert/alert.ts +24 -15
- package/src/components/badge/badge.constants.ts +2 -0
- package/src/components/badge/badge.ts +3 -4
- package/src/components/breadcrumb/breadcrumb.ts +2 -2
- package/src/components/button/button.constants.ts +8 -0
- package/src/components/button/button.ts +184 -144
- package/src/components/button-group/button-group.ts +18 -22
- package/src/components/calendar/calendar.ts +444 -0
- package/src/components/checkbox/checkbox.constants.ts +2 -0
- package/src/components/checkbox/checkbox.ts +33 -18
- package/src/components/code-block/code-block.ts +151 -84
- package/src/components/content-card/content-card.ts +10 -16
- package/src/components/cron-builder/cron-builder.ts +452 -0
- package/src/components/divider/divider.constants.ts +5 -0
- package/src/components/divider/divider.ts +22 -11
- package/src/components/drawer/drawer.ts +79 -34
- package/src/components/field/field.ts +9 -11
- package/src/components/footer/footer.ts +43 -12
- package/src/components/form/form.ts +121 -84
- package/src/components/grid/grid-row.ts +45 -32
- package/src/components/grid/grid.ts +7 -4
- package/src/components/icon/icon-paths.ts +175 -106
- package/src/components/icon/icon.ts +6 -6
- package/src/components/input/input.ts +59 -45
- package/src/components/link/link.ts +45 -21
- package/src/components/metadata/metadata.ts +26 -24
- package/src/components/modal/modal.ts +108 -74
- package/src/components/page-layout/page-layout.ts +97 -72
- package/src/components/pin-input/pin-input.ts +249 -0
- package/src/components/popover/popover.ts +192 -0
- package/src/components/radio/radio.ts +8 -13
- package/src/components/radio-group/radio-group.ts +45 -21
- package/src/components/router/router.ts +73 -50
- package/src/components/select/select.ts +41 -80
- package/src/components/skeleton/skeleton.ts +14 -14
- package/src/components/switch/switch.ts +31 -25
- package/src/components/table/data-table.ts +248 -177
- package/src/components/table/table.ts +52 -29
- package/src/components/tabs/tab-panel.ts +25 -13
- package/src/components/tabs/tab.ts +58 -33
- package/src/components/tabs/tabs.ts +77 -15
- package/src/components/textarea/textarea.ts +63 -15
- package/src/components/theme-toggle/theme-toggle.constants.ts +2 -0
- package/src/components/theme-toggle/theme-toggle.ts +47 -22
- package/src/components/time-picker/time-picker.ts +272 -0
- package/src/components/toggle-group/toggle-button.ts +104 -0
- package/src/components/toggle-group/toggle-group.ts +148 -0
- package/src/components/tooltip/tooltip.ts +286 -0
- package/src/components/vertical-nav/vertical-nav-group.ts +57 -18
- package/src/components/vertical-nav/vertical-nav-item.ts +35 -12
- package/src/styles/globals.css +27 -4
- package/src/styles/theme.css +40 -32
- package/tsconfig.json +2 -1
- package/dist/components/card/card.d.ts +0 -11
- package/dist/components/card/card.d.ts.map +0 -1
- package/dist/components/card/card.js +0 -54
- package/src/components/card/card.ts +0 -53
|
@@ -1,81 +1,14 @@
|
|
|
1
1
|
import {LitElement, html, css, PropertyValues} from "lit";
|
|
2
2
|
import {customElement, property, state, query} from "lit/decorators.js";
|
|
3
3
|
import {classMap} from "lit/directives/class-map.js";
|
|
4
|
+
import {ifDefined} from "lit/directives/if-defined.js";
|
|
4
5
|
|
|
5
6
|
export interface SelectOption {
|
|
6
7
|
label: string;
|
|
7
8
|
value: string;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
* Standard WHATWG Autocomplete tokens.
|
|
12
|
-
*/
|
|
13
|
-
export type SelectAutocomplete =
|
|
14
|
-
| "on"
|
|
15
|
-
| "off"
|
|
16
|
-
// Names
|
|
17
|
-
| "name"
|
|
18
|
-
| "honorific-prefix"
|
|
19
|
-
| "given-name"
|
|
20
|
-
| "additional-name"
|
|
21
|
-
| "family-name"
|
|
22
|
-
| "honorific-suffix"
|
|
23
|
-
| "nickname"
|
|
24
|
-
// Authentication & Identity
|
|
25
|
-
| "email"
|
|
26
|
-
| "username"
|
|
27
|
-
| "new-password"
|
|
28
|
-
| "current-password"
|
|
29
|
-
| "one-time-code"
|
|
30
|
-
| "organization"
|
|
31
|
-
| "organization-title"
|
|
32
|
-
| "url"
|
|
33
|
-
| "photo"
|
|
34
|
-
| "webauthn"
|
|
35
|
-
// Addresses
|
|
36
|
-
| "street-address"
|
|
37
|
-
| "address-line1"
|
|
38
|
-
| "address-line2"
|
|
39
|
-
| "address-line3"
|
|
40
|
-
| "address-level1" // State / Province
|
|
41
|
-
| "address-level2" // City
|
|
42
|
-
| "address-level3"
|
|
43
|
-
| "address-level4"
|
|
44
|
-
| "country"
|
|
45
|
-
| "country-name"
|
|
46
|
-
| "postal-code"
|
|
47
|
-
// Payment
|
|
48
|
-
| "cc-name"
|
|
49
|
-
| "cc-given-name"
|
|
50
|
-
| "cc-additional-name"
|
|
51
|
-
| "cc-family-name"
|
|
52
|
-
| "cc-number"
|
|
53
|
-
| "cc-exp"
|
|
54
|
-
| "cc-exp-month"
|
|
55
|
-
| "cc-exp-year"
|
|
56
|
-
| "cc-csc"
|
|
57
|
-
| "cc-type"
|
|
58
|
-
| "transaction-currency"
|
|
59
|
-
| "transaction-amount"
|
|
60
|
-
// Personal
|
|
61
|
-
| "language"
|
|
62
|
-
| "bday"
|
|
63
|
-
| "bday-day"
|
|
64
|
-
| "bday-month"
|
|
65
|
-
| "bday-year"
|
|
66
|
-
| "sex"
|
|
67
|
-
// Telephone & Messaging
|
|
68
|
-
| "tel"
|
|
69
|
-
| "tel-country-code"
|
|
70
|
-
| "tel-national"
|
|
71
|
-
| "tel-area-code"
|
|
72
|
-
| "tel-local"
|
|
73
|
-
| "tel-local-prefix"
|
|
74
|
-
| "tel-local-suffix"
|
|
75
|
-
| "tel-extension"
|
|
76
|
-
| "impp"
|
|
77
|
-
// Preserves IDE autocomplete while allowing space-separated modifiers (e.g., "shipping postal-code")
|
|
78
|
-
| (string & {});
|
|
11
|
+
export type SelectAutocomplete = "on" | "off" | "name" | "email" | (string & {});
|
|
79
12
|
|
|
80
13
|
@customElement("st-select")
|
|
81
14
|
export class StSelect extends LitElement {
|
|
@@ -84,6 +17,7 @@ export class StSelect extends LitElement {
|
|
|
84
17
|
|
|
85
18
|
@property({type: String}) name = "";
|
|
86
19
|
@property({type: String}) label = "";
|
|
20
|
+
@property({type: Boolean, attribute: "hide-label"}) hideLabel = false;
|
|
87
21
|
@property({type: String}) value = "";
|
|
88
22
|
@property({type: Boolean}) required = false;
|
|
89
23
|
@property({type: Boolean}) multiple = false;
|
|
@@ -103,6 +37,9 @@ export class StSelect extends LitElement {
|
|
|
103
37
|
@query(".combobox") private buttonElement!: HTMLElement;
|
|
104
38
|
@query(".search-input") private searchInputEl?: HTMLInputElement;
|
|
105
39
|
|
|
40
|
+
private _labelId = `select-label-${Math.random().toString(36).substring(2, 9)}`;
|
|
41
|
+
private _listboxId = `select-listbox-${Math.random().toString(36).substring(2, 9)}`;
|
|
42
|
+
|
|
106
43
|
static styles = css`
|
|
107
44
|
:host {
|
|
108
45
|
display: block;
|
|
@@ -118,6 +55,17 @@ export class StSelect extends LitElement {
|
|
|
118
55
|
margin-bottom: var(--st-spacing-xs);
|
|
119
56
|
}
|
|
120
57
|
|
|
58
|
+
.sr-only {
|
|
59
|
+
position: absolute;
|
|
60
|
+
width: 1px;
|
|
61
|
+
height: 1px;
|
|
62
|
+
padding: 0;
|
|
63
|
+
margin: -1px;
|
|
64
|
+
overflow: hidden;
|
|
65
|
+
clip: rect(0, 0, 0, 0);
|
|
66
|
+
border: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
121
69
|
.combobox {
|
|
122
70
|
display: flex;
|
|
123
71
|
justify-content: space-between;
|
|
@@ -184,7 +132,7 @@ export class StSelect extends LitElement {
|
|
|
184
132
|
top: calc(100% + 4px);
|
|
185
133
|
left: 0;
|
|
186
134
|
right: 0;
|
|
187
|
-
z-index:
|
|
135
|
+
z-index: 10;
|
|
188
136
|
background: var(--st-color-surface);
|
|
189
137
|
border: 1px solid var(--st-color-border);
|
|
190
138
|
border-radius: var(--st-radius-md);
|
|
@@ -264,19 +212,17 @@ export class StSelect extends LitElement {
|
|
|
264
212
|
this.handleClickOutside = this.handleClickOutside.bind(this);
|
|
265
213
|
}
|
|
266
214
|
|
|
267
|
-
// 2. Public API methods expected by st-form
|
|
268
215
|
public checkValidity(): boolean {
|
|
269
216
|
return this.internals.checkValidity();
|
|
270
217
|
}
|
|
271
218
|
|
|
272
219
|
public reportValidity(): boolean {
|
|
273
220
|
const isValid = this.checkValidity();
|
|
274
|
-
this.touched = true;
|
|
221
|
+
this.touched = true;
|
|
275
222
|
this.invalid = !isValid;
|
|
276
223
|
return isValid;
|
|
277
224
|
}
|
|
278
225
|
|
|
279
|
-
// 3. Override native focus to target the internal combobox button
|
|
280
226
|
public override focus(options?: FocusOptions) {
|
|
281
227
|
this.buttonElement?.focus(options);
|
|
282
228
|
}
|
|
@@ -297,6 +243,7 @@ export class StSelect extends LitElement {
|
|
|
297
243
|
}
|
|
298
244
|
|
|
299
245
|
override willUpdate(changedProperties: PropertyValues) {
|
|
246
|
+
super.willUpdate(changedProperties);
|
|
300
247
|
if (
|
|
301
248
|
changedProperties.has("value") ||
|
|
302
249
|
changedProperties.has("required") ||
|
|
@@ -333,6 +280,13 @@ export class StSelect extends LitElement {
|
|
|
333
280
|
}
|
|
334
281
|
}
|
|
335
282
|
|
|
283
|
+
formResetCallback() {
|
|
284
|
+
const initialValue = this.getAttribute("value") || "";
|
|
285
|
+
this.value = initialValue;
|
|
286
|
+
this.touched = false;
|
|
287
|
+
this.validate();
|
|
288
|
+
}
|
|
289
|
+
|
|
336
290
|
private handleClickOutside(e: Event) {
|
|
337
291
|
const path = e.composedPath();
|
|
338
292
|
if (!path.includes(this)) {
|
|
@@ -406,7 +360,6 @@ export class StSelect extends LitElement {
|
|
|
406
360
|
const currentValues = this.selectedValues;
|
|
407
361
|
const selectedOptions = this.options.filter((opt) => currentValues.includes(opt.value));
|
|
408
362
|
|
|
409
|
-
// 4. Update isInvalid to also respect the new property fallback
|
|
410
363
|
const isInvalid =
|
|
411
364
|
this.invalid || (this.touched && !this.internals.validity.valid) || !!this.error;
|
|
412
365
|
const displayError = isInvalid ? this.error || this.nativeError : "";
|
|
@@ -418,7 +371,11 @@ export class StSelect extends LitElement {
|
|
|
418
371
|
: this.options;
|
|
419
372
|
|
|
420
373
|
return html`
|
|
421
|
-
${this.label
|
|
374
|
+
${this.label
|
|
375
|
+
? html`<label id=${this._labelId} class=${classMap({"sr-only": this.hideLabel})}
|
|
376
|
+
>${this.label}</label
|
|
377
|
+
>`
|
|
378
|
+
: ""}
|
|
422
379
|
|
|
423
380
|
<button
|
|
424
381
|
type="button"
|
|
@@ -431,8 +388,8 @@ export class StSelect extends LitElement {
|
|
|
431
388
|
role="combobox"
|
|
432
389
|
aria-haspopup="listbox"
|
|
433
390
|
aria-expanded="${this.open}"
|
|
434
|
-
aria-labelledby
|
|
435
|
-
aria-controls
|
|
391
|
+
aria-labelledby=${ifDefined(this.label ? this._labelId : undefined)}
|
|
392
|
+
aria-controls=${this._listboxId}
|
|
436
393
|
@click=${this.toggleOpen}
|
|
437
394
|
@keydown=${this.handleButtonKeydown}
|
|
438
395
|
>
|
|
@@ -465,6 +422,8 @@ export class StSelect extends LitElement {
|
|
|
465
422
|
class="search-input"
|
|
466
423
|
placeholder="Search options..."
|
|
467
424
|
autocomplete="off"
|
|
425
|
+
spellcheck="false"
|
|
426
|
+
autocapitalize="none"
|
|
468
427
|
.value=${this.filterText}
|
|
469
428
|
@input=${this.handleSearchInput}
|
|
470
429
|
/>
|
|
@@ -473,7 +432,7 @@ export class StSelect extends LitElement {
|
|
|
473
432
|
: ""}
|
|
474
433
|
|
|
475
434
|
<ul
|
|
476
|
-
id
|
|
435
|
+
id=${this._listboxId}
|
|
477
436
|
class="listbox"
|
|
478
437
|
role="listbox"
|
|
479
438
|
aria-multiselectable="${this.multiple}"
|
|
@@ -495,6 +454,8 @@ export class StSelect extends LitElement {
|
|
|
495
454
|
})
|
|
496
455
|
: html`<li
|
|
497
456
|
class="option"
|
|
457
|
+
role="option"
|
|
458
|
+
aria-disabled="true"
|
|
498
459
|
style="color:var(--st-color-text-muted); cursor:default;"
|
|
499
460
|
>
|
|
500
461
|
No options found
|
|
@@ -508,7 +469,7 @@ export class StSelect extends LitElement {
|
|
|
508
469
|
<select
|
|
509
470
|
class="hidden-native"
|
|
510
471
|
name="${this.name}"
|
|
511
|
-
.autocomplete="${this.autocomplete}"
|
|
472
|
+
.autocomplete="${this.autocomplete as any}"
|
|
512
473
|
?multiple=${this.multiple}
|
|
513
474
|
tabindex="-1"
|
|
514
475
|
aria-hidden="true"
|
|
@@ -531,4 +492,4 @@ declare global {
|
|
|
531
492
|
interface HTMLElementTagNameMap {
|
|
532
493
|
"st-select": StSelect;
|
|
533
494
|
}
|
|
534
|
-
}
|
|
495
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
1
|
+
import { LitElement, html, css, PropertyValues } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import { resetStyles } from '../../styles/reset.js';
|
|
4
4
|
|
|
@@ -9,8 +9,14 @@ export class StSkeleton extends LitElement {
|
|
|
9
9
|
@property({ type: String }) width = '';
|
|
10
10
|
@property({ type: String }) height = '';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
this.setAttribute('role', 'status');
|
|
15
|
+
this.setAttribute('aria-label', 'Loading');
|
|
16
|
+
this.setAttribute('aria-busy', 'true');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override updated(changedProperties: PropertyValues<this>) {
|
|
14
20
|
super.updated(changedProperties);
|
|
15
21
|
|
|
16
22
|
if (changedProperties.has('width')) {
|
|
@@ -36,22 +42,20 @@ export class StSkeleton extends LitElement {
|
|
|
36
42
|
:host {
|
|
37
43
|
display: block;
|
|
38
44
|
|
|
39
|
-
/* Define base sizing variables that can be overridden by props */
|
|
40
45
|
--_width: var(--st-skeleton-width, 100%);
|
|
41
46
|
--_height: var(--st-skeleton-height, 1em);
|
|
42
47
|
|
|
43
|
-
/*
|
|
44
|
-
CRITICAL FIX: Apply sizing directly to the host.
|
|
45
|
-
This allows external classes and styles (like margin: auto) to work perfectly.
|
|
46
|
-
*/
|
|
47
48
|
width: var(--_width);
|
|
48
49
|
height: var(--_height);
|
|
49
50
|
|
|
50
|
-
/* Expose radius as a token for external theme overrides */
|
|
51
51
|
--st-skeleton-radius: var(--st-radius-sm, 0.25rem);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
:host([variant="text"]) {
|
|
55
|
+
display: inline-block;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
}
|
|
58
|
+
|
|
55
59
|
:host([variant="circular"]) {
|
|
56
60
|
--_width: var(--st-skeleton-width, 2.5rem);
|
|
57
61
|
--_height: var(--st-skeleton-height, 2.5rem);
|
|
@@ -62,7 +66,6 @@ export class StSkeleton extends LitElement {
|
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
.skeleton {
|
|
65
|
-
/* The inner element simply fills the host */
|
|
66
69
|
display: block;
|
|
67
70
|
width: 100%;
|
|
68
71
|
height: 100%;
|
|
@@ -76,7 +79,6 @@ export class StSkeleton extends LitElement {
|
|
|
76
79
|
background-size: 400% 100%;
|
|
77
80
|
border-radius: var(--st-skeleton-radius);
|
|
78
81
|
|
|
79
|
-
/* Prevent accidental selection */
|
|
80
82
|
user-select: none;
|
|
81
83
|
pointer-events: none;
|
|
82
84
|
}
|
|
@@ -85,7 +87,6 @@ export class StSkeleton extends LitElement {
|
|
|
85
87
|
border-radius: 50%;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
|
-
/* Animations */
|
|
89
90
|
:host([animation="shimmer"]) .skeleton {
|
|
90
91
|
animation: st-shimmer 1.4s ease infinite;
|
|
91
92
|
}
|
|
@@ -100,7 +101,6 @@ export class StSkeleton extends LitElement {
|
|
|
100
101
|
animation: none;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
|
-
/* Accessibility: Respect OS reduced motion settings */
|
|
104
104
|
@media (prefers-reduced-motion: reduce) {
|
|
105
105
|
.skeleton {
|
|
106
106
|
animation: none !important;
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import {LitElement, html, css, PropertyValues} from "lit";
|
|
2
2
|
import {customElement, property, query} from "lit/decorators.js";
|
|
3
|
+
import {ifDefined} from "lit/directives/if-defined.js";
|
|
3
4
|
import {resetStyles} from "../../styles/reset.js";
|
|
4
5
|
|
|
5
6
|
@customElement("st-switch")
|
|
6
7
|
export class StSwitch extends LitElement {
|
|
7
8
|
static formAssociated = true;
|
|
8
9
|
private _internals: ElementInternals;
|
|
10
|
+
static shadowRootOptions = {...LitElement.shadowRootOptions, delegatesFocus: true};
|
|
9
11
|
|
|
10
12
|
@query("input") private _inputEl!: HTMLInputElement;
|
|
11
13
|
|
|
12
14
|
@property({type: String, reflect: true}) name = "";
|
|
13
15
|
@property({type: String}) value = "on";
|
|
14
|
-
|
|
15
16
|
@property({type: Boolean, reflect: true}) checked = false;
|
|
16
17
|
@property({type: Boolean, reflect: true}) disabled = false;
|
|
17
18
|
@property({type: Boolean, reflect: true}) required = false;
|
|
18
|
-
|
|
19
19
|
@property({attribute: "aria-label"}) ariaLabel = "";
|
|
20
20
|
|
|
21
|
+
private _defaultChecked = false;
|
|
22
|
+
|
|
21
23
|
constructor() {
|
|
22
24
|
super();
|
|
23
25
|
this._internals = this.attachInternals();
|
|
@@ -41,7 +43,6 @@ export class StSwitch extends LitElement {
|
|
|
41
43
|
font-size: var(--st-font-size-base);
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
/* Visually hide the native input */
|
|
45
46
|
input {
|
|
46
47
|
position: absolute;
|
|
47
48
|
width: 1px;
|
|
@@ -54,12 +55,11 @@ export class StSwitch extends LitElement {
|
|
|
54
55
|
border-width: 0;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
/* The Switch Track (Pill) */
|
|
58
58
|
.track {
|
|
59
59
|
display: flex;
|
|
60
60
|
align-items: center;
|
|
61
|
-
width: 2.25rem;
|
|
62
|
-
height: 1.25rem;
|
|
61
|
+
width: 2.25rem;
|
|
62
|
+
height: 1.25rem;
|
|
63
63
|
background-color: var(--st-color-border);
|
|
64
64
|
border-radius: 999px;
|
|
65
65
|
padding: 2px;
|
|
@@ -69,40 +69,34 @@ export class StSwitch extends LitElement {
|
|
|
69
69
|
flex-shrink: 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
/* The Switch Thumb (Circle) */
|
|
73
72
|
.thumb {
|
|
74
|
-
width: 1rem;
|
|
75
|
-
height: 1rem;
|
|
76
|
-
background-color:
|
|
73
|
+
width: 1rem;
|
|
74
|
+
height: 1rem;
|
|
75
|
+
background-color: #ffffff; /* Explicitly white for contrast */
|
|
77
76
|
border-radius: 50%;
|
|
78
77
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
|
79
78
|
transform: translateX(0);
|
|
80
79
|
transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
81
80
|
}
|
|
82
81
|
|
|
83
|
-
|
|
82
|
+
label:hover input:not(:checked):not(:disabled) + .track {
|
|
83
|
+
background-color: var(--st-color-text-muted);
|
|
84
|
+
}
|
|
85
|
+
|
|
84
86
|
input:focus-visible + .track {
|
|
85
87
|
box-shadow:
|
|
86
88
|
0 0 0 2px var(--st-color-bg),
|
|
87
89
|
0 0 0 4px var(--st-color-primary);
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
/* Checked State */
|
|
91
92
|
:host([checked]) .track {
|
|
92
93
|
background-color: var(--st-color-primary);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
:host([checked]) .thumb {
|
|
96
|
-
/* Move thumb to the right: Track width (36px) - Padding (4px) - Thumb width (16px) = 16px */
|
|
97
97
|
transform: translateX(16px);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
/* Hover State (Subtle darkening of the track if unchecked) */
|
|
101
|
-
label:hover input:not(:checked) + .track {
|
|
102
|
-
background-color: var(--st-color-text-muted);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/* Disabled State */
|
|
106
100
|
:host([disabled]) {
|
|
107
101
|
pointer-events: none;
|
|
108
102
|
}
|
|
@@ -114,16 +108,21 @@ export class StSwitch extends LitElement {
|
|
|
114
108
|
`,
|
|
115
109
|
];
|
|
116
110
|
|
|
111
|
+
override firstUpdated(changedProperties: PropertyValues) {
|
|
112
|
+
super.firstUpdated(changedProperties);
|
|
113
|
+
this._defaultChecked = this.checked;
|
|
114
|
+
}
|
|
115
|
+
|
|
117
116
|
override updated(changedProperties: PropertyValues<this>) {
|
|
118
117
|
super.updated(changedProperties);
|
|
119
118
|
|
|
120
119
|
if (changedProperties.has("checked") || changedProperties.has("value")) {
|
|
121
120
|
this._internals.setFormValue(this.checked ? this.value : null);
|
|
122
|
-
this._syncValidity();
|
|
121
|
+
this.updateComplete.then(() => this._syncValidity());
|
|
123
122
|
}
|
|
124
123
|
|
|
125
124
|
if (changedProperties.has("required")) {
|
|
126
|
-
this._syncValidity();
|
|
125
|
+
this.updateComplete.then(() => this._syncValidity());
|
|
127
126
|
}
|
|
128
127
|
}
|
|
129
128
|
|
|
@@ -136,15 +135,22 @@ export class StSwitch extends LitElement {
|
|
|
136
135
|
);
|
|
137
136
|
}
|
|
138
137
|
|
|
138
|
+
public checkValidity() {
|
|
139
|
+
return this._internals.checkValidity();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public reportValidity() {
|
|
143
|
+
return this._internals.reportValidity();
|
|
144
|
+
}
|
|
145
|
+
|
|
139
146
|
formResetCallback() {
|
|
140
|
-
this.checked =
|
|
141
|
-
this._internals.setFormValue(null);
|
|
147
|
+
this.checked = this._defaultChecked;
|
|
148
|
+
this._internals.setFormValue(this.checked ? this.value : null);
|
|
142
149
|
this.updateComplete.then(() => this._syncValidity());
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
private _handleChange(e: Event) {
|
|
146
153
|
e.stopPropagation();
|
|
147
|
-
|
|
148
154
|
if (this.disabled) return;
|
|
149
155
|
|
|
150
156
|
this.checked = this._inputEl.checked;
|
|
@@ -157,7 +163,7 @@ export class StSwitch extends LitElement {
|
|
|
157
163
|
<input
|
|
158
164
|
type="checkbox"
|
|
159
165
|
role="switch"
|
|
160
|
-
aria-label=${this.ariaLabel ||
|
|
166
|
+
aria-label=${ifDefined(this.ariaLabel || undefined)}
|
|
161
167
|
.name=${this.name}
|
|
162
168
|
.value=${this.value}
|
|
163
169
|
.checked=${this.checked}
|