@solid-design-system/components 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/es/accordion-group.js +1 -0
- package/dist/components/es/accordion.js +1 -0
- package/dist/components/es/button.js +12 -12
- package/dist/components/es/divider.js +1 -0
- package/dist/components/es/if-defined.js +2 -7
- package/dist/components/es/link.js +1 -1
- package/dist/components/es/query.js +6 -0
- package/dist/components/es/solid-components2.js +1 -1
- package/dist/components/es/solid-element.js +1 -1
- package/dist/components/umd/solid-components.js +46 -46
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/accordion/accordion.d.ts +23 -0
- package/dist/package/components/accordion/accordion.js +152 -0
- package/dist/package/components/accordion-group/accordion-group.d.ts +16 -0
- package/dist/package/components/accordion-group/accordion-group.js +63 -0
- package/dist/package/components/divider/divider.d.ts +13 -0
- package/dist/package/components/divider/divider.js +50 -0
- package/dist/package/internal/animate.d.ts +10 -0
- package/dist/package/internal/animate.js +41 -0
- package/dist/package/internal/event.d.ts +1 -0
- package/dist/package/internal/event.js +14 -0
- package/dist/package/solid-components.d.ts +3 -0
- package/dist/package/solid-components.js +16 -10
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/package/utilities/animation-registry.d.ts +14 -0
- package/dist/package/utilities/animation-registry.js +35 -0
- package/dist/versioned-components/es/accordion-group.js +1 -0
- package/dist/versioned-components/es/accordion.js +1 -0
- package/dist/versioned-components/es/button.js +28 -28
- package/dist/versioned-components/es/divider.js +1 -0
- package/dist/versioned-components/es/icon.js +1 -1
- package/dist/versioned-components/es/if-defined.js +2 -7
- package/dist/versioned-components/es/include.js +1 -1
- package/dist/versioned-components/es/link.js +1 -1
- package/dist/versioned-components/es/query.js +6 -0
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/solid-element.js +1 -1
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-package/components/accordion/accordion.d.ts +23 -0
- package/dist/versioned-package/components/accordion/accordion.js +152 -0
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +16 -0
- package/dist/versioned-package/components/accordion-group/accordion-group.js +63 -0
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +18 -18
- package/dist/versioned-package/components/divider/divider.d.ts +13 -0
- package/dist/versioned-package/components/divider/divider.js +50 -0
- 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/link/link.d.ts +1 -1
- package/dist/versioned-package/components/link/link.js +2 -2
- 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/internal/animate.d.ts +10 -0
- package/dist/versioned-package/internal/animate.js +41 -0
- package/dist/versioned-package/internal/event.d.ts +1 -0
- package/dist/versioned-package/internal/event.js +14 -0
- package/dist/versioned-package/internal/form.js +1 -1
- package/dist/versioned-package/solid-components.d.ts +3 -0
- package/dist/versioned-package/solid-components.js +16 -10
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/versioned-package/utilities/animation-registry.d.ts +14 -0
- package/dist/versioned-package/utilities/animation-registry.js +35 -0
- package/dist/vscode.html-custom-data.json +111 -5
- package/dist/web-types.json +312 -6
- package/package.json +10 -5
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import "../icon/icon.js";
|
|
2
|
+
import { stopAnimations, animateTo, shimKeyframesHeightAuto } from "../../internal/animate.js";
|
|
3
|
+
import { css, html } from "lit";
|
|
4
|
+
import { query, property, customElement } from "lit/decorators.js";
|
|
5
|
+
import { setDefaultAnimation, getAnimation } from "../../utilities/animation-registry.js";
|
|
6
|
+
import { LocalizeController } from "../../utilities/localize.js";
|
|
7
|
+
import { waitForEvent } from "../../internal/event.js";
|
|
8
|
+
import { watch } from "../../internal/watch.js";
|
|
9
|
+
import cx from "classix";
|
|
10
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
14
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
15
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
16
|
+
if (decorator = decorators[i])
|
|
17
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
18
|
+
if (kind && result)
|
|
19
|
+
__defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
let SdAccordion = class extends SolidElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.localize = new LocalizeController(this);
|
|
26
|
+
this.open = false;
|
|
27
|
+
}
|
|
28
|
+
firstUpdated() {
|
|
29
|
+
this.body.hidden = !this.open;
|
|
30
|
+
this.body.style.height = this.open ? "auto" : "0";
|
|
31
|
+
}
|
|
32
|
+
handleSummaryClick() {
|
|
33
|
+
this.header.focus();
|
|
34
|
+
if (this.open) {
|
|
35
|
+
this.hide();
|
|
36
|
+
} else {
|
|
37
|
+
this.show();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
handleSummaryKeyDown(event) {
|
|
41
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
if (this.open) {
|
|
44
|
+
this.hide();
|
|
45
|
+
} else {
|
|
46
|
+
this.show();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (event.key === "ArrowUp" || event.key === "ArrowLeft") {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
this.hide();
|
|
52
|
+
}
|
|
53
|
+
if (event.key === "ArrowDown" || event.key === "ArrowRight") {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
this.show();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async handleOpenChange() {
|
|
59
|
+
if (this.open) {
|
|
60
|
+
const slShow = this.emit("sd-show", { cancelable: true });
|
|
61
|
+
if (slShow.defaultPrevented) {
|
|
62
|
+
this.open = false;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
await stopAnimations(this.body);
|
|
66
|
+
this.body.hidden = false;
|
|
67
|
+
const { keyframes, options } = getAnimation(this, "accordion.show", { dir: this.localize.dir() });
|
|
68
|
+
await animateTo(this.body, shimKeyframesHeightAuto(keyframes, this.body.scrollHeight), options);
|
|
69
|
+
this.body.style.height = "auto";
|
|
70
|
+
this.emit("sd-after-show");
|
|
71
|
+
} else {
|
|
72
|
+
const slHide = this.emit("sd-hide", { cancelable: true });
|
|
73
|
+
if (slHide.defaultPrevented) {
|
|
74
|
+
this.open = true;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await stopAnimations(this.body);
|
|
78
|
+
const { keyframes, options } = getAnimation(this, "accordion.hide", { dir: this.localize.dir() });
|
|
79
|
+
await animateTo(this.body, shimKeyframesHeightAuto(keyframes, this.body.scrollHeight), options);
|
|
80
|
+
this.body.hidden = true;
|
|
81
|
+
this.body.style.height = "auto";
|
|
82
|
+
this.emit("sd-after-hide");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/** Shows the accordion. */
|
|
86
|
+
async show() {
|
|
87
|
+
if (this.open) {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
this.open = true;
|
|
91
|
+
return waitForEvent(this, "sd-after-show");
|
|
92
|
+
}
|
|
93
|
+
/** Hides the accordion */
|
|
94
|
+
async hide() {
|
|
95
|
+
if (!this.open) {
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
this.open = false;
|
|
99
|
+
return waitForEvent(this, "sd-after-hide");
|
|
100
|
+
}
|
|
101
|
+
render() {
|
|
102
|
+
return html`<div part="base" class="outline outline-1 outline-neutral-400 -outline-offset-1"><header part="header" id="header" class="${cx(
|
|
103
|
+
"flex text-base gap-4 font-bold items-center cursor-pointer select-none px-4 py-3 focus:outline focus:outline-primary focus:outline-2 focus:outline-offset-2 focus-visible:focus",
|
|
104
|
+
this.open ? "bg-white text-accent hover:bg-neutral-200" : "text-primary bg-neutral-100 hover:bg-neutral-200"
|
|
105
|
+
)}" role="button" aria-expanded="${this.open ? "true" : "false"}" aria-controls="content" tabindex="0" @click="${this.handleSummaryClick}" @keydown="${this.handleSummaryKeyDown}"><slot name="summary" part="summary" class="flex flex-auto items-center text-left">${this.summary}</slot><span part="summary-icon" class="${cx(
|
|
106
|
+
"flex flex-grow-0 flex-shrink-0 flex-auto items-center transition-all ease-in-out duration-300 text-xl",
|
|
107
|
+
this.open && "rotate-180"
|
|
108
|
+
)}"><slot name="expand-icon" class="${cx(this.open && "hidden")}"><sd-1-2-0-icon library="system" name="chevron-down"></sd-1-2-0-icon></slot><slot name="collapse-icon" class="${cx(!this.open && "hidden")}"><sd-1-2-0-icon library="system" name="chevron-down"></sd-1-2-0-icon></slot></span></header><div part="content" id="content" class="overflow-hidden"><slot class="block px-4 py-6" role="region" aria-labelledby="header"></slot></div></div>`;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
SdAccordion.styles = [
|
|
112
|
+
SolidElement.styles,
|
|
113
|
+
css`:host{display:block}`
|
|
114
|
+
];
|
|
115
|
+
__decorateClass([
|
|
116
|
+
query('[part="base"]')
|
|
117
|
+
], SdAccordion.prototype, "accordion", 2);
|
|
118
|
+
__decorateClass([
|
|
119
|
+
query('[part="header"]')
|
|
120
|
+
], SdAccordion.prototype, "header", 2);
|
|
121
|
+
__decorateClass([
|
|
122
|
+
query('[part="content"]')
|
|
123
|
+
], SdAccordion.prototype, "body", 2);
|
|
124
|
+
__decorateClass([
|
|
125
|
+
property({ type: Boolean, reflect: true })
|
|
126
|
+
], SdAccordion.prototype, "open", 2);
|
|
127
|
+
__decorateClass([
|
|
128
|
+
property()
|
|
129
|
+
], SdAccordion.prototype, "summary", 2);
|
|
130
|
+
__decorateClass([
|
|
131
|
+
watch("open", { waitUntilFirstUpdate: true })
|
|
132
|
+
], SdAccordion.prototype, "handleOpenChange", 1);
|
|
133
|
+
SdAccordion = __decorateClass([
|
|
134
|
+
customElement("sd-1-2-0-accordion")
|
|
135
|
+
], SdAccordion);
|
|
136
|
+
setDefaultAnimation("accordion.show", {
|
|
137
|
+
keyframes: [
|
|
138
|
+
{ height: "0", opacity: "0" },
|
|
139
|
+
{ height: "auto", opacity: "1" }
|
|
140
|
+
],
|
|
141
|
+
options: { duration: 300, easing: "ease" }
|
|
142
|
+
});
|
|
143
|
+
setDefaultAnimation("accordion.hide", {
|
|
144
|
+
keyframes: [
|
|
145
|
+
{ height: "auto", opacity: "1" },
|
|
146
|
+
{ height: "0", opacity: "0" }
|
|
147
|
+
],
|
|
148
|
+
options: { duration: 300, easing: "ease" }
|
|
149
|
+
});
|
|
150
|
+
export {
|
|
151
|
+
SdAccordion as default
|
|
152
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '../accordion/accordion';
|
|
2
|
+
import SolidElement from '../../internal/solid-element';
|
|
3
|
+
export default class SdAccordionGroup extends SolidElement {
|
|
4
|
+
_accordionsInDefaultSlot: HTMLElement[];
|
|
5
|
+
closeOthers: boolean;
|
|
6
|
+
connectedCallback(): void;
|
|
7
|
+
disconnectedCallback(): void;
|
|
8
|
+
private handleAccordionShow;
|
|
9
|
+
render(): import("lit").TemplateResult<1>;
|
|
10
|
+
static styles: import("lit").CSSResultGroup[];
|
|
11
|
+
}
|
|
12
|
+
declare global {
|
|
13
|
+
interface HTMLElementTagNameMap {
|
|
14
|
+
'sd-1-2-0-accordion-group': SdAccordionGroup;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "../accordion/accordion.js";
|
|
2
|
+
import { css, html } from "lit";
|
|
3
|
+
import { queryAssignedElements, property, customElement } from "lit/decorators.js";
|
|
4
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
5
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
13
|
+
if (kind && result)
|
|
14
|
+
__defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
let SdAccordionGroup = class extends SolidElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.closeOthers = false;
|
|
21
|
+
this.handleAccordionShow = (event) => {
|
|
22
|
+
if (this.closeOthers) {
|
|
23
|
+
this._accordionsInDefaultSlot.forEach((accordionElement) => {
|
|
24
|
+
if (accordionElement === event.target) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (accordionElement.parentNode !== event.target.parentNode) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
accordionElement.removeAttribute("open");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
connectedCallback() {
|
|
36
|
+
super.connectedCallback();
|
|
37
|
+
this.addEventListener("sd-show", this.handleAccordionShow);
|
|
38
|
+
}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
super.disconnectedCallback();
|
|
41
|
+
this.removeEventListener("sd-show", this.handleAccordionShow);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return html`<div part="base"><slot></slot></div>`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
SdAccordionGroup.styles = [
|
|
48
|
+
componentStyles,
|
|
49
|
+
SolidElement.styles,
|
|
50
|
+
css`:host{display:block}::slotted(sd-1-2-0-accordion:not(:first-of-type)){margin-top:-1px}`
|
|
51
|
+
];
|
|
52
|
+
__decorateClass([
|
|
53
|
+
queryAssignedElements({ selector: "sd-1-2-0-accordion" })
|
|
54
|
+
], SdAccordionGroup.prototype, "_accordionsInDefaultSlot", 2);
|
|
55
|
+
__decorateClass([
|
|
56
|
+
property({ attribute: "close-others", type: Boolean })
|
|
57
|
+
], SdAccordionGroup.prototype, "closeOthers", 2);
|
|
58
|
+
SdAccordionGroup = __decorateClass([
|
|
59
|
+
customElement("sd-1-2-0-accordion-group")
|
|
60
|
+
], SdAccordionGroup);
|
|
61
|
+
export {
|
|
62
|
+
SdAccordionGroup as default
|
|
63
|
+
};
|
|
@@ -216,9 +216,9 @@ let SdButton = class extends SolidElement {
|
|
|
216
216
|
}[this.size]
|
|
217
217
|
)}>
|
|
218
218
|
</slot>
|
|
219
|
-
${this.loading ? html`<sd-1-0-
|
|
219
|
+
${this.loading ? html`<sd-1-2-0-spinner
|
|
220
220
|
class="${cx("absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2")}"
|
|
221
|
-
></sd-1-0-
|
|
221
|
+
></sd-1-2-0-spinner>` : ""}
|
|
222
222
|
</${tag}>
|
|
223
223
|
`;
|
|
224
224
|
}
|
|
@@ -234,7 +234,7 @@ SdButton.styles = [
|
|
|
234
234
|
cursor: pointer;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
sd-1-0-
|
|
237
|
+
sd-1-2-0-spinner {
|
|
238
238
|
--indicator-color: currentColor;
|
|
239
239
|
--track-color: var(--tw-varcolor-200);
|
|
240
240
|
}
|
|
@@ -253,11 +253,11 @@ SdButton.styles = [
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
/**
|
|
256
|
-
* sd-1-0-
|
|
256
|
+
* sd-1-2-0-icons should automatically resize correctly based on the button size.
|
|
257
257
|
*/
|
|
258
258
|
|
|
259
|
-
::slotted(sd-1-0-
|
|
260
|
-
sd-1-0-
|
|
259
|
+
::slotted(sd-1-2-0-icon),
|
|
260
|
+
sd-1-2-0-spinner {
|
|
261
261
|
font-size: calc(var(--tw-varspacing) / 2);
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -268,30 +268,30 @@ SdButton.styles = [
|
|
|
268
268
|
// * buttons and we style them here instead.
|
|
269
269
|
// */
|
|
270
270
|
|
|
271
|
-
// :host(.sd-1-0-
|
|
271
|
+
// :host(.sd-1-2-0-button-group__button--first:not(.sd-1-2-0-button-group__button--last)) .button {
|
|
272
272
|
// border-start-end-radius: 0;
|
|
273
273
|
// border-end-end-radius: 0;
|
|
274
274
|
// }
|
|
275
275
|
|
|
276
|
-
// :host(.sd-1-0-
|
|
276
|
+
// :host(.sd-1-2-0-button-group__button--inner) .button {
|
|
277
277
|
// border-radius: 0;
|
|
278
278
|
// }
|
|
279
279
|
|
|
280
|
-
// :host(.sd-1-0-
|
|
280
|
+
// :host(.sd-1-2-0-button-group__button--last:not(.sd-1-2-0-button-group__button--first)) .button {
|
|
281
281
|
// border-start-start-radius: 0;
|
|
282
282
|
// border-end-start-radius: 0;
|
|
283
283
|
// }
|
|
284
284
|
|
|
285
285
|
// /* All except the first */
|
|
286
|
-
// :host(.sd-1-0-
|
|
286
|
+
// :host(.sd-1-2-0-button-group__button:not(.sd-1-2-0-button-group__button--first)) {
|
|
287
287
|
// margin-inline-start: calc(-1 * var(--sd-input-border-width));
|
|
288
288
|
// }
|
|
289
289
|
|
|
290
290
|
// /* Add a visual separator between solid buttons */
|
|
291
291
|
// :host(
|
|
292
|
-
// .sd-1-0-
|
|
293
|
-
// .sd-1-0-
|
|
294
|
-
// .sd-1-0-
|
|
292
|
+
// .sd-1-2-0-button-group__button:not(
|
|
293
|
+
// .sd-1-2-0-button-group__button--first,
|
|
294
|
+
// .sd-1-2-0-button-group__button--radio,
|
|
295
295
|
// [variant='default']
|
|
296
296
|
// ):not(:hover)
|
|
297
297
|
// )
|
|
@@ -306,13 +306,13 @@ SdButton.styles = [
|
|
|
306
306
|
// }
|
|
307
307
|
|
|
308
308
|
// /* Bump hovered, focused, and checked buttons up so their focus ring isn't clipped */
|
|
309
|
-
// :host(.sd-1-0-
|
|
309
|
+
// :host(.sd-1-2-0-button-group__button--hover) {
|
|
310
310
|
// z-index: 1;
|
|
311
311
|
// }
|
|
312
312
|
|
|
313
313
|
// /* Focus and checked are always on top */
|
|
314
|
-
// :host(.sd-1-0-
|
|
315
|
-
// :host(.sd-1-0-
|
|
314
|
+
// :host(.sd-1-2-0-button-group__button--focus),
|
|
315
|
+
// :host(.sd-1-2-0-button-group__button[checked]) {
|
|
316
316
|
// z-index: 2;
|
|
317
317
|
// }
|
|
318
318
|
`
|
|
@@ -321,7 +321,7 @@ __decorateClass([
|
|
|
321
321
|
query("a, button")
|
|
322
322
|
], SdButton.prototype, "button", 2);
|
|
323
323
|
__decorateClass([
|
|
324
|
-
queryAssignedElements({ selector: "sd-1-0-
|
|
324
|
+
queryAssignedElements({ selector: "sd-1-2-0-icon" })
|
|
325
325
|
], SdButton.prototype, "_iconsInDefaultSlot", 2);
|
|
326
326
|
__decorateClass([
|
|
327
327
|
state()
|
|
@@ -384,7 +384,7 @@ __decorateClass([
|
|
|
384
384
|
watch("disabled", { waitUntilFirstUpdate: true })
|
|
385
385
|
], SdButton.prototype, "handleDisabledChange", 1);
|
|
386
386
|
SdButton = __decorateClass([
|
|
387
|
-
customElement("sd-1-0-
|
|
387
|
+
customElement("sd-1-2-0-button")
|
|
388
388
|
], SdButton);
|
|
389
389
|
export {
|
|
390
390
|
SdButton as default
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import SolidElement from '../../internal/solid-element';
|
|
2
|
+
export default class SdDivider extends SolidElement {
|
|
3
|
+
orientation: 'horizontal' | 'vertical';
|
|
4
|
+
inverted: boolean;
|
|
5
|
+
connectedCallback(): void;
|
|
6
|
+
render(): import("lit").TemplateResult<1>;
|
|
7
|
+
static styles: import("lit").CSSResultGroup[];
|
|
8
|
+
}
|
|
9
|
+
declare global {
|
|
10
|
+
interface HTMLElementTagNameMap {
|
|
11
|
+
'sd-1-2-0-divider': SdDivider;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { css, html } from "lit";
|
|
2
|
+
import { property, customElement } from "lit/decorators.js";
|
|
3
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
4
|
+
import cx from "classix";
|
|
5
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
10
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
+
if (decorator = decorators[i])
|
|
12
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
13
|
+
if (kind && result)
|
|
14
|
+
__defProp(target, key, result);
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
17
|
+
let SdDivider = class extends SolidElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.orientation = "horizontal";
|
|
21
|
+
this.inverted = false;
|
|
22
|
+
}
|
|
23
|
+
connectedCallback() {
|
|
24
|
+
super.connectedCallback();
|
|
25
|
+
this.setAttribute("role", "separator");
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
return html`<hr part="main" class="${cx(
|
|
29
|
+
this.inverted ? "border-primary-400" : "border-neutral-400",
|
|
30
|
+
this.orientation === "horizontal" ? "border-t w-full" : " border-l h-full"
|
|
31
|
+
)}">`;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
SdDivider.styles = [
|
|
35
|
+
componentStyles,
|
|
36
|
+
SolidElement.styles,
|
|
37
|
+
css`:host{margin:0}:host(sd-1-2-0-divider[orientation=horizontal]){display:block}:host(sd-1-2-0-divider[orientation=vertical]){display:inline-block}`
|
|
38
|
+
];
|
|
39
|
+
__decorateClass([
|
|
40
|
+
property({ reflect: true })
|
|
41
|
+
], SdDivider.prototype, "orientation", 2);
|
|
42
|
+
__decorateClass([
|
|
43
|
+
property({ type: Boolean, reflect: true })
|
|
44
|
+
], SdDivider.prototype, "inverted", 2);
|
|
45
|
+
SdDivider = __decorateClass([
|
|
46
|
+
customElement("sd-1-2-0-divider")
|
|
47
|
+
], SdDivider);
|
|
48
|
+
export {
|
|
49
|
+
SdDivider as default
|
|
50
|
+
};
|
|
@@ -76,7 +76,7 @@ let SdLink = class extends SolidElement {
|
|
|
76
76
|
};
|
|
77
77
|
SdLink.styles = [
|
|
78
78
|
SolidElement.styles,
|
|
79
|
-
css`::slotted(sd-1-0-
|
|
79
|
+
css`::slotted(sd-1-2-0-icon){font-size:1.25em;margin-bottom:-.25em}:host([size=sm][standalone]) ::slotted(sd-1-2-0-icon){font-size:1rem}:host([size=lg][standalone]) ::slotted(sd-1-2-0-icon){font-size:1.5rem}`
|
|
80
80
|
];
|
|
81
81
|
__decorateClass([
|
|
82
82
|
query("a")
|
|
@@ -100,7 +100,7 @@ __decorateClass([
|
|
|
100
100
|
property()
|
|
101
101
|
], SdLink.prototype, "download", 2);
|
|
102
102
|
SdLink = __decorateClass([
|
|
103
|
-
customElement("sd-1-0-
|
|
103
|
+
customElement("sd-1-2-0-link")
|
|
104
104
|
], SdLink);
|
|
105
105
|
export {
|
|
106
106
|
SdLink as default
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function animateTo(el: HTMLElement, keyframes: Keyframe[], options?: KeyframeAnimationOptions): Promise<unknown>;
|
|
2
|
+
export declare function parseDuration(delay: number | string): number;
|
|
3
|
+
export declare function prefersReducedMotion(): boolean;
|
|
4
|
+
export declare function stopAnimations(el: HTMLElement): Promise<unknown[]>;
|
|
5
|
+
export declare function shimKeyframesHeightAuto(keyframes: Keyframe[], calculatedHeight: number): {
|
|
6
|
+
height: string | number | null | undefined;
|
|
7
|
+
composite?: CompositeOperationOrAuto | undefined;
|
|
8
|
+
easing?: string | undefined;
|
|
9
|
+
offset?: number | null | undefined;
|
|
10
|
+
}[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function animateTo(el, keyframes, options) {
|
|
2
|
+
return new Promise((resolve) => {
|
|
3
|
+
if ((options == null ? void 0 : options.duration) === Infinity) {
|
|
4
|
+
throw new Error("Promise-based animations must be finite.");
|
|
5
|
+
}
|
|
6
|
+
const animation = el.animate(keyframes, {
|
|
7
|
+
...options,
|
|
8
|
+
duration: prefersReducedMotion() ? 0 : options.duration
|
|
9
|
+
});
|
|
10
|
+
animation.addEventListener("cancel", resolve, { once: true });
|
|
11
|
+
animation.addEventListener("finish", resolve, { once: true });
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function prefersReducedMotion() {
|
|
15
|
+
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
16
|
+
return query.matches;
|
|
17
|
+
}
|
|
18
|
+
function stopAnimations(el) {
|
|
19
|
+
return Promise.all(
|
|
20
|
+
el.getAnimations().map((animation) => {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
const handleAnimationEvent = requestAnimationFrame(resolve);
|
|
23
|
+
animation.addEventListener("cancel", () => handleAnimationEvent, { once: true });
|
|
24
|
+
animation.addEventListener("finish", () => handleAnimationEvent, { once: true });
|
|
25
|
+
animation.cancel();
|
|
26
|
+
});
|
|
27
|
+
})
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function shimKeyframesHeightAuto(keyframes, calculatedHeight) {
|
|
31
|
+
return keyframes.map((keyframe) => ({
|
|
32
|
+
...keyframe,
|
|
33
|
+
height: keyframe.height === "auto" ? `${calculatedHeight}px` : keyframe.height
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
animateTo,
|
|
38
|
+
prefersReducedMotion,
|
|
39
|
+
shimKeyframesHeightAuto,
|
|
40
|
+
stopAnimations
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function waitForEvent(el: HTMLElement, eventName: string): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function waitForEvent(el, eventName) {
|
|
2
|
+
return new Promise((resolve) => {
|
|
3
|
+
function done(event) {
|
|
4
|
+
if (event.target === el) {
|
|
5
|
+
el.removeEventListener(eventName, done);
|
|
6
|
+
resolve();
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
el.addEventListener(eventName, done);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
waitForEvent
|
|
14
|
+
};
|
|
@@ -90,7 +90,7 @@ class FormControlController {
|
|
|
90
90
|
const disabled = this.options.disabled(this.host);
|
|
91
91
|
const name = this.options.name(this.host);
|
|
92
92
|
const value = this.options.value(this.host);
|
|
93
|
-
const isButton = this.host.tagName.toLowerCase() === "sd-1-0-
|
|
93
|
+
const isButton = this.host.tagName.toLowerCase() === "sd-1-2-0-button";
|
|
94
94
|
if (!disabled && !isButton && typeof name === "string" && name.length > 0 && typeof value !== "undefined") {
|
|
95
95
|
if (Array.isArray(value)) {
|
|
96
96
|
value.forEach((val) => {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { default as SdAccordion } from './components/accordion/accordion';
|
|
2
|
+
export { default as SdAccordionGroup } from './components/accordion-group/accordion-group';
|
|
1
3
|
export { default as SdButton } from './components/button/button';
|
|
4
|
+
export { default as SdDivider } from './components/divider/divider';
|
|
2
5
|
export { default as SdIcon } from './components/icon/icon';
|
|
3
6
|
export { default as SdInclude } from './components/include/include';
|
|
4
7
|
export { default as SdLink } from './components/link/link';
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { default as default2 } from "./components/
|
|
2
|
-
import { default as default3 } from "./components/
|
|
3
|
-
import { default as default4 } from "./components/
|
|
4
|
-
import { default as default5 } from "./components/
|
|
5
|
-
import { default as default6 } from "./components/
|
|
1
|
+
import { default as default2 } from "./components/accordion/accordion.js";
|
|
2
|
+
import { default as default3 } from "./components/accordion-group/accordion-group.js";
|
|
3
|
+
import { default as default4 } from "./components/button/button.js";
|
|
4
|
+
import { default as default5 } from "./components/divider/divider.js";
|
|
5
|
+
import { default as default6 } from "./components/icon/icon.js";
|
|
6
|
+
import { default as default7 } from "./components/include/include.js";
|
|
7
|
+
import { default as default8 } from "./components/link/link.js";
|
|
8
|
+
import { default as default9 } from "./components/spinner/spinner.js";
|
|
6
9
|
import { registerIconLibrary, unregisterIconLibrary } from "./components/icon/library.js";
|
|
7
10
|
import { LocalizeController } from "./utilities/localize.js";
|
|
8
11
|
export {
|
|
9
12
|
LocalizeController,
|
|
10
|
-
default2 as
|
|
11
|
-
default3 as
|
|
12
|
-
default4 as
|
|
13
|
-
default5 as
|
|
14
|
-
default6 as
|
|
13
|
+
default2 as SdAccordion,
|
|
14
|
+
default3 as SdAccordionGroup,
|
|
15
|
+
default4 as SdButton,
|
|
16
|
+
default5 as SdDivider,
|
|
17
|
+
default6 as SdIcon,
|
|
18
|
+
default7 as SdInclude,
|
|
19
|
+
default8 as SdLink,
|
|
20
|
+
default9 as SdSpinner,
|
|
15
21
|
registerIconLibrary,
|
|
16
22
|
unregisterIconLibrary
|
|
17
23
|
};
|