@sellmate/design-system 1.0.40 → 1.0.42

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 (249) hide show
  1. package/dist/cjs/component.textinput-43trvZ5m.js +41 -0
  2. package/dist/cjs/design-system.cjs.js +1 -1
  3. package/dist/cjs/index.cjs.js +0 -9
  4. package/dist/cjs/loader.cjs.js +1 -1
  5. package/dist/cjs/sd-barcode-input.cjs.entry.js +162 -0
  6. package/dist/cjs/sd-button-v2_2.cjs.entry.js +4 -4
  7. package/dist/cjs/sd-button_20.cjs.entry.js +44 -69
  8. package/dist/cjs/sd-card.cjs.entry.js +1 -1
  9. package/dist/cjs/sd-confirm-modal.cjs.entry.js +124 -0
  10. package/dist/cjs/sd-date-picker.cjs.entry.js +1 -1
  11. package/dist/cjs/sd-dropdown-button.cjs.entry.js +3 -3
  12. package/dist/cjs/sd-file-picker.cjs.entry.js +3 -3
  13. package/dist/cjs/sd-guide.cjs.entry.js +2 -2
  14. package/dist/cjs/sd-modal-container.cjs.entry.js +17 -73
  15. package/dist/cjs/sd-popover.cjs.entry.js +10 -2
  16. package/dist/cjs/sd-progress.cjs.entry.js +2 -2
  17. package/dist/cjs/sd-select-group.cjs.entry.js +1 -1
  18. package/dist/cjs/sd-select-multiple.cjs.entry.js +1 -1
  19. package/dist/cjs/sd-select-option-group.cjs.entry.js +3 -3
  20. package/dist/cjs/sd-select-v2-list-item_2.cjs.entry.js +7 -16
  21. package/dist/cjs/sd-select-v2-listbox_2.cjs.entry.js +181 -14
  22. package/dist/cjs/sd-select-v2.cjs.entry.js +13 -21
  23. package/dist/cjs/{sd-select-v2.config-DZrPJ6OS.js → sd-select-v2.config-BJXi4hMP.js} +12 -7
  24. package/dist/cjs/sd-text-link.cjs.entry.js +3 -3
  25. package/dist/cjs/sd-toast-container.cjs.entry.js +1 -1
  26. package/dist/cjs/sd-toast.cjs.entry.js +2 -2
  27. package/dist/cjs/sd-toggle-button.cjs.entry.js +1 -1
  28. package/dist/cjs/sd-toggle.cjs.entry.js +1 -1
  29. package/dist/collection/collection-manifest.json +1 -1
  30. package/dist/collection/components/sd-barcode-input/sd-barcode-input.config.js +34 -0
  31. package/dist/collection/components/sd-barcode-input/sd-barcode-input.css +72 -0
  32. package/dist/collection/components/sd-barcode-input/sd-barcode-input.js +750 -0
  33. package/dist/collection/components/sd-button-v2/sd-button-v2.js +2 -2
  34. package/dist/collection/components/sd-card/sd-card.js +1 -1
  35. package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.config.js +4 -1
  36. package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.css +17 -17
  37. package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.js +7 -7
  38. package/dist/collection/components/sd-date-picker/sd-date-picker.js +1 -1
  39. package/dist/collection/components/sd-date-range-picker/sd-date-range-picker.js +4 -4
  40. package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.js +3 -3
  41. package/dist/collection/components/sd-field/sd-field.js +4 -3
  42. package/dist/collection/components/sd-file-picker/sd-file-picker.js +3 -3
  43. package/dist/collection/components/sd-floating-portal/sd-floating-portal.js +1 -1
  44. package/dist/collection/components/sd-guide/sd-guide.js +2 -2
  45. package/dist/collection/components/sd-icon/sd-icon.js +1 -1
  46. package/dist/collection/components/sd-input/sd-input.js +2 -2
  47. package/dist/collection/components/sd-loading-spinner/sd-loading-spinner.js +1 -1
  48. package/dist/collection/components/sd-modal-container/sd-modal-container.js +19 -118
  49. package/dist/collection/components/sd-number-input/sd-number-input.js +4 -4
  50. package/dist/collection/components/sd-pagination/sd-pagination.js +2 -2
  51. package/dist/collection/components/sd-popover/sd-popover.js +10 -2
  52. package/dist/collection/components/sd-portal/sd-portal.js +1 -1
  53. package/dist/collection/components/sd-progress/sd-progress.js +2 -2
  54. package/dist/collection/components/sd-select/sd-select-dropdown/sd-select-dropdown.js +2 -2
  55. package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
  56. package/dist/collection/components/sd-select/sd-select-search-input/sd-select-search-input.js +3 -3
  57. package/dist/collection/components/sd-select-group/sd-select-group.js +1 -1
  58. package/dist/collection/components/sd-select-multiple/sd-select-multiple.js +1 -1
  59. package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
  60. package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.css +6 -6
  61. package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.js +2 -2
  62. package/dist/collection/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.js +3 -12
  63. package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.css +1 -0
  64. package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +185 -16
  65. package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -2
  66. package/dist/collection/components/sd-select-v2/sd-select-v2.config.js +12 -7
  67. package/dist/collection/components/sd-select-v2/sd-select-v2.js +13 -21
  68. package/dist/collection/components/sd-tag/sd-tag.js +2 -2
  69. package/dist/collection/components/sd-text-link/sd-text-link.js +3 -3
  70. package/dist/collection/components/sd-textarea/sd-textarea.js +2 -2
  71. package/dist/collection/components/sd-toast/sd-toast.js +2 -2
  72. package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
  73. package/dist/collection/components/sd-toggle/sd-toggle.js +1 -1
  74. package/dist/collection/components/sd-toggle-button/sd-toggle-button.js +1 -1
  75. package/dist/collection/components/sd-tooltip/sd-tooltip.js +10 -2
  76. package/dist/collection/utils/modal.js +0 -9
  77. package/dist/components/index.js +1 -1
  78. package/dist/components/{p-8oyZJ0FK.js → p-6FZWkn3V.js} +1 -1
  79. package/dist/components/p-AfdVu7_V.js +1 -0
  80. package/dist/components/{p-PcxVERcm.js → p-B2IPxQNl.js} +1 -1
  81. package/dist/components/{p-DBCQtIY4.js → p-BBKrHUCP.js} +1 -1
  82. package/dist/components/{p-A5atk1St.js → p-BKtAiyh0.js} +1 -1
  83. package/dist/components/{p-5UN9Ry8A.js → p-BXuZFSsU.js} +1 -1
  84. package/dist/components/{p-CZN_I4v-.js → p-BZJDhQ6h.js} +1 -1
  85. package/dist/components/{p-CKi7RueC.js → p-BfqA9RSe.js} +1 -1
  86. package/dist/components/{p-2JXqy61T.js → p-Bo7U7jA2.js} +1 -1
  87. package/dist/components/{p-VztCEgcN.js → p-C7dgr7sG.js} +1 -1
  88. package/dist/components/p-CArAuWdh.js +1 -0
  89. package/dist/components/{p-vznqVg6E.js → p-CPr3lzac.js} +1 -1
  90. package/dist/components/{p-DEBuE-pW.js → p-CV1qJByG.js} +1 -1
  91. package/dist/components/p-CXjMXCNh.js +1 -0
  92. package/dist/components/p-CbjDAdZ_.js +1 -0
  93. package/dist/components/p-CnZPI5RL.js +1 -0
  94. package/dist/components/{p-du_AmhYu.js → p-CrJXDjO0.js} +1 -1
  95. package/dist/components/{p-DtCG-y6d.js → p-Cx2K_zB2.js} +1 -1
  96. package/dist/components/{p-CJZIwyH-.js → p-D3H3ILJG.js} +1 -1
  97. package/dist/components/{p-BNNjhCQc.js → p-DgDoP1wQ.js} +1 -1
  98. package/dist/components/{p-DPjPJkXv.js → p-DvQzT5XM.js} +1 -1
  99. package/dist/components/{p-CjZTu6hh.js → p-UaMNiu8y.js} +1 -1
  100. package/dist/components/p-gHb970iC.js +1 -0
  101. package/dist/components/p-jaHdAlr9.js +1 -0
  102. package/dist/components/{p-Ese2dRYD.js → p-jk3tAdJg.js} +1 -1
  103. package/dist/components/p-qbtTff3q.js +1 -0
  104. package/dist/components/{sd-notice-modal.d.ts → sd-barcode-input.d.ts} +4 -4
  105. package/dist/components/sd-barcode-input.js +1 -0
  106. package/dist/components/sd-button-v2.js +1 -1
  107. package/dist/components/sd-button.js +1 -1
  108. package/dist/components/sd-calendar.js +1 -1
  109. package/dist/components/sd-card.js +1 -1
  110. package/dist/components/sd-checkbox.js +1 -1
  111. package/dist/components/sd-confirm-modal.js +1 -1
  112. package/dist/components/sd-date-picker.js +1 -1
  113. package/dist/components/sd-date-range-picker.js +1 -1
  114. package/dist/components/sd-dropdown-button.js +1 -1
  115. package/dist/components/sd-field.js +1 -1
  116. package/dist/components/sd-file-picker.js +1 -1
  117. package/dist/components/sd-floating-portal.js +1 -1
  118. package/dist/components/sd-guide.js +1 -1
  119. package/dist/components/sd-icon.js +1 -1
  120. package/dist/components/sd-input.js +1 -1
  121. package/dist/components/sd-loading-spinner.js +1 -1
  122. package/dist/components/sd-modal-container.js +1 -1
  123. package/dist/components/sd-number-input.js +1 -1
  124. package/dist/components/sd-pagination.js +1 -1
  125. package/dist/components/sd-popover.js +1 -1
  126. package/dist/components/sd-portal.js +1 -1
  127. package/dist/components/sd-progress.js +1 -1
  128. package/dist/components/sd-select-dropdown.js +1 -1
  129. package/dist/components/sd-select-group.js +1 -1
  130. package/dist/components/sd-select-multiple-group.js +1 -1
  131. package/dist/components/sd-select-multiple.js +1 -1
  132. package/dist/components/sd-select-option-group.js +1 -1
  133. package/dist/components/sd-select-option.js +1 -1
  134. package/dist/components/sd-select-search-input.js +1 -1
  135. package/dist/components/sd-select-v2-list-item-search.js +1 -1
  136. package/dist/components/sd-select-v2-list-item.js +1 -1
  137. package/dist/components/sd-select-v2-listbox.js +1 -1
  138. package/dist/components/sd-select-v2-trigger.js +1 -1
  139. package/dist/components/sd-select-v2.js +1 -1
  140. package/dist/components/sd-select.js +1 -1
  141. package/dist/components/sd-table.js +1 -1
  142. package/dist/components/sd-tabs.js +1 -1
  143. package/dist/components/sd-tag.js +1 -1
  144. package/dist/components/sd-text-link.js +1 -1
  145. package/dist/components/sd-textarea.js +1 -1
  146. package/dist/components/sd-toast-container.js +1 -1
  147. package/dist/components/sd-toast.js +1 -1
  148. package/dist/components/sd-toggle-button.js +1 -1
  149. package/dist/components/sd-toggle.js +1 -1
  150. package/dist/components/sd-tooltip.js +1 -1
  151. package/dist/design-system/design-system.css +1 -1
  152. package/dist/design-system/design-system.esm.js +1 -1
  153. package/dist/design-system/index.esm.js +1 -1
  154. package/dist/design-system/p-0174f3c5.entry.js +1 -0
  155. package/dist/design-system/{p-8e0cc9be.entry.js → p-0dee408f.entry.js} +1 -1
  156. package/dist/design-system/{p-fb71301e.entry.js → p-4301b50d.entry.js} +1 -1
  157. package/dist/design-system/p-4921c569.entry.js +1 -0
  158. package/dist/design-system/{p-2408d1ab.entry.js → p-50b1196b.entry.js} +1 -1
  159. package/dist/design-system/p-535b0778.entry.js +1 -0
  160. package/dist/design-system/{p-7ce76a05.entry.js → p-57b1e335.entry.js} +1 -1
  161. package/dist/design-system/{p-6a34e6b8.entry.js → p-5ce3142c.entry.js} +1 -1
  162. package/dist/design-system/{p-d8b04e91.entry.js → p-634797a4.entry.js} +1 -1
  163. package/dist/design-system/{p-b71d0858.entry.js → p-63a43fc9.entry.js} +1 -1
  164. package/dist/design-system/{p-72b09ede.entry.js → p-6a371d98.entry.js} +1 -1
  165. package/dist/design-system/p-6db4e8c7.entry.js +1 -0
  166. package/dist/design-system/{p-36ba5f33.entry.js → p-7368eb09.entry.js} +1 -1
  167. package/dist/design-system/p-868ce552.entry.js +1 -0
  168. package/dist/design-system/p-9eea4660.entry.js +1 -0
  169. package/dist/design-system/p-CbjDAdZ_.js +1 -0
  170. package/dist/design-system/{p-9933475e.entry.js → p-aaf91535.entry.js} +1 -1
  171. package/dist/design-system/{p-e96c881f.entry.js → p-c1963b5e.entry.js} +1 -1
  172. package/dist/design-system/{p-63f997d7.entry.js → p-dc6246be.entry.js} +1 -1
  173. package/dist/design-system/p-e39687d0.entry.js +1 -0
  174. package/dist/design-system/p-f91f4fcc.entry.js +1 -0
  175. package/dist/design-system/{p-f9075737.entry.js → p-f9cf0d6f.entry.js} +1 -1
  176. package/dist/design-system/{p-b79756cc.entry.js → p-fdde3de0.entry.js} +1 -1
  177. package/dist/design-system/p-feb80c2f.entry.js +1 -0
  178. package/dist/design-system/{p-BOmBg3kj.js → p-o9Ugc4Ua.js} +1 -1
  179. package/dist/esm/component.textinput-CbjDAdZ_.js +39 -0
  180. package/dist/esm/design-system.js +1 -1
  181. package/dist/esm/index.js +0 -9
  182. package/dist/esm/loader.js +1 -1
  183. package/dist/esm/sd-barcode-input.entry.js +160 -0
  184. package/dist/esm/sd-button-v2_2.entry.js +4 -4
  185. package/dist/esm/sd-button_20.entry.js +39 -64
  186. package/dist/esm/sd-card.entry.js +1 -1
  187. package/dist/esm/sd-confirm-modal.entry.js +122 -0
  188. package/dist/esm/sd-date-picker.entry.js +1 -1
  189. package/dist/esm/sd-dropdown-button.entry.js +3 -3
  190. package/dist/esm/sd-file-picker.entry.js +3 -3
  191. package/dist/esm/sd-guide.entry.js +2 -2
  192. package/dist/esm/sd-modal-container.entry.js +17 -73
  193. package/dist/esm/sd-popover.entry.js +10 -2
  194. package/dist/esm/sd-progress.entry.js +2 -2
  195. package/dist/esm/sd-select-group.entry.js +1 -1
  196. package/dist/esm/sd-select-multiple.entry.js +1 -1
  197. package/dist/esm/sd-select-option-group.entry.js +3 -3
  198. package/dist/esm/sd-select-v2-list-item_2.entry.js +7 -16
  199. package/dist/esm/sd-select-v2-listbox_2.entry.js +181 -14
  200. package/dist/esm/{sd-select-v2.config-BOmBg3kj.js → sd-select-v2.config-o9Ugc4Ua.js} +12 -7
  201. package/dist/esm/sd-select-v2.entry.js +13 -21
  202. package/dist/esm/sd-text-link.entry.js +3 -3
  203. package/dist/esm/sd-toast-container.entry.js +1 -1
  204. package/dist/esm/sd-toast.entry.js +2 -2
  205. package/dist/esm/sd-toggle-button.entry.js +1 -1
  206. package/dist/esm/sd-toggle.entry.js +1 -1
  207. package/dist/types/components/sd-barcode-input/sd-barcode-input.config.d.ts +38 -0
  208. package/dist/types/components/sd-barcode-input/sd-barcode-input.d.ts +50 -0
  209. package/dist/types/components/sd-confirm-modal/sd-confirm-modal.config.d.ts +4 -3
  210. package/dist/types/components/sd-confirm-modal/sd-confirm-modal.d.ts +1 -1
  211. package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +3 -13
  212. package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +2 -5
  213. package/dist/types/components/sd-popover/sd-popover.d.ts +1 -0
  214. package/dist/types/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.d.ts +0 -1
  215. package/dist/types/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.d.ts +44 -2
  216. package/dist/types/components/sd-select-v2/sd-select-v2.config.d.ts +4 -0
  217. package/dist/types/components/sd-select-v2/sd-select-v2.d.ts +0 -1
  218. package/dist/types/components/sd-tooltip/sd-tooltip.d.ts +1 -0
  219. package/dist/types/components.d.ts +249 -130
  220. package/dist/types/index.d.ts +1 -1
  221. package/dist/types/utils/modal.d.ts +3 -4
  222. package/hydrate/index.js +584 -368
  223. package/hydrate/index.mjs +584 -368
  224. package/package.json +1 -1
  225. package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +0 -199
  226. package/dist/collection/components/sd-notice-modal/sd-notice-modal.config.js +0 -3
  227. package/dist/collection/components/sd-notice-modal/sd-notice-modal.css +0 -61
  228. package/dist/collection/components/sd-notice-modal/sd-notice-modal.js +0 -324
  229. package/dist/components/p-BDUKWznE.js +0 -1
  230. package/dist/components/p-BzfvfP0u.js +0 -1
  231. package/dist/components/p-C-AFCWLs.js +0 -1
  232. package/dist/components/p-CN-WKnUJ.js +0 -1
  233. package/dist/components/p-C_L-UaCP.js +0 -1
  234. package/dist/components/p-CrYrMUpQ.js +0 -1
  235. package/dist/components/p-D0PYeSW9.js +0 -1
  236. package/dist/components/p-DLe_Tu-I.js +0 -1
  237. package/dist/components/p-H9Vl4enQ.js +0 -1
  238. package/dist/components/sd-notice-modal.js +0 -1
  239. package/dist/design-system/p-10945e57.entry.js +0 -1
  240. package/dist/design-system/p-342f48ab.entry.js +0 -1
  241. package/dist/design-system/p-3ded14dc.entry.js +0 -1
  242. package/dist/design-system/p-951e5615.entry.js +0 -1
  243. package/dist/design-system/p-9c6fea35.entry.js +0 -1
  244. package/dist/design-system/p-9d431ea6.entry.js +0 -1
  245. package/dist/design-system/p-ba393cc8.entry.js +0 -1
  246. package/dist/design-system/p-df1f9832.entry.js +0 -1
  247. package/dist/esm/sd-confirm-modal_2.entry.js +0 -196
  248. package/dist/types/components/sd-notice-modal/sd-notice-modal.config.d.ts +0 -5
  249. package/dist/types/components/sd-notice-modal/sd-notice-modal.d.ts +0 -28
@@ -23,7 +23,7 @@ const SdModalContainer = class {
23
23
  this.shakeModal(top.modalEl);
24
24
  return;
25
25
  }
26
- this.requestDismiss(top.id, 'cancel');
26
+ this.requestDismiss(top.id, 'close');
27
27
  }
28
28
  }
29
29
  async open(options, chain) {
@@ -33,33 +33,7 @@ const SdModalContainer = class {
33
33
  clearTimeout(this.containerDismissTimerId);
34
34
  this.containerDismissTimerId = undefined;
35
35
  }
36
- this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
37
- this.isVisible = true;
38
- // Append after the container renders, then wait until the modal can paint before starting transitions.
39
- requestAnimationFrame(() => {
40
- if (this.contentRef) {
41
- this.contentRef.appendChild(modalEl);
42
- this.waitForModalReady(modalEl).then(() => {
43
- requestAnimationFrame(() => {
44
- const currentEntry = (this.entries ?? []).find(item => item.id === id);
45
- if (!currentEntry || currentEntry.closing || !modalEl.isConnected)
46
- return;
47
- this.isBackdropVisible = true;
48
- modalEl.classList.add('sd-modal-container__modal--visible');
49
- });
50
- });
51
- }
52
- });
53
- return id;
54
- }
55
- async openNotice(options, chain) {
56
- const id = `modal-${++modalIdCounter}`;
57
- const modalEl = this.createNoticeModal(id, options);
58
- if (this.containerDismissTimerId) {
59
- clearTimeout(this.containerDismissTimerId);
60
- this.containerDismissTimerId = undefined;
61
- }
62
- this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closing: false }];
36
+ this.entries = [...(this.entries ?? []), { id, modalEl, chain, persistent: !!options.persistent, closeAction: options.closeAction ?? 'none', closing: false }];
63
37
  this.isVisible = true;
64
38
  requestAnimationFrame(() => {
65
39
  if (this.contentRef) {
@@ -88,11 +62,11 @@ const SdModalContainer = class {
88
62
  el.setAttribute('data-modal-id', id);
89
63
  el.classList.add('sd-modal-container__modal');
90
64
  this.applyProps(el, options);
91
- el.addEventListener('sdConfirm', () => {
65
+ el.addEventListener('sdOk', () => {
92
66
  this.requestDismiss(id, 'confirm');
93
67
  });
94
68
  el.addEventListener('sdClose', () => {
95
- this.requestDismiss(id, 'cancel');
69
+ this.requestDismiss(id, 'close');
96
70
  });
97
71
  return el;
98
72
  }
@@ -125,43 +99,6 @@ const SdModalContainer = class {
125
99
  if (this.hasOwnProp(options, 'tagContents'))
126
100
  el.tagContents = options.tagContents;
127
101
  }
128
- createNoticeModal(id, options) {
129
- const el = document.createElement('sd-notice-modal');
130
- el.setAttribute('data-modal-id', id);
131
- el.classList.add('sd-modal-container__modal');
132
- this.applyNoticeProps(el, options);
133
- el.addEventListener('sdConfirm', () => {
134
- this.requestDismiss(id, 'confirm');
135
- });
136
- el.addEventListener('sdClose', () => {
137
- this.requestDismiss(id, 'cancel');
138
- });
139
- return el;
140
- }
141
- applyNoticeProps(el, options) {
142
- if (this.hasOwnProp(options, 'title'))
143
- this.setAttr(el, 'modal-title', options.title);
144
- if (this.hasOwnProp(options, 'titleClass'))
145
- this.setAttr(el, 'title-class', options.titleClass);
146
- if (this.hasOwnProp(options, 'mainButtonLabel')) {
147
- this.setAttr(el, 'main-button-label', options.mainButtonLabel);
148
- }
149
- if (this.hasOwnProp(options, 'subButtonLabel')) {
150
- this.setAttr(el, 'sub-button-label', options.subButtonLabel);
151
- }
152
- if (this.hasOwnProp(options, 'tagPreset'))
153
- this.setAttr(el, 'tag-preset', options.tagPreset);
154
- if (this.hasOwnProp(options, 'tagLabel'))
155
- this.setAttr(el, 'tag-label', options.tagLabel);
156
- if (this.hasOwnProp(options, 'slotLabel'))
157
- this.setAttr(el, 'slot-label', options.slotLabel);
158
- if (this.hasOwnProp(options, 'topMessage'))
159
- el.topMessage = options.topMessage ?? [];
160
- if (this.hasOwnProp(options, 'bottomMessage'))
161
- el.bottomMessage = options.bottomMessage ?? [];
162
- if (this.hasOwnProp(options, 'tagContents'))
163
- el.tagContents = options.tagContents;
164
- }
165
102
  handleBackdropClick = () => {
166
103
  const top = this.getTopEntry();
167
104
  if (!top)
@@ -170,7 +107,7 @@ const SdModalContainer = class {
170
107
  this.shakeModal(top.modalEl);
171
108
  return;
172
109
  }
173
- this.requestDismiss(top.id, 'cancel');
110
+ this.requestDismiss(top.id, 'close');
174
111
  };
175
112
  shakeModal(modalEl) {
176
113
  const cls = 'sd-modal-container__modal--shake';
@@ -196,7 +133,6 @@ const SdModalContainer = class {
196
133
  if (!entry || entry.closing)
197
134
  return;
198
135
  entry.modalEl.classList.remove('sd-modal-container__modal--visible');
199
- // fade out backdrop simultaneously if this is the last active modal
200
136
  const remainingActive = (this.entries ?? []).filter(item => item.id !== id && !item.closing);
201
137
  if (remainingActive.length === 0) {
202
138
  this.isBackdropVisible = false;
@@ -205,10 +141,18 @@ const SdModalContainer = class {
205
141
  this.finalizeDismiss(id);
206
142
  }, ANIMATION_DURATION);
207
143
  this.entries = (this.entries ?? []).map(item => item.id === id ? { ...item, closing: true, dismissTimerId } : item);
208
- if (reason === 'confirm')
209
- entry.chain._triggerOk();
210
- if (reason === 'cancel')
211
- entry.chain._triggerCancel();
144
+ if (reason === 'close') {
145
+ if (entry.closeAction === 'ok')
146
+ entry.chain._triggerOk();
147
+ else if (entry.closeAction === 'cancel')
148
+ entry.chain._triggerCancel();
149
+ }
150
+ else {
151
+ if (reason === 'confirm')
152
+ entry.chain._triggerOk();
153
+ if (reason === 'cancel')
154
+ entry.chain._triggerCancel();
155
+ }
212
156
  }
213
157
  finalizeDismiss(id) {
214
158
  const entry = (this.entries ?? []).find(item => item.id === id);
@@ -42,18 +42,26 @@ const SdPopover = class {
42
42
  this.slotContent = this.el.innerHTML;
43
43
  }
44
44
  buttonEl;
45
+ get popoverOffset() {
46
+ switch (this.placement) {
47
+ case 'top': return [0, -4];
48
+ case 'bottom': return [0, 4];
49
+ case 'left': return [4, 0];
50
+ case 'right': return [4, 0];
51
+ }
52
+ }
45
53
  handleClose = () => {
46
54
  this.showPopover = false;
47
55
  };
48
56
  render() {
49
- return (h(Fragment, { key: '205b8f574ce69afcb2abef1b0d0d6ec769230783' }, this.label ? (h("sd-button", { ref: el => (this.buttonEl = el), label: this.label, icon: this.icon, size: this.buttonSize, color: this.color, variant: this.buttonVariant, class: "sd-popover", onSdClick: () => (this.showPopover = !this.showPopover) })) : (h("sd-icon", { ref: el => (this.buttonEl = el), name: this.icon, size: this.iconSize, color: this.color, class: "sd-popover", onClick: () => (this.showPopover = !this.showPopover) })), this.showPopover && (h("sd-floating-portal", { key: 'af82589e6ed773709c83a6855c37b1ac7092b9ec', parentRef: this.buttonEl, onSdClose: this.handleClose, placement: this.placement }, h("div", { key: 'dfee40fa54b436a43583ebdc71830e6d590e1793', class: {
57
+ return (h(Fragment, { key: 'f367ea2ada0fda7c28c943bd7bd48785b1810999' }, this.label ? (h("sd-button", { ref: el => (this.buttonEl = el), label: this.label, icon: this.icon, size: this.buttonSize, color: this.color, variant: this.buttonVariant, class: "sd-popover", onSdClick: () => (this.showPopover = !this.showPopover) })) : (h("sd-icon", { ref: el => (this.buttonEl = el), name: this.icon, size: this.iconSize, color: this.color, class: "sd-popover", onClick: () => (this.showPopover = !this.showPopover) })), this.showPopover && (h("sd-floating-portal", { key: 'afdb58bfdf25af2adc45a7b81221c1859b517a5a', parentRef: this.buttonEl, onSdClose: this.handleClose, placement: this.placement, offset: this.popoverOffset }, h("div", { key: '38757707dd8c055674edbc2381409f5fd8712c8d', class: {
50
58
  'sd-floating-menu': true,
51
59
  'sd-floating-menu--popover': true,
52
60
  [`sd-floating-menu--${this.placement}`]: true,
53
61
  [this.menuClass]: !!this.menuClass,
54
62
  }, style: {
55
63
  '--sd-floating-bg': popoverTokens.popover.bg,
56
- } }, h("i", { key: '388ac52f514ddd9247e79d20309a1de029fcd601', class: `sd-floating-menu__arrow sd-floating-menu__arrow--${this.placement}` }, h(TooltipArrow, { key: '2502e1a63e3dca7e9c6d66805a9ec04e3106dd99' })), h("div", { key: 'e12b0df1dbdfe4b34de81ed231e1578bb5361afa', class: "sd-floating-menu__content" }, this.menuTitle && h("div", { key: '91f068beee3338f547157db06a0eee4f5e88355d', class: "sd-floating-menu__title" }, this.menuTitle), this.messages.length > 0 && (h("div", { key: '1283a6209c1c062d925ae1c32ba2a4f2aa98c8fa', class: "sd-floating-menu__messages" }, this.messages.map(message => (h("div", null, message))))), this.buttons.length > 0 && (h("div", { key: '130f5468eb8ac34bb02dce9a5a55c1fad17c8dcf', class: `sd-floating-menu__buttons sd-floating-menu__buttons--${this.buttons.length}` }, this.buttons.map(button => (h("sd-button", { ...button })))))), this.useClose && (h("button", { key: '330fb79d032bac9da45afec3ccf0f2ec6e3dafba', title: "close", class: "sd-floating-menu__close-button", onClick: () => this.handleClose() }, h("sd-icon", { key: '7ba5d1e112ac776bb29253ac2cee510d36147ced', name: "close", size: popoverTokens.popover.close.icon, color: popoverTokens.popover.close.color }))))))));
64
+ } }, h("i", { key: '333bae4cb23470121d63d4d8b34a1d2b15837e7d', class: `sd-floating-menu__arrow sd-floating-menu__arrow--${this.placement}` }, h(TooltipArrow, { key: '617781bb6fc8957576eb149471fd8bf0f44ca552' })), h("div", { key: '8c57d49782edd344c8c2c0b9bf44fff8ec154159', class: "sd-floating-menu__content" }, this.menuTitle && h("div", { key: 'a06b93124684cb96910ffa2603cf7410a01d6381', class: "sd-floating-menu__title" }, this.menuTitle), this.messages.length > 0 && (h("div", { key: '24691930b8ae03a3c92ed8e74dae708b5e64f03b', class: "sd-floating-menu__messages" }, this.messages.map(message => (h("div", null, message))))), this.buttons.length > 0 && (h("div", { key: 'd73cd4cc978711857c4c946dd2a1c1b64bb5feb6', class: `sd-floating-menu__buttons sd-floating-menu__buttons--${this.buttons.length}` }, this.buttons.map(button => (h("sd-button", { ...button })))))), this.useClose && (h("button", { key: 'cda218024d04b03fc2931afa99f0127bc7a9c4c5', title: "close", class: "sd-floating-menu__close-button", onClick: () => this.handleClose() }, h("sd-icon", { key: '3f41ebce27fd4bab823370d6bbe25b5caed9d5e1', name: "close", size: popoverTokens.popover.close.icon, color: popoverTokens.popover.close.color }))))))));
57
65
  }
58
66
  static get watchers() { return {
59
67
  "show": [{
@@ -39,10 +39,10 @@ const SdProgress = class {
39
39
  return this.statusColor[this.progressStatus];
40
40
  }
41
41
  render() {
42
- return (h("div", { key: '864f669831515b9c149ad579b6233e960eee79a9', style: {
42
+ return (h("div", { key: 'b97a1ba0ad800ada8a2e87aab6108a77053a3ed5', style: {
43
43
  '--progress-color': this.progressColor,
44
44
  '--progress-percentage': `${this.progressPercentage}%`,
45
- } }, this.type === 'bar' ? this.renderBarProgress() : this.renderSpinnerProgress(), this.label && h("div", { key: '42920cc06b249371ec7d98c07d2185d71265a538', class: "sd-progress__label" }, this.label)));
45
+ } }, this.type === 'bar' ? this.renderBarProgress() : this.renderSpinnerProgress(), this.label && h("div", { key: '6a182e4ade2d9c361a85d3fda62f08f62f4722a3', class: "sd-progress__label" }, this.label)));
46
46
  }
47
47
  renderBarProgress() {
48
48
  return (h("div", { class: `sd-progress__bar sd-progress__bar--${this.progressStatus}` }, h("div", { class: ['sd-progress__bar__percent', this.progressPercentage < 100 ? 'proceed' : ''].join(' ') }), h("div", { class: "sd-progress__bar__indicator sd-progress__bar__indicator--left" }, this.progressPercentage, "%"), h("div", { class: "sd-progress__bar__indicator sd-progress__bar__indicator--right" }, this.progressPercentage, "%")));
@@ -273,7 +273,7 @@ const SdSelectGroup = class extends BaseDropdownEvent {
273
273
  });
274
274
  }
275
275
  render() {
276
- return (h("sd-field", { key: '2ff7d25f8fd9724fead7722757f174610d7c084d', label: this.label, name: this.name, rules: this.rules, error: this.error, disabled: this.disabled, icon: this.icon, addonLabel: this.addonLabel, labelTooltip: this.labelTooltip, labelTooltipProps: this.labelTooltipProps, ref: el => (this.formField = el), style: { '--field-width': this.width || '200px' } }, h("div", { key: '57d0ff569579bb56810891a8e50a89e8b82096ac', class: {
276
+ return (h("sd-field", { key: '822acc0b4200ab415646218d0f059b45f348f5ea', label: this.label, name: this.name, rules: this.rules, error: this.error, disabled: this.disabled, icon: this.icon, addonLabel: this.addonLabel, labelTooltip: this.labelTooltip, labelTooltipProps: this.labelTooltipProps, ref: el => (this.formField = el), style: { '--field-width': this.width || '200px' } }, h("div", { key: 'f5a76e913d116469a9d3d9c777d5a3ad62ea42b7', class: {
277
277
  'sd-select-group': true,
278
278
  'sd-select-group--open': this.isOpen,
279
279
  'sd-select-group--disabled': this.disabled,
@@ -153,7 +153,7 @@ const SdSelectMultiple = class extends BaseDropdownEvent {
153
153
  this.handleOptionSelection(option);
154
154
  };
155
155
  render() {
156
- return (h("sd-field", { key: '022f39a42986c29f8cab7f6801a7d2e4bbd5aaa5', label: this.label, name: this.name, rules: this.rules, error: this.error, disabled: this.disabled, icon: this.icon, labelTooltip: this.labelTooltip, labelTooltipProps: this.labelTooltipProps, ref: el => (this.formField = el) }, h("div", { key: '93e4dd74f1b0ad76429f37c5fe6a9cffb98697d5', class: {
156
+ return (h("sd-field", { key: '315be9fce15876ab835f0a6609657dfc04b4f9cf', label: this.label, name: this.name, rules: this.rules, error: this.error, disabled: this.disabled, icon: this.icon, labelTooltip: this.labelTooltip, labelTooltipProps: this.labelTooltipProps, ref: el => (this.formField = el) }, h("div", { key: 'db4754bd0710e217119e02827e9e9db3285a5c74', class: {
157
157
  'sd-select-multiple': true,
158
158
  'sd-select-multiple--open': this.isOpen,
159
159
  'sd-select-multiple--disabled': this.disabled,
@@ -46,7 +46,7 @@ const SdSelectOptionGroup = class {
46
46
  }
47
47
  };
48
48
  render() {
49
- return (h("div", { key: '70ab9a558faf068cfc4eb0a5f6a29453ceedc6ec', class: {
49
+ return (h("div", { key: '809d58fbd23e57920785835b37f00b66b579a96c', class: {
50
50
  'sd-select__option-group': true,
51
51
  'sd-select__option-group--selected': !!this.isSelected,
52
52
  'sd-select__option-group--disabled': !!this.option.disabled,
@@ -55,10 +55,10 @@ const SdSelectOptionGroup = class {
55
55
  'sd-select__option-group--group': this.option.type === 'group',
56
56
  'sd-select__option-group--subgroup': this.option.type === 'subgroup',
57
57
  'sd-select__option-group--item': this.option.type === 'item',
58
- }, onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), style: this.optionStyle, "data-index": this.index, onClick: event => this.handleClick(this.option, this.isSelected, event) }, h("div", { key: 'ca5dc0033231ab204a8688f98453742cdbde7d26', class: "sd-select__option-group__label-wrapper" }, this.useCheckbox && (h("sd-checkbox", { key: 'bba6cb9fe649f6eda82ba287f73d0142e02c53c2', value: this.isSelected, disabled: this.option.disabled, onClick: e => {
58
+ }, onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), style: this.optionStyle, "data-index": this.index, onClick: event => this.handleClick(this.option, this.isSelected, event) }, h("div", { key: 'f2ff05ee37333111548779d9fe78d0c4b91c9a1e', class: "sd-select__option-group__label-wrapper" }, this.useCheckbox && (h("sd-checkbox", { key: '4ca8aaffb38af21f27d429f6c937b1da3374c24a', value: this.isSelected, disabled: this.option.disabled, onClick: e => {
59
59
  e.preventDefault();
60
60
  this.handleClick(this.option, this.isSelected, e);
61
- } })), h("span", { key: '7d03c080b7f5b92881389bfec787015a6ac55fa1', class: "sd-select__option-group-label" }, this.option.label), this.useIndicator && this.option.type !== 'item' && (h("span", { key: '7066453f92eac7549569db6854e3dc32515d80b9', class: "sd-select__option-group__count-indicator" }, `(${this.countInfo?.selectedCount}/${this.countInfo?.totalCount})`)))));
61
+ } })), h("span", { key: 'b4b2943e68b98ce82c32e78a9841aae3be4d8e5f', class: "sd-select__option-group-label" }, this.option.label), this.useIndicator && this.option.type !== 'item' && (h("span", { key: '6e1414b3738c43f8bd5d308b57440d34f9e1b7fa', class: "sd-select__option-group__count-indicator" }, `(${this.countInfo?.selectedCount}/${this.countInfo?.totalCount})`)))));
62
62
  }
63
63
  };
64
64
  SdSelectOptionGroup.style = sdSelectOptionGroupCss();
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-B8tGP77V.js';
2
- import { e as LIST_ITEM_LAYOUT, g as LIST_ITEM_COLORS, h as LIST_ITEM_TYPOGRAPHY, i as SEARCH_DEBOUNCE_MS } from './sd-select-v2.config-BOmBg3kj.js';
2
+ import { e as LIST_ITEM_LAYOUT, g as LIST_ITEM_COLORS, h as LIST_ITEM_TYPOGRAPHY, i as SEARCH_DEBOUNCE_MS } from './sd-select-v2.config-o9Ugc4Ua.js';
3
3
 
4
- const sdSelectV2ListItemCss = () => `sd-select-v2-list-item{display:block}sd-select-v2-list-item .sd-select-v2-list-item{display:flex;align-items:center;gap:var(--list-item-gap);padding:var(--list-item-padding-y) var(--list-item-padding-right) var(--list-item-padding-y) var(--list-item-padding-left);font-size:var(--list-item-font-size);line-height:var(--list-item-line-height);font-weight:var(--list-item-font-weight);background:var(--list-item-bg);color:var(--list-item-color);cursor:default;user-select:none}sd-select-v2-list-item .sd-select-v2-list-item--selectable{cursor:pointer}sd-select-v2-list-item .sd-select-v2-list-item--depth1-group{border-top:var(--list-item-border-top);font-weight:700}sd-select-v2-list-item .sd-select-v2-list-item--depth2-group{font-weight:500}sd-select-v2-list-item .sd-select-v2-list-item--selectable:not(.sd-select-v2-list-item--disabled):hover{background:var(--list-item-bg-hover);color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--focused.sd-select-v2-list-item--selectable:not(.sd-select-v2-list-item--disabled){background:var(--list-item-bg-hover);color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--selected:not(.sd-select-v2-list-item--group){font-weight:700;color:var(--list-item-bg-hover)}sd-select-v2-list-item .sd-select-v2-list-item--selected:hover,sd-select-v2-list-item .sd-select-v2-list-item--selected.sd-select-v2-list-item--focused{color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--disabled{color:var(--list-item-color-disabled);cursor:not-allowed}sd-select-v2-list-item .sd-select-v2-list-item__label{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}sd-select-v2-list-item .sd-select-v2-list-item__count{flex-shrink:0;font-weight:500;color:var(--list-item-color-disabled)}sd-select-v2-list-item .sd-select-v2-list-item__checkbox{flex-shrink:0}`;
4
+ const sdSelectV2ListItemCss = () => `sd-select-v2-list-item{display:block}sd-select-v2-list-item .sd-select-v2-list-item{display:flex;align-items:center;gap:var(--list-item-gap);padding:var(--list-item-padding-y) var(--list-item-padding-right) var(--list-item-padding-y) var(--list-item-padding-left);font-size:var(--list-item-font-size);line-height:var(--list-item-line-height);font-weight:var(--list-item-font-weight);background:var(--list-item-bg);color:var(--list-item-color);cursor:default;user-select:none}sd-select-v2-list-item .sd-select-v2-list-item--selectable{cursor:pointer}sd-select-v2-list-item .sd-select-v2-list-item--depth1-group{border-top:var(--list-item-border-top);font-weight:700}sd-select-v2-list-item .sd-select-v2-list-item--depth2-group{font-weight:500}sd-select-v2-list-item .sd-select-v2-list-item--focused.sd-select-v2-list-item--selectable:not(.sd-select-v2-list-item--disabled){background:var(--list-item-bg-hover);color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--selected:not(.sd-select-v2-list-item--group){font-weight:700;color:var(--list-item-bg-hover)}sd-select-v2-list-item .sd-select-v2-list-item--selected.sd-select-v2-list-item--focused{color:var(--list-item-color-hover)}sd-select-v2-list-item .sd-select-v2-list-item--disabled{color:var(--list-item-color-disabled);cursor:not-allowed}sd-select-v2-list-item .sd-select-v2-list-item__label{flex:0 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}sd-select-v2-list-item .sd-select-v2-list-item__count{flex-shrink:0;font-weight:500;color:var(--list-item-color-disabled)}sd-select-v2-list-item .sd-select-v2-list-item--group.sd-select-v2-list-item--focused .sd-select-v2-list-item__count{color:#ffffff}sd-select-v2-list-item .sd-select-v2-list-item__checkbox{flex-shrink:0}`;
5
5
 
6
6
  const SdSelectV2ListItem = class {
7
7
  constructor(hostRef) {
@@ -71,7 +71,7 @@ const SdSelectV2ListItem = class {
71
71
  if (isDepth1Group) {
72
72
  cssVars['--list-item-border-top'] = `${LIST_ITEM_COLORS.depth1.borderWidth}px solid ${LIST_ITEM_COLORS.depth1.border}`;
73
73
  }
74
- return (h("div", { key: '1e828b28202b9d22cc02dff0550e37e506167f90', class: {
74
+ return (h("div", { key: 'af73e77fdeb673b1862b7bd0b153ee0726a3f5db', class: {
75
75
  'sd-select-v2-list-item': true,
76
76
  'sd-select-v2-list-item--group': isGroup,
77
77
  'sd-select-v2-list-item--depth1-group': isDepth1Group,
@@ -81,7 +81,7 @@ const SdSelectV2ListItem = class {
81
81
  'sd-select-v2-list-item--focused': this.isFocused,
82
82
  'sd-select-v2-list-item--selectable': this.isSelectable && !this.option.disabled,
83
83
  'sd-select-v2-list-item--disabled': !!this.option.disabled,
84
- }, style: cssVars, onClick: this.handleClick }, this.useCheckbox && (h("sd-checkbox", { key: '7f49b89aff1a269944551664bc8a51447b5b2f7e', value: this.isSelected === null ? null : !!this.isSelected, disabled: this.option.disabled, class: "sd-select-v2-list-item__checkbox", onClick: this.handleCheckboxClick, onSdUpdate: this.handleCheckboxUpdate })), h("span", { key: '51aad2d06ecdf11968f3f13c632081a663a3d200', class: "sd-select-v2-list-item__label" }, this.option.label), this.countInfo && (h("span", { key: '1c1f5cd51460863ce41c8980dcc65cd2bb7bfee5', class: "sd-select-v2-list-item__count" }, "(", this.countInfo.selected, "/", this.countInfo.total, ")"))));
84
+ }, style: cssVars, onClick: this.handleClick }, this.useCheckbox && (h("sd-checkbox", { key: '8cfcf0375fc756562c4ac698c843bfde3ec3750c', value: this.isSelected === null ? null : !!this.isSelected, disabled: this.option.disabled, class: "sd-select-v2-list-item__checkbox", onClick: this.handleCheckboxClick, onSdUpdate: this.handleCheckboxUpdate })), h("span", { key: '1a993c125767559c9cd27f343983b26a24413a93', class: "sd-select-v2-list-item__label" }, this.option.label), this.countInfo && (h("span", { key: '377d0d6c6acab983aff2471fc0f4f78eaa637370', class: "sd-select-v2-list-item__count" }, "(", this.countInfo.selected, "/", this.countInfo.total, ")"))));
85
85
  }
86
86
  };
87
87
  SdSelectV2ListItem.style = sdSelectV2ListItemCss();
@@ -119,15 +119,6 @@ const SdSelectV2ListItemSearch = class {
119
119
  this.searchFilter.emit(this.searchText);
120
120
  }, SEARCH_DEBOUNCE_MS);
121
121
  };
122
- handleKeyDown = (e) => {
123
- if (e.key === 'Enter') {
124
- e.preventDefault();
125
- e.stopPropagation();
126
- if (this.debounceTimer)
127
- clearTimeout(this.debounceTimer);
128
- this.searchFilter.emit(this.searchText);
129
- }
130
- };
131
122
  handleClear = (e) => {
132
123
  e.stopPropagation();
133
124
  this.searchText = '';
@@ -143,12 +134,12 @@ const SdSelectV2ListItemSearch = class {
143
134
  clearTimeout(this.debounceTimer);
144
135
  }
145
136
  render() {
146
- return (h("div", { key: 'e7bd315d17d554aa63346f44eb8b2661994b49aa', class: {
137
+ return (h("div", { key: '7e0f812a04f8f72e41916aad1c2bd8313dac44c7', class: {
147
138
  'sd-select-v2-list-item-search': true,
148
139
  'sd-select-v2-list-item-search--scrolled': this.isScrolled,
149
- } }, h("div", { key: 'ee332050907bc7e9004ff27e3f79cf816e7a44e7', class: "sd-select-v2-list-item-search__inner" }, h("sd-icon", { key: 'ccd929d161ba92ef4e8b008cee8866815c21f430', name: "search", size: 16, color: "grey_70", class: "sd-select-v2-list-item-search__icon" }), h("input", { key: 'b10e1dcf4bee6df78e917c9e4c31563e0466f38e', ref: el => {
140
+ } }, h("div", { key: 'f9df679b4cab727ba2c29293194556dad00bf46b', class: "sd-select-v2-list-item-search__inner" }, h("sd-icon", { key: '5f9eb6de82437a6344cc3a0042a24196cb7392a5', name: "search", size: 16, color: "grey_70", class: "sd-select-v2-list-item-search__icon" }), h("input", { key: '382b15077dd49e3addceca6026953c6065a5f60c', ref: el => {
150
141
  this.inputEl = el;
151
- }, type: "text", class: "sd-select-v2-list-item-search__input", placeholder: "\uAC80\uC0C9\uC5B4 \uC785\uB825", value: this.searchText, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: () => this.searchFocus.emit() }), this.searchText && (h("button", { key: 'fa2ee3033cff6b707a409ada6982ed596492c81d', type: "button", class: "sd-select-v2-list-item-search__clear", onClick: this.handleClear }, h("sd-icon", { key: '0e2cab7ca1a11c1ce60e74ac435dc55fbc375438', name: "close", size: 12, color: "#888888" }))))));
142
+ }, type: "text", class: "sd-select-v2-list-item-search__input", placeholder: "\uAC80\uC0C9\uC5B4 \uC785\uB825", value: this.searchText, onInput: this.handleInput, onFocus: () => this.searchFocus.emit() }), this.searchText && (h("button", { key: '00830db3b8d303993acf0787e3818e36f7c2c19c', type: "button", class: "sd-select-v2-list-item-search__clear", onClick: this.handleClear }, h("sd-icon", { key: 'a40a022ec7a3ea9d4bda28e7b5fd41850966c716', name: "close", size: 12, color: "#888888" }))))));
152
143
  }
153
144
  };
154
145
  SdSelectV2ListItemSearch.style = sdSelectV2ListItemSearchCss();
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-B8tGP77V.js';
2
- import { c as countLeaves, S as SEARCH_THRESHOLD, f as filterTree, E as EMPTY_MESSAGE, L as LIST_BOX_LAYOUT, a as SELECT_COLORS, b as SELECT_TYPOGRAPHY, d as SELECT_LAYOUT } from './sd-select-v2.config-BOmBg3kj.js';
2
+ import { c as countLeaves, S as SEARCH_THRESHOLD, f as filterTree, E as EMPTY_MESSAGE, L as LIST_BOX_LAYOUT, a as SELECT_COLORS, b as SELECT_TYPOGRAPHY, d as SELECT_LAYOUT } from './sd-select-v2.config-o9Ugc4Ua.js';
3
3
 
4
- const sdSelectV2ListboxCss = () => `sd-select-v2-listbox{display:block}sd-select-v2-listbox .sd-select-v2-listbox{display:flex;flex-direction:column;min-width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);width:fit-content;border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden}sd-select-v2-listbox .sd-select-v2-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--listbox-padding-bottom)}sd-select-v2-listbox .sd-select-v2-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}`;
4
+ const sdSelectV2ListboxCss = () => `sd-select-v2-listbox{display:block}sd-select-v2-listbox .sd-select-v2-listbox{display:flex;flex-direction:column;min-width:var(--listbox-trigger-width);max-width:var(--listbox-max-width);max-height:var(--listbox-max-height);width:fit-content;border-radius:var(--listbox-radius);background:white;box-shadow:2px 2px 12px 2px rgba(0, 0, 0, 0.1);overflow:hidden;outline:none}sd-select-v2-listbox .sd-select-v2-listbox__list{flex:1;min-height:0;overflow-y:auto;padding-bottom:var(--listbox-padding-bottom)}sd-select-v2-listbox .sd-select-v2-listbox__empty{padding:12px;text-align:center;font-size:12px;line-height:20px;color:#888888}`;
5
5
 
6
6
  const SdSelectV2Listbox = class {
7
7
  constructor(hostRef) {
@@ -17,7 +17,12 @@ const SdSelectV2Listbox = class {
17
17
  maxHeight = '260px';
18
18
  searchKeyword = '';
19
19
  isScrolled = false;
20
+ focusedIndex = -1;
20
21
  optionSelect;
22
+ listEl;
23
+ lastScrolledIndex = -1;
24
+ keydownAttached = false;
25
+ suppressHover = false;
21
26
  get isDepth() {
22
27
  return this.name === 'default_depth' || this.name === 'multi_depth';
23
28
  }
@@ -67,9 +72,9 @@ const SdSelectV2Listbox = class {
67
72
  const selectedValues = this.getSelectedValues();
68
73
  if (selectedValues.size === 0)
69
74
  return false;
70
- const originalOption = this.findOriginalOption(option.value, this.options);
71
- const targetOption = originalOption ?? option;
72
- const leaves = this.collectLeaves(targetOption);
75
+ const leaves = this.collectVisibleLeaves(option);
76
+ if (leaves.length === 0)
77
+ return false;
73
78
  const selectedCount = leaves.filter(l => selectedValues.has(l.value)).length;
74
79
  if (selectedCount === 0)
75
80
  return false;
@@ -81,10 +86,9 @@ const SdSelectV2Listbox = class {
81
86
  if (!this.isMulti || !option.children)
82
87
  return undefined;
83
88
  const selectedValues = this.getSelectedValues();
84
- const originalOption = this.findOriginalOption(option.value, this.options);
85
- const totalLeaves = originalOption ? this.collectLeaves(originalOption) : this.collectLeaves(option);
86
- const selectedCount = totalLeaves.filter(l => selectedValues.has(l.value)).length;
87
- return { selected: selectedCount, total: totalLeaves.length };
89
+ const leaves = this.collectVisibleLeaves(option);
90
+ const selectedCount = leaves.filter(l => selectedValues.has(l.value)).length;
91
+ return { selected: selectedCount, total: leaves.length };
88
92
  }
89
93
  findOriginalOption(value, options) {
90
94
  for (const opt of options) {
@@ -103,21 +107,177 @@ const SdSelectV2Listbox = class {
103
107
  return [option];
104
108
  return option.children.flatMap(child => this.collectLeaves(child));
105
109
  }
110
+ /**
111
+ * Returns the leaves currently visible to the user for the given (possibly
112
+ * filtered) option. When a group's own label matched the search keyword its
113
+ * `children` is emptied by `filterTree`; in that case we fall back to the
114
+ * full original subtree because the user has no way to deselect descendants
115
+ * individually.
116
+ */
117
+ collectVisibleLeaves(option) {
118
+ if (!option.children)
119
+ return [option];
120
+ if (option.children.length === 0) {
121
+ const original = this.findOriginalOption(option.value, this.options);
122
+ return original ? this.collectLeaves(original) : [];
123
+ }
124
+ return option.children.flatMap(child => this.collectVisibleLeaves(child));
125
+ }
126
+ get navigableOptions() {
127
+ const items = [];
128
+ const walk = (opts) => {
129
+ for (const opt of opts) {
130
+ const isGroup = !!opt.children;
131
+ const isSelectable = !isGroup || this.isMulti;
132
+ if (isSelectable && !opt.disabled)
133
+ items.push(opt);
134
+ if (isGroup && opt.children && opt.children.length > 0)
135
+ walk(opt.children);
136
+ }
137
+ };
138
+ walk(this.filteredOptions);
139
+ return items;
140
+ }
141
+ isOptionFocused(option) {
142
+ if (this.focusedIndex < 0)
143
+ return false;
144
+ const focused = this.navigableOptions[this.focusedIndex];
145
+ // filterTree 가 매 호출마다 옵션 객체를 새로 복제하기 때문에 참조 비교
146
+ // (=== / indexOf) 는 검색이 적용된 동안 항상 실패한다. 고유 식별자인
147
+ // value 로 비교해야 한다.
148
+ return !!focused && focused.value === option.value;
149
+ }
150
+ resetFocusOnFilter() {
151
+ // 필터가 바뀌면 이전 인덱스가 가리키던 항목이 사라질 수 있으므로
152
+ // 새 결과의 첫 항목으로 옮긴다. 결과가 비면 -1.
153
+ const items = this.navigableOptions;
154
+ this.focusedIndex = items.length > 0 ? 0 : -1;
155
+ // 키보드 네비게이션 직후 마우스가 한 번도 안 움직인 채로 사용자가
156
+ // 검색을 시작했다면 hover suppression 이 켜진 상태로 남아있을 수 있다.
157
+ // 검색이라는 명백한 사용자 의도 전환 시점에 강제로 해제한다.
158
+ if (this.suppressHover) {
159
+ document.removeEventListener('mousemove', this.releaseHoverSuppress, true);
160
+ this.suppressHover = false;
161
+ }
162
+ }
106
163
  handleSearchFilter = (e) => {
107
164
  this.searchKeyword = e.detail;
108
165
  };
109
166
  handleScroll = (e) => {
110
167
  this.isScrolled = e.target.scrollTop > 0;
111
168
  };
169
+ emitOptionSelect(option) {
170
+ this.optionSelect.emit({
171
+ option,
172
+ leaves: this.collectVisibleLeaves(option),
173
+ });
174
+ }
112
175
  handleOptionClick = (e) => {
113
176
  e.stopPropagation();
114
- this.optionSelect.emit(e.detail);
177
+ this.emitOptionSelect(e.detail);
178
+ };
179
+ handleOptionHover = (option) => {
180
+ if (this.suppressHover)
181
+ return;
182
+ const idx = this.navigableOptions.findIndex(o => o.value === option.value);
183
+ if (idx >= 0)
184
+ this.focusedIndex = idx;
185
+ };
186
+ releaseHoverSuppress = () => {
187
+ this.suppressHover = false;
188
+ document.removeEventListener('mousemove', this.releaseHoverSuppress, true);
115
189
  };
190
+ handleKeyDown = (e) => {
191
+ const items = this.navigableOptions;
192
+ if (e.key === 'ArrowDown') {
193
+ if (items.length === 0)
194
+ return;
195
+ e.preventDefault();
196
+ e.stopPropagation();
197
+ this.focusedIndex = this.focusedIndex < 0 ? 0 : (this.focusedIndex + 1) % items.length;
198
+ this.beginHoverSuppression();
199
+ }
200
+ else if (e.key === 'ArrowUp') {
201
+ if (items.length === 0)
202
+ return;
203
+ e.preventDefault();
204
+ e.stopPropagation();
205
+ this.focusedIndex = this.focusedIndex <= 0 ? items.length - 1 : this.focusedIndex - 1;
206
+ this.beginHoverSuppression();
207
+ }
208
+ else if (e.key === 'Enter') {
209
+ if (this.focusedIndex < 0 || this.focusedIndex >= items.length)
210
+ return;
211
+ e.preventDefault();
212
+ e.stopPropagation();
213
+ this.emitOptionSelect(items[this.focusedIndex]);
214
+ }
215
+ };
216
+ /**
217
+ * 키보드로 인덱스를 옮기면 자동 스크롤이 일어나는데, 정지한 마우스 커서
218
+ * 아래로 다른 항목이 미끄러져 들어오면서 mouseenter 가 발화해 인덱스를
219
+ * 다시 덮어쓰는 문제를 막는다. 실제로 마우스가 한 번이라도 움직이기 전까지
220
+ * hover 갱신을 무시한다.
221
+ */
222
+ beginHoverSuppression() {
223
+ if (this.suppressHover)
224
+ return;
225
+ this.suppressHover = true;
226
+ document.addEventListener('mousemove', this.releaseHoverSuppress, true);
227
+ }
228
+ /**
229
+ * 리스트 컨테이너 내부에서만 스크롤한다. `scrollIntoView` 는 조상 스크롤
230
+ * 컨테이너(=문서 자체)까지 함께 스크롤시키므로 사용하지 않는다.
231
+ */
232
+ scrollFocusedIntoView() {
233
+ const list = this.listEl;
234
+ const focusedEl = list?.querySelector('.sd-select-v2-list-item--focused');
235
+ if (!list || !focusedEl)
236
+ return;
237
+ const listRect = list.getBoundingClientRect();
238
+ const itemRect = focusedEl.getBoundingClientRect();
239
+ if (itemRect.top < listRect.top) {
240
+ list.scrollTop += itemRect.top - listRect.top;
241
+ }
242
+ else if (itemRect.bottom > listRect.bottom) {
243
+ list.scrollTop += itemRect.bottom - listRect.bottom;
244
+ }
245
+ }
246
+ /**
247
+ * sd-portal 이 슬롯 노드를 body 로 이동시키면서 disconnect → connect 가
248
+ * 발생하므로, 키보드 리스너는 한 번만 실행되는 componentDidLoad 가 아니라
249
+ * connectedCallback / disconnectedCallback 에 묶어 매번 재부착한다.
250
+ * capture phase 로 잡아 포커스가 검색 input 에 있어도 ↑/↓/Enter 가
251
+ * input 의 기본 동작(커서 이동)·페이지 스크롤보다 먼저 처리되도록 한다.
252
+ */
253
+ connectedCallback() {
254
+ if (!this.keydownAttached) {
255
+ document.addEventListener('keydown', this.handleKeyDown, true);
256
+ this.keydownAttached = true;
257
+ }
258
+ }
259
+ disconnectedCallback() {
260
+ if (this.keydownAttached) {
261
+ document.removeEventListener('keydown', this.handleKeyDown, true);
262
+ this.keydownAttached = false;
263
+ }
264
+ if (this.suppressHover) {
265
+ document.removeEventListener('mousemove', this.releaseHoverSuppress, true);
266
+ this.suppressHover = false;
267
+ }
268
+ }
269
+ componentDidRender() {
270
+ if (this.focusedIndex !== this.lastScrolledIndex) {
271
+ this.lastScrolledIndex = this.focusedIndex;
272
+ if (this.focusedIndex >= 0)
273
+ this.scrollFocusedIntoView();
274
+ }
275
+ }
116
276
  renderOptions(options, depth = 1) {
117
277
  return options.map(option => {
118
278
  const isGroup = !!option.children;
119
279
  return [
120
- h("sd-select-v2-list-item", { option: option, depth: depth, isSelected: isGroup ? this.getGroupSelectionState(option) : this.isOptionSelected(option), useCheckbox: this.isMulti, countInfo: this.getCountInfo(option), onSdListItemClick: this.handleOptionClick }),
280
+ h("sd-select-v2-list-item", { option: option, depth: depth, isSelected: isGroup ? this.getGroupSelectionState(option) : this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, countInfo: this.getCountInfo(option), onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) }),
121
281
  isGroup && option.children ? this.renderOptions(option.children, depth + 1) : null,
122
282
  ];
123
283
  });
@@ -130,8 +290,15 @@ const SdSelectV2Listbox = class {
130
290
  '--listbox-radius': `${LIST_BOX_LAYOUT.radius}px`,
131
291
  '--listbox-padding-bottom': `${LIST_BOX_LAYOUT.paddingBottom}px`,
132
292
  };
133
- return (h("div", { key: 'b64bc66e7f9a356e3f0cf752cba3a3c9de1928c5', class: "sd-select-v2-listbox", style: cssVars }, this.showSearch && (h("sd-select-v2-list-item-search", { key: '2444bdda4e2a83008d175ba9867ecad01da5ed25', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), h("div", { key: '6307a0fd5480c006248dee44c4e1b54dd5749895', class: "sd-select-v2-listbox__list", onScroll: this.handleScroll }, this.isEmpty ? (h("div", { class: "sd-select-v2-listbox__empty" }, EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (h("sd-select-v2-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick })))))));
293
+ return (h("div", { key: 'f47839574d0c149ab4aa2a3912b51318ec815b55', class: "sd-select-v2-listbox", style: cssVars }, this.showSearch && (h("sd-select-v2-list-item-search", { key: '3c3f9fd3e0c935da59bc7727af5c719b76b309d5', isScrolled: this.isScrolled, onSdSearchFilter: this.handleSearchFilter })), h("div", { key: '4d4ef6c7c543689abb9ed085e07e613deca6c8d8', class: "sd-select-v2-listbox__list", onScroll: this.handleScroll, ref: el => {
294
+ this.listEl = el;
295
+ } }, this.isEmpty ? (h("div", { class: "sd-select-v2-listbox__empty" }, EMPTY_MESSAGE)) : this.isDepth ? (this.renderOptions(this.filteredOptions)) : (this.filteredOptions.map(option => (h("sd-select-v2-list-item", { option: option, depth: 1, isSelected: this.isOptionSelected(option), isFocused: this.isOptionFocused(option), useCheckbox: this.isMulti, onSdListItemClick: this.handleOptionClick, onMouseEnter: () => this.handleOptionHover(option) })))))));
134
296
  }
297
+ static get watchers() { return {
298
+ "searchKeyword": [{
299
+ "resetFocusOnFilter": 0
300
+ }]
301
+ }; }
135
302
  };
136
303
  SdSelectV2Listbox.style = sdSelectV2ListboxCss();
137
304
 
@@ -167,11 +334,11 @@ const SdSelectV2Trigger = class {
167
334
  : SELECT_COLORS.icon.default,
168
335
  '--trigger-icon-color': this.disabled ? SELECT_COLORS.icon.disabled : SELECT_COLORS.icon.default,
169
336
  };
170
- return (h("div", { key: '4fe2634aee7071ed48348b19dc367b1af88fd6d9', class: {
337
+ return (h("div", { key: '2cf4cc98bbfc8808f84d1d6b9dbfbb4f1afee272', class: {
171
338
  'sd-select-v2-trigger': true,
172
339
  'sd-select-v2-trigger--open': this.isOpen,
173
340
  'sd-select-v2-trigger--disabled': this.disabled,
174
- }, style: cssVars, onClick: this.handleClick }, h("div", { key: 'e0f71cdd91c6e04ebe5543fb2bc87d7331735da6', class: "sd-select-v2-trigger__content" }, h("span", { key: '3abfbc0541569c68870addc16a7d3439d7189ab5', class: "sd-select-v2-trigger__text" }, hasValue ? this.displayText : this.placeholder), h("sd-icon", { key: '8fcb187f67be75cf03c0f0bde42121cba0b16a47', name: "arrowDown", size: 12, color: "var(--trigger-icon-color)", class: {
341
+ }, style: cssVars, onClick: this.handleClick }, h("div", { key: '8835de30555a7ef7846afacad8ec6ee5482b36cf', class: "sd-select-v2-trigger__content" }, h("span", { key: '5afd6845dc9b412a3cd87e6a16de8bd506b38dbb', class: "sd-select-v2-trigger__text" }, hasValue ? this.displayText : this.placeholder), h("sd-icon", { key: '727d44f2814321bc80ca5a9d127ce5676f0bfdc6', name: "arrowDown", size: 12, color: "var(--trigger-icon-color)", class: {
175
342
  'sd-select-v2-trigger__icon': true,
176
343
  'sd-select-v2-trigger__icon--open': this.isOpen,
177
344
  } }))));
@@ -135,17 +135,22 @@ function filterTree(options, keyword) {
135
135
  const lowerKeyword = keyword.toLowerCase();
136
136
  return options.reduce((acc, option) => {
137
137
  const selfMatch = option.label.toLowerCase().includes(lowerKeyword);
138
- if (selfMatch) {
139
- acc.push({
140
- ...option,
141
- children: option.children ? [] : undefined,
142
- });
143
- }
144
- else if (option.children) {
138
+ if (option.children) {
139
+ // 그룹: 자식은 항상 추가로 필터링한다.
140
+ // - 자식 중 일치하는 게 있으면 그 자식들만 노출
141
+ // - 자식 매칭이 없더라도 그룹명이 매칭되면 그룹 헤더는 그대로 노출
142
+ // (이때 children 은 빈 배열로 두고, 선택 동작은 collectVisibleLeaves
143
+ // 의 fallback 이 원본 트리를 사용해 처리한다)
145
144
  const filteredChildren = filterTree(option.children, keyword);
146
145
  if (filteredChildren.length > 0) {
147
146
  acc.push({ ...option, children: filteredChildren });
148
147
  }
148
+ else if (selfMatch) {
149
+ acc.push({ ...option, children: [] });
150
+ }
151
+ }
152
+ else if (selfMatch) {
153
+ acc.push({ ...option });
149
154
  }
150
155
  return acc;
151
156
  }, []);