@synergy-design-system/components 1.2.1 → 1.3.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 (105) hide show
  1. package/dist/chunks/{chunk.EJXWL3JM.js → chunk.5AAIHRMI.js} +7 -3
  2. package/dist/chunks/chunk.5AAIHRMI.js.map +7 -0
  3. package/dist/chunks/{chunk.OUVIH6QL.js → chunk.6PUYPXNC.js} +3 -3
  4. package/dist/chunks/{chunk.P2LNG2PZ.js → chunk.AMTCNRDE.js} +38 -9
  5. package/dist/chunks/chunk.AMTCNRDE.js.map +7 -0
  6. package/dist/chunks/{chunk.NGM2Y5G5.js → chunk.B2WRX32I.js} +2 -2
  7. package/dist/chunks/{chunk.2D7KJSSX.js → chunk.BLHHZJQD.js} +4 -4
  8. package/dist/chunks/{chunk.U5AOTLVK.js → chunk.CZXYQ2WN.js} +2 -2
  9. package/dist/chunks/{chunk.MTGT2EG5.js → chunk.D63ANHR2.js} +2 -2
  10. package/dist/chunks/{chunk.S6PKR3AN.js → chunk.G6VDIPNQ.js} +5 -5
  11. package/dist/chunks/{chunk.R3S3AGUF.js → chunk.GHDB3G7H.js} +2 -2
  12. package/dist/chunks/{chunk.UYF5MTOU.js → chunk.H2CKSKRW.js} +2 -2
  13. package/dist/chunks/{chunk.Z3RZUTQU.js → chunk.HG5QC5EW.js} +2 -2
  14. package/dist/chunks/{chunk.6PFQSQLU.js → chunk.JRXQK6LG.js} +2 -2
  15. package/dist/chunks/{chunk.I4ZBEQUH.js → chunk.KZ3AQUHU.js} +3 -3
  16. package/dist/chunks/chunk.LAB4YJYE.js +16 -0
  17. package/dist/chunks/chunk.LAB4YJYE.js.map +7 -0
  18. package/dist/chunks/{chunk.4YSX6HUH.js → chunk.O7JATGQ6.js} +2 -2
  19. package/dist/chunks/{chunk.ZUOBN5Q3.js → chunk.QAWYSA72.js} +2 -2
  20. package/dist/chunks/{chunk.VM64SQGC.js → chunk.QFYXBNOQ.js} +3 -3
  21. package/dist/chunks/{chunk.MM2HMAE6.js → chunk.R6E3TWR3.js} +6 -14
  22. package/dist/chunks/chunk.R6E3TWR3.js.map +7 -0
  23. package/dist/chunks/{chunk.LWB5LXJ5.js → chunk.RBNQTDFJ.js} +2 -2
  24. package/dist/chunks/{chunk.W5TOVAHB.js → chunk.RHBEOZWF.js} +2 -2
  25. package/dist/chunks/{chunk.R3CMRBZ7.js → chunk.RLLBOQ6V.js} +3 -3
  26. package/dist/chunks/{chunk.V52P6M55.js → chunk.RWQLSIO7.js} +2 -2
  27. package/dist/chunks/{chunk.V52P6M55.js.map → chunk.RWQLSIO7.js.map} +1 -1
  28. package/dist/chunks/{chunk.5ILVVLJF.js → chunk.S74LATRZ.js} +2 -2
  29. package/dist/chunks/{chunk.QAPZLSEL.js → chunk.TGO3Z3HP.js} +3 -3
  30. package/dist/chunks/{chunk.PTBOOLQE.js → chunk.UO5HH5VY.js} +4 -4
  31. package/dist/chunks/{chunk.AP2QDLP7.js → chunk.VD6GL6QA.js} +2 -2
  32. package/dist/chunks/{chunk.ITSSPNRO.js → chunk.VP6WQHSI.js} +2 -2
  33. package/dist/chunks/{chunk.AMHJ56Z3.js → chunk.XOYAL6A7.js} +4 -4
  34. package/dist/chunks/{chunk.DS3H2UY3.js → chunk.YKNLO6A2.js} +3 -3
  35. package/dist/chunks/{chunk.MBXGNZ7I.js → chunk.Z65EDGTR.js} +2 -2
  36. package/dist/chunks/{chunk.GCYPKQBG.js → chunk.ZPSFUUNK.js} +2 -2
  37. package/dist/components/button/button.component.js +8 -8
  38. package/dist/components/button/button.js +9 -9
  39. package/dist/components/button-group/button-group.component.js +2 -2
  40. package/dist/components/button-group/button-group.js +3 -3
  41. package/dist/components/checkbox/checkbox.component.js +6 -6
  42. package/dist/components/checkbox/checkbox.js +7 -7
  43. package/dist/components/icon/icon.component.js +4 -4
  44. package/dist/components/icon/icon.js +5 -5
  45. package/dist/components/icon/library.js +2 -2
  46. package/dist/components/icon/library.system.js +1 -1
  47. package/dist/components/icon-button/icon-button.component.js +5 -5
  48. package/dist/components/icon-button/icon-button.js +6 -6
  49. package/dist/components/input/input.component.js +7 -7
  50. package/dist/components/input/input.js +8 -8
  51. package/dist/components/radio/radio.component.js +5 -5
  52. package/dist/components/radio/radio.js +6 -6
  53. package/dist/components/radio-button/radio-button.component.js +2 -2
  54. package/dist/components/radio-button/radio-button.js +3 -3
  55. package/dist/components/radio-group/radio-group.component.js +4 -4
  56. package/dist/components/radio-group/radio-group.js +5 -5
  57. package/dist/components/spinner/spinner.component.js +3 -3
  58. package/dist/components/switch/switch.component.js +3 -3
  59. package/dist/components/switch/switch.js +4 -4
  60. package/dist/components/tag/tag.component.js +7 -7
  61. package/dist/components/tag/tag.js +8 -8
  62. package/dist/components/textarea/textarea.component.js +3 -3
  63. package/dist/components/textarea/textarea.js +4 -4
  64. package/dist/custom-elements.json +2 -2
  65. package/dist/internal/form.d.ts +6 -0
  66. package/dist/internal/test.d.ts +4 -1
  67. package/dist/synergy.js +31 -31
  68. package/dist/translations/de.js +1 -1
  69. package/dist/utilities/form.js +2 -2
  70. package/dist/utilities/icon-library.js +2 -2
  71. package/dist/utilities/localize.d.ts +0 -1
  72. package/dist/utilities/localize.js +1 -1
  73. package/dist/web-types.json +1 -1
  74. package/package.json +2 -2
  75. package/dist/chunks/chunk.EJXWL3JM.js.map +0 -7
  76. package/dist/chunks/chunk.MM2HMAE6.js.map +0 -7
  77. package/dist/chunks/chunk.P2LNG2PZ.js.map +0 -7
  78. package/dist/chunks/chunk.R6VNLE6N.js +0 -11
  79. package/dist/chunks/chunk.R6VNLE6N.js.map +0 -7
  80. /package/dist/chunks/{chunk.OUVIH6QL.js.map → chunk.6PUYPXNC.js.map} +0 -0
  81. /package/dist/chunks/{chunk.NGM2Y5G5.js.map → chunk.B2WRX32I.js.map} +0 -0
  82. /package/dist/chunks/{chunk.2D7KJSSX.js.map → chunk.BLHHZJQD.js.map} +0 -0
  83. /package/dist/chunks/{chunk.U5AOTLVK.js.map → chunk.CZXYQ2WN.js.map} +0 -0
  84. /package/dist/chunks/{chunk.MTGT2EG5.js.map → chunk.D63ANHR2.js.map} +0 -0
  85. /package/dist/chunks/{chunk.S6PKR3AN.js.map → chunk.G6VDIPNQ.js.map} +0 -0
  86. /package/dist/chunks/{chunk.R3S3AGUF.js.map → chunk.GHDB3G7H.js.map} +0 -0
  87. /package/dist/chunks/{chunk.UYF5MTOU.js.map → chunk.H2CKSKRW.js.map} +0 -0
  88. /package/dist/chunks/{chunk.Z3RZUTQU.js.map → chunk.HG5QC5EW.js.map} +0 -0
  89. /package/dist/chunks/{chunk.6PFQSQLU.js.map → chunk.JRXQK6LG.js.map} +0 -0
  90. /package/dist/chunks/{chunk.I4ZBEQUH.js.map → chunk.KZ3AQUHU.js.map} +0 -0
  91. /package/dist/chunks/{chunk.4YSX6HUH.js.map → chunk.O7JATGQ6.js.map} +0 -0
  92. /package/dist/chunks/{chunk.ZUOBN5Q3.js.map → chunk.QAWYSA72.js.map} +0 -0
  93. /package/dist/chunks/{chunk.VM64SQGC.js.map → chunk.QFYXBNOQ.js.map} +0 -0
  94. /package/dist/chunks/{chunk.LWB5LXJ5.js.map → chunk.RBNQTDFJ.js.map} +0 -0
  95. /package/dist/chunks/{chunk.W5TOVAHB.js.map → chunk.RHBEOZWF.js.map} +0 -0
  96. /package/dist/chunks/{chunk.R3CMRBZ7.js.map → chunk.RLLBOQ6V.js.map} +0 -0
  97. /package/dist/chunks/{chunk.5ILVVLJF.js.map → chunk.S74LATRZ.js.map} +0 -0
  98. /package/dist/chunks/{chunk.QAPZLSEL.js.map → chunk.TGO3Z3HP.js.map} +0 -0
  99. /package/dist/chunks/{chunk.PTBOOLQE.js.map → chunk.UO5HH5VY.js.map} +0 -0
  100. /package/dist/chunks/{chunk.AP2QDLP7.js.map → chunk.VD6GL6QA.js.map} +0 -0
  101. /package/dist/chunks/{chunk.ITSSPNRO.js.map → chunk.VP6WQHSI.js.map} +0 -0
  102. /package/dist/chunks/{chunk.AMHJ56Z3.js.map → chunk.XOYAL6A7.js.map} +0 -0
  103. /package/dist/chunks/{chunk.DS3H2UY3.js.map → chunk.YKNLO6A2.js.map} +0 -0
  104. /package/dist/chunks/{chunk.MBXGNZ7I.js.map → chunk.Z65EDGTR.js.map} +0 -0
  105. /package/dist/chunks/{chunk.GCYPKQBG.js.map → chunk.ZPSFUUNK.js.map} +0 -0
@@ -1,9 +1,13 @@
1
1
  // src/components/icon/library.system.ts
2
2
  var icons = {
3
+ "add": `
4
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z"/></svg>`,
3
5
  "caret": `
4
- <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M16.59 8.295L12 12.875L7.41 8.295L6 9.705L12 15.705L18 9.705L16.59 8.295Z"/></svg>`,
6
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M16.59 8.29498L12 12.875L7.41 8.29498L6 9.70498L12 15.705L18 9.70498L16.59 8.29498Z"/></svg>`,
5
7
  "check": `
6
- <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M8.79496 15.875L4.62496 11.705L3.20496 13.115L8.79496 18.705L20.795 6.705L19.385 5.295L8.79496 15.875Z"/></svg>`,
8
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M8.79496 15.875L4.62496 11.705L3.20496 13.115L8.79496 18.705L20.795 6.70498L19.385 5.29498L8.79496 15.875Z"/></svg>`,
9
+ "chevron-down": `
10
+ <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M16.59 8.29498L12 12.875L7.41 8.29498L6 9.70498L12 15.705L18 9.70498L16.59 8.29498Z"/></svg>`,
7
11
  "eye-slash": `
8
12
  <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill='currentColor'><path d="M12.005 6.5C14.765 6.5 17.005 8.74 17.005 11.5C17.005 12.15 16.875 12.76 16.645 13.33L19.565 16.25C21.075 14.99 22.265 13.36 22.995 11.5C21.265 7.11 16.995 4 11.995 4C10.595 4 9.255 4.25 8.01501 4.7L10.175 6.86C10.745 6.63 11.355 6.5 12.005 6.5ZM2.005 3.77L4.745 6.51C3.085 7.8 1.785 9.52 1.005 11.5C2.735 15.89 7.005 19 12.005 19C13.555 19 15.035 18.7 16.385 18.16L16.805 18.58L19.735 21.5L21.005 20.23L3.275 2.5L2.005 3.77ZM7.53501 9.3L9.085 10.85C9.035 11.06 9.005 11.28 9.005 11.5C9.005 13.16 10.345 14.5 12.005 14.5C12.225 14.5 12.445 14.47 12.655 14.42L14.205 15.97C13.535 16.3 12.795 16.5 12.005 16.5C9.245 16.5 7.005 14.26 7.005 11.5C7.005 10.71 7.20501 9.97 7.53501 9.3ZM11.845 8.52L14.995 11.67L15.015 11.51C15.015 9.85 13.675 8.51 12.015 8.51L11.845 8.52Z"/></svg>`,
9
13
  "eye": `
@@ -31,4 +35,4 @@ var library_system_default = systemLibrary;
31
35
  export {
32
36
  library_system_default
33
37
  };
34
- //# sourceMappingURL=chunk.EJXWL3JM.js.map
38
+ //# sourceMappingURL=chunk.5AAIHRMI.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/icon/library.system.ts"],
4
+ "sourcesContent": ["/* eslint-disable */\nimport type { IconLibrary } from './library.js';\n\n//\n// System icons are a separate library to ensure they're always available, regardless of how the default icon library is\n// configured or if its icons resolve properly.\n//\n// All Synergy components must use the system library instead of the default library. For visual consistency, system\n// icons are a subset of Bootstrap Icons.\n//\n// **Start system icons**\nconst icons = {\n\t'add': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M19 13H13V19H11V13H5V11H11V5H13V11H19V13Z\"/></svg>`,\n\t'caret': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M16.59 8.29498L12 12.875L7.41 8.29498L6 9.70498L12 15.705L18 9.70498L16.59 8.29498Z\"/></svg>`,\n\t'check': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M8.79496 15.875L4.62496 11.705L3.20496 13.115L8.79496 18.705L20.795 6.70498L19.385 5.29498L8.79496 15.875Z\"/></svg>`,\n\t'chevron-down': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M16.59 8.29498L12 12.875L7.41 8.29498L6 9.70498L12 15.705L18 9.70498L16.59 8.29498Z\"/></svg>`,\n\t'eye-slash': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M12.005 6.5C14.765 6.5 17.005 8.74 17.005 11.5C17.005 12.15 16.875 12.76 16.645 13.33L19.565 16.25C21.075 14.99 22.265 13.36 22.995 11.5C21.265 7.11 16.995 4 11.995 4C10.595 4 9.255 4.25 8.01501 4.7L10.175 6.86C10.745 6.63 11.355 6.5 12.005 6.5ZM2.005 3.77L4.745 6.51C3.085 7.8 1.785 9.52 1.005 11.5C2.735 15.89 7.005 19 12.005 19C13.555 19 15.035 18.7 16.385 18.16L16.805 18.58L19.735 21.5L21.005 20.23L3.275 2.5L2.005 3.77ZM7.53501 9.3L9.085 10.85C9.035 11.06 9.005 11.28 9.005 11.5C9.005 13.16 10.345 14.5 12.005 14.5C12.225 14.5 12.445 14.47 12.655 14.42L14.205 15.97C13.535 16.3 12.795 16.5 12.005 16.5C9.245 16.5 7.005 14.26 7.005 11.5C7.005 10.71 7.20501 9.97 7.53501 9.3ZM11.845 8.52L14.995 11.67L15.015 11.51C15.015 9.85 13.675 8.51 12.015 8.51L11.845 8.52Z\"/></svg>`,\n\t'eye': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M12 4.5C7 4.5 2.73 7.61 1 12C2.73 16.39 7 19.5 12 19.5C17 19.5 21.27 16.39 23 12C21.27 7.61 17 4.5 12 4.5ZM12 17C9.24 17 7 14.76 7 12C7 9.24 9.24 7 12 7C14.76 7 17 9.24 17 12C17 14.76 14.76 17 12 17ZM12 9C10.34 9 9 10.34 9 12C9 13.66 10.34 15 12 15C13.66 15 15 13.66 15 12C15 10.34 13.66 9 12 9Z\"/></svg>`,\n\t'indeterminate': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M19 13H5V11H19V13Z\"/></svg>`,\n\t'radio': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M17 12C17 14.7614 14.7614 17 12 17C9.23858 17 7 14.7614 7 12C7 9.23858 9.23858 7 12 7C14.7614 7 17 9.23858 17 12Z\"/></svg>`,\n\t'x-circle-fill': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M12 2C6.47 2 2 6.47 2 12C2 17.53 6.47 22 12 22C17.53 22 22 17.53 22 12C22 6.47 17.53 2 12 2ZM17 15.59L15.59 17L12 13.41L8.41 17L7 15.59L10.59 12L7 8.41L8.41 7L12 10.59L15.59 7L17 8.41L13.41 12L17 15.59Z\"/></svg>`,\n\t'x-lg': `\n\t\t<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\" fill='currentColor'><path d=\"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z\"/></svg>`\n};\n// **End system icons**\n\nconst systemLibrary: IconLibrary = {\n name: 'system',\n resolver: (name: keyof typeof icons) => {\n if (name in icons) {\n return `data:image/svg+xml,${encodeURIComponent(icons[name])}`;\n }\n return '';\n }\n};\n\nexport default systemLibrary;\n"],
5
+ "mappings": ";AAWA,IAAM,QAAQ;AAAA,EACb,OAAO;AAAA;AAAA,EAEP,SAAS;AAAA;AAAA,EAET,SAAS;AAAA;AAAA,EAET,gBAAgB;AAAA;AAAA,EAEhB,aAAa;AAAA;AAAA,EAEb,OAAO;AAAA;AAAA,EAEP,iBAAiB;AAAA;AAAA,EAEjB,SAAS;AAAA;AAAA,EAET,iBAAiB;AAAA;AAAA,EAEjB,QAAQ;AAAA;AAET;AAGA,IAAM,gBAA6B;AAAA,EACjC,MAAM;AAAA,EACN,UAAU,CAAC,SAA6B;AACtC,QAAI,QAAQ,OAAO;AACjB,aAAO,sBAAsB,mBAAmB,MAAM,IAAI,CAAC,CAAC;AAAA,IAC9D;AACA,WAAO;AAAA,EACT;AACF;AAEA,IAAO,yBAAQ;",
6
+ "names": []
7
+ }
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk.JBYBQ5TQ.js";
4
4
  import {
5
5
  SynIcon
6
- } from "./chunk.VM64SQGC.js";
6
+ } from "./chunk.QFYXBNOQ.js";
7
7
  import {
8
8
  watch
9
9
  } from "./chunk.VZ7S7YYN.js";
10
10
  import {
11
11
  SynergyElement
12
- } from "./chunk.V52P6M55.js";
12
+ } from "./chunk.RWQLSIO7.js";
13
13
  import {
14
14
  __decorateClass
15
15
  } from "./chunk.DJOAQ4JU.js";
@@ -108,4 +108,4 @@ __decorateClass([
108
108
  export {
109
109
  SynRadio
110
110
  };
111
- //# sourceMappingURL=chunk.OUVIH6QL.js.map
111
+ //# sourceMappingURL=chunk.6PUYPXNC.js.map
@@ -6,6 +6,7 @@ import {
6
6
  // src/internal/form.ts
7
7
  var formCollections = /* @__PURE__ */ new WeakMap();
8
8
  var reportValidityOverloads = /* @__PURE__ */ new WeakMap();
9
+ var checkValidityOverloads = /* @__PURE__ */ new WeakMap();
9
10
  var userInteractedControls = /* @__PURE__ */ new WeakSet();
10
11
  var interactions = /* @__PURE__ */ new WeakMap();
11
12
  var FormControlController = class {
@@ -53,6 +54,19 @@ var FormControlController = class {
53
54
  this.setUserInteracted(this.host, true);
54
55
  }
55
56
  };
57
+ this.checkFormValidity = () => {
58
+ if (this.form && !this.form.noValidate) {
59
+ const elements = this.form.querySelectorAll("*");
60
+ for (const element of elements) {
61
+ if (typeof element.checkValidity === "function") {
62
+ if (!element.checkValidity()) {
63
+ return false;
64
+ }
65
+ }
66
+ }
67
+ }
68
+ return true;
69
+ };
56
70
  this.reportFormValidity = () => {
57
71
  if (this.form && !this.form.noValidate) {
58
72
  const elements = this.form.querySelectorAll("*");
@@ -69,11 +83,12 @@ var FormControlController = class {
69
83
  (this.host = host).addController(this);
70
84
  this.options = __spreadValues({
71
85
  form: (input) => {
72
- if (input.hasAttribute("form") && input.getAttribute("form") !== "") {
86
+ const formId = input.form;
87
+ if (formId) {
73
88
  const root = input.getRootNode();
74
- const formId = input.getAttribute("form");
75
- if (formId) {
76
- return root.getElementById(formId);
89
+ const form = root.getElementById(formId);
90
+ if (form) {
91
+ return form;
77
92
  }
78
93
  }
79
94
  return input.closest("form");
@@ -86,6 +101,7 @@ var FormControlController = class {
86
101
  return (_a = input.disabled) != null ? _a : false;
87
102
  },
88
103
  reportValidity: (input) => typeof input.reportValidity === "function" ? input.reportValidity() : true,
104
+ checkValidity: (input) => typeof input.checkValidity === "function" ? input.checkValidity() : true,
89
105
  setValue: (input, value) => input.value = value,
90
106
  assumeInteractionOn: ["syn-input"]
91
107
  }, options);
@@ -135,14 +151,23 @@ var FormControlController = class {
135
151
  reportValidityOverloads.set(this.form, this.form.reportValidity);
136
152
  this.form.reportValidity = () => this.reportFormValidity();
137
153
  }
154
+ if (!checkValidityOverloads.has(this.form)) {
155
+ checkValidityOverloads.set(this.form, this.form.checkValidity);
156
+ this.form.checkValidity = () => this.checkFormValidity();
157
+ }
138
158
  } else {
139
159
  this.form = void 0;
140
160
  }
141
161
  }
142
162
  detachForm() {
143
- var _a;
144
- if (this.form) {
145
- (_a = formCollections.get(this.form)) == null ? void 0 : _a.delete(this.host);
163
+ if (!this.form)
164
+ return;
165
+ const formCollection = formCollections.get(this.form);
166
+ if (!formCollection) {
167
+ return;
168
+ }
169
+ formCollection.delete(this.host);
170
+ if (formCollection.size <= 0) {
146
171
  this.form.removeEventListener("formdata", this.handleFormData);
147
172
  this.form.removeEventListener("submit", this.handleFormSubmit);
148
173
  this.form.removeEventListener("reset", this.handleFormReset);
@@ -150,8 +175,12 @@ var FormControlController = class {
150
175
  this.form.reportValidity = reportValidityOverloads.get(this.form);
151
176
  reportValidityOverloads.delete(this.form);
152
177
  }
178
+ if (checkValidityOverloads.has(this.form)) {
179
+ this.form.checkValidity = checkValidityOverloads.get(this.form);
180
+ checkValidityOverloads.delete(this.form);
181
+ }
182
+ this.form = void 0;
153
183
  }
154
- this.form = void 0;
155
184
  }
156
185
  setUserInteracted(el, hasInteracted) {
157
186
  if (hasInteracted) {
@@ -272,4 +301,4 @@ export {
272
301
  valueMissingValidityState,
273
302
  customErrorValidityState
274
303
  };
275
- //# sourceMappingURL=chunk.P2LNG2PZ.js.map
304
+ //# sourceMappingURL=chunk.AMTCNRDE.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/form.ts"],
4
+ "sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\nimport type { SynergyFormControl } from '../internal/synergy-element.js';\nimport type SynButton from '../components/button/button.js';\n\n//\n// We store a WeakMap of forms + controls so we can keep references to all Synergy controls within a given form. As\n// elements connect and disconnect to/from the DOM, their containing form is used as the key and the form control is\n// added and removed from the form's set, respectively.\n//\nexport const formCollections: WeakMap<HTMLFormElement, Set<SynergyFormControl>> = new WeakMap();\n\n//\n// We store a WeakMap of reportValidity() overloads so we can override it when form controls connect to the DOM and\n// restore the original behavior when they disconnect.\n//\nconst reportValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\nconst checkValidityOverloads: WeakMap<HTMLFormElement, () => boolean> = new WeakMap();\n\n//\n// We store a Set of controls that users have interacted with. This allows us to determine the interaction state\n// without littering the DOM with additional data attributes.\n//\nconst userInteractedControls: WeakSet<SynergyFormControl> = new WeakSet();\n\n//\n// We store a WeakMap of interactions for each form control so we can track when all conditions are met for validation.\n//\nconst interactions = new WeakMap<SynergyFormControl, string[]>();\n\nexport interface FormControlControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: SynergyFormControl) => HTMLFormElement | null;\n /** A function that returns the form control's name, which will be submitted with the form data. */\n name: (input: SynergyFormControl) => string;\n /** A function that returns the form control's current value. */\n value: (input: SynergyFormControl) => unknown | unknown[];\n /** A function that returns the form control's default value. */\n defaultValue: (input: SynergyFormControl) => unknown | unknown[];\n /** A function that returns the form control's current disabled state. If disabled, the value won't be submitted. */\n disabled: (input: SynergyFormControl) => boolean;\n /**\n * A function that maps to the form control's reportValidity() function. When the control is invalid, this will\n * prevent submission and trigger the browser's constraint violation warning.\n */\n reportValidity: (input: SynergyFormControl) => boolean;\n\n /**\n * A function that maps to the form control's `checkValidity()` function. When the control is invalid, this will return false.\n * this is helpful is you want to check validation without triggering the native browser constraint violation warning.\n */\n checkValidity: (input: SynergyFormControl) => boolean;\n /** A function that sets the form control's value */\n setValue: (input: SynergyFormControl, value: unknown) => void;\n /**\n * An array of event names to listen to. When all events in the list are emitted, the control will receive validity\n * states such as user-valid and user-invalid.user interacted validity states. */\n assumeInteractionOn: string[];\n}\n\n/** A reactive controller to allow form controls to participate in form submission, validation, etc. */\nexport class FormControlController implements ReactiveController {\n host: SynergyFormControl & ReactiveControllerHost;\n form?: HTMLFormElement | null;\n options: FormControlControllerOptions;\n\n constructor(host: ReactiveControllerHost & SynergyFormControl, options?: Partial<FormControlControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: input => {\n // If there's a form attribute, use it to find the target form by id\n // Controls may not always reflect the 'form' property. For example, `<syn-button>` doesn't reflect.\n const formId = input.form;\n\n if (formId) {\n const root = input.getRootNode() as Document | ShadowRoot;\n\n const form = root.getElementById(formId);\n\n if (form) {\n return form as HTMLFormElement;\n }\n }\n\n return input.closest('form');\n },\n name: input => input.name,\n value: input => input.value,\n defaultValue: input => input.defaultValue,\n disabled: input => input.disabled ?? false,\n reportValidity: input => (typeof input.reportValidity === 'function' ? input.reportValidity() : true),\n checkValidity: input => (typeof input.checkValidity === 'function' ? input.checkValidity() : true),\n setValue: (input, value: string) => (input.value = value),\n assumeInteractionOn: ['syn-input'],\n ...options\n };\n }\n\n hostConnected() {\n const form = this.options.form(this.host);\n\n if (form) {\n this.attachForm(form);\n }\n\n // Listen for interactions\n interactions.set(this.host, []);\n this.options.assumeInteractionOn.forEach(event => {\n this.host.addEventListener(event, this.handleInteraction);\n });\n }\n\n hostDisconnected() {\n this.detachForm();\n\n // Clean up interactions\n interactions.delete(this.host);\n this.options.assumeInteractionOn.forEach(event => {\n this.host.removeEventListener(event, this.handleInteraction);\n });\n }\n\n hostUpdated() {\n const form = this.options.form(this.host);\n\n // Detach if the form no longer exists\n if (!form) {\n this.detachForm();\n }\n\n // If the form has changed, reattach it\n if (form && this.form !== form) {\n this.detachForm();\n this.attachForm(form);\n }\n\n if (this.host.hasUpdated) {\n this.setValidity(this.host.validity.valid);\n }\n }\n\n private attachForm(form?: HTMLFormElement) {\n if (form) {\n this.form = form;\n\n // Add this element to the form's collection\n if (formCollections.has(this.form)) {\n formCollections.get(this.form)!.add(this.host);\n } else {\n formCollections.set(this.form, new Set<SynergyFormControl>([this.host]));\n }\n\n this.form.addEventListener('formdata', this.handleFormData);\n this.form.addEventListener('submit', this.handleFormSubmit);\n this.form.addEventListener('reset', this.handleFormReset);\n\n // Overload the form's reportValidity() method so it looks at Synergy form controls\n if (!reportValidityOverloads.has(this.form)) {\n reportValidityOverloads.set(this.form, this.form.reportValidity);\n this.form.reportValidity = () => this.reportFormValidity();\n }\n\n // Overload the form's checkValidity() method so it looks at Synergy form controls\n if (!checkValidityOverloads.has(this.form)) {\n checkValidityOverloads.set(this.form, this.form.checkValidity);\n this.form.checkValidity = () => this.checkFormValidity();\n }\n } else {\n this.form = undefined;\n }\n }\n\n private detachForm() {\n if (!this.form) return;\n\n const formCollection = formCollections.get(this.form);\n\n if (!formCollection) {\n return;\n }\n\n // Remove this host from the form's collection\n formCollection.delete(this.host);\n\n // Check to make sure there's no other form controls in the collection. If we do this\n // without checking if any other controls are still in the collection, then we will wipe out the\n // validity checks for all other elements.\n // see: https://github.com/synergy-design-system/synergy/issues/1703\n if (formCollection.size <= 0) {\n this.form.removeEventListener('formdata', this.handleFormData);\n this.form.removeEventListener('submit', this.handleFormSubmit);\n this.form.removeEventListener('reset', this.handleFormReset);\n\n // Remove the overload and restore the original method\n if (reportValidityOverloads.has(this.form)) {\n this.form.reportValidity = reportValidityOverloads.get(this.form)!;\n reportValidityOverloads.delete(this.form);\n }\n\n if (checkValidityOverloads.has(this.form)) {\n this.form.checkValidity = checkValidityOverloads.get(this.form)!;\n checkValidityOverloads.delete(this.form);\n }\n\n // So it looks weird here to not always set the form to undefined. But I _think_ if we unattach this.form here,\n // we end up in this fun spot where future validity checks don't have a reference to the form validity handler.\n // First form element in sets the validity handler. So we can't clean up `this.form` until there are no other form elements in the form.\n this.form = undefined;\n }\n }\n\n private handleFormData = (event: FormDataEvent) => {\n const disabled = this.options.disabled(this.host);\n const name = this.options.name(this.host);\n const value = this.options.value(this.host);\n\n // For buttons, we only submit the value if they were the submitter. This is currently done in doAction() by\n // injecting the name/value on a temporary button, so we can just skip them here.\n const isButton = this.host.tagName.toLowerCase() === 'syn-button';\n\n if (!disabled && !isButton && typeof name === 'string' && name.length > 0 && typeof value !== 'undefined') {\n if (Array.isArray(value)) {\n (value as unknown[]).forEach(val => {\n event.formData.append(name, (val as string | number | boolean).toString());\n });\n } else {\n event.formData.append(name, (value as string | number | boolean).toString());\n }\n }\n };\n\n private handleFormSubmit = (event: Event) => {\n const disabled = this.options.disabled(this.host);\n const reportValidity = this.options.reportValidity;\n\n // Update the interacted state for all controls when the form is submitted\n if (this.form && !this.form.noValidate) {\n formCollections.get(this.form)?.forEach(control => {\n this.setUserInteracted(control, true);\n });\n }\n\n if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n private handleFormReset = () => {\n this.options.setValue(this.host, this.options.defaultValue(this.host));\n this.setUserInteracted(this.host, false);\n interactions.set(this.host, []);\n };\n\n private handleInteraction = (event: Event) => {\n const emittedEvents = interactions.get(this.host)!;\n\n if (!emittedEvents.includes(event.type)) {\n emittedEvents.push(event.type);\n }\n\n // Mark it as user-interacted as soon as all associated events have been emitted\n if (emittedEvents.length === this.options.assumeInteractionOn.length) {\n this.setUserInteracted(this.host, true);\n }\n };\n\n private checkFormValidity = () => {\n //\n // This is very similar to the `reportFormValidity` function, but it does not trigger native constraint validation\n // Allow the user to simply check if the form is valid and handling validity in their own way.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Synergy inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>('*');\n\n for (const element of elements) {\n if (typeof element.checkValidity === 'function') {\n if (!element.checkValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n };\n\n private reportFormValidity = () => {\n //\n // Synergy form controls work hard to act like regular form controls. They support the Constraint Validation API\n // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also\n // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using\n // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.\n //\n // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger\n // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't\n // be necessary once we can use ElementInternals.\n //\n // Note that we're also honoring the form's novalidate attribute.\n //\n if (this.form && !this.form.noValidate) {\n // This seems sloppy, but checking all elements will cover native inputs, Synergy inputs, and other custom\n // elements that support the constraint validation API.\n const elements = this.form.querySelectorAll<HTMLInputElement>('*');\n\n for (const element of elements) {\n if (typeof element.reportValidity === 'function') {\n if (!element.reportValidity()) {\n return false;\n }\n }\n }\n }\n\n return true;\n };\n\n private setUserInteracted(el: SynergyFormControl, hasInteracted: boolean) {\n if (hasInteracted) {\n userInteractedControls.add(el);\n } else {\n userInteractedControls.delete(el);\n }\n\n el.requestUpdate();\n }\n\n private doAction(type: 'submit' | 'reset', submitter?: HTMLInputElement | SynButton) {\n if (this.form) {\n const button = document.createElement('button');\n button.type = type;\n button.style.position = 'absolute';\n button.style.width = '0';\n button.style.height = '0';\n button.style.clipPath = 'inset(50%)';\n button.style.overflow = 'hidden';\n button.style.whiteSpace = 'nowrap';\n\n // Pass name, value, and form attributes through to the temporary button\n if (submitter) {\n button.name = submitter.name;\n button.value = submitter.value;\n\n ['formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => {\n if (submitter.hasAttribute(attr)) {\n button.setAttribute(attr, submitter.getAttribute(attr)!);\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Returns the associated `<form>` element, if one exists. */\n getForm() {\n return this.form ?? null;\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(submitter?: HTMLInputElement | SynButton) {\n this.doAction('reset', submitter);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(submitter?: HTMLInputElement | SynButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction('submit', submitter);\n }\n\n /**\n * Synchronously sets the form control's validity. Call this when you know the future validity but need to update\n * the host element immediately, i.e. before Lit updates the component in the next update.\n */\n setValidity(isValid: boolean) {\n const host = this.host;\n const hasInteracted = Boolean(userInteractedControls.has(host));\n const required = Boolean(host.required);\n\n //\n // We're mapping the following \"states\" to data attributes. In the future, we can use ElementInternals.states to\n // create a similar mapping, but instead of [data-invalid] it will look like :--invalid.\n //\n // See this RFC for more details: https://github.com/synergy-design-system/synergy/issues/1011\n //\n host.toggleAttribute('data-required', required);\n host.toggleAttribute('data-optional', !required);\n host.toggleAttribute('data-invalid', !isValid);\n host.toggleAttribute('data-valid', isValid);\n host.toggleAttribute('data-user-invalid', !isValid && hasInteracted);\n host.toggleAttribute('data-user-valid', isValid && hasInteracted);\n }\n\n /**\n * Updates the form control's validity based on the current value of `host.validity.valid`. Call this when anything\n * that affects constraint validation changes so the component receives the correct validity states.\n */\n updateValidity() {\n const host = this.host;\n this.setValidity(host.validity.valid);\n }\n\n /**\n * Dispatches a non-bubbling, cancelable custom event of type `syn-invalid`.\n * If the `syn-invalid` event will be cancelled then the original `invalid`\n * event (which may have been passed as argument) will also be cancelled.\n * If no original `invalid` event has been passed then the `syn-invalid`\n * event will be cancelled before being dispatched.\n */\n emitInvalidEvent(originalInvalidEvent?: Event) {\n const slInvalidEvent = new CustomEvent<Record<PropertyKey, never>>('syn-invalid', {\n bubbles: false,\n composed: false,\n cancelable: true,\n detail: {}\n });\n\n if (!originalInvalidEvent) {\n slInvalidEvent.preventDefault();\n }\n\n if (!this.host.dispatchEvent(slInvalidEvent)) {\n originalInvalidEvent?.preventDefault();\n }\n }\n}\n\n/*\n * Predefined common validity states.\n * All of them are read-only.\n */\n\n// A validity state object that represents `valid`\nexport const validValidityState: ValidityState = Object.freeze({\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: true,\n valueMissing: false\n});\n\n// A validity state object that represents `value missing`\nexport const valueMissingValidityState: ValidityState = Object.freeze({\n ...validValidityState,\n valid: false,\n valueMissing: true\n});\n\n// A validity state object that represents a custom error\nexport const customErrorValidityState: ValidityState = Object.freeze({\n ...validValidityState,\n valid: false,\n customError: true\n});\n"],
5
+ "mappings": ";;;;;;AAeO,IAAM,kBAAqE,oBAAI,QAAQ;AAM9F,IAAM,0BAAmE,oBAAI,QAAQ;AACrF,IAAM,yBAAkE,oBAAI,QAAQ;AAMpF,IAAM,yBAAsD,oBAAI,QAAQ;AAKxE,IAAM,eAAe,oBAAI,QAAsC;AAiCxD,IAAM,wBAAN,MAA0D;AAAA,EAK/D,YAAY,MAAmD,SAAiD;AAiJhH,SAAQ,iBAAiB,CAAC,UAAyB;AACjD,YAAM,WAAW,KAAK,QAAQ,SAAS,KAAK,IAAI;AAChD,YAAM,OAAO,KAAK,QAAQ,KAAK,KAAK,IAAI;AACxC,YAAM,QAAQ,KAAK,QAAQ,MAAM,KAAK,IAAI;AAI1C,YAAM,WAAW,KAAK,KAAK,QAAQ,YAAY,MAAM;AAErD,UAAI,CAAC,YAAY,CAAC,YAAY,OAAO,SAAS,YAAY,KAAK,SAAS,KAAK,OAAO,UAAU,aAAa;AACzG,YAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAC,MAAoB,QAAQ,SAAO;AAClC,kBAAM,SAAS,OAAO,MAAO,IAAkC,SAAS,CAAC;AAAA,UAC3E,CAAC;AAAA,QACH,OAAO;AACL,gBAAM,SAAS,OAAO,MAAO,MAAoC,SAAS,CAAC;AAAA,QAC7E;AAAA,MACF;AAAA,IACF;AAEA,S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SAAS;AAAA,MACT,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,QAAQ,CAAC;AAAA,IACX,CAAC;AAED,QAAI,CAAC,sBAAsB;AACzB,qBAAe,eAAe;AAAA,IAChC;AAEA,QAAI,CAAC,KAAK,KAAK,cAAc,cAAc,GAAG;AAC5C,mEAAsB;AAAA,IACxB;AAAA,EACF;AACF;AAQO,IAAM,qBAAoC,OAAO,OAAO;AAAA,EAC7D,UAAU;AAAA,EACV,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,SAAS;AAAA,EACT,UAAU;AAAA,EACV,cAAc;AAAA,EACd,OAAO;AAAA,EACP,cAAc;AAChB,CAAC;AAGM,IAAM,4BAA2C,OAAO,OAAO,iCACjE,qBADiE;AAAA,EAEpE,OAAO;AAAA,EACP,cAAc;AAChB,EAAC;AAGM,IAAM,2BAA0C,OAAO,OAAO,iCAChE,qBADgE;AAAA,EAEnE,OAAO;AAAA,EACP,aAAa;AACf,EAAC;",
6
+ "names": []
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynTextarea
3
- } from "./chunk.QAPZLSEL.js";
3
+ } from "./chunk.TGO3Z3HP.js";
4
4
 
5
5
  // src/components/textarea/textarea.ts
6
6
  var textarea_default = SynTextarea;
@@ -9,4 +9,4 @@ SynTextarea.define("syn-textarea");
9
9
  export {
10
10
  textarea_default
11
11
  };
12
- //# sourceMappingURL=chunk.NGM2Y5G5.js.map
12
+ //# sourceMappingURL=chunk.B2WRX32I.js.map
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk.QHFGD6WW.js";
4
4
  import {
5
5
  SynIconButton
6
- } from "./chunk.R3CMRBZ7.js";
6
+ } from "./chunk.RLLBOQ6V.js";
7
7
  import {
8
8
  LocalizeController
9
- } from "./chunk.R6VNLE6N.js";
9
+ } from "./chunk.LAB4YJYE.js";
10
10
  import {
11
11
  SynergyElement
12
- } from "./chunk.V52P6M55.js";
12
+ } from "./chunk.RWQLSIO7.js";
13
13
  import {
14
14
  __decorateClass
15
15
  } from "./chunk.DJOAQ4JU.js";
@@ -72,4 +72,4 @@ __decorateClass([
72
72
  export {
73
73
  SynTag
74
74
  };
75
- //# sourceMappingURL=chunk.2D7KJSSX.js.map
75
+ //# sourceMappingURL=chunk.BLHHZJQD.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynRadioButton
3
- } from "./chunk.5ILVVLJF.js";
3
+ } from "./chunk.S74LATRZ.js";
4
4
 
5
5
  // src/components/radio-button/radio-button.ts
6
6
  var radio_button_default = SynRadioButton;
@@ -9,4 +9,4 @@ SynRadioButton.define("syn-radio-button");
9
9
  export {
10
10
  radio_button_default
11
11
  };
12
- //# sourceMappingURL=chunk.U5AOTLVK.js.map
12
+ //# sourceMappingURL=chunk.CZXYQ2WN.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynTag
3
- } from "./chunk.2D7KJSSX.js";
3
+ } from "./chunk.BLHHZJQD.js";
4
4
 
5
5
  // src/components/tag/tag.ts
6
6
  var tag_default = SynTag;
@@ -9,4 +9,4 @@ SynTag.define("syn-tag");
9
9
  export {
10
10
  tag_default
11
11
  };
12
- //# sourceMappingURL=chunk.MTGT2EG5.js.map
12
+ //# sourceMappingURL=chunk.D63ANHR2.js.map
@@ -9,19 +9,19 @@ import {
9
9
  } from "./chunk.XGXFE6IF.js";
10
10
  import {
11
11
  LocalizeController
12
- } from "./chunk.R6VNLE6N.js";
12
+ } from "./chunk.LAB4YJYE.js";
13
13
  import {
14
14
  FormControlController
15
- } from "./chunk.P2LNG2PZ.js";
15
+ } from "./chunk.AMTCNRDE.js";
16
16
  import {
17
17
  SynIcon
18
- } from "./chunk.VM64SQGC.js";
18
+ } from "./chunk.QFYXBNOQ.js";
19
19
  import {
20
20
  watch
21
21
  } from "./chunk.VZ7S7YYN.js";
22
22
  import {
23
23
  SynergyElement
24
- } from "./chunk.V52P6M55.js";
24
+ } from "./chunk.RWQLSIO7.js";
25
25
  import {
26
26
  __decorateClass
27
27
  } from "./chunk.DJOAQ4JU.js";
@@ -477,4 +477,4 @@ __decorateClass([
477
477
  export {
478
478
  SynInput
479
479
  };
480
- //# sourceMappingURL=chunk.S6PKR3AN.js.map
480
+ //# sourceMappingURL=chunk.G6VDIPNQ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynIcon
3
- } from "./chunk.VM64SQGC.js";
3
+ } from "./chunk.QFYXBNOQ.js";
4
4
 
5
5
  // src/components/icon/icon.ts
6
6
  var icon_default = SynIcon;
@@ -9,4 +9,4 @@ SynIcon.define("syn-icon");
9
9
  export {
10
10
  icon_default
11
11
  };
12
- //# sourceMappingURL=chunk.R3S3AGUF.js.map
12
+ //# sourceMappingURL=chunk.GHDB3G7H.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynRadio
3
- } from "./chunk.OUVIH6QL.js";
3
+ } from "./chunk.6PUYPXNC.js";
4
4
 
5
5
  // src/components/radio/radio.ts
6
6
  var radio_default = SynRadio;
@@ -9,4 +9,4 @@ SynRadio.define("syn-radio");
9
9
  export {
10
10
  radio_default
11
11
  };
12
- //# sourceMappingURL=chunk.UYF5MTOU.js.map
12
+ //# sourceMappingURL=chunk.H2CKSKRW.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  formCollections
3
- } from "./chunk.P2LNG2PZ.js";
3
+ } from "./chunk.AMTCNRDE.js";
4
4
 
5
5
  // src/utilities/form.ts
6
6
  function serialize(form) {
@@ -39,4 +39,4 @@ export {
39
39
  serialize,
40
40
  getFormControls
41
41
  };
42
- //# sourceMappingURL=chunk.Z3RZUTQU.js.map
42
+ //# sourceMappingURL=chunk.HG5QC5EW.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk.6C4JXZZN.js";
4
4
  import {
5
5
  library_system_default
6
- } from "./chunk.EJXWL3JM.js";
6
+ } from "./chunk.5AAIHRMI.js";
7
7
 
8
8
  // src/components/icon/library.ts
9
9
  var registry = [library_default_default, library_system_default];
@@ -42,4 +42,4 @@ export {
42
42
  registerIconLibrary,
43
43
  unregisterIconLibrary
44
44
  };
45
- //# sourceMappingURL=chunk.6PFQSQLU.js.map
45
+ //# sourceMappingURL=chunk.JRXQK6LG.js.map
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk.N2I6HVX3.js";
4
4
  import {
5
5
  LocalizeController
6
- } from "./chunk.R6VNLE6N.js";
6
+ } from "./chunk.LAB4YJYE.js";
7
7
  import {
8
8
  SynergyElement
9
- } from "./chunk.V52P6M55.js";
9
+ } from "./chunk.RWQLSIO7.js";
10
10
 
11
11
  // src/components/spinner/spinner.component.ts
12
12
  import { html } from "lit";
@@ -29,4 +29,4 @@ SynSpinner.styles = spinner_styles_default;
29
29
  export {
30
30
  SynSpinner
31
31
  };
32
- //# sourceMappingURL=chunk.I4ZBEQUH.js.map
32
+ //# sourceMappingURL=chunk.KZ3AQUHU.js.map
@@ -0,0 +1,16 @@
1
+ import {
2
+ en_default
3
+ } from "./chunk.A3SKDWCT.js";
4
+
5
+ // src/utilities/localize.ts
6
+ import { LocalizeController as DefaultLocalizationController, registerTranslation } from "@shoelace-style/localize";
7
+ import { registerTranslation as registerTranslation2 } from "@shoelace-style/localize";
8
+ var LocalizeController = class extends DefaultLocalizationController {
9
+ };
10
+ registerTranslation(en_default);
11
+
12
+ export {
13
+ LocalizeController,
14
+ registerTranslation2 as registerTranslation
15
+ };
16
+ //# sourceMappingURL=chunk.LAB4YJYE.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utilities/localize.ts"],
4
+ "sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { LocalizeController as DefaultLocalizationController, registerTranslation } from '@shoelace-style/localize';\nimport en from '../translations/en.js'; // Register English as the default/fallback language\nimport type { Translation as DefaultTranslation } from '@shoelace-style/localize';\n\n// Extend the controller and apply our own translation interface for better typings\nexport class LocalizeController extends DefaultLocalizationController<Translation> {\n // Technicallly '../translations/en.js' is supposed to work via side-effects. However, by some mystery sometimes the\n // translations don't get bundled as expected resulting in `no translation found` errors.\n // This is basically some extra assurance that our translations get registered prior to our localizer connecting in a component\n // and we don't rely on implicit import ordering.\n static {\n registerTranslation(en);\n }\n}\n\n// Export functions from the localize lib so we have one central place to import them from\nexport { registerTranslation } from '@shoelace-style/localize';\n\nexport interface Translation extends DefaultTranslation {\n $code: string; // e.g. en, en-GB\n $name: string; // e.g. English, Espa\u00F1ol\n $dir: 'ltr' | 'rtl';\n\n carousel: string;\n clearEntry: string;\n close: string;\n copied: string;\n copy: string;\n currentValue: string;\n error: string;\n goToSlide: (slide: number, count: number) => string;\n hidePassword: string;\n loading: string;\n nextSlide: string;\n numOptionsSelected: (num: number) => string;\n previousSlide: string;\n progress: string;\n remove: string;\n resize: string;\n scrollToEnd: string;\n scrollToStart: string;\n selectAColorFromTheScreen: string;\n showPassword: string;\n slideNum: (slide: number) => string;\n toggleColorFormat: string;\n}\n"],
5
+ "mappings": ";;;;;AAMA,SAAS,sBAAsB,+BAA+B,2BAA2B;AAgBzF,SAAS,uBAAAA,4BAA2B;AAX7B,IAAM,qBAAN,cAAiC,8BAA2C;AAQnF;AAFI,oBAAoB,UAAE;",
6
+ "names": ["registerTranslation"]
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynCheckbox
3
- } from "./chunk.AMHJ56Z3.js";
3
+ } from "./chunk.XOYAL6A7.js";
4
4
 
5
5
  // src/components/checkbox/checkbox.ts
6
6
  var checkbox_default = SynCheckbox;
@@ -9,4 +9,4 @@ SynCheckbox.define("syn-checkbox");
9
9
  export {
10
10
  checkbox_default
11
11
  };
12
- //# sourceMappingURL=chunk.4YSX6HUH.js.map
12
+ //# sourceMappingURL=chunk.O7JATGQ6.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynSwitch
3
- } from "./chunk.DS3H2UY3.js";
3
+ } from "./chunk.YKNLO6A2.js";
4
4
 
5
5
  // src/components/switch/switch.ts
6
6
  var switch_default = SynSwitch;
@@ -9,4 +9,4 @@ SynSwitch.define("syn-switch");
9
9
  export {
10
10
  switch_default
11
11
  };
12
- //# sourceMappingURL=chunk.ZUOBN5Q3.js.map
12
+ //# sourceMappingURL=chunk.QAWYSA72.js.map
@@ -5,13 +5,13 @@ import {
5
5
  getIconLibrary,
6
6
  unwatchIcon,
7
7
  watchIcon
8
- } from "./chunk.6PFQSQLU.js";
8
+ } from "./chunk.JRXQK6LG.js";
9
9
  import {
10
10
  icon_styles_default
11
11
  } from "./chunk.RSONAU45.js";
12
12
  import {
13
13
  SynergyElement
14
- } from "./chunk.V52P6M55.js";
14
+ } from "./chunk.RWQLSIO7.js";
15
15
  import {
16
16
  __decorateClass
17
17
  } from "./chunk.DJOAQ4JU.js";
@@ -172,4 +172,4 @@ __decorateClass([
172
172
  export {
173
173
  SynIcon
174
174
  };
175
- //# sourceMappingURL=chunk.VM64SQGC.js.map
175
+ //# sourceMappingURL=chunk.QFYXBNOQ.js.map
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  SynSpinner
3
- } from "./chunk.I4ZBEQUH.js";
3
+ } from "./chunk.KZ3AQUHU.js";
4
4
  import {
5
5
  HasSlotController
6
6
  } from "./chunk.XGXFE6IF.js";
7
7
  import {
8
8
  LocalizeController
9
- } from "./chunk.R6VNLE6N.js";
9
+ } from "./chunk.LAB4YJYE.js";
10
10
  import {
11
11
  FormControlController,
12
12
  validValidityState
13
- } from "./chunk.P2LNG2PZ.js";
13
+ } from "./chunk.AMTCNRDE.js";
14
14
  import {
15
15
  SynIcon
16
- } from "./chunk.VM64SQGC.js";
16
+ } from "./chunk.QFYXBNOQ.js";
17
17
  import {
18
18
  watch
19
19
  } from "./chunk.VZ7S7YYN.js";
20
20
  import {
21
21
  SynergyElement
22
- } from "./chunk.V52P6M55.js";
22
+ } from "./chunk.RWQLSIO7.js";
23
23
  import {
24
24
  button_styles_default
25
25
  } from "./chunk.VG7NKBOV.js";
@@ -36,14 +36,6 @@ var SynButton = class extends SynergyElement {
36
36
  constructor() {
37
37
  super(...arguments);
38
38
  this.formControlController = new FormControlController(this, {
39
- form: (input) => {
40
- if (input.hasAttribute("form")) {
41
- const doc = input.getRootNode();
42
- const formId = input.getAttribute("form");
43
- return doc.getElementById(formId);
44
- }
45
- return input.closest("form");
46
- },
47
39
  assumeInteractionOn: ["click"]
48
40
  });
49
41
  this.hasSlotController = new HasSlotController(this, "[default]", "prefix", "suffix");
@@ -277,4 +269,4 @@ __decorateClass([
277
269
  export {
278
270
  SynButton
279
271
  };
280
- //# sourceMappingURL=chunk.MM2HMAE6.js.map
272
+ //# sourceMappingURL=chunk.R6E3TWR3.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/button/button.component.ts"],
4
+ "sourcesContent": ["// ---------------------------------------------------------------------\n// \uD83D\uDD12 AUTOGENERATED BY VENDORISM\n// Removing this comment will prevent it from being managed by it.\n// ---------------------------------------------------------------------\n\n/* eslint-disable */\nimport { classMap } from 'lit/directives/class-map.js';\nimport { FormControlController, validValidityState } from '../../internal/form.js';\nimport { HasSlotController } from '../../internal/slot.js';\nimport { html, literal } from 'lit/static-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { LocalizeController } from '../../utilities/localize.js';\nimport { property, query, state } from 'lit/decorators.js';\nimport { watch } from '../../internal/watch.js';\nimport SynergyElement from '../../internal/synergy-element.js';\nimport SynIcon from '../icon/icon.component.js';\nimport SynSpinner from '../spinner/spinner.component.js';\nimport styles from './button.styles.js';\nimport type { CSSResultGroup } from 'lit';\nimport type { SynergyFormControl } from '../../internal/synergy-element.js';\n\n/**\n * @summary Buttons represent actions that are available to the user.\n * @documentation https://synergy.style/components/button\n * @status stable\n * @since 2.0\n *\n * @dependency syn-icon\n * @dependency syn-spinner\n *\n * @event syn-blur - Emitted when the button loses focus.\n * @event syn-focus - Emitted when the button gains focus.\n * @event syn-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.\n *\n * @slot - The button's label.\n * @slot prefix - A presentational prefix icon or similar element.\n * @slot suffix - A presentational suffix icon or similar element.\n *\n * @csspart base - The component's base wrapper.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart label - The button's label.\n * @csspart suffix - The container that wraps the suffix.\n * @csspart caret - The button's caret icon, an `<syn-icon>` element.\n * @csspart spinner - The spinner that shows when the button is in the loading state.\n */\nexport default class SynButton extends SynergyElement implements SynergyFormControl {\n static styles: CSSResultGroup = styles;\n static dependencies = {\n 'syn-icon': SynIcon,\n 'syn-spinner': SynSpinner\n };\n\n private readonly formControlController = new FormControlController(this, {\n assumeInteractionOn: ['click']\n });\n\n private readonly hasSlotController = new HasSlotController(this, '[default]', 'prefix', 'suffix');\n private readonly localize = new LocalizeController(this);\n\n @query('.button') button: HTMLButtonElement | HTMLLinkElement;\n\n @state() private hasFocus = false;\n @state() invalid = false;\n @property() title = ''; // make reactive to pass through\n\n /** The button's theme variant. */\n @property({ reflect: true }) variant: 'filled' | 'outline' | 'text' = 'outline';\n\n /** The button's size. */\n @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /** Draws the button with a caret. Used to indicate that the button triggers a dropdown menu or similar behavior. */\n @property({ type: Boolean, reflect: true }) caret = false;\n\n /** Disables the button. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Draws the button in a loading state. */\n @property({ type: Boolean, reflect: true }) loading = false;\n\n /**\n * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native\n * `<button>` elements behave. When the type is `submit`, the button will submit the surrounding form.\n */\n @property() type: 'button' | 'submit' | 'reset' = 'button';\n\n /**\n * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter.\n * This attribute is ignored when `href` is present.\n */\n @property() name = '';\n\n /**\n * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this\n * button is the submitter. This attribute is ignored when `href` is present.\n */\n @property() value = '';\n\n /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */\n @property() href = '';\n\n /** Tells the browser where to open the link. Only used when `href` is present. */\n @property() target: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * When using `href`, this attribute will map to the underlying link's `rel` attribute. Unlike regular links, the\n * default is `noreferrer noopener` to prevent security exploits. However, if you're using `target` to point to a\n * specific tab/window, this will prevent that from working correctly. You can remove or change the default value by\n * setting the attribute to an empty string or a value of your choice, respectively.\n */\n @property() rel = 'noreferrer noopener';\n\n /** Tells the browser to download the linked file as this filename. Only used when `href` is present. */\n @property() download?: string;\n\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property() form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ attribute: 'formaction' }) formAction: string;\n\n /** Used to override the form owner's `enctype` attribute. */\n @property({ attribute: 'formenctype' })\n formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';\n\n /** Used to override the form owner's `method` attribute. */\n @property({ attribute: 'formmethod' }) formMethod: 'post' | 'get';\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: 'formnovalidate', type: Boolean }) formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ attribute: 'formtarget' }) formTarget: '_self' | '_blank' | '_parent' | '_top' | string;\n\n /** Gets the validity state object */\n get validity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).validity;\n }\n\n return validValidityState;\n }\n\n /** Gets the validation message */\n get validationMessage() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).validationMessage;\n }\n\n return '';\n }\n\n firstUpdated() {\n if (this.isButton()) {\n this.formControlController.updateValidity();\n }\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('syn-blur');\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('syn-focus');\n }\n\n private handleClick() {\n if (this.type === 'submit') {\n this.formControlController.submit(this);\n }\n\n if (this.type === 'reset') {\n this.formControlController.reset(this);\n }\n }\n\n private handleInvalid(event: Event) {\n this.formControlController.setValidity(false);\n this.formControlController.emitInvalidEvent(event);\n }\n\n private isButton() {\n return this.href ? false : true;\n }\n\n private isLink() {\n return this.href ? true : false;\n }\n\n @watch('disabled', { waitUntilFirstUpdate: true })\n handleDisabledChange() {\n if (this.isButton()) {\n // Disabled form controls are always valid\n this.formControlController.setValidity(this.disabled);\n }\n }\n\n /** Simulates a click on the button. */\n click() {\n this.button.click();\n }\n\n /** Sets focus on the button. */\n focus(options?: FocusOptions) {\n this.button.focus(options);\n }\n\n /** Removes focus from the button. */\n blur() {\n this.button.blur();\n }\n\n /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */\n checkValidity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).checkValidity();\n }\n\n return true;\n }\n\n /** Gets the associated form, if one exists. */\n getForm(): HTMLFormElement | null {\n return this.formControlController.getForm();\n }\n\n /** Checks for validity and shows the browser's validation message if the control is invalid. */\n reportValidity() {\n if (this.isButton()) {\n return (this.button as HTMLButtonElement).reportValidity();\n }\n\n return true;\n }\n\n /** Sets a custom validation message. Pass an empty string to restore validity. */\n setCustomValidity(message: string) {\n if (this.isButton()) {\n (this.button as HTMLButtonElement).setCustomValidity(message);\n this.formControlController.updateValidity();\n }\n }\n\n render() {\n const isLink = this.isLink();\n const tag = isLink ? literal`a` : literal`button`;\n\n /* eslint-disable lit/no-invalid-html */\n /* eslint-disable lit/binding-positions */\n return html`\n <${tag}\n part=\"base\"\n class=${classMap({\n button: true,\n 'button--primary': true,\n 'button--text': this.variant === 'text',\n 'button--small': this.size === 'small',\n 'button--medium': this.size === 'medium',\n 'button--large': this.size === 'large',\n 'button--caret': this.caret,\n 'button--disabled': this.disabled,\n 'button--focused': this.hasFocus,\n 'button--loading': this.loading,\n 'button--filled': this.variant === 'filled',\n 'button--outline': this.variant === 'outline',\n 'button--rtl': this.localize.dir() === 'rtl',\n 'button--has-label': this.hasSlotController.test('[default]'),\n 'button--has-prefix': this.hasSlotController.test('prefix'),\n 'button--has-suffix': this.hasSlotController.test('suffix')\n })}\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n title=${this.title /* An empty title prevents browser validation tooltips from appearing on hover */}\n name=${ifDefined(isLink ? undefined : this.name)}\n value=${ifDefined(isLink ? undefined : this.value)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink ? this.rel : undefined)}\n role=${ifDefined(isLink ? undefined : 'button')}\n aria-disabled=${this.disabled ? 'true' : 'false'}\n tabindex=${this.disabled ? '-1' : '0'}\n @blur=${this.handleBlur}\n @focus=${this.handleFocus}\n @invalid=${this.isButton() ? this.handleInvalid : null}\n @click=${this.handleClick}\n >\n <slot name=\"prefix\" part=\"prefix\" class=\"button__prefix\"></slot>\n <slot part=\"label\" class=\"button__label\"></slot>\n <slot name=\"suffix\" part=\"suffix\" class=\"button__suffix\"></slot>\n ${\n this.caret ? html` <syn-icon part=\"caret\" class=\"button__caret\" library=\"system\" name=\"caret\"></syn-icon> ` : ''\n }\n ${this.loading ? html`<syn-spinner part=\"spinner\"></syn-spinner>` : ''}\n </${tag}>\n `;\n /* eslint-enable lit/no-invalid-html */\n /* eslint-enable lit/binding-positions */\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAS,gBAAgB;AAGzB,SAAS,MAAM,eAAe;AAC9B,SAAS,iBAAiB;AAE1B,SAAS,UAAU,OAAO,aAAa;AAiCvC,IAAqB,YAArB,cAAuC,eAA6C;AAAA,EAApF;AAAA;AAOE,SAAiB,wBAAwB,IAAI,sBAAsB,MAAM;AAAA,MACvE,qBAAqB,CAAC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E,sBAAsB,KAAK,CAAC;AAAA,GArJ9B,UAsJnB;",
6
+ "names": []
7
+ }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynButton
3
- } from "./chunk.MM2HMAE6.js";
3
+ } from "./chunk.R6E3TWR3.js";
4
4
 
5
5
  // src/components/button/button.ts
6
6
  var button_default = SynButton;
@@ -9,4 +9,4 @@ SynButton.define("syn-button");
9
9
  export {
10
10
  button_default
11
11
  };
12
- //# sourceMappingURL=chunk.LWB5LXJ5.js.map
12
+ //# sourceMappingURL=chunk.RBNQTDFJ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SynButtonGroup
3
- } from "./chunk.AP2QDLP7.js";
3
+ } from "./chunk.VD6GL6QA.js";
4
4
 
5
5
  // src/components/button-group/button-group.ts
6
6
  var button_group_default = SynButtonGroup;
@@ -9,4 +9,4 @@ SynButtonGroup.define("syn-button-group");
9
9
  export {
10
10
  button_group_default
11
11
  };
12
- //# sourceMappingURL=chunk.W5TOVAHB.js.map
12
+ //# sourceMappingURL=chunk.RHBEOZWF.js.map