@synergy-design-system/components 0.1.0 → 1.0.0-main.2
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/package.json +29 -10
- package/dist/chunks/chunk.2A3352EO.js +0 -10
- package/dist/chunks/chunk.2CFEYJLE.js +0 -29
- package/dist/chunks/chunk.2DA7CIOQ.js +0 -44
- package/dist/chunks/chunk.4NMNW5OM.js +0 -22
- package/dist/chunks/chunk.7XI5LKCC.js +0 -14
- package/dist/chunks/chunk.HQUF2ZAX.js +0 -62
- package/dist/chunks/chunk.HSF5YXAS.js +0 -294
- package/dist/chunks/chunk.KHU4AFPL.js +0 -11
- package/dist/chunks/chunk.MAS2SHYD.js +0 -41
- package/dist/chunks/chunk.NBKDLFEY.js +0 -201
- package/dist/chunks/chunk.O3LUPMYG.js +0 -372
- package/dist/chunks/chunk.PM7NIY3M.js +0 -35
- package/dist/chunks/chunk.Q5SD5LHE.js +0 -607
- package/dist/chunks/chunk.QPNUJNT5.js +0 -70
- package/dist/chunks/chunk.SVIWEI6P.js +0 -27
- package/dist/chunks/chunk.VRTJZYIC.js +0 -127
- package/dist/chunks/chunk.XVEDHRRP.js +0 -500
- package/dist/chunks/chunk.Y5USHY74.js +0 -31
- package/dist/chunks/chunk.Z6AW3P62.js +0 -317
- package/dist/components/button/button.component.d.ts +0 -132
- package/dist/components/button/button.component.js +0 -21
- package/dist/components/button/button.d.ts +0 -8
- package/dist/components/button/button.js +0 -25
- package/dist/components/button/button.styles.d.ts +0 -2
- package/dist/components/button/button.styles.js +0 -8
- package/dist/components/icon/icon.component.d.ts +0 -42
- package/dist/components/icon/icon.component.js +0 -14
- package/dist/components/icon/icon.d.ts +0 -8
- package/dist/components/icon/icon.js +0 -18
- package/dist/components/icon/icon.styles.d.ts +0 -2
- package/dist/components/icon/icon.styles.js +0 -8
- package/dist/components/icon/library.d.ts +0 -19
- package/dist/components/icon/library.default.d.ts +0 -3
- package/dist/components/icon/library.default.js +0 -8
- package/dist/components/icon/library.js +0 -18
- package/dist/components/icon/library.system.d.ts +0 -3
- package/dist/components/icon/library.system.js +0 -7
- package/dist/components/input/input.component.d.ts +0 -179
- package/dist/components/input/input.component.js +0 -19
- package/dist/components/input/input.d.ts +0 -8
- package/dist/components/input/input.js +0 -20
- package/dist/components/input/input.styles.d.ts +0 -2
- package/dist/components/input/input.styles.js +0 -8
- package/dist/components/spinner/spinner.component.d.ts +0 -20
- package/dist/components/spinner/spinner.component.js +0 -12
- package/dist/components/spinner/spinner.styles.d.ts +0 -2
- package/dist/components/spinner/spinner.styles.js +0 -8
- package/dist/custom-elements.json +0 -1967
- package/dist/events/events.d.ts +0 -8
- package/dist/events/syn-blur.d.ts +0 -6
- package/dist/events/syn-change.d.ts +0 -6
- package/dist/events/syn-clear.d.ts +0 -6
- package/dist/events/syn-error.d.ts +0 -8
- package/dist/events/syn-focus.d.ts +0 -6
- package/dist/events/syn-input.d.ts +0 -6
- package/dist/events/syn-invalid.d.ts +0 -6
- package/dist/events/syn-load.d.ts +0 -6
- package/dist/internal/default-value.d.ts +0 -2
- package/dist/internal/form.d.ts +0 -73
- package/dist/internal/slot.d.ts +0 -23
- package/dist/internal/synergy-element.d.ts +0 -47
- package/dist/internal/test/form-control-base-tests.d.ts +0 -7
- package/dist/internal/watch.d.ts +0 -26
- package/dist/styles/component.styles.d.ts +0 -2
- package/dist/styles/form-control.styles.d.ts +0 -2
- package/dist/synergy-autoloader.d.ts +0 -4
- package/dist/synergy-autoloader.js +0 -40
- package/dist/synergy.d.ts +0 -2
- package/dist/synergy.js +0 -20
- package/dist/translations/de.d.ts +0 -3
- package/dist/translations/de.js +0 -45
- package/dist/translations/en.d.ts +0 -3
- package/dist/translations/en.js +0 -7
- package/dist/utilities/base-path.d.ts +0 -18
- package/dist/utilities/base-path.js +0 -9
- package/dist/utilities/localize.d.ts +0 -33
- package/dist/utilities/localize.js +0 -10
- package/dist/vscode.html-custom-data.json +0 -400
- package/dist/web-types.json +0 -790
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"author": {
|
|
3
|
+
"name": "SICK Global UX Foundation",
|
|
4
|
+
"url": "https://www.sick.com"
|
|
5
|
+
},
|
|
2
6
|
"name": "@synergy-design-system/components",
|
|
3
|
-
"version": "0.
|
|
7
|
+
"version": "1.0.0-main.2",
|
|
4
8
|
"description": "",
|
|
5
9
|
"repository": {
|
|
6
10
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/
|
|
11
|
+
"url": "https://github.com/SickDesignSystem/synergy.git",
|
|
12
|
+
"directory": "packages/components"
|
|
8
13
|
},
|
|
9
14
|
"exports": {
|
|
10
15
|
".": {
|
|
@@ -18,7 +23,9 @@
|
|
|
18
23
|
"./dist/utilities/*": "./dist/utilities/*",
|
|
19
24
|
"./dist/translations/*": "./dist/translations/*"
|
|
20
25
|
},
|
|
21
|
-
"files": [
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
22
29
|
"scripts": {
|
|
23
30
|
"build": "node scripts/build.js",
|
|
24
31
|
"test": "web-test-runner --group default",
|
|
@@ -28,12 +35,20 @@
|
|
|
28
35
|
"vendor.eject": "node scripts/vendorism.js -e",
|
|
29
36
|
"lint:css": "stylelint \"src/**/*.{css,js,ts}\"",
|
|
30
37
|
"lint:js": "eslint src",
|
|
31
|
-
"lint": "pnpm run /^lint:.*/"
|
|
38
|
+
"lint": "pnpm run /^lint:.*/",
|
|
39
|
+
"release": "semantic-release --tagFormat 'components/${version}' -e semantic-release-monorepo"
|
|
32
40
|
},
|
|
33
|
-
"author": "",
|
|
34
41
|
"type": "module",
|
|
35
|
-
"homepage": "",
|
|
36
|
-
"keywords": [
|
|
42
|
+
"homepage": "https://github.com/SickDesignSystem/synergy/tree/main/packages/components",
|
|
43
|
+
"keywords": [
|
|
44
|
+
"Web Components",
|
|
45
|
+
"LIT Components",
|
|
46
|
+
"Design System",
|
|
47
|
+
"SDS",
|
|
48
|
+
"Synergy Design System",
|
|
49
|
+
"SICK",
|
|
50
|
+
"SICK Design System"
|
|
51
|
+
],
|
|
37
52
|
"license": "ISC",
|
|
38
53
|
"devDependencies": {
|
|
39
54
|
"@custom-elements-manifest/analyzer": "^0.8.4",
|
|
@@ -68,7 +83,7 @@
|
|
|
68
83
|
"pascal-case": "^4.0.0",
|
|
69
84
|
"prettier": "^3.0.3",
|
|
70
85
|
"remark-parse": "^11.0.0",
|
|
71
|
-
"semantic-release": "^
|
|
86
|
+
"semantic-release": "^19.0.5",
|
|
72
87
|
"semantic-release-monorepo": "^7.0.5",
|
|
73
88
|
"sinon": "^16.1.0",
|
|
74
89
|
"stylelint": "^15.10.3",
|
|
@@ -92,7 +107,8 @@
|
|
|
92
107
|
{
|
|
93
108
|
"name": "alpha",
|
|
94
109
|
"prerelease": true
|
|
95
|
-
}
|
|
110
|
+
},
|
|
111
|
+
"release-fallback"
|
|
96
112
|
],
|
|
97
113
|
"plugins": [
|
|
98
114
|
"@semantic-release/commit-analyzer",
|
|
@@ -113,7 +129,10 @@
|
|
|
113
129
|
"@semantic-release/git",
|
|
114
130
|
{
|
|
115
131
|
"message": "chore(release/components): ${nextRelease.version} [skip actions]\n\n${nextRelease.notes}",
|
|
116
|
-
"assets": [
|
|
132
|
+
"assets": [
|
|
133
|
+
"CHANGELOG.md",
|
|
134
|
+
"package.json"
|
|
135
|
+
]
|
|
117
136
|
}
|
|
118
137
|
],
|
|
119
138
|
[
|
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,294 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
};
|