@solid-design-system/components 1.21.1 → 1.23.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/carousel.js +3 -3
- package/dist/components/es/checkbox-group.js +1 -0
- package/dist/components/es/checkbox.js +11 -0
- package/dist/components/es/event.js +1 -1
- package/dist/components/es/icon.js +4 -4
- package/dist/components/es/interactive.js +1 -0
- package/dist/components/es/radio-group.js +1 -1
- package/dist/components/es/radio.js +1 -1
- package/dist/components/es/solid-components2.js +1 -1
- package/dist/components/es/solid-element.js +1 -1
- package/dist/components/es/tooltip.js +4 -0
- package/dist/components/umd/solid-components.js +29 -16
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/checkbox/checkbox.d.ts +40 -0
- package/dist/package/components/checkbox/checkbox.js +179 -0
- package/dist/package/components/checkbox-group/checkbox-group.d.ts +20 -0
- package/dist/package/components/checkbox-group/checkbox-group.js +102 -0
- package/dist/package/components/icon/library.system.d.ts +3 -0
- package/dist/package/components/icon/library.system.js +11 -0
- package/dist/package/components/radio/radio.js +1 -3
- package/dist/package/components/radio-group/radio-group.js +7 -8
- package/dist/package/components/tooltip/tooltip.d.ts +39 -0
- package/dist/package/components/tooltip/tooltip.js +233 -0
- package/dist/package/internal/animate.js +11 -0
- package/dist/package/internal/default-value.d.ts +2 -0
- package/dist/package/internal/default-value.js +21 -0
- package/dist/package/solid-components.d.ts +3 -0
- package/dist/package/solid-components.js +34 -28
- package/dist/package/styles/tailwind.css.js +1 -1
- 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 -0
- package/dist/versioned-components/es/checkbox.js +11 -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/event.js +1 -1
- package/dist/versioned-components/es/form.js +1 -1
- package/dist/versioned-components/es/icon.js +4 -4
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/interactive.js +1 -0
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/navigation-item.js +1 -1
- 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/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/tag.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/tooltip.js +4 -0
- 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 +40 -0
- package/dist/versioned-package/components/checkbox/checkbox.js +179 -0
- package/dist/versioned-package/components/checkbox-group/checkbox-group.d.ts +20 -0
- package/dist/versioned-package/components/checkbox-group/checkbox-group.js +102 -0
- 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 +6 -6
- 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/icon/library.system.d.ts +3 -0
- package/dist/versioned-package/components/icon/library.system.js +11 -0
- 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/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/popup/popup.d.ts +1 -1
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/radio/radio.d.ts +1 -1
- package/dist/versioned-package/components/radio/radio.js +3 -5
- package/dist/versioned-package/components/radio-group/radio-group.d.ts +2 -2
- package/dist/versioned-package/components/radio-group/radio-group.js +18 -19
- 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/tag/tag.d.ts +1 -1
- package/dist/versioned-package/components/tag/tag.js +2 -2
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/components/tooltip/tooltip.d.ts +39 -0
- package/dist/versioned-package/components/tooltip/tooltip.js +233 -0
- 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/animate.js +11 -0
- package/dist/versioned-package/internal/default-value.d.ts +2 -0
- package/dist/versioned-package/internal/default-value.js +21 -0
- package/dist/versioned-package/internal/form.js +1 -1
- package/dist/versioned-package/solid-components.d.ts +3 -0
- package/dist/versioned-package/solid-components.js +34 -28
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +345 -21
- package/dist/web-types.json +504 -1
- package/package.json +3 -3
|
@@ -73,10 +73,8 @@ let SdRadio = class extends SolidElement {
|
|
|
73
73
|
}
|
|
74
74
|
render() {
|
|
75
75
|
return html`<span part="base" class="${cx(
|
|
76
|
-
"sd-1-
|
|
77
|
-
this.checked && "radio--checked",
|
|
76
|
+
"sd-1-23-0-radio group inline-flex items-start items-center text-base leading-normal text-black cursor-pointer align-middle",
|
|
78
77
|
this.disabled && "hover:cursor-not-allowed",
|
|
79
|
-
this.hasFocus && "radio--focused",
|
|
80
78
|
{
|
|
81
79
|
/* sizes, fonts */
|
|
82
80
|
sm: "small-size text-sm",
|
|
@@ -89,7 +87,7 @@ let SdRadio = class extends SolidElement {
|
|
|
89
87
|
"rounded-full inline-flex text-white border bg-accent h-2.5 w-2.5",
|
|
90
88
|
this.disabled && "bg-neutral-500" || this.invalid && "bg-error hover:bg-error-400 group-hover:bg-error-400" || this.checked && "bg-accent hover:bg-accent-550 group-hover:bg-accent-550" || "bg-neutral-800"
|
|
91
89
|
)}"></span>` : ""}</span><slot part="label" class="${cx(
|
|
92
|
-
"
|
|
90
|
+
"ml-2 select-none inline-block",
|
|
93
91
|
this.disabled && "text-neutral-500" || this.invalid && "text-error" || "text-black"
|
|
94
92
|
)}"></slot></span>`;
|
|
95
93
|
}
|
|
@@ -123,7 +121,7 @@ __decorateClass([
|
|
|
123
121
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
124
122
|
], SdRadio.prototype, "handleDisabledChange", 1);
|
|
125
123
|
SdRadio = __decorateClass([
|
|
126
|
-
customElement("sd-1-
|
|
124
|
+
customElement("sd-1-23-0-radio")
|
|
127
125
|
], SdRadio);
|
|
128
126
|
export {
|
|
129
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-23-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-23-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-23-0-radio, sd-1-23-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-23-0-radio, sd-1-23-0-radio-button");
|
|
79
79
|
const radios = this.getAllRadios();
|
|
80
80
|
const oldValue = this.value;
|
|
81
81
|
if (target.disabled) {
|
|
@@ -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-23-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-23-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-23-0-radio") && customElements.get("sd-1-23-0-radio-button")) {
|
|
170
170
|
this.syncRadioElements();
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
if (customElements.get("sd-1-
|
|
173
|
+
if (customElements.get("sd-1-23-0-radio")) {
|
|
174
174
|
this.syncRadioElements();
|
|
175
175
|
} else {
|
|
176
|
-
customElements.whenDefined("sd-1-
|
|
176
|
+
customElements.whenDefined("sd-1-23-0-radio").then(() => this.syncRadios());
|
|
177
177
|
}
|
|
178
|
-
if (customElements.get("sd-1-
|
|
178
|
+
if (customElements.get("sd-1-23-0-radio-button")) {
|
|
179
179
|
this.syncRadioElements();
|
|
180
180
|
} else {
|
|
181
|
-
customElements.whenDefined("sd-1-
|
|
181
|
+
customElements.whenDefined("sd-1-23-0-radio-button").then(() => this.syncRadios());
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
updateCheckedRadio() {
|
|
@@ -241,35 +241,34 @@ let SdRadioGroup = class extends SolidElement {
|
|
|
241
241
|
const hasErrorText = this.errorText ? true : !!hasErrorTextSlot;
|
|
242
242
|
const defaultSlot = html`<slot @slotchange="${this.syncRadios}" @click="${this.handleRadioClick}" @keydown="${this.handleKeyDown}"></slot>`;
|
|
243
243
|
return html`<fieldset part="form-control" class="${cx(
|
|
244
|
-
"
|
|
245
|
-
hasLabel && "form-control--has-label",
|
|
244
|
+
"border-0 p-0 m-0",
|
|
246
245
|
hasErrorText && "text-error",
|
|
247
246
|
{
|
|
248
247
|
/* sizes, fonts */
|
|
249
248
|
sm: "text-sm",
|
|
250
249
|
lg: "text-base"
|
|
251
250
|
}[this.size]
|
|
252
|
-
)}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><label part="form-control-label" id="label" class="
|
|
251
|
+
)}" role="radiogroup" aria-labelledby="label" aria-errormessage="error-text"><label part="form-control-label" id="label" class="${cx("mb-2 p-0 font-bold leading-normal text-black", hasLabel ? "has-label flex" : "hidden")}" aria-hidden="${!hasLabel}" @click="${this.handleLabelClick}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${cx(
|
|
253
252
|
"form-control-input flex",
|
|
254
253
|
this.invalid && "form-control-input--invalid text-error",
|
|
255
254
|
{
|
|
256
|
-
vertical: "
|
|
257
|
-
horizontal: "
|
|
255
|
+
vertical: "flex-col",
|
|
256
|
+
horizontal: "flex-row"
|
|
258
257
|
}[this.orientation]
|
|
259
|
-
)}"><div class="sr-only"><div id="error-message" aria-live="assertive">${this.errorText}</div><label
|
|
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>`;
|
|
260
259
|
}
|
|
261
260
|
};
|
|
262
|
-
SdRadioGroup.dependencies = { "sd-1-
|
|
261
|
+
SdRadioGroup.dependencies = { "sd-1-23-0-button-group": SdButtonGroup };
|
|
263
262
|
SdRadioGroup.styles = [
|
|
264
263
|
componentStyles,
|
|
265
264
|
SolidElement.styles,
|
|
266
|
-
css`:host{display:block}
|
|
265
|
+
css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-1-23-0-radio){margin-bottom:8px;display:flex}:host([orientation=vertical]) ::slotted(sd-1-23-0-radio:last-of-type){margin-bottom:0}:host([orientation=horizontal]) ::slotted(sd-1-23-0-radio){margin-right:24px}:host([size=sm]):host([orientation=horizontal]) ::slotted(sd-1-23-0-radio){margin-right:16px}:host([orientation=horizontal]) ::slotted(sd-1-23-0-radio:last-of-type){margin-right:0}:host([required]) #label.has-label::after{content:'*';margin-left:2px}`
|
|
267
266
|
];
|
|
268
267
|
__decorateClass([
|
|
269
268
|
query("slot:not([name])")
|
|
270
269
|
], SdRadioGroup.prototype, "defaultSlot", 2);
|
|
271
270
|
__decorateClass([
|
|
272
|
-
query("
|
|
271
|
+
query("#validation-input")
|
|
273
272
|
], SdRadioGroup.prototype, "validationInput", 2);
|
|
274
273
|
__decorateClass([
|
|
275
274
|
state()
|
|
@@ -314,7 +313,7 @@ __decorateClass([
|
|
|
314
313
|
watch("value")
|
|
315
314
|
], SdRadioGroup.prototype, "handleValueChange", 1);
|
|
316
315
|
SdRadioGroup = __decorateClass([
|
|
317
|
-
customElement("sd-1-
|
|
316
|
+
customElement("sd-1-23-0-radio-group")
|
|
318
317
|
], SdRadioGroup);
|
|
319
318
|
export {
|
|
320
319
|
SdRadioGroup as default
|
|
@@ -72,7 +72,7 @@ let SdTag = class extends SolidElement {
|
|
|
72
72
|
lg: "text-base",
|
|
73
73
|
sm: "text-[12px]"
|
|
74
74
|
}[this.size]
|
|
75
|
-
)}"><sd-1-
|
|
75
|
+
)}"><sd-1-23-0-icon library="system" name="close" label="remove"></sd-1-23-0-icon></slot></${tag}>`;
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
SdTag.styles = [
|
|
@@ -104,7 +104,7 @@ __decorateClass([
|
|
|
104
104
|
property()
|
|
105
105
|
], SdTag.prototype, "download", 2);
|
|
106
106
|
SdTag = __decorateClass([
|
|
107
|
-
customElement("sd-1-
|
|
107
|
+
customElement("sd-1-23-0-tag")
|
|
108
108
|
], SdTag);
|
|
109
109
|
export {
|
|
110
110
|
SdTag as default
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import '../popup/popup';
|
|
2
|
+
import SolidElement from '../../internal/solid-element';
|
|
3
|
+
import type SdPopup from '../popup/popup';
|
|
4
|
+
export default class SdTooltip extends SolidElement {
|
|
5
|
+
private hoverTimeout;
|
|
6
|
+
private readonly localize;
|
|
7
|
+
defaultSlot: HTMLSlotElement;
|
|
8
|
+
body: HTMLElement;
|
|
9
|
+
popup: SdPopup;
|
|
10
|
+
content: string;
|
|
11
|
+
placement: 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end';
|
|
12
|
+
size: 'lg' | 'sm';
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
open: boolean;
|
|
15
|
+
trigger: string;
|
|
16
|
+
hoist: boolean;
|
|
17
|
+
connectedCallback(): void;
|
|
18
|
+
firstUpdated(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
private handleBlur;
|
|
21
|
+
private handleClick;
|
|
22
|
+
private handleFocus;
|
|
23
|
+
private handleKeyDown;
|
|
24
|
+
private handleMouseOver;
|
|
25
|
+
private handleMouseOut;
|
|
26
|
+
private hasTrigger;
|
|
27
|
+
handleOpenChange(): Promise<void>;
|
|
28
|
+
handleOptionsChange(): Promise<void>;
|
|
29
|
+
handleDisabledChange(): void;
|
|
30
|
+
show(): Promise<void>;
|
|
31
|
+
hide(): Promise<void>;
|
|
32
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
33
|
+
static styles: import("lit").CSSResultGroup[];
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'sd-1-23-0-tooltip': SdTooltip;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import "../popup/popup.js";
|
|
2
|
+
import { parseDuration, stopAnimations, animateTo } from "../../internal/animate.js";
|
|
3
|
+
import { unsafeCSS, css, html } from "lit";
|
|
4
|
+
import { customElement } from "../../internal/register-custom-element.js";
|
|
5
|
+
import { setDefaultAnimation, getAnimation } from "../../utilities/animation-registry.js";
|
|
6
|
+
import { LocalizeController } from "../../utilities/localize.js";
|
|
7
|
+
import { query, property } from "lit/decorators.js";
|
|
8
|
+
import { waitForEvent } from "../../internal/event.js";
|
|
9
|
+
import { watch } from "../../internal/watch.js";
|
|
10
|
+
import cx from "classix";
|
|
11
|
+
import InteractiveStyles from "../../styles/interactive/interactive.css.js";
|
|
12
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
13
|
+
var __defProp = Object.defineProperty;
|
|
14
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
16
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
17
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
18
|
+
if (decorator = decorators[i])
|
|
19
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
20
|
+
if (kind && result)
|
|
21
|
+
__defProp(target, key, result);
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
let SdTooltip = class extends SolidElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.localize = new LocalizeController(this);
|
|
28
|
+
this.content = "";
|
|
29
|
+
this.placement = "top";
|
|
30
|
+
this.size = "lg";
|
|
31
|
+
this.disabled = false;
|
|
32
|
+
this.open = false;
|
|
33
|
+
this.trigger = "click focus";
|
|
34
|
+
this.hoist = false;
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
this.handleBlur = this.handleBlur.bind(this);
|
|
39
|
+
this.handleClick = this.handleClick.bind(this);
|
|
40
|
+
this.handleFocus = this.handleFocus.bind(this);
|
|
41
|
+
this.handleKeyDown = this.handleKeyDown.bind(this);
|
|
42
|
+
this.handleMouseOver = this.handleMouseOver.bind(this);
|
|
43
|
+
this.handleMouseOut = this.handleMouseOut.bind(this);
|
|
44
|
+
this.updateComplete.then(() => {
|
|
45
|
+
this.addEventListener("blur", this.handleBlur, true);
|
|
46
|
+
this.addEventListener("focus", this.handleFocus, true);
|
|
47
|
+
this.addEventListener("click", this.handleClick);
|
|
48
|
+
this.addEventListener("keydown", this.handleKeyDown);
|
|
49
|
+
this.addEventListener("mouseover", this.handleMouseOver);
|
|
50
|
+
this.addEventListener("mouseout", this.handleMouseOut);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
firstUpdated() {
|
|
54
|
+
this.body.hidden = !this.open;
|
|
55
|
+
if (this.open) {
|
|
56
|
+
this.popup.active = true;
|
|
57
|
+
this.popup.reposition();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
disconnectedCallback() {
|
|
61
|
+
super.disconnectedCallback();
|
|
62
|
+
this.removeEventListener("blur", this.handleBlur, true);
|
|
63
|
+
this.removeEventListener("focus", this.handleFocus, true);
|
|
64
|
+
this.removeEventListener("click", this.handleClick);
|
|
65
|
+
this.removeEventListener("keydown", this.handleKeyDown);
|
|
66
|
+
this.removeEventListener("mouseover", this.handleMouseOver);
|
|
67
|
+
this.removeEventListener("mouseout", this.handleMouseOut);
|
|
68
|
+
}
|
|
69
|
+
handleBlur() {
|
|
70
|
+
if (this.hasTrigger("focus")) {
|
|
71
|
+
this.hide();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
handleClick() {
|
|
75
|
+
if (this.hasTrigger("click")) {
|
|
76
|
+
if (this.open) {
|
|
77
|
+
this.hide();
|
|
78
|
+
} else {
|
|
79
|
+
this.show();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
handleFocus() {
|
|
84
|
+
if (this.hasTrigger("focus")) {
|
|
85
|
+
this.show();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
handleKeyDown(event) {
|
|
89
|
+
if (this.open && event.key === "Escape") {
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
this.hide();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
handleMouseOver() {
|
|
95
|
+
if (this.hasTrigger("hover")) {
|
|
96
|
+
const delay = parseDuration(getComputedStyle(this).getPropertyValue("--show-delay"));
|
|
97
|
+
clearTimeout(this.hoverTimeout);
|
|
98
|
+
this.hoverTimeout = window.setTimeout(() => this.show(), delay);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
handleMouseOut() {
|
|
102
|
+
if (this.hasTrigger("hover")) {
|
|
103
|
+
const delay = parseDuration(getComputedStyle(this).getPropertyValue("--hide-delay"));
|
|
104
|
+
clearTimeout(this.hoverTimeout);
|
|
105
|
+
this.hoverTimeout = window.setTimeout(() => this.hide(), delay);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
hasTrigger(triggerType) {
|
|
109
|
+
const triggers = this.trigger.split(" ");
|
|
110
|
+
return triggers.includes(triggerType);
|
|
111
|
+
}
|
|
112
|
+
async handleOpenChange() {
|
|
113
|
+
if (this.open) {
|
|
114
|
+
if (this.disabled) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.emit("sd-show");
|
|
118
|
+
await stopAnimations(this.body);
|
|
119
|
+
this.body.hidden = false;
|
|
120
|
+
this.popup.active = true;
|
|
121
|
+
const { keyframes, options } = getAnimation(this, "tooltip.show", { dir: this.localize.dir() });
|
|
122
|
+
await animateTo(this.popup.popup, keyframes, options);
|
|
123
|
+
this.emit("sd-after-show");
|
|
124
|
+
} else {
|
|
125
|
+
this.emit("sd-hide");
|
|
126
|
+
await stopAnimations(this.body);
|
|
127
|
+
const { keyframes, options } = getAnimation(this, "tooltip.hide", { dir: this.localize.dir() });
|
|
128
|
+
await animateTo(this.popup.popup, keyframes, options);
|
|
129
|
+
this.popup.active = false;
|
|
130
|
+
this.body.hidden = true;
|
|
131
|
+
this.emit("sd-after-hide");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async handleOptionsChange() {
|
|
135
|
+
if (this.hasUpdated) {
|
|
136
|
+
await this.updateComplete;
|
|
137
|
+
this.popup.reposition();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
handleDisabledChange() {
|
|
141
|
+
if (this.disabled && this.open) {
|
|
142
|
+
this.hide();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/** Shows the tooltip. */
|
|
146
|
+
async show() {
|
|
147
|
+
if (this.open) {
|
|
148
|
+
return void 0;
|
|
149
|
+
}
|
|
150
|
+
this.open = true;
|
|
151
|
+
return waitForEvent(this, "sd-after-show");
|
|
152
|
+
}
|
|
153
|
+
/** Hides the tooltip */
|
|
154
|
+
async hide() {
|
|
155
|
+
if (!this.open) {
|
|
156
|
+
return void 0;
|
|
157
|
+
}
|
|
158
|
+
this.open = false;
|
|
159
|
+
return waitForEvent(this, "sd-after-hide");
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
const isStart = this.placement.endsWith("-start");
|
|
163
|
+
const isEnd = this.placement.endsWith("-end");
|
|
164
|
+
return html`<sd-1-23-0-popup part="base" exportparts="
|
|
165
|
+
popup:base__popup,
|
|
166
|
+
arrow:base__arrow
|
|
167
|
+
" class="${cx(this.open && "tooltip--open")}" placement="${this.placement}" distance="10" skidding="${{ start: 2, end: -2, default: 0 }[isStart ? "start" : isEnd ? "end" : "default"] * (this.size === "sm" ? -1 : 1)}" strategy="${this.hoist ? "fixed" : "absolute"}" flip shift arrow auto-size="vertical" arrow-padding="0"><slot slot="anchor" aria-describedby="tooltip" class="${cx(this.size === "lg" ? "text-xl" : "text-base")}"><button class="flex sd-interactive rounded-full"><sd-1-23-0-icon library="system" name="info-circle" class="${cx(this.disabled && "sd-interactive--disabled")}"></sd-1-23-0-icon></button></slot><slot name="content" part="body" id="tooltip" class="bg-primary text-white py-3 px-4 block rounded-none text-sm text-left" role="tooltip" aria-label="Tooltip" aria-live="${this.open ? "polite" : "off"}">${this.content}</slot></sd-1-23-0-popup>`;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
SdTooltip.styles = [
|
|
171
|
+
SolidElement.styles,
|
|
172
|
+
unsafeCSS(InteractiveStyles),
|
|
173
|
+
css`:host{--hide-delay:0ms;--show-delay:150ms;display:contents}sd-1-23-0-popup{--arrow-color:rgb(var(--sd-color-primary, 0 53 142) / 1);--arrow-size:10px}sd-1-23-0-popup::part(popup){pointer-events:none;z-index:10;box-shadow:0 1px 3px 0 rgb(81 81 81 / 75%)}sd-1-23-0-popup::part(arrow){--tw-shadow:var(--sd-shadow, 0px 1px 3px 0px rgb(81 81 81 / 75%));--tw-shadow-colored:0px 1px 3px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}sd-1-23-0-popup[placement^=top]::part(popup){transform-origin:bottom}sd-1-23-0-popup[placement^=bottom]::part(popup){transform-origin:top}#tooltip{max-width:var(--max-width)}::slotted([slot=content]){overflow:auto;max-width:var(--auto-size-available-width)!important;max-height:var(--auto-size-available-height)!important}`
|
|
174
|
+
];
|
|
175
|
+
__decorateClass([
|
|
176
|
+
query("slot:not([name])")
|
|
177
|
+
], SdTooltip.prototype, "defaultSlot", 2);
|
|
178
|
+
__decorateClass([
|
|
179
|
+
query("#tooltip")
|
|
180
|
+
], SdTooltip.prototype, "body", 2);
|
|
181
|
+
__decorateClass([
|
|
182
|
+
query("sd-1-23-0-popup")
|
|
183
|
+
], SdTooltip.prototype, "popup", 2);
|
|
184
|
+
__decorateClass([
|
|
185
|
+
property()
|
|
186
|
+
], SdTooltip.prototype, "content", 2);
|
|
187
|
+
__decorateClass([
|
|
188
|
+
property({ reflect: true })
|
|
189
|
+
], SdTooltip.prototype, "placement", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
property()
|
|
192
|
+
], SdTooltip.prototype, "size", 2);
|
|
193
|
+
__decorateClass([
|
|
194
|
+
property({ type: Boolean, reflect: true })
|
|
195
|
+
], SdTooltip.prototype, "disabled", 2);
|
|
196
|
+
__decorateClass([
|
|
197
|
+
property({ type: Boolean, reflect: true })
|
|
198
|
+
], SdTooltip.prototype, "open", 2);
|
|
199
|
+
__decorateClass([
|
|
200
|
+
property()
|
|
201
|
+
], SdTooltip.prototype, "trigger", 2);
|
|
202
|
+
__decorateClass([
|
|
203
|
+
property({ type: Boolean })
|
|
204
|
+
], SdTooltip.prototype, "hoist", 2);
|
|
205
|
+
__decorateClass([
|
|
206
|
+
watch("open", { waitUntilFirstUpdate: true })
|
|
207
|
+
], SdTooltip.prototype, "handleOpenChange", 1);
|
|
208
|
+
__decorateClass([
|
|
209
|
+
watch(["content", "hoist", "placement"])
|
|
210
|
+
], SdTooltip.prototype, "handleOptionsChange", 1);
|
|
211
|
+
__decorateClass([
|
|
212
|
+
watch("disabled")
|
|
213
|
+
], SdTooltip.prototype, "handleDisabledChange", 1);
|
|
214
|
+
SdTooltip = __decorateClass([
|
|
215
|
+
customElement("sd-1-23-0-tooltip")
|
|
216
|
+
], SdTooltip);
|
|
217
|
+
setDefaultAnimation("tooltip.show", {
|
|
218
|
+
keyframes: [
|
|
219
|
+
{ opacity: 0, scale: 0.8 },
|
|
220
|
+
{ opacity: 1, scale: 1 }
|
|
221
|
+
],
|
|
222
|
+
options: { duration: 150, easing: "ease" }
|
|
223
|
+
});
|
|
224
|
+
setDefaultAnimation("tooltip.hide", {
|
|
225
|
+
keyframes: [
|
|
226
|
+
{ opacity: 1, scale: 1 },
|
|
227
|
+
{ opacity: 0, scale: 0.8 }
|
|
228
|
+
],
|
|
229
|
+
options: { duration: 150, easing: "ease" }
|
|
230
|
+
});
|
|
231
|
+
export {
|
|
232
|
+
SdTooltip as default
|
|
233
|
+
};
|
|
@@ -87,7 +87,7 @@ let SdVideo = class extends SolidElement {
|
|
|
87
87
|
this.playing ? "opacity-0" : "opacity-100",
|
|
88
88
|
this.isBelowBreakpoint ? "w-[48px] h-[48px]" : "w-[96px] h-[96px]",
|
|
89
89
|
"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 p-4 bg-white bg-opacity-75 rounded-full play-pause-transition"
|
|
90
|
-
)}"><slot name="play-icon" part="play-icon" class="${cx(this.isBelowBreakpoint ? "text-[2rem]" : "text-[4rem]")}"><sd-1-
|
|
90
|
+
)}"><slot name="play-icon" part="play-icon" class="${cx(this.isBelowBreakpoint ? "text-[2rem]" : "text-[4rem]")}"><sd-1-23-0-icon id="default-play-icon" library="system" name="start"></sd-1-23-0-icon></slot></div></button> ${this.hasSlotController.test("poster") ? html`<slot name="poster" role="presentation" @transitionend="${this.hidePoster}"></slot>` : null}<div part="overlay" id="overlay" role="presentation" class="${cx(
|
|
91
91
|
this.overlay && !this.playing ? "opacity-100" : "opacity-0",
|
|
92
92
|
"bg-[rgba(0,0,0,0.65)] w-full h-full absolute top-0 left-0 pointer-events-none z-20 play-pause-transition"
|
|
93
93
|
)}"></div><slot></slot></div>`;
|
|
@@ -110,7 +110,7 @@ __decorateClass([
|
|
|
110
110
|
property({ type: Boolean })
|
|
111
111
|
], SdVideo.prototype, "isBelowBreakpoint", 2);
|
|
112
112
|
SdVideo = __decorateClass([
|
|
113
|
-
customElement("sd-1-
|
|
113
|
+
customElement("sd-1-23-0-video")
|
|
114
114
|
], SdVideo);
|
|
115
115
|
export {
|
|
116
116
|
SdVideo as default
|
|
@@ -11,6 +11,16 @@ function animateTo(el, keyframes, options) {
|
|
|
11
11
|
animation.addEventListener("finish", resolve, { once: true });
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
+
function parseDuration(delay) {
|
|
15
|
+
delay = delay.toString().toLowerCase();
|
|
16
|
+
if (delay.indexOf("ms") > -1) {
|
|
17
|
+
return parseFloat(delay);
|
|
18
|
+
}
|
|
19
|
+
if (delay.indexOf("s") > -1) {
|
|
20
|
+
return parseFloat(delay) * 1e3;
|
|
21
|
+
}
|
|
22
|
+
return parseFloat(delay);
|
|
23
|
+
}
|
|
14
24
|
function prefersReducedMotion() {
|
|
15
25
|
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
16
26
|
return query.matches;
|
|
@@ -35,6 +45,7 @@ function shimKeyframesHeightAuto(keyframes, calculatedHeight) {
|
|
|
35
45
|
}
|
|
36
46
|
export {
|
|
37
47
|
animateTo,
|
|
48
|
+
parseDuration,
|
|
38
49
|
prefersReducedMotion,
|
|
39
50
|
shimKeyframesHeightAuto,
|
|
40
51
|
stopAnimations
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defaultConverter } from "lit";
|
|
2
|
+
const defaultValue = (propertyName = "value") => (proto, key) => {
|
|
3
|
+
const ctor = proto.constructor;
|
|
4
|
+
const attributeChangedCallback = ctor.prototype.attributeChangedCallback;
|
|
5
|
+
ctor.prototype.attributeChangedCallback = function(name, old, value) {
|
|
6
|
+
const options = ctor.getPropertyOptions(propertyName);
|
|
7
|
+
const attributeName = typeof options.attribute === "string" ? options.attribute : propertyName;
|
|
8
|
+
if (name === attributeName) {
|
|
9
|
+
const converter = options.converter || defaultConverter;
|
|
10
|
+
const fromAttribute = typeof converter === "function" ? converter : (converter == null ? void 0 : converter.fromAttribute) ?? defaultConverter.fromAttribute;
|
|
11
|
+
const newValue = fromAttribute(value, options.type);
|
|
12
|
+
if (this[propertyName] !== newValue) {
|
|
13
|
+
this[key] = newValue;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
attributeChangedCallback.call(this, name, old, value);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
defaultValue
|
|
21
|
+
};
|
|
@@ -8,7 +8,7 @@ class FormControlController {
|
|
|
8
8
|
const disabled = this.options.disabled(this.host);
|
|
9
9
|
const name = this.options.name(this.host);
|
|
10
10
|
const value = this.options.value(this.host);
|
|
11
|
-
const isButton = this.host.tagName.toLowerCase() === "sd-1-
|
|
11
|
+
const isButton = this.host.tagName.toLowerCase() === "sd-1-23-0-button";
|
|
12
12
|
if (!disabled && !isButton && typeof name === "string" && name.length > 0 && typeof value !== "undefined") {
|
|
13
13
|
if (Array.isArray(value)) {
|
|
14
14
|
value.forEach((val) => {
|
|
@@ -5,6 +5,8 @@ export { default as SdBrandshape } from './components/brandshape/brandshape';
|
|
|
5
5
|
export { default as SdButton } from './components/button/button';
|
|
6
6
|
export { default as SdCarousel } from './components/carousel/carousel';
|
|
7
7
|
export { default as SdCarouselItem } from './components/carousel-item/carousel-item';
|
|
8
|
+
export { default as SdCheckbox } from './components/checkbox/checkbox';
|
|
9
|
+
export { default as SdCheckboxGroup } from './components/checkbox-group/checkbox-group';
|
|
8
10
|
export { default as SdDivider } from './components/divider/divider';
|
|
9
11
|
export { default as SdDrawer } from './components/drawer/drawer';
|
|
10
12
|
export { default as SdDropdown } from './components/dropdown/dropdown';
|
|
@@ -18,6 +20,7 @@ export { default as SdRadioGroup } from './components/radio-group/radio-group';
|
|
|
18
20
|
export { default as SdSpinner } from './components/spinner/spinner';
|
|
19
21
|
export { default as SdTag } from './components/tag/tag';
|
|
20
22
|
export { default as SdTeaser } from './components/teaser/teaser';
|
|
23
|
+
export { default as SdTooltip } from './components/tooltip/tooltip';
|
|
21
24
|
export { default as SdVideo } from './components/video/video';
|
|
22
25
|
export * from './utilities/icon-library';
|
|
23
26
|
export * from './utilities/localize';
|