@sellmate/design-system 1.0.37 → 1.0.39

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 (281) hide show
  1. package/dist/cjs/design-system.cjs.js +1 -1
  2. package/dist/cjs/index.cjs.js +124 -19
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sd-badge.cjs.entry.js +1 -1
  5. package/dist/cjs/{sd-button-v2.cjs.entry.js → sd-button-v2_2.cjs.entry.js} +184 -2
  6. package/dist/cjs/{sd-button_21.cjs.entry.js → sd-button_20.cjs.entry.js} +154 -89
  7. package/dist/cjs/sd-card.cjs.entry.js +1 -1
  8. package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +199 -0
  9. package/dist/cjs/sd-date-picker.cjs.entry.js +1 -1
  10. package/dist/cjs/sd-dropdown-button.cjs.entry.js +7 -18
  11. package/dist/cjs/sd-file-picker.cjs.entry.js +3 -3
  12. package/dist/cjs/sd-guide.cjs.entry.js +2 -2
  13. package/dist/cjs/sd-modal-container.cjs.entry.js +263 -0
  14. package/dist/cjs/sd-popover.cjs.entry.js +2 -2
  15. package/dist/cjs/sd-progress.cjs.entry.js +2 -2
  16. package/dist/cjs/sd-radio-button-group.cjs.entry.js +1 -1
  17. package/dist/cjs/sd-radio-group.cjs.entry.js +1 -1
  18. package/dist/cjs/sd-select-group.cjs.entry.js +2 -2
  19. package/dist/cjs/sd-select-multiple-group.cjs.entry.js +1 -1
  20. package/dist/cjs/sd-select-multiple.cjs.entry.js +1 -1
  21. package/dist/cjs/sd-select-option-group.cjs.entry.js +3 -3
  22. package/dist/cjs/sd-select-v2-list-item_2.cjs.entry.js +6 -6
  23. package/dist/cjs/sd-select-v2-listbox_2.cjs.entry.js +5 -10
  24. package/dist/cjs/sd-select-v2.cjs.entry.js +20 -8
  25. package/dist/cjs/{sd-select-v2.config-DedHbMz4.js → sd-select-v2.config-DZrPJ6OS.js} +0 -14
  26. package/dist/cjs/sd-tabs.cjs.entry.js +1 -1
  27. package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
  28. package/dist/cjs/sd-toast.cjs.entry.js +2 -2
  29. package/dist/cjs/sd-toggle-button.cjs.entry.js +1 -1
  30. package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
  31. package/dist/cjs/system-lN7yOMPF.js +20 -0
  32. package/dist/collection/collection-manifest.json +3 -1
  33. package/dist/collection/components/sd-badge/sd-badge.js +1 -1
  34. package/dist/collection/components/sd-button-v2/sd-button-v2.js +2 -2
  35. package/dist/collection/components/sd-card/sd-card.js +1 -1
  36. package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.config.js +17 -0
  37. package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.css +67 -0
  38. package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.js +385 -0
  39. package/dist/collection/components/sd-date-picker/sd-date-picker.js +1 -1
  40. package/dist/collection/components/sd-date-range-picker/sd-date-range-picker.js +4 -4
  41. package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.js +3 -3
  42. package/dist/collection/components/sd-field/sd-field.css +12 -15
  43. package/dist/collection/components/sd-field/sd-field.js +26 -13
  44. package/dist/collection/components/sd-file-picker/sd-file-picker.js +3 -3
  45. package/dist/collection/components/sd-floating-portal/sd-floating-portal.js +1 -1
  46. package/dist/collection/components/sd-guide/sd-guide.js +2 -2
  47. package/dist/collection/components/sd-icon/sd-icon.js +1 -1
  48. package/dist/collection/components/sd-input/sd-input.config.js +34 -0
  49. package/dist/collection/components/sd-input/sd-input.css +16 -6
  50. package/dist/collection/components/sd-input/sd-input.js +61 -36
  51. package/dist/collection/components/sd-loading-spinner/sd-loading-spinner.js +1 -1
  52. package/dist/collection/components/sd-modal-container/sd-modal-container.config.js +1 -0
  53. package/dist/collection/components/sd-modal-container/sd-modal-container.css +58 -0
  54. package/dist/collection/components/sd-modal-container/sd-modal-container.js +399 -0
  55. package/dist/collection/components/sd-notice-modal/sd-notice-modal.config.js +3 -0
  56. package/dist/collection/components/sd-notice-modal/sd-notice-modal.css +61 -0
  57. package/dist/collection/components/sd-notice-modal/sd-notice-modal.js +324 -0
  58. package/dist/collection/components/sd-number-input/sd-number-input.js +11 -11
  59. package/dist/collection/components/sd-pagination/sd-pagination.js +2 -2
  60. package/dist/collection/components/sd-popover/sd-popover.js +2 -2
  61. package/dist/collection/components/sd-portal/sd-portal.js +1 -1
  62. package/dist/collection/components/sd-progress/sd-progress.js +2 -2
  63. package/dist/collection/components/sd-radio/sd-radio.js +1 -1
  64. package/dist/collection/components/sd-radio-button-group/sd-radio-button-group.js +1 -1
  65. package/dist/collection/components/sd-radio-group/sd-radio-group.js +1 -1
  66. package/dist/collection/components/sd-select/sd-select-dropdown/sd-select-dropdown.js +2 -2
  67. package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
  68. package/dist/collection/components/sd-select/sd-select-search-input/sd-select-search-input.js +3 -3
  69. package/dist/collection/components/sd-select/sd-select.js +8 -8
  70. package/dist/collection/components/sd-select-group/sd-select-group.js +8 -8
  71. package/dist/collection/components/sd-select-multiple/sd-select-multiple.js +1 -1
  72. package/dist/collection/components/sd-select-multiple-group/sd-select-multiple-group.js +1 -1
  73. package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
  74. package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.js +2 -2
  75. package/dist/collection/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.js +3 -3
  76. package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +1 -1
  77. package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.css +0 -12
  78. package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -27
  79. package/dist/collection/components/sd-select-v2/sd-select-v2.config.js +0 -8
  80. package/dist/collection/components/sd-select-v2/sd-select-v2.js +42 -16
  81. package/dist/collection/components/sd-table/sd-table.js +4 -4
  82. package/dist/collection/components/sd-tabs/sd-tabs.js +1 -1
  83. package/dist/collection/components/sd-tag/sd-tag.js +2 -2
  84. package/dist/collection/components/sd-textarea/sd-textarea.js +2 -2
  85. package/dist/collection/components/sd-toast/sd-toast.js +2 -2
  86. package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
  87. package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
  88. package/dist/collection/components/sd-toggle-button/sd-toggle-button.js +1 -1
  89. package/dist/collection/components/sd-tooltip/sd-tooltip.js +2 -2
  90. package/dist/collection/index.js +1 -0
  91. package/dist/collection/utils/modal.js +103 -0
  92. package/dist/components/index.js +1 -1
  93. package/dist/components/{p-dBp4oI6E.js → p-0gO8WB9o.js} +1 -1
  94. package/dist/components/p-5UN9Ry8A.js +1 -0
  95. package/dist/components/{p-DkjKNMgx.js → p-9EyS2_Bp.js} +1 -1
  96. package/dist/components/p-BH_WRHMs.js +1 -0
  97. package/dist/components/{p-CtOFXnU0.js → p-BL0JF-Wh.js} +1 -1
  98. package/dist/components/{p-CyfWQr0q.js → p-BMpVqedy.js} +1 -1
  99. package/dist/components/{p-CdOU_SOg.js → p-BdjLD8BG.js} +1 -1
  100. package/dist/components/{p-DOt_ptQc.js → p-C7G_tiJw.js} +1 -1
  101. package/dist/components/p-CBmWor54.js +1 -0
  102. package/dist/components/p-CCGsaeed.js +1 -0
  103. package/dist/components/{p-eM9OCX16.js → p-CGU_sdK0.js} +1 -1
  104. package/dist/components/p-CIwsurLw.js +1 -0
  105. package/dist/components/p-CS6ohqwt.js +1 -0
  106. package/dist/components/p-C_L-UaCP.js +1 -0
  107. package/dist/components/{p-BBpn_mYj.js → p-Cefcggep.js} +1 -1
  108. package/dist/components/{p-gnF0_mDJ.js → p-Cm4BQbyn.js} +1 -1
  109. package/dist/components/{p-zUWRVubn.js → p-CnGJ-zsX.js} +1 -1
  110. package/dist/components/{p-BvBroZuS.js → p-CsS4T0El.js} +1 -1
  111. package/dist/components/{p-CxT7-293.js → p-DBCQtIY4.js} +1 -1
  112. package/dist/components/{p-yQoaU7-d.js → p-DEBuE-pW.js} +1 -1
  113. package/dist/components/{p-CiHU8TZa.js → p-DEP3qjY2.js} +1 -1
  114. package/dist/components/{p-Cva7D7mF.js → p-DS5oSTUS.js} +1 -1
  115. package/dist/components/{p-DKcKp__V.js → p-Dzg317Va.js} +1 -1
  116. package/dist/components/p-Trj68Yo5.js +1 -0
  117. package/dist/components/p-_Zc2887O.js +1 -0
  118. package/dist/components/{p-CgwiT7OF.js → p-cWdYmHLY.js} +1 -1
  119. package/dist/components/{p-CXoqcDFa.js → p-dvfewOFM.js} +1 -1
  120. package/dist/components/{p-D8OiOEB8.js → p-l5p-E_Gh.js} +1 -1
  121. package/dist/components/p-nLkkdmKA.js +1 -0
  122. package/dist/components/{p-41grr69M.js → p-vMfU_F7J.js} +1 -1
  123. package/dist/components/sd-badge.js +1 -1
  124. package/dist/components/sd-button-v2.js +1 -1
  125. package/dist/components/sd-button.js +1 -1
  126. package/dist/components/sd-calendar.js +1 -1
  127. package/dist/components/sd-card.js +1 -1
  128. package/dist/components/sd-checkbox.js +1 -1
  129. package/dist/components/sd-confirm-modal.d.ts +11 -0
  130. package/dist/components/sd-confirm-modal.js +1 -0
  131. package/dist/components/sd-date-picker.js +1 -1
  132. package/dist/components/sd-date-range-picker.js +1 -1
  133. package/dist/components/sd-dropdown-button.js +1 -1
  134. package/dist/components/sd-field.js +1 -1
  135. package/dist/components/sd-file-picker.js +1 -1
  136. package/dist/components/sd-floating-portal.js +1 -1
  137. package/dist/components/sd-guide.js +1 -1
  138. package/dist/components/sd-icon.js +1 -1
  139. package/dist/components/sd-input.js +1 -1
  140. package/dist/components/sd-loading-spinner.js +1 -1
  141. package/dist/components/sd-modal-container.d.ts +11 -0
  142. package/dist/components/sd-modal-container.js +1 -0
  143. package/dist/components/{sd-modal-card.d.ts → sd-notice-modal.d.ts} +4 -4
  144. package/dist/components/sd-notice-modal.js +1 -0
  145. package/dist/components/sd-number-input.js +1 -1
  146. package/dist/components/sd-pagination.js +1 -1
  147. package/dist/components/sd-popover.js +1 -1
  148. package/dist/components/sd-portal.js +1 -1
  149. package/dist/components/sd-progress.js +1 -1
  150. package/dist/components/sd-radio-button-group.js +1 -1
  151. package/dist/components/sd-radio-group.js +1 -1
  152. package/dist/components/sd-radio.js +1 -1
  153. package/dist/components/sd-select-dropdown.js +1 -1
  154. package/dist/components/sd-select-group.js +1 -1
  155. package/dist/components/sd-select-multiple-group.js +1 -1
  156. package/dist/components/sd-select-multiple.js +1 -1
  157. package/dist/components/sd-select-option-group.js +1 -1
  158. package/dist/components/sd-select-option.js +1 -1
  159. package/dist/components/sd-select-search-input.js +1 -1
  160. package/dist/components/sd-select-v2-list-item-search.js +1 -1
  161. package/dist/components/sd-select-v2-list-item.js +1 -1
  162. package/dist/components/sd-select-v2-listbox.js +1 -1
  163. package/dist/components/sd-select-v2-trigger.js +1 -1
  164. package/dist/components/sd-select-v2.js +1 -1
  165. package/dist/components/sd-select.js +1 -1
  166. package/dist/components/sd-table.js +1 -1
  167. package/dist/components/sd-tabs.js +1 -1
  168. package/dist/components/sd-tag.js +1 -1
  169. package/dist/components/sd-textarea.js +1 -1
  170. package/dist/components/sd-toast-container.js +1 -1
  171. package/dist/components/sd-toast.js +1 -1
  172. package/dist/components/sd-toggle-button.js +1 -1
  173. package/dist/components/sd-toggle.js +1 -1
  174. package/dist/components/sd-tooltip.js +1 -1
  175. package/dist/design-system/design-system.css +1 -1
  176. package/dist/design-system/design-system.esm.js +1 -1
  177. package/dist/design-system/index.esm.js +1 -1
  178. package/dist/design-system/{p-a35adbbc.entry.js → p-021e4171.entry.js} +1 -1
  179. package/dist/design-system/{p-d817c235.entry.js → p-0cca5deb.entry.js} +1 -1
  180. package/dist/design-system/{p-97bfc75f.entry.js → p-0fdca641.entry.js} +1 -1
  181. package/dist/design-system/{p-270227ae.entry.js → p-10945e57.entry.js} +1 -1
  182. package/dist/design-system/{p-5b2d9ef2.entry.js → p-12f04366.entry.js} +1 -1
  183. package/dist/design-system/{p-2119dddc.entry.js → p-13d4baf3.entry.js} +1 -1
  184. package/dist/design-system/p-1e975178.entry.js +1 -0
  185. package/dist/design-system/{p-e4a19588.entry.js → p-2408d1ab.entry.js} +1 -1
  186. package/dist/design-system/p-342f48ab.entry.js +1 -0
  187. package/dist/design-system/p-36ba5f33.entry.js +1 -0
  188. package/dist/design-system/{p-c4f9aeed.entry.js → p-37e9e161.entry.js} +1 -1
  189. package/dist/design-system/{p-a88dabbd.entry.js → p-4731457c.entry.js} +1 -1
  190. package/dist/design-system/{p-1d7ea568.entry.js → p-63f997d7.entry.js} +1 -1
  191. package/dist/design-system/{p-b3473468.entry.js → p-6d9e16bd.entry.js} +1 -1
  192. package/dist/design-system/p-9c6fea35.entry.js +1 -0
  193. package/dist/design-system/p-9d431ea6.entry.js +1 -0
  194. package/dist/design-system/p-BOmBg3kj.js +1 -0
  195. package/dist/design-system/{p-CdOU_SOg.js → p-BdjLD8BG.js} +1 -1
  196. package/dist/design-system/p-CS6ohqwt.js +1 -0
  197. package/dist/design-system/{p-0c2e44fb.entry.js → p-a4e87345.entry.js} +1 -1
  198. package/dist/design-system/{p-594dee9b.entry.js → p-acb529cb.entry.js} +1 -1
  199. package/dist/design-system/{p-a94ed4a3.entry.js → p-b71d0858.entry.js} +1 -1
  200. package/dist/design-system/p-ba393cc8.entry.js +1 -0
  201. package/dist/design-system/p-d8b04e91.entry.js +1 -0
  202. package/dist/design-system/{p-01a7b38b.entry.js → p-e0ef7658.entry.js} +1 -1
  203. package/dist/design-system/p-e96c881f.entry.js +1 -0
  204. package/dist/design-system/p-f186c0f4.entry.js +1 -0
  205. package/dist/design-system/p-f87b6a45.entry.js +1 -0
  206. package/dist/design-system/p-f9075737.entry.js +1 -0
  207. package/dist/esm/design-system.js +1 -1
  208. package/dist/esm/index.js +124 -20
  209. package/dist/esm/loader.js +1 -1
  210. package/dist/esm/sd-badge.entry.js +1 -1
  211. package/dist/esm/{sd-button-v2.config-CRtF2Br0.js → sd-button-v2.config-Dtf44MOf.js} +1 -1
  212. package/dist/esm/{sd-button-v2.entry.js → sd-button-v2_2.entry.js} +185 -4
  213. package/dist/esm/{sd-button_21.entry.js → sd-button_20.entry.js} +155 -89
  214. package/dist/esm/sd-card.entry.js +1 -1
  215. package/dist/esm/sd-confirm-modal_2.entry.js +196 -0
  216. package/dist/esm/sd-date-picker.entry.js +1 -1
  217. package/dist/esm/sd-dropdown-button.entry.js +5 -16
  218. package/dist/esm/sd-file-picker.entry.js +3 -3
  219. package/dist/esm/sd-guide.entry.js +2 -2
  220. package/dist/esm/sd-modal-container.entry.js +261 -0
  221. package/dist/esm/sd-popover.entry.js +2 -2
  222. package/dist/esm/sd-progress.entry.js +2 -2
  223. package/dist/esm/sd-radio-button-group.entry.js +1 -1
  224. package/dist/esm/sd-radio-group.entry.js +1 -1
  225. package/dist/esm/sd-select-group.entry.js +2 -2
  226. package/dist/esm/sd-select-multiple-group.entry.js +1 -1
  227. package/dist/esm/sd-select-multiple.entry.js +1 -1
  228. package/dist/esm/sd-select-option-group.entry.js +3 -3
  229. package/dist/esm/sd-select-v2-list-item_2.entry.js +6 -6
  230. package/dist/esm/sd-select-v2-listbox_2.entry.js +5 -10
  231. package/dist/esm/{sd-select-v2.config-BXY0UBNx.js → sd-select-v2.config-BOmBg3kj.js} +0 -14
  232. package/dist/esm/sd-select-v2.entry.js +20 -8
  233. package/dist/esm/sd-tabs.entry.js +1 -1
  234. package/dist/esm/sd-toast-container.entry.js +1 -1
  235. package/dist/esm/sd-toast.entry.js +2 -2
  236. package/dist/esm/sd-toggle-button.entry.js +1 -1
  237. package/dist/esm/sd-toggle.entry.js +1 -1
  238. package/dist/esm/system-CS6ohqwt.js +18 -0
  239. package/dist/types/components/sd-confirm-modal/sd-confirm-modal.config.d.ts +14 -0
  240. package/dist/types/components/sd-confirm-modal/sd-confirm-modal.d.ts +31 -0
  241. package/dist/types/components/sd-field/sd-field.d.ts +1 -1
  242. package/dist/types/components/sd-input/sd-input.config.d.ts +38 -0
  243. package/dist/types/components/sd-input/sd-input.d.ts +4 -3
  244. package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +45 -0
  245. package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +27 -0
  246. package/dist/types/components/sd-notice-modal/sd-notice-modal.config.d.ts +5 -0
  247. package/dist/types/components/sd-notice-modal/sd-notice-modal.d.ts +28 -0
  248. package/dist/types/components/sd-number-input/sd-number-input.d.ts +1 -1
  249. package/dist/types/components/sd-select/sd-select.d.ts +1 -1
  250. package/dist/types/components/sd-select-group/sd-select-group.d.ts +1 -1
  251. package/dist/types/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.d.ts +0 -1
  252. package/dist/types/components/sd-select-v2/sd-select-v2.config.d.ts +0 -8
  253. package/dist/types/components/sd-select-v2/sd-select-v2.d.ts +3 -2
  254. package/dist/types/components.d.ts +288 -123
  255. package/dist/types/index.d.ts +2 -0
  256. package/dist/types/utils/modal.d.ts +12 -0
  257. package/hydrate/index.js +720 -164
  258. package/hydrate/index.mjs +720 -164
  259. package/package.json +1 -1
  260. package/dist/cjs/sd-tag.cjs.entry.js +0 -186
  261. package/dist/collection/components/sd-modal-card/sd-modal-card.css +0 -51
  262. package/dist/collection/components/sd-modal-card/sd-modal-card.js +0 -254
  263. package/dist/components/p-72hNB1Fw.js +0 -1
  264. package/dist/components/p-C6uWXKpX.js +0 -1
  265. package/dist/components/p-CC6lx8di.js +0 -1
  266. package/dist/components/p-CpfPgt7c.js +0 -1
  267. package/dist/components/p-d1GtjL2y.js +0 -1
  268. package/dist/components/sd-modal-card.js +0 -1
  269. package/dist/design-system/p-2185ffaa.entry.js +0 -1
  270. package/dist/design-system/p-35473290.entry.js +0 -1
  271. package/dist/design-system/p-4810e846.entry.js +0 -1
  272. package/dist/design-system/p-62581abe.entry.js +0 -1
  273. package/dist/design-system/p-687f8414.entry.js +0 -1
  274. package/dist/design-system/p-89578577.entry.js +0 -1
  275. package/dist/design-system/p-93c2d29f.entry.js +0 -1
  276. package/dist/design-system/p-BXY0UBNx.js +0 -1
  277. package/dist/design-system/p-e7654632.entry.js +0 -1
  278. package/dist/design-system/p-ebee1495.entry.js +0 -1
  279. package/dist/design-system/p-fea7dbce.entry.js +0 -1
  280. package/dist/esm/sd-tag.entry.js +0 -184
  281. package/dist/types/components/sd-modal-card/sd-modal-card.d.ts +0 -25
@@ -0,0 +1,399 @@
1
+ import { h } from "@stencil/core";
2
+ let modalIdCounter = 0;
3
+ const ANIMATION_DURATION = 350;
4
+ export class SdModalContainer {
5
+ el;
6
+ entries = [];
7
+ isVisible = false;
8
+ isBackdropVisible = false;
9
+ contentRef;
10
+ containerDismissTimerId;
11
+ handleKeydown(e) {
12
+ if (e.key === 'Escape') {
13
+ const top = this.getTopEntry();
14
+ if (!top)
15
+ return;
16
+ if (top.persistent) {
17
+ this.shakeModal(top.modalEl);
18
+ return;
19
+ }
20
+ this.requestDismiss(top.id, 'cancel');
21
+ }
22
+ }
23
+ async open(options, chain) {
24
+ const id = `modal-${++modalIdCounter}`;
25
+ const modalEl = this.createConfirmModal(id, options);
26
+ if (this.containerDismissTimerId) {
27
+ clearTimeout(this.containerDismissTimerId);
28
+ this.containerDismissTimerId = undefined;
29
+ }
30
+ this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
31
+ this.isVisible = true;
32
+ // Append after the container renders, then wait until the modal can paint before starting transitions.
33
+ requestAnimationFrame(() => {
34
+ if (this.contentRef) {
35
+ this.contentRef.appendChild(modalEl);
36
+ this.waitForModalReady(modalEl).then(() => {
37
+ requestAnimationFrame(() => {
38
+ const currentEntry = (this.entries ?? []).find(item => item.id === id);
39
+ if (!currentEntry || currentEntry.closing || !modalEl.isConnected)
40
+ return;
41
+ this.isBackdropVisible = true;
42
+ modalEl.classList.add('sd-modal-container__modal--visible');
43
+ });
44
+ });
45
+ }
46
+ });
47
+ return id;
48
+ }
49
+ async openNotice(options, chain) {
50
+ const id = `modal-${++modalIdCounter}`;
51
+ const modalEl = this.createNoticeModal(id, options);
52
+ if (this.containerDismissTimerId) {
53
+ clearTimeout(this.containerDismissTimerId);
54
+ this.containerDismissTimerId = undefined;
55
+ }
56
+ this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
57
+ this.isVisible = true;
58
+ requestAnimationFrame(() => {
59
+ if (this.contentRef) {
60
+ this.contentRef.appendChild(modalEl);
61
+ this.waitForModalReady(modalEl).then(() => {
62
+ requestAnimationFrame(() => {
63
+ const currentEntry = (this.entries ?? []).find(item => item.id === id);
64
+ if (!currentEntry || currentEntry.closing || !modalEl.isConnected)
65
+ return;
66
+ this.isBackdropVisible = true;
67
+ modalEl.classList.add('sd-modal-container__modal--visible');
68
+ });
69
+ });
70
+ }
71
+ });
72
+ return id;
73
+ }
74
+ async update(id, props) {
75
+ const entry = (this.entries ?? []).find(e => e.id === id);
76
+ if (!entry || entry.closing)
77
+ return;
78
+ this.applyProps(entry.modalEl, props);
79
+ }
80
+ createConfirmModal(id, options) {
81
+ const el = document.createElement('sd-confirm-modal');
82
+ el.setAttribute('data-modal-id', id);
83
+ el.classList.add('sd-modal-container__modal');
84
+ this.applyProps(el, options);
85
+ el.addEventListener('sdConfirm', () => {
86
+ this.requestDismiss(id, 'confirm');
87
+ });
88
+ el.addEventListener('sdClose', () => {
89
+ this.requestDismiss(id, 'cancel');
90
+ });
91
+ return el;
92
+ }
93
+ applyProps(el, options) {
94
+ if (this.hasOwnProp(options, 'type'))
95
+ this.setAttr(el, 'type', options.type);
96
+ if (this.hasOwnProp(options, 'title'))
97
+ this.setAttr(el, 'modal-title', options.title);
98
+ if (this.hasOwnProp(options, 'titleClass'))
99
+ this.setAttr(el, 'title-class', options.titleClass);
100
+ if (this.hasOwnProp(options, 'mainButtonLabel')) {
101
+ this.setAttr(el, 'main-button-label', options.mainButtonLabel);
102
+ }
103
+ if (this.hasOwnProp(options, 'mainButtonName')) {
104
+ this.setAttr(el, 'main-button-name', options.mainButtonName);
105
+ }
106
+ if (this.hasOwnProp(options, 'subButtonLabel')) {
107
+ this.setAttr(el, 'sub-button-label', options.subButtonLabel);
108
+ }
109
+ if (this.hasOwnProp(options, 'tagPreset'))
110
+ this.setAttr(el, 'tag-preset', options.tagPreset);
111
+ if (this.hasOwnProp(options, 'tagLabel'))
112
+ this.setAttr(el, 'tag-label', options.tagLabel);
113
+ if (this.hasOwnProp(options, 'slotLabel'))
114
+ this.setAttr(el, 'slot-label', options.slotLabel);
115
+ if (this.hasOwnProp(options, 'topMessage'))
116
+ el.topMessage = options.topMessage ?? [];
117
+ if (this.hasOwnProp(options, 'bottomMessage'))
118
+ el.bottomMessage = options.bottomMessage ?? [];
119
+ if (this.hasOwnProp(options, 'tagContents'))
120
+ el.tagContents = options.tagContents;
121
+ }
122
+ createNoticeModal(id, options) {
123
+ const el = document.createElement('sd-notice-modal');
124
+ el.setAttribute('data-modal-id', id);
125
+ el.classList.add('sd-modal-container__modal');
126
+ this.applyNoticeProps(el, options);
127
+ el.addEventListener('sdConfirm', () => {
128
+ this.requestDismiss(id, 'confirm');
129
+ });
130
+ el.addEventListener('sdClose', () => {
131
+ this.requestDismiss(id, 'cancel');
132
+ });
133
+ return el;
134
+ }
135
+ applyNoticeProps(el, options) {
136
+ if (this.hasOwnProp(options, 'title'))
137
+ this.setAttr(el, 'modal-title', options.title);
138
+ if (this.hasOwnProp(options, 'titleClass'))
139
+ this.setAttr(el, 'title-class', options.titleClass);
140
+ if (this.hasOwnProp(options, 'mainButtonLabel')) {
141
+ this.setAttr(el, 'main-button-label', options.mainButtonLabel);
142
+ }
143
+ if (this.hasOwnProp(options, 'subButtonLabel')) {
144
+ this.setAttr(el, 'sub-button-label', options.subButtonLabel);
145
+ }
146
+ if (this.hasOwnProp(options, 'tagPreset'))
147
+ this.setAttr(el, 'tag-preset', options.tagPreset);
148
+ if (this.hasOwnProp(options, 'tagLabel'))
149
+ this.setAttr(el, 'tag-label', options.tagLabel);
150
+ if (this.hasOwnProp(options, 'slotLabel'))
151
+ this.setAttr(el, 'slot-label', options.slotLabel);
152
+ if (this.hasOwnProp(options, 'topMessage'))
153
+ el.topMessage = options.topMessage ?? [];
154
+ if (this.hasOwnProp(options, 'bottomMessage'))
155
+ el.bottomMessage = options.bottomMessage ?? [];
156
+ if (this.hasOwnProp(options, 'tagContents'))
157
+ el.tagContents = options.tagContents;
158
+ }
159
+ handleBackdropClick = () => {
160
+ const top = this.getTopEntry();
161
+ if (!top)
162
+ return;
163
+ if (top.persistent) {
164
+ this.shakeModal(top.modalEl);
165
+ return;
166
+ }
167
+ this.requestDismiss(top.id, 'cancel');
168
+ };
169
+ shakeModal(modalEl) {
170
+ const cls = 'sd-modal-container__modal--shake';
171
+ modalEl.classList.remove(cls);
172
+ modalEl.addEventListener('animationend', () => modalEl.classList.remove(cls), { once: true });
173
+ requestAnimationFrame(() => {
174
+ modalEl.classList.add(cls);
175
+ });
176
+ }
177
+ disconnectedCallback() {
178
+ (this.entries ?? []).forEach(entry => {
179
+ if (entry.dismissTimerId)
180
+ clearTimeout(entry.dismissTimerId);
181
+ });
182
+ if (this.containerDismissTimerId)
183
+ clearTimeout(this.containerDismissTimerId);
184
+ }
185
+ getTopEntry() {
186
+ return [...(this.entries ?? [])].reverse().find(entry => !entry.closing);
187
+ }
188
+ requestDismiss(id, reason) {
189
+ const entry = (this.entries ?? []).find(item => item.id === id);
190
+ if (!entry || entry.closing)
191
+ return;
192
+ entry.modalEl.classList.remove('sd-modal-container__modal--visible');
193
+ // fade out backdrop simultaneously if this is the last active modal
194
+ const remainingActive = (this.entries ?? []).filter(item => item.id !== id && !item.closing);
195
+ if (remainingActive.length === 0) {
196
+ this.isBackdropVisible = false;
197
+ }
198
+ const dismissTimerId = setTimeout(() => {
199
+ this.finalizeDismiss(id);
200
+ }, ANIMATION_DURATION);
201
+ this.entries = (this.entries ?? []).map(item => item.id === id ? { ...item, closing: true, dismissTimerId } : item);
202
+ if (reason === 'confirm')
203
+ entry.chain._triggerOk();
204
+ if (reason === 'cancel')
205
+ entry.chain._triggerCancel();
206
+ }
207
+ finalizeDismiss(id) {
208
+ const entry = (this.entries ?? []).find(item => item.id === id);
209
+ if (!entry)
210
+ return;
211
+ if (entry.dismissTimerId)
212
+ clearTimeout(entry.dismissTimerId);
213
+ entry.modalEl.remove();
214
+ const nextEntries = (this.entries ?? []).filter(item => item.id !== id);
215
+ this.entries = nextEntries;
216
+ if (nextEntries.length === 0) {
217
+ this.containerDismissTimerId = setTimeout(() => {
218
+ if ((this.entries ?? []).length === 0) {
219
+ this.isVisible = false;
220
+ }
221
+ this.containerDismissTimerId = undefined;
222
+ }, ANIMATION_DURATION);
223
+ }
224
+ }
225
+ waitForModalReady(modalEl) {
226
+ const componentOnReady = modalEl.componentOnReady;
227
+ if (typeof componentOnReady === 'function') {
228
+ return componentOnReady.call(modalEl).then(() => undefined);
229
+ }
230
+ return new Promise(resolve => {
231
+ requestAnimationFrame(() => {
232
+ requestAnimationFrame(() => resolve());
233
+ });
234
+ });
235
+ }
236
+ hasOwnProp(options, key) {
237
+ return Object.prototype.hasOwnProperty.call(options, key);
238
+ }
239
+ setAttr(el, name, value) {
240
+ if (value == null)
241
+ return;
242
+ el.setAttribute(name, value);
243
+ }
244
+ render() {
245
+ if (!this.isVisible)
246
+ return null;
247
+ return (h("div", { class: "sd-modal-container" }, h("div", { class: {
248
+ 'sd-modal-container__backdrop': true,
249
+ 'sd-modal-container__backdrop--visible': this.isBackdropVisible,
250
+ }, onClick: this.handleBackdropClick }), h("div", { class: "sd-modal-container__content", ref: el => { this.contentRef = el; } })));
251
+ }
252
+ static get is() { return "sd-modal-container"; }
253
+ static get originalStyleUrls() {
254
+ return {
255
+ "$": ["sd-modal-container.scss"]
256
+ };
257
+ }
258
+ static get styleUrls() {
259
+ return {
260
+ "$": ["sd-modal-container.css"]
261
+ };
262
+ }
263
+ static get states() {
264
+ return {
265
+ "entries": {},
266
+ "isVisible": {},
267
+ "isBackdropVisible": {}
268
+ };
269
+ }
270
+ static get methods() {
271
+ return {
272
+ "open": {
273
+ "complexType": {
274
+ "signature": "(options: ConfirmModalOptions, chain: ModalDialogChainLike) => Promise<string>",
275
+ "parameters": [{
276
+ "name": "options",
277
+ "type": "ConfirmModalOptions",
278
+ "docs": ""
279
+ }, {
280
+ "name": "chain",
281
+ "type": "ModalDialogChainLike",
282
+ "docs": ""
283
+ }],
284
+ "references": {
285
+ "Promise": {
286
+ "location": "global",
287
+ "id": "global::Promise"
288
+ },
289
+ "ConfirmModalOptions": {
290
+ "location": "import",
291
+ "path": "./sd-modal-container.config",
292
+ "id": "src/components/sd-modal-container/sd-modal-container.config.ts::ConfirmModalOptions",
293
+ "referenceLocation": "ConfirmModalOptions"
294
+ },
295
+ "ModalDialogChainLike": {
296
+ "location": "import",
297
+ "path": "./sd-modal-container.config",
298
+ "id": "src/components/sd-modal-container/sd-modal-container.config.ts::ModalDialogChainLike",
299
+ "referenceLocation": "ModalDialogChainLike"
300
+ }
301
+ },
302
+ "return": "Promise<string>"
303
+ },
304
+ "docs": {
305
+ "text": "",
306
+ "tags": []
307
+ }
308
+ },
309
+ "openNotice": {
310
+ "complexType": {
311
+ "signature": "(options: NoticeModalOptions, chain: ModalDialogChainLike) => Promise<string>",
312
+ "parameters": [{
313
+ "name": "options",
314
+ "type": "NoticeModalOptions",
315
+ "docs": ""
316
+ }, {
317
+ "name": "chain",
318
+ "type": "ModalDialogChainLike",
319
+ "docs": ""
320
+ }],
321
+ "references": {
322
+ "Promise": {
323
+ "location": "global",
324
+ "id": "global::Promise"
325
+ },
326
+ "NoticeModalOptions": {
327
+ "location": "import",
328
+ "path": "./sd-modal-container.config",
329
+ "id": "src/components/sd-modal-container/sd-modal-container.config.ts::NoticeModalOptions",
330
+ "referenceLocation": "NoticeModalOptions"
331
+ },
332
+ "ModalDialogChainLike": {
333
+ "location": "import",
334
+ "path": "./sd-modal-container.config",
335
+ "id": "src/components/sd-modal-container/sd-modal-container.config.ts::ModalDialogChainLike",
336
+ "referenceLocation": "ModalDialogChainLike"
337
+ }
338
+ },
339
+ "return": "Promise<string>"
340
+ },
341
+ "docs": {
342
+ "text": "",
343
+ "tags": []
344
+ }
345
+ },
346
+ "update": {
347
+ "complexType": {
348
+ "signature": "(id: string, props: Partial<ConfirmModalOptions & NoticeModalOptions>) => Promise<void>",
349
+ "parameters": [{
350
+ "name": "id",
351
+ "type": "string",
352
+ "docs": ""
353
+ }, {
354
+ "name": "props",
355
+ "type": "{ type?: ConfirmModalType | undefined; title?: string | undefined; titleClass?: string | undefined; topMessage?: string[] | undefined; bottomMessage?: string[] | undefined; mainButtonName?: ConfirmModalMainButton | undefined; mainButtonLabel?: string | undefined; subButtonLabel?: string | undefined; tagPreset?: \"square_xs_red\" | \"square_xs_orange\" | \"square_xs_yellow\" | \"square_xs_green\" | \"square_xs_blue\" | \"square_xs_darkblue\" | \"square_xs_indigo\" | \"square_xs_grey\" | \"square_sm_red\" | \"square_sm_orange\" | \"square_sm_yellow\" | \"square_sm_green\" | \"square_sm_blue\" | \"square_sm_darkblue\" | \"square_sm_indigo\" | \"square_sm_grey\" | \"square_md_red\" | \"square_md_orange\" | \"square_md_yellow\" | \"square_md_green\" | \"square_md_blue\" | \"square_md_darkblue\" | \"square_md_indigo\" | \"square_md_grey\" | \"pill_xs_red\" | \"pill_xs_orange\" | \"pill_xs_yellow\" | \"pill_xs_green\" | \"pill_xs_blue\" | \"pill_xs_darkblue\" | \"pill_xs_indigo\" | \"pill_xs_grey\" | \"pill_sm_red\" | \"pill_sm_orange\" | \"pill_sm_yellow\" | \"pill_sm_green\" | \"pill_sm_blue\" | \"pill_sm_darkblue\" | \"pill_sm_indigo\" | \"pill_sm_grey\" | \"pill_md_red\" | \"pill_md_orange\" | \"pill_md_yellow\" | \"pill_md_green\" | \"pill_md_blue\" | \"pill_md_darkblue\" | \"pill_md_indigo\" | \"pill_md_grey\" | undefined; tagLabel?: string | undefined; slotLabel?: string | undefined; tagContents?: HTMLElement | undefined; persistent?: boolean | undefined; }",
356
+ "docs": ""
357
+ }],
358
+ "references": {
359
+ "Promise": {
360
+ "location": "global",
361
+ "id": "global::Promise"
362
+ },
363
+ "Partial": {
364
+ "location": "global",
365
+ "id": "global::Partial"
366
+ },
367
+ "ConfirmModalOptions": {
368
+ "location": "import",
369
+ "path": "./sd-modal-container.config",
370
+ "id": "src/components/sd-modal-container/sd-modal-container.config.ts::ConfirmModalOptions",
371
+ "referenceLocation": "ConfirmModalOptions"
372
+ },
373
+ "NoticeModalOptions": {
374
+ "location": "import",
375
+ "path": "./sd-modal-container.config",
376
+ "id": "src/components/sd-modal-container/sd-modal-container.config.ts::NoticeModalOptions",
377
+ "referenceLocation": "NoticeModalOptions"
378
+ }
379
+ },
380
+ "return": "Promise<void>"
381
+ },
382
+ "docs": {
383
+ "text": "",
384
+ "tags": []
385
+ }
386
+ }
387
+ };
388
+ }
389
+ static get elementRef() { return "el"; }
390
+ static get listeners() {
391
+ return [{
392
+ "name": "keydown",
393
+ "method": "handleKeydown",
394
+ "target": "window",
395
+ "capture": false,
396
+ "passive": false
397
+ }];
398
+ }
399
+ }
@@ -0,0 +1,3 @@
1
+ import { CLOSE_ICON_SIZE, CLOSE_ICON_COLOR, } from "../sd-confirm-modal/sd-confirm-modal.config";
2
+ export const NOTICE_BUTTON_PRESET = 'neutral_outline_md';
3
+ export { CLOSE_ICON_SIZE, CLOSE_ICON_COLOR, };
@@ -0,0 +1,61 @@
1
+ sd-notice-modal {
2
+ display: block;
3
+ width: fit-content;
4
+ min-width: 520px;
5
+ }
6
+ sd-notice-modal .sd-notice-modal {
7
+ position: relative;
8
+ padding: var(--sd-modal-modal-padding-y) var(--sd-modal-modal-padding-x);
9
+ border-radius: var(--sd-modal-modal-radius);
10
+ box-shadow: 4px 4px 24px 4px rgba(0, 0, 0, 0.2);
11
+ background: var(--sd-modal-modal-bg);
12
+ }
13
+ sd-notice-modal .sd-notice-modal__close-button {
14
+ position: absolute;
15
+ top: 16px;
16
+ right: 16px;
17
+ cursor: pointer;
18
+ }
19
+ sd-notice-modal .sd-notice-modal__title {
20
+ color: var(--sd-modal-modal-title-color);
21
+ font-size: var(--sd-modal-modal-title-typography-font-size);
22
+ font-weight: var(--sd-modal-modal-title-typography-font-weight);
23
+ line-height: var(--sd-modal-modal-title-typography-line-height);
24
+ text-align: center;
25
+ margin: 0 0 var(--sd-modal-modal-body-gap) 0;
26
+ }
27
+ sd-notice-modal .sd-notice-modal__body {
28
+ display: flex;
29
+ flex-direction: column;
30
+ gap: var(--sd-modal-modal-body-gap);
31
+ }
32
+ sd-notice-modal .sd-notice-modal__message-text {
33
+ color: var(--sd-modal-modal-message-color);
34
+ font-size: var(--sd-modal-modal-message-typography-font-size);
35
+ font-weight: var(--sd-modal-modal-message-typography-font-weight);
36
+ line-height: var(--sd-modal-modal-message-typography-line-height);
37
+ text-align: center;
38
+ margin: 0;
39
+ }
40
+ sd-notice-modal .sd-notice-modal__content-box {
41
+ display: flex;
42
+ align-items: center;
43
+ justify-content: center;
44
+ gap: 8px;
45
+ padding: 12px 16px;
46
+ border: 1px solid #e1e1e1;
47
+ border-radius: 8px;
48
+ background: white;
49
+ }
50
+ sd-notice-modal .sd-notice-modal__slot-label {
51
+ font-size: 14px;
52
+ font-weight: 700;
53
+ line-height: var(--sd-modal-modal-message-typography-line-height);
54
+ color: var(--sd-modal-modal-message-color);
55
+ }
56
+ sd-notice-modal .sd-notice-modal__button {
57
+ display: flex;
58
+ justify-content: center;
59
+ gap: var(--sd-modal-modal-button-gap);
60
+ margin-top: 32px;
61
+ }