@pine-ds/core 4.10.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (511) hide show
  1. package/components/aria-references.js +1 -0
  2. package/components/attributes.js +1 -1
  3. package/components/index2.js +1 -1
  4. package/components/pds-alert.js +1 -1
  5. package/components/pds-avatar.js +1 -1
  6. package/components/pds-box2.js +1 -1
  7. package/components/pds-button2.js +1 -1
  8. package/components/pds-checkbox2.js +1 -1
  9. package/components/pds-chip2.js +1 -1
  10. package/components/pds-combobox.js +2 -2
  11. package/components/pds-copytext.js +1 -1
  12. package/components/pds-datepicker.js +1 -1
  13. package/components/pds-drawer-content.js +1 -1
  14. package/components/pds-drawer-footer.js +1 -1
  15. package/components/pds-drawer-header.js +1 -1
  16. package/components/pds-drawer.js +1 -1
  17. package/components/pds-dropdown-menu-item.js +1 -1
  18. package/components/pds-dropdown-menu-separator.js +1 -1
  19. package/components/pds-dropdown-menu.js +1 -1
  20. package/components/pds-filter.js +1 -1
  21. package/components/pds-image.js +1 -1
  22. package/components/pds-input2.js +1 -1
  23. package/components/pds-link2.js +1 -1
  24. package/components/pds-loader2.js +1 -1
  25. package/components/pds-modal-footer.js +1 -1
  26. package/components/pds-modal-header.js +1 -1
  27. package/components/pds-modal2.js +1 -1
  28. package/components/pds-multiselect.js +1 -1
  29. package/components/pds-popover.js +1 -1
  30. package/components/pds-progress.js +1 -1
  31. package/components/pds-radio-group.js +1 -1
  32. package/components/pds-radio.js +1 -1
  33. package/components/pds-select.js +1 -1
  34. package/components/pds-sortable-item.js +1 -1
  35. package/components/pds-sortable.js +2 -2
  36. package/components/pds-switch.js +1 -1
  37. package/components/pds-table-body.js +1 -1
  38. package/components/pds-table-cell2.js +1 -1
  39. package/components/pds-table-head-cell2.js +1 -1
  40. package/components/pds-table-head.js +1 -1
  41. package/components/pds-table-row.js +1 -1
  42. package/components/pds-table.js +1 -1
  43. package/components/pds-tabs.js +1 -1
  44. package/components/pds-text2.js +1 -1
  45. package/components/pds-textarea.js +1 -1
  46. package/components/pds-toast.js +1 -1
  47. package/components/pds-tooltip.js +1 -1
  48. package/components/sortable-label.js +1 -0
  49. package/components/truncation-tooltip.js +1 -1
  50. package/dist/cjs/aria-references-CUmqibnO.js +54 -0
  51. package/dist/cjs/{attributes-CW49XqaL.js → attributes-Cgbkw6gO.js} +3 -0
  52. package/dist/cjs/loader.cjs.js +1 -1
  53. package/dist/cjs/pds-alert.cjs.entry.js +2 -2
  54. package/dist/cjs/pds-avatar.cjs.entry.js +3 -2
  55. package/dist/cjs/pds-box.cjs.entry.js +4 -3
  56. package/dist/cjs/pds-button.cjs.entry.js +25 -45
  57. package/dist/cjs/pds-checkbox.cjs.entry.js +4 -4
  58. package/dist/cjs/pds-chip.cjs.entry.js +3 -3
  59. package/dist/cjs/pds-combobox.cjs.entry.js +246 -106
  60. package/dist/cjs/pds-copytext.cjs.entry.js +3 -3
  61. package/dist/cjs/pds-datepicker.cjs.entry.js +295 -82
  62. package/dist/cjs/pds-drawer-content.cjs.entry.js +1 -1
  63. package/dist/cjs/pds-drawer-footer.cjs.entry.js +1 -1
  64. package/dist/cjs/pds-drawer-header.cjs.entry.js +1 -1
  65. package/dist/cjs/pds-drawer.cjs.entry.js +5 -7
  66. package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +85 -49
  67. package/dist/cjs/pds-dropdown-menu-separator.cjs.entry.js +2 -2
  68. package/dist/cjs/pds-dropdown-menu.cjs.entry.js +83 -10
  69. package/dist/cjs/pds-filter.cjs.entry.js +24 -2
  70. package/dist/cjs/pds-image.cjs.entry.js +148 -6
  71. package/dist/cjs/pds-input.cjs.entry.js +4 -4
  72. package/dist/cjs/pds-link.cjs.entry.js +4 -5
  73. package/dist/cjs/pds-loader.cjs.entry.js +4 -3
  74. package/dist/cjs/pds-modal-footer.cjs.entry.js +1 -1
  75. package/dist/cjs/pds-modal-header.cjs.entry.js +1 -1
  76. package/dist/cjs/pds-modal.cjs.entry.js +9 -12
  77. package/dist/cjs/pds-multiselect.cjs.entry.js +64 -18
  78. package/dist/cjs/pds-popover.cjs.entry.js +8 -6
  79. package/dist/cjs/pds-progress.cjs.entry.js +3 -3
  80. package/dist/cjs/pds-radio-group.cjs.entry.js +4 -4
  81. package/dist/cjs/pds-radio.cjs.entry.js +6 -6
  82. package/dist/cjs/pds-row.cjs.entry.js +1 -1
  83. package/dist/cjs/pds-select.cjs.entry.js +2 -2
  84. package/dist/cjs/pds-sortable-item.cjs.entry.js +28 -5
  85. package/dist/cjs/pds-sortable.cjs.entry.js +356 -4
  86. package/dist/cjs/pds-switch.cjs.entry.js +92 -15
  87. package/dist/cjs/pds-tab.cjs.entry.js +1 -1
  88. package/dist/cjs/pds-table-body.cjs.entry.js +1 -1
  89. package/dist/cjs/pds-table-cell.cjs.entry.js +24 -5
  90. package/dist/cjs/pds-table-head-cell.cjs.entry.js +59 -11
  91. package/dist/cjs/pds-table-head.cjs.entry.js +1 -1
  92. package/dist/cjs/pds-table-row.cjs.entry.js +1 -1
  93. package/dist/cjs/pds-table.cjs.entry.js +260 -5
  94. package/dist/cjs/pds-tabpanel.cjs.entry.js +1 -1
  95. package/dist/cjs/pds-tabs.cjs.entry.js +3 -3
  96. package/dist/cjs/pds-text.cjs.entry.js +5 -3
  97. package/dist/cjs/pds-textarea.cjs.entry.js +8 -7
  98. package/dist/cjs/pds-toast.cjs.entry.js +8 -4
  99. package/dist/cjs/pds-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/pine-core.cjs.js +1 -1
  101. package/dist/cjs/sortable-label-DOcJrHvA.js +37 -0
  102. package/dist/cjs/{truncation-tooltip-Bikp7n9I.js → truncation-tooltip-CM5HgRHh.js} +69 -0
  103. package/dist/collection/components/pds-alert/pds-alert.css +0 -3
  104. package/dist/collection/components/pds-alert/pds-alert.js +3 -2
  105. package/dist/collection/components/pds-avatar/pds-avatar.js +7 -6
  106. package/dist/collection/components/pds-avatar/stories/pds-avatar.stories.js +1 -1
  107. package/dist/collection/components/pds-box/pds-box.css +1273 -1189
  108. package/dist/collection/components/pds-box/pds-box.js +180 -156
  109. package/dist/collection/components/pds-box/stories/pds-box.stories.js +79 -37
  110. package/dist/collection/components/pds-button/pds-button.js +26 -4
  111. package/dist/collection/components/pds-button/stories/pds-button.stories.js +25 -11
  112. package/dist/collection/components/pds-checkbox/pds-checkbox.js +10 -10
  113. package/dist/collection/components/pds-chip/pds-chip.js +3 -3
  114. package/dist/collection/components/pds-combobox/pds-combobox.css +162 -53
  115. package/dist/collection/components/pds-combobox/pds-combobox.js +261 -121
  116. package/dist/collection/components/pds-combobox/stories/pds-combobox.stories.js +35 -4
  117. package/dist/collection/components/pds-copytext/pds-copytext.js +2 -2
  118. package/dist/collection/components/pds-datepicker/date-utils.js +42 -0
  119. package/dist/collection/components/pds-datepicker/pds-datepicker.js +164 -65
  120. package/dist/collection/components/pds-datepicker/presets.js +42 -7
  121. package/dist/collection/components/pds-datepicker/stories/pds-datepicker.stories.js +11 -0
  122. package/dist/collection/components/pds-datepicker/value.js +76 -18
  123. package/dist/collection/components/pds-drawer/pds-drawer-content/pds-drawer-content.js +2 -5
  124. package/dist/collection/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.js +2 -1
  125. package/dist/collection/components/pds-drawer/pds-drawer-header/pds-drawer-header.js +2 -1
  126. package/dist/collection/components/pds-drawer/pds-drawer.js +8 -10
  127. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +17 -8
  128. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.js +95 -62
  129. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.js +3 -3
  130. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.css +2 -0
  131. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu.js +84 -9
  132. package/dist/collection/components/pds-dropdown-menu/stories/pds-dropdown-menu.stories.js +24 -1
  133. package/dist/collection/components/pds-filters/pds-filter/pds-filter.css +2 -1
  134. package/dist/collection/components/pds-filters/pds-filter/pds-filter.js +24 -7
  135. package/dist/collection/components/pds-image/image-interface.js +1 -0
  136. package/dist/collection/components/pds-image/pds-image.css +11 -0
  137. package/dist/collection/components/pds-image/pds-image.js +249 -8
  138. package/dist/collection/components/pds-image/stories/pds-image.stories.js +117 -1
  139. package/dist/collection/components/pds-input/pds-input.js +14 -9
  140. package/dist/collection/components/pds-link/pds-link.js +10 -14
  141. package/dist/collection/components/pds-link/stories/pds-link.stories.js +6 -2
  142. package/dist/collection/components/pds-loader/pds-loader.js +5 -4
  143. package/dist/collection/components/pds-modal/pds-modal-footer/pds-modal-footer.js +2 -1
  144. package/dist/collection/components/pds-modal/pds-modal-header/pds-modal-header.js +2 -1
  145. package/dist/collection/components/pds-modal/pds-modal.js +11 -13
  146. package/dist/collection/components/pds-modal/stories/pds-modal.stories.js +7 -7
  147. package/dist/collection/components/pds-multiselect/pds-multiselect.css +2 -2
  148. package/dist/collection/components/pds-multiselect/pds-multiselect.js +63 -18
  149. package/dist/collection/components/pds-popover/pds-popover.css +1 -1
  150. package/dist/collection/components/pds-popover/pds-popover.js +9 -7
  151. package/dist/collection/components/pds-progress/pds-progress.js +4 -4
  152. package/dist/collection/components/pds-radio/pds-radio.css +5 -1
  153. package/dist/collection/components/pds-radio/pds-radio.js +9 -9
  154. package/dist/collection/components/pds-radio/stories/pds-radio.stories.js +9 -9
  155. package/dist/collection/components/pds-radio-group/pds-radio-group.js +7 -7
  156. package/dist/collection/components/pds-radio-group/stories/pds-radio-group.stories.js +3 -3
  157. package/dist/collection/components/pds-row/stories/pds-row.stories.js +15 -14
  158. package/dist/collection/components/pds-select/pds-select.js +7 -4
  159. package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.css +38 -0
  160. package/dist/collection/components/pds-sortable/pds-sortable-item/pds-sortable-item.js +47 -5
  161. package/dist/collection/components/pds-sortable/pds-sortable.js +481 -5
  162. package/dist/collection/components/pds-sortable/sortable-label.js +33 -0
  163. package/dist/collection/components/pds-sortable/stories/pds-sortable.stories.js +27 -0
  164. package/dist/collection/components/pds-switch/pds-switch.js +114 -17
  165. package/dist/collection/components/pds-switch/stories/pds-switch.stories.js +79 -0
  166. package/dist/collection/components/pds-table/pds-table-body/pds-table-body.js +4 -1
  167. package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.js +47 -4
  168. package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +6 -2
  169. package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.css +11 -0
  170. package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +98 -10
  171. package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +5 -1
  172. package/dist/collection/components/pds-table/pds-table.css +8 -0
  173. package/dist/collection/components/pds-table/pds-table.js +295 -7
  174. package/dist/collection/components/pds-table/stories/pds-table.stories.js +131 -6
  175. package/dist/collection/components/pds-tabs/pds-tabs.js +3 -3
  176. package/dist/collection/components/pds-tabs/stories/pds-tabs.stories.js +1 -1
  177. package/dist/collection/components/pds-text/pds-text.js +5 -3
  178. package/dist/collection/components/pds-textarea/pds-textarea.js +16 -14
  179. package/dist/collection/components/pds-textarea/stories/pds-textarea.stories.js +2 -13
  180. package/dist/collection/components/pds-toast/pds-toast.css +4 -3
  181. package/dist/collection/components/pds-toast/pds-toast.js +9 -5
  182. package/dist/collection/components/pds-toast/stories/pds-toast.stories.js +2 -2
  183. package/dist/collection/components/pds-tooltip/pds-tooltip.css +2 -1
  184. package/dist/collection/components/pds-tooltip/stories/pds-tooltip.stories.js +17 -17
  185. package/dist/collection/utils/aria-references.js +9 -3
  186. package/dist/collection/utils/truncation-tooltip.js +67 -0
  187. package/dist/docs.json +1150 -371
  188. package/dist/esm/aria-references-CNn1lObg.js +50 -0
  189. package/dist/esm/{attributes-DkeVeN0g.js → attributes-CD8knu3a.js} +3 -0
  190. package/dist/esm/{index-DvN3tyZp.js → index-B0DXTeeV.js} +1 -1
  191. package/dist/esm/loader.js +1 -1
  192. package/dist/esm/pds-accordion.entry.js +1 -1
  193. package/dist/esm/pds-alert.entry.js +2 -2
  194. package/dist/esm/pds-avatar.entry.js +4 -3
  195. package/dist/esm/pds-box.entry.js +4 -3
  196. package/dist/esm/pds-button.entry.js +24 -44
  197. package/dist/esm/pds-checkbox.entry.js +5 -5
  198. package/dist/esm/pds-chip.entry.js +4 -4
  199. package/dist/esm/pds-combobox.entry.js +246 -106
  200. package/dist/esm/pds-copytext.entry.js +4 -4
  201. package/dist/esm/pds-datepicker.entry.js +296 -83
  202. package/dist/esm/pds-drawer-content.entry.js +1 -1
  203. package/dist/esm/pds-drawer-footer.entry.js +1 -1
  204. package/dist/esm/pds-drawer-header.entry.js +1 -1
  205. package/dist/esm/pds-drawer.entry.js +5 -7
  206. package/dist/esm/pds-dropdown-menu-item.entry.js +85 -49
  207. package/dist/esm/pds-dropdown-menu-separator.entry.js +2 -2
  208. package/dist/esm/pds-dropdown-menu.entry.js +84 -11
  209. package/dist/esm/pds-filter.entry.js +25 -3
  210. package/dist/esm/pds-image.entry.js +149 -7
  211. package/dist/esm/pds-input.entry.js +5 -5
  212. package/dist/esm/pds-link.entry.js +5 -6
  213. package/dist/esm/pds-loader.entry.js +4 -3
  214. package/dist/esm/pds-modal-footer.entry.js +1 -1
  215. package/dist/esm/pds-modal-header.entry.js +1 -1
  216. package/dist/esm/pds-modal.entry.js +9 -12
  217. package/dist/esm/pds-multiselect.entry.js +65 -19
  218. package/dist/esm/pds-popover.entry.js +8 -6
  219. package/dist/esm/pds-progress.entry.js +3 -3
  220. package/dist/esm/pds-radio-group.entry.js +5 -5
  221. package/dist/esm/pds-radio.entry.js +7 -7
  222. package/dist/esm/pds-row.entry.js +1 -1
  223. package/dist/esm/pds-select.entry.js +3 -3
  224. package/dist/esm/pds-sortable-item.entry.js +29 -6
  225. package/dist/esm/pds-sortable.entry.js +357 -5
  226. package/dist/esm/pds-switch.entry.js +94 -17
  227. package/dist/esm/pds-tab.entry.js +1 -1
  228. package/dist/esm/pds-table-body.entry.js +1 -1
  229. package/dist/esm/pds-table-cell.entry.js +24 -5
  230. package/dist/esm/pds-table-head-cell.entry.js +60 -12
  231. package/dist/esm/pds-table-head.entry.js +1 -1
  232. package/dist/esm/pds-table-row.entry.js +1 -1
  233. package/dist/esm/pds-table.entry.js +261 -6
  234. package/dist/esm/pds-tabpanel.entry.js +1 -1
  235. package/dist/esm/pds-tabs.entry.js +3 -3
  236. package/dist/esm/pds-text.entry.js +5 -3
  237. package/dist/esm/pds-textarea.entry.js +9 -8
  238. package/dist/esm/pds-toast.entry.js +8 -4
  239. package/dist/esm/pds-tooltip.entry.js +1 -1
  240. package/dist/esm/pine-core.js +1 -1
  241. package/dist/esm/sortable-label-PItnzVVR.js +35 -0
  242. package/dist/esm/{truncation-tooltip-DBcPipr9.js → truncation-tooltip-CkIWm6Z-.js} +68 -1
  243. package/dist/esm-es5/aria-references-CNn1lObg.js +1 -0
  244. package/dist/esm-es5/{attributes-DkeVeN0g.js → attributes-CD8knu3a.js} +1 -1
  245. package/dist/esm-es5/{index-DvN3tyZp.js → index-B0DXTeeV.js} +1 -1
  246. package/dist/esm-es5/loader.js +1 -1
  247. package/dist/esm-es5/pds-accordion.entry.js +1 -1
  248. package/dist/esm-es5/pds-alert.entry.js +1 -1
  249. package/dist/esm-es5/pds-avatar.entry.js +1 -1
  250. package/dist/esm-es5/pds-box.entry.js +1 -1
  251. package/dist/esm-es5/pds-button.entry.js +1 -1
  252. package/dist/esm-es5/pds-checkbox.entry.js +1 -1
  253. package/dist/esm-es5/pds-chip.entry.js +1 -1
  254. package/dist/esm-es5/pds-combobox.entry.js +1 -1
  255. package/dist/esm-es5/pds-copytext.entry.js +1 -1
  256. package/dist/esm-es5/pds-datepicker.entry.js +1 -1
  257. package/dist/esm-es5/pds-drawer-content.entry.js +1 -1
  258. package/dist/esm-es5/pds-drawer-footer.entry.js +1 -1
  259. package/dist/esm-es5/pds-drawer-header.entry.js +1 -1
  260. package/dist/esm-es5/pds-drawer.entry.js +1 -1
  261. package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -1
  262. package/dist/esm-es5/pds-dropdown-menu-separator.entry.js +1 -1
  263. package/dist/esm-es5/pds-dropdown-menu.entry.js +1 -1
  264. package/dist/esm-es5/pds-filter.entry.js +1 -1
  265. package/dist/esm-es5/pds-image.entry.js +1 -1
  266. package/dist/esm-es5/pds-input.entry.js +1 -1
  267. package/dist/esm-es5/pds-link.entry.js +1 -1
  268. package/dist/esm-es5/pds-loader.entry.js +1 -1
  269. package/dist/esm-es5/pds-modal-footer.entry.js +1 -1
  270. package/dist/esm-es5/pds-modal-header.entry.js +1 -1
  271. package/dist/esm-es5/pds-modal.entry.js +1 -1
  272. package/dist/esm-es5/pds-multiselect.entry.js +1 -1
  273. package/dist/esm-es5/pds-popover.entry.js +1 -1
  274. package/dist/esm-es5/pds-progress.entry.js +1 -1
  275. package/dist/esm-es5/pds-radio-group.entry.js +1 -1
  276. package/dist/esm-es5/pds-radio.entry.js +1 -1
  277. package/dist/esm-es5/pds-row.entry.js +1 -1
  278. package/dist/esm-es5/pds-select.entry.js +1 -1
  279. package/dist/esm-es5/pds-sortable-item.entry.js +1 -1
  280. package/dist/esm-es5/pds-sortable.entry.js +2 -2
  281. package/dist/esm-es5/pds-switch.entry.js +1 -1
  282. package/dist/esm-es5/pds-tab.entry.js +1 -1
  283. package/dist/esm-es5/pds-table-body.entry.js +1 -1
  284. package/dist/esm-es5/pds-table-cell.entry.js +1 -1
  285. package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
  286. package/dist/esm-es5/pds-table-head.entry.js +1 -1
  287. package/dist/esm-es5/pds-table-row.entry.js +1 -1
  288. package/dist/esm-es5/pds-table.entry.js +1 -1
  289. package/dist/esm-es5/pds-tabpanel.entry.js +1 -1
  290. package/dist/esm-es5/pds-tabs.entry.js +1 -1
  291. package/dist/esm-es5/pds-text.entry.js +1 -1
  292. package/dist/esm-es5/pds-textarea.entry.js +1 -1
  293. package/dist/esm-es5/pds-toast.entry.js +1 -1
  294. package/dist/esm-es5/pds-tooltip.entry.js +1 -1
  295. package/dist/esm-es5/pine-core.js +1 -1
  296. package/dist/esm-es5/sortable-label-PItnzVVR.js +1 -0
  297. package/dist/esm-es5/truncation-tooltip-CkIWm6Z-.js +1 -0
  298. package/dist/pine-core/{p-f834cb07.system.entry.js → p-00891b8d.system.entry.js} +1 -1
  299. package/dist/pine-core/{p-3f8bd3fb.system.entry.js → p-053ff8eb.system.entry.js} +1 -1
  300. package/dist/pine-core/p-08b9e3ad.entry.js +1 -0
  301. package/dist/pine-core/{p-4d98bc0c.system.entry.js → p-0a7570dd.system.entry.js} +1 -1
  302. package/dist/pine-core/{p-d018dc60.system.entry.js → p-0ac4262e.system.entry.js} +1 -1
  303. package/dist/pine-core/{p-89d38a82.system.entry.js → p-0e1b8bd1.system.entry.js} +1 -1
  304. package/dist/pine-core/{p-e1d1b5d8.entry.js → p-12fdc65f.entry.js} +1 -1
  305. package/dist/pine-core/{p-d48fe5a0.system.entry.js → p-16fceef6.system.entry.js} +1 -1
  306. package/dist/pine-core/p-1765a41b.system.entry.js +1 -0
  307. package/dist/pine-core/{p-a594c41f.entry.js → p-18524c25.entry.js} +1 -1
  308. package/dist/pine-core/p-1a013a5c.system.entry.js +1 -0
  309. package/dist/pine-core/{p-2b9622c1.system.entry.js → p-1ab52531.system.entry.js} +1 -1
  310. package/dist/pine-core/p-1c584a20.entry.js +1 -0
  311. package/dist/pine-core/p-1edef412.entry.js +1 -0
  312. package/dist/pine-core/{p-5946203c.entry.js → p-1f998e3e.entry.js} +1 -1
  313. package/dist/pine-core/{p-39e57657.entry.js → p-1fb1ca3d.entry.js} +1 -1
  314. package/dist/pine-core/p-2b6becc2.entry.js +1 -0
  315. package/dist/pine-core/p-2cc7c682.entry.js +1 -0
  316. package/dist/pine-core/{p-639acef8.system.entry.js → p-2ddcd845.system.entry.js} +1 -1
  317. package/dist/pine-core/{p-6a1aa8d3.entry.js → p-2f15e85f.entry.js} +1 -1
  318. package/dist/pine-core/{p-67f795d5.system.entry.js → p-33da254f.system.entry.js} +1 -1
  319. package/dist/pine-core/{p-c6a9e62c.system.entry.js → p-3fc9ef80.system.entry.js} +1 -1
  320. package/dist/pine-core/p-4125a4a6.system.entry.js +1 -0
  321. package/dist/pine-core/p-47df9e9f.system.entry.js +3 -0
  322. package/dist/pine-core/p-51680c9c.system.entry.js +1 -0
  323. package/dist/pine-core/p-55535481.system.entry.js +1 -0
  324. package/dist/pine-core/p-55a4659a.system.entry.js +1 -0
  325. package/dist/pine-core/{p-c5e1eb3c.system.entry.js → p-57af5c29.system.entry.js} +1 -1
  326. package/dist/pine-core/p-57edd301.system.entry.js +1 -0
  327. package/dist/pine-core/{p-bfa34194.entry.js → p-5d582798.entry.js} +1 -1
  328. package/dist/pine-core/p-5db87fda.system.entry.js +1 -0
  329. package/dist/pine-core/{p-19cf1d91.system.entry.js → p-5eb0c78c.system.entry.js} +1 -1
  330. package/dist/pine-core/{p-42f70f93.system.entry.js → p-6017afb5.system.entry.js} +1 -1
  331. package/dist/pine-core/{p-63f85859.system.entry.js → p-60e65fe0.system.entry.js} +1 -1
  332. package/dist/pine-core/{p-973c3ac0.entry.js → p-627a94da.entry.js} +1 -1
  333. package/dist/pine-core/{p-a9d96e22.entry.js → p-68328afc.entry.js} +1 -1
  334. package/dist/pine-core/{p-bd7dc317.system.entry.js → p-72668673.system.entry.js} +1 -1
  335. package/dist/pine-core/p-72ff5ad2.system.entry.js +1 -0
  336. package/dist/pine-core/p-736ea7dd.entry.js +7 -0
  337. package/dist/pine-core/p-765f4207.entry.js +1 -0
  338. package/dist/pine-core/{p-2a18852f.entry.js → p-77530cf2.entry.js} +1 -1
  339. package/dist/pine-core/p-77a22399.entry.js +1 -0
  340. package/dist/pine-core/p-783127bf.entry.js +1 -0
  341. package/dist/pine-core/{p-d9719e37.entry.js → p-82f7eed1.entry.js} +1 -1
  342. package/dist/pine-core/{p-124a0a24.entry.js → p-84d4ae26.entry.js} +1 -1
  343. package/dist/pine-core/p-8deeda07.entry.js +1 -0
  344. package/dist/pine-core/{p-849ec281.system.entry.js → p-8e17a6d8.system.entry.js} +1 -1
  345. package/dist/pine-core/p-8e7e7bba.entry.js +1 -0
  346. package/dist/pine-core/{p-e82f758f.system.entry.js → p-907c69e9.system.entry.js} +1 -1
  347. package/dist/pine-core/{p-1415c988.system.entry.js → p-90f83a5b.system.entry.js} +1 -1
  348. package/dist/pine-core/p-97145eee.system.entry.js +1 -0
  349. package/dist/pine-core/{p-a09c9c5e.system.entry.js → p-9d983e09.system.entry.js} +1 -1
  350. package/dist/pine-core/{p-1e3ef425.entry.js → p-9e005996.entry.js} +1 -1
  351. package/dist/pine-core/{p-DvN3tyZp.js → p-B0DXTeeV.js} +1 -1
  352. package/dist/pine-core/{p-CNXspDYs.system.js → p-BlJQebvG.system.js} +1 -1
  353. package/dist/pine-core/p-C35-349-.system.js +1 -0
  354. package/dist/pine-core/{p-vFsJv75D.system.js → p-CIe1DGXa.system.js} +1 -1
  355. package/dist/pine-core/p-CNn1lObg.js +1 -0
  356. package/dist/pine-core/p-CQJ44c6o.system.js +1 -0
  357. package/dist/pine-core/p-Dv9QBmIF.js +1 -0
  358. package/dist/pine-core/p-PItnzVVR.js +1 -0
  359. package/dist/pine-core/p-VPGVqK3P.system.js +1 -0
  360. package/dist/pine-core/p-XK45dzWR.system.js +1 -1
  361. package/dist/pine-core/p-a149af29.entry.js +1 -0
  362. package/dist/pine-core/p-a20d9eca.system.entry.js +1 -0
  363. package/dist/pine-core/{p-f6f4fd42.entry.js → p-a5782d99.entry.js} +1 -1
  364. package/dist/pine-core/p-a5e9c583.entry.js +1 -0
  365. package/dist/pine-core/{p-4d47023c.system.entry.js → p-a9eaf160.system.entry.js} +1 -1
  366. package/dist/pine-core/{p-143b33a6.entry.js → p-b00b07e3.entry.js} +1 -1
  367. package/dist/pine-core/{p-c7a53c4f.entry.js → p-b7b29392.entry.js} +1 -1
  368. package/dist/pine-core/p-b96bdff6.entry.js +1 -0
  369. package/dist/pine-core/{p-f71d71ca.entry.js → p-bbd9ab75.entry.js} +1 -1
  370. package/dist/pine-core/p-bdab6c9f.entry.js +1 -0
  371. package/dist/pine-core/p-biShcgLI.js +1 -0
  372. package/dist/pine-core/{p-548bce53.system.entry.js → p-c12b5cd7.system.entry.js} +1 -1
  373. package/dist/pine-core/p-c1dc7692.entry.js +1 -0
  374. package/dist/pine-core/p-c76d8b9e.system.entry.js +1 -0
  375. package/dist/pine-core/{p-590df41a.entry.js → p-c89ea2d3.entry.js} +1 -1
  376. package/dist/pine-core/{p-d920d759.system.entry.js → p-c9630934.system.entry.js} +1 -1
  377. package/dist/pine-core/{p-6f4ab1ea.system.entry.js → p-cb9227f6.system.entry.js} +1 -1
  378. package/dist/pine-core/p-ceef0eb1.entry.js +1 -0
  379. package/dist/pine-core/p-d1283e8d.entry.js +1 -0
  380. package/dist/pine-core/p-d676926d.system.entry.js +1 -0
  381. package/dist/pine-core/{p-61cfdbb2.entry.js → p-d7d7a4e1.entry.js} +1 -1
  382. package/dist/pine-core/p-d85d50cb.entry.js +1 -0
  383. package/dist/pine-core/p-daa802f1.entry.js +2 -0
  384. package/dist/pine-core/p-ddf4b9b5.system.entry.js +1 -0
  385. package/dist/pine-core/p-de3b319e.system.entry.js +8 -0
  386. package/dist/pine-core/{p-cb9baf78.system.entry.js → p-e00777da.system.entry.js} +1 -1
  387. package/dist/pine-core/p-e2541eeb.entry.js +1 -0
  388. package/dist/pine-core/{p-01f1cdaf.system.entry.js → p-e2a1a49a.system.entry.js} +1 -1
  389. package/dist/pine-core/p-e4ebea88.system.entry.js +1 -0
  390. package/dist/pine-core/{p-947582e1.entry.js → p-e554bd64.entry.js} +1 -1
  391. package/dist/pine-core/{p-dd7ded84.entry.js → p-e6427c87.entry.js} +1 -1
  392. package/dist/pine-core/{p-50ddadbf.entry.js → p-e72e8b8f.entry.js} +1 -1
  393. package/dist/pine-core/p-e92d0f0f.system.entry.js +1 -0
  394. package/dist/pine-core/{p-9b32727a.system.entry.js → p-eab165b9.system.entry.js} +1 -1
  395. package/dist/pine-core/p-eabc4bd8.entry.js +1 -0
  396. package/dist/pine-core/p-ef9f84f2.system.entry.js +1 -0
  397. package/dist/pine-core/{p-c9ae7964.entry.js → p-f026af73.entry.js} +1 -1
  398. package/dist/pine-core/{p-99530cb5.entry.js → p-f0509c8e.entry.js} +1 -1
  399. package/dist/pine-core/p-f1252e72.system.entry.js +1 -0
  400. package/dist/pine-core/p-f3496fd1.entry.js +1 -0
  401. package/dist/pine-core/{p-eecd9ad8.system.entry.js → p-f90f4be7.system.entry.js} +1 -1
  402. package/dist/pine-core/p-f9bdaadd.system.entry.js +1 -0
  403. package/dist/pine-core/{p-128c04e7.entry.js → p-fda791df.entry.js} +1 -1
  404. package/dist/pine-core/p-fea4296d.entry.js +1 -0
  405. package/dist/pine-core/pine-core.esm.js +1 -1
  406. package/dist/types/components/pds-alert/pds-alert.d.ts +2 -1
  407. package/dist/types/components/pds-avatar/pds-avatar.d.ts +5 -4
  408. package/dist/types/components/pds-box/pds-box.d.ts +68 -57
  409. package/dist/types/components/pds-button/pds-button.d.ts +14 -3
  410. package/dist/types/components/pds-checkbox/pds-checkbox.d.ts +15 -8
  411. package/dist/types/components/pds-chip/pds-chip.d.ts +2 -2
  412. package/dist/types/components/pds-combobox/pds-combobox.d.ts +48 -11
  413. package/dist/types/components/pds-copytext/pds-copytext.d.ts +3 -1
  414. package/dist/types/components/pds-datepicker/date-utils.d.ts +19 -0
  415. package/dist/types/components/pds-datepicker/datepicker-interface.d.ts +22 -5
  416. package/dist/types/components/pds-datepicker/pds-datepicker.d.ts +33 -7
  417. package/dist/types/components/pds-datepicker/presets.d.ts +3 -2
  418. package/dist/types/components/pds-datepicker/value.d.ts +14 -2
  419. package/dist/types/components/pds-drawer/pds-drawer-content/pds-drawer-content.d.ts +1 -4
  420. package/dist/types/components/pds-drawer/pds-drawer-footer/pds-drawer-footer.d.ts +1 -0
  421. package/dist/types/components/pds-drawer/pds-drawer-header/pds-drawer-header.d.ts +1 -0
  422. package/dist/types/components/pds-drawer/pds-drawer.d.ts +4 -6
  423. package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.d.ts +20 -16
  424. package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu-separator/pds-dropdown-menu-separator.d.ts +1 -1
  425. package/dist/types/components/pds-dropdown-menu/pds-dropdown-menu.d.ts +7 -0
  426. package/dist/types/components/pds-filters/pds-filter/pds-filter.d.ts +6 -5
  427. package/dist/types/components/pds-image/image-interface.d.ts +12 -0
  428. package/dist/types/components/pds-image/pds-image.d.ts +69 -9
  429. package/dist/types/components/pds-input/pds-input.d.ts +17 -7
  430. package/dist/types/components/pds-link/pds-link.d.ts +8 -8
  431. package/dist/types/components/pds-loader/pds-loader.d.ts +3 -2
  432. package/dist/types/components/pds-modal/pds-modal-footer/pds-modal-footer.d.ts +1 -0
  433. package/dist/types/components/pds-modal/pds-modal-header/pds-modal-header.d.ts +1 -0
  434. package/dist/types/components/pds-modal/pds-modal.d.ts +7 -9
  435. package/dist/types/components/pds-multiselect/pds-multiselect.d.ts +14 -8
  436. package/dist/types/components/pds-popover/pds-popover.d.ts +2 -2
  437. package/dist/types/components/pds-progress/pds-progress.d.ts +2 -2
  438. package/dist/types/components/pds-radio/pds-radio.d.ts +6 -5
  439. package/dist/types/components/pds-radio-group/pds-radio-group.d.ts +5 -4
  440. package/dist/types/components/pds-select/pds-select.d.ts +9 -3
  441. package/dist/types/components/pds-sortable/pds-sortable-item/pds-sortable-item.d.ts +8 -2
  442. package/dist/types/components/pds-sortable/pds-sortable.d.ts +82 -1
  443. package/dist/types/components/pds-sortable/sortable-label.d.ts +7 -0
  444. package/dist/types/components/pds-switch/pds-switch.d.ts +17 -2
  445. package/dist/types/components/pds-table/pds-table-body/pds-table-body.d.ts +3 -0
  446. package/dist/types/components/pds-table/pds-table-cell/pds-table-cell.d.ts +10 -0
  447. package/dist/types/components/pds-table/pds-table-head/pds-table-head.d.ts +5 -1
  448. package/dist/types/components/pds-table/pds-table-head-cell/pds-table-head-cell.d.ts +21 -0
  449. package/dist/types/components/pds-table/pds-table-row/pds-table-row.d.ts +4 -0
  450. package/dist/types/components/pds-table/pds-table.d.ts +76 -2
  451. package/dist/types/components/pds-tabs/pds-tabs.d.ts +1 -1
  452. package/dist/types/components/pds-textarea/pds-textarea.d.ts +15 -13
  453. package/dist/types/components/pds-toast/pds-toast.d.ts +5 -1
  454. package/dist/types/components.d.ts +505 -335
  455. package/dist/types/utils/aria-references.d.ts +4 -0
  456. package/dist/types/utils/truncation-tooltip.d.ts +39 -0
  457. package/dist/types/utils/types.d.ts +3 -0
  458. package/dist/vscode.html-data.json +350 -137
  459. package/hydrate/index.js +2054 -427
  460. package/hydrate/index.mjs +2054 -427
  461. package/package.json +3 -3
  462. package/readme.md +26 -55
  463. package/dist/esm-es5/truncation-tooltip-DBcPipr9.js +0 -1
  464. package/dist/pine-core/p-07323107.entry.js +0 -1
  465. package/dist/pine-core/p-08b8e941.entry.js +0 -1
  466. package/dist/pine-core/p-0b7b3fc2.system.entry.js +0 -3
  467. package/dist/pine-core/p-0d5f0ab5.system.entry.js +0 -1
  468. package/dist/pine-core/p-14dedf01.system.entry.js +0 -1
  469. package/dist/pine-core/p-1ca8d183.entry.js +0 -1
  470. package/dist/pine-core/p-1f62bb71.entry.js +0 -7
  471. package/dist/pine-core/p-2dd30d12.entry.js +0 -1
  472. package/dist/pine-core/p-35s7h-dk.js +0 -1
  473. package/dist/pine-core/p-3610cb3b.entry.js +0 -1
  474. package/dist/pine-core/p-39276663.entry.js +0 -1
  475. package/dist/pine-core/p-3a1dc752.system.entry.js +0 -1
  476. package/dist/pine-core/p-42d43c3f.system.entry.js +0 -1
  477. package/dist/pine-core/p-4a90b9c8.system.entry.js +0 -1
  478. package/dist/pine-core/p-4cfe922b.entry.js +0 -1
  479. package/dist/pine-core/p-5f181694.system.entry.js +0 -1
  480. package/dist/pine-core/p-60a30975.system.entry.js +0 -1
  481. package/dist/pine-core/p-62aa6a78.system.entry.js +0 -1
  482. package/dist/pine-core/p-64bcb378.entry.js +0 -1
  483. package/dist/pine-core/p-724baba3.system.entry.js +0 -1
  484. package/dist/pine-core/p-72659a0e.system.entry.js +0 -1
  485. package/dist/pine-core/p-8436cbfb.entry.js +0 -1
  486. package/dist/pine-core/p-8ade17ce.entry.js +0 -1
  487. package/dist/pine-core/p-8e7f75e6.entry.js +0 -1
  488. package/dist/pine-core/p-8fb520df.entry.js +0 -1
  489. package/dist/pine-core/p-92115e88.entry.js +0 -1
  490. package/dist/pine-core/p-94c9b7d1.system.entry.js +0 -1
  491. package/dist/pine-core/p-97356d4b.entry.js +0 -1
  492. package/dist/pine-core/p-97653e60.entry.js +0 -1
  493. package/dist/pine-core/p-97b73359.entry.js +0 -1
  494. package/dist/pine-core/p-BZVUD2on.js +0 -1
  495. package/dist/pine-core/p-Dj-z_ugg.system.js +0 -1
  496. package/dist/pine-core/p-ad5208a4.system.entry.js +0 -1
  497. package/dist/pine-core/p-afc2f165.entry.js +0 -1
  498. package/dist/pine-core/p-bcc378ba.system.entry.js +0 -8
  499. package/dist/pine-core/p-c8a0b562.system.entry.js +0 -1
  500. package/dist/pine-core/p-d47b2a6a.system.entry.js +0 -1
  501. package/dist/pine-core/p-d6f338e0.entry.js +0 -1
  502. package/dist/pine-core/p-da8b864a.entry.js +0 -2
  503. package/dist/pine-core/p-db7fb5a3.entry.js +0 -1
  504. package/dist/pine-core/p-de455073.system.entry.js +0 -1
  505. package/dist/pine-core/p-e3de6a1d.entry.js +0 -1
  506. package/dist/pine-core/p-e84fa9ed.entry.js +0 -1
  507. package/dist/pine-core/p-eb4f0daa.system.entry.js +0 -1
  508. package/dist/pine-core/p-eb56af4a.system.entry.js +0 -1
  509. package/dist/pine-core/p-ef0eba9b.system.entry.js +0 -1
  510. package/dist/pine-core/p-f11cce27.system.entry.js +0 -1
  511. package/dist/pine-core/p-f354dbac.entry.js +0 -1
@@ -1,6 +1,11 @@
1
- import { Host, h } from "@stencil/core";
1
+ import { forceUpdate, Host, h } from "@stencil/core";
2
+ import { sortableItemLabel } from "./sortable-label";
2
3
  import { HostStylingKeeper } from "../../utils/attributes";
4
+ import { formatMessage } from "../../i18n";
3
5
  import Sortable from "sortablejs";
6
+ const LIVE_REGION_CLASS = 'pds-sortable__live-region';
7
+ const GRABBED_CLASS = 'pds-sortable-item--grabbed';
8
+ const HANDLE_SELECTOR = '.pds-sortable-item__handle';
4
9
  /**
5
10
  * @lightDom host-only
6
11
  */
@@ -24,11 +29,155 @@ export class PdsSortable {
24
29
  * Determines the grabbable area for the `pds-sortable-item`.
25
30
  */
26
31
  this.handleType = 'row';
32
+ /**
33
+ * Accessible label for each item's reorder handle, the button the keyboard reorders with. Pass a translated string to localize it; `{item}` is interpolated.
34
+ * @defaultValue 'Reorder {item}'
35
+ */
36
+ this.handleLabel = 'Reorder {item}';
37
+ /**
38
+ * Screen-reader announcement when an item is picked up from the keyboard. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated.
39
+ * @defaultValue '{item}, picked up. Position {position} of {total}. Press the arrow keys to move, Space or Enter to drop, Escape to cancel.'
40
+ */
41
+ this.itemPickedUpLabel = '{item}, picked up. Position {position} of {total}. Press the arrow keys to move, Space or Enter to drop, Escape to cancel.';
42
+ /**
43
+ * Screen-reader announcement when a picked-up item is moved. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated.
44
+ * @defaultValue '{item}, moved to position {position} of {total}'
45
+ */
46
+ this.itemMovedLabel = '{item}, moved to position {position} of {total}';
47
+ /**
48
+ * Screen-reader announcement when a picked-up item is dropped. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated.
49
+ * @defaultValue '{item}, dropped at position {position} of {total}'
50
+ */
51
+ this.itemDroppedLabel = '{item}, dropped at position {position} of {total}';
52
+ /**
53
+ * Screen-reader announcement when a keyboard reorder is canceled and the item goes back. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated.
54
+ * @defaultValue 'Reorder canceled. {item} returned to position {position} of {total}'
55
+ */
56
+ this.reorderCanceledLabel = 'Reorder canceled. {item} returned to position {position} of {total}';
57
+ /** The item picked up from the keyboard, and where it started. */
58
+ this.grabbed = null;
59
+ this.liveRegion = null;
27
60
  this.hostKeeper = new HostStylingKeeper();
61
+ // Set only when a `pointerdown` here drops a picked-up item, and only until the `click` that
62
+ // follows it, if one does: a screen reader's browse-mode Enter or Space synthesizes both for
63
+ // the same press, and that click must not re-pick-up what its own pointerdown just dropped.
64
+ this.droppedByPointerDown = null;
65
+ this.handleFocusIn = () => {
66
+ this.ensureLiveRegion();
67
+ };
68
+ /**
69
+ * Focus leaving a picked-up item drops it where it is, unless the whole window lost focus (the user
70
+ * switched apps), when the item stays picked up for their return. A real window blur does not move
71
+ * `document.activeElement` away from the handle that's losing focus (some browsers reset it to `body`
72
+ * instead, but never to a different element), so it's told apart from focus moving into an iframe or
73
+ * another embedded document that way: an iframe becomes a genuinely different active element, while a
74
+ * window blur leaves `activeElement` as the handle itself, `null`, or `body`.
75
+ */
76
+ this.handleFocusOut = (ev) => {
77
+ var _a;
78
+ if (!this.isGrabbing() || ev.target !== this.focusTarget(this.grabbed.item))
79
+ return;
80
+ const nothingElseFocused = document.activeElement === null || document.activeElement === document.body || document.activeElement === ev.target;
81
+ if (ev.relatedTarget === null && ((_a = document.hasFocus) === null || _a === void 0 ? void 0 : _a.call(document)) === false && nothingElseFocused)
82
+ return;
83
+ this.drop(ev);
84
+ };
85
+ /**
86
+ * Screen readers in browse mode turn Enter and Space on a button into a click with no key events,
87
+ * so a click that isn't from a pointer (`detail` is 0) picks up or drops too.
88
+ */
89
+ this.handleClick = (ev) => {
90
+ if (this.disabled || ev.detail !== 0)
91
+ return;
92
+ const item = this.targetItem(ev.target);
93
+ if (!item)
94
+ return;
95
+ // NVDA and JAWS in Chromium fire this click's capture-phase `pointerdown` first, for the
96
+ // same Enter or Space press. If that pointerdown found the item already grabbed and dropped
97
+ // it, this click is that same press's drop, already handled -- picking the item back up here
98
+ // would leave it stuck grabbed, since Escape and the arrow keys don't reach the handle in
99
+ // browse mode.
100
+ if (this.droppedByPointerDown === item) {
101
+ this.droppedByPointerDown = null;
102
+ return;
103
+ }
104
+ if (!this.isGrabbing()) {
105
+ this.pickUp(item);
106
+ }
107
+ else if (this.grabbed.item === item) {
108
+ this.drop(ev);
109
+ }
110
+ };
111
+ this.handleKeyDown = (ev) => {
112
+ if (this.disabled || ev.altKey || ev.ctrlKey || ev.metaKey)
113
+ return;
114
+ const item = this.targetItem(ev.target);
115
+ if (!item)
116
+ return;
117
+ if (!this.isGrabbing()) {
118
+ if ((ev.key === ' ' || ev.key === 'Enter') && !ev.repeat) {
119
+ ev.preventDefault();
120
+ this.pickUp(item);
121
+ }
122
+ return;
123
+ }
124
+ if (this.grabbed.item !== item)
125
+ return;
126
+ const items = this.items();
127
+ const index = items.indexOf(item);
128
+ switch (ev.key) {
129
+ case 'ArrowUp':
130
+ ev.preventDefault();
131
+ this.moveTo(item, index - 1);
132
+ break;
133
+ case 'ArrowDown':
134
+ ev.preventDefault();
135
+ this.moveTo(item, index + 1);
136
+ break;
137
+ case 'Home':
138
+ ev.preventDefault();
139
+ this.moveTo(item, 0);
140
+ break;
141
+ case 'End':
142
+ ev.preventDefault();
143
+ this.moveTo(item, items.length - 1);
144
+ break;
145
+ case ' ':
146
+ case 'Enter':
147
+ ev.preventDefault();
148
+ if (!ev.repeat)
149
+ this.drop(ev);
150
+ break;
151
+ case 'Escape':
152
+ // Keep an enclosing modal or drawer from closing too.
153
+ ev.preventDefault();
154
+ ev.stopPropagation();
155
+ this.cancel();
156
+ break;
157
+ }
158
+ };
28
159
  }
29
160
  handleDisabledChange() {
30
161
  var _a;
31
162
  (_a = this.sortableInstance) === null || _a === void 0 ? void 0 : _a.option('disabled', this.disabled);
163
+ if (this.disabled && this.isGrabbing())
164
+ this.cancel();
165
+ this.updateItems();
166
+ }
167
+ handleHandleTypeChange() {
168
+ var _a;
169
+ if (this.isGrabbing())
170
+ this.cancel();
171
+ // `null`, not `undefined`: SortableJS treats `option(name, undefined)` as a read, which would
172
+ // leave a previous handle restriction in place.
173
+ (_a = this.sortableInstance) === null || _a === void 0 ? void 0 : _a.option('handle', this.handleType === 'handle' ? HANDLE_SELECTOR : null);
174
+ this.updateItems();
175
+ }
176
+ updateItems() {
177
+ this.items().forEach((item) => {
178
+ if (item.tagName === 'PDS-SORTABLE-ITEM')
179
+ forceUpdate(item);
180
+ });
32
181
  }
33
182
  classNames() {
34
183
  const classNames = ['pds-sortable'];
@@ -50,11 +199,19 @@ export class PdsSortable {
50
199
  this.hostKeeper.connect(this.el);
51
200
  }
52
201
  disconnectedCallback() {
202
+ var _a;
53
203
  this.hostKeeper.disconnect();
204
+ // Put the order back: a move that was never dropped was never emitted.
205
+ if (this.isGrabbing())
206
+ this.cancel(false);
207
+ (_a = this.liveRegion) === null || _a === void 0 ? void 0 : _a.remove();
208
+ this.liveRegion = null;
54
209
  }
55
210
  componentDidLoad() {
211
+ var _a;
212
+ const reduceMotion = typeof window !== 'undefined' && ((_a = window.matchMedia) === null || _a === void 0 ? void 0 : _a.call(window, '(prefers-reduced-motion: reduce)').matches);
56
213
  let sortableOptions = {
57
- animation: 150,
214
+ animation: reduceMotion ? 0 : 150,
58
215
  disabled: this.disabled,
59
216
  ghostClass: 'pds-sortable-item--ghost',
60
217
  dragClass: 'pds-sortable-item--drag',
@@ -63,14 +220,203 @@ export class PdsSortable {
63
220
  },
64
221
  };
65
222
  if (this.handleType === 'handle') {
66
- sortableOptions = Object.assign(Object.assign({}, sortableOptions), { handle: '.pds-sortable-item__handle' });
223
+ sortableOptions = Object.assign(Object.assign({}, sortableOptions), { handle: HANDLE_SELECTOR });
67
224
  }
68
225
  this.sortableInstance = Sortable.create(this.el, sortableOptions);
226
+ // In place before the first announcement, as a region that's created with its text isn't read.
227
+ this.ensureLiveRegion();
228
+ // Items that rendered before this list was defined have no handle yet.
229
+ this.updateItems();
230
+ }
231
+ /** The children that can be reordered, counted as SortableJS counts them. */
232
+ items() {
233
+ return Array.from(this.el.children).filter((child) => child.tagName !== 'TEMPLATE');
234
+ }
235
+ /**
236
+ * The live region sits right after the list, not in it, so it's never counted as an item, by
237
+ * SortableJS or by a consumer reading the list's children, and it's still in the same modal. A
238
+ * morph that removes it gets it put back on the next focus.
239
+ */
240
+ ensureLiveRegion() {
241
+ if (!this.liveRegion) {
242
+ // A page-cache (bfcache, Turbo) restore brings back a DOM snapshot that can already have
243
+ // this list's own live region sitting right after it -- adopted here instead of making
244
+ // another, which would leave the stale one behind with its last message still in it.
245
+ const existing = this.el.nextElementSibling;
246
+ if (existing === null || existing === void 0 ? void 0 : existing.classList.contains(LIVE_REGION_CLASS)) {
247
+ this.liveRegion = existing;
248
+ return;
249
+ }
250
+ const region = document.createElement('span');
251
+ region.className = LIVE_REGION_CLASS;
252
+ region.setAttribute('role', 'status');
253
+ region.setAttribute('aria-live', 'polite');
254
+ region.setAttribute('aria-atomic', 'true');
255
+ // Created here, not rendered, so the scoped stylesheet can't reach it. With no inset, an
256
+ // absolutely positioned element sits at its static position -- the end of the list, here --
257
+ // rather than collapsing to (0, 0), which can grow a scrollable ancestor's scroll area.
258
+ Object.assign(region.style, {
259
+ position: 'absolute',
260
+ width: '1px',
261
+ height: '1px',
262
+ margin: '-1px',
263
+ padding: '0',
264
+ overflow: 'hidden',
265
+ clipPath: 'inset(50%)',
266
+ whiteSpace: 'nowrap',
267
+ border: '0',
268
+ });
269
+ this.liveRegion = region;
270
+ }
271
+ if (!this.liveRegion.isConnected && this.el.parentNode) {
272
+ // The host may itself be slotted into a named slot (e.g. inside a modal); stay in it rather
273
+ // than falling back to the default slot, which a consumer's template may not render.
274
+ const hostSlot = this.el.getAttribute('slot');
275
+ if (hostSlot !== null) {
276
+ this.liveRegion.setAttribute('slot', hostSlot);
277
+ }
278
+ else {
279
+ this.liveRegion.removeAttribute('slot');
280
+ }
281
+ this.el.parentNode.insertBefore(this.liveRegion, this.el.nextSibling);
282
+ }
283
+ }
284
+ announce(template, item) {
285
+ this.ensureLiveRegion();
286
+ const items = this.items();
287
+ const message = formatMessage(template, {
288
+ item: sortableItemLabel(item),
289
+ position: items.indexOf(item) + 1,
290
+ total: items.length,
291
+ });
292
+ // A repeat of the same text isn't announced again, so tell the two apart.
293
+ this.liveRegion.textContent = message === this.liveRegion.textContent ? `${message} ` : message;
294
+ }
295
+ handlePointerDown(ev) {
296
+ // A drag takes over from a keyboard reorder: keep the moves so far, so the drag starts from them.
297
+ // Only the primary button (or a touch/pen contact, same value) can start that drag -- a
298
+ // right-click or a secondary pointer does something else (a context menu, typically) and
299
+ // must not drop the item out from under it.
300
+ if (ev.button !== 0 || !this.isGrabbing())
301
+ return;
302
+ const item = this.grabbed.item;
303
+ this.drop(ev);
304
+ this.droppedByPointerDown = item;
305
+ window.setTimeout(() => {
306
+ if (this.droppedByPointerDown === item)
307
+ this.droppedByPointerDown = null;
308
+ }, 0);
309
+ }
310
+ /**
311
+ * Whether an item is picked up. One that's been taken out of the list meanwhile (a re-render, a
312
+ * stream update) is let go, as there's nothing left to move.
313
+ */
314
+ isGrabbing() {
315
+ if (this.grabbed && this.grabbed.item.parentElement !== this.el)
316
+ this.release();
317
+ return this.grabbed !== null;
318
+ }
319
+ /** The item whose handle `target` is, if it is one. */
320
+ targetItem(target) {
321
+ const item = this.items().find((candidate) => candidate.contains(target));
322
+ return item && this.focusTarget(item) === target ? item : undefined;
323
+ }
324
+ /** The item's handle, the button the keyboard reorders with. */
325
+ focusTarget(item) {
326
+ var _a;
327
+ return ((_a = Array.from(item.children).find((child) => child.matches(HANDLE_SELECTOR))) !== null && _a !== void 0 ? _a : null);
328
+ }
329
+ // SortableJS tells `index` (among all children) and `draggableIndex` (among draggable ones)
330
+ // apart for a list that also holds non-draggable children. This list doesn't -- the live
331
+ // region that once lived among `this.el`'s children now sits outside it as a sibling -- so
332
+ // `items()` already is every child, and the two counts are always the same.
333
+ indexes(item) {
334
+ const index = this.items().indexOf(item);
335
+ return { index, draggableIndex: index };
336
+ }
337
+ pickUp(item) {
338
+ var _a;
339
+ const { index, draggableIndex } = this.indexes(item);
340
+ this.grabbed = { item, oldIndex: index, oldDraggableIndex: draggableIndex };
341
+ item.classList.add(GRABBED_CLASS);
342
+ (_a = this.focusTarget(item)) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-pressed', 'true');
343
+ this.announce(this.itemPickedUpLabel, item);
344
+ }
345
+ /**
346
+ * Moves the other items around `item` rather than `item` itself, so it never leaves the DOM and
347
+ * keeps focus.
348
+ */
349
+ moveTo(item, to, announce = true) {
350
+ var _a;
351
+ const items = this.items();
352
+ const from = items.indexOf(item);
353
+ if (to < 0 || to >= items.length || to === from) {
354
+ // At the first or last position, an out-of-range attempt (ArrowUp at the top, ArrowDown at
355
+ // the bottom) or a no-op one (Home already first, End already last) would otherwise leave
356
+ // a screen reader user with no sign the key landed at all. Repeating the current position
357
+ // confirms it without implying a move that didn't happen -- `cancel()`'s own call here
358
+ // passes `announce: false` and gets its own, different announcement instead.
359
+ if (announce)
360
+ this.announce(this.itemMovedLabel, item);
361
+ return;
362
+ }
363
+ if (to < from) {
364
+ const next = item.nextSibling;
365
+ items.slice(to, from).forEach((sibling) => this.el.insertBefore(sibling, next));
366
+ }
367
+ else {
368
+ items.slice(from + 1, to + 1).forEach((sibling) => this.el.insertBefore(sibling, item));
369
+ }
370
+ // Focus doesn't move, so the browser won't scroll the item into view itself.
371
+ (_a = item.scrollIntoView) === null || _a === void 0 ? void 0 : _a.call(item, { block: 'nearest' });
372
+ if (announce)
373
+ this.announce(this.itemMovedLabel, item);
374
+ }
375
+ drop(originalEvent) {
376
+ const { item, oldIndex, oldDraggableIndex } = this.grabbed;
377
+ this.release();
378
+ this.announce(this.itemDroppedLabel, item);
379
+ const { index, draggableIndex } = this.indexes(item);
380
+ // A keyboard drop happens more often than a drag: tabbing away from a picked-up row, a click
381
+ // elsewhere in the list, or the second press of a screen reader's browse-mode Enter all drop
382
+ // it too. Emitting unconditionally would have a consumer that saves on every event send a
383
+ // no-op request each time nothing actually moved.
384
+ if (draggableIndex === oldDraggableIndex)
385
+ return;
386
+ // The same shape SortableJS gives `onEnd`, with the event that ended the move as
387
+ // `originalEvent` -- not always a `KeyboardEvent`: a `FocusEvent` when focus leaves the row,
388
+ // a `PointerEvent` for a pointerdown, or a `MouseEvent` for a browse-mode click.
389
+ const detail = Object.assign(new CustomEvent('end', { bubbles: true, cancelable: true }), {
390
+ item,
391
+ from: this.el,
392
+ to: this.el,
393
+ oldIndex,
394
+ newIndex: index,
395
+ oldDraggableIndex,
396
+ newDraggableIndex: draggableIndex,
397
+ originalEvent,
398
+ pullMode: undefined,
399
+ });
400
+ this.pdsSortableItemMoved.emit(detail);
401
+ }
402
+ cancel(announce = true) {
403
+ const { item, oldDraggableIndex } = this.grabbed;
404
+ this.release();
405
+ // Items may have come or gone meanwhile, so go back as near the start as the list allows.
406
+ this.moveTo(item, Math.min(oldDraggableIndex, this.items().length - 1), false);
407
+ if (announce)
408
+ this.announce(this.reorderCanceledLabel, item);
409
+ }
410
+ release() {
411
+ var _a;
412
+ this.grabbed.item.classList.remove(GRABBED_CLASS);
413
+ (_a = this.focusTarget(this.grabbed.item)) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-pressed', 'false');
414
+ this.grabbed = null;
69
415
  }
70
416
  render() {
71
417
  const classNames = this.classNames();
72
418
  this.hostKeeper.record(classNames);
73
- return (h(Host, { key: '6e9e7b769f57ebfd81541fbecbe17b3fb4ad3e47', class: classNames, id: this.componentId }, h("slot", { key: 'c9466a216862c0a3e578f3fcfc1ac1e26146722b' })));
419
+ return (h(Host, { key: 'a1fb28574e3aa92a923c4baeecec690d4052601f', class: classNames, id: this.componentId, onFocusin: this.handleFocusIn, onFocusout: this.handleFocusOut, onKeyDown: this.handleKeyDown, onClick: this.handleClick }, h("slot", { key: 'b9a255d4f94a6b9976a4cac7e142e45210125828' })));
74
420
  }
75
421
  static get is() { return "pds-sortable"; }
76
422
  static get encapsulation() { return "scoped"; }
@@ -190,6 +536,121 @@ export class PdsSortable {
190
536
  "reflect": false,
191
537
  "attribute": "handle-type",
192
538
  "defaultValue": "'row'"
539
+ },
540
+ "handleLabel": {
541
+ "type": "string",
542
+ "mutable": false,
543
+ "complexType": {
544
+ "original": "string",
545
+ "resolved": "string",
546
+ "references": {}
547
+ },
548
+ "required": false,
549
+ "optional": false,
550
+ "docs": {
551
+ "tags": [{
552
+ "name": "defaultValue",
553
+ "text": "'Reorder {item}'"
554
+ }],
555
+ "text": "Accessible label for each item's reorder handle, the button the keyboard reorders with. Pass a translated string to localize it; `{item}` is interpolated."
556
+ },
557
+ "getter": false,
558
+ "setter": false,
559
+ "reflect": false,
560
+ "attribute": "handle-label",
561
+ "defaultValue": "'Reorder {item}'"
562
+ },
563
+ "itemPickedUpLabel": {
564
+ "type": "string",
565
+ "mutable": false,
566
+ "complexType": {
567
+ "original": "string",
568
+ "resolved": "string",
569
+ "references": {}
570
+ },
571
+ "required": false,
572
+ "optional": false,
573
+ "docs": {
574
+ "tags": [{
575
+ "name": "defaultValue",
576
+ "text": "'{item}, picked up. Position {position} of {total}. Press the arrow keys to move, Space or Enter to drop, Escape to cancel.'"
577
+ }],
578
+ "text": "Screen-reader announcement when an item is picked up from the keyboard. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated."
579
+ },
580
+ "getter": false,
581
+ "setter": false,
582
+ "reflect": false,
583
+ "attribute": "item-picked-up-label",
584
+ "defaultValue": "'{item}, picked up. Position {position} of {total}. Press the arrow keys to move, Space or Enter to drop, Escape to cancel.'"
585
+ },
586
+ "itemMovedLabel": {
587
+ "type": "string",
588
+ "mutable": false,
589
+ "complexType": {
590
+ "original": "string",
591
+ "resolved": "string",
592
+ "references": {}
593
+ },
594
+ "required": false,
595
+ "optional": false,
596
+ "docs": {
597
+ "tags": [{
598
+ "name": "defaultValue",
599
+ "text": "'{item}, moved to position {position} of {total}'"
600
+ }],
601
+ "text": "Screen-reader announcement when a picked-up item is moved. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated."
602
+ },
603
+ "getter": false,
604
+ "setter": false,
605
+ "reflect": false,
606
+ "attribute": "item-moved-label",
607
+ "defaultValue": "'{item}, moved to position {position} of {total}'"
608
+ },
609
+ "itemDroppedLabel": {
610
+ "type": "string",
611
+ "mutable": false,
612
+ "complexType": {
613
+ "original": "string",
614
+ "resolved": "string",
615
+ "references": {}
616
+ },
617
+ "required": false,
618
+ "optional": false,
619
+ "docs": {
620
+ "tags": [{
621
+ "name": "defaultValue",
622
+ "text": "'{item}, dropped at position {position} of {total}'"
623
+ }],
624
+ "text": "Screen-reader announcement when a picked-up item is dropped. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated."
625
+ },
626
+ "getter": false,
627
+ "setter": false,
628
+ "reflect": false,
629
+ "attribute": "item-dropped-label",
630
+ "defaultValue": "'{item}, dropped at position {position} of {total}'"
631
+ },
632
+ "reorderCanceledLabel": {
633
+ "type": "string",
634
+ "mutable": false,
635
+ "complexType": {
636
+ "original": "string",
637
+ "resolved": "string",
638
+ "references": {}
639
+ },
640
+ "required": false,
641
+ "optional": false,
642
+ "docs": {
643
+ "tags": [{
644
+ "name": "defaultValue",
645
+ "text": "'Reorder canceled. {item} returned to position {position} of {total}'"
646
+ }],
647
+ "text": "Screen-reader announcement when a keyboard reorder is canceled and the item goes back. Pass a translated string to localize it; `{item}`, `{position}` and `{total}` are interpolated."
648
+ },
649
+ "getter": false,
650
+ "setter": false,
651
+ "reflect": false,
652
+ "attribute": "reorder-canceled-label",
653
+ "defaultValue": "'Reorder canceled. {item} returned to position {position} of {total}'"
193
654
  }
194
655
  };
195
656
  }
@@ -202,7 +663,7 @@ export class PdsSortable {
202
663
  "composed": true,
203
664
  "docs": {
204
665
  "tags": [],
205
- "text": "Event emitted when a sortable item is moved."
666
+ "text": "Event emitted when a sortable item is moved, by dragging or from the keyboard. A keyboard move\ncarries the same fields as a drag (`item`, `from`, `to`, `oldIndex`, `newIndex`,\n`oldDraggableIndex`, `newDraggableIndex`), with the event that ended the move as\n`originalEvent` -- a `KeyboardEvent` for Space or Enter, but a `FocusEvent`, `PointerEvent` or\n`MouseEvent` when the drop instead comes from focus leaving the row, a drag taking over, or a\nscreen reader's browse-mode click."
206
667
  },
207
668
  "complexType": {
208
669
  "original": "SortableEvent",
@@ -223,6 +684,21 @@ export class PdsSortable {
223
684
  return [{
224
685
  "propName": "disabled",
225
686
  "methodName": "handleDisabledChange"
687
+ }, {
688
+ "propName": "handleType",
689
+ "methodName": "handleHandleTypeChange"
690
+ }, {
691
+ "propName": "handleLabel",
692
+ "methodName": "updateItems"
693
+ }];
694
+ }
695
+ static get listeners() {
696
+ return [{
697
+ "name": "pointerdown",
698
+ "method": "handlePointerDown",
699
+ "target": undefined,
700
+ "capture": true,
701
+ "passive": true
226
702
  }];
227
703
  }
228
704
  }
@@ -0,0 +1,33 @@
1
+ const ELEMENT_NODE = 1;
2
+ const TEXT_NODE = 3;
3
+ /**
4
+ * The name a sortable item goes by in its handle's label and in reorder announcements: its
5
+ * `item-label`, or else its own text, leaving out the handle and the actions.
6
+ * @param item - A `pds-sortable-item`
7
+ * @returns The item's name, with whitespace collapsed
8
+ */
9
+ export const sortableItemLabel = (item) => {
10
+ var _a;
11
+ const { itemLabel } = item;
12
+ if (itemLabel)
13
+ return itemLabel;
14
+ // Only the first text-bearing child, not every one of them joined: a row with a status chip or
15
+ // an actions menu outside the `sortable-item-actions` slot would otherwise read that text into
16
+ // the name too (e.g. "Reorder Newsletter Default Edit Archive Duplicate"). The main content is
17
+ // conventionally the first child, so this still gets a real multi-line label (the first child
18
+ // can itself wrap several lines of text) without pulling in siblings meant to be set dressing.
19
+ for (const node of Array.from(item.childNodes)) {
20
+ // Comments (such as a server's template annotations) and script, style and template contents
21
+ // aren't part of the name.
22
+ if (node.nodeType === ELEMENT_NODE &&
23
+ node.matches('.pds-sortable-item__handle, .pds-sortable-item__actions, [slot="sortable-item-actions"], script, style, template')) {
24
+ continue;
25
+ }
26
+ if (node.nodeType !== TEXT_NODE && node.nodeType !== ELEMENT_NODE)
27
+ continue;
28
+ const text = ((_a = node.textContent) !== null && _a !== void 0 ? _a : '').replace(/\s+/g, ' ').trim();
29
+ if (text)
30
+ return text;
31
+ }
32
+ return '';
33
+ };
@@ -75,6 +75,21 @@ const FullDemoTemplate = (args) => html`
75
75
  </pds-sortable-item>
76
76
  </pds-sortable>`;
77
77
 
78
+ const LocalizedTemplate = (args) => html`
79
+ <pds-sortable
80
+ component-id="${args.componentId}"
81
+ handle-type="${args.handleType}"
82
+ handle-label="${args.handleLabel}"
83
+ item-picked-up-label="${args.itemPickedUpLabel}"
84
+ item-moved-label="${args.itemMovedLabel}"
85
+ item-dropped-label="${args.itemDroppedLabel}"
86
+ reorder-canceled-label="${args.reorderCanceledLabel}"
87
+ >
88
+ <pds-sortable-item item-label="Introduction">Introduction · 3 leçons</pds-sortable-item>
89
+ <pds-sortable-item item-label="Module 1">Module 1 · 5 leçons</pds-sortable-item>
90
+ <pds-sortable-item item-label="Module 2">Module 2 · 4 leçons</pds-sortable-item>
91
+ </pds-sortable>`;
92
+
78
93
  export const Default = BaseTemplate.bind();
79
94
  Default.args = {
80
95
  componentId: 'default',
@@ -137,3 +152,15 @@ FullDemo.args = {
137
152
  dividers: true,
138
153
  handleType: 'row',
139
154
  };
155
+
156
+ export const Localized = LocalizedTemplate.bind();
157
+ Localized.args = {
158
+ componentId: 'localized',
159
+ handleType: 'handle',
160
+ handleLabel: 'Réorganiser {item}',
161
+ itemPickedUpLabel:
162
+ '{item} sélectionné. Position {position} sur {total}. Utilisez les flèches pour déplacer, Espace ou Entrée pour déposer, Échap pour annuler.',
163
+ itemMovedLabel: '{item} déplacé en position {position} sur {total}',
164
+ itemDroppedLabel: '{item} déposé en position {position} sur {total}',
165
+ reorderCanceledLabel: 'Réorganisation annulée. {item} revenu en position {position} sur {total}',
166
+ };