@synergy-design-system/components 0.1.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/README.md +14 -0
- package/dist/chunks/chunk.2A3352EO.js +10 -0
- package/dist/chunks/chunk.2CFEYJLE.js +29 -0
- package/dist/chunks/chunk.2DA7CIOQ.js +44 -0
- package/dist/chunks/chunk.4NMNW5OM.js +22 -0
- package/dist/chunks/chunk.7XI5LKCC.js +14 -0
- package/dist/chunks/chunk.HQUF2ZAX.js +62 -0
- package/dist/chunks/chunk.HSF5YXAS.js +294 -0
- package/dist/chunks/chunk.KHU4AFPL.js +11 -0
- package/dist/chunks/chunk.MAS2SHYD.js +41 -0
- package/dist/chunks/chunk.NBKDLFEY.js +201 -0
- package/dist/chunks/chunk.O3LUPMYG.js +372 -0
- package/dist/chunks/chunk.PM7NIY3M.js +35 -0
- package/dist/chunks/chunk.Q5SD5LHE.js +607 -0
- package/dist/chunks/chunk.QPNUJNT5.js +70 -0
- package/dist/chunks/chunk.SVIWEI6P.js +27 -0
- package/dist/chunks/chunk.VRTJZYIC.js +127 -0
- package/dist/chunks/chunk.XVEDHRRP.js +500 -0
- package/dist/chunks/chunk.Y5USHY74.js +31 -0
- package/dist/chunks/chunk.Z6AW3P62.js +317 -0
- package/dist/components/button/button.component.d.ts +132 -0
- package/dist/components/button/button.component.js +21 -0
- package/dist/components/button/button.d.ts +8 -0
- package/dist/components/button/button.js +25 -0
- package/dist/components/button/button.styles.d.ts +2 -0
- package/dist/components/button/button.styles.js +8 -0
- package/dist/components/icon/icon.component.d.ts +42 -0
- package/dist/components/icon/icon.component.js +14 -0
- package/dist/components/icon/icon.d.ts +8 -0
- package/dist/components/icon/icon.js +18 -0
- package/dist/components/icon/icon.styles.d.ts +2 -0
- package/dist/components/icon/icon.styles.js +8 -0
- package/dist/components/icon/library.d.ts +19 -0
- package/dist/components/icon/library.default.d.ts +3 -0
- package/dist/components/icon/library.default.js +8 -0
- package/dist/components/icon/library.js +18 -0
- package/dist/components/icon/library.system.d.ts +3 -0
- package/dist/components/icon/library.system.js +7 -0
- package/dist/components/input/input.component.d.ts +179 -0
- package/dist/components/input/input.component.js +19 -0
- package/dist/components/input/input.d.ts +8 -0
- package/dist/components/input/input.js +20 -0
- package/dist/components/input/input.styles.d.ts +2 -0
- package/dist/components/input/input.styles.js +8 -0
- package/dist/components/spinner/spinner.component.d.ts +20 -0
- package/dist/components/spinner/spinner.component.js +12 -0
- package/dist/components/spinner/spinner.styles.d.ts +2 -0
- package/dist/components/spinner/spinner.styles.js +8 -0
- package/dist/custom-elements.json +1967 -0
- package/dist/events/events.d.ts +8 -0
- package/dist/events/syn-blur.d.ts +6 -0
- package/dist/events/syn-change.d.ts +6 -0
- package/dist/events/syn-clear.d.ts +6 -0
- package/dist/events/syn-error.d.ts +8 -0
- package/dist/events/syn-focus.d.ts +6 -0
- package/dist/events/syn-input.d.ts +6 -0
- package/dist/events/syn-invalid.d.ts +6 -0
- package/dist/events/syn-load.d.ts +6 -0
- package/dist/internal/default-value.d.ts +2 -0
- package/dist/internal/form.d.ts +73 -0
- package/dist/internal/slot.d.ts +23 -0
- package/dist/internal/synergy-element.d.ts +47 -0
- package/dist/internal/test/form-control-base-tests.d.ts +7 -0
- package/dist/internal/watch.d.ts +26 -0
- package/dist/styles/component.styles.d.ts +2 -0
- package/dist/styles/form-control.styles.d.ts +2 -0
- package/dist/synergy-autoloader.d.ts +4 -0
- package/dist/synergy-autoloader.js +40 -0
- package/dist/synergy.d.ts +2 -0
- package/dist/synergy.js +20 -0
- package/dist/translations/de.d.ts +3 -0
- package/dist/translations/de.js +45 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +7 -0
- package/dist/utilities/base-path.d.ts +18 -0
- package/dist/utilities/base-path.js +9 -0
- package/dist/utilities/localize.d.ts +33 -0
- package/dist/utilities/localize.js +10 -0
- package/dist/vscode.html-custom-data.json +400 -0
- package/dist/web-types.json +790 -0
- package/package.json +131 -0
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @synergy-design-system/components
|
|
2
|
+
|
|
3
|
+
Synergy Web Component library based on [shoelace](https://shoelace.style/).
|
|
4
|
+
|
|
5
|
+
## Local setup
|
|
6
|
+
### Using the vendor cli
|
|
7
|
+
The vendor cli is taking care about updating our code base according to a new version of shoelace.
|
|
8
|
+
|
|
9
|
+
To change the shoelace version, that should be downloaded, change the version in the config of `./scripts/vendorism.js`.
|
|
10
|
+
To download it use the command `pnpm vendor.get`.
|
|
11
|
+
If code in our components library should be updated to this new shoelace version use `pnpm vendor.set`.
|
|
12
|
+
|
|
13
|
+
All shoelace files are per default readonly and are disabled from being changed. To change this files can be ejected. This can be done via:
|
|
14
|
+
`pnpm vendor.eject "src/declaration.d.ts"`.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/utilities/localize.ts
|
|
2
|
+
import { LocalizeController as DefaultLocalizationController } from "@shoelace-style/localize";
|
|
3
|
+
import { registerTranslation } from "@shoelace-style/localize";
|
|
4
|
+
var LocalizeController = class extends DefaultLocalizationController {
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
LocalizeController,
|
|
9
|
+
registerTranslation
|
|
10
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// src/utilities/base-path.ts
|
|
2
|
+
var basePath = "";
|
|
3
|
+
function setBasePath(path) {
|
|
4
|
+
basePath = path;
|
|
5
|
+
}
|
|
6
|
+
function getBasePath(subpath = "") {
|
|
7
|
+
if (!basePath) {
|
|
8
|
+
const scripts = [...document.getElementsByTagName("script")];
|
|
9
|
+
const configScript = scripts.find((script) => script.hasAttribute("data-synergy"));
|
|
10
|
+
if (configScript) {
|
|
11
|
+
setBasePath(configScript.getAttribute("data-synergy"));
|
|
12
|
+
} else {
|
|
13
|
+
const fallbackScript = scripts.find((s) => {
|
|
14
|
+
return /synergy(\.min)?\.js($|\?)/.test(s.src) || /synergy-autoloader(\.min)?\.js($|\?)/.test(s.src);
|
|
15
|
+
});
|
|
16
|
+
let path = "";
|
|
17
|
+
if (fallbackScript) {
|
|
18
|
+
path = fallbackScript.getAttribute("src");
|
|
19
|
+
}
|
|
20
|
+
setBasePath(path.split("/").slice(0, -1).join("/"));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return basePath.replace(/\/$/, "") + (subpath ? `/${subpath.replace(/^\//, "")}` : ``);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
setBasePath,
|
|
28
|
+
getBasePath
|
|
29
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
library_default_default
|
|
3
|
+
} from "./chunk.7XI5LKCC.js";
|
|
4
|
+
import {
|
|
5
|
+
library_system_default
|
|
6
|
+
} from "./chunk.VRTJZYIC.js";
|
|
7
|
+
|
|
8
|
+
// src/components/icon/library.ts
|
|
9
|
+
var registry = [library_default_default, library_system_default];
|
|
10
|
+
var watchedIcons = [];
|
|
11
|
+
function watchIcon(icon) {
|
|
12
|
+
watchedIcons.push(icon);
|
|
13
|
+
}
|
|
14
|
+
function unwatchIcon(icon) {
|
|
15
|
+
watchedIcons = watchedIcons.filter((el) => el !== icon);
|
|
16
|
+
}
|
|
17
|
+
function getIconLibrary(name) {
|
|
18
|
+
return registry.find((lib) => lib.name === name);
|
|
19
|
+
}
|
|
20
|
+
function registerIconLibrary(name, options) {
|
|
21
|
+
unregisterIconLibrary(name);
|
|
22
|
+
registry.push({
|
|
23
|
+
name,
|
|
24
|
+
resolver: options.resolver,
|
|
25
|
+
mutator: options.mutator,
|
|
26
|
+
spriteSheet: options.spriteSheet
|
|
27
|
+
});
|
|
28
|
+
watchedIcons.forEach((icon) => {
|
|
29
|
+
if (icon.library === name) {
|
|
30
|
+
icon.setIcon();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function unregisterIconLibrary(name) {
|
|
35
|
+
registry = registry.filter((lib) => lib.name !== name);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
watchIcon,
|
|
40
|
+
unwatchIcon,
|
|
41
|
+
getIconLibrary,
|
|
42
|
+
registerIconLibrary,
|
|
43
|
+
unregisterIconLibrary
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/styles/component.styles.ts
|
|
2
|
+
import { css } from "lit";
|
|
3
|
+
var component_styles_default = css`
|
|
4
|
+
/* stylelint-disable */
|
|
5
|
+
:host {
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host *,
|
|
10
|
+
:host *::before,
|
|
11
|
+
:host *::after {
|
|
12
|
+
box-sizing: inherit;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[hidden] {
|
|
16
|
+
display: none !important;
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
component_styles_default
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getBasePath
|
|
3
|
+
} from "./chunk.2CFEYJLE.js";
|
|
4
|
+
|
|
5
|
+
// src/components/icon/library.default.ts
|
|
6
|
+
var library = {
|
|
7
|
+
name: "default",
|
|
8
|
+
resolver: (name) => getBasePath(`assets/icons/${name}.svg`)
|
|
9
|
+
};
|
|
10
|
+
var library_default_default = library;
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
library_default_default
|
|
14
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass,
|
|
3
|
+
__spreadValues
|
|
4
|
+
} from "./chunk.PM7NIY3M.js";
|
|
5
|
+
|
|
6
|
+
// src/internal/synergy-element.ts
|
|
7
|
+
import { LitElement } from "lit";
|
|
8
|
+
import { property } from "lit/decorators.js";
|
|
9
|
+
var SynergyElement = class extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
Object.entries(this.constructor.dependencies).forEach(([name, component]) => {
|
|
13
|
+
this.constructor.define(name, component);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
emit(name, options) {
|
|
17
|
+
const event = new CustomEvent(name, __spreadValues({
|
|
18
|
+
bubbles: true,
|
|
19
|
+
cancelable: false,
|
|
20
|
+
composed: true,
|
|
21
|
+
detail: {}
|
|
22
|
+
}, options));
|
|
23
|
+
this.dispatchEvent(event);
|
|
24
|
+
return event;
|
|
25
|
+
}
|
|
26
|
+
static define(name, elementConstructor = this, options = {}) {
|
|
27
|
+
const currentlyRegisteredConstructor = customElements.get(name);
|
|
28
|
+
if (!currentlyRegisteredConstructor) {
|
|
29
|
+
customElements.define(name, class extends elementConstructor {
|
|
30
|
+
}, options);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
let newVersion = " (unknown version)";
|
|
34
|
+
let existingVersion = newVersion;
|
|
35
|
+
if ("version" in elementConstructor && elementConstructor.version) {
|
|
36
|
+
newVersion = " v" + elementConstructor.version;
|
|
37
|
+
}
|
|
38
|
+
if ("version" in currentlyRegisteredConstructor && currentlyRegisteredConstructor.version) {
|
|
39
|
+
existingVersion = " v" + currentlyRegisteredConstructor.version;
|
|
40
|
+
}
|
|
41
|
+
if (newVersion && existingVersion && newVersion === existingVersion) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
console.warn(
|
|
45
|
+
`Attempted to register <${name}>${newVersion}, but <${name}>${existingVersion} has already been registered.`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
/* eslint-disable */
|
|
50
|
+
// @ts-expect-error This is auto-injected at build time.
|
|
51
|
+
SynergyElement.version = "0.1.0";
|
|
52
|
+
SynergyElement.dependencies = {};
|
|
53
|
+
__decorateClass([
|
|
54
|
+
property()
|
|
55
|
+
], SynergyElement.prototype, "dir", 2);
|
|
56
|
+
__decorateClass([
|
|
57
|
+
property()
|
|
58
|
+
], SynergyElement.prototype, "lang", 2);
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
SynergyElement
|
|
62
|
+
};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import {
|
|
2
|
+
button_styles_default
|
|
3
|
+
} from "./chunk.Q5SD5LHE.js";
|
|
4
|
+
import {
|
|
5
|
+
SynSpinner
|
|
6
|
+
} from "./chunk.Y5USHY74.js";
|
|
7
|
+
import {
|
|
8
|
+
FormControlController,
|
|
9
|
+
HasSlotController,
|
|
10
|
+
validValidityState
|
|
11
|
+
} from "./chunk.Z6AW3P62.js";
|
|
12
|
+
import {
|
|
13
|
+
SynIcon,
|
|
14
|
+
watch
|
|
15
|
+
} from "./chunk.NBKDLFEY.js";
|
|
16
|
+
import {
|
|
17
|
+
LocalizeController
|
|
18
|
+
} from "./chunk.2A3352EO.js";
|
|
19
|
+
import {
|
|
20
|
+
SynergyElement
|
|
21
|
+
} from "./chunk.HQUF2ZAX.js";
|
|
22
|
+
import {
|
|
23
|
+
__decorateClass
|
|
24
|
+
} from "./chunk.PM7NIY3M.js";
|
|
25
|
+
|
|
26
|
+
// src/components/button/button.component.ts
|
|
27
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
28
|
+
import { html, literal } from "lit/static-html.js";
|
|
29
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
30
|
+
import { property, query, state } from "lit/decorators.js";
|
|
31
|
+
var SynButton = class extends SynergyElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.formControlController = new FormControlController(this, {
|
|
35
|
+
form: (input) => {
|
|
36
|
+
if (input.hasAttribute("form")) {
|
|
37
|
+
const doc = input.getRootNode();
|
|
38
|
+
const formId = input.getAttribute("form");
|
|
39
|
+
return doc.getElementById(formId);
|
|
40
|
+
}
|
|
41
|
+
return input.closest("form");
|
|
42
|
+
},
|
|
43
|
+
assumeInteractionOn: ["click"]
|
|
44
|
+
});
|
|
45
|
+
this.hasSlotController = new HasSlotController(this, "[default]", "prefix", "suffix");
|
|
46
|
+
this.localize = new LocalizeController(this);
|
|
47
|
+
this.hasFocus = false;
|
|
48
|
+
this.invalid = false;
|
|
49
|
+
this.title = "";
|
|
50
|
+
this.variant = "default";
|
|
51
|
+
this.size = "medium";
|
|
52
|
+
this.caret = false;
|
|
53
|
+
this.disabled = false;
|
|
54
|
+
this.loading = false;
|
|
55
|
+
this.outline = false;
|
|
56
|
+
this.pill = false;
|
|
57
|
+
this.circle = false;
|
|
58
|
+
this.type = "button";
|
|
59
|
+
this.name = "";
|
|
60
|
+
this.value = "";
|
|
61
|
+
this.href = "";
|
|
62
|
+
this.rel = "noreferrer noopener";
|
|
63
|
+
}
|
|
64
|
+
/** Gets the validity state object */
|
|
65
|
+
get validity() {
|
|
66
|
+
if (this.isButton()) {
|
|
67
|
+
return this.button.validity;
|
|
68
|
+
}
|
|
69
|
+
return validValidityState;
|
|
70
|
+
}
|
|
71
|
+
/** Gets the validation message */
|
|
72
|
+
get validationMessage() {
|
|
73
|
+
if (this.isButton()) {
|
|
74
|
+
return this.button.validationMessage;
|
|
75
|
+
}
|
|
76
|
+
return "";
|
|
77
|
+
}
|
|
78
|
+
firstUpdated() {
|
|
79
|
+
if (this.isButton()) {
|
|
80
|
+
this.formControlController.updateValidity();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
handleBlur() {
|
|
84
|
+
this.hasFocus = false;
|
|
85
|
+
this.emit("syn-blur");
|
|
86
|
+
}
|
|
87
|
+
handleFocus() {
|
|
88
|
+
this.hasFocus = true;
|
|
89
|
+
this.emit("syn-focus");
|
|
90
|
+
}
|
|
91
|
+
handleClick() {
|
|
92
|
+
if (this.type === "submit") {
|
|
93
|
+
this.formControlController.submit(this);
|
|
94
|
+
}
|
|
95
|
+
if (this.type === "reset") {
|
|
96
|
+
this.formControlController.reset(this);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
handleInvalid(event) {
|
|
100
|
+
this.formControlController.setValidity(false);
|
|
101
|
+
this.formControlController.emitInvalidEvent(event);
|
|
102
|
+
}
|
|
103
|
+
isButton() {
|
|
104
|
+
return this.href ? false : true;
|
|
105
|
+
}
|
|
106
|
+
isLink() {
|
|
107
|
+
return this.href ? true : false;
|
|
108
|
+
}
|
|
109
|
+
handleDisabledChange() {
|
|
110
|
+
if (this.isButton()) {
|
|
111
|
+
this.formControlController.setValidity(this.disabled);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/** Simulates a click on the button. */
|
|
115
|
+
click() {
|
|
116
|
+
this.button.click();
|
|
117
|
+
}
|
|
118
|
+
/** Sets focus on the button. */
|
|
119
|
+
focus(options) {
|
|
120
|
+
this.button.focus(options);
|
|
121
|
+
}
|
|
122
|
+
/** Removes focus from the button. */
|
|
123
|
+
blur() {
|
|
124
|
+
this.button.blur();
|
|
125
|
+
}
|
|
126
|
+
/** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
|
|
127
|
+
checkValidity() {
|
|
128
|
+
if (this.isButton()) {
|
|
129
|
+
return this.button.checkValidity();
|
|
130
|
+
}
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
/** Gets the associated form, if one exists. */
|
|
134
|
+
getForm() {
|
|
135
|
+
return this.formControlController.getForm();
|
|
136
|
+
}
|
|
137
|
+
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
|
138
|
+
reportValidity() {
|
|
139
|
+
if (this.isButton()) {
|
|
140
|
+
return this.button.reportValidity();
|
|
141
|
+
}
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
|
145
|
+
setCustomValidity(message) {
|
|
146
|
+
if (this.isButton()) {
|
|
147
|
+
this.button.setCustomValidity(message);
|
|
148
|
+
this.formControlController.updateValidity();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
render() {
|
|
152
|
+
const isLink = this.isLink();
|
|
153
|
+
const tag = isLink ? literal`a` : literal`button`;
|
|
154
|
+
return html`
|
|
155
|
+
<${tag}
|
|
156
|
+
part="base"
|
|
157
|
+
class=${classMap({
|
|
158
|
+
button: true,
|
|
159
|
+
"button--default": this.variant === "default",
|
|
160
|
+
"button--primary": this.variant === "primary",
|
|
161
|
+
"button--success": this.variant === "success",
|
|
162
|
+
"button--neutral": this.variant === "neutral",
|
|
163
|
+
"button--warning": this.variant === "warning",
|
|
164
|
+
"button--danger": this.variant === "danger",
|
|
165
|
+
"button--text": this.variant === "text",
|
|
166
|
+
"button--small": this.size === "small",
|
|
167
|
+
"button--medium": this.size === "medium",
|
|
168
|
+
"button--large": this.size === "large",
|
|
169
|
+
"button--caret": this.caret,
|
|
170
|
+
"button--circle": this.circle,
|
|
171
|
+
"button--disabled": this.disabled,
|
|
172
|
+
"button--focused": this.hasFocus,
|
|
173
|
+
"button--loading": this.loading,
|
|
174
|
+
"button--standard": !this.outline,
|
|
175
|
+
"button--outline": this.outline,
|
|
176
|
+
"button--pill": this.pill,
|
|
177
|
+
"button--rtl": this.localize.dir() === "rtl",
|
|
178
|
+
"button--has-label": this.hasSlotController.test("[default]"),
|
|
179
|
+
"button--has-prefix": this.hasSlotController.test("prefix"),
|
|
180
|
+
"button--has-suffix": this.hasSlotController.test("suffix")
|
|
181
|
+
})}
|
|
182
|
+
?disabled=${ifDefined(isLink ? void 0 : this.disabled)}
|
|
183
|
+
type=${ifDefined(isLink ? void 0 : this.type)}
|
|
184
|
+
title=${this.title}
|
|
185
|
+
name=${ifDefined(isLink ? void 0 : this.name)}
|
|
186
|
+
value=${ifDefined(isLink ? void 0 : this.value)}
|
|
187
|
+
href=${ifDefined(isLink ? this.href : void 0)}
|
|
188
|
+
target=${ifDefined(isLink ? this.target : void 0)}
|
|
189
|
+
download=${ifDefined(isLink ? this.download : void 0)}
|
|
190
|
+
rel=${ifDefined(isLink ? this.rel : void 0)}
|
|
191
|
+
role=${ifDefined(isLink ? void 0 : "button")}
|
|
192
|
+
aria-disabled=${this.disabled ? "true" : "false"}
|
|
193
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
194
|
+
@blur=${this.handleBlur}
|
|
195
|
+
@focus=${this.handleFocus}
|
|
196
|
+
@invalid=${this.isButton() ? this.handleInvalid : null}
|
|
197
|
+
@click=${this.handleClick}
|
|
198
|
+
>
|
|
199
|
+
<slot name="prefix" part="prefix" class="button__prefix"></slot>
|
|
200
|
+
<slot part="label" class="button__label"></slot>
|
|
201
|
+
<slot name="suffix" part="suffix" class="button__suffix"></slot>
|
|
202
|
+
${this.caret ? html` <syn-icon part="caret" class="button__caret" library="system" name="caret"></syn-icon> ` : ""}
|
|
203
|
+
${this.loading ? html`<syn-spinner part="spinner"></syn-spinner>` : ""}
|
|
204
|
+
</${tag}>
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
SynButton.styles = button_styles_default;
|
|
209
|
+
SynButton.dependencies = {
|
|
210
|
+
"syn-icon": SynIcon,
|
|
211
|
+
"syn-spinner": SynSpinner
|
|
212
|
+
};
|
|
213
|
+
__decorateClass([
|
|
214
|
+
query(".button")
|
|
215
|
+
], SynButton.prototype, "button", 2);
|
|
216
|
+
__decorateClass([
|
|
217
|
+
state()
|
|
218
|
+
], SynButton.prototype, "hasFocus", 2);
|
|
219
|
+
__decorateClass([
|
|
220
|
+
state()
|
|
221
|
+
], SynButton.prototype, "invalid", 2);
|
|
222
|
+
__decorateClass([
|
|
223
|
+
property()
|
|
224
|
+
], SynButton.prototype, "title", 2);
|
|
225
|
+
__decorateClass([
|
|
226
|
+
property({ reflect: true })
|
|
227
|
+
], SynButton.prototype, "variant", 2);
|
|
228
|
+
__decorateClass([
|
|
229
|
+
property({ reflect: true })
|
|
230
|
+
], SynButton.prototype, "size", 2);
|
|
231
|
+
__decorateClass([
|
|
232
|
+
property({ type: Boolean, reflect: true })
|
|
233
|
+
], SynButton.prototype, "caret", 2);
|
|
234
|
+
__decorateClass([
|
|
235
|
+
property({ type: Boolean, reflect: true })
|
|
236
|
+
], SynButton.prototype, "disabled", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
property({ type: Boolean, reflect: true })
|
|
239
|
+
], SynButton.prototype, "loading", 2);
|
|
240
|
+
__decorateClass([
|
|
241
|
+
property({ type: Boolean, reflect: true })
|
|
242
|
+
], SynButton.prototype, "outline", 2);
|
|
243
|
+
__decorateClass([
|
|
244
|
+
property({ type: Boolean, reflect: true })
|
|
245
|
+
], SynButton.prototype, "pill", 2);
|
|
246
|
+
__decorateClass([
|
|
247
|
+
property({ type: Boolean, reflect: true })
|
|
248
|
+
], SynButton.prototype, "circle", 2);
|
|
249
|
+
__decorateClass([
|
|
250
|
+
property()
|
|
251
|
+
], SynButton.prototype, "type", 2);
|
|
252
|
+
__decorateClass([
|
|
253
|
+
property()
|
|
254
|
+
], SynButton.prototype, "name", 2);
|
|
255
|
+
__decorateClass([
|
|
256
|
+
property()
|
|
257
|
+
], SynButton.prototype, "value", 2);
|
|
258
|
+
__decorateClass([
|
|
259
|
+
property()
|
|
260
|
+
], SynButton.prototype, "href", 2);
|
|
261
|
+
__decorateClass([
|
|
262
|
+
property()
|
|
263
|
+
], SynButton.prototype, "target", 2);
|
|
264
|
+
__decorateClass([
|
|
265
|
+
property()
|
|
266
|
+
], SynButton.prototype, "rel", 2);
|
|
267
|
+
__decorateClass([
|
|
268
|
+
property()
|
|
269
|
+
], SynButton.prototype, "download", 2);
|
|
270
|
+
__decorateClass([
|
|
271
|
+
property()
|
|
272
|
+
], SynButton.prototype, "form", 2);
|
|
273
|
+
__decorateClass([
|
|
274
|
+
property({ attribute: "formaction" })
|
|
275
|
+
], SynButton.prototype, "formAction", 2);
|
|
276
|
+
__decorateClass([
|
|
277
|
+
property({ attribute: "formenctype" })
|
|
278
|
+
], SynButton.prototype, "formEnctype", 2);
|
|
279
|
+
__decorateClass([
|
|
280
|
+
property({ attribute: "formmethod" })
|
|
281
|
+
], SynButton.prototype, "formMethod", 2);
|
|
282
|
+
__decorateClass([
|
|
283
|
+
property({ attribute: "formnovalidate", type: Boolean })
|
|
284
|
+
], SynButton.prototype, "formNoValidate", 2);
|
|
285
|
+
__decorateClass([
|
|
286
|
+
property({ attribute: "formtarget" })
|
|
287
|
+
], SynButton.prototype, "formTarget", 2);
|
|
288
|
+
__decorateClass([
|
|
289
|
+
watch("disabled", { waitUntilFirstUpdate: true })
|
|
290
|
+
], SynButton.prototype, "handleDisabledChange", 1);
|
|
291
|
+
|
|
292
|
+
export {
|
|
293
|
+
SynButton
|
|
294
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/translations/en.ts
|
|
2
|
+
import { registerTranslation } from "@shoelace-style/localize";
|
|
3
|
+
var translation = {
|
|
4
|
+
$code: "en",
|
|
5
|
+
$name: "English",
|
|
6
|
+
$dir: "ltr",
|
|
7
|
+
carousel: "Carousel",
|
|
8
|
+
clearEntry: "Clear entry",
|
|
9
|
+
close: "Close",
|
|
10
|
+
copied: "Copied",
|
|
11
|
+
copy: "Copy",
|
|
12
|
+
currentValue: "Current value",
|
|
13
|
+
error: "Error",
|
|
14
|
+
goToSlide: (slide, count) => `Go to slide ${slide} of ${count}`,
|
|
15
|
+
hidePassword: "Hide password",
|
|
16
|
+
loading: "Loading",
|
|
17
|
+
nextSlide: "Next slide",
|
|
18
|
+
numOptionsSelected: (num) => {
|
|
19
|
+
if (num === 0)
|
|
20
|
+
return "No options selected";
|
|
21
|
+
if (num === 1)
|
|
22
|
+
return "1 option selected";
|
|
23
|
+
return `${num} options selected`;
|
|
24
|
+
},
|
|
25
|
+
previousSlide: "Previous slide",
|
|
26
|
+
progress: "Progress",
|
|
27
|
+
remove: "Remove",
|
|
28
|
+
resize: "Resize",
|
|
29
|
+
scrollToEnd: "Scroll to end",
|
|
30
|
+
scrollToStart: "Scroll to start",
|
|
31
|
+
selectAColorFromTheScreen: "Select a color from the screen",
|
|
32
|
+
showPassword: "Show password",
|
|
33
|
+
slideNum: (slide) => `Slide ${slide}`,
|
|
34
|
+
toggleColorFormat: "Toggle color format"
|
|
35
|
+
};
|
|
36
|
+
registerTranslation(translation);
|
|
37
|
+
var en_default = translation;
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
en_default
|
|
41
|
+
};
|