@synergy-design-system/components 1.0.0-main.3 → 1.0.0-main.4

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 (144) hide show
  1. package/dist/chunks/chunk.2FIY3TX5.js +32 -0
  2. package/dist/chunks/chunk.2FIY3TX5.js.map +7 -0
  3. package/dist/chunks/chunk.5OIEI73E.js +45 -0
  4. package/dist/chunks/chunk.5OIEI73E.js.map +7 -0
  5. package/dist/chunks/chunk.5PZUAKCS.js +202 -0
  6. package/dist/chunks/chunk.5PZUAKCS.js.map +7 -0
  7. package/dist/chunks/chunk.6C4JXZZN.js +15 -0
  8. package/dist/chunks/chunk.6C4JXZZN.js.map +7 -0
  9. package/dist/chunks/chunk.7EGSHKGV.js +12 -0
  10. package/dist/chunks/chunk.7EGSHKGV.js.map +7 -0
  11. package/dist/chunks/chunk.A3SKDWCT.js +42 -0
  12. package/dist/chunks/chunk.A3SKDWCT.js.map +7 -0
  13. package/dist/chunks/chunk.BQPK6UKU.js +498 -0
  14. package/dist/chunks/chunk.BQPK6UKU.js.map +7 -0
  15. package/dist/chunks/chunk.BREU4ILT.js +28 -0
  16. package/dist/chunks/chunk.BREU4ILT.js.map +7 -0
  17. package/dist/chunks/chunk.C7624ITA.js +30 -0
  18. package/dist/chunks/chunk.C7624ITA.js.map +7 -0
  19. package/dist/chunks/chunk.DJOAQ4JU.js +36 -0
  20. package/dist/chunks/chunk.DJOAQ4JU.js.map +7 -0
  21. package/dist/chunks/chunk.DREO4ZTN.js +10 -0
  22. package/dist/chunks/chunk.DREO4ZTN.js.map +7 -0
  23. package/dist/chunks/chunk.EW2JZPYV.js +12 -0
  24. package/dist/chunks/chunk.EW2JZPYV.js.map +7 -0
  25. package/dist/chunks/chunk.FUYWF5Y2.js +278 -0
  26. package/dist/chunks/chunk.FUYWF5Y2.js.map +7 -0
  27. package/dist/chunks/chunk.ILONRPL4.js +10 -0
  28. package/dist/chunks/chunk.ILONRPL4.js.map +7 -0
  29. package/dist/chunks/chunk.N2I6HVX3.js +71 -0
  30. package/dist/chunks/chunk.N2I6HVX3.js.map +7 -0
  31. package/dist/chunks/chunk.O7USYXBT.js +23 -0
  32. package/dist/chunks/chunk.O7USYXBT.js.map +7 -0
  33. package/dist/chunks/chunk.P22LQI5J.js +376 -0
  34. package/dist/chunks/chunk.P22LQI5J.js.map +7 -0
  35. package/dist/chunks/chunk.Q77OTWF2.js +378 -0
  36. package/dist/chunks/chunk.Q77OTWF2.js.map +7 -0
  37. package/dist/chunks/chunk.R6VNLE6N.js +11 -0
  38. package/dist/chunks/chunk.R6VNLE6N.js.map +7 -0
  39. package/dist/chunks/chunk.SLLG4KJR.js +63 -0
  40. package/dist/chunks/chunk.SLLG4KJR.js.map +7 -0
  41. package/dist/chunks/chunk.U7ZJ22QM.js +128 -0
  42. package/dist/chunks/chunk.U7ZJ22QM.js.map +7 -0
  43. package/dist/chunks/chunk.WDCAHRYG.js +273 -0
  44. package/dist/chunks/chunk.WDCAHRYG.js.map +7 -0
  45. package/dist/chunks/chunk.WTCUSH7V.js +42 -0
  46. package/dist/chunks/chunk.WTCUSH7V.js.map +7 -0
  47. package/dist/chunks/chunk.XGXFE6IF.js +49 -0
  48. package/dist/chunks/chunk.XGXFE6IF.js.map +7 -0
  49. package/dist/components/button/button.component.d.ts +123 -0
  50. package/dist/components/button/button.component.js +24 -0
  51. package/dist/components/button/button.component.js.map +7 -0
  52. package/dist/components/button/button.custom.styles.d.ts +2 -0
  53. package/dist/components/button/button.custom.styles.js +8 -0
  54. package/dist/components/button/button.custom.styles.js.map +7 -0
  55. package/dist/components/button/button.d.ts +8 -0
  56. package/dist/components/button/button.js +25 -0
  57. package/dist/components/button/button.js.map +7 -0
  58. package/dist/components/button/button.styles.d.ts +2 -0
  59. package/dist/components/button/button.styles.js +10 -0
  60. package/dist/components/button/button.styles.js.map +7 -0
  61. package/dist/components/checkbox/checkbox.custom.styles.d.ts +2 -0
  62. package/dist/components/checkbox/checkbox.custom.styles.js +11 -0
  63. package/dist/components/checkbox/checkbox.custom.styles.js.map +7 -0
  64. package/dist/components/icon/icon.component.d.ts +42 -0
  65. package/dist/components/icon/icon.component.js +15 -0
  66. package/dist/components/icon/icon.component.js.map +7 -0
  67. package/dist/components/icon/icon.d.ts +8 -0
  68. package/dist/components/icon/icon.js +19 -0
  69. package/dist/components/icon/icon.js.map +7 -0
  70. package/dist/components/icon/icon.styles.d.ts +2 -0
  71. package/dist/components/icon/icon.styles.js +9 -0
  72. package/dist/components/icon/icon.styles.js.map +7 -0
  73. package/dist/components/icon/library.d.ts +19 -0
  74. package/dist/components/icon/library.default.d.ts +3 -0
  75. package/dist/components/icon/library.default.js +9 -0
  76. package/dist/components/icon/library.default.js.map +7 -0
  77. package/dist/components/icon/library.js +19 -0
  78. package/dist/components/icon/library.js.map +7 -0
  79. package/dist/components/icon/library.system.d.ts +3 -0
  80. package/dist/components/icon/library.system.js +8 -0
  81. package/dist/components/icon/library.system.js.map +7 -0
  82. package/dist/components/input/input.component.d.ts +175 -0
  83. package/dist/components/input/input.component.js +22 -0
  84. package/dist/components/input/input.component.js.map +7 -0
  85. package/dist/components/input/input.custom.styles.d.ts +2 -0
  86. package/dist/components/input/input.custom.styles.js +8 -0
  87. package/dist/components/input/input.custom.styles.js.map +7 -0
  88. package/dist/components/input/input.d.ts +8 -0
  89. package/dist/components/input/input.js +23 -0
  90. package/dist/components/input/input.js.map +7 -0
  91. package/dist/components/input/input.styles.d.ts +2 -0
  92. package/dist/components/input/input.styles.js +10 -0
  93. package/dist/components/input/input.styles.js.map +7 -0
  94. package/dist/components/spinner/spinner.component.d.ts +20 -0
  95. package/dist/components/spinner/spinner.component.js +13 -0
  96. package/dist/components/spinner/spinner.component.js.map +7 -0
  97. package/dist/components/spinner/spinner.styles.d.ts +2 -0
  98. package/dist/components/spinner/spinner.styles.js +9 -0
  99. package/dist/components/spinner/spinner.styles.js.map +7 -0
  100. package/dist/components/textarea/textarea.custom.styles.d.ts +2 -0
  101. package/dist/components/textarea/textarea.custom.styles.js +11 -0
  102. package/dist/components/textarea/textarea.custom.styles.js.map +7 -0
  103. package/dist/custom-elements.json +1870 -0
  104. package/dist/events/events.d.ts +8 -0
  105. package/dist/events/syn-blur.d.ts +6 -0
  106. package/dist/events/syn-change.d.ts +6 -0
  107. package/dist/events/syn-clear.d.ts +6 -0
  108. package/dist/events/syn-error.d.ts +8 -0
  109. package/dist/events/syn-focus.d.ts +6 -0
  110. package/dist/events/syn-input.d.ts +6 -0
  111. package/dist/events/syn-invalid.d.ts +6 -0
  112. package/dist/events/syn-load.d.ts +6 -0
  113. package/dist/internal/default-value.d.ts +2 -0
  114. package/dist/internal/form.d.ts +73 -0
  115. package/dist/internal/slot.d.ts +23 -0
  116. package/dist/internal/synergy-element.d.ts +47 -0
  117. package/dist/internal/test/form-control-base-tests.d.ts +7 -0
  118. package/dist/internal/watch.d.ts +26 -0
  119. package/dist/styles/component.styles.d.ts +2 -0
  120. package/dist/styles/form-control.styles.d.ts +2 -0
  121. package/dist/synergy-autoloader.d.ts +4 -0
  122. package/dist/synergy-autoloader.js +41 -0
  123. package/dist/synergy-autoloader.js.map +7 -0
  124. package/dist/synergy.d.ts +4 -0
  125. package/dist/synergy.js +38 -0
  126. package/dist/synergy.js.map +7 -0
  127. package/dist/translations/de.d.ts +3 -0
  128. package/dist/translations/de.js +46 -0
  129. package/dist/translations/de.js.map +7 -0
  130. package/dist/translations/en.d.ts +3 -0
  131. package/dist/translations/en.js +8 -0
  132. package/dist/translations/en.js.map +7 -0
  133. package/dist/utilities/base-path.d.ts +18 -0
  134. package/dist/utilities/base-path.js +10 -0
  135. package/dist/utilities/base-path.js.map +7 -0
  136. package/dist/utilities/form.d.ts +11 -0
  137. package/dist/utilities/form.js +11 -0
  138. package/dist/utilities/form.js.map +7 -0
  139. package/dist/utilities/localize.d.ts +33 -0
  140. package/dist/utilities/localize.js +11 -0
  141. package/dist/utilities/localize.js.map +7 -0
  142. package/dist/vscode.html-custom-data.json +371 -0
  143. package/dist/web-types.json +738 -0
  144. package/package.json +2 -2
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/components/icon/library.system.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 { 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//\nconst icons = {\n caret: `\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n `,\n check: `\n <svg part=\"checked-icon\" class=\"checkbox__icon\" viewBox=\"0 0 16 16\">\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"round\">\n <g stroke=\"currentColor\">\n <g transform=\"translate(3.428571, 3.428571)\">\n <path d=\"M0,5.71428571 L3.42857143,9.14285714\"></path>\n <path d=\"M9.14285714,0 L3.42857143,9.14285714\"></path>\n </g>\n </g>\n </g>\n </svg>\n `,\n 'chevron-down': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-chevron-down\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z\"/>\n </svg>\n `,\n 'chevron-left': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-chevron-left\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z\"/>\n </svg>\n `,\n 'chevron-right': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-chevron-right\" viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z\"/>\n </svg>\n `,\n copy: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-files\" viewBox=\"0 0 16 16\" part=\"svg\">\n <path d=\"M13 0H6a2 2 0 0 0-2 2 2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2 2 2 0 0 0 2-2V2a2 2 0 0 0-2-2zm0 13V4a2 2 0 0 0-2-2H5a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1zM3 4a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4z\"></path>\n </svg>\n `,\n eye: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-eye\" viewBox=\"0 0 16 16\">\n <path d=\"M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z\"/>\n <path d=\"M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z\"/>\n </svg>\n `,\n 'eye-slash': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-eye-slash\" viewBox=\"0 0 16 16\">\n <path d=\"M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z\"/>\n <path d=\"M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z\"/>\n <path d=\"M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12-.708.708z\"/>\n </svg>\n `,\n eyedropper: `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-eyedropper\" viewBox=\"0 0 16 16\">\n <path d=\"M13.354.646a1.207 1.207 0 0 0-1.708 0L8.5 3.793l-.646-.647a.5.5 0 1 0-.708.708L8.293 5l-7.147 7.146A.5.5 0 0 0 1 12.5v1.793l-.854.853a.5.5 0 1 0 .708.707L1.707 15H3.5a.5.5 0 0 0 .354-.146L11 7.707l1.146 1.147a.5.5 0 0 0 .708-.708l-.647-.646 3.147-3.146a1.207 1.207 0 0 0 0-1.708l-2-2zM2 12.707l7-7L10.293 7l-7 7H2v-1.293z\"></path>\n </svg>\n `,\n 'grip-vertical': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-grip-vertical\" viewBox=\"0 0 16 16\">\n <path d=\"M7 2a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM7 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-3 3a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm3 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z\"></path>\n </svg>\n `,\n indeterminate: `\n <svg part=\"indeterminate-icon\" class=\"checkbox__icon\" viewBox=\"0 0 16 16\">\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" stroke-linecap=\"round\">\n <g stroke=\"currentColor\" stroke-width=\"2\">\n <g transform=\"translate(2.285714, 6.857143)\">\n <path d=\"M10.2857143,1.14285714 L1.14285714,1.14285714\"></path>\n </g>\n </g>\n </g>\n </svg>\n `,\n 'person-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-person-fill\" viewBox=\"0 0 16 16\">\n <path d=\"M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z\"/>\n </svg>\n `,\n 'play-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-play-fill\" viewBox=\"0 0 16 16\">\n <path d=\"m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393z\"></path>\n </svg>\n `,\n 'pause-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-pause-fill\" viewBox=\"0 0 16 16\">\n <path d=\"M5.5 3.5A1.5 1.5 0 0 1 7 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5zm5 0A1.5 1.5 0 0 1 12 5v6a1.5 1.5 0 0 1-3 0V5a1.5 1.5 0 0 1 1.5-1.5z\"></path>\n </svg>\n `,\n radio: `\n <svg part=\"checked-icon\" class=\"radio__icon\" viewBox=\"0 0 16 16\">\n <g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g fill=\"currentColor\">\n <circle cx=\"8\" cy=\"8\" r=\"3.42857143\"></circle>\n </g>\n </g>\n </svg>\n `,\n 'star-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-star-fill\" viewBox=\"0 0 16 16\">\n <path d=\"M3.612 15.443c-.386.198-.824-.149-.746-.592l.83-4.73L.173 6.765c-.329-.314-.158-.888.283-.95l4.898-.696L7.538.792c.197-.39.73-.39.927 0l2.184 4.327 4.898.696c.441.062.612.636.282.95l-3.522 3.356.83 4.73c.078.443-.36.79-.746.592L8 13.187l-4.389 2.256z\"/>\n </svg>\n `,\n 'x-lg': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-x-lg\" viewBox=\"0 0 16 16\">\n <path d=\"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z\"/>\n </svg>\n `,\n 'x-circle-fill': `\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"currentColor\" class=\"bi bi-x-circle-fill\" viewBox=\"0 0 16 16\">\n <path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM5.354 4.646a.5.5 0 1 0-.708.708L7.293 8l-2.647 2.646a.5.5 0 0 0 .708.708L8 8.707l2.646 2.647a.5.5 0 0 0 .708-.708L8.707 8l2.647-2.646a.5.5 0 0 0-.708-.708L8 7.293 5.354 4.646z\"></path>\n </svg>\n `\n};\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": ";AAeA,IAAM,QAAQ;AAAA,EACZ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYP,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAML,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOb,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,EAKZ,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWf,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA,EAKf,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA,EAKd,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASP,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,EAKR,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAKnB;AAEA,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
+ }
@@ -0,0 +1,273 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "./chunk.DJOAQ4JU.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
+ export {
269
+ formCollections,
270
+ FormControlController,
271
+ validValidityState
272
+ };
273
+ //# sourceMappingURL=chunk.WDCAHRYG.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();\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 /** 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 if (input.hasAttribute('form') && input.getAttribute('form') !== '') {\n const root = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute('form');\n\n if (formId) {\n return root.getElementById(formId) 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 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 } else {\n this.form = undefined;\n }\n }\n\n private detachForm() {\n if (this.form) {\n // Remove this element from the form's collection\n formCollections.get(this.form)?.delete(this.host);\n\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\n this.form = undefined;\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 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;AAMrF,IAAM,yBAAsD,oBAAI,QAAQ;AAKxE,IAAM,eAAe,oBAAI,QAAsC;AA2BxD,IAAM,wBAAN,MAA0D;AAAA,EAK/D,YAAY,MAAmD,SAAiD;AAkHhH,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,SAAQ,mBAAmB,CAAC,UAAi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form.ts
6
+ function serialize(form) {
7
+ const formData = new FormData(form);
8
+ const object = {};
9
+ formData.forEach((value, key) => {
10
+ if (Reflect.has(object, key)) {
11
+ const entry = object[key];
12
+ if (Array.isArray(entry)) {
13
+ entry.push(value);
14
+ } else {
15
+ object[key] = [object[key], value];
16
+ }
17
+ } else {
18
+ object[key] = value;
19
+ }
20
+ });
21
+ return object;
22
+ }
23
+ function getFormControls(form) {
24
+ const rootNode = form.getRootNode();
25
+ const allNodes = [...rootNode.querySelectorAll("*")];
26
+ const formControls = [...form.elements];
27
+ const collection = formCollections.get(form);
28
+ const synergyFormControls = collection ? Array.from(collection) : [];
29
+ return [...formControls, ...synergyFormControls].sort((a, b) => {
30
+ if (allNodes.indexOf(a) < allNodes.indexOf(b))
31
+ return -1;
32
+ if (allNodes.indexOf(a) > allNodes.indexOf(b))
33
+ return 1;
34
+ return 0;
35
+ });
36
+ }
37
+
38
+ export {
39
+ serialize,
40
+ getFormControls
41
+ };
42
+ //# sourceMappingURL=chunk.WTCUSH7V.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utilities/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 { formCollections } from '../internal/form.js';\n\n/**\n * Serializes a form and returns a plain object. If a form control with the same name appears more than once, the\n * property will be converted to an array.\n */\nexport function serialize(form: HTMLFormElement) {\n const formData = new FormData(form);\n const object: Record<string, unknown> = {};\n\n formData.forEach((value, key) => {\n if (Reflect.has(object, key)) {\n const entry = object[key];\n if (Array.isArray(entry)) {\n entry.push(value);\n } else {\n object[key] = [object[key], value];\n }\n } else {\n object[key] = value;\n }\n });\n\n return object;\n}\n\n/**\n * Returns all form controls that are associated with the specified form. Includes both native and Synergy form\n * controls. Use this function in lieu of the `HTMLFormElement.elements` property, which doesn't recognize Synergy\n * form controls.\n */\nexport function getFormControls(form: HTMLFormElement) {\n const rootNode = form.getRootNode() as Document | ShadowRoot;\n const allNodes = [...rootNode.querySelectorAll('*')];\n const formControls = [...form.elements];\n const collection = formCollections.get(form);\n const synergyFormControls = collection ? Array.from(collection) : [];\n\n // To return form controls in the right order, we sort by DOM index\n return [...formControls, ...synergyFormControls].sort((a: Element, b: Element) => {\n if (allNodes.indexOf(a) < allNodes.indexOf(b)) return -1;\n if (allNodes.indexOf(a) > allNodes.indexOf(b)) return 1;\n return 0;\n });\n}\n"],
5
+ "mappings": ";;;;;AAYO,SAAS,UAAU,MAAuB;AAC/C,QAAM,WAAW,IAAI,SAAS,IAAI;AAClC,QAAM,SAAkC,CAAC;AAEzC,WAAS,QAAQ,CAAC,OAAO,QAAQ;AAC/B,QAAI,QAAQ,IAAI,QAAQ,GAAG,GAAG;AAC5B,YAAM,QAAQ,OAAO,GAAG;AACxB,UAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,cAAM,KAAK,KAAK;AAAA,MAClB,OAAO;AACL,eAAO,GAAG,IAAI,CAAC,OAAO,GAAG,GAAG,KAAK;AAAA,MACnC;AAAA,IACF,OAAO;AACL,aAAO,GAAG,IAAI;AAAA,IAChB;AAAA,EACF,CAAC;AAED,SAAO;AACT;AAOO,SAAS,gBAAgB,MAAuB;AACrD,QAAM,WAAW,KAAK,YAAY;AAClC,QAAM,WAAW,CAAC,GAAG,SAAS,iBAAiB,GAAG,CAAC;AACnD,QAAM,eAAe,CAAC,GAAG,KAAK,QAAQ;AACtC,QAAM,aAAa,gBAAgB,IAAI,IAAI;AAC3C,QAAM,sBAAsB,aAAa,MAAM,KAAK,UAAU,IAAI,CAAC;AAGnE,SAAO,CAAC,GAAG,cAAc,GAAG,mBAAmB,EAAE,KAAK,CAAC,GAAY,MAAe;AAChF,QAAI,SAAS,QAAQ,CAAC,IAAI,SAAS,QAAQ,CAAC;AAAG,aAAO;AACtD,QAAI,SAAS,QAAQ,CAAC,IAAI,SAAS,QAAQ,CAAC;AAAG,aAAO;AACtD,WAAO;AAAA,EACT,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,49 @@
1
+ // src/internal/slot.ts
2
+ var HasSlotController = class {
3
+ constructor(host, ...slotNames) {
4
+ this.slotNames = [];
5
+ this.handleSlotChange = (event) => {
6
+ const slot = event.target;
7
+ if (this.slotNames.includes("[default]") && !slot.name || slot.name && this.slotNames.includes(slot.name)) {
8
+ this.host.requestUpdate();
9
+ }
10
+ };
11
+ (this.host = host).addController(this);
12
+ this.slotNames = slotNames;
13
+ }
14
+ hasDefaultSlot() {
15
+ return [...this.host.childNodes].some((node) => {
16
+ if (node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "") {
17
+ return true;
18
+ }
19
+ if (node.nodeType === node.ELEMENT_NODE) {
20
+ const el = node;
21
+ const tagName = el.tagName.toLowerCase();
22
+ if (tagName === "syn-visually-hidden") {
23
+ return false;
24
+ }
25
+ if (!el.hasAttribute("slot")) {
26
+ return true;
27
+ }
28
+ }
29
+ return false;
30
+ });
31
+ }
32
+ hasNamedSlot(name) {
33
+ return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
34
+ }
35
+ test(slotName) {
36
+ return slotName === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
37
+ }
38
+ hostConnected() {
39
+ this.host.shadowRoot.addEventListener("slotchange", this.handleSlotChange);
40
+ }
41
+ hostDisconnected() {
42
+ this.host.shadowRoot.removeEventListener("slotchange", this.handleSlotChange);
43
+ }
44
+ };
45
+
46
+ export {
47
+ HasSlotController
48
+ };
49
+ //# sourceMappingURL=chunk.XGXFE6IF.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/internal/slot.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';\n\n/** A reactive controller that determines when slots exist. */\nexport class HasSlotController implements ReactiveController {\n host: ReactiveControllerHost & Element;\n slotNames: string[] = [];\n\n constructor(host: ReactiveControllerHost & Element, ...slotNames: string[]) {\n (this.host = host).addController(this);\n this.slotNames = slotNames;\n }\n\n private hasDefaultSlot() {\n return [...this.host.childNodes].some(node => {\n if (node.nodeType === node.TEXT_NODE && node.textContent!.trim() !== '') {\n return true;\n }\n\n if (node.nodeType === node.ELEMENT_NODE) {\n const el = node as HTMLElement;\n const tagName = el.tagName.toLowerCase();\n\n // Ignore visually hidden elements since they aren't rendered\n if (tagName === 'syn-visually-hidden') {\n return false;\n }\n\n // If it doesn't have a slot attribute, it's part of the default slot\n if (!el.hasAttribute('slot')) {\n return true;\n }\n }\n\n return false;\n });\n }\n\n private hasNamedSlot(name: string) {\n return this.host.querySelector(`:scope > [slot=\"${name}\"]`) !== null;\n }\n\n test(slotName: string) {\n return slotName === '[default]' ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);\n }\n\n hostConnected() {\n this.host.shadowRoot!.addEventListener('slotchange', this.handleSlotChange);\n }\n\n hostDisconnected() {\n this.host.shadowRoot!.removeEventListener('slotchange', this.handleSlotChange);\n }\n\n private handleSlotChange = (event: Event) => {\n const slot = event.target as HTMLSlotElement;\n\n if ((this.slotNames.includes('[default]') && !slot.name) || (slot.name && this.slotNames.includes(slot.name))) {\n this.host.requestUpdate();\n }\n };\n}\n\n/**\n * Given a slot, this function iterates over all of its assigned element and text nodes and returns the concatenated\n * HTML as a string. This is useful because we can't use slot.innerHTML as an alternative.\n */\nexport function getInnerHTML(slot: HTMLSlotElement): string {\n const nodes = slot.assignedNodes({ flatten: true });\n let html = '';\n\n [...nodes].forEach(node => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n html += (node as HTMLElement).outerHTML;\n }\n\n if (node.nodeType === Node.TEXT_NODE) {\n html += node.textContent;\n }\n });\n\n return html;\n}\n\n/**\n * Given a slot, this function iterates over all of its assigned text nodes and returns the concatenated text as a\n * string. This is useful because we can't use slot.textContent as an alternative.\n */\nexport function getTextContent(slot: HTMLSlotElement | undefined | null): string {\n if (!slot) {\n return '';\n }\n const nodes = slot.assignedNodes({ flatten: true });\n let text = '';\n\n [...nodes].forEach(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n text += node.textContent;\n }\n });\n\n return text;\n}\n"],
5
+ "mappings": ";AASO,IAAM,oBAAN,MAAsD;AAAA,EAI3D,YAAY,SAA2C,WAAqB;AAF5E,qBAAsB,CAAC;AAgDvB,SAAQ,mBAAmB,CAAC,UAAiB;AAC3C,YAAM,OAAO,MAAM;AAEnB,UAAK,KAAK,UAAU,SAAS,WAAW,KAAK,CAAC,KAAK,QAAU,KAAK,QAAQ,KAAK,UAAU,SAAS,KAAK,IAAI,GAAI;AAC7G,aAAK,KAAK,cAAc;AAAA,MAC1B;AAAA,IACF;AAnDE,KAAC,KAAK,OAAO,MAAM,cAAc,IAAI;AACrC,SAAK,YAAY;AAAA,EACnB;AAAA,EAEQ,iBAAiB;AACvB,WAAO,CAAC,GAAG,KAAK,KAAK,UAAU,EAAE,KAAK,UAAQ;AAC5C,UAAI,KAAK,aAAa,KAAK,aAAa,KAAK,YAAa,KAAK,MAAM,IAAI;AACvE,eAAO;AAAA,MACT;AAEA,UAAI,KAAK,aAAa,KAAK,cAAc;AACvC,cAAM,KAAK;AACX,cAAM,UAAU,GAAG,QAAQ,YAAY;AAGvC,YAAI,YAAY,uBAAuB;AACrC,iBAAO;AAAA,QACT;AAGA,YAAI,CAAC,GAAG,aAAa,MAAM,GAAG;AAC5B,iBAAO;AAAA,QACT;AAAA,MACF;AAEA,aAAO;AAAA,IACT,CAAC;AAAA,EACH;AAAA,EAEQ,aAAa,MAAc;AACjC,WAAO,KAAK,KAAK,cAAc,mBAAmB,IAAI,IAAI,MAAM;AAAA,EAClE;AAAA,EAEA,KAAK,UAAkB;AACrB,WAAO,aAAa,cAAc,KAAK,eAAe,IAAI,KAAK,aAAa,QAAQ;AAAA,EACtF;AAAA,EAEA,gBAAgB;AACd,SAAK,KAAK,WAAY,iBAAiB,cAAc,KAAK,gBAAgB;AAAA,EAC5E;AAAA,EAEA,mBAAmB;AACjB,SAAK,KAAK,WAAY,oBAAoB,cAAc,KAAK,gBAAgB;AAAA,EAC/E;AASF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,123 @@
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' | 'outline' | '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
+ /**
54
+ * The type of button. Note that the default value is `button` instead of `submit`, which is opposite of how native
55
+ * `<button>` elements behave. When the type is `submit`, the button will submit the surrounding form.
56
+ */
57
+ type: 'button' | 'submit' | 'reset';
58
+ /**
59
+ * The name of the button, submitted as a name/value pair with form data, but only when this button is the submitter.
60
+ * This attribute is ignored when `href` is present.
61
+ */
62
+ name: string;
63
+ /**
64
+ * The value of the button, submitted as a pair with the button's name as part of the form data, but only when this
65
+ * button is the submitter. This attribute is ignored when `href` is present.
66
+ */
67
+ value: string;
68
+ /** When set, the underlying button will be rendered as an `<a>` with this `href` instead of a `<button>`. */
69
+ href: string;
70
+ /** Tells the browser where to open the link. Only used when `href` is present. */
71
+ target: '_blank' | '_parent' | '_self' | '_top';
72
+ /**
73
+ * When using `href`, this attribute will map to the underlying link's `rel` attribute. Unlike regular links, the
74
+ * default is `noreferrer noopener` to prevent security exploits. However, if you're using `target` to point to a
75
+ * specific tab/window, this will prevent that from working correctly. You can remove or change the default value by
76
+ * setting the attribute to an empty string or a value of your choice, respectively.
77
+ */
78
+ rel: string;
79
+ /** Tells the browser to download the linked file as this filename. Only used when `href` is present. */
80
+ download?: string;
81
+ /**
82
+ * The "form owner" to associate the button with. If omitted, the closest containing form will be used instead. The
83
+ * value of this attribute must be an id of a form in the same document or shadow root as the button.
84
+ */
85
+ form: string;
86
+ /** Used to override the form owner's `action` attribute. */
87
+ formAction: string;
88
+ /** Used to override the form owner's `enctype` attribute. */
89
+ formEnctype: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
90
+ /** Used to override the form owner's `method` attribute. */
91
+ formMethod: 'post' | 'get';
92
+ /** Used to override the form owner's `novalidate` attribute. */
93
+ formNoValidate: boolean;
94
+ /** Used to override the form owner's `target` attribute. */
95
+ formTarget: '_self' | '_blank' | '_parent' | '_top' | string;
96
+ /** Gets the validity state object */
97
+ get validity(): ValidityState;
98
+ /** Gets the validation message */
99
+ get validationMessage(): string;
100
+ firstUpdated(): void;
101
+ private handleBlur;
102
+ private handleFocus;
103
+ private handleClick;
104
+ private handleInvalid;
105
+ private isButton;
106
+ private isLink;
107
+ handleDisabledChange(): void;
108
+ /** Simulates a click on the button. */
109
+ click(): void;
110
+ /** Sets focus on the button. */
111
+ focus(options?: FocusOptions): void;
112
+ /** Removes focus from the button. */
113
+ blur(): void;
114
+ /** Checks for validity but does not show a validation message. Returns `true` when valid and `false` when invalid. */
115
+ checkValidity(): boolean;
116
+ /** Gets the associated form, if one exists. */
117
+ getForm(): HTMLFormElement | null;
118
+ /** Checks for validity and shows the browser's validation message if the control is invalid. */
119
+ reportValidity(): boolean;
120
+ /** Sets a custom validation message. Pass an empty string to restore validity. */
121
+ setCustomValidity(message: string): void;
122
+ render(): import("lit").TemplateResult;
123
+ }
@@ -0,0 +1,24 @@
1
+ import {
2
+ SynButton
3
+ } from "../../chunks/chunk.FUYWF5Y2.js";
4
+ import "../../chunks/chunk.2FIY3TX5.js";
5
+ import "../../chunks/chunk.N2I6HVX3.js";
6
+ import "../../chunks/chunk.XGXFE6IF.js";
7
+ import "../../chunks/chunk.R6VNLE6N.js";
8
+ import "../../chunks/chunk.A3SKDWCT.js";
9
+ import "../../chunks/chunk.WDCAHRYG.js";
10
+ import "../../chunks/chunk.P22LQI5J.js";
11
+ import "../../chunks/chunk.DREO4ZTN.js";
12
+ import "../../chunks/chunk.5PZUAKCS.js";
13
+ import "../../chunks/chunk.SLLG4KJR.js";
14
+ import "../../chunks/chunk.BREU4ILT.js";
15
+ import "../../chunks/chunk.5OIEI73E.js";
16
+ import "../../chunks/chunk.6C4JXZZN.js";
17
+ import "../../chunks/chunk.U7ZJ22QM.js";
18
+ import "../../chunks/chunk.C7624ITA.js";
19
+ import "../../chunks/chunk.O7USYXBT.js";
20
+ import "../../chunks/chunk.DJOAQ4JU.js";
21
+ export {
22
+ SynButton as default
23
+ };
24
+ //# sourceMappingURL=button.component.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: import("lit").CSSResult;
2
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import {
2
+ button_custom_styles_default
3
+ } from "../../chunks/chunk.DREO4ZTN.js";
4
+ import "../../chunks/chunk.DJOAQ4JU.js";
5
+ export {
6
+ button_custom_styles_default as default
7
+ };
8
+ //# sourceMappingURL=button.custom.styles.js.map