@solid-design-system/components 3.22.1 → 3.22.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/es/checkbox.js +1 -1
- package/dist/components/es/form.js +1 -1
- package/dist/components/es/input.js +6 -1
- package/dist/components/es/live.js +2 -2
- package/dist/components/es/radio-group.js +1 -1
- package/dist/components/es/select.js +1 -1
- package/dist/components/es/switch.js +1 -1
- package/dist/components/es/textarea.js +1 -1
- package/dist/components/umd/solid-components.js +20 -15
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/checkbox/checkbox.js +1 -1
- package/dist/package/components/input/input.d.ts +6 -1
- package/dist/package/components/input/input.js +38 -5
- package/dist/package/components/radio-group/radio-group.js +1 -1
- package/dist/package/components/select/select.js +1 -1
- package/dist/package/components/switch/switch.js +1 -1
- package/dist/package/components/textarea/textarea.js +1 -1
- package/dist/package/internal/form.js +2 -0
- package/dist/package/internal/longpress.d.ts +24 -0
- package/dist/package/internal/longpress.js +80 -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/audio.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/dialog.js +1 -1
- 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/expandable.js +1 -1
- package/dist/versioned-components/es/flipcard.js +1 -1
- 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 +1 -1
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/input.js +6 -1
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/live.js +2 -2
- package/dist/versioned-components/es/map-marker.js +1 -1
- 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 -1
- package/dist/versioned-components/es/quickfact.js +1 -1
- package/dist/versioned-components/es/radio-button.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/scrollable.js +1 -1
- package/dist/versioned-components/es/select.js +3 -3
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/step-group.js +1 -1
- package/dist/versioned-components/es/step.js +1 -1
- package/dist/versioned-components/es/switch.js +1 -1
- package/dist/versioned-components/es/tab-group.js +1 -1
- package/dist/versioned-components/es/tab-panel.js +1 -1
- package/dist/versioned-components/es/tab.js +1 -1
- package/dist/versioned-components/es/tag.js +1 -1
- package/dist/versioned-components/es/teaser-media.js +1 -1
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-components/es/textarea.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/audio/audio.d.ts +1 -1
- package/dist/versioned-package/components/audio/audio.js +6 -6
- 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/dialog/dialog.d.ts +1 -1
- package/dist/versioned-package/components/dialog/dialog.js +2 -2
- 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/expandable/expandable.d.ts +1 -1
- package/dist/versioned-package/components/expandable/expandable.js +2 -2
- package/dist/versioned-package/components/flipcard/flipcard.d.ts +1 -1
- package/dist/versioned-package/components/flipcard/flipcard.js +1 -1
- 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 +7 -2
- package/dist/versioned-package/components/input/input.js +39 -6
- 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/map-marker/map-marker.d.ts +1 -1
- package/dist/versioned-package/components/map-marker/map-marker.js +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.d.ts +1 -1
- package/dist/versioned-package/components/navigation-item/navigation-item.js +5 -5
- 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 +1 -1
- package/dist/versioned-package/components/option/option.js +2 -2
- 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/quickfact/quickfact.d.ts +1 -1
- package/dist/versioned-package/components/quickfact/quickfact.js +2 -2
- 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-button/radio-button.d.ts +1 -1
- package/dist/versioned-package/components/radio-button/radio-button.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/scrollable/scrollable.d.ts +1 -1
- package/dist/versioned-package/components/scrollable/scrollable.js +3 -3
- package/dist/versioned-package/components/select/select.d.ts +4 -4
- package/dist/versioned-package/components/select/select.js +25 -25
- 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/step/step.d.ts +1 -1
- package/dist/versioned-package/components/step/step.js +2 -2
- package/dist/versioned-package/components/step-group/step-group.d.ts +1 -1
- package/dist/versioned-package/components/step-group/step-group.js +2 -2
- 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/tab/tab.d.ts +1 -1
- package/dist/versioned-package/components/tab/tab.js +2 -2
- package/dist/versioned-package/components/tab-group/tab-group.d.ts +1 -1
- package/dist/versioned-package/components/tab-group/tab-group.js +13 -13
- package/dist/versioned-package/components/tab-panel/tab-panel.d.ts +1 -1
- package/dist/versioned-package/components/tab-panel/tab-panel.js +2 -2
- 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/teaser-media/teaser-media.js +1 -1
- package/dist/versioned-package/components/textarea/textarea.d.ts +1 -1
- package/dist/versioned-package/components/textarea/textarea.js +2 -2
- 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 +5 -3
- package/dist/versioned-package/internal/longpress.d.ts +24 -0
- package/dist/versioned-package/internal/longpress.js +80 -0
- package/dist/versioned-package/styles/headline/headline.css.js +1 -1
- package/dist/versioned-package/utilities/autocomplete-config.js +4 -4
- package/dist/versioned-styles/solid-styles.css +1 -1
- package/dist/vscode.html-custom-data.json +49 -49
- package/dist/web-types.json +94 -54
- package/package.json +3 -3
@@ -117,7 +117,7 @@ let SdCheckbox = class extends SolidElement {
|
|
117
117
|
md: "text-base",
|
118
118
|
lg: "text-base"
|
119
119
|
}[this.size]
|
120
|
-
)}"><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(
|
120
|
+
)}"><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"}" aria-describedby="invalid-message" @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(
|
121
121
|
`relative flex flex-shrink-0 items-center justify-center border rounded-sm h-4 w-4
|
122
122
|
peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2
|
123
123
|
peer-focus-visible:outline-primary`,
|
@@ -25,7 +25,7 @@ export default class SdInput extends SolidElement implements SolidFormControl {
|
|
25
25
|
readonly: boolean;
|
26
26
|
passwordToggle: boolean;
|
27
27
|
passwordVisible: boolean;
|
28
|
-
|
28
|
+
spinButtons: boolean;
|
29
29
|
minlength: number;
|
30
30
|
maxlength: number;
|
31
31
|
min: number | string;
|
@@ -57,6 +57,11 @@ export default class SdInput extends SolidElement implements SolidFormControl {
|
|
57
57
|
private handleInvalid;
|
58
58
|
private handleKeyDown;
|
59
59
|
private handlePasswordToggle;
|
60
|
+
private isDecrementDisabled;
|
61
|
+
private isIncrementDisabled;
|
62
|
+
private handleStep;
|
63
|
+
private handleStepUp;
|
64
|
+
private handleStepDown;
|
60
65
|
handleDisabledChange(): void;
|
61
66
|
handleStepChange(): void;
|
62
67
|
handleValueChange(): Promise<void>;
|
@@ -8,6 +8,7 @@ import { HasSlotController } from "../../internal/slot.js";
|
|
8
8
|
import { ifDefined } from "lit/directives/if-defined.js";
|
9
9
|
import { live } from "lit/directives/live.js";
|
10
10
|
import { LocalizeController } from "../../utilities/localize.js";
|
11
|
+
import { longPress } from "../../internal/longpress.js";
|
11
12
|
import { query, state, property } from "lit/decorators.js";
|
12
13
|
import { watch } from "../../internal/watch.js";
|
13
14
|
import componentStyles from "../../styles/component.styles.js";
|
@@ -54,7 +55,7 @@ let SdInput = class extends SolidElement {
|
|
54
55
|
this.readonly = false;
|
55
56
|
this.passwordToggle = false;
|
56
57
|
this.passwordVisible = false;
|
57
|
-
this.
|
58
|
+
this.spinButtons = false;
|
58
59
|
this.form = "";
|
59
60
|
this.name = "";
|
60
61
|
this.title = "";
|
@@ -134,6 +135,38 @@ let SdInput = class extends SolidElement {
|
|
134
135
|
handlePasswordToggle() {
|
135
136
|
this.passwordVisible = !this.passwordVisible;
|
136
137
|
}
|
138
|
+
isDecrementDisabled() {
|
139
|
+
if (this.disabled || this.readonly) {
|
140
|
+
return true;
|
141
|
+
}
|
142
|
+
if (this.min === void 0 || this.min === null) {
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
const min = typeof this.min === "string" ? parseFloat(this.min) : this.min;
|
146
|
+
return this.valueAsNumber <= min;
|
147
|
+
}
|
148
|
+
isIncrementDisabled() {
|
149
|
+
if (this.disabled || this.readonly) {
|
150
|
+
return true;
|
151
|
+
}
|
152
|
+
if (this.max === void 0 || this.max === null) {
|
153
|
+
return false;
|
154
|
+
}
|
155
|
+
const max = typeof this.max === "string" ? parseFloat(this.max) : this.max;
|
156
|
+
return this.valueAsNumber >= max;
|
157
|
+
}
|
158
|
+
handleStep() {
|
159
|
+
this.handleInput();
|
160
|
+
this.input.focus();
|
161
|
+
}
|
162
|
+
handleStepUp() {
|
163
|
+
this.stepUp();
|
164
|
+
this.handleStep();
|
165
|
+
}
|
166
|
+
handleStepDown() {
|
167
|
+
this.stepDown();
|
168
|
+
this.handleStep();
|
169
|
+
}
|
137
170
|
handleDisabledChange() {
|
138
171
|
this.formControlController.setValidity(this.disabled);
|
139
172
|
}
|
@@ -245,13 +278,13 @@ let SdInput = class extends SolidElement {
|
|
245
278
|
"min-w-0 flex-grow focus:outline-none bg-transparent placeholder-neutral-700",
|
246
279
|
this.size === "sm" ? "h-6" : "h-8",
|
247
280
|
textSize
|
248
|
-
)}" type="${this.type === "password" && this.passwordVisible ? "text" : this.type}" title="${this.title}" name="${ifDefined(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" min="${ifDefined(this.min)}" max="${ifDefined(this.max)}" step="${ifDefined(this.step)}" .value="${live(this.value)}" autocapitalize="${ifDefined(this.type === "password" ? "off" : this.autocapitalize)}" autocomplete="${ifDefined(this.type === "password" ? "off" : this.autocomplete)}" autocorrect="${ifDefined(this.type === "password" ? "off" : this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${ifDefined(this.pattern)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("flex justify-center ", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${cx("icon-fill-neutral-800", iconSize)}" library="system" name="closing-round"></sd-icon></slot></button>` : ""} ${this.passwordToggle && this.type === "password" ? html`<button aria-label="${this.localize.term(this.passwordVisible ? "hidePassword" : "showPassword")}" part="password-toggle-button" class="flex items-center" type="button" @click="${this.handlePasswordToggle}" tabindex="-1">${this.passwordVisible ? html`<slot name="show-password-icon"><sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="eye"></sd-icon></slot>` : html`<slot name="hide-password-icon"><sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="eye-crossed-out"></sd-icon></slot>`}</button>` : ""} ${(this.type === "date" || this.type === "datetime-local") && !isFirefox ? html`<sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="calendar"></sd-icon>` : ""} ${this.type === "time" ? html`<sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="clock"></sd-icon>` : ""} ${this.type === "search" ? html`<button class="flex items-center" type="button" tabindex="-1"><sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="magnifying-glass"></sd-icon></button>` : ""} ${this.showInvalidStyle ? html`<sd-icon part="invalid-icon" class="${cx("text-error", iconMarginLeft, iconSize)}" library="system" name="risk"></sd-icon>` : ""} ${this.showValidStyle && this.styleOnValid ? html`<sd-icon class="${cx("text-success flex-shrink-0", iconMarginLeft, iconSize)}" library="system" name="status-check" part="valid-icon"></sd-icon>` : ""} ${slots["right"] ? html`<slot name="right" part="right" class="${cx("inline-flex", iconColor, iconMarginLeft, iconSize)}"></slot>` : ""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${!hasHelpText}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`;
|
281
|
+
)}" type="${this.type === "password" && this.passwordVisible ? "text" : this.type}" title="${this.title}" name="${ifDefined(this.name)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" min="${ifDefined(this.min)}" max="${ifDefined(this.max)}" step="${ifDefined(this.step)}" .value="${live(this.value)}" autocapitalize="${ifDefined(this.type === "password" ? "off" : this.autocapitalize)}" autocomplete="${ifDefined(this.type === "password" ? "off" : this.autocomplete)}" autocorrect="${ifDefined(this.type === "password" ? "off" : this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${this.spellcheck}" pattern="${ifDefined(this.pattern)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text invalid-message" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @keydown="${this.handleKeyDown}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("flex justify-center ", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${cx("icon-fill-neutral-800", iconSize)}" library="system" name="closing-round"></sd-icon></slot></button>` : ""} ${this.passwordToggle && this.type === "password" ? html`<button aria-label="${this.localize.term(this.passwordVisible ? "hidePassword" : "showPassword")}" part="password-toggle-button" class="flex items-center" type="button" @click="${this.handlePasswordToggle}" tabindex="-1">${this.passwordVisible ? html`<slot name="show-password-icon"><sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="eye"></sd-icon></slot>` : html`<slot name="hide-password-icon"><sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="eye-crossed-out"></sd-icon></slot>`}</button>` : ""} ${(this.type === "date" || this.type === "datetime-local") && !isFirefox ? html`<sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="calendar"></sd-icon>` : ""} ${this.type === "time" ? html`<sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="clock"></sd-icon>` : ""} ${this.type === "search" ? html`<button class="flex items-center" type="button" tabindex="-1"><sd-icon class="${cx(iconColor, iconMarginLeft, iconSize)}" library="system" name="magnifying-glass"></sd-icon></button>` : ""} ${this.showInvalidStyle ? html`<sd-icon part="invalid-icon" class="${cx("text-error", iconMarginLeft, iconSize)}" library="system" name="risk"></sd-icon>` : ""} ${this.showValidStyle && this.styleOnValid ? html`<sd-icon class="${cx("text-success flex-shrink-0", iconMarginLeft, iconSize)}" library="system" name="status-check" part="valid-icon"></sd-icon>` : ""} ${slots["right"] ? html`<slot name="right" part="right" class="${cx("inline-flex", iconColor, iconMarginLeft, iconSize)}"></slot>` : ""} ${this.type === "number" && this.spinButtons ? html`<div part="stepper" class="flex items-center"><button part="decrement-number-stepper" class="stepper-button flex" type="button" ?disabled="${this.isDecrementDisabled()}" aria-hidden="true" ${longPress({ start: () => this.handleStepDown(), end: () => this.handleChange() })} tabindex="-1"><slot name="decrement-number-stepper"><sd-icon library="global-resources" name="system/minus-round" label="Decrease value" class="${cx(iconColor, iconMarginLeft, iconSize)}"></sd-icon></slot></button> <button part="increment-number-stepper" class="stepper-button flex" type="button" ?disabled="${this.isIncrementDisabled()}" aria-hidden="true" ${longPress({ start: () => this.handleStepUp(), end: () => this.handleChange() })} tabindex="-1"><slot name="increment-number-stepper"><sd-icon library="global-resources" name="system/plus-round" label="Decrease value" class="${cx(iconColor, iconMarginLeft, iconSize)}"></sd-icon></slot></button></div>` : ""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${!hasHelpText}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`;
|
249
282
|
}
|
250
283
|
};
|
251
284
|
SdInput.styles = [
|
252
285
|
componentStyles,
|
253
286
|
SolidElement.styles,
|
254
|
-
css`:host{position:relative;box-sizing:border-box;display:inline-block;width:100%;text-align:left}:host([vertical]){display:block}:host([required]) #label::after{content:' *'}details summary::-webkit-details-marker{display:none}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}input[type=time]::-webkit-calendar-picker-indicator{background:0 0}details summary::-webkit-details-marker,input[type=date]::-webkit-calendar-picker-indicator,input[type=datetime-local]::-webkit-calendar-picker-indicator,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{display:none}`
|
287
|
+
css`:host{position:relative;box-sizing:border-box;display:inline-block;width:100%;text-align:left}:host([vertical]){display:block}:host([required]) #label::after{content:' *'}details summary::-webkit-details-marker{display:none}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}input[type=time]::-webkit-calendar-picker-indicator{background:0 0}details summary::-webkit-details-marker,input[type=date]::-webkit-calendar-picker-indicator,input[type=datetime-local]::-webkit-calendar-picker-indicator,input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration,input[type=search]::-webkit-search-results-button,input[type=search]::-webkit-search-results-decoration{display:none}.stepper-button[disabled] sd-icon{--tw-text-opacity:1;color:rgb(var(--sd-color-neutral-500,174 174 174) / var(--tw-text-opacity))}`
|
255
288
|
];
|
256
289
|
__decorateClass([
|
257
290
|
query("#input")
|
@@ -308,8 +341,8 @@ __decorateClass([
|
|
308
341
|
property({ attribute: "password-visible", type: Boolean })
|
309
342
|
], SdInput.prototype, "passwordVisible", 2);
|
310
343
|
__decorateClass([
|
311
|
-
property({ attribute: "
|
312
|
-
], SdInput.prototype, "
|
344
|
+
property({ attribute: "spin-buttons", type: Boolean })
|
345
|
+
], SdInput.prototype, "spinButtons", 2);
|
313
346
|
__decorateClass([
|
314
347
|
property({ type: Number })
|
315
348
|
], SdInput.prototype, "minlength", 2);
|
@@ -243,7 +243,7 @@ let SdRadioGroup = class extends SolidElement {
|
|
243
243
|
md: "text-base",
|
244
244
|
lg: "text-base"
|
245
245
|
}[this.size]
|
246
|
-
)}" role="radiogroup" aria-
|
246
|
+
)}" role="radiogroup" aria-describedby="invalid-message"><div class="flex items-center gap-1 mb-2"><legend part="form-control-label" id="label" class="${cx("p-0 leading-normal text-black text-left", !hasLabel && "hidden", this.boldLabel && "font-bold")}" @click="${this.focus}" aria-hidden="${hasLabel ? "false" : "true"}"><slot name="label">${this.label}</slot></legend><slot name="tooltip"></slot></div><div part="form-control-input" class="${cx(
|
247
247
|
"flex",
|
248
248
|
{
|
249
249
|
vertical: "flex-col",
|
@@ -528,7 +528,7 @@ let SdSelect = class extends SolidElement {
|
|
528
528
|
"appearance-none outline-none flex-grow bg-transparent w-full",
|
529
529
|
cursorStyles,
|
530
530
|
this.multiple && this.useTags && this.value.length > 0 ? "hidden" : ""
|
531
|
-
)}" type="text" placeholder="${this.placeholder}" .disabled="${this.disabled}" .value="${this.displayLabel}" autocomplete="off" spellcheck="false" autocapitalize="off" readonly="readonly" aria-controls="listbox" aria-expanded="${this.open ? "true" : "false"}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled ? "true" : "false"}" aria-describedby="help-text" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${this.multiple && this.useTags ? html`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>` : ""} <input class="${cx("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10", cursorStyles)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value) ? this.value.join(", ") : this.value}" tabindex="-1" aria-hidden="true" @focus="${() => this.focus()}" @invalid="${this.handleInvalid}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("select__clear flex justify-center", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${cx("text-icon-fill-neutral-800", iconSize)}" library="system" name="closing-round"></sd-icon></slot></button>` : ""} ${this.showInvalidStyle ? html`<sd-icon part="invalid-icon" class="${cx(iconMarginLeft, iconSize, "text-error")}" library="system" name="risk"></sd-icon>` : ""} ${this.styleOnValid && this.showValidStyle ? html`<sd-icon part="valid-icon" class="${cx("flex-shrink-0 text-success", iconMarginLeft, iconSize)}" library="system" name="status-check"></sd-icon>` : ""}<slot name="expand-icon" part="expand-icon" class="${cx(
|
531
|
+
)}" type="text" placeholder="${this.placeholder}" .disabled="${this.disabled}" .value="${this.displayLabel}" autocomplete="off" spellcheck="false" autocapitalize="off" readonly="readonly" aria-controls="listbox" aria-expanded="${this.open ? "true" : "false"}" aria-haspopup="listbox" aria-labelledby="label" aria-disabled="${this.disabled ? "true" : "false"}" aria-describedby="help-text invalid-message" role="combobox" tabindex="0" @focus="${this.handleFocus}" @blur="${this.handleBlur}"> ${this.multiple && this.useTags ? html`<div part="tags" class="flex-grow flex flex-wrap items-center gap-1">${this.tags}</div>` : ""} <input class="${cx("value-input absolute top-0 left-0 w-full h-full opacity-0 -z-10", cursorStyles)}" type="text" ?disabled="${this.disabled}" ?required="${this.required}" .value="${Array.isArray(this.value) ? this.value.join(", ") : this.value}" tabindex="-1" aria-hidden="true" @focus="${() => this.focus()}" @invalid="${this.handleInvalid}"> ${hasClearIcon ? html`<button part="clear-button" class="${cx("select__clear flex justify-center", iconMarginLeft)}" type="button" aria-label="${this.localize.term("clearEntry")}" @mousedown="${this.handleClearMouseDown}" @click="${this.handleClearClick}" tabindex="-1"><slot name="clear-icon"><sd-icon class="${cx("text-icon-fill-neutral-800", iconSize)}" library="system" name="closing-round"></sd-icon></slot></button>` : ""} ${this.showInvalidStyle ? html`<sd-icon part="invalid-icon" class="${cx(iconMarginLeft, iconSize, "text-error")}" library="system" name="risk"></sd-icon>` : ""} ${this.styleOnValid && this.showValidStyle ? html`<sd-icon part="valid-icon" class="${cx("flex-shrink-0 text-success", iconMarginLeft, iconSize)}" library="system" name="status-check"></sd-icon>` : ""}<slot name="expand-icon" part="expand-icon" class="${cx(
|
532
532
|
"inline-flex ml-2 transition-all",
|
533
533
|
this.open ? "rotate-180" : "rotate-0",
|
534
534
|
this.disabled ? "text-neutral-500" : "text-primary",
|
@@ -104,7 +104,7 @@ let SdSwitch = class extends SolidElement {
|
|
104
104
|
return html`<label part="base" class="${cx(
|
105
105
|
"group flex items-center text-base leading-normal text-black cursor-pointer",
|
106
106
|
this.disabled && "hover:cursor-not-allowed"
|
107
|
-
)}"><input id="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)}" .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"}" class="${cx(
|
107
|
+
)}"><input id="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)}" .checked="${live(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" aria-checked="${this.checked ? "true" : "false"}" aria-describedby="invalid-message" @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"}" class="${cx(
|
108
108
|
`relative flex flex-initial items-center justify-center border rounded-full h-4 w-8 transition-colors ease duration-100
|
109
109
|
peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2
|
110
110
|
peer-focus-visible:outline-primary`,
|
@@ -199,7 +199,7 @@ let SdTextarea = class extends SolidElement {
|
|
199
199
|
"flex-grow focus:outline-none bg-transparent placeholder-neutral-700 resize-none",
|
200
200
|
this.disabled && "cursor-not-allowed",
|
201
201
|
textSize
|
202
|
-
)}" title="${this.title}" name="${ifDefined(this.name)}" .value="${live(this.value)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" rows="${ifDefined(this.rows)}" autocapitalize="${ifDefined(this.autocapitalize)}" autocorrect="${ifDefined(this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${ifDefined(this.spellcheck)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"></textarea> ${this.showInvalidStyle ? html`<sd-icon class="${cx("text-error absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="risk" part="invalid-icon"></sd-icon>` : ""} ${this.styleOnValid && this.showValidStyle ? html`<sd-icon class="${cx("text-success absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="status-check" part="valid-icon"></sd-icon>` : ""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${hasHelpText ? "false" : "true"}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`;
|
202
|
+
)}" title="${this.title}" name="${ifDefined(this.name)}" .value="${live(this.value)}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" placeholder="${ifDefined(this.placeholder)}" minlength="${ifDefined(this.minlength)}" maxlength="${ifDefined(this.maxlength)}" rows="${ifDefined(this.rows)}" autocapitalize="${ifDefined(this.autocapitalize)}" autocorrect="${ifDefined(this.autocorrect)}" ?autofocus="${this.autofocus}" spellcheck="${ifDefined(this.spellcheck)}" enterkeyhint="${ifDefined(this.enterkeyhint)}" inputmode="${ifDefined(this.inputmode)}" aria-describedby="help-text invalid-message" @change="${this.handleChange}" @input="${this.handleInput}" @invalid="${this.handleInvalid}" @focus="${this.handleFocus}" @blur="${this.handleBlur}"></textarea> ${this.showInvalidStyle ? html`<sd-icon class="${cx("text-error absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="risk" part="invalid-icon"></sd-icon>` : ""} ${this.styleOnValid && this.showValidStyle ? html`<sd-icon class="${cx("text-success absolute right-4 bg-white group-hover:bg-neutral-200", iconSizeMarginLeft)}" library="system" name="status-check" part="valid-icon"></sd-icon>` : ""}</div></div><slot name="help-text" part="form-control-help-text" id="help-text" class="${cx("text-sm text-neutral-700", hasHelpText ? "block" : "hidden")}" aria-hidden="${hasHelpText ? "false" : "true"}">${this.helpText}</slot></div>${this.formControlController.renderInvalidMessage()}`;
|
203
203
|
}
|
204
204
|
};
|
205
205
|
SdTextarea.styles = [
|
@@ -233,6 +233,7 @@ class FormControlController {
|
|
233
233
|
host.removeAttribute("data-valid");
|
234
234
|
host.removeAttribute("data-user-invalid");
|
235
235
|
host.removeAttribute("data-user-valid");
|
236
|
+
host.removeAttribute("aria-invalid");
|
236
237
|
} else {
|
237
238
|
host.toggleAttribute("data-required", required);
|
238
239
|
host.toggleAttribute("data-optional", !required);
|
@@ -240,6 +241,7 @@ class FormControlController {
|
|
240
241
|
host.toggleAttribute("data-valid", isValid);
|
241
242
|
host.toggleAttribute("data-user-invalid", !isValid && hasInteracted);
|
242
243
|
host.toggleAttribute("data-user-valid", isValid && hasInteracted);
|
244
|
+
host.setAttribute("aria-invalid", (!isValid).toString());
|
243
245
|
}
|
244
246
|
}
|
245
247
|
/**
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { AsyncDirective, type DirectiveParameters, type Part } from 'lit/async-directive.js';
|
3
|
+
import { type ElementPart, noChange, nothing } from 'lit';
|
4
|
+
interface Callbacks {
|
5
|
+
start: () => void;
|
6
|
+
end: () => void;
|
7
|
+
}
|
8
|
+
declare class LongPressDirective extends AsyncDirective {
|
9
|
+
host: HTMLButtonElement;
|
10
|
+
observer: MutationObserver;
|
11
|
+
callbacks: Callbacks;
|
12
|
+
interval: NodeJS.Timeout;
|
13
|
+
timeout: NodeJS.Timeout;
|
14
|
+
constructor(part: Part);
|
15
|
+
render(_callback: Callbacks): typeof nothing;
|
16
|
+
update(part: ElementPart, [callbacks]: DirectiveParameters<this>): typeof noChange;
|
17
|
+
protected disconnected(): void;
|
18
|
+
private handlePointerDown;
|
19
|
+
private spinOnLongPressCallback;
|
20
|
+
private handlePointerUp;
|
21
|
+
private stopSpinningAndCleanUp;
|
22
|
+
}
|
23
|
+
export declare const longPress: (_callback: Callbacks) => import("lit/async-directive").DirectiveResult<typeof LongPressDirective>;
|
24
|
+
export type { LongPressDirective };
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { directive, AsyncDirective, PartType } from "lit/async-directive.js";
|
2
|
+
import { nothing, noChange } from "lit";
|
3
|
+
class LongPressDirective extends AsyncDirective {
|
4
|
+
constructor(part) {
|
5
|
+
super(part);
|
6
|
+
this.handlePointerDown = (event) => {
|
7
|
+
if (event.button !== 0 || this.host.disabled) {
|
8
|
+
return;
|
9
|
+
}
|
10
|
+
this.spinOnLongPressCallback(event);
|
11
|
+
};
|
12
|
+
this.handlePointerUp = (pointerUp) => {
|
13
|
+
pointerUp == null ? void 0 : pointerUp.preventDefault();
|
14
|
+
pointerUp == null ? void 0 : pointerUp.stopPropagation();
|
15
|
+
if (this.timeout) {
|
16
|
+
this.callbacks.start();
|
17
|
+
}
|
18
|
+
this.stopSpinningAndCleanUp();
|
19
|
+
this.callbacks.end();
|
20
|
+
document.removeEventListener("pointerup", this.handlePointerUp);
|
21
|
+
};
|
22
|
+
if (part.type !== PartType.ELEMENT || !(part.element instanceof HTMLButtonElement)) {
|
23
|
+
throw new Error("The `longPress` directive must be used on an HTMLButtonElement.");
|
24
|
+
}
|
25
|
+
}
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
|
27
|
+
render(_callback) {
|
28
|
+
return nothing;
|
29
|
+
}
|
30
|
+
update(part, [callbacks]) {
|
31
|
+
if (this.callbacks === void 0 && this.host === void 0) {
|
32
|
+
this.host = part.element;
|
33
|
+
this.callbacks = { ...callbacks };
|
34
|
+
this.host.addEventListener("pointerdown", this.handlePointerDown);
|
35
|
+
}
|
36
|
+
return noChange;
|
37
|
+
}
|
38
|
+
disconnected() {
|
39
|
+
this.stopSpinningAndCleanUp();
|
40
|
+
this.host.removeEventListener("pointerdown", this.handlePointerDown);
|
41
|
+
document.removeEventListener("pointerup", this.handlePointerUp);
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Start spinning on long press clicks otherwise handle as single click event
|
45
|
+
*/
|
46
|
+
spinOnLongPressCallback(event) {
|
47
|
+
var _a;
|
48
|
+
event.preventDefault();
|
49
|
+
event.stopPropagation();
|
50
|
+
this.timeout = setTimeout(() => {
|
51
|
+
this.timeout = void 0;
|
52
|
+
this.interval = setInterval(() => {
|
53
|
+
this.callbacks.start();
|
54
|
+
}, 50);
|
55
|
+
}, 500);
|
56
|
+
document.addEventListener("pointerup", this.handlePointerUp);
|
57
|
+
(_a = this.observer) == null ? void 0 : _a.disconnect();
|
58
|
+
this.observer = new MutationObserver((mutations) => {
|
59
|
+
mutations.forEach((mutation) => {
|
60
|
+
if (mutation.attributeName === "disabled") {
|
61
|
+
this.stopSpinningAndCleanUp();
|
62
|
+
}
|
63
|
+
});
|
64
|
+
});
|
65
|
+
this.observer.observe(this.host, { attributes: true });
|
66
|
+
}
|
67
|
+
/**
|
68
|
+
* Stop the spinning and clean up all timer and observer
|
69
|
+
*/
|
70
|
+
stopSpinningAndCleanUp() {
|
71
|
+
var _a;
|
72
|
+
clearInterval(this.interval);
|
73
|
+
clearTimeout(this.timeout);
|
74
|
+
(_a = this.observer) == null ? void 0 : _a.disconnect();
|
75
|
+
}
|
76
|
+
}
|
77
|
+
const longPress = directive(LongPressDirective);
|
78
|
+
export {
|
79
|
+
longPress
|
80
|
+
};
|
@@ -1 +1 @@
|
|
1
|
-
import"./accordion.js";import{S as e,x as t,c as o,i as s,n as r,a}from"./solid-components2.js";import{o as c}from"./query-assigned-elements.js";var n=Object.defineProperty,d=Object.getOwnPropertyDescriptor,i=(e,t,o,s)=>{for(var r,a=s>1?void 0:s?d(t,o):t,c=e.length-1;c>=0;c--)(r=e[c])&&(a=(s?r(t,o,a):r(a))||a);return s&&a&&n(t,o,a),a};let l=class extends e{constructor(){super(...arguments),this.closeOthers=!1,this.handleAccordionShow=e=>{this.closeOthers&&this._accordionsInDefaultSlot.forEach((t=>{t!==e.target&&t.parentNode===e.target.parentNode&&t.removeAttribute("open")}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("sd-show",this.handleAccordionShow)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("sd-show",this.handleAccordionShow)}render(){return t`<div part="base"><slot></slot></div>`}};l.styles=[o,e.styles,s`:host{display:block}::slotted(sd-3-22-
|
1
|
+
import"./accordion.js";import{S as e,x as t,c as o,i as s,n as r,a}from"./solid-components2.js";import{o as c}from"./query-assigned-elements.js";var n=Object.defineProperty,d=Object.getOwnPropertyDescriptor,i=(e,t,o,s)=>{for(var r,a=s>1?void 0:s?d(t,o):t,c=e.length-1;c>=0;c--)(r=e[c])&&(a=(s?r(t,o,a):r(a))||a);return s&&a&&n(t,o,a),a};let l=class extends e{constructor(){super(...arguments),this.closeOthers=!1,this.handleAccordionShow=e=>{this.closeOthers&&this._accordionsInDefaultSlot.forEach((t=>{t!==e.target&&t.parentNode===e.target.parentNode&&t.removeAttribute("open")}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("sd-show",this.handleAccordionShow)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("sd-show",this.handleAccordionShow)}render(){return t`<div part="base"><slot></slot></div>`}};l.styles=[o,e.styles,s`:host{display:block}::slotted(sd-3-22-3-accordion:not(:first-of-type)){margin-top:-1px}`],i([c({selector:"sd-3-22-3-accordion"})],l.prototype,"_accordionsInDefaultSlot",2),i([r({attribute:"close-others",type:Boolean})],l.prototype,"closeOthers",2),l=i([a("sd-3-22-3-accordion-group")],l);export{l as default};
|
@@ -1 +1 @@
|
|
1
|
-
import"./icon.js";import{s as e,a as t,b as s}from"./animate.js";import{S as o,L as i,x as a,t as r,i as n,e as h,n as d,a as l}from"./solid-components2.js";import{g as p,s as c}from"./animation-registry.js";import{w as y}from"./event.js";import{w as m}from"./watch.js";var u=Object.defineProperty,f=Object.getOwnPropertyDescriptor,b=(e,t,s,o)=>{for(var i,a=o>1?void 0:o?f(t,s):t,r=e.length-1;r>=0;r--)(i=e[r])&&(a=(o?i(t,s,a):i(a))||a);return o&&a&&u(t,s,a),a};let w=class extends o{constructor(){super(...arguments),this.localize=new i(this),this.open=!1}firstUpdated(){this.body.hidden=!this.open,this.body.style.height=this.open?"auto":"0"}handleSummaryClick(){this.open?this.hide():this.show()}handleSummaryKeyDown(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),this.open?this.hide():this.show()),("ArrowUp"===e.key||"ArrowLeft"===e.key)&&(e.preventDefault(),this.hide()),("ArrowDown"===e.key||"ArrowRight"===e.key)&&(e.preventDefault(),this.show())}async handleOpenChange(){if(this.open){if(this.emit("sd-show",{cancelable:!0}).defaultPrevented)return void(this.open=!1);await e(this.body),this.body.hidden=!1;const{keyframes:o,options:i}=p(this,"accordion.show",{dir:this.localize.dir()});await t(this.body,s(o,this.body.scrollHeight),i),this.body.style.height="auto",this.emit("sd-after-show")}else{if(this.emit("sd-hide",{cancelable:!0}).defaultPrevented)return void(this.open=!0);await e(this.body);const{keyframes:o,options:i}=p(this,"accordion.hide",{dir:this.localize.dir()});await t(this.body,s(o,this.body.scrollHeight),i),this.body.hidden=!0,this.body.style.height="auto",this.emit("sd-after-hide")}}async show(){if(!this.open)return this.open=!0,y(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,y(this,"sd-after-hide")}render(){return a`<div part="base" class="border-y border-neutral-400"><header part="header" id="header" class="${r("flex text-base gap-4 font-bold items-center cursor-pointer select-none px-4 py-3 focus-visible:focus-outline text-primary hover:bg-neutral-200 relative group")}" role="button" aria-expanded="${this.open?"true":"false"}" aria-controls="content" tabindex="0" @click="${this.handleSummaryClick}" @keydown="${this.handleSummaryKeyDown}"><div part="summary-border" class="${r(!this.open&&"opacity-0","w-1 bg-accent absolute left-0 transition-all h-[calc(100%-16px)] group-hover:h-full")}"></div><slot name="summary" part="summary" class="flex flex-auto items-center text-left">${this.summary}</slot><span part="summary-icon" class="${r("flex flex-grow-0 flex-shrink-0 flex-auto items-center transition-all ease-in-out duration-300 text-xl",this.open&&"rotate-180")}"><slot name="expand-icon" class="${r(this.open&&"hidden")}"><sd-3-22-
|
1
|
+
import"./icon.js";import{s as e,a as t,b as s}from"./animate.js";import{S as o,L as i,x as a,t as r,i as n,e as h,n as d,a as l}from"./solid-components2.js";import{g as p,s as c}from"./animation-registry.js";import{w as y}from"./event.js";import{w as m}from"./watch.js";var u=Object.defineProperty,f=Object.getOwnPropertyDescriptor,b=(e,t,s,o)=>{for(var i,a=o>1?void 0:o?f(t,s):t,r=e.length-1;r>=0;r--)(i=e[r])&&(a=(o?i(t,s,a):i(a))||a);return o&&a&&u(t,s,a),a};let w=class extends o{constructor(){super(...arguments),this.localize=new i(this),this.open=!1}firstUpdated(){this.body.hidden=!this.open,this.body.style.height=this.open?"auto":"0"}handleSummaryClick(){this.open?this.hide():this.show()}handleSummaryKeyDown(e){("Enter"===e.key||" "===e.key)&&(e.preventDefault(),this.open?this.hide():this.show()),("ArrowUp"===e.key||"ArrowLeft"===e.key)&&(e.preventDefault(),this.hide()),("ArrowDown"===e.key||"ArrowRight"===e.key)&&(e.preventDefault(),this.show())}async handleOpenChange(){if(this.open){if(this.emit("sd-show",{cancelable:!0}).defaultPrevented)return void(this.open=!1);await e(this.body),this.body.hidden=!1;const{keyframes:o,options:i}=p(this,"accordion.show",{dir:this.localize.dir()});await t(this.body,s(o,this.body.scrollHeight),i),this.body.style.height="auto",this.emit("sd-after-show")}else{if(this.emit("sd-hide",{cancelable:!0}).defaultPrevented)return void(this.open=!0);await e(this.body);const{keyframes:o,options:i}=p(this,"accordion.hide",{dir:this.localize.dir()});await t(this.body,s(o,this.body.scrollHeight),i),this.body.hidden=!0,this.body.style.height="auto",this.emit("sd-after-hide")}}async show(){if(!this.open)return this.open=!0,y(this,"sd-after-show")}async hide(){if(this.open)return this.open=!1,y(this,"sd-after-hide")}render(){return a`<div part="base" class="border-y border-neutral-400"><header part="header" id="header" class="${r("flex text-base gap-4 font-bold items-center cursor-pointer select-none px-4 py-3 focus-visible:focus-outline text-primary hover:bg-neutral-200 relative group")}" role="button" aria-expanded="${this.open?"true":"false"}" aria-controls="content" tabindex="0" @click="${this.handleSummaryClick}" @keydown="${this.handleSummaryKeyDown}"><div part="summary-border" class="${r(!this.open&&"opacity-0","w-1 bg-accent absolute left-0 transition-all h-[calc(100%-16px)] group-hover:h-full")}"></div><slot name="summary" part="summary" class="flex flex-auto items-center text-left">${this.summary}</slot><span part="summary-icon" class="${r("flex flex-grow-0 flex-shrink-0 flex-auto items-center transition-all ease-in-out duration-300 text-xl",this.open&&"rotate-180")}"><slot name="expand-icon" class="${r(this.open&&"hidden")}"><sd-3-22-3-icon library="system" name="chevron-down"></sd-3-22-3-icon></slot><slot name="collapse-icon" class="${r(!this.open&&"hidden")}"><sd-3-22-3-icon library="system" name="chevron-down"></sd-3-22-3-icon></slot></span></header><div part="content" id="content" class="overflow-hidden"><slot part="content__slot" class="block px-4 py-6" role="region" aria-labelledby="header"></slot></div></div>`}};w.styles=[o.styles,n`:host{display:block}`],b([h('[part="base"]')],w.prototype,"accordion",2),b([h('[part="header"]')],w.prototype,"header",2),b([h('[part="content"]')],w.prototype,"body",2),b([d({type:Boolean,reflect:!0})],w.prototype,"open",2),b([d()],w.prototype,"summary",2),b([m("open",{waitUntilFirstUpdate:!0})],w.prototype,"handleOpenChange",1),w=b([l("sd-3-22-3-accordion")],w),c("accordion.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:300,easing:"ease"}}),c("accordion.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:300,easing:"ease"}});export{w as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,L as e,x as i,t as s,r,i as a,n as o,e as n,a as d}from"./solid-components2.js";import{H as l}from"./slot.js";import{r as h}from"./state.js";import{Wave as u}from"./wave.js";import{I as c}from"./interactive.js";var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,y=(t,e,i,s)=>{for(var r,a=s>1?void 0:s?m(e,i):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s?r(e,i,a):r(a))||a);return s&&a&&p(e,i,a),a};let g=class extends t{constructor(){super(),this.localize=new e(this),this.hasSlotController=new l(this,"transcript"),this.reversedLayout=!1,this.hideTimestamps=!1,this.animated=!1,this.inverted=!1,this.speed=1,this.currentTime=this.formatTime(0),this.duration="",this.isPlaying=!1,this.isMuted=!1,this.progress=0,this.setAudioProgress=()=>{this.progressSlider.max=Math.floor(this.audioElement.duration).toString()},this.updateCurrentTime=this.updateCurrentTime.bind(this),this.handleAudioEnd=this.handleAudioEnd.bind(this),this.handleAudioProgress=this.handleAudioProgress.bind(this),this.handleAudioProgressKeydown=this.handleAudioProgressKeydown.bind(this)}firstUpdated(){this.audioElement&&(this.audioElement.addEventListener("timeupdate",this.updateCurrentTime),this.audioElement.addEventListener("ended",this.handleAudioEnd),this.audioElement.setAttribute("controlsList","nodownload"),this.audioElement.playbackRate=this.speed,this.animated&&this.initAnimation())}updated(t){if(t.has("animated")){const e=t.get("animated");!e&&this.animated?this.initAnimation():e&&!this.animated&&this.clear()}}get audioElement(){const t=this.shadowRoot.querySelector("slot");return(null==t?void 0:t.assignedElements().length)>0?t.assignedElements()[0]:null}updateCurrentTime(){if(!this.audioElement)return;const t=this.audioElement.currentTime;this.currentTime=this.formatTime(t),this.progress=Math.floor(t),this.progressSlider&&(this.progressSlider.value=this.progress.toString())}updateAudioDuration(){if(this.audioElement){if(isNaN(this.audioElement.duration))return void setTimeout((()=>{this.updateAudioDuration()}),100);this.duration=this.formatTime(this.audioElement.duration),this.setAudioProgress()}}playAudio(){this.audioElement&&(this.isPlaying=!0,this.audioElement.play(),this.emit("sd-playback-start"),this.animated&&this.draw())}pauseAudio(){this.audioElement&&(this.isPlaying=!1,this.audioElement.pause(),this.emit("sd-playback-pause"),this.animated&&this.stopAnimation())}handleAudioEnd(){this.emit("sd-playback-end"),this.isPlaying=!1,this.progress=0,this.progressSlider.value="0",this.currentTime=this.formatTime(0),this.animated&&this.stopAnimation()}toggleMute(){this.audioElement&&(this.isMuted=!this.isMuted,this.isMuted?(this.emit("sd-playback-mute"),this.audioElement.muted=!0):(this.emit("sd-playback-unmute"),this.audioElement.muted=!1))}toggleMuteKeydown(t){"Enter"===t.key&&(t.preventDefault(),this.toggleMute())}togglePlaybackSpeed(){this.audioElement&&(this.emit("sd-playback-speed"),this.speed=1.5===this.speed?1:this.speed+.25,this.audioElement.playbackRate=this.speed)}togglePlaybackSpeedKeydown(t){"Enter"===t.key&&(t.preventDefault(),this.togglePlaybackSpeed())}formatTime(t){const e=Math.floor(t/60),i=Math.floor(t%60);return`${e}:${i<10?"0":""}${i}`}handleAudioProgress(){if(!this.audioElement)return;const t=Number(this.progressSlider.value);this.audioElement.currentTime=t,this.progress=t,this.currentTime=this.formatTime(t)}handleAudioProgressKeydown(t){"ArrowRight"===t.key&&(this.progressSlider.value=(Number(this.progressSlider.value)+1).toString(),this.handleAudioProgress()),"ArrowLeft"===t.key&&(this.progressSlider.value=(Number(this.progressSlider.value)-1).toString(),this.handleAudioProgress())}showTranscript(){this.emit("sd-transcript-click"),this.drawer.open=!0}showTranscriptKeydown(t){("Enter"===t.key||" "===t.key)&&this.showTranscript()}rgbToHex(t){const e=t.match(/\d+/g);if(e&&3===e.length){const t=parseInt(e[0]),i=parseInt(e[1]),s=parseInt(e[2]),r=t=>t.toString(16).padStart(2,"0");return`#${r(t)}${r(i)}${r(s)}`.toUpperCase()}return null}initAnimation(){this.context=this.canvas.getContext("2d");const t=this.audioPlayerContainer.querySelector(".playback-speed"),e=window.getComputedStyle(t).color;let i;i=this.inverted?"#FFFFFF33":this.rgbToHex(e)+"33",this.waveList=[new u({canvas:this.canvas,color:i,phase:240,shift:1.5,amplitude:230,frequency:.012,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:2.5,amplitude:250,frequency:.005,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:-2.5,amplitude:250,frequency:.005,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:-1,amplitude:200,frequency:.018,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:1.5,amplitude:150,frequency:.01,damping:1})],this.animated&&this.drawStillWaves()}drawStillWaves(){this.waveList.forEach((t=>{t.redraw()}))}stopAnimation(){this.isPlaying=!1}clear(){!this.context||!this.canvas||this.context.clearRect(0,0,this.canvas.width,this.canvas.height)}async draw(){!this.isPlaying||!this.animated||(this.clear(),this.waveList.forEach((t=>{t.redraw()})),await new Promise((t=>{setTimeout(t,1e3/30)})),await this.draw())}render(){const t=this.audioElement?this.progress/this.audioElement.duration*100:0,e=i`<div class="${s("controls grid grid-cols-3 justify-items-center items-center",!this.animated&&"relative",this.animated&&!this.reversedLayout&&"absolute -top-4 left-0 w-full",this.reversedLayout?"mt-2":"mb-2")}" part="audio-controls"><button class="${s("playback-speed justify-self-start text-base font-bold hover:cursor-pointer sd-interactive",this.inverted&&"sd-interactive--inverted")}" aria-label="${this.localize.term("playbackSpeed")}" tabindex="0" @click="${this.togglePlaybackSpeed}" @keydown="${this.togglePlaybackSpeedKeydown}" part="playback-speed">${this.speed}x</button><sd-3-22-1-button ?inverted="${!!this.inverted}" part="play-button" size="lg" @click="${this.isPlaying?this.pauseAudio:this.playAudio}" aria-label="${this.isPlaying?this.localize.term("pauseAudio"):this.localize.term("playAudio")}">${this.isPlaying?i`<sd-3-22-1-icon name="pause" library="system"></sd-3-22-1-icon>`:i`<sd-3-22-1-icon name="start" library="system"></sd-3-22-1-icon>`}</sd-3-22-1-button><div class="flex items-center justify-self-end">${this.hasSlotController.test("transcript")?i`<button class="${s("mr-6 w-6 h-6 hover:cursor-pointer sd-interactive",this.inverted&&"sd-interactive--inverted")}" @click="${this.showTranscript}" @keydown="${this.showTranscriptKeydown}" tab-index="0"><sd-3-22-1-icon class="w-6 h-6" name="transcript" library="system" label="${this.isMuted?this.localize.term("unmute"):this.localize.term("mute")}"></sd-3-22-1-icon></button>`:null} <button class="${s("w-6 h-6 hover:cursor-pointer sd-interactive",this.inverted&&"sd-interactive--inverted")}" part="volume" aria-label="${this.localize.term("mute")}" tabindex="0" @click="${this.toggleMute}" @keydown="${this.toggleMuteKeydown}"><sd-3-22-1-icon class="w-6 h-6" name="${this.isMuted?"mute":"volume"}" library="system"></sd-3-22-1-icon></button></div></div>`,r=i`<div class="${s("w-full flex justify-between",this.reversedLayout?"mb-2":"mt-2",this.animated&&this.reversedLayout&&"absolute bottom-0 left-0 mb-2",this.animated&&!this.reversedLayout&&"mt-2")}" part="timestamps"><div class="${s("current-time text-sm",this.inverted?"text-primary-400":"text-neutral-700")}">${this.currentTime}</div><div class="${s("current-time text-sm",this.inverted?"text-primary-400":"text-neutral-700")}">${this.duration}</div></div>`;return i`<div class="${s("w-full flex relative",this.reversedLayout?"flex-col-reverse":"flex-col")}" aria-label="${this.localize.term("audioPlayer")}" part="audio-player"><slot @slotchange="${this.updateAudioDuration}"></slot>${!this.animated||this.animated&&this.reversedLayout?e:null}<div class="relative">${this.animated&&!this.reversedLayout?i`${e}`:null} ${this.animated?i`<canvas class="w-full h-16"></canvas>`:null} ${!this.hideTimestamps&&this.animated&&this.reversedLayout?r:null} <input class="${s("progress-slider bg-primary appearance-none w-full cursor-pointer outline-none h-1 flex items-center sd-interactive",this.inverted&&"sd-interactive--inverted")}" type="range" max="100" step="0.001" value="${this.progress}" tabindex="0" @input="${this.handleAudioProgress}" @keydown="${this.handleAudioProgressKeydown}" part="progress-slider" style="background:linear-gradient(to right,${this.inverted?"rgb(var(--sd-color-white, 255 255 255) / 1)":"rgb(var(--sd-color-primary, 0 53 142) / 1)"} ${t}%,${this.animated?"transparent":this.inverted?"rgb(var(--sd-color-primary-400, 153 171 208) / 1)":"rgb(var(--sd-color-grey-400, 195 195 195) / 1)"} ${t}%)"></div>${this.hasSlotController.test("transcript")?i`<sd-3-22-1-drawer><slot name="transcript"></slot></sd-3-22-1-drawer>`:null} ${this.hideTimestamps||this.animated&&this.reversedLayout?null:r}</div>`}};g.styles=[t.styles,r(c),a`.progress-slider:focus-visible{outline:2px solid transparent;outline-offset:2px}.progress-slider::-webkit-slider-thumb{background-color:currentColor;height:var(--sd-spacing-4,1rem);width:var(--sd-spacing-4,1rem);-webkit-appearance:none;appearance:none;border-radius:var(--sd-border-radius-full,9999px);border-style:none;-webkit-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.progress-slider:focus-visible::-webkit-slider-thumb{outline-style:solid;outline-offset:2px}.progress-slider::-moz-range-thumb{background-color:currentColor;height:var(--sd-spacing-4,1rem);width:var(--sd-spacing-4,1rem);-moz-appearance:none;appearance:none;border-radius:var(--sd-border-radius-full,9999px);border-style:none;-moz-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.progress-slider:focus-visible::-moz-range-thumb{outline-style:solid;outline-offset:2px}sd-3-22-1-button::part(base){display:flex;height:var(--sd-spacing-16,4rem);width:var(--sd-spacing-16,4rem);align-items:center;justify-content:center;border-radius:var(--sd-border-radius-full,9999px)}sd-3-22-1-button::part(label){flex-grow:0}`],y([o({type:Boolean,reflect:!0,attribute:"reversed-layout"})],g.prototype,"reversedLayout",2),y([o({type:Boolean,reflect:!0,attribute:"hide-timestamps"})],g.prototype,"hideTimestamps",2),y([o({type:Boolean,reflect:!0})],g.prototype,"animated",2),y([o({type:Boolean,reflect:!0})],g.prototype,"inverted",2),y([o({type:Number})],g.prototype,"speed",2),y([h()],g.prototype,"currentTime",2),y([h()],g.prototype,"duration",2),y([h()],g.prototype,"isPlaying",2),y([h()],g.prototype,"isMuted",2),y([h()],g.prototype,"progress",2),y([n('[part="progress-slider"]')],g.prototype,"progressSlider",2),y([n('[part="audio-player"]')],g.prototype,"audioPlayerContainer",2),y([n("sd-3-22-1-drawer")],g.prototype,"drawer",2),y([n("canvas")],g.prototype,"canvas",2),g=y([d("sd-3-22-1-audio")],g);export{g as default};
|
1
|
+
import{S as t,L as e,x as i,t as s,r,i as a,n as o,e as n,a as d}from"./solid-components2.js";import{H as l}from"./slot.js";import{r as h}from"./state.js";import{Wave as u}from"./wave.js";import{I as c}from"./interactive.js";var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,y=(t,e,i,s)=>{for(var r,a=s>1?void 0:s?m(e,i):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s?r(e,i,a):r(a))||a);return s&&a&&p(e,i,a),a};let g=class extends t{constructor(){super(),this.localize=new e(this),this.hasSlotController=new l(this,"transcript"),this.reversedLayout=!1,this.hideTimestamps=!1,this.animated=!1,this.inverted=!1,this.speed=1,this.currentTime=this.formatTime(0),this.duration="",this.isPlaying=!1,this.isMuted=!1,this.progress=0,this.setAudioProgress=()=>{this.progressSlider.max=Math.floor(this.audioElement.duration).toString()},this.updateCurrentTime=this.updateCurrentTime.bind(this),this.handleAudioEnd=this.handleAudioEnd.bind(this),this.handleAudioProgress=this.handleAudioProgress.bind(this),this.handleAudioProgressKeydown=this.handleAudioProgressKeydown.bind(this)}firstUpdated(){this.audioElement&&(this.audioElement.addEventListener("timeupdate",this.updateCurrentTime),this.audioElement.addEventListener("ended",this.handleAudioEnd),this.audioElement.setAttribute("controlsList","nodownload"),this.audioElement.playbackRate=this.speed,this.animated&&this.initAnimation())}updated(t){if(t.has("animated")){const e=t.get("animated");!e&&this.animated?this.initAnimation():e&&!this.animated&&this.clear()}}get audioElement(){const t=this.shadowRoot.querySelector("slot");return(null==t?void 0:t.assignedElements().length)>0?t.assignedElements()[0]:null}updateCurrentTime(){if(!this.audioElement)return;const t=this.audioElement.currentTime;this.currentTime=this.formatTime(t),this.progress=Math.floor(t),this.progressSlider&&(this.progressSlider.value=this.progress.toString())}updateAudioDuration(){if(this.audioElement){if(isNaN(this.audioElement.duration))return void setTimeout((()=>{this.updateAudioDuration()}),100);this.duration=this.formatTime(this.audioElement.duration),this.setAudioProgress()}}playAudio(){this.audioElement&&(this.isPlaying=!0,this.audioElement.play(),this.emit("sd-playback-start"),this.animated&&this.draw())}pauseAudio(){this.audioElement&&(this.isPlaying=!1,this.audioElement.pause(),this.emit("sd-playback-pause"),this.animated&&this.stopAnimation())}handleAudioEnd(){this.emit("sd-playback-end"),this.isPlaying=!1,this.progress=0,this.progressSlider.value="0",this.currentTime=this.formatTime(0),this.animated&&this.stopAnimation()}toggleMute(){this.audioElement&&(this.isMuted=!this.isMuted,this.isMuted?(this.emit("sd-playback-mute"),this.audioElement.muted=!0):(this.emit("sd-playback-unmute"),this.audioElement.muted=!1))}toggleMuteKeydown(t){"Enter"===t.key&&(t.preventDefault(),this.toggleMute())}togglePlaybackSpeed(){this.audioElement&&(this.emit("sd-playback-speed"),this.speed=1.5===this.speed?1:this.speed+.25,this.audioElement.playbackRate=this.speed)}togglePlaybackSpeedKeydown(t){"Enter"===t.key&&(t.preventDefault(),this.togglePlaybackSpeed())}formatTime(t){const e=Math.floor(t/60),i=Math.floor(t%60);return`${e}:${i<10?"0":""}${i}`}handleAudioProgress(){if(!this.audioElement)return;const t=Number(this.progressSlider.value);this.audioElement.currentTime=t,this.progress=t,this.currentTime=this.formatTime(t)}handleAudioProgressKeydown(t){"ArrowRight"===t.key&&(this.progressSlider.value=(Number(this.progressSlider.value)+1).toString(),this.handleAudioProgress()),"ArrowLeft"===t.key&&(this.progressSlider.value=(Number(this.progressSlider.value)-1).toString(),this.handleAudioProgress())}showTranscript(){this.emit("sd-transcript-click"),this.drawer.open=!0}showTranscriptKeydown(t){("Enter"===t.key||" "===t.key)&&this.showTranscript()}rgbToHex(t){const e=t.match(/\d+/g);if(e&&3===e.length){const t=parseInt(e[0]),i=parseInt(e[1]),s=parseInt(e[2]),r=t=>t.toString(16).padStart(2,"0");return`#${r(t)}${r(i)}${r(s)}`.toUpperCase()}return null}initAnimation(){this.context=this.canvas.getContext("2d");const t=this.audioPlayerContainer.querySelector(".playback-speed"),e=window.getComputedStyle(t).color;let i;i=this.inverted?"#FFFFFF33":this.rgbToHex(e)+"33",this.waveList=[new u({canvas:this.canvas,color:i,phase:240,shift:1.5,amplitude:230,frequency:.012,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:2.5,amplitude:250,frequency:.005,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:-2.5,amplitude:250,frequency:.005,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:-1,amplitude:200,frequency:.018,damping:1}),new u({canvas:this.canvas,color:i,phase:180,shift:1.5,amplitude:150,frequency:.01,damping:1})],this.animated&&this.drawStillWaves()}drawStillWaves(){this.waveList.forEach((t=>{t.redraw()}))}stopAnimation(){this.isPlaying=!1}clear(){!this.context||!this.canvas||this.context.clearRect(0,0,this.canvas.width,this.canvas.height)}async draw(){!this.isPlaying||!this.animated||(this.clear(),this.waveList.forEach((t=>{t.redraw()})),await new Promise((t=>{setTimeout(t,1e3/30)})),await this.draw())}render(){const t=this.audioElement?this.progress/this.audioElement.duration*100:0,e=i`<div class="${s("controls grid grid-cols-3 justify-items-center items-center",!this.animated&&"relative",this.animated&&!this.reversedLayout&&"absolute -top-4 left-0 w-full",this.reversedLayout?"mt-2":"mb-2")}" part="audio-controls"><button class="${s("playback-speed justify-self-start text-base font-bold hover:cursor-pointer sd-interactive",this.inverted&&"sd-interactive--inverted")}" aria-label="${this.localize.term("playbackSpeed")}" tabindex="0" @click="${this.togglePlaybackSpeed}" @keydown="${this.togglePlaybackSpeedKeydown}" part="playback-speed">${this.speed}x</button><sd-3-22-3-button ?inverted="${!!this.inverted}" part="play-button" size="lg" @click="${this.isPlaying?this.pauseAudio:this.playAudio}" aria-label="${this.isPlaying?this.localize.term("pauseAudio"):this.localize.term("playAudio")}">${this.isPlaying?i`<sd-3-22-3-icon name="pause" library="system"></sd-3-22-3-icon>`:i`<sd-3-22-3-icon name="start" library="system"></sd-3-22-3-icon>`}</sd-3-22-3-button><div class="flex items-center justify-self-end">${this.hasSlotController.test("transcript")?i`<button class="${s("mr-6 w-6 h-6 hover:cursor-pointer sd-interactive",this.inverted&&"sd-interactive--inverted")}" @click="${this.showTranscript}" @keydown="${this.showTranscriptKeydown}" tab-index="0"><sd-3-22-3-icon class="w-6 h-6" name="transcript" library="system" label="${this.isMuted?this.localize.term("unmute"):this.localize.term("mute")}"></sd-3-22-3-icon></button>`:null} <button class="${s("w-6 h-6 hover:cursor-pointer sd-interactive",this.inverted&&"sd-interactive--inverted")}" part="volume" aria-label="${this.localize.term("mute")}" tabindex="0" @click="${this.toggleMute}" @keydown="${this.toggleMuteKeydown}"><sd-3-22-3-icon class="w-6 h-6" name="${this.isMuted?"mute":"volume"}" library="system"></sd-3-22-3-icon></button></div></div>`,r=i`<div class="${s("w-full flex justify-between",this.reversedLayout?"mb-2":"mt-2",this.animated&&this.reversedLayout&&"absolute bottom-0 left-0 mb-2",this.animated&&!this.reversedLayout&&"mt-2")}" part="timestamps"><div class="${s("current-time text-sm",this.inverted?"text-primary-400":"text-neutral-700")}">${this.currentTime}</div><div class="${s("current-time text-sm",this.inverted?"text-primary-400":"text-neutral-700")}">${this.duration}</div></div>`;return i`<div class="${s("w-full flex relative",this.reversedLayout?"flex-col-reverse":"flex-col")}" aria-label="${this.localize.term("audioPlayer")}" part="audio-player"><slot @slotchange="${this.updateAudioDuration}"></slot>${!this.animated||this.animated&&this.reversedLayout?e:null}<div class="relative">${this.animated&&!this.reversedLayout?i`${e}`:null} ${this.animated?i`<canvas class="w-full h-16"></canvas>`:null} ${!this.hideTimestamps&&this.animated&&this.reversedLayout?r:null} <input class="${s("progress-slider bg-primary appearance-none w-full cursor-pointer outline-none h-1 flex items-center sd-interactive",this.inverted&&"sd-interactive--inverted")}" type="range" max="100" step="0.001" value="${this.progress}" tabindex="0" @input="${this.handleAudioProgress}" @keydown="${this.handleAudioProgressKeydown}" part="progress-slider" style="background:linear-gradient(to right,${this.inverted?"rgb(var(--sd-color-white, 255 255 255) / 1)":"rgb(var(--sd-color-primary, 0 53 142) / 1)"} ${t}%,${this.animated?"transparent":this.inverted?"rgb(var(--sd-color-primary-400, 153 171 208) / 1)":"rgb(var(--sd-color-grey-400, 195 195 195) / 1)"} ${t}%)"></div>${this.hasSlotController.test("transcript")?i`<sd-3-22-3-drawer><slot name="transcript"></slot></sd-3-22-3-drawer>`:null} ${this.hideTimestamps||this.animated&&this.reversedLayout?null:r}</div>`}};g.styles=[t.styles,r(c),a`.progress-slider:focus-visible{outline:2px solid transparent;outline-offset:2px}.progress-slider::-webkit-slider-thumb{background-color:currentColor;height:var(--sd-spacing-4,1rem);width:var(--sd-spacing-4,1rem);-webkit-appearance:none;appearance:none;border-radius:var(--sd-border-radius-full,9999px);border-style:none;-webkit-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.progress-slider:focus-visible::-webkit-slider-thumb{outline-style:solid;outline-offset:2px}.progress-slider::-moz-range-thumb{background-color:currentColor;height:var(--sd-spacing-4,1rem);width:var(--sd-spacing-4,1rem);-moz-appearance:none;appearance:none;border-radius:var(--sd-border-radius-full,9999px);border-style:none;-moz-transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.progress-slider:focus-visible::-moz-range-thumb{outline-style:solid;outline-offset:2px}sd-3-22-3-button::part(base){display:flex;height:var(--sd-spacing-16,4rem);width:var(--sd-spacing-16,4rem);align-items:center;justify-content:center;border-radius:var(--sd-border-radius-full,9999px)}sd-3-22-3-button::part(label){flex-grow:0}`],y([o({type:Boolean,reflect:!0,attribute:"reversed-layout"})],g.prototype,"reversedLayout",2),y([o({type:Boolean,reflect:!0,attribute:"hide-timestamps"})],g.prototype,"hideTimestamps",2),y([o({type:Boolean,reflect:!0})],g.prototype,"animated",2),y([o({type:Boolean,reflect:!0})],g.prototype,"inverted",2),y([o({type:Number})],g.prototype,"speed",2),y([h()],g.prototype,"currentTime",2),y([h()],g.prototype,"duration",2),y([h()],g.prototype,"isPlaying",2),y([h()],g.prototype,"isMuted",2),y([h()],g.prototype,"progress",2),y([n('[part="progress-slider"]')],g.prototype,"progressSlider",2),y([n('[part="audio-player"]')],g.prototype,"audioPlayerContainer",2),y([n("sd-3-22-3-drawer")],g.prototype,"drawer",2),y([n("canvas")],g.prototype,"canvas",2),g=y([d("sd-3-22-3-audio")],g);export{g as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as e,x as t,t as r,i as s,n as i,a as n}from"./solid-components2.js";var o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=(e,t,r,s)=>{for(var i,n=s>1?void 0:s?a(t,r):t,l=e.length-1;l>=0;l--)(i=e[l])&&(n=(s?i(t,r,n):i(n))||n);return s&&n&&o(t,r,n),n};let p=class extends e{constructor(){super(...arguments),this.size="lg",this.variant="default",this.inverted=!1}render(){return t`<span role="status" part="base" aria-labelledby="content" class="${r("inline-flex items-center justify-center gap-x-[1px] text-center font-bold whitespace-nowrap border rounded-full select-none cursor-[inherit]",{default:this.inverted?"text-primary bg-primary-100 border-primary":"text-white bg-primary-500 border-white",success:this.inverted?"text-white bg-success border-primary":"text-white bg-success border-white",error:this.inverted?"text-white bg-error border-primary":"text-white bg-error border-white"}[this.variant],{sm:"h-2 min-w-2",md:"h-4 px-1 min-w-4",lg:"h-5 min-w-5"}[this.size])}"><span id="content" part="content" class="${r("sm"===this.size&&"sr-only")}"><slot></slot></span></span>`}};p.styles=[e.styles,s`:host{display:inline-flex;align-items:center;justify-content:center}:host([size=md]){font-size:.625rem}:host([size=lg]){font-size:.75rem}:host([size=lg])::part(base){padding-left:.313rem;padding-right:.313rem}`],l([i({reflect:!0})],p.prototype,"size",2),l([i({reflect:!0})],p.prototype,"variant",2),l([i({type:Boolean,reflect:!0})],p.prototype,"inverted",2),p=l([n("sd-3-22-
|
1
|
+
import{S as e,x as t,t as r,i as s,n as i,a as n}from"./solid-components2.js";var o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=(e,t,r,s)=>{for(var i,n=s>1?void 0:s?a(t,r):t,l=e.length-1;l>=0;l--)(i=e[l])&&(n=(s?i(t,r,n):i(n))||n);return s&&n&&o(t,r,n),n};let p=class extends e{constructor(){super(...arguments),this.size="lg",this.variant="default",this.inverted=!1}render(){return t`<span role="status" part="base" aria-labelledby="content" class="${r("inline-flex items-center justify-center gap-x-[1px] text-center font-bold whitespace-nowrap border rounded-full select-none cursor-[inherit]",{default:this.inverted?"text-primary bg-primary-100 border-primary":"text-white bg-primary-500 border-white",success:this.inverted?"text-white bg-success border-primary":"text-white bg-success border-white",error:this.inverted?"text-white bg-error border-primary":"text-white bg-error border-white"}[this.variant],{sm:"h-2 min-w-2",md:"h-4 px-1 min-w-4",lg:"h-5 min-w-5"}[this.size])}"><span id="content" part="content" class="${r("sm"===this.size&&"sr-only")}"><slot></slot></span></span>`}};p.styles=[e.styles,s`:host{display:inline-flex;align-items:center;justify-content:center}:host([size=md]){font-size:.625rem}:host([size=lg]){font-size:.75rem}:host([size=lg])::part(base){padding-left:.313rem;padding-right:.313rem}`],l([i({reflect:!0})],p.prototype,"size",2),l([i({reflect:!0})],p.prototype,"variant",2),l([i({type:Boolean,reflect:!0})],p.prototype,"inverted",2),p=l([n("sd-3-22-3-badge")],p);export{p as default};
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import{S as t,x as e,t as r,c as a,i as s,e as i,n as o,a as n}from"./solid-components2.js";import{r as p}from"./state.js";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(t,e,r,a)=>{for(var s,i=a>1?void 0:a?d(e,r):e,o=t.length-1;o>=0;o--)(s=t[o])&&(i=(a?s(e,r,i):s(i))||i);return a&&i&&l(e,r,i),i};let v=class extends t{constructor(){super(...arguments),this.variant="primary",this.shapes=["top","middle","bottom"],this.componentBreakpoint=0}getSvg(t,e){return{0:this.smallSvg(e),414:this.mediumSvg(e),640:this.largeSvg(e)}[t]}largeSvg(t){return"top"===t?e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 121"><path d="M610.777 1.393.001 120.146 0 123h700.001V74.79c0-4.797-.462-9.585-1.381-14.294-7.909-40.537-47.237-66.998-87.843-59.103Z"/></svg>`:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 123"><path d="M89.224 121.607 700 2.854 700.001 0h-700L0 48.21c0 4.797.463 9.584 1.381 14.294 7.909 40.537 47.237 66.998 87.843 59.103Z"/></svg>`}mediumSvg(t){return"top"===t?e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 119"><path d="M597.75 1.6 0 118.046V121h700V85.872c0-5.509-.53-11.006-1.583-16.413-9.063-46.543-54.133-76.924-100.667-67.86Z"/></svg>`:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 121"><path d="M102.25 119.4 700 2.954V0H0v35.128c0 5.509.53 11.006 1.583 16.413 9.063 46.543 54.134 76.924 100.667 67.859Z"/></svg>`}smallSvg(t){return"top"===t?e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 113"><path d="M566.951 2.08 0 112.466v2.934h700v-3.672c0-7.166-.689-14.314-2.059-21.348-11.789-60.557-70.436-100.09-130.99-88.3Z"/></svg>`:e`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 700 116"><path d="M133.049 113.32 700 2.934V0H0v3.672c0 7.165.69 14.314 2.059 21.348 11.79 60.557 70.436 100.09 130.99 88.3Z"/></svg>`}setBreakpoint(){switch(!0){case this.containerElem.clientWidth<=414:this.componentBreakpoint=0;break;case this.containerElem.clientWidth<640:this.componentBreakpoint=414;break;default:this.componentBreakpoint=640}}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver((()=>this.setBreakpoint())),this.updateComplete.then((()=>{this.setBreakpoint(),this.resizeObserver.observe(this.containerElem)}))}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver.unobserve(this.containerElem)}renderTopBrandshape(){return e`<div class="relative" part="shape-top">${this.getSvg(this.componentBreakpoint,"top")} ${this.renderWhitespaceFix("top")}</div>`}renderMiddleBrandshape(){return e`<div class="${r({0:"px-6 py-4",414:"px-10 py-8",640:"px-10 py-8"}[this.componentBreakpoint],"w-full block relative")}"><div part="shape-middle" class="${r({"neutral-100":"bg-neutral-100",primary:"bg-primary",white:"bg-white","border-white":"bg-transparent","border-primary":"bg-transparent",image:"bg-transparent"}[this.variant],"w-full block absolute h-full top-0 left-0 z-0")}"></div><div class="z-10 relative" part="content"><slot></slot></div></div>`}renderBottomBrandshape(){return e`<div class="relative" part="shape-bottom">${this.getSvg(this.componentBreakpoint,"bottom")}${this.renderWhitespaceFix("bottom")}</div>`}renderWhitespaceFix(t){return e`<div class="${r({"neutral-100":"bg-neutral-100",primary:"bg-primary",white:"bg-white","border-white":"bg-transparent","border-primary":"bg-transparent",image:"bg-transparent"}[this.variant],{top:"bottom-0",bottom:"top-0"}[t],"block absolute left-0 w-full h-[1px]")}"></div>`}renderStylizedVariant(){return e`<div part="stylized-container" class="w-full overflow-hidden"><slot class="${r("image"!==this.variant&&"hidden")}" name="image"></slot></div>`}renderShapes(){return e`${this.shapes.includes("top")?this.renderTopBrandshape():""} ${this.shapes.includes("middle")?this.renderMiddleBrandshape():""} ${this.shapes.includes("bottom")?this.renderBottomBrandshape():""}`}render(){const t=this.variant.startsWith("border-")||"image"===this.variant;return e`<div class="${r({"neutral-100":"fill-neutral-100",primary:"fill-primary",white:"fill-white","border-white":"fill-transparent","border-primary":"fill-transparent",image:"fill-transparent"}[this.variant],"relative")}" part="base">${t?this.renderStylizedVariant():""} ${this.renderShapes()} ${this.shapes.includes("middle")?e`<slot></slot>`:""}</div>`}};v.styles=[a,t.styles,s`:host{display:block;container-type:inline-size;--angle:11deg;--radius:60px;--tan:tan(var(--angle));--adjacent:100cqw;--opposite:calc(var(--tan) * var(--adjacent));--curve:calc(
|
2
2
|
(var(--opposite) - (var(--radius) / 3)) * 0.5
|
3
|
-
)}@supports not (transform:skewY(11deg)){:host{--tan:0.1943803091}}@media (min-width:415px){:host{--radius:72px}}@media (min-width:640px){:host{--radius:84px}}:host([variant=image]) [part=stylized-container],:host([variant^=border-]) [part=stylized-container]::before{position:absolute;top:var(--sd-spacing-0,0);left:var(--sd-spacing-0,0);transform:skewY(calc(var(--angle) * -1));height:calc(100% - var(--curve) * 2);border-radius:0 var(--radius);margin-top:calc(var(--curve))}slot[name=image]::slotted(img),slot[name=image]::slotted(video){width:100%;-o-object-fit:cover;object-fit:cover;transform:translateY(calc(var(--curve) * -1)) skewY(var(--angle));height:calc(100% + var(--curve) * 2)!important;position:absolute!important}@supports not (height:100cqw){:host([variant=image]) [part=stylized-container],:host([variant^=border-]) [part=stylized-container]::before{transform:unset;height:100%;margin-top:0}slot[name=image]::slotted(img),slot[name=image]::slotted(video){transform:unset;height:100%!important}}:host([variant=border-primary]){--internal-border-color:rgb(var(--sd-color-primary, 0 53 142))}:host([variant=border-white]){--internal-border-color:var(--sd-color-white, white)}:host([variant^=border-]) [part=stylized-container]::before{right:var(--sd-spacing-0,0);border-width:2px;border-style:solid;content:'';border-color:var(--internal-border-color,#000)}`],h([i("[part=base]")],v.prototype,"containerElem",2),h([o({type:String})],v.prototype,"variant",2),h([o({type:Array})],v.prototype,"shapes",2),h([p()],v.prototype,"componentBreakpoint",2),v=h([n("sd-3-22-
|
3
|
+
)}@supports not (transform:skewY(11deg)){:host{--tan:0.1943803091}}@media (min-width:415px){:host{--radius:72px}}@media (min-width:640px){:host{--radius:84px}}:host([variant=image]) [part=stylized-container],:host([variant^=border-]) [part=stylized-container]::before{position:absolute;top:var(--sd-spacing-0,0);left:var(--sd-spacing-0,0);transform:skewY(calc(var(--angle) * -1));height:calc(100% - var(--curve) * 2);border-radius:0 var(--radius);margin-top:calc(var(--curve))}slot[name=image]::slotted(img),slot[name=image]::slotted(video){width:100%;-o-object-fit:cover;object-fit:cover;transform:translateY(calc(var(--curve) * -1)) skewY(var(--angle));height:calc(100% + var(--curve) * 2)!important;position:absolute!important}@supports not (height:100cqw){:host([variant=image]) [part=stylized-container],:host([variant^=border-]) [part=stylized-container]::before{transform:unset;height:100%;margin-top:0}slot[name=image]::slotted(img),slot[name=image]::slotted(video){transform:unset;height:100%!important}}:host([variant=border-primary]){--internal-border-color:rgb(var(--sd-color-primary, 0 53 142))}:host([variant=border-white]){--internal-border-color:var(--sd-color-white, white)}:host([variant^=border-]) [part=stylized-container]::before{right:var(--sd-spacing-0,0);border-width:2px;border-style:solid;content:'';border-color:var(--internal-border-color,#000)}`],h([i("[part=base]")],v.prototype,"containerElem",2),h([o({type:String})],v.prototype,"variant",2),h([o({type:Array})],v.prototype,"shapes",2),h([p()],v.prototype,"componentBreakpoint",2),v=h([n("sd-3-22-3-brandshape")],v);export{v as default};
|
@@ -1 +1 @@
|
|
1
|
-
import"./spinner.js";import{S as t,t as e,c as r,i,e as o,n as a,a as s}from"./solid-components2.js";import{F as n,v as l}from"./form.js";import{H as d}from"./slot.js";import{s as p,n as h}from"./static.js";import{o as c}from"./if-defined.js";import{r as m}from"./state.js";import{o as u}from"./query-assigned-elements.js";import{w as b}from"./watch.js";var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,f=(t,e,r,i)=>{for(var o,a=i>1?void 0:i?y(e,r):e,s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i?o(e,r,a):o(a))||a);return i&&a&&v(e,r,a),a};let g=class extends t{constructor(){super(...arguments),this.formControlController=new n(this,{form:t=>{if(t.hasAttribute("form")){const e=t.getRootNode(),r=t.getAttribute("form");return e.getElementById(r)}return t.closest("form")}}),this.hasSlotController=new d(this,"[default]","icon-left","icon-right"),this.invalid=!1,this.title="",this.variant="primary",this.inverted=!1,this.size="lg",this.disabled=!1,this.loading=!1,this.type="button",this.name="",this.value="",this.href=""}get validity(){return this.isButton()?this.button.validity:l}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}handleClick(t){if(this.disabled||this.loading)return t.preventDefault(),void t.stopPropagation();"submit"===this.type&&this.formControlController.submit(this),"reset"===this.type&&this.formControlController.reset(this)}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(t){this.button.focus(t)}blur(){this.button.blur()}checkValidity(){return!this.isButton()||this.button.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return!this.isButton()||this.button.reportValidity()}setCustomValidity(t){this.isButton()&&(this.button.setCustomValidity(t),this.formControlController.updateValidity())}render(){const t=this.isLink(),r=t?p`a`:p`button`,i={label:this.hasSlotController.test("[default]"),"icon-left":this.hasSlotController.test("icon-left"),"icon-right":this.hasSlotController.test("icon-right"),"icon-only":this._iconsInDefaultSlot.length>0};return h`<${r} part="base" class="${e("font-md leading-[calc(var(--tw-varspacing)-2px)] no-underline\n w-full h-varspacing whitespace-nowrap align-middle inline-flex items-stretch justify-center\n border transition-colors duration-200 ease-in-out rounded-default\n select-none cursor-[inherit]",this.inverted?"focus-visible:focus-outline-inverted":"focus-visible:focus-outline",this.loading&&"relative cursor-wait",this.disabled&&"cursor-not-allowed",i["icon-only"]&&"px-0 w-varspacing",{sm:"text-sm varspacing-8 px-4",md:"text-base varspacing-10 px-4",lg:"text-base varspacing-12 px-4"}[this.size],{primary:this.inverted?"text-primary bg-white border-transparent\n hover:text-primary-500 hover:bg-primary-100\n active:text-primary-800 active:bg-primary-200\n disabled:bg-neutral-600 disabled:text-white":"text-white bg-primary border-transparent\n hover:text-primary-100 hover:bg-primary-500\n active:text-primary-200 active:bg-primary-800\n disabled:bg-neutral-500",secondary:this.inverted?"text-white border-white\n hover:text-primary-100 hover:bg-primary-500 hover:border-primary-100\n active:text-primary-200 active:bg-primary-800 active:border-primary-200\n disabled:text-neutral-600 disabled:border-neutral-600":"text-primary border-primary\n hover:text-primary-500 hover:border-primary-500 hover:bg-primary-100\n active:text-primary-800 active:border-primary-800 active:bg-primary-200\n disabled:text-neutral-500 disabled:border-neutral-500",tertiary:this.inverted?"text-white border-transparent\n hover:text-primary-100 hover:bg-primary-500\n active:text-primary-200 active:bg-primary-800\n disabled:text-neutral-600":"text-primary border-transparent\n hover:text-primary-500 hover:bg-primary-100\n active:text-primary-800 active:bg-primary-200\n disabled:text-neutral-500",cta:`text-white bg-accent-500 border-transparent\n hover:bg-accent-550\n active:bg-accent-700\n ${this.inverted?"disabled:bg-neutral-600":"disabled:bg-neutral-500"} disabled:text-white`}[this.variant])}" ?disabled="${c(t?void 0:this.disabled)}" type="${c(t?void 0:this.type)}" title="${this.title}" name="${c(t?void 0:this.name)}" value="${c(t?void 0:this.value)}" href="${c(t?this.href:void 0)}" target="${c(t?this.target:void 0)}" download="${c(t?this.download:void 0)}" rel="${c(t&&this.target?"noreferrer noopener":void 0)}" role="${c(t?void 0:"button")}" aria-disabled="${this.disabled?"true":"false"}" tabindex="${this.disabled?"-1":"0"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @invalid="${this.isButton()?this.handleInvalid:null}" @click="${this.handleClick}"><slot name="icon-left" part="icon-left" class="${e("flex flex-auto items-center pointer-events-none",i["icon-only"]&&"hidden",this.loading&&"invisible",i["icon-left"]&&{sm:"mr-1",md:"mr-2",lg:"mr-2"}[this.size])}"></slot><slot part="label" class="${e(i["icon-only"]?"flex flex-auto items-center pointer-events-none":"inline-block",this.loading&&"invisible")}"></slot><slot name="icon-right" part="icon-right" class="${e("flex flex-auto items-center pointer-events-none",this.loading&&"invisible",i["icon-only"]&&"hidden",i["icon-right"]&&{sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size])}"></slot>${this.loading?h`<sd-3-22-
|
1
|
+
import"./spinner.js";import{S as t,t as e,c as r,i,e as o,n as a,a as s}from"./solid-components2.js";import{F as n,v as l}from"./form.js";import{H as d}from"./slot.js";import{s as p,n as h}from"./static.js";import{o as c}from"./if-defined.js";import{r as m}from"./state.js";import{o as u}from"./query-assigned-elements.js";import{w as b}from"./watch.js";var v=Object.defineProperty,y=Object.getOwnPropertyDescriptor,f=(t,e,r,i)=>{for(var o,a=i>1?void 0:i?y(e,r):e,s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i?o(e,r,a):o(a))||a);return i&&a&&v(e,r,a),a};let g=class extends t{constructor(){super(...arguments),this.formControlController=new n(this,{form:t=>{if(t.hasAttribute("form")){const e=t.getRootNode(),r=t.getAttribute("form");return e.getElementById(r)}return t.closest("form")}}),this.hasSlotController=new d(this,"[default]","icon-left","icon-right"),this.invalid=!1,this.title="",this.variant="primary",this.inverted=!1,this.size="lg",this.disabled=!1,this.loading=!1,this.type="button",this.name="",this.value="",this.href=""}get validity(){return this.isButton()?this.button.validity:l}get validationMessage(){return this.isButton()?this.button.validationMessage:""}firstUpdated(){this.isButton()&&this.formControlController.updateValidity()}handleBlur(){this.emit("sd-blur")}handleFocus(){this.emit("sd-focus")}handleClick(t){if(this.disabled||this.loading)return t.preventDefault(),void t.stopPropagation();"submit"===this.type&&this.formControlController.submit(this),"reset"===this.type&&this.formControlController.reset(this)}handleInvalid(t){this.formControlController.setValidity(!1),this.formControlController.emitInvalidEvent(t)}isButton(){return!this.href}isLink(){return!!this.href}handleDisabledChange(){this.isButton()&&this.formControlController.setValidity(this.disabled)}click(){this.button.click()}focus(t){this.button.focus(t)}blur(){this.button.blur()}checkValidity(){return!this.isButton()||this.button.checkValidity()}getForm(){return this.formControlController.getForm()}reportValidity(){return!this.isButton()||this.button.reportValidity()}setCustomValidity(t){this.isButton()&&(this.button.setCustomValidity(t),this.formControlController.updateValidity())}render(){const t=this.isLink(),r=t?p`a`:p`button`,i={label:this.hasSlotController.test("[default]"),"icon-left":this.hasSlotController.test("icon-left"),"icon-right":this.hasSlotController.test("icon-right"),"icon-only":this._iconsInDefaultSlot.length>0};return h`<${r} part="base" class="${e("font-md leading-[calc(var(--tw-varspacing)-2px)] no-underline\n w-full h-varspacing whitespace-nowrap align-middle inline-flex items-stretch justify-center\n border transition-colors duration-200 ease-in-out rounded-default\n select-none cursor-[inherit]",this.inverted?"focus-visible:focus-outline-inverted":"focus-visible:focus-outline",this.loading&&"relative cursor-wait",this.disabled&&"cursor-not-allowed",i["icon-only"]&&"px-0 w-varspacing",{sm:"text-sm varspacing-8 px-4",md:"text-base varspacing-10 px-4",lg:"text-base varspacing-12 px-4"}[this.size],{primary:this.inverted?"text-primary bg-white border-transparent\n hover:text-primary-500 hover:bg-primary-100\n active:text-primary-800 active:bg-primary-200\n disabled:bg-neutral-600 disabled:text-white":"text-white bg-primary border-transparent\n hover:text-primary-100 hover:bg-primary-500\n active:text-primary-200 active:bg-primary-800\n disabled:bg-neutral-500",secondary:this.inverted?"text-white border-white\n hover:text-primary-100 hover:bg-primary-500 hover:border-primary-100\n active:text-primary-200 active:bg-primary-800 active:border-primary-200\n disabled:text-neutral-600 disabled:border-neutral-600":"text-primary border-primary\n hover:text-primary-500 hover:border-primary-500 hover:bg-primary-100\n active:text-primary-800 active:border-primary-800 active:bg-primary-200\n disabled:text-neutral-500 disabled:border-neutral-500",tertiary:this.inverted?"text-white border-transparent\n hover:text-primary-100 hover:bg-primary-500\n active:text-primary-200 active:bg-primary-800\n disabled:text-neutral-600":"text-primary border-transparent\n hover:text-primary-500 hover:bg-primary-100\n active:text-primary-800 active:bg-primary-200\n disabled:text-neutral-500",cta:`text-white bg-accent-500 border-transparent\n hover:bg-accent-550\n active:bg-accent-700\n ${this.inverted?"disabled:bg-neutral-600":"disabled:bg-neutral-500"} disabled:text-white`}[this.variant])}" ?disabled="${c(t?void 0:this.disabled)}" type="${c(t?void 0:this.type)}" title="${this.title}" name="${c(t?void 0:this.name)}" value="${c(t?void 0:this.value)}" href="${c(t?this.href:void 0)}" target="${c(t?this.target:void 0)}" download="${c(t?this.download:void 0)}" rel="${c(t&&this.target?"noreferrer noopener":void 0)}" role="${c(t?void 0:"button")}" aria-disabled="${this.disabled?"true":"false"}" tabindex="${this.disabled?"-1":"0"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" @invalid="${this.isButton()?this.handleInvalid:null}" @click="${this.handleClick}"><slot name="icon-left" part="icon-left" class="${e("flex flex-auto items-center pointer-events-none",i["icon-only"]&&"hidden",this.loading&&"invisible",i["icon-left"]&&{sm:"mr-1",md:"mr-2",lg:"mr-2"}[this.size])}"></slot><slot part="label" class="${e(i["icon-only"]?"flex flex-auto items-center pointer-events-none":"inline-block",this.loading&&"invisible")}"></slot><slot name="icon-right" part="icon-right" class="${e("flex flex-auto items-center pointer-events-none",this.loading&&"invisible",i["icon-only"]&&"hidden",i["icon-right"]&&{sm:"ml-1",md:"ml-2",lg:"ml-2"}[this.size])}"></slot>${this.loading?h`<sd-3-22-3-spinner class="${e("absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2")}"></sd-3-22-3-spinner>`:""}</${r}>`}};g.styles=[r,t.styles,i`:host{position:relative;display:inline-block;width:var(--sd-spacing-auto,auto);cursor:pointer}sd-3-22-3-spinner{--indicator-color:currentColor;--track-color:var(--tw-varcolor-200)}::slotted(sd-3-22-3-badge){pointer-events:none;position:absolute;top:var(--sd-spacing-0,0);right:var(--sd-spacing-0,0);--tw-translate-x:50%!important;--tw-translate-y:-50%!important;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))!important}::slotted(sd-3-22-3-icon),sd-3-22-3-spinner{font-size:calc(var(--tw-varspacing)/ 2)}`],f([o("a, button")],g.prototype,"button",2),f([u({selector:"sd-3-22-3-icon"})],g.prototype,"_iconsInDefaultSlot",2),f([m()],g.prototype,"invalid",2),f([a()],g.prototype,"title",2),f([a({reflect:!0})],g.prototype,"variant",2),f([a({type:Boolean,reflect:!0})],g.prototype,"inverted",2),f([a({reflect:!0})],g.prototype,"size",2),f([a({type:Boolean,reflect:!0})],g.prototype,"disabled",2),f([a({type:Boolean,reflect:!0})],g.prototype,"loading",2),f([a()],g.prototype,"type",2),f([a()],g.prototype,"name",2),f([a()],g.prototype,"value",2),f([a()],g.prototype,"href",2),f([a()],g.prototype,"target",2),f([a()],g.prototype,"download",2),f([a()],g.prototype,"form",2),f([a({attribute:"formaction"})],g.prototype,"formAction",2),f([a({attribute:"formenctype"})],g.prototype,"formEnctype",2),f([a({attribute:"formmethod"})],g.prototype,"formMethod",2),f([a({attribute:"formnovalidate",type:Boolean})],g.prototype,"formNoValidate",2),f([a({attribute:"formtarget"})],g.prototype,"formTarget",2),f([b("disabled",{waitUntilFirstUpdate:!0})],g.prototype,"handleDisabledChange",1),g=f([s("sd-3-22-3-button")],g);export{g as default};
|
@@ -1 +1 @@
|
|
1
|
-
import{S as t,x as e,c as s,i as r,a as o}from"./solid-components2.js";Object.defineProperty,Object.getOwnPropertyDescriptor;let a=class extends t{static isCarouselItem(t){return t instanceof Element&&"slide"===t.getAttribute("aria-roledescription")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group")}render(){return e`<slot></slot>`}};a.styles=[t.styles,s,r`:host{aspect-ratio:var(--aspect-ratio);scroll-snap-align:start;scroll-snap-stop:always;display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center}::slotted(img){height:100%;width:100%;-o-object-fit:cover;object-fit:cover}`],a=((t,e,s,r)=>{for(var o,a=e,i=t.length-1;i>=0;i--)(o=t[i])&&(a=o(a)||a);return a})([o("sd-3-22-
|
1
|
+
import{S as t,x as e,c as s,i as r,a as o}from"./solid-components2.js";Object.defineProperty,Object.getOwnPropertyDescriptor;let a=class extends t{static isCarouselItem(t){return t instanceof Element&&"slide"===t.getAttribute("aria-roledescription")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","group")}render(){return e`<slot></slot>`}};a.styles=[t.styles,s,r`:host{aspect-ratio:var(--aspect-ratio);scroll-snap-align:start;scroll-snap-stop:always;display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center}::slotted(img){height:100%;width:100%;-o-object-fit:cover;object-fit:cover}`],a=((t,e,s,r)=>{for(var o,a=e,i=t.length-1;i>=0;i--)(o=t[i])&&(a=o(a)||a);return a})([o("sd-3-22-3-carousel-item")],a);export{a as default};
|