@pine-ds/core 3.13.0 → 3.14.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 (253) hide show
  1. package/components/mock-pds-modal.js.map +1 -1
  2. package/components/pds-avatar.js +18 -5
  3. package/components/pds-avatar.js.map +1 -1
  4. package/components/pds-button2.js.map +1 -1
  5. package/components/pds-checkbox2.js.map +1 -1
  6. package/components/pds-chip2.js.map +1 -1
  7. package/components/pds-combobox.js +1 -1
  8. package/components/pds-combobox.js.map +1 -1
  9. package/components/pds-dropdown-menu-item.js +1 -1
  10. package/components/pds-dropdown-menu-item.js.map +1 -1
  11. package/components/pds-filter.js +1 -1
  12. package/components/pds-filter.js.map +1 -1
  13. package/components/pds-input.js +6 -2
  14. package/components/pds-input.js.map +1 -1
  15. package/components/pds-modal.js.map +1 -1
  16. package/components/pds-radio.js.map +1 -1
  17. package/components/pds-select.js +14 -2
  18. package/components/pds-select.js.map +1 -1
  19. package/components/pds-table-cell2.js.map +1 -1
  20. package/components/pds-table-head-cell2.js +15 -3
  21. package/components/pds-table-head-cell2.js.map +1 -1
  22. package/components/pds-table.js +44 -3
  23. package/components/pds-table.js.map +1 -1
  24. package/components/pds-textarea.js +8 -4
  25. package/components/pds-textarea.js.map +1 -1
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/cjs/mock-pds-modal.entry.cjs.js.map +1 -1
  28. package/dist/cjs/pds-avatar.cjs.entry.js +17 -5
  29. package/dist/cjs/pds-avatar.entry.cjs.js.map +1 -1
  30. package/dist/cjs/pds-button.entry.cjs.js.map +1 -1
  31. package/dist/cjs/pds-checkbox.entry.cjs.js.map +1 -1
  32. package/dist/cjs/pds-chip.entry.cjs.js.map +1 -1
  33. package/dist/cjs/pds-combobox.cjs.entry.js +1 -1
  34. package/dist/cjs/pds-combobox.entry.cjs.js.map +1 -1
  35. package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +1 -1
  36. package/dist/cjs/pds-dropdown-menu-item.entry.cjs.js.map +1 -1
  37. package/dist/cjs/pds-filter.cjs.entry.js +1 -1
  38. package/dist/cjs/pds-filter.entry.cjs.js.map +1 -1
  39. package/dist/cjs/pds-input.cjs.entry.js +6 -2
  40. package/dist/cjs/pds-input.entry.cjs.js.map +1 -1
  41. package/dist/cjs/pds-modal.entry.cjs.js.map +1 -1
  42. package/dist/cjs/pds-radio.entry.cjs.js.map +1 -1
  43. package/dist/cjs/pds-select.cjs.entry.js +14 -2
  44. package/dist/cjs/pds-select.entry.cjs.js.map +1 -1
  45. package/dist/cjs/pds-table-cell.entry.cjs.js.map +1 -1
  46. package/dist/cjs/pds-table-head-cell.cjs.entry.js +13 -2
  47. package/dist/cjs/pds-table-head-cell.entry.cjs.js.map +1 -1
  48. package/dist/cjs/pds-table.cjs.entry.js +42 -3
  49. package/dist/cjs/pds-table.entry.cjs.js.map +1 -1
  50. package/dist/cjs/pds-textarea.cjs.entry.js +8 -4
  51. package/dist/cjs/pds-textarea.entry.cjs.js.map +1 -1
  52. package/dist/cjs/pine-core.cjs.js +1 -1
  53. package/dist/collection/components/pds-avatar/pds-avatar.css +14 -1
  54. package/dist/collection/components/pds-avatar/pds-avatar.js +39 -4
  55. package/dist/collection/components/pds-avatar/pds-avatar.js.map +1 -1
  56. package/dist/collection/components/pds-avatar/stories/pds-avatar.stories.js +15 -0
  57. package/dist/collection/components/pds-button/pds-button.css +3 -0
  58. package/dist/collection/components/pds-checkbox/pds-checkbox.css +2 -0
  59. package/dist/collection/components/pds-chip/pds-chip.css +7 -0
  60. package/dist/collection/components/pds-combobox/pds-combobox.css +6 -1
  61. package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +4 -3
  62. package/dist/collection/components/pds-filters/pds-filter/pds-filter.css +1 -1
  63. package/dist/collection/components/pds-input/pds-input.css +2 -2
  64. package/dist/collection/components/pds-input/pds-input.js +24 -1
  65. package/dist/collection/components/pds-input/pds-input.js.map +1 -1
  66. package/dist/collection/components/pds-modal/pds-modal.css +1 -0
  67. package/dist/collection/components/pds-radio/pds-radio.css +1 -0
  68. package/dist/collection/components/pds-select/pds-select.css +2 -2
  69. package/dist/collection/components/pds-select/pds-select.js +71 -2
  70. package/dist/collection/components/pds-select/pds-select.js.map +1 -1
  71. package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.css +1 -0
  72. package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.css +1 -0
  73. package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +41 -2
  74. package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js.map +1 -1
  75. package/dist/collection/components/pds-table/pds-table.css +2 -0
  76. package/dist/collection/components/pds-table/pds-table.js +84 -3
  77. package/dist/collection/components/pds-table/pds-table.js.map +1 -1
  78. package/dist/collection/components/pds-table/stories/pds-table.stories.js +77 -0
  79. package/dist/collection/components/pds-textarea/pds-textarea.js +27 -4
  80. package/dist/collection/components/pds-textarea/pds-textarea.js.map +1 -1
  81. package/dist/docs.json +224 -3
  82. package/dist/esm/loader.js +1 -1
  83. package/dist/esm/mock-pds-modal.entry.js.map +1 -1
  84. package/dist/esm/pds-avatar.entry.js +17 -5
  85. package/dist/esm/pds-avatar.entry.js.map +1 -1
  86. package/dist/esm/pds-button.entry.js.map +1 -1
  87. package/dist/esm/pds-checkbox.entry.js.map +1 -1
  88. package/dist/esm/pds-chip.entry.js.map +1 -1
  89. package/dist/esm/pds-combobox.entry.js +1 -1
  90. package/dist/esm/pds-combobox.entry.js.map +1 -1
  91. package/dist/esm/pds-dropdown-menu-item.entry.js +1 -1
  92. package/dist/esm/pds-dropdown-menu-item.entry.js.map +1 -1
  93. package/dist/esm/pds-filter.entry.js +1 -1
  94. package/dist/esm/pds-filter.entry.js.map +1 -1
  95. package/dist/esm/pds-input.entry.js +6 -2
  96. package/dist/esm/pds-input.entry.js.map +1 -1
  97. package/dist/esm/pds-modal.entry.js.map +1 -1
  98. package/dist/esm/pds-radio.entry.js.map +1 -1
  99. package/dist/esm/pds-select.entry.js +14 -2
  100. package/dist/esm/pds-select.entry.js.map +1 -1
  101. package/dist/esm/pds-table-cell.entry.js.map +1 -1
  102. package/dist/esm/pds-table-head-cell.entry.js +13 -2
  103. package/dist/esm/pds-table-head-cell.entry.js.map +1 -1
  104. package/dist/esm/pds-table.entry.js +42 -3
  105. package/dist/esm/pds-table.entry.js.map +1 -1
  106. package/dist/esm/pds-textarea.entry.js +8 -4
  107. package/dist/esm/pds-textarea.entry.js.map +1 -1
  108. package/dist/esm/pine-core.js +1 -1
  109. package/dist/esm-es5/loader.js +1 -1
  110. package/dist/esm-es5/mock-pds-modal.entry.js.map +1 -1
  111. package/dist/esm-es5/pds-avatar.entry.js +1 -1
  112. package/dist/esm-es5/pds-avatar.entry.js.map +1 -1
  113. package/dist/esm-es5/pds-button.entry.js.map +1 -1
  114. package/dist/esm-es5/pds-checkbox.entry.js.map +1 -1
  115. package/dist/esm-es5/pds-chip.entry.js.map +1 -1
  116. package/dist/esm-es5/pds-combobox.entry.js +1 -1
  117. package/dist/esm-es5/pds-combobox.entry.js.map +1 -1
  118. package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -1
  119. package/dist/esm-es5/pds-dropdown-menu-item.entry.js.map +1 -1
  120. package/dist/esm-es5/pds-filter.entry.js +1 -1
  121. package/dist/esm-es5/pds-filter.entry.js.map +1 -1
  122. package/dist/esm-es5/pds-input.entry.js +1 -1
  123. package/dist/esm-es5/pds-input.entry.js.map +1 -1
  124. package/dist/esm-es5/pds-modal.entry.js.map +1 -1
  125. package/dist/esm-es5/pds-radio.entry.js.map +1 -1
  126. package/dist/esm-es5/pds-select.entry.js +1 -1
  127. package/dist/esm-es5/pds-select.entry.js.map +1 -1
  128. package/dist/esm-es5/pds-table-cell.entry.js.map +1 -1
  129. package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
  130. package/dist/esm-es5/pds-table-head-cell.entry.js.map +1 -1
  131. package/dist/esm-es5/pds-table.entry.js +1 -1
  132. package/dist/esm-es5/pds-table.entry.js.map +1 -1
  133. package/dist/esm-es5/pds-textarea.entry.js +1 -1
  134. package/dist/esm-es5/pds-textarea.entry.js.map +1 -1
  135. package/dist/esm-es5/pine-core.js +1 -1
  136. package/dist/pine-core/mock-pds-modal.entry.esm.js.map +1 -1
  137. package/dist/pine-core/p--gPqixhD.system.js.map +1 -1
  138. package/dist/pine-core/p-002fe322.system.entry.js +2 -0
  139. package/dist/pine-core/p-002fe322.system.entry.js.map +1 -0
  140. package/dist/pine-core/{p-131a8cff.system.entry.js → p-098cbcd7.system.entry.js} +2 -2
  141. package/dist/pine-core/p-098cbcd7.system.entry.js.map +1 -0
  142. package/dist/pine-core/p-478d1107.entry.js +2 -0
  143. package/dist/pine-core/{p-41cc9270.entry.js.map → p-478d1107.entry.js.map} +1 -1
  144. package/dist/pine-core/p-4SEjggIC.system.js.map +1 -0
  145. package/dist/pine-core/p-4d25449c.entry.js +2 -0
  146. package/dist/pine-core/p-4d25449c.entry.js.map +1 -0
  147. package/dist/pine-core/p-534e44cb.system.entry.js +4 -0
  148. package/dist/pine-core/{p-bee8d4b8.system.entry.js.map → p-534e44cb.system.entry.js.map} +1 -1
  149. package/dist/pine-core/p-54a56826.entry.js +3 -0
  150. package/dist/pine-core/{p-66160018.entry.js.map → p-54a56826.entry.js.map} +1 -1
  151. package/dist/pine-core/p-646ac76d.entry.js +2 -0
  152. package/dist/pine-core/p-646ac76d.entry.js.map +1 -0
  153. package/dist/pine-core/p-6bc7d67f.system.entry.js +2 -0
  154. package/dist/pine-core/{p-c03e2c5d.system.entry.js.map → p-6bc7d67f.system.entry.js.map} +1 -1
  155. package/dist/pine-core/p-9c0ec80a.entry.js +2 -0
  156. package/dist/pine-core/p-9c0ec80a.entry.js.map +1 -0
  157. package/dist/pine-core/p-9e62c418.system.entry.js +2 -0
  158. package/dist/pine-core/p-9e62c418.system.entry.js.map +1 -0
  159. package/dist/pine-core/p-B4EMeCRH.system.js.map +1 -0
  160. package/dist/pine-core/p-BCKPcTKX.system.js.map +1 -1
  161. package/dist/pine-core/p-Bjj4Pcbb.system.js.map +1 -0
  162. package/dist/pine-core/p-Bnp3zJ0T.system.js.map +1 -0
  163. package/dist/pine-core/p-C48G0LPH.system.js.map +1 -1
  164. package/dist/pine-core/p-CCgKUhC7.system.js.map +1 -0
  165. package/dist/pine-core/p-CTfQ_9yC.system.js.map +1 -1
  166. package/dist/pine-core/p-CXGuX44q.system.js.map +1 -1
  167. package/dist/pine-core/p-DSwKfctG.system.js.map +1 -0
  168. package/dist/pine-core/p-DfCCzxYg.system.js.map +1 -0
  169. package/dist/pine-core/p-DpeOrUYB.system.js.map +1 -1
  170. package/dist/pine-core/p-JAVnELnm.system.js +1 -1
  171. package/dist/pine-core/p-PMNjgK0C.system.js.map +1 -0
  172. package/dist/pine-core/p-WhfStK1C.system.js.map +1 -1
  173. package/dist/pine-core/p-XCTiWii8.system.js.map +1 -0
  174. package/dist/pine-core/p-a847fad3.entry.js +2 -0
  175. package/dist/pine-core/p-a847fad3.entry.js.map +1 -0
  176. package/dist/pine-core/p-ac2f9463.entry.js +2 -0
  177. package/dist/pine-core/p-ac2f9463.entry.js.map +1 -0
  178. package/dist/pine-core/p-d98310b9.system.entry.js +2 -0
  179. package/dist/pine-core/p-d98310b9.system.entry.js.map +1 -0
  180. package/dist/pine-core/{p-b8047816.system.entry.js → p-dcc6ad67.system.entry.js} +2 -2
  181. package/dist/pine-core/{p-b8047816.system.entry.js.map → p-dcc6ad67.system.entry.js.map} +1 -1
  182. package/dist/pine-core/p-e011d7e5.entry.js +2 -0
  183. package/dist/pine-core/p-e011d7e5.entry.js.map +1 -0
  184. package/dist/pine-core/p-e3d76aa3.system.entry.js +2 -0
  185. package/dist/pine-core/p-e3d76aa3.system.entry.js.map +1 -0
  186. package/dist/pine-core/p-f82b464c.entry.js +2 -0
  187. package/dist/pine-core/{p-4c0797f2.entry.js.map → p-f82b464c.entry.js.map} +1 -1
  188. package/dist/pine-core/p-fe28b975.system.entry.js +2 -0
  189. package/dist/pine-core/p-fe28b975.system.entry.js.map +1 -0
  190. package/dist/pine-core/pds-avatar.entry.esm.js.map +1 -1
  191. package/dist/pine-core/pds-button.entry.esm.js.map +1 -1
  192. package/dist/pine-core/pds-checkbox.entry.esm.js.map +1 -1
  193. package/dist/pine-core/pds-chip.entry.esm.js.map +1 -1
  194. package/dist/pine-core/pds-combobox.entry.esm.js.map +1 -1
  195. package/dist/pine-core/pds-dropdown-menu-item.entry.esm.js.map +1 -1
  196. package/dist/pine-core/pds-filter.entry.esm.js.map +1 -1
  197. package/dist/pine-core/pds-input.entry.esm.js.map +1 -1
  198. package/dist/pine-core/pds-modal.entry.esm.js.map +1 -1
  199. package/dist/pine-core/pds-radio.entry.esm.js.map +1 -1
  200. package/dist/pine-core/pds-select.entry.esm.js.map +1 -1
  201. package/dist/pine-core/pds-table-cell.entry.esm.js.map +1 -1
  202. package/dist/pine-core/pds-table-head-cell.entry.esm.js.map +1 -1
  203. package/dist/pine-core/pds-table.entry.esm.js.map +1 -1
  204. package/dist/pine-core/pds-textarea.entry.esm.js.map +1 -1
  205. package/dist/pine-core/pine-core.esm.js +1 -1
  206. package/dist/types/components/pds-avatar/pds-avatar.d.ts +5 -0
  207. package/dist/types/components/pds-input/pds-input.d.ts +5 -0
  208. package/dist/types/components/pds-select/pds-select.d.ts +16 -1
  209. package/dist/types/components/pds-table/pds-table-head-cell/pds-table-head-cell.d.ts +6 -0
  210. package/dist/types/components/pds-table/pds-table.d.ts +17 -1
  211. package/dist/types/components/pds-textarea/pds-textarea.d.ts +5 -0
  212. package/dist/types/components.d.ts +59 -1
  213. package/dist/vscode.html-data.json +34 -5
  214. package/hydrate/index.js +108 -22
  215. package/hydrate/index.mjs +108 -22
  216. package/package.json +5 -5
  217. package/dist/pine-core/p-0c84a3f4.entry.js +0 -2
  218. package/dist/pine-core/p-0c84a3f4.entry.js.map +0 -1
  219. package/dist/pine-core/p-0fdffed5.entry.js +0 -2
  220. package/dist/pine-core/p-0fdffed5.entry.js.map +0 -1
  221. package/dist/pine-core/p-1282026f.entry.js +0 -2
  222. package/dist/pine-core/p-1282026f.entry.js.map +0 -1
  223. package/dist/pine-core/p-131a8cff.system.entry.js.map +0 -1
  224. package/dist/pine-core/p-198abda7.system.entry.js +0 -2
  225. package/dist/pine-core/p-198abda7.system.entry.js.map +0 -1
  226. package/dist/pine-core/p-20f255e6.entry.js +0 -2
  227. package/dist/pine-core/p-20f255e6.entry.js.map +0 -1
  228. package/dist/pine-core/p-41cc9270.entry.js +0 -2
  229. package/dist/pine-core/p-49c1eab0.entry.js +0 -2
  230. package/dist/pine-core/p-49c1eab0.entry.js.map +0 -1
  231. package/dist/pine-core/p-4c0797f2.entry.js +0 -2
  232. package/dist/pine-core/p-54a02bb5.system.entry.js +0 -2
  233. package/dist/pine-core/p-54a02bb5.system.entry.js.map +0 -1
  234. package/dist/pine-core/p-66160018.entry.js +0 -3
  235. package/dist/pine-core/p-98824683.entry.js +0 -2
  236. package/dist/pine-core/p-98824683.entry.js.map +0 -1
  237. package/dist/pine-core/p-BOn7G6db.system.js.map +0 -1
  238. package/dist/pine-core/p-CTjTtD1R.system.js.map +0 -1
  239. package/dist/pine-core/p-Ch7MRoFE.system.js.map +0 -1
  240. package/dist/pine-core/p-DQawTYre.system.js.map +0 -1
  241. package/dist/pine-core/p-DQs506y8.system.js.map +0 -1
  242. package/dist/pine-core/p-RO-Y2DRT.system.js.map +0 -1
  243. package/dist/pine-core/p-bee8d4b8.system.entry.js +0 -4
  244. package/dist/pine-core/p-c03e2c5d.system.entry.js +0 -2
  245. package/dist/pine-core/p-c2d17093.system.entry.js +0 -2
  246. package/dist/pine-core/p-c2d17093.system.entry.js.map +0 -1
  247. package/dist/pine-core/p-e3d81bee.system.entry.js +0 -2
  248. package/dist/pine-core/p-e3d81bee.system.entry.js.map +0 -1
  249. package/dist/pine-core/p-e846b67f.system.entry.js +0 -2
  250. package/dist/pine-core/p-e846b67f.system.entry.js.map +0 -1
  251. package/dist/pine-core/p-pw5cGGlu.system.js.map +0 -1
  252. package/dist/pine-core/p-qkIMFuAW.system.js.map +0 -1
  253. package/dist/pine-core/p-uv97KtT8.system.js.map +0 -1
@@ -56,6 +56,17 @@ export class PdsTableHeadCell {
56
56
  }
57
57
  };
58
58
  }
59
+ /**
60
+ * Programmatically sets this column as the active sort column with the specified direction.
61
+ * Used by pds-table to apply a default sort on initial load.
62
+ * @param direction - The sort direction to apply ('asc' or 'desc')
63
+ */
64
+ async setActiveSort(direction) {
65
+ if (!this.sortable)
66
+ return;
67
+ this.sortingDirection = direction;
68
+ this.hostElement.classList.add('is-active');
69
+ }
59
70
  componentWillLoad() {
60
71
  // Set initial references and state before first render
61
72
  this.tableRef = this.hostElement.closest('pds-table');
@@ -160,11 +171,11 @@ export class PdsTableHeadCell {
160
171
  return classNames.join(' ');
161
172
  }
162
173
  render() {
163
- return (h(Host, { key: '7e7976ee53daac21144a0a572e5ed7787bcc33b7', class: this.classNames(), role: "columnheader", onClick: this.toggleSort, part: "head-cell", style: this.tableRef &&
174
+ return (h(Host, { key: '18228c7b1950668f12f983d9e5364bbf2deb3f1a', class: this.classNames(), role: "columnheader", onClick: this.toggleSort, part: "head-cell", style: this.tableRef &&
164
175
  this.tableRef.fixedColumn &&
165
176
  this.tableRef.selectable
166
177
  ? { '--fixed-cell-position': '40px' }
167
- : {} }, h("slot", { key: 'e5ea1d7684f1ff15da069765dbc19a3167c6dd20' }), this.sortable && (h("pds-icon", { key: '3404301d664b6604a3d7f8b6ae4a460cf2c9deb3', icon: this.sortingDirection === 'asc' ? upSmall : downSmall, part: "sort-icon" }))));
178
+ : {} }, h("slot", { key: '283f5e031cc8fe521c25af8060ce51c3ebaffa93' }), this.sortable && (h("pds-icon", { key: 'a7e172c6fbf1185ab9885af04bcf2f2449370e6b', icon: this.sortingDirection === 'asc' ? upSmall : downSmall, part: "sort-icon" }))));
168
179
  }
169
180
  static get is() { return "pds-table-head-cell"; }
170
181
  static get encapsulation() { return "shadow"; }
@@ -247,6 +258,34 @@ export class PdsTableHeadCell {
247
258
  }
248
259
  }];
249
260
  }
261
+ static get methods() {
262
+ return {
263
+ "setActiveSort": {
264
+ "complexType": {
265
+ "signature": "(direction: \"asc\" | \"desc\") => Promise<void>",
266
+ "parameters": [{
267
+ "name": "direction",
268
+ "type": "\"desc\" | \"asc\"",
269
+ "docs": "- The sort direction to apply ('asc' or 'desc')"
270
+ }],
271
+ "references": {
272
+ "Promise": {
273
+ "location": "global",
274
+ "id": "global::Promise"
275
+ }
276
+ },
277
+ "return": "Promise<void>"
278
+ },
279
+ "docs": {
280
+ "text": "Programmatically sets this column as the active sort column with the specified direction.\nUsed by pds-table to apply a default sort on initial load.",
281
+ "tags": [{
282
+ "name": "param",
283
+ "text": "direction - The sort direction to apply ('asc' or 'desc')"
284
+ }]
285
+ }
286
+ }
287
+ };
288
+ }
250
289
  static get elementRef() { return "hostElement"; }
251
290
  }
252
291
  //# sourceMappingURL=pds-table-head-cell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pds-table-head-cell.js","sourceRoot":"","sources":["../../../../../src/components/pds-table/pds-table-head-cell/pds-table-head-cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,OAAO,gBAAgB;IAL7B;QAQU,oBAAe,GAAuB,IAAI,CAAC;QAE3C,iBAAY,GAAW,CAAC,CAAC;QAkBjC;;WAEG;QACc,qBAAgB,GAAmB,KAAK,CAAC;QAE1D;;;WAGG;QACc,mBAAc,GAAY,KAAK,CAAC;QAEjD;;;WAGG;QACM,eAAU,GAAY,KAAK,CAAC;QAErC;;;WAGG;QACc,kBAAa,GAAY,KAAK,CAAC;QAEhD;;;W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iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDACH,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EACxB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,IAAI,CAAC,UAAU,EACxB,IAAI,EAAC,WAAW,EAChB,KAAK,EACH,IAAI,CAAC,QAAQ;gBACb,IAAI,CAAC,QAAQ,CAAC,WAAW;gBACzB,IAAI,CAAC,QAAQ,CAAC,UAAU;gBACtB,CAAC,CAAC,EAAE,uBAAuB,EAAE,MAAM,EAAE;gBACrC,CAAC,CAAC,EAAE;YAGR,8DAAa;YACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,iEAAU,IAAI,EAAE,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAC,WAAW,GAAG,CAC3F,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Prop, h, Event, EventEmitter, State } from '@stencil/core';\n\nimport { downSmall, upSmall } from '@pine-ds/icons/icons';\n\n@Component({\n tag: 'pds-table-head-cell',\n styleUrls: ['pds-table-head-cell.scss'],\n shadow: true,\n})\nexport class PdsTableHeadCell {\n @Element() hostElement: HTMLPdsTableHeadCellElement;\n private tableRef: HTMLPdsTableElement;\n private scrollContainer: HTMLElement | null = null;\n private setupTimer: number | undefined;\n private setupRetries: number = 0;\n private headObserver?: MutationObserver;\n\n /**\n * Sets the text alignment within the head cell.\n */\n @Prop() cellAlign?: 'start' | 'center' | 'end' | 'justify';\n\n /**\n * Determines whether the table column is sortable when set to `true`.\n */\n @Prop() sortable: boolean;\n\n /**\n * Event emitted to signal that a table column header has been sorted, providing information about the sorted column's name and sorting direction.\n */\n @Event() pdsTableSort: EventEmitter<{ column: string; direction: string }>;\n\n /**\n * The direction of sorting.\n */\n @State() private sortingDirection: 'asc' | 'desc' = 'asc';\n\n /**\n * Determines if the table is currently scrolling.\n * @defaultValue false\n */\n @State() private tableScrolling: boolean = false;\n\n /**\n * Determines if the table row is currently selected.\n * @defaultValue false\n */\n @State() isSelected: boolean = false;\n\n /**\n * Determines if the parent table-head has the border attribute.\n * @defaultValue false\n */\n @State() private hasHeadBorder: boolean = false;\n\n /**\n * Determines if the parent table-head has the background attribute.\n * @defaultValue false\n */\n @State() private hasHeadBackground: boolean = false;\n\n componentWillLoad() {\n // Set initial references and state before first render\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n\n const tableHead = this.hostElement.closest('pds-table-head') as HTMLElement;\n if (tableHead) {\n this.hasHeadBorder = tableHead.hasAttribute('border');\n this.hasHeadBackground = tableHead.hasAttribute('background');\n }\n }\n\n componentDidLoad() {\n if (this.tableRef && this.tableRef.responsive && this.tableRef.fixedColumn) {\n // For responsive tables with fixed columns, set up scroll detection\n // This enables the first column header to show a shadow when the table is scrolled horizontally\n this.setupScrollListener();\n }\n\n // Watch for changes to the parent table-head's border and background attributes\n const tableHead = this.hostElement.closest('pds-table-head') as HTMLElement;\n if (tableHead && typeof MutationObserver !== 'undefined') {\n // Defensive guard: disconnect existing observer before creating a new one\n if (this.headObserver) {\n this.headObserver.disconnect();\n }\n\n this.headObserver = new MutationObserver(() => {\n // Update state when border or background attributes change\n this.hasHeadBorder = tableHead.hasAttribute('border');\n this.hasHeadBackground = tableHead.hasAttribute('background');\n });\n\n this.headObserver.observe(tableHead, {\n attributes: true,\n attributeFilter: ['border', 'background']\n });\n }\n }\n\n disconnectedCallback() {\n this.cleanupScrollListener();\n\n if (this.headObserver) {\n this.headObserver.disconnect();\n }\n }\n\n\n private setupScrollListener() {\n if (!this.tableRef) return;\n\n // Query shadowRoot once and cache the container\n const container = this.tableRef.shadowRoot?.querySelector('.pds-table-responsive-container') as HTMLElement;\n\n if (container) {\n // Container available immediately\n this.scrollContainer = container;\n this.scrollContainer.addEventListener('scroll', this.handleScroll, { passive: true });\n this.handleScroll(); // Initial check\n this.setupRetries = 0; // Reset counter on success\n } else {\n // Container not ready, set up timer for retry with bounds\n this.setupTimer = window.setTimeout(() => {\n if (this.scrollContainer) return; // Already found\n this.setupRetries = (this.setupRetries || 0) + 1;\n if (this.setupRetries <= 50) {\n this.setupScrollListener();\n } else {\n console.warn('Failed to find responsive container after 50 attempts');\n }\n }, 100);\n }\n }\n\n private cleanupScrollListener() {\n if (this.scrollContainer) {\n this.scrollContainer.removeEventListener('scroll', this.handleScroll);\n this.scrollContainer = null;\n }\n\n if (this.setupTimer !== undefined) {\n window.clearTimeout(this.setupTimer);\n this.setupTimer = undefined;\n }\n\n this.setupRetries = 0; // Reset retry counter\n }\n\n /**\n * Handles scroll events to update fixed column shadow state.\n * Updates the tableScrolling state to control CSS classes for fixed column shadows.\n * @private\n */\n private handleScroll = () => {\n if (!this.scrollContainer) {\n return;\n }\n\n try {\n this.tableScrolling = this.scrollContainer.scrollLeft > 0;\n } catch (error) {\n console.warn('Scroll handler error:', error);\n }\n };\n\n private toggleSort = () => {\n if (this.sortable) {\n const column = this.hostElement.innerText.trim();\n this.sortingDirection = this.sortingDirection === 'asc' ? 'desc' : 'asc';\n\n this.tableRef.querySelectorAll('pds-table-head-cell').forEach((headCell) => {\n headCell.classList.remove('is-active');\n });\n\n this.hostElement.classList.toggle('is-active');\n this.pdsTableSort.emit({ column, direction: this.sortingDirection });\n }\n }\n\n private classNames() {\n const classNames = [];\n\n if (this.tableRef && this.tableRef.compact) {\n classNames.push('is-compact');\n }\n\n if (this.cellAlign) {\n classNames.push(`pds-table-head-cell--align-${this.cellAlign}`);\n }\n\n if (this.sortable) {\n classNames.push('is-sortable');\n }\n\n if (this.sortable && this.sortingDirection !== null) {\n classNames.push('sort-' + this.sortingDirection);\n }\n\n if (this.tableRef && this.tableRef.fixedColumn && this.tableScrolling) {\n classNames.push('has-scrolled');\n }\n\n if (this.hasHeadBackground) {\n classNames.push('has-head-background');\n }\n\n if (this.hasHeadBorder) {\n classNames.push('has-head-border');\n }\n\n return classNames.join(' ');\n }\n\n render() {\n return (\n <Host\n class={this.classNames()}\n role=\"columnheader\"\n onClick={this.toggleSort}\n part=\"head-cell\"\n style={\n this.tableRef &&\n this.tableRef.fixedColumn &&\n this.tableRef.selectable\n ? { '--fixed-cell-position': '40px' }\n : {}\n }\n >\n <slot></slot>\n {this.sortable && (\n <pds-icon icon={this.sortingDirection === 'asc' ? upSmall : downSmall} part=\"sort-icon\" />\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pds-table-head-cell.js","sourceRoot":"","sources":["../../../../../src/components/pds-table/pds-table-head-cell/pds-table-head-cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,OAAO,gBAAgB;IAL7B;QAQU,oBAAe,GAAuB,IAAI,CAAC;QAE3C,iBAAY,GAAW,CAAC,CAAC;QAkBjC;;WAEG;QACc,qBAAgB,GAAmB,KAAK,CAAC;QAE1D;;;WAGG;QACc,mBAAc,GAAY,KAAK,CAAC;QAEjD;;;WAGG;QACM,eAAU,GAAY,KAAK,CAAC;QAErC;;;WAGG;QACc,kBAAa,GAAY,KAAK,CAAC;QAEhD;;;WAGG;QACc,sBAAiB,GAAY,KAAK,CAAC;QAuGpD;;;;WAIG;QACK,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC1B,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,IA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,aAAa,EAAE,CAAC;YACvB,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDACH,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EACxB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,IAAI,CAAC,UAAU,EACxB,IAAI,EAAC,WAAW,EAChB,KAAK,EACH,IAAI,CAAC,QAAQ;gBACb,IAAI,CAAC,QAAQ,CAAC,WAAW;gBACzB,IAAI,CAAC,QAAQ,CAAC,UAAU;gBACtB,CAAC,CAAC,EAAE,uBAAuB,EAAE,MAAM,EAAE;gBACrC,CAAC,CAAC,EAAE;YAGR,8DAAa;YACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,iEAAU,IAAI,EAAE,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAC,WAAW,GAAG,CAC3F,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Prop, h, Event, EventEmitter, State, Method } from '@stencil/core';\n\nimport { downSmall, upSmall } from '@pine-ds/icons/icons';\n\n@Component({\n tag: 'pds-table-head-cell',\n styleUrls: ['pds-table-head-cell.scss'],\n shadow: true,\n})\nexport class PdsTableHeadCell {\n @Element() hostElement: HTMLPdsTableHeadCellElement;\n private tableRef: HTMLPdsTableElement;\n private scrollContainer: HTMLElement | null = null;\n private setupTimer: number | undefined;\n private setupRetries: number = 0;\n private headObserver?: MutationObserver;\n\n /**\n * Sets the text alignment within the head cell.\n */\n @Prop() cellAlign?: 'start' | 'center' | 'end' | 'justify';\n\n /**\n * Determines whether the table column is sortable when set to `true`.\n */\n @Prop() sortable: boolean;\n\n /**\n * Event emitted to signal that a table column header has been sorted, providing information about the sorted column's name and sorting direction.\n */\n @Event() pdsTableSort: EventEmitter<{ column: string; direction: string }>;\n\n /**\n * The direction of sorting.\n */\n @State() private sortingDirection: 'asc' | 'desc' = 'asc';\n\n /**\n * Determines if the table is currently scrolling.\n * @defaultValue false\n */\n @State() private tableScrolling: boolean = false;\n\n /**\n * Determines if the table row is currently selected.\n * @defaultValue false\n */\n @State() isSelected: boolean = false;\n\n /**\n * Determines if the parent table-head has the border attribute.\n * @defaultValue false\n */\n @State() private hasHeadBorder: boolean = false;\n\n /**\n * Determines if the parent table-head has the background attribute.\n * @defaultValue false\n */\n @State() private hasHeadBackground: boolean = false;\n\n /**\n * Programmatically sets this column as the active sort column with the specified direction.\n * Used by pds-table to apply a default sort on initial load.\n * @param direction - The sort direction to apply ('asc' or 'desc')\n */\n @Method()\n async setActiveSort(direction: 'asc' | 'desc') {\n if (!this.sortable) return;\n\n this.sortingDirection = direction;\n this.hostElement.classList.add('is-active');\n }\n\n componentWillLoad() {\n // Set initial references and state before first render\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n\n const tableHead = this.hostElement.closest('pds-table-head') as HTMLElement;\n if (tableHead) {\n this.hasHeadBorder = tableHead.hasAttribute('border');\n this.hasHeadBackground = tableHead.hasAttribute('background');\n }\n }\n\n componentDidLoad() {\n if (this.tableRef && this.tableRef.responsive && this.tableRef.fixedColumn) {\n // For responsive tables with fixed columns, set up scroll detection\n // This enables the first column header to show a shadow when the table is scrolled horizontally\n this.setupScrollListener();\n }\n\n // Watch for changes to the parent table-head's border and background attributes\n const tableHead = this.hostElement.closest('pds-table-head') as HTMLElement;\n if (tableHead && typeof MutationObserver !== 'undefined') {\n // Defensive guard: disconnect existing observer before creating a new one\n if (this.headObserver) {\n this.headObserver.disconnect();\n }\n\n this.headObserver = new MutationObserver(() => {\n // Update state when border or background attributes change\n this.hasHeadBorder = tableHead.hasAttribute('border');\n this.hasHeadBackground = tableHead.hasAttribute('background');\n });\n\n this.headObserver.observe(tableHead, {\n attributes: true,\n attributeFilter: ['border', 'background']\n });\n }\n }\n\n disconnectedCallback() {\n this.cleanupScrollListener();\n\n if (this.headObserver) {\n this.headObserver.disconnect();\n }\n }\n\n\n private setupScrollListener() {\n if (!this.tableRef) return;\n\n // Query shadowRoot once and cache the container\n const container = this.tableRef.shadowRoot?.querySelector('.pds-table-responsive-container') as HTMLElement;\n\n if (container) {\n // Container available immediately\n this.scrollContainer = container;\n this.scrollContainer.addEventListener('scroll', this.handleScroll, { passive: true });\n this.handleScroll(); // Initial check\n this.setupRetries = 0; // Reset counter on success\n } else {\n // Container not ready, set up timer for retry with bounds\n this.setupTimer = window.setTimeout(() => {\n if (this.scrollContainer) return; // Already found\n this.setupRetries = (this.setupRetries || 0) + 1;\n if (this.setupRetries <= 50) {\n this.setupScrollListener();\n } else {\n console.warn('Failed to find responsive container after 50 attempts');\n }\n }, 100);\n }\n }\n\n private cleanupScrollListener() {\n if (this.scrollContainer) {\n this.scrollContainer.removeEventListener('scroll', this.handleScroll);\n this.scrollContainer = null;\n }\n\n if (this.setupTimer !== undefined) {\n window.clearTimeout(this.setupTimer);\n this.setupTimer = undefined;\n }\n\n this.setupRetries = 0; // Reset retry counter\n }\n\n /**\n * Handles scroll events to update fixed column shadow state.\n * Updates the tableScrolling state to control CSS classes for fixed column shadows.\n * @private\n */\n private handleScroll = () => {\n if (!this.scrollContainer) {\n return;\n }\n\n try {\n this.tableScrolling = this.scrollContainer.scrollLeft > 0;\n } catch (error) {\n console.warn('Scroll handler error:', error);\n }\n };\n\n private toggleSort = () => {\n if (this.sortable) {\n const column = this.hostElement.innerText.trim();\n this.sortingDirection = this.sortingDirection === 'asc' ? 'desc' : 'asc';\n\n this.tableRef.querySelectorAll('pds-table-head-cell').forEach((headCell) => {\n headCell.classList.remove('is-active');\n });\n\n this.hostElement.classList.toggle('is-active');\n this.pdsTableSort.emit({ column, direction: this.sortingDirection });\n }\n }\n\n private classNames() {\n const classNames = [];\n\n if (this.tableRef && this.tableRef.compact) {\n classNames.push('is-compact');\n }\n\n if (this.cellAlign) {\n classNames.push(`pds-table-head-cell--align-${this.cellAlign}`);\n }\n\n if (this.sortable) {\n classNames.push('is-sortable');\n }\n\n if (this.sortable && this.sortingDirection !== null) {\n classNames.push('sort-' + this.sortingDirection);\n }\n\n if (this.tableRef && this.tableRef.fixedColumn && this.tableScrolling) {\n classNames.push('has-scrolled');\n }\n\n if (this.hasHeadBackground) {\n classNames.push('has-head-background');\n }\n\n if (this.hasHeadBorder) {\n classNames.push('has-head-border');\n }\n\n return classNames.join(' ');\n }\n\n render() {\n return (\n <Host\n class={this.classNames()}\n role=\"columnheader\"\n onClick={this.toggleSort}\n part=\"head-cell\"\n style={\n this.tableRef &&\n this.tableRef.fixedColumn &&\n this.tableRef.selectable\n ? { '--fixed-cell-position': '40px' }\n : {}\n }\n >\n <slot></slot>\n {this.sortable && (\n <pds-icon icon={this.sortingDirection === 'asc' ? upSmall : downSmall} part=\"sort-icon\" />\n )}\n </Host>\n );\n }\n}\n"]}
@@ -80,6 +80,7 @@
80
80
  }
81
81
 
82
82
  .scroll-shadow-left {
83
+ /* stylelint-disable-next-line pine-design-system/no-hardcoded-colors */
83
84
  background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent);
84
85
  border-bottom-left-radius: inherit;
85
86
  border-top-left-radius: inherit;
@@ -87,6 +88,7 @@
87
88
  }
88
89
 
89
90
  .scroll-shadow-right {
91
+ /* stylelint-disable-next-line pine-design-system/no-hardcoded-colors */
90
92
  background: linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent);
91
93
  border-bottom-right-radius: inherit;
92
94
  border-top-right-radius: inherit;
@@ -11,6 +11,12 @@ export class PdsTable {
11
11
  * @defaultValue false
12
12
  */
13
13
  this.rowDividers = false;
14
+ /**
15
+ * The direction to sort the default column on initial load.
16
+ * Only applies if `defaultSortColumn` is set.
17
+ * @defaultValue 'asc'
18
+ */
19
+ this.defaultSortDirection = 'asc';
14
20
  /**
15
21
  * The name of the column being sorted.
16
22
  * @defaultValue null
@@ -22,13 +28,41 @@ export class PdsTable {
22
28
  */
23
29
  this.sortingDirection = 'asc';
24
30
  }
25
- componentWillLoad() {
26
- this.sortingColumn = null;
27
- }
28
31
  componentDidLoad() {
29
32
  if (this.responsive) {
30
33
  this.setupResponsiveScrolling();
31
34
  }
35
+ // Apply default sort if specified
36
+ if (this.defaultSortColumn) {
37
+ void this.applyDefaultSort().catch((err) => {
38
+ console.warn('Failed to apply default sort.', err);
39
+ });
40
+ }
41
+ }
42
+ /**
43
+ * Applies the default sort configuration on initial load.
44
+ * Finds the matching column header and activates its sort state.
45
+ * @private
46
+ */
47
+ async applyDefaultSort() {
48
+ var _a;
49
+ // Normalize direction to handle invalid HTML attribute values
50
+ const direction = this.defaultSortDirection === 'desc' ? 'desc' : 'asc';
51
+ // Find the matching sortable header cell
52
+ const columnHeaderCells = Array.from(this.el.querySelectorAll('pds-table-head-cell[sortable]'));
53
+ const matchingCell = columnHeaderCells.find((cell) => { var _a; return ((_a = cell.textContent) !== null && _a !== void 0 ? _a : '').trim() === this.defaultSortColumn; });
54
+ if (matchingCell) {
55
+ const columnName = ((_a = matchingCell.textContent) !== null && _a !== void 0 ? _a : '').trim();
56
+ // Sort the table data
57
+ this.sortTable(columnName, direction);
58
+ this.sortingColumn = columnName;
59
+ this.sortingDirection = direction;
60
+ // Activate the visual state on the header cell
61
+ await matchingCell.setActiveSort(direction);
62
+ }
63
+ else {
64
+ console.warn(`Default sort column "${this.defaultSortColumn}" not found.`);
65
+ }
32
66
  }
33
67
  disconnectedCallback() {
34
68
  if (this._teardownResponsive) {
@@ -131,6 +165,9 @@ export class PdsTable {
131
165
  }
132
166
  sortTable(column, direction) {
133
167
  const tableBody = this.el.querySelector('pds-table-body');
168
+ // Return early if no table body exists
169
+ if (!tableBody)
170
+ return;
134
171
  // Get the rows in the table body
135
172
  const tableRows = Array.from(tableBody.querySelectorAll('pds-table-row'));
136
173
  // Find the column index based on the column name
@@ -159,6 +196,8 @@ export class PdsTable {
159
196
  });
160
197
  }
161
198
  handleTableSort(event) {
199
+ if (event.defaultPrevented)
200
+ return;
162
201
  const { direction } = event.detail;
163
202
  this.sortTable(event.detail.column, direction);
164
203
  this.sortingColumn = event.detail.column;
@@ -323,6 +362,48 @@ export class PdsTable {
323
362
  "reflect": true,
324
363
  "attribute": "row-dividers",
325
364
  "defaultValue": "false"
365
+ },
366
+ "defaultSortColumn": {
367
+ "type": "string",
368
+ "mutable": false,
369
+ "complexType": {
370
+ "original": "string",
371
+ "resolved": "string",
372
+ "references": {}
373
+ },
374
+ "required": false,
375
+ "optional": true,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "The name of the column to sort by on initial load.\nMust match the text content of a sortable column header."
379
+ },
380
+ "getter": false,
381
+ "setter": false,
382
+ "reflect": false,
383
+ "attribute": "default-sort-column"
384
+ },
385
+ "defaultSortDirection": {
386
+ "type": "string",
387
+ "mutable": false,
388
+ "complexType": {
389
+ "original": "'asc' | 'desc'",
390
+ "resolved": "\"asc\" | \"desc\"",
391
+ "references": {}
392
+ },
393
+ "required": false,
394
+ "optional": true,
395
+ "docs": {
396
+ "tags": [{
397
+ "name": "defaultValue",
398
+ "text": "'asc'"
399
+ }],
400
+ "text": "The direction to sort the default column on initial load.\nOnly applies if `defaultSortColumn` is set."
401
+ },
402
+ "getter": false,
403
+ "setter": false,
404
+ "reflect": false,
405
+ "attribute": "default-sort-direction",
406
+ "defaultValue": "'asc'"
326
407
  }
327
408
  };
328
409
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pds-table.js","sourceRoot":"","sources":["../../../../src/components/pds-table/pds-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,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CACR,CAAC;QACJ,CAAC;QAED,OAAO,CACL,EAAC,IAAI,IACH,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EACxB,EAAE,EAAE,IAAI,CAAC,WAAW,EACpB,IAAI,EAAC,MAAM,EACX,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,QAAQ,EAAC,GAAG,EACZ,IAAI,EAAC,OAAO;YAEZ,eAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, h, Prop, State, Listen } from '@stencil/core';\n\n@Component({\n tag: 'pds-table',\n styleUrls: ['pds-table.scss'],\n shadow: true,\n})\nexport class PdsTable {\n @Element() el: HTMLPdsTableElement;\n private scrollContainer: HTMLElement | null = null;\n private _responsiveHandleScroll: (() => void) | null = null;\n private _responsiveHandleResize: (() => void) | null = null;\n private _responsiveResizeObserver: ResizeObserver | null = null;\n private _teardownResponsive: (() => void) | null = null;\n\n /**\n * Determines if the table displays with reduced table cell padding.\n */\n @Prop() compact: boolean;\n\n /**\n * A unique identifier used for the table `id` attribute.\n */\n @Prop() componentId!: string;\n\n /**\n * Enables the table to be responsive by horizontally scrolling on smaller screens.\n */\n @Prop() responsive: boolean;\n\n /**\n * Determines if the should display a fixed first column.\n */\n @Prop() fixedColumn: boolean;\n\n /**\n * Determines if the table displays checkboxes for selectable rows.\n */\n @Prop() selectable: boolean;\n\n /**\n * Adds divider borders between table rows. The last row will not have a bottom border.\n * @defaultValue false\n */\n @Prop({ reflect: true }) rowDividers: boolean = false;\n\n /**\n * The name of the column being sorted.\n * @defaultValue null\n */\n @State() sortingColumn: string | null = null;\n\n /**\n * The direction of sorting.\n * @defaultValue 'asc'\n */\n @State() sortingDirection: 'asc' | 'desc' = 'asc';\n\n\n /**\n * Event that is emitted when the checkbox is clicked, carrying the rowIndex and selected value.\n */\n @Event() pdsTableSelect: EventEmitter<{ rowIndex: number; isSelected: boolean }>;\n\n /**\n * Event that is emitted when the select all checkbox is clicked, carrying the selected value.\n */\n @Event() pdsTableSelectAll: EventEmitter<{ isSelected: boolean }>;\n\n componentWillLoad() {\n this.sortingColumn = null;\n }\n\n componentDidLoad() {\n if (this.responsive) {\n this.setupResponsiveScrolling();\n }\n }\n\n disconnectedCallback() {\n if (this._teardownResponsive) {\n this._teardownResponsive();\n this._teardownResponsive = null;\n }\n }\n\n /**\n * Sets up responsive scrolling behavior for the table.\n *\n * This method creates a horizontal scrolling system where:\n * - The table content can scroll horizontally when it exceeds the container width\n * - Scroll shadows appear at the left/right edges to indicate scrollable content\n * - Fixed columns remain sticky during horizontal scrolling\n * - Shadows respect border-radius and don't appear when there's nothing to scroll\n *\n * Architecture:\n * - Host element: Contains everything, respects parent constraints\n * - Container element: Handles horizontal scrolling (overflow-x: auto)\n * - Shadow elements: Positioned fixed relative to host, show scroll indicators\n *\n * @private\n */\n private setupResponsiveScrolling() {\n const container = this.el.shadowRoot?.querySelector('.pds-table-responsive-container') as HTMLElement;\n const leftShadow = this.el.shadowRoot?.querySelector('.scroll-shadow-left') as HTMLElement;\n const rightShadow = this.el.shadowRoot?.querySelector('.scroll-shadow-right') as HTMLElement;\n\n if (!container || !leftShadow || !rightShadow) return;\n\n // Store container reference for cleanup\n this.scrollContainer = container;\n\n /**\n * Updates the visibility of scroll shadows based on current scroll position.\n * Left shadow: Shows when scrolled away from start (hidden if fixedColumn is enabled)\n * Right shadow: Shows when there's content to scroll and not at the end\n */\n this._responsiveHandleScroll = () => {\n if (!this.scrollContainer) return;\n\n const scrollLeft = this.scrollContainer.scrollLeft;\n const maxScrollLeft = this.scrollContainer.scrollWidth - this.scrollContainer.clientWidth;\n\n // Show left shadow when scrolled away from start, but not if there's a fixed column\n leftShadow.style.opacity = (scrollLeft > 0 && !this.fixedColumn) ? '1' : '0';\n\n // Show right shadow only if there's content to scroll AND not at end\n rightShadow.style.opacity = (maxScrollLeft > 0 && scrollLeft < maxScrollLeft - 1) ? '1' : '0';\n };\n\n // Add scroll event listener to container element\n this.scrollContainer.addEventListener('scroll', this._responsiveHandleScroll, { passive: true });\n\n // Add resize observer to update shadows when container size changes\n if (typeof window !== 'undefined' && window.ResizeObserver) {\n try {\n this._responsiveResizeObserver = new ResizeObserver(() => {\n this._responsiveHandleScroll?.();\n });\n this._responsiveResizeObserver.observe(this.scrollContainer);\n } catch (error) {\n // ResizeObserver not available in some environments (e.g., tests)\n // Fall back to window resize listener only\n }\n }\n\n // Listen for window resize as fallback\n if (typeof window !== 'undefined') {\n this._responsiveHandleResize = () => {\n this._responsiveHandleScroll?.();\n };\n window.addEventListener('resize', this._responsiveHandleResize);\n }\n\n // Create teardown function for cleanup\n this._teardownResponsive = () => {\n if (this.scrollContainer && this._responsiveHandleScroll) {\n this.scrollContainer.removeEventListener('scroll', this._responsiveHandleScroll);\n this.scrollContainer = null;\n }\n\n if (this._responsiveResizeObserver) {\n this._responsiveResizeObserver.disconnect();\n this._responsiveResizeObserver = null;\n }\n\n if (typeof window !== 'undefined' && this._responsiveHandleResize) {\n window.removeEventListener('resize', this._responsiveHandleResize);\n this._responsiveHandleResize = null;\n }\n\n this._responsiveHandleScroll = null;\n };\n\n // Initial check after setup\n this._responsiveHandleScroll();\n }\n\n\n private classNames() {\n const classNames = ['pds-table'];\n\n if (this.compact) {\n classNames.push('is-compact');\n }\n\n if (this.responsive) {\n classNames.push('is-responsive');\n }\n\n return classNames.join(' ');\n }\n\n private sortTable(column: string, direction: 'asc' | 'desc') {\n const tableBody = this.el.querySelector('pds-table-body');\n\n // Get the rows in the table body\n const tableRows = Array.from(tableBody.querySelectorAll('pds-table-row'));\n\n // Find the column index based on the column name\n const columnHeaderCells: HTMLElement[] = Array.from(\n this.el.querySelectorAll('pds-table-head-cell[sortable]')\n );\n\n const columnHeaderCell = columnHeaderCells.find(\n (cell) => cell.innerText.trim() === column\n );\n\n if (!columnHeaderCell) {\n console.warn(`Column \"${column}\" not found.`);\n return;\n }\n\n const columnIndex = columnHeaderCells.indexOf(columnHeaderCell);\n\n // Sort the rows based on the content of the specified column\n tableRows.sort((a, b) => {\n const valueA = a.querySelector(`pds-table-cell:nth-child(${columnIndex + 1})`).textContent.trim();\n const valueB = b.querySelector(`pds-table-cell:nth-child(${columnIndex + 1})`).textContent.trim();\n\n if (direction === 'asc') {\n return valueA.localeCompare(valueB, undefined, { sensitivity: 'base' });\n } else {\n return valueB.localeCompare(valueA, undefined, { sensitivity: 'base' });\n }\n });\n\n // Clear and append the sorted rows back to the table body\n tableBody.innerHTML = '';\n tableRows.forEach((row) => {\n tableBody.appendChild(row);\n });\n }\n\n @Listen('pdsTableSort')\n handleTableSort(event: CustomEvent<{ column: string; direction: 'asc' | 'desc' }>) {\n const { direction } = event.detail;\n this.sortTable(event.detail.column, direction);\n this.sortingColumn = event.detail.column;\n this.sortingDirection = direction;\n }\n\n @Listen('pdsTableSelectAll')\n handleTableSelectAll(event: CustomEvent<{ isSelected: boolean }>) {\n if (event.defaultPrevented) return;\n\n const pdsTableBody = this.el.querySelector('pds-table-body');\n const tableRows = Array.from(pdsTableBody.querySelectorAll('pds-table-row'));\n\n tableRows.forEach((row) => {\n row.isSelected = event.detail.isSelected;\n });\n }\n\n @Listen('pdsTableRowSelected')\n async handleTableSelect(event: CustomEvent<{ rowIndex: number; isSelected: boolean }>) {\n if (event.defaultPrevented) return;\n\n const allTableRows = this.el.querySelectorAll('pds-table-row');\n const allSelectedRows = Array.from(allTableRows).every((row) => row.isSelected);\n const noneSelectedRows = Array.from(allTableRows).every((row) => !row.isSelected);\n const pdsTableHead = this.el.querySelector('pds-table-head');\n if (!pdsTableHead) return;\n\n const headerCheckbox = pdsTableHead.shadowRoot.querySelector('pds-checkbox');\n headerCheckbox.checked = allSelectedRows;\n headerCheckbox.indeterminate = !allSelectedRows && !noneSelectedRows;\n }\n\n render() {\n if (this.responsive) {\n return (\n <Host\n class=\"pds-table is-responsive pds-table-responsive-host\"\n id={this.componentId}\n role=\"grid\"\n selectable={this.selectable}\n tabindex=\"0\"\n part=\"table responsive-table\"\n >\n <div class=\"scroll-shadow-left\" part=\"scroll-shadow-left\"></div>\n <div class=\"scroll-shadow-right\" part=\"scroll-shadow-right\"></div>\n <div class=\"pds-table-responsive-container\" part=\"responsive-container\">\n <div class=\"pds-table-responsive-wrapper\" part=\"responsive-wrapper\">\n <div class={this.classNames()} part=\"table-inner\">\n <slot></slot>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n return (\n <Host\n class={this.classNames()}\n id={this.componentId}\n role=\"grid\"\n selectable={this.selectable}\n tabindex=\"0\"\n part=\"table\"\n >\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pds-table.js","sourceRoot":"","sources":["../../../../src/components/pds-table/pds-table.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAOtG,MAAM,OAAO,QAAQ;IALrB;QAOU,oBAAe,GAAuB,IAAI,CAAC;QAC3C,4BAAuB,GAAwB,IAAI,CAAC;QACpD,4BAAuB,GAAwB,IAAI,CAAC;QACpD,8BAAyB,GAA0B,IAAI,CAAC;QACxD,wBAAmB,GAAwB,IAAI,CAAC;QA2BxD;;;WAGG;QACsB,gBAAW,GAAY,KAAK,CAAC;QAQtD;;;;WAIG;QACK,yBAAoB,GAAoB,KAAK,CAAC;QAEtD;;;WAGG;QACM,kBAAa,GAAkB,IAAI,CAAC;QAE7C;;;WAGG;QACM,qBAAgB,GAAmB,KAAK,CAAC;KAkSnD;IArRC,gBAAgB;QACd,IAAI,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Host, h, Prop, State, Listen } from '@stencil/core';\n\n@Component({\n tag: 'pds-table',\n styleUrls: ['pds-table.scss'],\n shadow: true,\n})\nexport class PdsTable {\n @Element() el: HTMLPdsTableElement;\n private scrollContainer: HTMLElement | null = null;\n private _responsiveHandleScroll: (() => void) | null = null;\n private _responsiveHandleResize: (() => void) | null = null;\n private _responsiveResizeObserver: ResizeObserver | null = null;\n private _teardownResponsive: (() => void) | null = null;\n\n /**\n * Determines if the table displays with reduced table cell padding.\n */\n @Prop() compact: boolean;\n\n /**\n * A unique identifier used for the table `id` attribute.\n */\n @Prop() componentId!: string;\n\n /**\n * Enables the table to be responsive by horizontally scrolling on smaller screens.\n */\n @Prop() responsive: boolean;\n\n /**\n * Determines if the should display a fixed first column.\n */\n @Prop() fixedColumn: boolean;\n\n /**\n * Determines if the table displays checkboxes for selectable rows.\n */\n @Prop() selectable: boolean;\n\n /**\n * Adds divider borders between table rows. The last row will not have a bottom border.\n * @defaultValue false\n */\n @Prop({ reflect: true }) rowDividers: boolean = false;\n\n /**\n * The name of the column to sort by on initial load.\n * Must match the text content of a sortable column header.\n */\n @Prop() defaultSortColumn?: string;\n\n /**\n * The direction to sort the default column on initial load.\n * Only applies if `defaultSortColumn` is set.\n * @defaultValue 'asc'\n */\n @Prop() defaultSortDirection?: 'asc' | 'desc' = 'asc';\n\n /**\n * The name of the column being sorted.\n * @defaultValue null\n */\n @State() sortingColumn: string | null = null;\n\n /**\n * The direction of sorting.\n * @defaultValue 'asc'\n */\n @State() sortingDirection: 'asc' | 'desc' = 'asc';\n\n\n /**\n * Event that is emitted when the checkbox is clicked, carrying the rowIndex and selected value.\n */\n @Event() pdsTableSelect: EventEmitter<{ rowIndex: number; isSelected: boolean }>;\n\n /**\n * Event that is emitted when the select all checkbox is clicked, carrying the selected value.\n */\n @Event() pdsTableSelectAll: EventEmitter<{ isSelected: boolean }>;\n\n componentDidLoad() {\n if (this.responsive) {\n this.setupResponsiveScrolling();\n }\n\n // Apply default sort if specified\n if (this.defaultSortColumn) {\n void this.applyDefaultSort().catch((err) => {\n console.warn('Failed to apply default sort.', err);\n });\n }\n }\n\n /**\n * Applies the default sort configuration on initial load.\n * Finds the matching column header and activates its sort state.\n * @private\n */\n private async applyDefaultSort() {\n // Normalize direction to handle invalid HTML attribute values\n const direction: 'asc' | 'desc' = this.defaultSortDirection === 'desc' ? 'desc' : 'asc';\n\n // Find the matching sortable header cell\n const columnHeaderCells = Array.from(\n this.el.querySelectorAll('pds-table-head-cell[sortable]')\n ) as HTMLPdsTableHeadCellElement[];\n\n const matchingCell = columnHeaderCells.find(\n (cell) => (cell.textContent ?? '').trim() === this.defaultSortColumn\n );\n\n if (matchingCell) {\n const columnName = (matchingCell.textContent ?? '').trim();\n // Sort the table data\n this.sortTable(columnName, direction);\n this.sortingColumn = columnName;\n this.sortingDirection = direction;\n\n // Activate the visual state on the header cell\n await matchingCell.setActiveSort(direction);\n } else {\n console.warn(`Default sort column \"${this.defaultSortColumn}\" not found.`);\n }\n }\n\n disconnectedCallback() {\n if (this._teardownResponsive) {\n this._teardownResponsive();\n this._teardownResponsive = null;\n }\n }\n\n /**\n * Sets up responsive scrolling behavior for the table.\n *\n * This method creates a horizontal scrolling system where:\n * - The table content can scroll horizontally when it exceeds the container width\n * - Scroll shadows appear at the left/right edges to indicate scrollable content\n * - Fixed columns remain sticky during horizontal scrolling\n * - Shadows respect border-radius and don't appear when there's nothing to scroll\n *\n * Architecture:\n * - Host element: Contains everything, respects parent constraints\n * - Container element: Handles horizontal scrolling (overflow-x: auto)\n * - Shadow elements: Positioned fixed relative to host, show scroll indicators\n *\n * @private\n */\n private setupResponsiveScrolling() {\n const container = this.el.shadowRoot?.querySelector('.pds-table-responsive-container') as HTMLElement;\n const leftShadow = this.el.shadowRoot?.querySelector('.scroll-shadow-left') as HTMLElement;\n const rightShadow = this.el.shadowRoot?.querySelector('.scroll-shadow-right') as HTMLElement;\n\n if (!container || !leftShadow || !rightShadow) return;\n\n // Store container reference for cleanup\n this.scrollContainer = container;\n\n /**\n * Updates the visibility of scroll shadows based on current scroll position.\n * Left shadow: Shows when scrolled away from start (hidden if fixedColumn is enabled)\n * Right shadow: Shows when there's content to scroll and not at the end\n */\n this._responsiveHandleScroll = () => {\n if (!this.scrollContainer) return;\n\n const scrollLeft = this.scrollContainer.scrollLeft;\n const maxScrollLeft = this.scrollContainer.scrollWidth - this.scrollContainer.clientWidth;\n\n // Show left shadow when scrolled away from start, but not if there's a fixed column\n leftShadow.style.opacity = (scrollLeft > 0 && !this.fixedColumn) ? '1' : '0';\n\n // Show right shadow only if there's content to scroll AND not at end\n rightShadow.style.opacity = (maxScrollLeft > 0 && scrollLeft < maxScrollLeft - 1) ? '1' : '0';\n };\n\n // Add scroll event listener to container element\n this.scrollContainer.addEventListener('scroll', this._responsiveHandleScroll, { passive: true });\n\n // Add resize observer to update shadows when container size changes\n if (typeof window !== 'undefined' && window.ResizeObserver) {\n try {\n this._responsiveResizeObserver = new ResizeObserver(() => {\n this._responsiveHandleScroll?.();\n });\n this._responsiveResizeObserver.observe(this.scrollContainer);\n } catch (error) {\n // ResizeObserver not available in some environments (e.g., tests)\n // Fall back to window resize listener only\n }\n }\n\n // Listen for window resize as fallback\n if (typeof window !== 'undefined') {\n this._responsiveHandleResize = () => {\n this._responsiveHandleScroll?.();\n };\n window.addEventListener('resize', this._responsiveHandleResize);\n }\n\n // Create teardown function for cleanup\n this._teardownResponsive = () => {\n if (this.scrollContainer && this._responsiveHandleScroll) {\n this.scrollContainer.removeEventListener('scroll', this._responsiveHandleScroll);\n this.scrollContainer = null;\n }\n\n if (this._responsiveResizeObserver) {\n this._responsiveResizeObserver.disconnect();\n this._responsiveResizeObserver = null;\n }\n\n if (typeof window !== 'undefined' && this._responsiveHandleResize) {\n window.removeEventListener('resize', this._responsiveHandleResize);\n this._responsiveHandleResize = null;\n }\n\n this._responsiveHandleScroll = null;\n };\n\n // Initial check after setup\n this._responsiveHandleScroll();\n }\n\n\n private classNames() {\n const classNames = ['pds-table'];\n\n if (this.compact) {\n classNames.push('is-compact');\n }\n\n if (this.responsive) {\n classNames.push('is-responsive');\n }\n\n return classNames.join(' ');\n }\n\n private sortTable(column: string, direction: 'asc' | 'desc') {\n const tableBody = this.el.querySelector('pds-table-body');\n\n // Return early if no table body exists\n if (!tableBody) return;\n\n // Get the rows in the table body\n const tableRows = Array.from(tableBody.querySelectorAll('pds-table-row'));\n\n // Find the column index based on the column name\n const columnHeaderCells: HTMLElement[] = Array.from(\n this.el.querySelectorAll('pds-table-head-cell[sortable]')\n );\n\n const columnHeaderCell = columnHeaderCells.find(\n (cell) => cell.innerText.trim() === column\n );\n\n if (!columnHeaderCell) {\n console.warn(`Column \"${column}\" not found.`);\n return;\n }\n\n const columnIndex = columnHeaderCells.indexOf(columnHeaderCell);\n\n // Sort the rows based on the content of the specified column\n tableRows.sort((a, b) => {\n const valueA = a.querySelector(`pds-table-cell:nth-child(${columnIndex + 1})`).textContent.trim();\n const valueB = b.querySelector(`pds-table-cell:nth-child(${columnIndex + 1})`).textContent.trim();\n\n if (direction === 'asc') {\n return valueA.localeCompare(valueB, undefined, { sensitivity: 'base' });\n } else {\n return valueB.localeCompare(valueA, undefined, { sensitivity: 'base' });\n }\n });\n\n // Clear and append the sorted rows back to the table body\n tableBody.innerHTML = '';\n tableRows.forEach((row) => {\n tableBody.appendChild(row);\n });\n }\n\n @Listen('pdsTableSort')\n handleTableSort(event: CustomEvent<{ column: string; direction: 'asc' | 'desc' }>) {\n if (event.defaultPrevented) return;\n\n const { direction } = event.detail;\n this.sortTable(event.detail.column, direction);\n this.sortingColumn = event.detail.column;\n this.sortingDirection = direction;\n }\n\n @Listen('pdsTableSelectAll')\n handleTableSelectAll(event: CustomEvent<{ isSelected: boolean }>) {\n if (event.defaultPrevented) return;\n\n const pdsTableBody = this.el.querySelector('pds-table-body');\n const tableRows = Array.from(pdsTableBody.querySelectorAll('pds-table-row'));\n\n tableRows.forEach((row) => {\n row.isSelected = event.detail.isSelected;\n });\n }\n\n @Listen('pdsTableRowSelected')\n async handleTableSelect(event: CustomEvent<{ rowIndex: number; isSelected: boolean }>) {\n if (event.defaultPrevented) return;\n\n const allTableRows = this.el.querySelectorAll('pds-table-row');\n const allSelectedRows = Array.from(allTableRows).every((row) => row.isSelected);\n const noneSelectedRows = Array.from(allTableRows).every((row) => !row.isSelected);\n const pdsTableHead = this.el.querySelector('pds-table-head');\n if (!pdsTableHead) return;\n\n const headerCheckbox = pdsTableHead.shadowRoot.querySelector('pds-checkbox');\n headerCheckbox.checked = allSelectedRows;\n headerCheckbox.indeterminate = !allSelectedRows && !noneSelectedRows;\n }\n\n render() {\n if (this.responsive) {\n return (\n <Host\n class=\"pds-table is-responsive pds-table-responsive-host\"\n id={this.componentId}\n role=\"grid\"\n selectable={this.selectable}\n tabindex=\"0\"\n part=\"table responsive-table\"\n >\n <div class=\"scroll-shadow-left\" part=\"scroll-shadow-left\"></div>\n <div class=\"scroll-shadow-right\" part=\"scroll-shadow-right\"></div>\n <div class=\"pds-table-responsive-container\" part=\"responsive-container\">\n <div class=\"pds-table-responsive-wrapper\" part=\"responsive-wrapper\">\n <div class={this.classNames()} part=\"table-inner\">\n <slot></slot>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n return (\n <Host\n class={this.classNames()}\n id={this.componentId}\n role=\"grid\"\n selectable={this.selectable}\n tabindex=\"0\"\n part=\"table\"\n >\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
@@ -24,6 +24,21 @@ export default {
24
24
  control: { type: 'boolean' },
25
25
  description: 'Adds divider borders between table rows. The last row will not have a bottom border',
26
26
  },
27
+ defaultSortColumn: {
28
+ control: { type: 'text' },
29
+ description: 'The name of the column to sort by on initial load. Must match the text content of a sortable column header.',
30
+ table: {
31
+ category: 'Sorting',
32
+ },
33
+ },
34
+ defaultSortDirection: {
35
+ control: { type: 'select' },
36
+ options: ['asc', 'desc'],
37
+ description: 'The direction to sort the default column on initial load.',
38
+ table: {
39
+ category: 'Sorting',
40
+ },
41
+ },
27
42
  },
28
43
  };
29
44
 
@@ -236,6 +251,54 @@ const SortableTemplate = (args) => html`
236
251
  </pds-table-body>
237
252
  </pds-table>`;
238
253
 
254
+ const DefaultSortTemplate = (args) => html`
255
+ <pds-table
256
+ ?compact=${args.compact}
257
+ component-id="${args.componentId}"
258
+ ?fixed-column=${args.fixedColumn}
259
+ ?responsive=${args.responsive}
260
+ ?row-dividers=${args.rowDividers}
261
+ ?selectable=${args.selectable}
262
+ default-sort-column="${args.defaultSortColumn}"
263
+ default-sort-direction="${args.defaultSortDirection}"
264
+ >
265
+ <pds-table-head
266
+ ?border=${args.border}
267
+ ?background=${args.background}
268
+ >
269
+ <pds-table-head-cell sortable>Name</pds-table-head-cell>
270
+ <pds-table-head-cell sortable>Email</pds-table-head-cell>
271
+ <pds-table-head-cell sortable>Account</pds-table-head-cell>
272
+ </pds-table-head>
273
+ <pds-table-body>
274
+ <pds-table-row>
275
+ <pds-table-cell>John Doe</pds-table-cell>
276
+ <pds-table-cell>john.doe@example.com</pds-table-cell>
277
+ <pds-table-cell>47321</pds-table-cell>
278
+ </pds-table-row>
279
+ <pds-table-row>
280
+ <pds-table-cell>Jane Smith</pds-table-cell>
281
+ <pds-table-cell>jane.smith@example.com</pds-table-cell>
282
+ <pds-table-cell>89654</pds-table-cell>
283
+ </pds-table-row>
284
+ <pds-table-row>
285
+ <pds-table-cell>Michael Johnson</pds-table-cell>
286
+ <pds-table-cell>michael.johnson@example.com</pds-table-cell>
287
+ <pds-table-cell>21578</pds-table-cell>
288
+ </pds-table-row>
289
+ <pds-table-row>
290
+ <pds-table-cell>Susan Brown</pds-table-cell>
291
+ <pds-table-cell>susan.brown@example.com</pds-table-cell>
292
+ <pds-table-cell>63920</pds-table-cell>
293
+ </pds-table-row>
294
+ <pds-table-row>
295
+ <pds-table-cell>William Davis</pds-table-cell>
296
+ <pds-table-cell>william.davis@example.com</pds-table-cell>
297
+ <pds-table-cell>17436</pds-table-cell>
298
+ </pds-table-row>
299
+ </pds-table-body>
300
+ </pds-table>`;
301
+
239
302
  export const Default = BaseTemplate.bind();
240
303
  Default.args = {
241
304
  compact: false,
@@ -321,6 +384,20 @@ Sortable.args = {
321
384
  sortable: true,
322
385
  };
323
386
 
387
+ export const DefaultSorting = DefaultSortTemplate.bind();
388
+ DefaultSorting.args = {
389
+ compact: false,
390
+ componentId: 'default-sort',
391
+ fixedColumn: false,
392
+ border: false,
393
+ background: false,
394
+ responsive: false,
395
+ rowDividers: false,
396
+ selectable: false,
397
+ defaultSortColumn: 'Name',
398
+ defaultSortDirection: 'desc',
399
+ };
400
+
324
401
  export const RowDividers = BaseTemplate.bind();
325
402
  RowDividers.args = {
326
403
  compact: false,
@@ -77,6 +77,9 @@ export class PdsTextarea {
77
77
  this.onTextareaChange = (ev) => {
78
78
  this.emitValueChange(ev);
79
79
  };
80
+ this.onKeyDown = (ev) => {
81
+ this.pdsKeyDown.emit(ev);
82
+ };
80
83
  }
81
84
  /**
82
85
  * Sets focus on the native `textarea` in the `pds-textarea`. Use this method instead of the global
@@ -289,10 +292,10 @@ export class PdsTextarea {
289
292
  }
290
293
  render() {
291
294
  const value = this.getValue();
292
- return (h(Host, { key: '8e14fed28b2edd75aef6c5a1991518bb8b11931d', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null, "has-action": this.hasAction && !this.hideLabel ? 'true' : null }, h("div", { key: '4dcf8471267223b0cd1f6e7b6dd2072550b3ac8b', class: "pds-textarea" }, this.label &&
293
- h("div", { key: '520d616798b2223a979955ed268378bc5ffd1571', class: "pds-textarea__label-wrapper" }, h("label", { key: 'b04566b03b0c809b4b6c639d75774d845a021636', htmlFor: this.componentId }, h("span", { key: 'a6b92315f11a7cf15c9aa2db0cd7d8a824ff88ae', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), !this.hideLabel && this.renderAction()), h("div", { key: 'b4cebca68b014c837fa8415a8f67f611b150b083', class: "pds-textarea__field-wrapper" }, h("textarea", Object.assign({ key: 'ac49811c463709ed2918324005ec8f4285fb76f2', ref: (el) => this.nativeTextarea = el, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, maxlength: this.maxLength, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onBlur: this.onBlur, onChange: this.onTextareaChange, onFocus: this.onFocus, onInput: this.onInput }, this.inheritedAttributes), value), this.renderCharacterCounter()), this.helperMessage &&
294
- h("p", { key: '7a4cc4c278d39c675a5e6e3d0b4a917d63441cd1', class: "pds-textarea__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
295
- h("p", { key: 'd02251c55ef2baf92fd66c92a16154b805494b6c', "aria-live": "assertive", class: "pds-textarea__error-message", id: messageId(this.componentId, 'error') }, h("pds-icon", { key: 'd7632ac66b16c0c306f245a23d379689d65e8010', icon: danger, size: "small" }), this.errorMessage))));
295
+ return (h(Host, { key: '294f37b2751fd4fbc16e7b2cca62d1a5200b7f4e', "aria-disabled": this.disabled ? 'true' : null, "aria-readonly": this.readonly ? 'true' : null, "has-action": this.hasAction && !this.hideLabel ? 'true' : null }, h("div", { key: 'b785c5740642dafcdb771f3a9ffb933d8ada3f4e', class: "pds-textarea" }, this.label &&
296
+ h("div", { key: '31ad1d39efe78fc7a29e48d4a8d228a97422eba9', class: "pds-textarea__label-wrapper" }, h("label", { key: 'e37a18d36bffa47f00d5d3376df45b3f35c3e8a3', htmlFor: this.componentId }, h("span", { key: 'fc2d376e1dc976c3004f6ab225c921ebc7e46dd4', class: this.hideLabel ? 'visually-hidden' : '' }, this.label)), !this.hideLabel && this.renderAction()), h("div", { key: '7b5db43c23fb9a2ddb3ebec0b684953a4b043ea1', class: "pds-textarea__field-wrapper" }, h("textarea", Object.assign({ key: '81355164c2b01ab7ef5d6adcb3f92a59eec2692f', ref: (el) => this.nativeTextarea = el, "aria-describedby": assignDescription(this.componentId, this.invalid, this.helperMessage), "aria-invalid": this.invalid ? "true" : undefined, autocomplete: this.autocomplete, class: this.textareaClassNames(), disabled: this.disabled, id: this.componentId, maxlength: this.maxLength, name: this.name, placeholder: this.placeholder, readOnly: this.readonly, required: this.required, rows: this.rows, onBlur: this.onBlur, onChange: this.onTextareaChange, onFocus: this.onFocus, onInput: this.onInput, onKeyDown: this.onKeyDown }, this.inheritedAttributes), value), this.renderCharacterCounter()), this.helperMessage &&
297
+ h("p", { key: 'abcdf1ef2aa24d0057e5b0c212c06b5324f0dd9b', class: "pds-textarea__helper-message", id: messageId(this.componentId, 'helper') }, this.helperMessage), this.invalid &&
298
+ h("p", { key: '1c526c2aae382caabe83ff5e3dadd7510371a656', "aria-live": "assertive", class: "pds-textarea__error-message", id: messageId(this.componentId, 'error') }, h("pds-icon", { key: 'e8a0960b0e2dbacfe46113b3f1162e35d301afac', icon: danger, size: "small" }), this.errorMessage))));
296
299
  }
297
300
  static get is() { return "pds-textarea"; }
298
301
  static get encapsulation() { return "shadow"; }
@@ -741,6 +744,26 @@ export class PdsTextarea {
741
744
  }
742
745
  }
743
746
  }
747
+ }, {
748
+ "method": "pdsKeyDown",
749
+ "name": "pdsKeyDown",
750
+ "bubbles": true,
751
+ "cancelable": true,
752
+ "composed": true,
753
+ "docs": {
754
+ "tags": [],
755
+ "text": "Emitted when a key is pressed down in the textarea."
756
+ },
757
+ "complexType": {
758
+ "original": "KeyboardEvent",
759
+ "resolved": "KeyboardEvent",
760
+ "references": {
761
+ "KeyboardEvent": {
762
+ "location": "global",
763
+ "id": "global::KeyboardEvent"
764
+ }
765
+ }
766
+ }
744
767
  }];
745
768
  }
746
769
  static get methods() {