@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
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import '../icon/icon';
|
|
2
|
+
import SolidElement from '../../internal/solid-element';
|
|
3
|
+
import type { SolidFormControl } from '../../internal/solid-element';
|
|
4
|
+
export default class SdCheckbox extends SolidElement implements SolidFormControl {
|
|
5
|
+
private readonly formControlController;
|
|
6
|
+
input: HTMLInputElement;
|
|
7
|
+
title: string;
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
size: 'sm' | 'lg';
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
checked: boolean;
|
|
13
|
+
indeterminate: boolean;
|
|
14
|
+
defaultChecked: boolean;
|
|
15
|
+
form: string;
|
|
16
|
+
required: boolean;
|
|
17
|
+
get validity(): ValidityState;
|
|
18
|
+
firstUpdated(): void;
|
|
19
|
+
private handleClick;
|
|
20
|
+
private handleBlur;
|
|
21
|
+
private handleInput;
|
|
22
|
+
private handleInvalid;
|
|
23
|
+
private handleFocus;
|
|
24
|
+
handleDisabledChange(): void;
|
|
25
|
+
handleStateChange(): void;
|
|
26
|
+
click(): void;
|
|
27
|
+
focus(options?: FocusOptions): void;
|
|
28
|
+
blur(): void;
|
|
29
|
+
checkValidity(): boolean;
|
|
30
|
+
getForm(): HTMLFormElement | null;
|
|
31
|
+
reportValidity(): boolean;
|
|
32
|
+
setCustomValidity(message: string): void;
|
|
33
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
34
|
+
static styles: import("lit").CSSResultGroup[];
|
|
35
|
+
}
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'sd-checkbox': SdCheckbox;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import "../icon/icon.js";
|
|
2
|
+
import { css, html } from "lit";
|
|
3
|
+
import { customElement } from "../../internal/register-custom-element.js";
|
|
4
|
+
import { defaultValue } from "../../internal/default-value.js";
|
|
5
|
+
import { FormControlController } from "../../internal/form.js";
|
|
6
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
7
|
+
import { live } from "lit/directives/live.js";
|
|
8
|
+
import { query, property } from "lit/decorators.js";
|
|
9
|
+
import { watch } from "../../internal/watch.js";
|
|
10
|
+
import cx from "classix";
|
|
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 SdCheckbox = class extends SolidElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.formControlController = new FormControlController(this, {
|
|
27
|
+
value: (control) => control.checked ? control.value || "on" : void 0,
|
|
28
|
+
defaultValue: (control) => control.defaultChecked,
|
|
29
|
+
setValue: (control, checked) => control.checked = checked
|
|
30
|
+
});
|
|
31
|
+
this.title = "";
|
|
32
|
+
this.name = "";
|
|
33
|
+
this.size = "lg";
|
|
34
|
+
this.disabled = false;
|
|
35
|
+
this.checked = false;
|
|
36
|
+
this.indeterminate = false;
|
|
37
|
+
this.defaultChecked = false;
|
|
38
|
+
this.form = "";
|
|
39
|
+
this.required = false;
|
|
40
|
+
}
|
|
41
|
+
/** Gets the validity state object */
|
|
42
|
+
get validity() {
|
|
43
|
+
return this.input.validity;
|
|
44
|
+
}
|
|
45
|
+
firstUpdated() {
|
|
46
|
+
this.formControlController.updateValidity();
|
|
47
|
+
}
|
|
48
|
+
handleClick() {
|
|
49
|
+
this.checked = !this.checked;
|
|
50
|
+
this.indeterminate = false;
|
|
51
|
+
this.emit("sd-change");
|
|
52
|
+
}
|
|
53
|
+
handleBlur() {
|
|
54
|
+
this.emit("sd-blur");
|
|
55
|
+
}
|
|
56
|
+
handleInput() {
|
|
57
|
+
this.emit("sd-input");
|
|
58
|
+
}
|
|
59
|
+
handleInvalid(event) {
|
|
60
|
+
this.formControlController.setValidity(false);
|
|
61
|
+
this.formControlController.emitInvalidEvent(event);
|
|
62
|
+
}
|
|
63
|
+
handleFocus() {
|
|
64
|
+
this.emit("sd-focus");
|
|
65
|
+
}
|
|
66
|
+
handleDisabledChange() {
|
|
67
|
+
this.setAttribute("aria-disabled", this.disabled ? "true" : "false");
|
|
68
|
+
this.formControlController.setValidity(this.disabled);
|
|
69
|
+
}
|
|
70
|
+
handleStateChange() {
|
|
71
|
+
this.input.checked = this.checked;
|
|
72
|
+
this.input.indeterminate = this.indeterminate;
|
|
73
|
+
this.formControlController.updateValidity();
|
|
74
|
+
}
|
|
75
|
+
/** Simulates a click on the checkbox. */
|
|
76
|
+
click() {
|
|
77
|
+
this.input.click();
|
|
78
|
+
}
|
|
79
|
+
/** Sets focus on the checkbox. */
|
|
80
|
+
focus(options) {
|
|
81
|
+
this.input.focus(options);
|
|
82
|
+
}
|
|
83
|
+
/** Removes focus from the checkbox. */
|
|
84
|
+
blur() {
|
|
85
|
+
this.input.blur();
|
|
86
|
+
}
|
|
87
|
+
/** Checks for validity but does not show a validation message. Returns true when valid and false when invalid. */
|
|
88
|
+
checkValidity() {
|
|
89
|
+
return this.input.checkValidity();
|
|
90
|
+
}
|
|
91
|
+
/** Gets the associated form, if one exists. */
|
|
92
|
+
getForm() {
|
|
93
|
+
return this.formControlController.getForm();
|
|
94
|
+
}
|
|
95
|
+
/** Checks for validity and shows a validation message if the control is invalid. */
|
|
96
|
+
reportValidity() {
|
|
97
|
+
return this.input.reportValidity();
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sets a custom validation message. The value provided will be shown to the user when the form is submitted. To clear
|
|
101
|
+
* the custom validation message, call this method with an empty string.
|
|
102
|
+
*/
|
|
103
|
+
setCustomValidity(message) {
|
|
104
|
+
this.input.setCustomValidity(message);
|
|
105
|
+
this.formControlController.updateValidity();
|
|
106
|
+
}
|
|
107
|
+
render() {
|
|
108
|
+
return html`<label part="base" class="${cx(
|
|
109
|
+
"sd-checkbox group flex items-start text-base leading-normal text-black cursor-pointer",
|
|
110
|
+
this.disabled && "hover:cursor-not-allowed",
|
|
111
|
+
{
|
|
112
|
+
/* sizes, fonts */
|
|
113
|
+
sm: "text-sm",
|
|
114
|
+
lg: "text-base"
|
|
115
|
+
}[this.size]
|
|
116
|
+
)}"><input class="peer absolute opacity-0 p-0 m-0 pointer-events-none" type="checkbox" title="${this.title}" name="${this.name}" value="${ifDefined(this.value)}" .indeterminate="${live(this.indeterminate)}" .checked="${live(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" aria-checked="${this.checked ? "true" : "false"}" @click="${this.handleClick}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @blur="${this.handleBlur}" @focus="${this.handleFocus}"> <span id="control" part="control ${this.checked ? " control--checked" : "control--unchecked"} ${this.indeterminate ? " control--indeterminate" : ""}" class="${cx(
|
|
117
|
+
`relative flex flex-initial items-center justify-center border rounded-sm h-4 w-4
|
|
118
|
+
peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2
|
|
119
|
+
peer-focus-visible:outline-primary`,
|
|
120
|
+
{
|
|
121
|
+
sm: "mt-[2px]",
|
|
122
|
+
lg: "mt-[3px]"
|
|
123
|
+
}[this.size],
|
|
124
|
+
this.disabled && this.indeterminate && "border-neutral-500 bg-neutral-500" || this.disabled && this.checked && "border-neutral-500 bg-neutral-500" || this.disabled && "border-neutral-500" || (this.checked || this.indeterminate) && "border-accent hover:border-accent-550 group-hover:border-accent-550 bg-accent group-hover:bg-accent-550" || "border-neutral-800 hover:bg-neutral-200 group-hover:bg-neutral-200 bg-white"
|
|
125
|
+
)}">${this.checked ? html`<sd-icon part="checked-icon" class="text-white w-3 h-3" library="system" name="status-hook"></sd-icon>` : ""} ${!this.checked && this.indeterminate ? html`<sd-icon part="indeterminate-icon" class="text-white w-3 h-3" library="system" name="status-minus"></sd-icon>` : ""} </span><span part="label" id="label" class="${cx(
|
|
126
|
+
"select-none inline-block ml-2 text-black",
|
|
127
|
+
this.disabled && "text-neutral-500" || "text-neutral-800"
|
|
128
|
+
)}"><slot></slot></span></label>`;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
SdCheckbox.styles = [
|
|
132
|
+
SolidElement.styles,
|
|
133
|
+
css`:host{display:block}:host(:focus-visible){outline:0}:host([required]) #label::after{content:' *'}:host([data-user-invalid]) #label{color:rgb(var(--sd-color-error,204 25 55))}:host([data-user-invalid]) #control{border-color:rgb(var(--sd-color-error,204 25 55))}:host([data-user-invalid]):host([indeterminate]) #control{background-color:rgb(var(--sd-color-error,204 25 55))}`
|
|
134
|
+
];
|
|
135
|
+
__decorateClass([
|
|
136
|
+
query('input[type="checkbox"]')
|
|
137
|
+
], SdCheckbox.prototype, "input", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property()
|
|
140
|
+
], SdCheckbox.prototype, "title", 2);
|
|
141
|
+
__decorateClass([
|
|
142
|
+
property()
|
|
143
|
+
], SdCheckbox.prototype, "name", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
property()
|
|
146
|
+
], SdCheckbox.prototype, "value", 2);
|
|
147
|
+
__decorateClass([
|
|
148
|
+
property({ reflect: true })
|
|
149
|
+
], SdCheckbox.prototype, "size", 2);
|
|
150
|
+
__decorateClass([
|
|
151
|
+
property({ type: Boolean, reflect: true })
|
|
152
|
+
], SdCheckbox.prototype, "disabled", 2);
|
|
153
|
+
__decorateClass([
|
|
154
|
+
property({ type: Boolean, reflect: true })
|
|
155
|
+
], SdCheckbox.prototype, "checked", 2);
|
|
156
|
+
__decorateClass([
|
|
157
|
+
property({ type: Boolean, reflect: true })
|
|
158
|
+
], SdCheckbox.prototype, "indeterminate", 2);
|
|
159
|
+
__decorateClass([
|
|
160
|
+
defaultValue("checked")
|
|
161
|
+
], SdCheckbox.prototype, "defaultChecked", 2);
|
|
162
|
+
__decorateClass([
|
|
163
|
+
property({ reflect: true })
|
|
164
|
+
], SdCheckbox.prototype, "form", 2);
|
|
165
|
+
__decorateClass([
|
|
166
|
+
property({ type: Boolean, reflect: true })
|
|
167
|
+
], SdCheckbox.prototype, "required", 2);
|
|
168
|
+
__decorateClass([
|
|
169
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
170
|
+
], SdCheckbox.prototype, "handleDisabledChange", 1);
|
|
171
|
+
__decorateClass([
|
|
172
|
+
watch(["checked", "indeterminate"], { waitUntilFirstUpdate: true })
|
|
173
|
+
], SdCheckbox.prototype, "handleStateChange", 1);
|
|
174
|
+
SdCheckbox = __decorateClass([
|
|
175
|
+
customElement("sd-checkbox")
|
|
176
|
+
], SdCheckbox);
|
|
177
|
+
export {
|
|
178
|
+
SdCheckbox as default
|
|
179
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '../icon/icon';
|
|
2
|
+
import SolidElement from '../../internal/solid-element';
|
|
3
|
+
export default class SdCheckboxGroup extends SolidElement {
|
|
4
|
+
private readonly hasSlotController;
|
|
5
|
+
label: string;
|
|
6
|
+
size: 'lg' | 'sm';
|
|
7
|
+
orientation: 'horizontal' | 'vertical';
|
|
8
|
+
private getAllCheckboxes;
|
|
9
|
+
private syncCheckboxElements;
|
|
10
|
+
private syncCheckboxes;
|
|
11
|
+
handleSizeChange(): void;
|
|
12
|
+
handleInvalid(): void;
|
|
13
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
14
|
+
static styles: import("lit").CSSResultGroup[];
|
|
15
|
+
}
|
|
16
|
+
declare global {
|
|
17
|
+
interface HTMLElementTagNameMap {
|
|
18
|
+
'sd-checkbox-group': SdCheckboxGroup;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { property } from "lit/decorators.js";
|
|
6
|
+
import { watch } from "../../internal/watch.js";
|
|
7
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
8
|
+
import cx from "classix";
|
|
9
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
14
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
+
if (decorator = decorators[i])
|
|
16
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
17
|
+
if (kind && result)
|
|
18
|
+
__defProp(target, key, result);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
let SdCheckboxGroup = class extends SolidElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
this.hasSlotController = new HasSlotController(this, "label");
|
|
25
|
+
this.label = "";
|
|
26
|
+
this.size = "lg";
|
|
27
|
+
this.orientation = "vertical";
|
|
28
|
+
}
|
|
29
|
+
getAllCheckboxes() {
|
|
30
|
+
return [...this.querySelectorAll("sd-checkbox")];
|
|
31
|
+
}
|
|
32
|
+
async syncCheckboxElements() {
|
|
33
|
+
const checkboxes = this.getAllCheckboxes();
|
|
34
|
+
await Promise.all(
|
|
35
|
+
// Sync the checked state and size
|
|
36
|
+
checkboxes.map(async (checkbox) => {
|
|
37
|
+
await checkbox.updateComplete;
|
|
38
|
+
checkbox.size = this.size;
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
if (!checkboxes.some((checkbox) => checkbox.checked)) {
|
|
42
|
+
checkboxes[0].tabIndex = 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
syncCheckboxes() {
|
|
46
|
+
if (customElements.get("sd-checkbox")) {
|
|
47
|
+
this.syncCheckboxElements();
|
|
48
|
+
} else {
|
|
49
|
+
customElements.whenDefined("sd-checkbox").then(() => this.syncCheckboxes());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
handleSizeChange() {
|
|
53
|
+
this.syncCheckboxes();
|
|
54
|
+
}
|
|
55
|
+
handleInvalid() {
|
|
56
|
+
this.syncCheckboxes();
|
|
57
|
+
}
|
|
58
|
+
render() {
|
|
59
|
+
const hasLabelSlot = this.hasSlotController.test("label");
|
|
60
|
+
const hasLabel = this.label ? true : hasLabelSlot;
|
|
61
|
+
const defaultSlot = html`<slot @slotchange="${this.syncCheckboxes}"></slot>`;
|
|
62
|
+
return html`<fieldset part="form-control" class="${cx(
|
|
63
|
+
"border-0 p-0 m-0",
|
|
64
|
+
{
|
|
65
|
+
/* sizes, fonts */
|
|
66
|
+
sm: "text-sm",
|
|
67
|
+
lg: "text-base"
|
|
68
|
+
}[this.size]
|
|
69
|
+
)}" role="group" aria-labelledby="label"><label part="form-control-label" id="label" class="${cx("mb-2 p-0 font-bold leading-normal text-black", hasLabel ? "flex" : "hidden")}" aria-hidden="${!hasLabel}"><slot name="label">${this.label}</slot></label><div part="form-control-input" class="${cx(
|
|
70
|
+
{
|
|
71
|
+
vertical: "flex flex-col",
|
|
72
|
+
horizontal: "flex flex-row"
|
|
73
|
+
}[this.orientation]
|
|
74
|
+
)}">${defaultSlot}</div></fieldset>`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
SdCheckboxGroup.styles = [
|
|
78
|
+
componentStyles,
|
|
79
|
+
SolidElement.styles,
|
|
80
|
+
css`:host{display:block}:host([orientation=vertical]) ::slotted(sd-checkbox){margin-bottom:8px;display:flex}:host([orientation=vertical]) ::slotted(sd-checkbox:last-of-type){margin-bottom:0}:host([orientation=horizontal]) ::slotted(sd-checkbox){margin-right:24px}:host([size=sm]):host([orientation=horizontal]) ::slotted(sd-checkbox){margin-right:16px}:host([orientation=horizontal]) ::slotted(sd-checkbox:last-of-type){margin-right:0}`
|
|
81
|
+
];
|
|
82
|
+
__decorateClass([
|
|
83
|
+
property()
|
|
84
|
+
], SdCheckboxGroup.prototype, "label", 2);
|
|
85
|
+
__decorateClass([
|
|
86
|
+
property({ reflect: true })
|
|
87
|
+
], SdCheckboxGroup.prototype, "size", 2);
|
|
88
|
+
__decorateClass([
|
|
89
|
+
property({ reflect: true })
|
|
90
|
+
], SdCheckboxGroup.prototype, "orientation", 2);
|
|
91
|
+
__decorateClass([
|
|
92
|
+
watch("size", { waitUntilFirstUpdate: true })
|
|
93
|
+
], SdCheckboxGroup.prototype, "handleSizeChange", 1);
|
|
94
|
+
__decorateClass([
|
|
95
|
+
watch("invalid", { waitUntilFirstUpdate: true })
|
|
96
|
+
], SdCheckboxGroup.prototype, "handleInvalid", 1);
|
|
97
|
+
SdCheckboxGroup = __decorateClass([
|
|
98
|
+
customElement("sd-checkbox-group")
|
|
99
|
+
], SdCheckboxGroup);
|
|
100
|
+
export {
|
|
101
|
+
SdCheckboxGroup as default
|
|
102
|
+
};
|
|
@@ -14,6 +14,17 @@ const icons = {
|
|
|
14
14
|
<path d="M21.707 2.293a1 1 0 0 0-1.414 0L12 10.586 3.707 2.293a1 1 0 0 0-1.413 1.414l-.001-.001 8.293 8.293-8.293 8.293a1 1 0 0 0 0 1.414 1 1 0 0 0 1.414 0L12 13.413l8.293 8.293a1 1 0 0 0 1.414 0 1 1 0 0 0 0-1.414l-8.293-8.293 8.293-8.293a1 1 0 0 0 0-1.414z"/></svg>
|
|
15
15
|
</svg>
|
|
16
16
|
`,
|
|
17
|
+
"info-circle": `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2Zm0 18a8 8 0 1 1 0-16 8 8 0 0 1 0 16Z"/><path d="M13.333 7.833a1.5 1.5 0 1 1-3.001-.001 1.5 1.5 0 0 1 3.001.001ZM13 11.667a1 1 0 0 0-1-1h-1a1 1 0 0 0 0 2v2.667h2v-3.667Z"/><path d="M11 16.333v-1h-1a1 1 0 0 0 0 2h2a1 1 0 0 1-1-1Zm3-1h-1v1a1 1 0 0 1-1 1h2a1 1 0 0 0 0-2Z"/><path d="M13 16.333v-1h-2v1a1 1 0 0 0 2 0Z"/></svg>`,
|
|
18
|
+
"status-hook": `
|
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none">
|
|
20
|
+
<path fill="currentColor" d="m9.947 1.138-.005.008-.001.003-5.56 8.34-2.434-2.447-.004-.004a.648.648 0 0 0-1.093.475c0 .172.066.328.175.444l.003.004 3 2.999c.117.117.28.19.46.19h.065c.2-.021.37-.13.475-.286l.005-.008.001-.002 5.994-8.992a.65.65 0 0 0-.18-.902l-.007-.005-.002-.002a.65.65 0 0 0-.892.185Z"/>
|
|
21
|
+
</svg>
|
|
22
|
+
`,
|
|
23
|
+
"status-minus": `
|
|
24
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
|
|
25
|
+
<path d="M10 5.375H2C1.65496 5.375 1.375 5.65496 1.375 6C1.375 6.34504 1.65496 6.625 2 6.625H10C10.345 6.625 10.625 6.34504 10.625 6C10.625 5.65496 10.345 5.375 10 5.375Z" fill="currentColor"/>
|
|
26
|
+
</svg>
|
|
27
|
+
`,
|
|
17
28
|
start: `
|
|
18
29
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
19
30
|
<path d="m57.44 29.76-37.333-24A2.667 2.667 0 0 0 16 8v48a2.668 2.668 0 0 0 2.667 2.666 2.672 2.672 0 0 0 1.45-.431l-.01.005 37.333-24a2.67 2.67 0 0 0 1.192-2.221c0-.923-.47-1.74-1.184-2.216l-.01-.006.002-.037ZM21.333 51.112V12.89l29.734 19.112-29.734 19.11Z"/>
|
|
@@ -74,9 +74,7 @@ let SdRadio = class extends SolidElement {
|
|
|
74
74
|
render() {
|
|
75
75
|
return html`<span part="base" class="${cx(
|
|
76
76
|
"sd-radio group inline-flex items-start items-center text-base leading-normal text-black cursor-pointer align-middle",
|
|
77
|
-
this.checked && "radio--checked",
|
|
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
|
}
|
|
@@ -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
261
|
SdRadioGroup.dependencies = { "sd-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-radio){margin-bottom:8px;display:flex}:host([orientation=vertical]) ::slotted(sd-radio:last-of-type){margin-bottom:0}:host([orientation=horizontal]) ::slotted(sd-radio){margin-right:24px}:host([size=sm]):host([orientation=horizontal]) ::slotted(sd-radio){margin-right:16px}:host([orientation=horizontal]) ::slotted(sd-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()
|
|
@@ -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-tooltip': SdTooltip;
|
|
38
|
+
}
|
|
39
|
+
}
|