@solid-design-system/components 1.31.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/es/checkbox.js +1 -1
- package/dist/components/es/default-value.js +1 -0
- package/dist/components/es/drawer.js +1 -1
- package/dist/components/es/dropdown.js +1 -1
- package/dist/components/es/form-control.styles.js +1 -0
- package/dist/components/es/icon.js +3 -4
- package/dist/components/es/input.js +1 -1
- package/dist/components/es/live.js +3 -3
- package/dist/components/es/option.js +1 -0
- package/dist/components/es/popup.js +1 -1
- package/dist/components/es/scroll.js +1 -0
- package/dist/components/es/select.js +5 -0
- package/dist/components/es/solid-components2.js +1 -1
- package/dist/components/es/solid-element.js +1 -1
- package/dist/components/es/switch.js +1 -1
- package/dist/components/es/tabbable.js +1 -1
- package/dist/components/es/tag.js +1 -1
- package/dist/components/umd/solid-components.js +25 -22
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/option/option.d.ts +30 -0
- package/dist/package/components/option/option.js +145 -0
- package/dist/package/components/popup/popup.d.ts +3 -0
- package/dist/package/components/popup/popup.js +17 -0
- package/dist/package/components/select/select.d.ts +101 -0
- package/dist/package/components/select/select.js +700 -0
- package/dist/package/components/tag/tag.d.ts +1 -0
- package/dist/package/components/tag/tag.js +5 -3
- package/dist/package/solid-components.d.ts +2 -0
- package/dist/package/solid-components.js +22 -18
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/package/translations/en.js +3 -4
- package/dist/package/utilities/localize.d.ts +1 -0
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -1
- package/dist/versioned-components/es/carousel-item.js +1 -1
- package/dist/versioned-components/es/carousel.js +3 -3
- package/dist/versioned-components/es/checkbox-group.js +1 -1
- package/dist/versioned-components/es/checkbox.js +1 -1
- package/dist/versioned-components/es/default-value.js +1 -0
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -1
- package/dist/versioned-components/es/dropdown.js +1 -1
- package/dist/versioned-components/es/form-control.styles.js +1 -0
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/header.js +1 -1
- package/dist/versioned-components/es/icon.js +3 -4
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/input.js +1 -1
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/live.js +3 -3
- package/dist/versioned-components/es/navigation-item.js +1 -1
- package/dist/versioned-components/es/notification.js +1 -1
- package/dist/versioned-components/es/option.js +1 -0
- package/dist/versioned-components/es/popup.js +1 -1
- package/dist/versioned-components/es/radio-group.js +1 -1
- package/dist/versioned-components/es/radio.js +1 -1
- package/dist/versioned-components/es/scroll.js +1 -0
- package/dist/versioned-components/es/select.js +5 -0
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/solid-element.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/switch.js +1 -1
- package/dist/versioned-components/es/tabbable.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/tooltip.js +2 -2
- package/dist/versioned-components/es/video.js +1 -1
- package/dist/versioned-package/_components/button-group/button-group.d.ts +1 -1
- package/dist/versioned-package/_components/button-group/button-group.js +11 -11
- package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/badge/badge.d.ts +1 -1
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +4 -4
- package/dist/versioned-package/components/carousel/carousel.d.ts +1 -1
- package/dist/versioned-package/components/carousel/carousel.js +6 -6
- package/dist/versioned-package/components/carousel-item/carousel-item.d.ts +1 -1
- package/dist/versioned-package/components/carousel-item/carousel-item.js +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.d.ts +1 -1
- package/dist/versioned-package/components/checkbox/checkbox.js +4 -4
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +1 -1
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +5 -5
- package/dist/versioned-package/components/divider/divider.d.ts +1 -1
- package/dist/versioned-package/components/divider/divider.js +2 -2
- package/dist/versioned-package/components/drawer/drawer.d.ts +1 -1
- package/dist/versioned-package/components/drawer/drawer.js +2 -2
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/versioned-package/components/dropdown/dropdown.js +8 -8
- package/dist/versioned-package/components/header/header.d.ts +1 -1
- package/dist/versioned-package/components/header/header.js +4 -4
- package/dist/versioned-package/components/icon/icon.d.ts +1 -1
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/include/include.d.ts +1 -1
- package/dist/versioned-package/components/include/include.js +1 -1
- package/dist/versioned-package/components/input/input.d.ts +1 -1
- package/dist/versioned-package/components/input/input.js +4 -4
- package/dist/versioned-package/components/link/link.d.ts +1 -1
- package/dist/versioned-package/components/link/link.js +2 -2
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +3 -3
- package/dist/versioned-package/components/notification/notification.d.ts +1 -1
- package/dist/versioned-package/components/notification/notification.js +5 -5
- package/dist/versioned-package/components/option/option.d.ts +30 -0
- package/dist/versioned-package/components/option/option.js +145 -0
- package/dist/versioned-package/components/popup/popup.d.ts +4 -1
- package/dist/versioned-package/components/popup/popup.js +18 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.js +14 -14
- package/dist/versioned-package/components/select/select.d.ts +101 -0
- package/dist/versioned-package/components/select/select.js +700 -0
- package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/switch/switch.d.ts +1 -1
- package/dist/versioned-package/components/switch/switch.js +2 -2
- package/dist/versioned-package/components/tag/tag.d.ts +2 -1
- package/dist/versioned-package/components/tag/tag.js +6 -4
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.js +5 -5
- package/dist/versioned-package/components/video/video.d.ts +1 -1
- package/dist/versioned-package/components/video/video.js +2 -2
- package/dist/versioned-package/internal/form.js +2 -2
- package/dist/versioned-package/solid-components.d.ts +2 -0
- package/dist/versioned-package/solid-components.js +22 -18
- package/dist/versioned-package/styles/form-control.styles.js +1 -1
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-package/translations/en.js +3 -4
- package/dist/versioned-package/utilities/localize.d.ts +1 -0
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +346 -32
- package/dist/web-types.json +790 -82
- package/package.json +3 -3
|
@@ -129,7 +129,7 @@ let SdNotification = class extends SolidElement {
|
|
|
129
129
|
() => {
|
|
130
130
|
toastStack.removeChild(this);
|
|
131
131
|
resolve();
|
|
132
|
-
if (toastStack.querySelector("sd-1-
|
|
132
|
+
if (toastStack.querySelector("sd-1-32-0-notification") === null) {
|
|
133
133
|
toastStack.remove();
|
|
134
134
|
}
|
|
135
135
|
},
|
|
@@ -146,15 +146,15 @@ let SdNotification = class extends SolidElement {
|
|
|
146
146
|
warning: "bg-warning",
|
|
147
147
|
error: "bg-error"
|
|
148
148
|
}[this.variant]
|
|
149
|
-
)}"><sd-1-
|
|
149
|
+
)}"><sd-1-32-0-icon name="${{
|
|
150
150
|
info: "info-circle",
|
|
151
151
|
success: "confirm-circle",
|
|
152
152
|
warning: "exclamation-circle",
|
|
153
153
|
error: "warning"
|
|
154
|
-
}[this.variant] || ""}" library="system" class="h-6 w-6 text-white"></sd-1-
|
|
154
|
+
}[this.variant] || ""}" library="system" class="h-6 w-6 text-white"></sd-1-32-0-icon></slot><div part="content" class="${cx(
|
|
155
155
|
"h-full w-full p-1 gap-2 flex items-center justify-stretch bg-white",
|
|
156
156
|
"border-solid border-[1px] border-l-0 border-neutral-400"
|
|
157
|
-
)}"><slot part="message" class="block w-full pl-3 py-2" aria-live="polite"></slot>${this.closable ? html`<sd-1-
|
|
157
|
+
)}"><slot part="message" class="block w-full pl-3 py-2" aria-live="polite"></slot>${this.closable ? html`<sd-1-32-0-button size="md" variant="tertiary" part="close-button" class="ml-auto flex flex-[0_0_auto] items-stretch" label="${this.localize.term("close")}" @click="${this.handleCloseClick}"><sd-1-32-0-icon name="close" library="system" color="currentColor"></sd-1-32-0-icon></sd-1-32-0-button>` : ""}</div>${this.durationIndicator ? html`<div part="duration-indicator__elapsed" id="duration-indicator__elapsed" style="${`animation-duration: ${this.duration}ms`}" class="${cx(`absolute w-0 h-[2px] bottom-0 bg-primary z-10 animate-grow`)}"></div><div part="duration-indicator__total" class="w-full h-[2px] bottom-0 absolute bg-neutral-400"></div>` : ""}</div>`;
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
160
|
SdNotification.styles = [
|
|
@@ -190,7 +190,7 @@ __decorateClass([
|
|
|
190
190
|
watch("duration")
|
|
191
191
|
], SdNotification.prototype, "handleDurationChange", 1);
|
|
192
192
|
SdNotification = __decorateClass([
|
|
193
|
-
customElement("sd-1-
|
|
193
|
+
customElement("sd-1-32-0-notification")
|
|
194
194
|
], SdNotification);
|
|
195
195
|
setDefaultAnimation("notification.show", {
|
|
196
196
|
keyframes: [
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import '../icon/icon';
|
|
2
|
+
import SolidElement from '../../internal/solid-element';
|
|
3
|
+
export default class SdOption extends SolidElement {
|
|
4
|
+
private readonly hasSlotController;
|
|
5
|
+
private cachedTextLabel;
|
|
6
|
+
private readonly localize;
|
|
7
|
+
defaultSlot: HTMLSlotElement;
|
|
8
|
+
current: boolean;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
hasHover: boolean;
|
|
11
|
+
size: 'lg' | 'md' | 'sm';
|
|
12
|
+
checkbox: boolean;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
value: string;
|
|
15
|
+
connectedCallback(): void;
|
|
16
|
+
private handleDefaultSlotChange;
|
|
17
|
+
private handleMouseEnter;
|
|
18
|
+
private handleMouseLeave;
|
|
19
|
+
handleDisabledChange(): void;
|
|
20
|
+
handleSelectedChange(): void;
|
|
21
|
+
handleValueChange(): void;
|
|
22
|
+
getTextLabel(): string;
|
|
23
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
24
|
+
static styles: import("lit").CSSResultGroup[];
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
'sd-1-32-0-option': SdOption;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import "../icon/icon.js";
|
|
2
|
+
import { css, html } from "lit";
|
|
3
|
+
import { customElement } from "../../internal/register-custom-element.js";
|
|
4
|
+
import { HasSlotController } from "../../internal/slot.js";
|
|
5
|
+
import { LocalizeController } from "../../utilities/localize.js";
|
|
6
|
+
import { query, state, property } from "lit/decorators.js";
|
|
7
|
+
import { watch } from "../../internal/watch.js";
|
|
8
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
9
|
+
import cx from "classix";
|
|
10
|
+
import formControlStyles from "../../styles/form-control.styles.js";
|
|
11
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result)
|
|
20
|
+
__defProp(target, key, result);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
let SdOption = class extends SolidElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.hasSlotController = new HasSlotController(this, "default", "left", "right");
|
|
27
|
+
this.localize = new LocalizeController(this);
|
|
28
|
+
this.current = false;
|
|
29
|
+
this.selected = false;
|
|
30
|
+
this.hasHover = false;
|
|
31
|
+
this.size = "lg";
|
|
32
|
+
this.checkbox = false;
|
|
33
|
+
this.disabled = false;
|
|
34
|
+
this.value = "";
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.setAttribute("role", "option");
|
|
39
|
+
this.setAttribute("aria-selected", "false");
|
|
40
|
+
}
|
|
41
|
+
handleDefaultSlotChange() {
|
|
42
|
+
const textLabel = this.getTextLabel();
|
|
43
|
+
if (typeof this.cachedTextLabel === "undefined") {
|
|
44
|
+
this.cachedTextLabel = textLabel;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (textLabel !== this.cachedTextLabel) {
|
|
48
|
+
this.cachedTextLabel = textLabel;
|
|
49
|
+
this.emit("slotchange", { bubbles: true, composed: false, cancelable: false });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleMouseEnter() {
|
|
53
|
+
this.hasHover = true;
|
|
54
|
+
}
|
|
55
|
+
handleMouseLeave() {
|
|
56
|
+
this.hasHover = false;
|
|
57
|
+
}
|
|
58
|
+
handleDisabledChange() {
|
|
59
|
+
this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
|
|
60
|
+
}
|
|
61
|
+
handleSelectedChange() {
|
|
62
|
+
this.setAttribute("aria-selected", this.selected ? "true" : "false");
|
|
63
|
+
}
|
|
64
|
+
handleValueChange() {
|
|
65
|
+
if (this.value.includes(" ")) {
|
|
66
|
+
console.error(`Option values cannot include a space. All spaces have been replaced with underscores.`, this);
|
|
67
|
+
this.value = this.value.replace(/ /g, "_");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Returns a plain text label based on the option's content. */
|
|
71
|
+
getTextLabel() {
|
|
72
|
+
return (this.textContent ?? "").trim();
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
const slots = {
|
|
76
|
+
default: this.hasSlotController.test("default"),
|
|
77
|
+
left: this.hasSlotController.test("left"),
|
|
78
|
+
right: this.hasSlotController.test("right")
|
|
79
|
+
};
|
|
80
|
+
return html`<div part="base" class="${cx(
|
|
81
|
+
"px-4 flex items-center w-full transition-all text-left text-base relative text-black",
|
|
82
|
+
{
|
|
83
|
+
sm: "text-sm py-1",
|
|
84
|
+
md: "text-base py-2",
|
|
85
|
+
lg: "text-base py-3"
|
|
86
|
+
}[this.size],
|
|
87
|
+
this.disabled ? "text-neutral-500 cursor-not-allowed" : "cursor-pointer",
|
|
88
|
+
this.hasHover && !this.disabled ? "bg-neutral-200" : "",
|
|
89
|
+
this.current && "bg-neutral-200"
|
|
90
|
+
)}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}"><span class="${cx(
|
|
91
|
+
"absolute w-full left-0 top-0 pointer-events-none transition-all duration-150 border-l-4 h-[calc(100%-8px)]",
|
|
92
|
+
this.selected && !this.checkbox ? "border-accent" : "border-transparent",
|
|
93
|
+
this.disabled && "border-neutral-500 top-1",
|
|
94
|
+
!this.disabled && this.hasHover ? "h-full top-0" : "top-1"
|
|
95
|
+
)}"></span> ${this.checkbox ? html`<span id="control" part="control ${this.selected ? " control--checked" : "control--unchecked"}" class="${cx(
|
|
96
|
+
"relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4 mr-2",
|
|
97
|
+
this.disabled ? "border-neutral-500" : this.selected ? "bg-accent border-accent" : "border-neutral-800"
|
|
98
|
+
)}">${this.selected ? html`<sd-1-32-0-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-hook"></sd-1-32-0-icon>` : ""}</span>` : ""} ${slots["left"] ? html`<slot name="left" part="left" class="inline-flex mr-2"></slot>` : ""}<slot part="label" class="inline-block flex-grow" @slotchange="${this.handleDefaultSlotChange}"></slot>${slots["right"] ? html`<slot name="right" part="right" class="inline-flex ml-2"></slot>` : ""}</div>`;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
SdOption.styles = [
|
|
102
|
+
componentStyles,
|
|
103
|
+
formControlStyles,
|
|
104
|
+
SolidElement.styles,
|
|
105
|
+
css`:host{outline:0!important;display:block;position:relative;width:100%}`
|
|
106
|
+
];
|
|
107
|
+
__decorateClass([
|
|
108
|
+
query('[part="base"]')
|
|
109
|
+
], SdOption.prototype, "defaultSlot", 2);
|
|
110
|
+
__decorateClass([
|
|
111
|
+
state()
|
|
112
|
+
], SdOption.prototype, "current", 2);
|
|
113
|
+
__decorateClass([
|
|
114
|
+
state()
|
|
115
|
+
], SdOption.prototype, "selected", 2);
|
|
116
|
+
__decorateClass([
|
|
117
|
+
state()
|
|
118
|
+
], SdOption.prototype, "hasHover", 2);
|
|
119
|
+
__decorateClass([
|
|
120
|
+
property({ reflect: true })
|
|
121
|
+
], SdOption.prototype, "size", 2);
|
|
122
|
+
__decorateClass([
|
|
123
|
+
property({ type: Boolean, reflect: true })
|
|
124
|
+
], SdOption.prototype, "checkbox", 2);
|
|
125
|
+
__decorateClass([
|
|
126
|
+
property({ type: Boolean, reflect: true })
|
|
127
|
+
], SdOption.prototype, "disabled", 2);
|
|
128
|
+
__decorateClass([
|
|
129
|
+
property({ reflect: true })
|
|
130
|
+
], SdOption.prototype, "value", 2);
|
|
131
|
+
__decorateClass([
|
|
132
|
+
watch("disabled")
|
|
133
|
+
], SdOption.prototype, "handleDisabledChange", 1);
|
|
134
|
+
__decorateClass([
|
|
135
|
+
watch("selected")
|
|
136
|
+
], SdOption.prototype, "handleSelectedChange", 1);
|
|
137
|
+
__decorateClass([
|
|
138
|
+
watch("value")
|
|
139
|
+
], SdOption.prototype, "handleValueChange", 1);
|
|
140
|
+
SdOption = __decorateClass([
|
|
141
|
+
customElement("sd-1-32-0-option")
|
|
142
|
+
], SdOption);
|
|
143
|
+
export {
|
|
144
|
+
SdOption as default
|
|
145
|
+
};
|
|
@@ -2,6 +2,7 @@ import SolidElement from '../../internal/solid-element';
|
|
|
2
2
|
export default class SdPopup extends SolidElement {
|
|
3
3
|
private anchorEl;
|
|
4
4
|
private cleanup;
|
|
5
|
+
private mutationObserver;
|
|
5
6
|
popup: HTMLElement;
|
|
6
7
|
private arrowEl;
|
|
7
8
|
anchor: Element | string;
|
|
@@ -28,6 +29,8 @@ export default class SdPopup extends SolidElement {
|
|
|
28
29
|
connectedCallback(): Promise<void>;
|
|
29
30
|
disconnectedCallback(): void;
|
|
30
31
|
updated(changedProps: Map<string, unknown>): Promise<void>;
|
|
32
|
+
private setupMutationObserver;
|
|
33
|
+
private handleCurrentPlacementChange;
|
|
31
34
|
private handleAnchorChange;
|
|
32
35
|
private start;
|
|
33
36
|
private stop;
|
|
@@ -37,6 +40,6 @@ export default class SdPopup extends SolidElement {
|
|
|
37
40
|
}
|
|
38
41
|
declare global {
|
|
39
42
|
interface HTMLElementTagNameMap {
|
|
40
|
-
'sd-1-
|
|
43
|
+
'sd-1-32-0-popup': SdPopup;
|
|
41
44
|
}
|
|
42
45
|
}
|
|
@@ -39,9 +39,13 @@ let SdPopup = class extends SolidElement {
|
|
|
39
39
|
super.connectedCallback();
|
|
40
40
|
await this.updateComplete;
|
|
41
41
|
this.start();
|
|
42
|
+
this.setupMutationObserver();
|
|
42
43
|
}
|
|
43
44
|
disconnectedCallback() {
|
|
44
45
|
this.stop();
|
|
46
|
+
if (this.mutationObserver) {
|
|
47
|
+
this.mutationObserver.disconnect();
|
|
48
|
+
}
|
|
45
49
|
}
|
|
46
50
|
async updated(changedProps) {
|
|
47
51
|
super.updated(changedProps);
|
|
@@ -60,6 +64,19 @@ let SdPopup = class extends SolidElement {
|
|
|
60
64
|
this.reposition();
|
|
61
65
|
}
|
|
62
66
|
}
|
|
67
|
+
setupMutationObserver() {
|
|
68
|
+
this.mutationObserver = new MutationObserver((mutations) => this.handleCurrentPlacementChange(mutations));
|
|
69
|
+
const config = { attributes: true };
|
|
70
|
+
this.mutationObserver.observe(this, config);
|
|
71
|
+
}
|
|
72
|
+
handleCurrentPlacementChange(mutations) {
|
|
73
|
+
return mutations.forEach((mutation) => {
|
|
74
|
+
if (mutation.attributeName === "data-current-placement") {
|
|
75
|
+
const currentPlacement = this.getAttribute("data-current-placement");
|
|
76
|
+
this.emit("sd-current-placement", { detail: currentPlacement });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
63
80
|
async handleAnchorChange() {
|
|
64
81
|
await this.stop();
|
|
65
82
|
if (this.anchor && typeof this.anchor === "string") {
|
|
@@ -312,7 +329,7 @@ __decorateClass([
|
|
|
312
329
|
property({ attribute: "auto-size-padding", type: Number })
|
|
313
330
|
], SdPopup.prototype, "autoSizePadding", 2);
|
|
314
331
|
SdPopup = __decorateClass([
|
|
315
|
-
customElement("sd-1-
|
|
332
|
+
customElement("sd-1-32-0-popup")
|
|
316
333
|
], SdPopup);
|
|
317
334
|
export {
|
|
318
335
|
SdPopup as default
|
|
@@ -73,7 +73,7 @@ let SdRadio = class extends SolidElement {
|
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
75
|
return html`<span part="base" class="${cx(
|
|
76
|
-
"sd-1-
|
|
76
|
+
"sd-1-32-0-radio group inline-flex items-start items-center text-base leading-normal text-black cursor-pointer align-middle",
|
|
77
77
|
this.disabled && "hover:cursor-not-allowed",
|
|
78
78
|
{
|
|
79
79
|
/* sizes, fonts */
|
|
@@ -121,7 +121,7 @@ __decorateClass([
|
|
|
121
121
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
122
122
|
], SdRadio.prototype, "handleDisabledChange", 1);
|
|
123
123
|
SdRadio = __decorateClass([
|
|
124
|
-
customElement("sd-1-
|
|
124
|
+
customElement("sd-1-32-0-radio")
|
|
125
125
|
], SdRadio);
|
|
126
126
|
export {
|
|
127
127
|
SdRadio as default
|
|
@@ -4,7 +4,7 @@ import SolidElement from '../../internal/solid-element';
|
|
|
4
4
|
import type { SolidFormControl } from '../../internal/solid-element';
|
|
5
5
|
export default class SdRadioGroup extends SolidElement implements SolidFormControl {
|
|
6
6
|
static dependencies: {
|
|
7
|
-
'sd-1-
|
|
7
|
+
'sd-1-32-0-button-group': typeof SdButtonGroup;
|
|
8
8
|
};
|
|
9
9
|
protected readonly formControlController: FormControlController;
|
|
10
10
|
private readonly hasSlotController;
|
|
@@ -47,6 +47,6 @@ export default class SdRadioGroup extends SolidElement implements SolidFormContr
|
|
|
47
47
|
}
|
|
48
48
|
declare global {
|
|
49
49
|
interface HTMLElementTagNameMap {
|
|
50
|
-
'sd-1-
|
|
50
|
+
'sd-1-32-0-radio-group': SdRadioGroup;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -72,10 +72,10 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
72
72
|
this.formControlController.updateValidity();
|
|
73
73
|
}
|
|
74
74
|
getAllRadios() {
|
|
75
|
-
return [...this.querySelectorAll("sd-1-
|
|
75
|
+
return [...this.querySelectorAll("sd-1-32-0-radio, sd-1-32-0-radio-button")];
|
|
76
76
|
}
|
|
77
77
|
handleRadioClick(event) {
|
|
78
|
-
const target = event.target.closest("sd-1-
|
|
78
|
+
const target = event.target.closest("sd-1-32-0-radio, sd-1-32-0-radio-button");
|
|
79
79
|
const radios = this.getAllRadios();
|
|
80
80
|
const oldValue = this.value;
|
|
81
81
|
if (target.disabled) {
|
|
@@ -85,7 +85,7 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
85
85
|
radios.forEach((radio) => radio.checked = radio === target);
|
|
86
86
|
if (this.value !== oldValue) {
|
|
87
87
|
this.emit("sd-change");
|
|
88
|
-
this.emit("sd-1-
|
|
88
|
+
this.emit("sd-1-32-0-input");
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
handleKeyDown(event) {
|
|
@@ -119,7 +119,7 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
119
119
|
}
|
|
120
120
|
if (this.value !== oldValue) {
|
|
121
121
|
this.emit("sd-change");
|
|
122
|
-
this.emit("sd-1-
|
|
122
|
+
this.emit("sd-1-32-0-input");
|
|
123
123
|
}
|
|
124
124
|
event.preventDefault();
|
|
125
125
|
}
|
|
@@ -147,7 +147,7 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
147
147
|
radio.invalid = this.invalid;
|
|
148
148
|
})
|
|
149
149
|
);
|
|
150
|
-
this.hasButtonGroup = radios.some((radio) => radio.tagName.toLowerCase() === "sd-1-
|
|
150
|
+
this.hasButtonGroup = radios.some((radio) => radio.tagName.toLowerCase() === "sd-1-32-0-radio-button");
|
|
151
151
|
if (!radios.some((radio) => radio.checked)) {
|
|
152
152
|
if (this.hasButtonGroup) {
|
|
153
153
|
const buttonRadio = (_a = radios[0].shadowRoot) == null ? void 0 : _a.querySelector("button");
|
|
@@ -159,26 +159,26 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
if (this.hasButtonGroup) {
|
|
162
|
-
const buttonGroup = (_b = this.shadowRoot) == null ? void 0 : _b.querySelector("sd-1-
|
|
162
|
+
const buttonGroup = (_b = this.shadowRoot) == null ? void 0 : _b.querySelector("sd-1-32-0-button-group");
|
|
163
163
|
if (buttonGroup) {
|
|
164
164
|
buttonGroup.disableRole = true;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
syncRadios() {
|
|
169
|
-
if (customElements.get("sd-1-
|
|
169
|
+
if (customElements.get("sd-1-32-0-radio") && customElements.get("sd-1-32-0-radio-button")) {
|
|
170
170
|
this.syncRadioElements();
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
if (customElements.get("sd-1-
|
|
173
|
+
if (customElements.get("sd-1-32-0-radio")) {
|
|
174
174
|
this.syncRadioElements();
|
|
175
175
|
} else {
|
|
176
|
-
customElements.whenDefined("sd-1-
|
|
176
|
+
customElements.whenDefined("sd-1-32-0-radio").then(() => this.syncRadios());
|
|
177
177
|
}
|
|
178
|
-
if (customElements.get("sd-1-
|
|
178
|
+
if (customElements.get("sd-1-32-0-radio-button")) {
|
|
179
179
|
this.syncRadioElements();
|
|
180
180
|
} else {
|
|
181
|
-
customElements.whenDefined("sd-1-
|
|
181
|
+
customElements.whenDefined("sd-1-32-0-radio-button").then(() => this.syncRadios());
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
updateCheckedRadio() {
|
|
@@ -258,11 +258,11 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
258
258
|
)}"><div class="sr-only"><div id="error-message" aria-live="assertive">${this.errorText}</div><label><input id="validation-input" type="text" ?required="${this.required}" tabindex="-1" hidden @invalid="${this.handleInvalid}"></label></div>${defaultSlot}</div></fieldset>`;
|
|
259
259
|
}
|
|
260
260
|
};
|
|
261
|
-
SdRadioGroup.dependencies = { "sd-1-
|
|
261
|
+
SdRadioGroup.dependencies = { "sd-1-32-0-button-group": SdButtonGroup };
|
|
262
262
|
SdRadioGroup.styles = [
|
|
263
263
|
componentStyles,
|
|
264
264
|
SolidElement.styles,
|
|
265
|
-
css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-1-
|
|
265
|
+
css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-1-32-0-radio){margin-bottom:8px;display:flex}:host([orientation=vertical]) ::slotted(sd-1-32-0-radio:last-of-type){margin-bottom:0}:host([orientation=horizontal]) ::slotted(sd-1-32-0-radio){margin-right:24px}:host([size=sm]):host([orientation=horizontal]) ::slotted(sd-1-32-0-radio){margin-right:16px}:host([orientation=horizontal]) ::slotted(sd-1-32-0-radio:last-of-type){margin-right:0}:host([required]) #label.has-label::after{content:'*';margin-left:2px}`
|
|
266
266
|
];
|
|
267
267
|
__decorateClass([
|
|
268
268
|
query("slot:not([name])")
|
|
@@ -313,7 +313,7 @@ __decorateClass([
|
|
|
313
313
|
watch("value")
|
|
314
314
|
], SdRadioGroup.prototype, "handleValueChange", 1);
|
|
315
315
|
SdRadioGroup = __decorateClass([
|
|
316
|
-
customElement("sd-1-
|
|
316
|
+
customElement("sd-1-32-0-radio-group")
|
|
317
317
|
], SdRadioGroup);
|
|
318
318
|
export {
|
|
319
319
|
SdRadioGroup as default
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import SdIcon from '../icon/icon';
|
|
2
|
+
import SdPopup from '../popup/popup';
|
|
3
|
+
import SdTag from '../tag/tag';
|
|
4
|
+
import SolidElement from '../../internal/solid-element';
|
|
5
|
+
import type { SolidFormControl } from '../../internal/solid-element';
|
|
6
|
+
import type { TemplateResult } from 'lit';
|
|
7
|
+
import type SdOption from '../option/option';
|
|
8
|
+
export default class SdSelect extends SolidElement implements SolidFormControl {
|
|
9
|
+
static dependencies: {
|
|
10
|
+
'sd-1-32-0-icon': typeof SdIcon;
|
|
11
|
+
'sd-1-32-0-popup': typeof SdPopup;
|
|
12
|
+
'sd-1-32-0-tag': typeof SdTag;
|
|
13
|
+
};
|
|
14
|
+
private readonly formControlController;
|
|
15
|
+
private readonly hasSlotController;
|
|
16
|
+
private readonly localize;
|
|
17
|
+
private typeToSelectString;
|
|
18
|
+
private typeToSelectTimeout;
|
|
19
|
+
_optionsInDefaultSlot: SdOption[];
|
|
20
|
+
popup: SdPopup;
|
|
21
|
+
combobox: HTMLSlotElement;
|
|
22
|
+
displayInput: HTMLInputElement;
|
|
23
|
+
valueInput: HTMLInputElement;
|
|
24
|
+
listbox: HTMLSlotElement;
|
|
25
|
+
private hasFocus;
|
|
26
|
+
hasHover: boolean;
|
|
27
|
+
private displayLabel;
|
|
28
|
+
private currentOption;
|
|
29
|
+
private selectedOptions;
|
|
30
|
+
private isValid;
|
|
31
|
+
private isInvalid;
|
|
32
|
+
defaultValue: string | string[];
|
|
33
|
+
open: boolean;
|
|
34
|
+
size: 'lg' | 'md' | 'sm';
|
|
35
|
+
label: string;
|
|
36
|
+
placeholder: string;
|
|
37
|
+
helpText: string;
|
|
38
|
+
placement: 'top' | 'bottom';
|
|
39
|
+
private currentPlacement;
|
|
40
|
+
clearable: boolean;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
multiple: boolean;
|
|
43
|
+
useTags: boolean;
|
|
44
|
+
maxOptionsVisible: number;
|
|
45
|
+
form: string;
|
|
46
|
+
name: string;
|
|
47
|
+
value: string | string[];
|
|
48
|
+
required: boolean;
|
|
49
|
+
hoist: boolean;
|
|
50
|
+
getTag: (option: SdOption, index: number) => TemplateResult | string | HTMLElement;
|
|
51
|
+
get validity(): ValidityState;
|
|
52
|
+
get validationMessage(): string;
|
|
53
|
+
connectedCallback(): void;
|
|
54
|
+
updated(): void;
|
|
55
|
+
private addOpenListeners;
|
|
56
|
+
private removeOpenListeners;
|
|
57
|
+
private handleFocus;
|
|
58
|
+
private handleBlur;
|
|
59
|
+
private handleDocumentFocusIn;
|
|
60
|
+
private handleDocumentKeyDown;
|
|
61
|
+
private handleDocumentMouseDown;
|
|
62
|
+
private handleLabelClick;
|
|
63
|
+
private handleComboboxMouseDown;
|
|
64
|
+
private handleComboboxKeyDown;
|
|
65
|
+
private handleClearClick;
|
|
66
|
+
private handleClearMouseDown;
|
|
67
|
+
private handleOptionClick;
|
|
68
|
+
private handleDefaultSlotChange;
|
|
69
|
+
private handleTagRemove;
|
|
70
|
+
private getAllOptions;
|
|
71
|
+
private getFirstOption;
|
|
72
|
+
private setCurrentOption;
|
|
73
|
+
private setSelectedOptions;
|
|
74
|
+
private toggleOptionSelection;
|
|
75
|
+
private selectionChanged;
|
|
76
|
+
protected get tags(): TemplateResult<1>[];
|
|
77
|
+
private handleInvalid;
|
|
78
|
+
private handleMouseEnter;
|
|
79
|
+
private handleMouseLeave;
|
|
80
|
+
private handleCurrentPlacement;
|
|
81
|
+
handleUseTagsChange(): void;
|
|
82
|
+
handleDisabledChange(): void;
|
|
83
|
+
handleOpenChange(): Promise<void>;
|
|
84
|
+
applySizeToOptions(): void;
|
|
85
|
+
handleValueChange(): void;
|
|
86
|
+
show(): Promise<void>;
|
|
87
|
+
hide(): Promise<void>;
|
|
88
|
+
checkValidity(): boolean;
|
|
89
|
+
getForm(): HTMLFormElement | null;
|
|
90
|
+
reportValidity(): boolean;
|
|
91
|
+
setCustomValidity(message: string): void;
|
|
92
|
+
focus(options?: FocusOptions): void;
|
|
93
|
+
blur(): void;
|
|
94
|
+
render(): TemplateResult<1>;
|
|
95
|
+
static styles: import("lit").CSSResultGroup[];
|
|
96
|
+
}
|
|
97
|
+
declare global {
|
|
98
|
+
interface HTMLElementTagNameMap {
|
|
99
|
+
'sd-1-32-0-select': SdSelect;
|
|
100
|
+
}
|
|
101
|
+
}
|