@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.
Files changed (81) hide show
  1. package/README.md +14 -0
  2. package/dist/chunks/chunk.2A3352EO.js +10 -0
  3. package/dist/chunks/chunk.2CFEYJLE.js +29 -0
  4. package/dist/chunks/chunk.2DA7CIOQ.js +44 -0
  5. package/dist/chunks/chunk.4NMNW5OM.js +22 -0
  6. package/dist/chunks/chunk.7XI5LKCC.js +14 -0
  7. package/dist/chunks/chunk.HQUF2ZAX.js +62 -0
  8. package/dist/chunks/chunk.HSF5YXAS.js +294 -0
  9. package/dist/chunks/chunk.KHU4AFPL.js +11 -0
  10. package/dist/chunks/chunk.MAS2SHYD.js +41 -0
  11. package/dist/chunks/chunk.NBKDLFEY.js +201 -0
  12. package/dist/chunks/chunk.O3LUPMYG.js +372 -0
  13. package/dist/chunks/chunk.PM7NIY3M.js +35 -0
  14. package/dist/chunks/chunk.Q5SD5LHE.js +607 -0
  15. package/dist/chunks/chunk.QPNUJNT5.js +70 -0
  16. package/dist/chunks/chunk.SVIWEI6P.js +27 -0
  17. package/dist/chunks/chunk.VRTJZYIC.js +127 -0
  18. package/dist/chunks/chunk.XVEDHRRP.js +500 -0
  19. package/dist/chunks/chunk.Y5USHY74.js +31 -0
  20. package/dist/chunks/chunk.Z6AW3P62.js +317 -0
  21. package/dist/components/button/button.component.d.ts +132 -0
  22. package/dist/components/button/button.component.js +21 -0
  23. package/dist/components/button/button.d.ts +8 -0
  24. package/dist/components/button/button.js +25 -0
  25. package/dist/components/button/button.styles.d.ts +2 -0
  26. package/dist/components/button/button.styles.js +8 -0
  27. package/dist/components/icon/icon.component.d.ts +42 -0
  28. package/dist/components/icon/icon.component.js +14 -0
  29. package/dist/components/icon/icon.d.ts +8 -0
  30. package/dist/components/icon/icon.js +18 -0
  31. package/dist/components/icon/icon.styles.d.ts +2 -0
  32. package/dist/components/icon/icon.styles.js +8 -0
  33. package/dist/components/icon/library.d.ts +19 -0
  34. package/dist/components/icon/library.default.d.ts +3 -0
  35. package/dist/components/icon/library.default.js +8 -0
  36. package/dist/components/icon/library.js +18 -0
  37. package/dist/components/icon/library.system.d.ts +3 -0
  38. package/dist/components/icon/library.system.js +7 -0
  39. package/dist/components/input/input.component.d.ts +179 -0
  40. package/dist/components/input/input.component.js +19 -0
  41. package/dist/components/input/input.d.ts +8 -0
  42. package/dist/components/input/input.js +20 -0
  43. package/dist/components/input/input.styles.d.ts +2 -0
  44. package/dist/components/input/input.styles.js +8 -0
  45. package/dist/components/spinner/spinner.component.d.ts +20 -0
  46. package/dist/components/spinner/spinner.component.js +12 -0
  47. package/dist/components/spinner/spinner.styles.d.ts +2 -0
  48. package/dist/components/spinner/spinner.styles.js +8 -0
  49. package/dist/custom-elements.json +1967 -0
  50. package/dist/events/events.d.ts +8 -0
  51. package/dist/events/syn-blur.d.ts +6 -0
  52. package/dist/events/syn-change.d.ts +6 -0
  53. package/dist/events/syn-clear.d.ts +6 -0
  54. package/dist/events/syn-error.d.ts +8 -0
  55. package/dist/events/syn-focus.d.ts +6 -0
  56. package/dist/events/syn-input.d.ts +6 -0
  57. package/dist/events/syn-invalid.d.ts +6 -0
  58. package/dist/events/syn-load.d.ts +6 -0
  59. package/dist/internal/default-value.d.ts +2 -0
  60. package/dist/internal/form.d.ts +73 -0
  61. package/dist/internal/slot.d.ts +23 -0
  62. package/dist/internal/synergy-element.d.ts +47 -0
  63. package/dist/internal/test/form-control-base-tests.d.ts +7 -0
  64. package/dist/internal/watch.d.ts +26 -0
  65. package/dist/styles/component.styles.d.ts +2 -0
  66. package/dist/styles/form-control.styles.d.ts +2 -0
  67. package/dist/synergy-autoloader.d.ts +4 -0
  68. package/dist/synergy-autoloader.js +40 -0
  69. package/dist/synergy.d.ts +2 -0
  70. package/dist/synergy.js +20 -0
  71. package/dist/translations/de.d.ts +3 -0
  72. package/dist/translations/de.js +45 -0
  73. package/dist/translations/en.d.ts +3 -0
  74. package/dist/translations/en.js +7 -0
  75. package/dist/utilities/base-path.d.ts +18 -0
  76. package/dist/utilities/base-path.js +9 -0
  77. package/dist/utilities/localize.d.ts +33 -0
  78. package/dist/utilities/localize.js +10 -0
  79. package/dist/vscode.html-custom-data.json +400 -0
  80. package/dist/web-types.json +790 -0
  81. package/package.json +131 -0
@@ -0,0 +1,317 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk.PM7NIY3M.js";
5
+
6
+ // src/internal/form.ts
7
+ var formCollections = /* @__PURE__ */ new WeakMap();
8
+ var reportValidityOverloads = /* @__PURE__ */ new WeakMap();
9
+ var userInteractedControls = /* @__PURE__ */ new WeakSet();
10
+ var interactions = /* @__PURE__ */ new WeakMap();
11
+ var FormControlController = class {
12
+ constructor(host, options) {
13
+ this.handleFormData = (event) => {
14
+ const disabled = this.options.disabled(this.host);
15
+ const name = this.options.name(this.host);
16
+ const value = this.options.value(this.host);
17
+ const isButton = this.host.tagName.toLowerCase() === "syn-button";
18
+ if (!disabled && !isButton && typeof name === "string" && name.length > 0 && typeof value !== "undefined") {
19
+ if (Array.isArray(value)) {
20
+ value.forEach((val) => {
21
+ event.formData.append(name, val.toString());
22
+ });
23
+ } else {
24
+ event.formData.append(name, value.toString());
25
+ }
26
+ }
27
+ };
28
+ this.handleFormSubmit = (event) => {
29
+ var _a;
30
+ const disabled = this.options.disabled(this.host);
31
+ const reportValidity = this.options.reportValidity;
32
+ if (this.form && !this.form.noValidate) {
33
+ (_a = formCollections.get(this.form)) == null ? void 0 : _a.forEach((control) => {
34
+ this.setUserInteracted(control, true);
35
+ });
36
+ }
37
+ if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
38
+ event.preventDefault();
39
+ event.stopImmediatePropagation();
40
+ }
41
+ };
42
+ this.handleFormReset = () => {
43
+ this.options.setValue(this.host, this.options.defaultValue(this.host));
44
+ this.setUserInteracted(this.host, false);
45
+ interactions.set(this.host, []);
46
+ };
47
+ this.handleInteraction = (event) => {
48
+ const emittedEvents = interactions.get(this.host);
49
+ if (!emittedEvents.includes(event.type)) {
50
+ emittedEvents.push(event.type);
51
+ }
52
+ if (emittedEvents.length === this.options.assumeInteractionOn.length) {
53
+ this.setUserInteracted(this.host, true);
54
+ }
55
+ };
56
+ this.reportFormValidity = () => {
57
+ if (this.form && !this.form.noValidate) {
58
+ const elements = this.form.querySelectorAll("*");
59
+ for (const element of elements) {
60
+ if (typeof element.reportValidity === "function") {
61
+ if (!element.reportValidity()) {
62
+ return false;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ return true;
68
+ };
69
+ (this.host = host).addController(this);
70
+ this.options = __spreadValues({
71
+ form: (input) => {
72
+ if (input.hasAttribute("form") && input.getAttribute("form") !== "") {
73
+ const root = input.getRootNode();
74
+ const formId = input.getAttribute("form");
75
+ if (formId) {
76
+ return root.getElementById(formId);
77
+ }
78
+ }
79
+ return input.closest("form");
80
+ },
81
+ name: (input) => input.name,
82
+ value: (input) => input.value,
83
+ defaultValue: (input) => input.defaultValue,
84
+ disabled: (input) => {
85
+ var _a;
86
+ return (_a = input.disabled) != null ? _a : false;
87
+ },
88
+ reportValidity: (input) => typeof input.reportValidity === "function" ? input.reportValidity() : true,
89
+ setValue: (input, value) => input.value = value,
90
+ assumeInteractionOn: ["syn-input"]
91
+ }, options);
92
+ }
93
+ hostConnected() {
94
+ const form = this.options.form(this.host);
95
+ if (form) {
96
+ this.attachForm(form);
97
+ }
98
+ interactions.set(this.host, []);
99
+ this.options.assumeInteractionOn.forEach((event) => {
100
+ this.host.addEventListener(event, this.handleInteraction);
101
+ });
102
+ }
103
+ hostDisconnected() {
104
+ this.detachForm();
105
+ interactions.delete(this.host);
106
+ this.options.assumeInteractionOn.forEach((event) => {
107
+ this.host.removeEventListener(event, this.handleInteraction);
108
+ });
109
+ }
110
+ hostUpdated() {
111
+ const form = this.options.form(this.host);
112
+ if (!form) {
113
+ this.detachForm();
114
+ }
115
+ if (form && this.form !== form) {
116
+ this.detachForm();
117
+ this.attachForm(form);
118
+ }
119
+ if (this.host.hasUpdated) {
120
+ this.setValidity(this.host.validity.valid);
121
+ }
122
+ }
123
+ attachForm(form) {
124
+ if (form) {
125
+ this.form = form;
126
+ if (formCollections.has(this.form)) {
127
+ formCollections.get(this.form).add(this.host);
128
+ } else {
129
+ formCollections.set(this.form, /* @__PURE__ */ new Set([this.host]));
130
+ }
131
+ this.form.addEventListener("formdata", this.handleFormData);
132
+ this.form.addEventListener("submit", this.handleFormSubmit);
133
+ this.form.addEventListener("reset", this.handleFormReset);
134
+ if (!reportValidityOverloads.has(this.form)) {
135
+ reportValidityOverloads.set(this.form, this.form.reportValidity);
136
+ this.form.reportValidity = () => this.reportFormValidity();
137
+ }
138
+ } else {
139
+ this.form = void 0;
140
+ }
141
+ }
142
+ detachForm() {
143
+ var _a;
144
+ if (this.form) {
145
+ (_a = formCollections.get(this.form)) == null ? void 0 : _a.delete(this.host);
146
+ this.form.removeEventListener("formdata", this.handleFormData);
147
+ this.form.removeEventListener("submit", this.handleFormSubmit);
148
+ this.form.removeEventListener("reset", this.handleFormReset);
149
+ if (reportValidityOverloads.has(this.form)) {
150
+ this.form.reportValidity = reportValidityOverloads.get(this.form);
151
+ reportValidityOverloads.delete(this.form);
152
+ }
153
+ }
154
+ this.form = void 0;
155
+ }
156
+ setUserInteracted(el, hasInteracted) {
157
+ if (hasInteracted) {
158
+ userInteractedControls.add(el);
159
+ } else {
160
+ userInteractedControls.delete(el);
161
+ }
162
+ el.requestUpdate();
163
+ }
164
+ doAction(type, submitter) {
165
+ if (this.form) {
166
+ const button = document.createElement("button");
167
+ button.type = type;
168
+ button.style.position = "absolute";
169
+ button.style.width = "0";
170
+ button.style.height = "0";
171
+ button.style.clipPath = "inset(50%)";
172
+ button.style.overflow = "hidden";
173
+ button.style.whiteSpace = "nowrap";
174
+ if (submitter) {
175
+ button.name = submitter.name;
176
+ button.value = submitter.value;
177
+ ["formaction", "formenctype", "formmethod", "formnovalidate", "formtarget"].forEach((attr) => {
178
+ if (submitter.hasAttribute(attr)) {
179
+ button.setAttribute(attr, submitter.getAttribute(attr));
180
+ }
181
+ });
182
+ }
183
+ this.form.append(button);
184
+ button.click();
185
+ button.remove();
186
+ }
187
+ }
188
+ /** Returns the associated `<form>` element, if one exists. */
189
+ getForm() {
190
+ var _a;
191
+ return (_a = this.form) != null ? _a : null;
192
+ }
193
+ /** Resets the form, restoring all the control to their default value */
194
+ reset(submitter) {
195
+ this.doAction("reset", submitter);
196
+ }
197
+ /** Submits the form, triggering validation and form data injection. */
198
+ submit(submitter) {
199
+ this.doAction("submit", submitter);
200
+ }
201
+ /**
202
+ * Synchronously sets the form control's validity. Call this when you know the future validity but need to update
203
+ * the host element immediately, i.e. before Lit updates the component in the next update.
204
+ */
205
+ setValidity(isValid) {
206
+ const host = this.host;
207
+ const hasInteracted = Boolean(userInteractedControls.has(host));
208
+ const required = Boolean(host.required);
209
+ host.toggleAttribute("data-required", required);
210
+ host.toggleAttribute("data-optional", !required);
211
+ host.toggleAttribute("data-invalid", !isValid);
212
+ host.toggleAttribute("data-valid", isValid);
213
+ host.toggleAttribute("data-user-invalid", !isValid && hasInteracted);
214
+ host.toggleAttribute("data-user-valid", isValid && hasInteracted);
215
+ }
216
+ /**
217
+ * Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything
218
+ * that affects constraint validation changes so the component receives the correct validity states.
219
+ */
220
+ updateValidity() {
221
+ const host = this.host;
222
+ this.setValidity(host.validity.valid);
223
+ }
224
+ /**
225
+ * Dispatches a non-bubbling, cancelable custom event of type `syn-invalid`.
226
+ * If the `syn-invalid` event will be cancelled then the original `invalid`
227
+ * event (which may have been passed as argument) will also be cancelled.
228
+ * If no original `invalid` event has been passed then the `syn-invalid`
229
+ * event will be cancelled before being dispatched.
230
+ */
231
+ emitInvalidEvent(originalInvalidEvent) {
232
+ const slInvalidEvent = new CustomEvent("syn-invalid", {
233
+ bubbles: false,
234
+ composed: false,
235
+ cancelable: true,
236
+ detail: {}
237
+ });
238
+ if (!originalInvalidEvent) {
239
+ slInvalidEvent.preventDefault();
240
+ }
241
+ if (!this.host.dispatchEvent(slInvalidEvent)) {
242
+ originalInvalidEvent == null ? void 0 : originalInvalidEvent.preventDefault();
243
+ }
244
+ }
245
+ };
246
+ var validValidityState = Object.freeze({
247
+ badInput: false,
248
+ customError: false,
249
+ patternMismatch: false,
250
+ rangeOverflow: false,
251
+ rangeUnderflow: false,
252
+ stepMismatch: false,
253
+ tooLong: false,
254
+ tooShort: false,
255
+ typeMismatch: false,
256
+ valid: true,
257
+ valueMissing: false
258
+ });
259
+ var valueMissingValidityState = Object.freeze(__spreadProps(__spreadValues({}, validValidityState), {
260
+ valid: false,
261
+ valueMissing: true
262
+ }));
263
+ var customErrorValidityState = Object.freeze(__spreadProps(__spreadValues({}, validValidityState), {
264
+ valid: false,
265
+ customError: true
266
+ }));
267
+
268
+ // src/internal/slot.ts
269
+ var HasSlotController = class {
270
+ constructor(host, ...slotNames) {
271
+ this.slotNames = [];
272
+ this.handleSlotChange = (event) => {
273
+ const slot = event.target;
274
+ if (this.slotNames.includes("[default]") && !slot.name || slot.name && this.slotNames.includes(slot.name)) {
275
+ this.host.requestUpdate();
276
+ }
277
+ };
278
+ (this.host = host).addController(this);
279
+ this.slotNames = slotNames;
280
+ }
281
+ hasDefaultSlot() {
282
+ return [...this.host.childNodes].some((node) => {
283
+ if (node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "") {
284
+ return true;
285
+ }
286
+ if (node.nodeType === node.ELEMENT_NODE) {
287
+ const el = node;
288
+ const tagName = el.tagName.toLowerCase();
289
+ if (tagName === "syn-visually-hidden") {
290
+ return false;
291
+ }
292
+ if (!el.hasAttribute("slot")) {
293
+ return true;
294
+ }
295
+ }
296
+ return false;
297
+ });
298
+ }
299
+ hasNamedSlot(name) {
300
+ return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
301
+ }
302
+ test(slotName) {
303
+ return slotName === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
304
+ }
305
+ hostConnected() {
306
+ this.host.shadowRoot.addEventListener("slotchange", this.handleSlotChange);
307
+ }
308
+ hostDisconnected() {
309
+ this.host.shadowRoot.removeEventListener("slotchange", this.handleSlotChange);
310
+ }
311
+ };
312
+
313
+ export {
314
+ FormControlController,
315
+ validValidityState,
316
+ HasSlotController
317
+ };
@@ -0,0 +1,132 @@
1
+ import SynergyElement from '../../internal/synergy-element.js';
2
+ import SynIcon from '../icon/icon.component.js';
3
+ import SynSpinner from '../spinner/spinner.component.js';
4
+ import type { CSSResultGroup } from 'lit';
5
+ import type { SynergyFormControl } from '../../internal/synergy-element.js';
6
+ /**
7
+ * @summary Buttons represent actions that are available to the user.
8
+ * @documentation https://synergy.style/components/button
9
+ * @status stable
10
+ * @since 2.0
11
+ *
12
+ * @dependency syn-icon
13
+ * @dependency syn-spinner
14
+ *
15
+ * @event syn-blur - Emitted when the button loses focus.
16
+ * @event syn-focus - Emitted when the button gains focus.
17
+ * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
18
+ *
19
+ * @slot - The button's label.
20
+ * @slot prefix - A presentational prefix icon or similar element.
21
+ * @slot suffix - A presentational suffix icon or similar element.
22
+ *
23
+ * @csspart base - The component's base wrapper.
24
+ * @csspart prefix - The container that wraps the prefix.
25
+ * @csspart label - The button's label.
26
+ * @csspart suffix - The container that wraps the suffix.
27
+ * @csspart caret - The button's caret icon, an `<syn-icon>` element.
28
+ * @csspart spinner - The spinner that shows when the button is in the loading state.
29
+ */
30
+ export default class SynButton extends SynergyElement implements SynergyFormControl {
31
+ static styles: CSSResultGroup;
32
+ static dependencies: {
33
+ 'syn-icon': typeof SynIcon;
34
+ 'syn-spinner': typeof SynSpinner;
35
+ };
36
+ private readonly formControlController;
37
+ private readonly hasSlotController;
38
+ private readonly localize;
39
+ button: HTMLButtonElement | HTMLLinkElement;
40
+ private hasFocus;
41
+ invalid: boolean;
42
+ title: string;
43
+ /** The button's theme variant. */
44
+ variant: 'default' | 'primary' | 'success' | 'neutral' | 'warning' | 'danger' | 'text';
45
+ /** The button's size. */
46
+ size: 'small' | 'medium' | 'large';
47
+ /** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */
48
+ caret: boolean;
49
+ /** Disables the button. */
50
+ disabled: boolean;
51
+ /** Draws the button in a loading state. */
52
+ loading: boolean;
53
+ /** Draws an outlined button. */
54
+ outline: boolean;
55
+ /** Draws a pill-style button with rounded edges. */
56
+ pill: boolean;
57
+ /**
58
+ * Draws a circular icon button. When this attribute is present, the button expects a single `<syn-icon>` in the
59
+ * default slot.
60
+ */
61
+ circle: boolean;
62
+ /**
63
+ * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native
64
+ * `<button>` elements behave. When the type is `submit`, the button will submit the surrounding form.
65
+ */
66
+ type: 'button' | 'submit' | 'reset';
67
+ /**
68
+ * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter.
69
+ * This attribute is ignored when `href` is present.
70
+ */
71
+ name: string;
72
+ /**
73
+ * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this
74
+ * button is the submitter. This attribute is ignored when `href` is present.
75
+ */
76
+ value: string;
77
+ /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */
78
+ href: string;
79
+ /** Tells the browser where to open the link. Only used when `href` is present. */
80
+ target: '_blank' | '_parent' | '_self' | '_top';
81
+ /**
82
+ * When using `href`, this attribute will map to the underlying link's `rel` attribute. Unlike regular links, the
83
+ * default is `noreferrer noopener` to prevent security exploits. However, if you're using `target` to point to a
84
+ * specific tab/window, this will prevent that from working correctly. You can remove or change the default value by
85
+ * setting the attribute to an empty string or a value of your choice, respectively.
86
+ */
87
+ rel: string;
88
+ /** Tells the browser to download the linked file as this filename. Only used when `href` is present. */
89
+ download?: string;
90
+ /**
91
+ * The "form owner" to associate the button with. If omitted, the closest containing form will be used instead. The
92
+ * value of this attribute must be an id of a form in the same document or shadow root as the button.
93
+ */
94
+ form: string;
95
+ /** Used to override the form owner's `action` attribute. */
96
+ formAction: string;
97
+ /** Used to override the form owner's `enctype` attribute. */
98
+ formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
99
+ /** Used to override the form owner's `method` attribute. */
100
+ formMethod: 'post' | 'get';
101
+ /** Used to override the form owner's `novalidate` attribute. */
102
+ formNoValidate: boolean;
103
+ /** Used to override the form owner's `target` attribute. */
104
+ formTarget: '_self' | '_blank' | '_parent' | '_top' | string;
105
+ /** Gets the validity state object */
106
+ get validity(): ValidityState;
107
+ /** Gets the validation message */
108
+ get validationMessage(): string;
109
+ firstUpdated(): void;
110
+ private handleBlur;
111
+ private handleFocus;
112
+ private handleClick;
113
+ private handleInvalid;
114
+ private isButton;
115
+ private isLink;
116
+ handleDisabledChange(): void;
117
+ /** Simulates a click on the button. */
118
+ click(): void;
119
+ /** Sets focus on the button. */
120
+ focus(options?: FocusOptions): void;
121
+ /** Removes focus from the button. */
122
+ blur(): void;
123
+ /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
124
+ checkValidity(): boolean;
125
+ /** Gets the associated form, if one exists. */
126
+ getForm(): HTMLFormElement | null;
127
+ /** Checks for validity and shows the browser's validation message if the control is invalid. */
128
+ reportValidity(): boolean;
129
+ /** Sets a custom validation message. Pass an empty string to restore validity. */
130
+ setCustomValidity(message: string): void;
131
+ render(): import("lit").TemplateResult;
132
+ }
@@ -0,0 +1,21 @@
1
+ import {
2
+ SynButton
3
+ } from "../../chunks/chunk.HSF5YXAS.js";
4
+ import "../../chunks/chunk.Q5SD5LHE.js";
5
+ import "../../chunks/chunk.Y5USHY74.js";
6
+ import "../../chunks/chunk.QPNUJNT5.js";
7
+ import "../../chunks/chunk.Z6AW3P62.js";
8
+ import "../../chunks/chunk.NBKDLFEY.js";
9
+ import "../../chunks/chunk.SVIWEI6P.js";
10
+ import "../../chunks/chunk.2DA7CIOQ.js";
11
+ import "../../chunks/chunk.7XI5LKCC.js";
12
+ import "../../chunks/chunk.VRTJZYIC.js";
13
+ import "../../chunks/chunk.2CFEYJLE.js";
14
+ import "../../chunks/chunk.2A3352EO.js";
15
+ import "../../chunks/chunk.MAS2SHYD.js";
16
+ import "../../chunks/chunk.HQUF2ZAX.js";
17
+ import "../../chunks/chunk.4NMNW5OM.js";
18
+ import "../../chunks/chunk.PM7NIY3M.js";
19
+ export {
20
+ SynButton as default
21
+ };
@@ -0,0 +1,8 @@
1
+ import SynButton from './button.component.js';
2
+ export * from './button.component.js';
3
+ export default SynButton;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'syn-button': SynButton;
7
+ }
8
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ SynButton
3
+ } from "../../chunks/chunk.HSF5YXAS.js";
4
+ import "../../chunks/chunk.Q5SD5LHE.js";
5
+ import "../../chunks/chunk.Y5USHY74.js";
6
+ import "../../chunks/chunk.QPNUJNT5.js";
7
+ import "../../chunks/chunk.Z6AW3P62.js";
8
+ import "../../chunks/chunk.NBKDLFEY.js";
9
+ import "../../chunks/chunk.SVIWEI6P.js";
10
+ import "../../chunks/chunk.2DA7CIOQ.js";
11
+ import "../../chunks/chunk.7XI5LKCC.js";
12
+ import "../../chunks/chunk.VRTJZYIC.js";
13
+ import "../../chunks/chunk.2CFEYJLE.js";
14
+ import "../../chunks/chunk.2A3352EO.js";
15
+ import "../../chunks/chunk.MAS2SHYD.js";
16
+ import "../../chunks/chunk.HQUF2ZAX.js";
17
+ import "../../chunks/chunk.4NMNW5OM.js";
18
+ import "../../chunks/chunk.PM7NIY3M.js";
19
+
20
+ // src/components/button/button.ts
21
+ var button_default = SynButton;
22
+ SynButton.define("syn-button");
23
+ export {
24
+ button_default as default
25
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import {
2
+ button_styles_default
3
+ } from "../../chunks/chunk.Q5SD5LHE.js";
4
+ import "../../chunks/chunk.4NMNW5OM.js";
5
+ import "../../chunks/chunk.PM7NIY3M.js";
6
+ export {
7
+ button_styles_default as default
8
+ };
@@ -0,0 +1,42 @@
1
+ import SynergyElement from '../../internal/synergy-element.js';
2
+ import type { CSSResultGroup, HTMLTemplateResult } from 'lit';
3
+ /**
4
+ * @summary Icons are symbols that can be used to represent various options within an application.
5
+ * @documentation https://synergy.style/components/icon
6
+ * @status stable
7
+ * @since 2.0
8
+ *
9
+ * @event syn-load - Emitted when the icon has loaded. When using `spriteSheet: true` this will not emit.
10
+ * @event syn-error - Emitted when the icon fails to load due to an error. When using `spriteSheet: true` this will not emit.
11
+ *
12
+ * @csspart svg - The internal SVG element.
13
+ * @csspart use - The <use> element generated when using `spriteSheet: true`
14
+ */
15
+ export default class SynIcon extends SynergyElement {
16
+ static styles: CSSResultGroup;
17
+ private initialRender;
18
+ /** Given a URL, this function returns the resulting SVG element or an appropriate error symbol. */
19
+ private resolveIcon;
20
+ private svg;
21
+ /** The name of the icon to draw. Available names depend on the icon library being used. */
22
+ name?: string;
23
+ /**
24
+ * An external URL of an SVG file. Be sure you trust the content you are including, as it will be executed as code and
25
+ * can result in XSS attacks.
26
+ */
27
+ src?: string;
28
+ /**
29
+ * An alternate description to use for assistive devices. If omitted, the icon will be considered presentational and
30
+ * ignored by assistive devices.
31
+ */
32
+ label: string;
33
+ /** The name of a registered custom icon library. */
34
+ library: string;
35
+ connectedCallback(): void;
36
+ firstUpdated(): void;
37
+ disconnectedCallback(): void;
38
+ private getIconSource;
39
+ handleLabelChange(): void;
40
+ setIcon(): Promise<void>;
41
+ render(): SVGElement | HTMLTemplateResult | null;
42
+ }
@@ -0,0 +1,14 @@
1
+ import {
2
+ SynIcon
3
+ } from "../../chunks/chunk.NBKDLFEY.js";
4
+ import "../../chunks/chunk.SVIWEI6P.js";
5
+ import "../../chunks/chunk.2DA7CIOQ.js";
6
+ import "../../chunks/chunk.7XI5LKCC.js";
7
+ import "../../chunks/chunk.VRTJZYIC.js";
8
+ import "../../chunks/chunk.2CFEYJLE.js";
9
+ import "../../chunks/chunk.HQUF2ZAX.js";
10
+ import "../../chunks/chunk.4NMNW5OM.js";
11
+ import "../../chunks/chunk.PM7NIY3M.js";
12
+ export {
13
+ SynIcon as default
14
+ };
@@ -0,0 +1,8 @@
1
+ import SynIcon from './icon.component.js';
2
+ export * from './icon.component.js';
3
+ export default SynIcon;
4
+ declare global {
5
+ interface HTMLElementTagNameMap {
6
+ 'syn-icon': SynIcon;
7
+ }
8
+ }
@@ -0,0 +1,18 @@
1
+ import {
2
+ SynIcon
3
+ } from "../../chunks/chunk.NBKDLFEY.js";
4
+ import "../../chunks/chunk.SVIWEI6P.js";
5
+ import "../../chunks/chunk.2DA7CIOQ.js";
6
+ import "../../chunks/chunk.7XI5LKCC.js";
7
+ import "../../chunks/chunk.VRTJZYIC.js";
8
+ import "../../chunks/chunk.2CFEYJLE.js";
9
+ import "../../chunks/chunk.HQUF2ZAX.js";
10
+ import "../../chunks/chunk.4NMNW5OM.js";
11
+ import "../../chunks/chunk.PM7NIY3M.js";
12
+
13
+ // src/components/icon/icon.ts
14
+ var icon_default = SynIcon;
15
+ SynIcon.define("syn-icon");
16
+ export {
17
+ icon_default as default
18
+ };
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import {
2
+ icon_styles_default
3
+ } from "../../chunks/chunk.SVIWEI6P.js";
4
+ import "../../chunks/chunk.4NMNW5OM.js";
5
+ import "../../chunks/chunk.PM7NIY3M.js";
6
+ export {
7
+ icon_styles_default as default
8
+ };
@@ -0,0 +1,19 @@
1
+ import type SynIcon from '../icon/icon.js';
2
+ export type IconLibraryResolver = (name: string) => string;
3
+ export type IconLibraryMutator = (svg: SVGElement) => void;
4
+ export interface IconLibrary {
5
+ name: string;
6
+ resolver: IconLibraryResolver;
7
+ mutator?: IconLibraryMutator;
8
+ spriteSheet?: boolean;
9
+ }
10
+ /** Adds an icon to the list of watched icons. */
11
+ export declare function watchIcon(icon: SynIcon): void;
12
+ /** Removes an icon from the list of watched icons. */
13
+ export declare function unwatchIcon(icon: SynIcon): void;
14
+ /** Returns a library from the registry. */
15
+ export declare function getIconLibrary(name?: string): IconLibrary | undefined;
16
+ /** Adds an icon library to the registry, or overrides an existing one. */
17
+ export declare function registerIconLibrary(name: string, options: Omit<IconLibrary, 'name'>): void;
18
+ /** Removes an icon library from the registry. */
19
+ export declare function unregisterIconLibrary(name: string): void;
@@ -0,0 +1,3 @@
1
+ import type { IconLibrary } from './library.js';
2
+ declare const library: IconLibrary;
3
+ export default library;
@@ -0,0 +1,8 @@
1
+ import {
2
+ library_default_default
3
+ } from "../../chunks/chunk.7XI5LKCC.js";
4
+ import "../../chunks/chunk.2CFEYJLE.js";
5
+ import "../../chunks/chunk.PM7NIY3M.js";
6
+ export {
7
+ library_default_default as default
8
+ };
@@ -0,0 +1,18 @@
1
+ import {
2
+ getIconLibrary,
3
+ registerIconLibrary,
4
+ unregisterIconLibrary,
5
+ unwatchIcon,
6
+ watchIcon
7
+ } from "../../chunks/chunk.2DA7CIOQ.js";
8
+ import "../../chunks/chunk.7XI5LKCC.js";
9
+ import "../../chunks/chunk.VRTJZYIC.js";
10
+ import "../../chunks/chunk.2CFEYJLE.js";
11
+ import "../../chunks/chunk.PM7NIY3M.js";
12
+ export {
13
+ getIconLibrary,
14
+ registerIconLibrary,
15
+ unregisterIconLibrary,
16
+ unwatchIcon,
17
+ watchIcon
18
+ };