@solid-design-system/components 1.8.0 → 1.10.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/button.js +1 -6
- package/dist/components/es/drawer.js +1 -0
- package/dist/components/es/dropdown.js +1 -1
- package/dist/components/es/solid-components2.js +1 -1
- package/dist/components/es/solid-element.js +4 -4
- package/dist/components/es/static.js +6 -0
- package/dist/components/es/tabbable.js +1 -0
- package/dist/components/es/tag.js +1 -0
- package/dist/components/umd/solid-components.js +10 -10
- package/dist/custom-elements.json +1 -1
- package/dist/package/components/drawer/drawer.d.ts +34 -0
- package/dist/package/components/drawer/drawer.js +283 -0
- package/dist/package/components/icon/library.system.d.ts +1 -0
- package/dist/package/components/icon/library.system.js +6 -1
- package/dist/package/components/tag/tag.d.ts +24 -0
- package/dist/package/components/tag/tag.js +110 -0
- package/dist/package/internal/modal.d.ts +12 -0
- package/dist/package/internal/modal.js +52 -0
- package/dist/package/internal/scroll.js +23 -1
- package/dist/package/internal/string.d.ts +1 -0
- package/dist/package/internal/string.js +6 -0
- package/dist/package/solid-components.d.ts +2 -0
- package/dist/package/solid-components.js +18 -14
- package/dist/package/styles/tailwind.css.js +1 -1
- package/dist/versioned-components/es/accordion-group.js +1 -1
- package/dist/versioned-components/es/accordion.js +1 -1
- package/dist/versioned-components/es/badge.js +1 -1
- package/dist/versioned-components/es/brandshape.js +1 -1
- package/dist/versioned-components/es/button.js +1 -6
- package/dist/versioned-components/es/divider.js +1 -1
- package/dist/versioned-components/es/drawer.js +1 -0
- package/dist/versioned-components/es/dropdown.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/link.js +1 -1
- package/dist/versioned-components/es/popup.js +1 -1
- package/dist/versioned-components/es/solid-components2.js +1 -1
- package/dist/versioned-components/es/solid-element.js +4 -4
- package/dist/versioned-components/es/spinner.js +1 -1
- package/dist/versioned-components/es/static.js +6 -0
- package/dist/versioned-components/es/tabbable.js +1 -0
- package/dist/versioned-components/es/tag.js +1 -0
- package/dist/versioned-components/es/teaser.js +1 -1
- package/dist/versioned-package/components/accordion/accordion.d.ts +1 -1
- package/dist/versioned-package/components/accordion/accordion.js +2 -2
- package/dist/versioned-package/components/accordion-group/accordion-group.d.ts +1 -1
- package/dist/versioned-package/components/accordion-group/accordion-group.js +3 -3
- package/dist/versioned-package/components/badge/badge.d.ts +1 -1
- package/dist/versioned-package/components/badge/badge.js +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.d.ts +1 -1
- package/dist/versioned-package/components/brandshape/brandshape.js +1 -1
- package/dist/versioned-package/components/button/button.d.ts +1 -1
- package/dist/versioned-package/components/button/button.js +4 -4
- package/dist/versioned-package/components/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 +34 -0
- package/dist/versioned-package/components/drawer/drawer.js +283 -0
- package/dist/versioned-package/components/dropdown/dropdown.d.ts +1 -1
- package/dist/versioned-package/components/dropdown/dropdown.js +6 -6
- package/dist/versioned-package/components/icon/icon.d.ts +1 -1
- package/dist/versioned-package/components/icon/icon.js +1 -1
- package/dist/versioned-package/components/icon/library.system.d.ts +1 -0
- package/dist/versioned-package/components/icon/library.system.js +6 -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/popup/popup.d.ts +1 -1
- package/dist/versioned-package/components/popup/popup.js +1 -1
- package/dist/versioned-package/components/spinner/spinner.d.ts +1 -1
- package/dist/versioned-package/components/spinner/spinner.js +1 -1
- package/dist/versioned-package/components/tag/tag.d.ts +24 -0
- package/dist/versioned-package/components/tag/tag.js +110 -0
- package/dist/versioned-package/components/teaser/teaser.js +1 -1
- package/dist/versioned-package/internal/form.js +1 -1
- package/dist/versioned-package/internal/modal.d.ts +12 -0
- package/dist/versioned-package/internal/modal.js +52 -0
- package/dist/versioned-package/internal/scroll.js +23 -1
- package/dist/versioned-package/internal/string.d.ts +1 -0
- package/dist/versioned-package/internal/string.js +6 -0
- package/dist/versioned-package/solid-components.d.ts +2 -0
- package/dist/versioned-package/solid-components.js +18 -14
- package/dist/versioned-package/styles/tailwind.css.js +1 -1
- package/dist/vscode.html-custom-data.json +215 -13
- package/dist/web-types.json +612 -14
- package/package.json +3 -3
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import "../button/button.js";
|
|
2
|
+
import "../icon/icon.js";
|
|
3
|
+
import { animateTo, stopAnimations } from "../../internal/animate.js";
|
|
4
|
+
import { css, html } from "lit";
|
|
5
|
+
import { query, property, customElement } from "lit/decorators.js";
|
|
6
|
+
import { setDefaultAnimation, getAnimation } from "../../utilities/animation-registry.js";
|
|
7
|
+
import { HasSlotController } from "../../internal/slot.js";
|
|
8
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
9
|
+
import { LocalizeController } from "../../utilities/localize.js";
|
|
10
|
+
import { lockBodyScrolling, unlockBodyScrolling } from "../../internal/scroll.js";
|
|
11
|
+
import { uppercaseFirstLetter } from "../../internal/string.js";
|
|
12
|
+
import { waitForEvent } from "../../internal/event.js";
|
|
13
|
+
import { watch } from "../../internal/watch.js";
|
|
14
|
+
import componentStyles from "../../styles/component.styles.js";
|
|
15
|
+
import cx from "classix";
|
|
16
|
+
import Modal from "../../internal/modal.js";
|
|
17
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
18
|
+
var __defProp = Object.defineProperty;
|
|
19
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
21
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
22
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
23
|
+
if (decorator = decorators[i])
|
|
24
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
25
|
+
if (kind && result)
|
|
26
|
+
__defProp(target, key, result);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
let SdDrawer = class extends SolidElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.hasSlotController = new HasSlotController(this, "footer");
|
|
33
|
+
this.localize = new LocalizeController(this);
|
|
34
|
+
this.modal = new Modal(this);
|
|
35
|
+
this.open = false;
|
|
36
|
+
this.label = "";
|
|
37
|
+
this.placement = "end";
|
|
38
|
+
this.contained = false;
|
|
39
|
+
this.noHeader = false;
|
|
40
|
+
this.handleDocumentKeyDown = (event) => {
|
|
41
|
+
if (this.open && event.key === "Escape") {
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
this.requestClose("keyboard");
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
firstUpdated() {
|
|
48
|
+
this.drawer.hidden = !this.open;
|
|
49
|
+
if (this.open) {
|
|
50
|
+
this.addOpenListeners();
|
|
51
|
+
if (!this.contained) {
|
|
52
|
+
this.modal.activate();
|
|
53
|
+
lockBodyScrolling(this);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
disconnectedCallback() {
|
|
58
|
+
super.disconnectedCallback();
|
|
59
|
+
unlockBodyScrolling(this);
|
|
60
|
+
}
|
|
61
|
+
requestClose(source) {
|
|
62
|
+
const slRequestClose = this.emit("sd-request-close", {
|
|
63
|
+
cancelable: true,
|
|
64
|
+
detail: { source }
|
|
65
|
+
});
|
|
66
|
+
if (slRequestClose.defaultPrevented) {
|
|
67
|
+
const animation = getAnimation(this, "drawer.denyClose", { dir: this.localize.dir() });
|
|
68
|
+
animateTo(this.panel, animation.keyframes, animation.options);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.hide();
|
|
72
|
+
}
|
|
73
|
+
addOpenListeners() {
|
|
74
|
+
document.addEventListener("keydown", this.handleDocumentKeyDown);
|
|
75
|
+
}
|
|
76
|
+
removeOpenListeners() {
|
|
77
|
+
document.removeEventListener("keydown", this.handleDocumentKeyDown);
|
|
78
|
+
}
|
|
79
|
+
async handleOpenChange() {
|
|
80
|
+
if (this.open) {
|
|
81
|
+
this.emit("sd-show");
|
|
82
|
+
this.addOpenListeners();
|
|
83
|
+
this.originalTrigger = document.activeElement;
|
|
84
|
+
if (!this.contained) {
|
|
85
|
+
this.modal.activate();
|
|
86
|
+
lockBodyScrolling(this);
|
|
87
|
+
}
|
|
88
|
+
const autoFocusTarget = this.querySelector("[autofocus]");
|
|
89
|
+
if (autoFocusTarget) {
|
|
90
|
+
autoFocusTarget.removeAttribute("autofocus");
|
|
91
|
+
}
|
|
92
|
+
await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);
|
|
93
|
+
this.drawer.hidden = false;
|
|
94
|
+
requestAnimationFrame(() => {
|
|
95
|
+
const sdInitialFocus = this.emit("sd-initial-focus", { cancelable: true });
|
|
96
|
+
if (!sdInitialFocus.defaultPrevented) {
|
|
97
|
+
if (autoFocusTarget) {
|
|
98
|
+
autoFocusTarget.focus({ preventScroll: true });
|
|
99
|
+
} else {
|
|
100
|
+
this.panel.focus({ preventScroll: true });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (autoFocusTarget) {
|
|
104
|
+
autoFocusTarget.setAttribute("autofocus", "");
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const panelAnimation = getAnimation(this, `drawer.show${uppercaseFirstLetter(this.placement)}`, {
|
|
108
|
+
dir: this.localize.dir()
|
|
109
|
+
});
|
|
110
|
+
const overlayAnimation = getAnimation(this, "drawer.overlay.show", { dir: this.localize.dir() });
|
|
111
|
+
await Promise.all([
|
|
112
|
+
animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options),
|
|
113
|
+
animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options)
|
|
114
|
+
]);
|
|
115
|
+
this.emit("sd-after-show");
|
|
116
|
+
} else {
|
|
117
|
+
this.emit("sd-hide");
|
|
118
|
+
this.removeOpenListeners();
|
|
119
|
+
if (!this.contained) {
|
|
120
|
+
this.modal.deactivate();
|
|
121
|
+
unlockBodyScrolling(this);
|
|
122
|
+
}
|
|
123
|
+
await Promise.all([stopAnimations(this.drawer), stopAnimations(this.overlay)]);
|
|
124
|
+
const panelAnimation = getAnimation(this, `drawer.hide${uppercaseFirstLetter(this.placement)}`, {
|
|
125
|
+
dir: this.localize.dir()
|
|
126
|
+
});
|
|
127
|
+
const overlayAnimation = getAnimation(this, "drawer.overlay.hide", { dir: this.localize.dir() });
|
|
128
|
+
await Promise.all([
|
|
129
|
+
animateTo(this.overlay, overlayAnimation.keyframes, overlayAnimation.options).then(() => {
|
|
130
|
+
this.overlay.hidden = true;
|
|
131
|
+
}),
|
|
132
|
+
animateTo(this.panel, panelAnimation.keyframes, panelAnimation.options).then(() => {
|
|
133
|
+
this.panel.hidden = true;
|
|
134
|
+
})
|
|
135
|
+
]);
|
|
136
|
+
this.drawer.hidden = true;
|
|
137
|
+
this.overlay.hidden = false;
|
|
138
|
+
this.panel.hidden = false;
|
|
139
|
+
const trigger = this.originalTrigger;
|
|
140
|
+
if (typeof (trigger == null ? void 0 : trigger.focus) === "function") {
|
|
141
|
+
setTimeout(() => trigger.focus());
|
|
142
|
+
}
|
|
143
|
+
this.emit("sd-after-hide");
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
handleNoModalChange() {
|
|
147
|
+
if (this.open && !this.contained) {
|
|
148
|
+
this.modal.activate();
|
|
149
|
+
lockBodyScrolling(this);
|
|
150
|
+
}
|
|
151
|
+
if (this.open && this.contained) {
|
|
152
|
+
this.modal.deactivate();
|
|
153
|
+
unlockBodyScrolling(this);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/** Shows the drawer. */
|
|
157
|
+
async show() {
|
|
158
|
+
if (this.open) {
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
this.open = true;
|
|
162
|
+
return waitForEvent(this, "sd-after-show");
|
|
163
|
+
}
|
|
164
|
+
/** Hides the drawer */
|
|
165
|
+
async hide() {
|
|
166
|
+
if (!this.open) {
|
|
167
|
+
return void 0;
|
|
168
|
+
}
|
|
169
|
+
this.open = false;
|
|
170
|
+
return waitForEvent(this, "sd-after-hide");
|
|
171
|
+
}
|
|
172
|
+
render() {
|
|
173
|
+
return html`<div part="base" class="${cx(
|
|
174
|
+
"top-0 start-0 w-full h-full pointer-events-none overflow-hidden",
|
|
175
|
+
this.contained ? "absolute" : "fixed"
|
|
176
|
+
)}"><div part="overlay" class="${cx(
|
|
177
|
+
"block top-0 left-0 right-0 bottom-0 bg-neutral-800/75 pointer-events-auto",
|
|
178
|
+
this.contained ? "absolute" : "fixed"
|
|
179
|
+
)}" @click="${() => this.requestClose("overlay")}" tabindex="-1"></div><div part="panel" class="${cx(
|
|
180
|
+
"absolute flex flex-col z-10 max-w-full max-h-full bg-white shadow-lg overflow-auto pointer-events-auto focus:outline-none",
|
|
181
|
+
{
|
|
182
|
+
end: "top-0 end-0 bottom-auto start-auto w-[--width] h-full",
|
|
183
|
+
start: "top-0 end-auto bottom-auto start-0 w-[--width] h-full"
|
|
184
|
+
}[this.placement]
|
|
185
|
+
)}" role="dialog" aria-modal="true" aria-hidden="${this.open ? "false" : "true"}" aria-label="${this.label}" aria-labelledby="${ifDefined(!this.noHeader ? "title" : void 0)}" tabindex="0">${!this.noHeader ? html`<header part="header" class="flex justify-between py-2 px-4 items-center flex-shrink-0" style="min-height:56px"><div part="title"><slot name="header" part="title" class="flex-auto text-xl m-0" id="title"></slot></div><div class="shrink-0 flex flex-wrap justify-end gap-1 ml-4 absolute top-2 right-2"><sd-1-10-0-button variant="tertiary" size="lg" part="close-button" @click="${() => this.requestClose("close-button")}"><sd-1-10-0-icon name="close" library="system"></sd-1-10-0-icon></sd-1-10-0-button></div></header>` : ""}<div part="body" class="flex-auto block px-4"><slot></slot></div><footer part="footer" class="${cx(this.hasSlotController.test("footer") ? "text-left p-4" : "hidden")}"><slot name="footer"></slot></footer></div></div>`;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
SdDrawer.styles = [
|
|
189
|
+
SolidElement.styles,
|
|
190
|
+
css`${componentStyles}:host{--width:25rem;display:contents}:host([contained]){z-index:initial}:host(:not([contained])){z-index:var(--sd-z-index-drawer)}[part=body]{-webkit-overflow-scrolling:touch;overflow-y:scroll;scrollbar-width:none}[part=body]::-webkit-scrollbar{width:0;height:0}`
|
|
191
|
+
];
|
|
192
|
+
__decorateClass([
|
|
193
|
+
query("[part=base]")
|
|
194
|
+
], SdDrawer.prototype, "drawer", 2);
|
|
195
|
+
__decorateClass([
|
|
196
|
+
query("[part=panel]")
|
|
197
|
+
], SdDrawer.prototype, "panel", 2);
|
|
198
|
+
__decorateClass([
|
|
199
|
+
query("[part=overlay]")
|
|
200
|
+
], SdDrawer.prototype, "overlay", 2);
|
|
201
|
+
__decorateClass([
|
|
202
|
+
property({ type: Boolean, reflect: true })
|
|
203
|
+
], SdDrawer.prototype, "open", 2);
|
|
204
|
+
__decorateClass([
|
|
205
|
+
property({ attribute: "label", reflect: true })
|
|
206
|
+
], SdDrawer.prototype, "label", 2);
|
|
207
|
+
__decorateClass([
|
|
208
|
+
property({ reflect: true })
|
|
209
|
+
], SdDrawer.prototype, "placement", 2);
|
|
210
|
+
__decorateClass([
|
|
211
|
+
property({ type: Boolean, reflect: true })
|
|
212
|
+
], SdDrawer.prototype, "contained", 2);
|
|
213
|
+
__decorateClass([
|
|
214
|
+
property({ attribute: "no-header", type: Boolean })
|
|
215
|
+
], SdDrawer.prototype, "noHeader", 2);
|
|
216
|
+
__decorateClass([
|
|
217
|
+
watch("open", { waitUntilFirstUpdate: true })
|
|
218
|
+
], SdDrawer.prototype, "handleOpenChange", 1);
|
|
219
|
+
__decorateClass([
|
|
220
|
+
watch("contained", { waitUntilFirstUpdate: true })
|
|
221
|
+
], SdDrawer.prototype, "handleNoModalChange", 1);
|
|
222
|
+
SdDrawer = __decorateClass([
|
|
223
|
+
customElement("sd-1-10-0-drawer")
|
|
224
|
+
], SdDrawer);
|
|
225
|
+
setDefaultAnimation("drawer.showStart", {
|
|
226
|
+
keyframes: [
|
|
227
|
+
{ opacity: 0, translate: "-100%" },
|
|
228
|
+
{ opacity: 1, translate: "0" }
|
|
229
|
+
],
|
|
230
|
+
rtlKeyframes: [
|
|
231
|
+
{ opacity: 0, translate: "100%" },
|
|
232
|
+
{ opacity: 1, translate: "0" }
|
|
233
|
+
],
|
|
234
|
+
options: { duration: 250, easing: "ease" }
|
|
235
|
+
});
|
|
236
|
+
setDefaultAnimation("drawer.hideStart", {
|
|
237
|
+
keyframes: [
|
|
238
|
+
{ opacity: 1, translate: "0" },
|
|
239
|
+
{ opacity: 0, translate: "-100%" }
|
|
240
|
+
],
|
|
241
|
+
rtlKeyframes: [
|
|
242
|
+
{ opacity: 1, translate: "0" },
|
|
243
|
+
{ opacity: 0, translate: "100%" }
|
|
244
|
+
],
|
|
245
|
+
options: { duration: 250, easing: "ease" }
|
|
246
|
+
});
|
|
247
|
+
setDefaultAnimation("drawer.showEnd", {
|
|
248
|
+
keyframes: [
|
|
249
|
+
{ opacity: 0, translate: "100%" },
|
|
250
|
+
{ opacity: 1, translate: "0" }
|
|
251
|
+
],
|
|
252
|
+
rtlKeyframes: [
|
|
253
|
+
{ opacity: 0, translate: "-100%" },
|
|
254
|
+
{ opacity: 1, translate: "0" }
|
|
255
|
+
],
|
|
256
|
+
options: { duration: 250, easing: "ease" }
|
|
257
|
+
});
|
|
258
|
+
setDefaultAnimation("drawer.hideEnd", {
|
|
259
|
+
keyframes: [
|
|
260
|
+
{ opacity: 1, translate: "0" },
|
|
261
|
+
{ opacity: 0, translate: "100%" }
|
|
262
|
+
],
|
|
263
|
+
rtlKeyframes: [
|
|
264
|
+
{ opacity: 1, translate: "0" },
|
|
265
|
+
{ opacity: 0, translate: "-100%" }
|
|
266
|
+
],
|
|
267
|
+
options: { duration: 250, easing: "ease" }
|
|
268
|
+
});
|
|
269
|
+
setDefaultAnimation("drawer.denyClose", {
|
|
270
|
+
keyframes: [{ scale: 1 }, { scale: 1.01 }, { scale: 1 }],
|
|
271
|
+
options: { duration: 250 }
|
|
272
|
+
});
|
|
273
|
+
setDefaultAnimation("drawer.overlay.show", {
|
|
274
|
+
keyframes: [{ opacity: 0 }, { opacity: 1 }],
|
|
275
|
+
options: { duration: 250 }
|
|
276
|
+
});
|
|
277
|
+
setDefaultAnimation("drawer.overlay.hide", {
|
|
278
|
+
keyframes: [{ opacity: 1 }, { opacity: 0 }],
|
|
279
|
+
options: { duration: 250 }
|
|
280
|
+
});
|
|
281
|
+
export {
|
|
282
|
+
SdDrawer as default
|
|
283
|
+
};
|
|
@@ -169,7 +169,7 @@ let SdDropdown = class extends SolidElement {
|
|
|
169
169
|
// that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
|
|
170
170
|
// a child of the slotted element, or an element in the slotted element's shadow root.
|
|
171
171
|
//
|
|
172
|
-
// For example, the accessible trigger of an <sd-1-
|
|
172
|
+
// For example, the accessible trigger of an <sd-1-10-0-button> is a <button> located inside its shadow root.
|
|
173
173
|
//
|
|
174
174
|
// To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
|
|
175
175
|
//
|
|
@@ -179,8 +179,8 @@ let SdDropdown = class extends SolidElement {
|
|
|
179
179
|
let target;
|
|
180
180
|
if (accessibleTrigger) {
|
|
181
181
|
switch (accessibleTrigger.tagName.toLowerCase()) {
|
|
182
|
-
case "sd-1-
|
|
183
|
-
case "sd-1-
|
|
182
|
+
case "sd-1-10-0-button":
|
|
183
|
+
case "sd-1-10-0-icon-button":
|
|
184
184
|
target = accessibleTrigger.button;
|
|
185
185
|
break;
|
|
186
186
|
default:
|
|
@@ -256,11 +256,11 @@ let SdDropdown = class extends SolidElement {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
render() {
|
|
259
|
-
return html`<sd-1-
|
|
259
|
+
return html`<sd-1-10-0-popup part="base" id="dropdown" placement="${this.placement}" distance="${this.rounded && this.distance < 1 ? 1 : this.distance}" skidding="${this.skidding}" strategy="${this.hoist ? "fixed" : "absolute"}" ?flip="${!this.noFlip}" shift auto-size="vertical" auto-size-padding="10" ?active="${this.open}"><slot name="trigger" slot="anchor" part="trigger" class="block" @click="${this.handleTriggerClick}" @keydown="${this.handleTriggerKeyDown}" @keyup="${this.handleTriggerKeyUp}" @slotchange="${this.handleTriggerSlotChange}"></slot><slot part="panel" class="${cx(
|
|
260
260
|
"shadow bg-white",
|
|
261
261
|
this.open ? "block pointer-events-auto" : "pointer-events-none",
|
|
262
262
|
this.rounded && "rounded-md"
|
|
263
|
-
)}" aria-hidden="${this.open ? "false" : "true"}" aria-labelledby="dropdown"></slot></sd-1-
|
|
263
|
+
)}" aria-hidden="${this.open ? "false" : "true"}" aria-labelledby="dropdown"></slot></sd-1-10-0-popup>`;
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
266
|
SdDropdown.styles = [
|
|
@@ -314,7 +314,7 @@ __decorateClass([
|
|
|
314
314
|
watch("open", { waitUntilFirstUpdate: true })
|
|
315
315
|
], SdDropdown.prototype, "handleOpenChange", 1);
|
|
316
316
|
SdDropdown = __decorateClass([
|
|
317
|
-
customElement("sd-1-
|
|
317
|
+
customElement("sd-1-10-0-dropdown")
|
|
318
318
|
], SdDropdown);
|
|
319
319
|
setDefaultAnimation("dropdown.show", {
|
|
320
320
|
keyframes: [
|
|
@@ -8,7 +8,12 @@ const icons = {
|
|
|
8
8
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
9
9
|
<path d="M12.743 6.333c-0.188-0.195-0.452-0.316-0.743-0.316s-0.555 0.121-0.743 0.315l-0 0-9 10c-0.137 0.17-0.22 0.388-0.22 0.626 0 0.552 0.448 1 1 1 0.276 0 0.526-0.112 0.707-0.293v0l8.257-9.173 8.257 9.173c0.181 0.181 0.431 0.292 0.707 0.292 0.552 0 1-0.448 1-1 0-0.238-0.083-0.456-0.222-0.628l0.001 0.002z"></path>
|
|
10
10
|
</svg>
|
|
11
|
-
|
|
11
|
+
`,
|
|
12
|
+
close: `
|
|
13
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
14
|
+
<path d="M21.707 2.293a1 1 0 0 0-1.414 0L12 10.586 3.707 2.293a1 1 0 0 0-1.413 1.414l-.001-.001 8.293 8.293-8.293 8.293a1 1 0 0 0 0 1.414 1 1 0 0 0 1.414 0L12 13.413l8.293 8.293a1 1 0 0 0 1.414 0 1 1 0 0 0 0-1.414l-8.293-8.293 8.293-8.293a1 1 0 0 0 0-1.414z"/></svg>
|
|
15
|
+
</svg>
|
|
16
|
+
`
|
|
12
17
|
};
|
|
13
18
|
const systemLibrary = {
|
|
14
19
|
name: "system",
|
|
@@ -76,7 +76,7 @@ let SdLink = class extends SolidElement {
|
|
|
76
76
|
};
|
|
77
77
|
SdLink.styles = [
|
|
78
78
|
SolidElement.styles,
|
|
79
|
-
css`::slotted(sd-1-
|
|
79
|
+
css`::slotted(sd-1-10-0-icon){font-size:1.25em;margin-bottom:-.25em}:host([size=sm][standalone]) ::slotted(sd-1-10-0-icon){font-size:1rem}:host([size=lg][standalone]) ::slotted(sd-1-10-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-
|
|
103
|
+
customElement("sd-1-10-0-link")
|
|
104
104
|
], SdLink);
|
|
105
105
|
export {
|
|
106
106
|
SdLink as default
|
|
@@ -311,7 +311,7 @@ __decorateClass([
|
|
|
311
311
|
property({ attribute: "auto-size-padding", type: Number })
|
|
312
312
|
], SdPopup.prototype, "autoSizePadding", 2);
|
|
313
313
|
SdPopup = __decorateClass([
|
|
314
|
-
customElement("sd-1-
|
|
314
|
+
customElement("sd-1-10-0-popup")
|
|
315
315
|
], SdPopup);
|
|
316
316
|
export {
|
|
317
317
|
SdPopup as default
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import SolidElement from '../../internal/solid-element';
|
|
2
|
+
export default class SdTag extends SolidElement {
|
|
3
|
+
tag: HTMLButtonElement | HTMLLinkElement;
|
|
4
|
+
size: 'lg' | 'sm';
|
|
5
|
+
selected: boolean;
|
|
6
|
+
removable: boolean;
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
href: string;
|
|
9
|
+
target: '_blank' | '_parent' | '_self' | '_top';
|
|
10
|
+
download?: string;
|
|
11
|
+
private handleBlur;
|
|
12
|
+
private handleFocus;
|
|
13
|
+
private isLink;
|
|
14
|
+
click(): void;
|
|
15
|
+
focus(options?: FocusOptions): void;
|
|
16
|
+
blur(): void;
|
|
17
|
+
render(): import("lit-html").TemplateResult;
|
|
18
|
+
static styles: import("lit").CSSResultGroup[];
|
|
19
|
+
}
|
|
20
|
+
declare global {
|
|
21
|
+
interface HTMLElementTagNameMap {
|
|
22
|
+
'sd-1-10-0-tag': SdTag;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { query, property, customElement } from "lit/decorators.js";
|
|
3
|
+
import { literal, html } from "lit/static-html.js";
|
|
4
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
5
|
+
import cx from "classix";
|
|
6
|
+
import SolidElement from "../../internal/solid-element.js";
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result)
|
|
15
|
+
__defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
let SdTag = class extends SolidElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.size = "lg";
|
|
22
|
+
this.selected = false;
|
|
23
|
+
this.removable = false;
|
|
24
|
+
this.disabled = false;
|
|
25
|
+
this.href = "";
|
|
26
|
+
}
|
|
27
|
+
handleBlur() {
|
|
28
|
+
this.emit("sd-blur");
|
|
29
|
+
}
|
|
30
|
+
handleFocus() {
|
|
31
|
+
this.emit("sd-focus");
|
|
32
|
+
}
|
|
33
|
+
isLink() {
|
|
34
|
+
return this.href ? true : false;
|
|
35
|
+
}
|
|
36
|
+
/** Simulates a click on the tag. */
|
|
37
|
+
click() {
|
|
38
|
+
this.tag.click();
|
|
39
|
+
}
|
|
40
|
+
/** Sets focus on the tag. */
|
|
41
|
+
focus(options) {
|
|
42
|
+
this.tag.focus(options);
|
|
43
|
+
}
|
|
44
|
+
/** Removes focus from the tag. */
|
|
45
|
+
blur() {
|
|
46
|
+
this.tag.blur();
|
|
47
|
+
}
|
|
48
|
+
render() {
|
|
49
|
+
const isLink = this.isLink();
|
|
50
|
+
const tag = isLink ? literal`a` : literal`button`;
|
|
51
|
+
return html`<${tag} part="base" type="${ifDefined(isLink ? void 0 : "button")}" href="${ifDefined(isLink ? this.href : void 0)}" rel="${ifDefined(isLink && this.target ? "noreferrer noopener" : void 0)}" target="${ifDefined(isLink ? this.target : void 0)}" download="${ifDefined(isLink ? this.download : void 0)}" ?disabled="${ifDefined(isLink ? void 0 : this.disabled)}" aria-disabled="${this.disabled ? "true" : "false"}" tabindex="${this.disabled ? "-1" : "0"}" @blur="${this.handleBlur}" @focus="${this.handleFocus}" class="${cx(
|
|
52
|
+
/* basic styles of the wrapper */
|
|
53
|
+
"inline-flex border box-border rounded-full items-center leading-none whitespace-nowrap focus-visible:focus-outline",
|
|
54
|
+
{
|
|
55
|
+
/* sizes, fonts */
|
|
56
|
+
lg: "h-8 text-base gap-2",
|
|
57
|
+
sm: "h-6 text-sm gap-1"
|
|
58
|
+
}[this.size],
|
|
59
|
+
{
|
|
60
|
+
/* padding */
|
|
61
|
+
lg: !this.removable ? "px-4 py-2" : "pl-4 pr-3 py-2",
|
|
62
|
+
sm: !this.removable ? "px-3 py-[5px]" : "pl-3 pr-2 py-2"
|
|
63
|
+
}[this.size],
|
|
64
|
+
/* colors */
|
|
65
|
+
!this.selected ? "border-primary text-primary hover:border-primary-500 hover:bg-neutral-100 hover:text-primary-500 disabled:border-neutral-500 disabled:text-neutral-500" : "bg-primary border-primary text-white hover:bg-primary-500 hover:border-primary-500 disabled:bg-neutral-500 disabled:border-neutral-500",
|
|
66
|
+
this.disabled && !isLink && "cursor-not-allowed"
|
|
67
|
+
)}"><slot part="content"></slot><slot part="removable-indicator" name="removable-indicator" class="${cx(
|
|
68
|
+
!this.removable && "hidden",
|
|
69
|
+
{
|
|
70
|
+
/* sizes, fonts */
|
|
71
|
+
lg: "text-base",
|
|
72
|
+
sm: "text-[12px]"
|
|
73
|
+
}[this.size]
|
|
74
|
+
)}"><sd-1-10-0-icon library="system" name="close" label="remove"></sd-1-10-0-icon></slot></${tag}>`;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
SdTag.styles = [
|
|
78
|
+
SolidElement.styles,
|
|
79
|
+
css`:host{display:inline-block}`
|
|
80
|
+
];
|
|
81
|
+
__decorateClass([
|
|
82
|
+
query("a, button")
|
|
83
|
+
], SdTag.prototype, "tag", 2);
|
|
84
|
+
__decorateClass([
|
|
85
|
+
property({ reflect: true })
|
|
86
|
+
], SdTag.prototype, "size", 2);
|
|
87
|
+
__decorateClass([
|
|
88
|
+
property({ type: Boolean, reflect: true })
|
|
89
|
+
], SdTag.prototype, "selected", 2);
|
|
90
|
+
__decorateClass([
|
|
91
|
+
property({ type: Boolean, reflect: true })
|
|
92
|
+
], SdTag.prototype, "removable", 2);
|
|
93
|
+
__decorateClass([
|
|
94
|
+
property({ type: Boolean, reflect: true })
|
|
95
|
+
], SdTag.prototype, "disabled", 2);
|
|
96
|
+
__decorateClass([
|
|
97
|
+
property()
|
|
98
|
+
], SdTag.prototype, "href", 2);
|
|
99
|
+
__decorateClass([
|
|
100
|
+
property()
|
|
101
|
+
], SdTag.prototype, "target", 2);
|
|
102
|
+
__decorateClass([
|
|
103
|
+
property()
|
|
104
|
+
], SdTag.prototype, "download", 2);
|
|
105
|
+
SdTag = __decorateClass([
|
|
106
|
+
customElement("sd-1-10-0-tag")
|
|
107
|
+
], SdTag);
|
|
108
|
+
export {
|
|
109
|
+
SdTag as default
|
|
110
|
+
};
|
|
@@ -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-
|
|
93
|
+
const isButton = this.host.tagName.toLowerCase() === "sd-1-10-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) => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default class Modal {
|
|
2
|
+
element: HTMLElement;
|
|
3
|
+
tabDirection: 'forward' | 'backward';
|
|
4
|
+
constructor(element: HTMLElement);
|
|
5
|
+
activate(): void;
|
|
6
|
+
deactivate(): void;
|
|
7
|
+
isActive(): boolean;
|
|
8
|
+
checkFocus(): void;
|
|
9
|
+
handleFocusIn(): void;
|
|
10
|
+
handleKeyDown(event: KeyboardEvent): void;
|
|
11
|
+
handleKeyUp(): void;
|
|
12
|
+
}
|