@salesforce/design-system-react 11.0.0-rc.0 → 11.0.0-rc.2

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 (552) hide show
  1. package/README.md +27 -1
  2. package/dist/cjs/components/accordion/index.cjs +1 -1
  3. package/dist/cjs/components/accordion/index.cjs.map +1 -1
  4. package/dist/cjs/components/accordion/panel.cjs.map +1 -1
  5. package/dist/cjs/components/alert/index.cjs +1 -1
  6. package/dist/cjs/components/alert/index.cjs.map +1 -1
  7. package/dist/cjs/components/builder-header/nav-dropdown.cjs.map +1 -1
  8. package/dist/cjs/components/builder-header/nav-link.cjs.map +1 -1
  9. package/dist/cjs/components/builder-header/toolbar.cjs.map +1 -1
  10. package/dist/cjs/components/button/check-props.cjs +1 -1
  11. package/dist/cjs/components/button/check-props.cjs.map +1 -1
  12. package/dist/cjs/components/button/index.cjs +1 -1
  13. package/dist/cjs/components/button/index.cjs.map +1 -1
  14. package/dist/cjs/components/button-stateful/check-props.cjs +1 -1
  15. package/dist/cjs/components/button-stateful/check-props.cjs.map +1 -1
  16. package/dist/cjs/components/button-stateful/index.cjs +1 -1
  17. package/dist/cjs/components/button-stateful/index.cjs.map +1 -1
  18. package/dist/cjs/components/carousel/index.cjs +1 -1
  19. package/dist/cjs/components/carousel/index.cjs.map +1 -1
  20. package/dist/cjs/components/carousel/private/carousel-indicators.cjs.map +1 -1
  21. package/dist/cjs/components/carousel/private/carousel-item.cjs +1 -1
  22. package/dist/cjs/components/carousel/private/carousel-item.cjs.map +1 -1
  23. package/dist/cjs/components/checkbox/check-props.cjs +1 -1
  24. package/dist/cjs/components/checkbox/check-props.cjs.map +1 -1
  25. package/dist/cjs/components/checkbox/index.cjs +1 -1
  26. package/dist/cjs/components/checkbox/index.cjs.map +1 -1
  27. package/dist/cjs/components/color-picker/color-picker.cjs +1 -1
  28. package/dist/cjs/components/color-picker/color-picker.cjs.map +1 -1
  29. package/dist/cjs/components/color-picker/private/custom-color.cjs.map +1 -1
  30. package/dist/cjs/components/color-picker/private/hsv-color.cjs +1 -1
  31. package/dist/cjs/components/color-picker/private/hsv-color.cjs.map +1 -1
  32. package/dist/cjs/components/color-picker/private/swatch-option.cjs +1 -1
  33. package/dist/cjs/components/color-picker/private/swatch-option.cjs.map +1 -1
  34. package/dist/cjs/components/color-picker/private/swatch.cjs +1 -1
  35. package/dist/cjs/components/color-picker/private/swatch.cjs.map +1 -1
  36. package/dist/cjs/components/combobox/combobox.cjs +1 -1
  37. package/dist/cjs/components/combobox/combobox.cjs.map +1 -1
  38. package/dist/cjs/components/combobox/index.cjs +1 -1
  39. package/dist/cjs/components/combobox/index.cjs.map +1 -1
  40. package/dist/cjs/components/combobox/private/menu.cjs +1 -1
  41. package/dist/cjs/components/combobox/private/menu.cjs.map +1 -1
  42. package/dist/cjs/components/date-picker/date-picker.cjs +1 -1
  43. package/dist/cjs/components/date-picker/date-picker.cjs.map +1 -1
  44. package/dist/cjs/components/date-picker/index.cjs.map +1 -1
  45. package/dist/cjs/components/date-picker/private/calendar.cjs.map +1 -1
  46. package/dist/cjs/components/date-picker/private/day.cjs +1 -1
  47. package/dist/cjs/components/date-picker/private/day.cjs.map +1 -1
  48. package/dist/cjs/components/files/file.cjs +1 -8
  49. package/dist/cjs/components/files/file.cjs.map +1 -1
  50. package/dist/cjs/components/files/private/file-actions.cjs +1 -1
  51. package/dist/cjs/components/files/private/file-actions.cjs.map +1 -1
  52. package/dist/cjs/components/files/private/file-figure.cjs +1 -1
  53. package/dist/cjs/components/files/private/file-figure.cjs.map +1 -1
  54. package/dist/cjs/components/filter/filter.cjs +1 -1
  55. package/dist/cjs/components/filter/filter.cjs.map +1 -1
  56. package/dist/cjs/components/icon/check-props.cjs +1 -1
  57. package/dist/cjs/components/icon/check-props.cjs.map +1 -1
  58. package/dist/cjs/components/icon/index.cjs +1 -1
  59. package/dist/cjs/components/icon/index.cjs.map +1 -1
  60. package/dist/cjs/components/icon/input-icon/index.cjs.map +1 -1
  61. package/dist/cjs/components/icon-settings/index.cjs.map +1 -1
  62. package/dist/cjs/components/input/check-props.cjs +1 -1
  63. package/dist/cjs/components/input/check-props.cjs.map +1 -1
  64. package/dist/cjs/components/input/index.cjs.map +1 -1
  65. package/dist/cjs/components/input/private/inner-input.cjs.map +1 -1
  66. package/dist/cjs/components/input/search.cjs.map +1 -1
  67. package/dist/cjs/components/menu-dropdown/button-trigger.cjs.map +1 -1
  68. package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs +1 -1
  69. package/dist/cjs/components/menu-dropdown/menu-dropdown.cjs.map +1 -1
  70. package/dist/cjs/components/modal/index.cjs +1 -1
  71. package/dist/cjs/components/modal/index.cjs.map +1 -1
  72. package/dist/cjs/components/panel/filtering/group.cjs.map +1 -1
  73. package/dist/cjs/components/pill/index.cjs.map +1 -1
  74. package/dist/cjs/components/pill-container/index.cjs +1 -1
  75. package/dist/cjs/components/pill-container/index.cjs.map +1 -1
  76. package/dist/cjs/components/popover/edit-dialog.cjs.map +1 -1
  77. package/dist/cjs/components/popover/index.cjs.map +1 -1
  78. package/dist/cjs/components/popover/popover.cjs +1 -1
  79. package/dist/cjs/components/popover/popover.cjs.map +1 -1
  80. package/dist/cjs/components/progress-indicator/index.cjs.map +1 -1
  81. package/dist/cjs/components/progress-indicator/private/step.cjs.map +1 -1
  82. package/dist/cjs/components/progress-ring/index.cjs.map +1 -1
  83. package/dist/cjs/components/radio/index.cjs +1 -1
  84. package/dist/cjs/components/radio/index.cjs.map +1 -1
  85. package/dist/cjs/components/radio-group/check-props.cjs.map +1 -1
  86. package/dist/cjs/components/radio-group/index.cjs.map +1 -1
  87. package/dist/cjs/components/scoped-notification/index.cjs.map +1 -1
  88. package/dist/cjs/components/setup-assistant/step.cjs.map +1 -1
  89. package/dist/cjs/components/simple-data-table/cell.cjs +1 -1
  90. package/dist/cjs/components/simple-data-table/cell.cjs.map +1 -1
  91. package/dist/cjs/components/simple-data-table/index.cjs +1 -1
  92. package/dist/cjs/components/simple-data-table/index.cjs.map +1 -1
  93. package/dist/cjs/components/simple-data-table/interactive-element.cjs +1 -1
  94. package/dist/cjs/components/simple-data-table/interactive-element.cjs.map +1 -1
  95. package/dist/cjs/components/simple-data-table/private/cell-context.cjs.map +1 -1
  96. package/dist/cjs/components/simple-data-table/private/corner-style.cjs +2 -0
  97. package/dist/cjs/components/simple-data-table/private/corner-style.cjs.map +1 -0
  98. package/dist/cjs/components/simple-data-table/private/head.cjs +1 -1
  99. package/dist/cjs/components/simple-data-table/private/head.cjs.map +1 -1
  100. package/dist/cjs/components/simple-data-table/private/header-cell.cjs +1 -1
  101. package/dist/cjs/components/simple-data-table/private/header-cell.cjs.map +1 -1
  102. package/dist/cjs/components/simple-data-table/private/link.cjs +1 -1
  103. package/dist/cjs/components/simple-data-table/private/link.cjs.map +1 -1
  104. package/dist/cjs/components/simple-data-table/private/row.cjs +1 -1
  105. package/dist/cjs/components/simple-data-table/private/row.cjs.map +1 -1
  106. package/dist/cjs/components/simple-data-table/row-actions.cjs +1 -1
  107. package/dist/cjs/components/simple-data-table/row-actions.cjs.map +1 -1
  108. package/dist/cjs/components/slider/index.cjs.map +1 -1
  109. package/dist/cjs/components/split-view/header.cjs.map +1 -1
  110. package/dist/cjs/components/split-view/listbox.cjs.map +1 -1
  111. package/dist/cjs/components/split-view/private/list-item-with-content.cjs.map +1 -1
  112. package/dist/cjs/components/tabs/index.cjs.map +1 -1
  113. package/dist/cjs/components/tabs/panel.cjs.map +1 -1
  114. package/dist/cjs/components/tabs/private/tab.cjs +1 -1
  115. package/dist/cjs/components/tabs/private/tab.cjs.map +1 -1
  116. package/dist/cjs/components/textarea/check-props.cjs +1 -1
  117. package/dist/cjs/components/textarea/check-props.cjs.map +1 -1
  118. package/dist/cjs/components/textarea/index.cjs +1 -1
  119. package/dist/cjs/components/textarea/index.cjs.map +1 -1
  120. package/dist/cjs/components/toast/index.cjs.map +1 -1
  121. package/dist/cjs/components/tooltip/index.cjs +1 -3
  122. package/dist/cjs/components/tooltip/index.cjs.map +1 -1
  123. package/dist/cjs/components/tree/private/branch.cjs.map +1 -1
  124. package/dist/cjs/components/tree/private/item.cjs.map +1 -1
  125. package/dist/cjs/components/tree/private/render-branch.cjs +1 -1
  126. package/dist/cjs/components/tree/private/render-branch.cjs.map +1 -1
  127. package/dist/cjs/components/tree/tree.cjs.map +1 -1
  128. package/dist/cjs/components/trial-bar/button.cjs.map +1 -1
  129. package/dist/cjs/components/trial-bar/dropdown.cjs.map +1 -1
  130. package/dist/cjs/components/utilities/dialog/index.cjs +1 -1
  131. package/dist/cjs/components/utilities/dialog/index.cjs.map +1 -1
  132. package/dist/cjs/components/utilities/dialog/portal.cjs +1 -1
  133. package/dist/cjs/components/utilities/dialog/portal.cjs.map +1 -1
  134. package/dist/cjs/components/utilities/menu-list/index.cjs +1 -26
  135. package/dist/cjs/components/utilities/menu-list/index.cjs.map +1 -1
  136. package/dist/cjs/components/utilities/menu-list/item-label.cjs.map +1 -1
  137. package/dist/cjs/components/utilities/menu-list/item.cjs +1 -1
  138. package/dist/cjs/components/utilities/menu-list/item.cjs.map +1 -1
  139. package/dist/cjs/components/utilities/utility-icon/index.cjs +1 -1
  140. package/dist/cjs/components/utilities/utility-icon/index.cjs.map +1 -1
  141. package/dist/cjs/utilities/color.cjs +1 -1
  142. package/dist/cjs/utilities/color.cjs.map +1 -1
  143. package/dist/cjs/utilities/dom-element-focus.cjs.map +1 -1
  144. package/dist/cjs/utilities/execution-environment.cjs.map +1 -1
  145. package/dist/cjs/utilities/get-aria-props.cjs +1 -1
  146. package/dist/cjs/utilities/get-aria-props.cjs.map +1 -1
  147. package/dist/cjs/utilities/get-component-doc.cjs +1 -1
  148. package/dist/cjs/utilities/get-component-doc.cjs.map +1 -1
  149. package/dist/cjs/utilities/get-data-props.cjs +1 -1
  150. package/dist/cjs/utilities/get-data-props.cjs.map +1 -1
  151. package/dist/cjs/utilities/keyboard-navigable-dialog.cjs +1 -1
  152. package/dist/cjs/utilities/keyboard-navigable-dialog.cjs.map +1 -1
  153. package/dist/cjs/utilities/keyboard-navigate.cjs +1 -1
  154. package/dist/cjs/utilities/keyboard-navigate.cjs.map +1 -1
  155. package/dist/cjs/utilities/product-tokens/icon-backgrounds.cjs.map +1 -1
  156. package/dist/cjs/utilities/warning/children-as-trigger.cjs +1 -1
  157. package/dist/cjs/utilities/warning/children-as-trigger.cjs.map +1 -1
  158. package/dist/cjs/utilities/warning/deprecated-property-value.cjs +1 -1
  159. package/dist/cjs/utilities/warning/deprecated-property-value.cjs.map +1 -1
  160. package/dist/cjs/utilities/warning/deprecated-property.cjs +1 -1
  161. package/dist/cjs/utilities/warning/deprecated-property.cjs.map +1 -1
  162. package/dist/cjs/utilities/warning/has-children-without-display-name-of.cjs +1 -1
  163. package/dist/cjs/utilities/warning/has-children-without-display-name-of.cjs.map +1 -1
  164. package/dist/cjs/utilities/warning/if-one-then-both-required-property.cjs +1 -1
  165. package/dist/cjs/utilities/warning/if-one-then-both-required-property.cjs.map +1 -1
  166. package/dist/cjs/utilities/warning/is-trigger-tabbable.cjs +1 -1
  167. package/dist/cjs/utilities/warning/is-trigger-tabbable.cjs.map +1 -1
  168. package/dist/cjs/utilities/warning/low-priority-warning.cjs.map +1 -1
  169. package/dist/cjs/utilities/warning/one-of-required-property.cjs +1 -1
  170. package/dist/cjs/utilities/warning/one-of-required-property.cjs.map +1 -1
  171. package/dist/cjs/utilities/warning/only-one-of-properties.cjs +1 -1
  172. package/dist/cjs/utilities/warning/only-one-of-properties.cjs.map +1 -1
  173. package/dist/cjs/utilities/warning/removal-version.cjs +2 -0
  174. package/dist/cjs/utilities/warning/removal-version.cjs.map +1 -0
  175. package/dist/cjs/utilities/warning/render-function-return-contents-lack-display-name.cjs +1 -1
  176. package/dist/cjs/utilities/warning/render-function-return-contents-lack-display-name.cjs.map +1 -1
  177. package/dist/cjs/utilities/warning/required-property.cjs +1 -1
  178. package/dist/cjs/utilities/warning/required-property.cjs.map +1 -1
  179. package/dist/cjs/utilities/warning/sunset-property.cjs +1 -1
  180. package/dist/cjs/utilities/warning/sunset-property.cjs.map +1 -1
  181. package/dist/cjs/utilities/warning/warned-registry.cjs +2 -0
  182. package/dist/cjs/utilities/warning/warned-registry.cjs.map +1 -0
  183. package/dist/es/components/accordion/index.js +7 -3
  184. package/dist/es/components/accordion/index.js.map +1 -1
  185. package/dist/es/components/accordion/panel.js.map +1 -1
  186. package/dist/es/components/alert/index.js +4 -5
  187. package/dist/es/components/alert/index.js.map +1 -1
  188. package/dist/es/components/builder-header/nav-dropdown.js.map +1 -1
  189. package/dist/es/components/builder-header/nav-link.js.map +1 -1
  190. package/dist/es/components/builder-header/toolbar.js.map +1 -1
  191. package/dist/es/components/button/check-props.js +1 -1
  192. package/dist/es/components/button/check-props.js.map +1 -1
  193. package/dist/es/components/button/index.js +50 -50
  194. package/dist/es/components/button/index.js.map +1 -1
  195. package/dist/es/components/button-stateful/check-props.js +1 -1
  196. package/dist/es/components/button-stateful/check-props.js.map +1 -1
  197. package/dist/es/components/button-stateful/index.js +3 -2
  198. package/dist/es/components/button-stateful/index.js.map +1 -1
  199. package/dist/es/components/carousel/index.js +155 -129
  200. package/dist/es/components/carousel/index.js.map +1 -1
  201. package/dist/es/components/carousel/private/carousel-indicators.js.map +1 -1
  202. package/dist/es/components/carousel/private/carousel-item.js +1 -1
  203. package/dist/es/components/carousel/private/carousel-item.js.map +1 -1
  204. package/dist/es/components/checkbox/check-props.js +1 -1
  205. package/dist/es/components/checkbox/check-props.js.map +1 -1
  206. package/dist/es/components/checkbox/index.js +102 -100
  207. package/dist/es/components/checkbox/index.js.map +1 -1
  208. package/dist/es/components/color-picker/color-picker.js +150 -151
  209. package/dist/es/components/color-picker/color-picker.js.map +1 -1
  210. package/dist/es/components/color-picker/private/custom-color.js.map +1 -1
  211. package/dist/es/components/color-picker/private/hsv-color.js +16 -20
  212. package/dist/es/components/color-picker/private/hsv-color.js.map +1 -1
  213. package/dist/es/components/color-picker/private/swatch-option.js +2 -2
  214. package/dist/es/components/color-picker/private/swatch-option.js.map +1 -1
  215. package/dist/es/components/color-picker/private/swatch.js +1 -1
  216. package/dist/es/components/color-picker/private/swatch.js.map +1 -1
  217. package/dist/es/components/combobox/combobox.js +569 -582
  218. package/dist/es/components/combobox/combobox.js.map +1 -1
  219. package/dist/es/components/combobox/index.js +6 -19
  220. package/dist/es/components/combobox/index.js.map +1 -1
  221. package/dist/es/components/combobox/private/menu.js +3 -3
  222. package/dist/es/components/combobox/private/menu.js.map +1 -1
  223. package/dist/es/components/date-picker/date-picker.js +101 -102
  224. package/dist/es/components/date-picker/date-picker.js.map +1 -1
  225. package/dist/es/components/date-picker/index.js.map +1 -1
  226. package/dist/es/components/date-picker/private/calendar.js.map +1 -1
  227. package/dist/es/components/date-picker/private/day.js +1 -1
  228. package/dist/es/components/date-picker/private/day.js.map +1 -1
  229. package/dist/es/components/files/file.js +5 -6
  230. package/dist/es/components/files/file.js.map +1 -1
  231. package/dist/es/components/files/private/file-actions.js +2 -2
  232. package/dist/es/components/files/private/file-actions.js.map +1 -1
  233. package/dist/es/components/files/private/file-figure.js +1 -1
  234. package/dist/es/components/files/private/file-figure.js.map +1 -1
  235. package/dist/es/components/filter/filter.js +5 -1
  236. package/dist/es/components/filter/filter.js.map +1 -1
  237. package/dist/es/components/icon/check-props.js +9 -7
  238. package/dist/es/components/icon/check-props.js.map +1 -1
  239. package/dist/es/components/icon/index.js +13 -10
  240. package/dist/es/components/icon/index.js.map +1 -1
  241. package/dist/es/components/icon/input-icon/index.js.map +1 -1
  242. package/dist/es/components/icon-settings/index.js.map +1 -1
  243. package/dist/es/components/input/check-props.js +14 -13
  244. package/dist/es/components/input/check-props.js.map +1 -1
  245. package/dist/es/components/input/index.js.map +1 -1
  246. package/dist/es/components/input/private/inner-input.js.map +1 -1
  247. package/dist/es/components/input/search.js.map +1 -1
  248. package/dist/es/components/menu-dropdown/button-trigger.js.map +1 -1
  249. package/dist/es/components/menu-dropdown/menu-dropdown.js +202 -207
  250. package/dist/es/components/menu-dropdown/menu-dropdown.js.map +1 -1
  251. package/dist/es/components/modal/index.js +1 -2
  252. package/dist/es/components/modal/index.js.map +1 -1
  253. package/dist/es/components/panel/filtering/group.js.map +1 -1
  254. package/dist/es/components/pill/index.js.map +1 -1
  255. package/dist/es/components/pill-container/index.js +10 -6
  256. package/dist/es/components/pill-container/index.js.map +1 -1
  257. package/dist/es/components/popover/edit-dialog.js.map +1 -1
  258. package/dist/es/components/popover/index.js.map +1 -1
  259. package/dist/es/components/popover/popover.js +181 -177
  260. package/dist/es/components/popover/popover.js.map +1 -1
  261. package/dist/es/components/progress-indicator/index.js.map +1 -1
  262. package/dist/es/components/progress-indicator/private/step.js.map +1 -1
  263. package/dist/es/components/progress-ring/index.js.map +1 -1
  264. package/dist/es/components/radio/index.js +1 -1
  265. package/dist/es/components/radio/index.js.map +1 -1
  266. package/dist/es/components/radio-group/check-props.js.map +1 -1
  267. package/dist/es/components/radio-group/index.js.map +1 -1
  268. package/dist/es/components/scoped-notification/index.js.map +1 -1
  269. package/dist/es/components/setup-assistant/step.js.map +1 -1
  270. package/dist/es/components/simple-data-table/cell.js +8 -5
  271. package/dist/es/components/simple-data-table/cell.js.map +1 -1
  272. package/dist/es/components/simple-data-table/index.js +97 -91
  273. package/dist/es/components/simple-data-table/index.js.map +1 -1
  274. package/dist/es/components/simple-data-table/interactive-element.js +31 -28
  275. package/dist/es/components/simple-data-table/interactive-element.js.map +1 -1
  276. package/dist/es/components/simple-data-table/private/cell-context.js.map +1 -1
  277. package/dist/es/components/simple-data-table/private/corner-style.js +9 -0
  278. package/dist/es/components/simple-data-table/private/corner-style.js.map +1 -0
  279. package/dist/es/components/simple-data-table/private/head.js +65 -42
  280. package/dist/es/components/simple-data-table/private/head.js.map +1 -1
  281. package/dist/es/components/simple-data-table/private/header-cell.js +2 -1
  282. package/dist/es/components/simple-data-table/private/header-cell.js.map +1 -1
  283. package/dist/es/components/simple-data-table/private/link.js.map +1 -1
  284. package/dist/es/components/simple-data-table/private/row.js +96 -60
  285. package/dist/es/components/simple-data-table/private/row.js.map +1 -1
  286. package/dist/es/components/simple-data-table/row-actions.js +4 -1
  287. package/dist/es/components/simple-data-table/row-actions.js.map +1 -1
  288. package/dist/es/components/slider/index.js.map +1 -1
  289. package/dist/es/components/split-view/header.js.map +1 -1
  290. package/dist/es/components/split-view/listbox.js.map +1 -1
  291. package/dist/es/components/split-view/private/list-item-with-content.js.map +1 -1
  292. package/dist/es/components/tabs/index.js.map +1 -1
  293. package/dist/es/components/tabs/panel.js.map +1 -1
  294. package/dist/es/components/tabs/private/tab.js +1 -1
  295. package/dist/es/components/tabs/private/tab.js.map +1 -1
  296. package/dist/es/components/textarea/check-props.js +1 -1
  297. package/dist/es/components/textarea/check-props.js.map +1 -1
  298. package/dist/es/components/textarea/index.js +29 -42
  299. package/dist/es/components/textarea/index.js.map +1 -1
  300. package/dist/es/components/toast/index.js.map +1 -1
  301. package/dist/es/components/tooltip/index.js +107 -88
  302. package/dist/es/components/tooltip/index.js.map +1 -1
  303. package/dist/es/components/tree/private/branch.js.map +1 -1
  304. package/dist/es/components/tree/private/item.js.map +1 -1
  305. package/dist/es/components/tree/private/render-branch.js +14 -19
  306. package/dist/es/components/tree/private/render-branch.js.map +1 -1
  307. package/dist/es/components/tree/tree.js.map +1 -1
  308. package/dist/es/components/trial-bar/button.js.map +1 -1
  309. package/dist/es/components/trial-bar/dropdown.js.map +1 -1
  310. package/dist/es/components/utilities/dialog/index.js +2 -1
  311. package/dist/es/components/utilities/dialog/index.js.map +1 -1
  312. package/dist/es/components/utilities/dialog/portal.js +5 -3
  313. package/dist/es/components/utilities/dialog/portal.js.map +1 -1
  314. package/dist/es/components/utilities/menu-list/index.js +6 -6
  315. package/dist/es/components/utilities/menu-list/index.js.map +1 -1
  316. package/dist/es/components/utilities/menu-list/item-label.js.map +1 -1
  317. package/dist/es/components/utilities/menu-list/item.js +42 -18
  318. package/dist/es/components/utilities/menu-list/item.js.map +1 -1
  319. package/dist/es/components/utilities/utility-icon/index.js +32 -52
  320. package/dist/es/components/utilities/utility-icon/index.js.map +1 -1
  321. package/dist/es/utilities/color.js +1 -1
  322. package/dist/es/utilities/color.js.map +1 -1
  323. package/dist/es/utilities/dom-element-focus.js.map +1 -1
  324. package/dist/es/utilities/execution-environment.js.map +1 -1
  325. package/dist/es/utilities/get-aria-props.js +1 -1
  326. package/dist/es/utilities/get-aria-props.js.map +1 -1
  327. package/dist/es/utilities/get-component-doc.js +6 -6
  328. package/dist/es/utilities/get-component-doc.js.map +1 -1
  329. package/dist/es/utilities/get-data-props.js +1 -1
  330. package/dist/es/utilities/get-data-props.js.map +1 -1
  331. package/dist/es/utilities/keyboard-navigable-dialog.js +7 -7
  332. package/dist/es/utilities/keyboard-navigable-dialog.js.map +1 -1
  333. package/dist/es/utilities/keyboard-navigate.js +1 -1
  334. package/dist/es/utilities/keyboard-navigate.js.map +1 -1
  335. package/dist/es/utilities/product-tokens/icon-backgrounds.js.map +1 -1
  336. package/dist/es/utilities/warning/children-as-trigger.js +10 -8
  337. package/dist/es/utilities/warning/children-as-trigger.js.map +1 -1
  338. package/dist/es/utilities/warning/deprecated-property-value.js +12 -10
  339. package/dist/es/utilities/warning/deprecated-property-value.js.map +1 -1
  340. package/dist/es/utilities/warning/deprecated-property.js +10 -8
  341. package/dist/es/utilities/warning/deprecated-property.js.map +1 -1
  342. package/dist/es/utilities/warning/has-children-without-display-name-of.js +11 -10
  343. package/dist/es/utilities/warning/has-children-without-display-name-of.js.map +1 -1
  344. package/dist/es/utilities/warning/if-one-then-both-required-property.js +10 -9
  345. package/dist/es/utilities/warning/if-one-then-both-required-property.js.map +1 -1
  346. package/dist/es/utilities/warning/is-trigger-tabbable.js +9 -8
  347. package/dist/es/utilities/warning/is-trigger-tabbable.js.map +1 -1
  348. package/dist/es/utilities/warning/low-priority-warning.js.map +1 -1
  349. package/dist/es/utilities/warning/one-of-required-property.js +11 -10
  350. package/dist/es/utilities/warning/one-of-required-property.js.map +1 -1
  351. package/dist/es/utilities/warning/only-one-of-properties.js +9 -8
  352. package/dist/es/utilities/warning/only-one-of-properties.js.map +1 -1
  353. package/dist/es/utilities/warning/removal-version.js +6 -0
  354. package/dist/es/utilities/warning/removal-version.js.map +1 -0
  355. package/dist/es/utilities/warning/render-function-return-contents-lack-display-name.js +14 -13
  356. package/dist/es/utilities/warning/render-function-return-contents-lack-display-name.js.map +1 -1
  357. package/dist/es/utilities/warning/required-property.js +8 -7
  358. package/dist/es/utilities/warning/required-property.js.map +1 -1
  359. package/dist/es/utilities/warning/sunset-property.js +8 -7
  360. package/dist/es/utilities/warning/sunset-property.js.map +1 -1
  361. package/dist/es/utilities/warning/warned-registry.js +10 -0
  362. package/dist/es/utilities/warning/warned-registry.js.map +1 -0
  363. package/dist/llms/components/accordion.md +267 -0
  364. package/dist/llms/components/alert.md +228 -0
  365. package/dist/llms/components/avatar.md +167 -0
  366. package/dist/llms/components/badge.md +153 -0
  367. package/dist/llms/components/breadcrumb.md +148 -0
  368. package/dist/llms/components/builder-header.examples.md +239 -0
  369. package/dist/llms/components/builder-header.md +736 -0
  370. package/dist/llms/components/button-group.md +167 -0
  371. package/dist/llms/components/button-stateful.md +246 -0
  372. package/dist/llms/components/button.md +661 -0
  373. package/dist/llms/components/card.md +368 -0
  374. package/dist/llms/components/carousel.md +365 -0
  375. package/dist/llms/components/checkbox.md +887 -0
  376. package/dist/llms/components/color-picker.md +591 -0
  377. package/dist/llms/components/combobox.examples.md +802 -0
  378. package/dist/llms/components/combobox.md +929 -0
  379. package/dist/llms/components/date-picker.md +546 -0
  380. package/dist/llms/components/docked-composer.md +173 -0
  381. package/dist/llms/components/dynamic-icon.md +226 -0
  382. package/dist/llms/components/expandable-section.md +198 -0
  383. package/dist/llms/components/files.md +337 -0
  384. package/dist/llms/components/filter.md +775 -0
  385. package/dist/llms/components/icon-settings.md +301 -0
  386. package/dist/llms/components/icon.md +1040 -0
  387. package/dist/llms/components/input.md +746 -0
  388. package/dist/llms/components/media-object.md +125 -0
  389. package/dist/llms/components/menu-dropdown.md +732 -0
  390. package/dist/llms/components/modal.md +504 -0
  391. package/dist/llms/components/page-header.md +282 -0
  392. package/dist/llms/components/panel.md +256 -0
  393. package/dist/llms/components/pill-container.md +218 -0
  394. package/dist/llms/components/pill.md +266 -0
  395. package/dist/llms/components/popover.md +600 -0
  396. package/dist/llms/components/portal-settings.md +371 -0
  397. package/dist/llms/components/progress-bar.md +175 -0
  398. package/dist/llms/components/progress-indicator.md +399 -0
  399. package/dist/llms/components/progress-ring.md +146 -0
  400. package/dist/llms/components/radio-button-group.md +285 -0
  401. package/dist/llms/components/radio-group.md +242 -0
  402. package/dist/llms/components/radio.md +269 -0
  403. package/dist/llms/components/scoped-notification.md +156 -0
  404. package/dist/llms/components/setup-assistant.md +398 -0
  405. package/dist/llms/components/simple-data-table.examples.md +2773 -0
  406. package/dist/llms/components/simple-data-table.md +919 -0
  407. package/dist/llms/components/slider.md +217 -0
  408. package/dist/llms/components/spinner.md +232 -0
  409. package/dist/llms/components/split-view.md +350 -0
  410. package/dist/llms/components/tabs.md +311 -0
  411. package/dist/llms/components/textarea.md +331 -0
  412. package/dist/llms/components/toast.md +267 -0
  413. package/dist/llms/components/tooltip.md +470 -0
  414. package/dist/llms/components/tree.md +1011 -0
  415. package/dist/llms/components/trial-bar.md +383 -0
  416. package/dist/llms/components/vertical-navigation.md +196 -0
  417. package/dist/llms/components/visual-picker.md +362 -0
  418. package/dist/llms/components/welcome-mat.md +885 -0
  419. package/dist/llms/docs/migration-v11.md +471 -0
  420. package/dist/llms/llms-full.txt +6874 -0
  421. package/dist/llms/llms.txt +133 -0
  422. package/dist/llms/rules.md +36 -0
  423. package/dist/types/components/accordion/index.d.ts.map +1 -1
  424. package/dist/types/components/accordion/panel.d.ts +7 -7
  425. package/dist/types/components/builder-header/nav-dropdown.d.ts +1 -0
  426. package/dist/types/components/builder-header/nav-dropdown.d.ts.map +1 -1
  427. package/dist/types/components/builder-header/nav-link.d.ts +0 -1
  428. package/dist/types/components/builder-header/nav-link.d.ts.map +1 -1
  429. package/dist/types/components/builder-header/toolbar.d.ts +0 -1
  430. package/dist/types/components/builder-header/toolbar.d.ts.map +1 -1
  431. package/dist/types/components/button/index.d.ts +19 -6
  432. package/dist/types/components/button/index.d.ts.map +1 -1
  433. package/dist/types/components/button-stateful/index.d.ts +8 -2
  434. package/dist/types/components/button-stateful/index.d.ts.map +1 -1
  435. package/dist/types/components/carousel/index.d.ts +7 -1
  436. package/dist/types/components/carousel/index.d.ts.map +1 -1
  437. package/dist/types/components/checkbox/index.d.ts +22 -5
  438. package/dist/types/components/checkbox/index.d.ts.map +1 -1
  439. package/dist/types/components/color-picker/color-picker.d.ts +6 -4
  440. package/dist/types/components/color-picker/color-picker.d.ts.map +1 -1
  441. package/dist/types/components/color-picker/types.d.ts +2 -2
  442. package/dist/types/components/combobox/combobox.d.ts +22 -0
  443. package/dist/types/components/combobox/combobox.d.ts.map +1 -1
  444. package/dist/types/components/combobox/index.d.ts +1 -1
  445. package/dist/types/components/combobox/index.d.ts.map +1 -1
  446. package/dist/types/components/date-picker/date-picker.d.ts +16 -4
  447. package/dist/types/components/date-picker/date-picker.d.ts.map +1 -1
  448. package/dist/types/components/date-picker/index.d.ts +2 -6
  449. package/dist/types/components/date-picker/index.d.ts.map +1 -1
  450. package/dist/types/components/files/file.d.ts +5 -0
  451. package/dist/types/components/files/file.d.ts.map +1 -1
  452. package/dist/types/components/icon/index.d.ts +8 -1
  453. package/dist/types/components/icon/index.d.ts.map +1 -1
  454. package/dist/types/components/icon/input-icon/index.d.ts +3 -0
  455. package/dist/types/components/icon/input-icon/index.d.ts.map +1 -1
  456. package/dist/types/components/icon-settings/index.d.ts.map +1 -1
  457. package/dist/types/components/input/index.d.ts +10 -6
  458. package/dist/types/components/input/index.d.ts.map +1 -1
  459. package/dist/types/components/input/search.d.ts.map +1 -1
  460. package/dist/types/components/menu-dropdown/button-trigger.d.ts +5 -0
  461. package/dist/types/components/menu-dropdown/button-trigger.d.ts.map +1 -1
  462. package/dist/types/components/menu-dropdown/menu-dropdown.d.ts +13 -3
  463. package/dist/types/components/menu-dropdown/menu-dropdown.d.ts.map +1 -1
  464. package/dist/types/components/modal/index.d.ts +5 -5
  465. package/dist/types/components/modal/index.d.ts.map +1 -1
  466. package/dist/types/components/page-header/types.d.ts +3 -0
  467. package/dist/types/components/page-header/types.d.ts.map +1 -1
  468. package/dist/types/components/panel/filtering/group.d.ts +2 -0
  469. package/dist/types/components/panel/filtering/group.d.ts.map +1 -1
  470. package/dist/types/components/pill/index.d.ts +1 -0
  471. package/dist/types/components/pill/index.d.ts.map +1 -1
  472. package/dist/types/components/popover/edit-dialog.d.ts +1 -3
  473. package/dist/types/components/popover/edit-dialog.d.ts.map +1 -1
  474. package/dist/types/components/popover/index.d.ts.map +1 -1
  475. package/dist/types/components/popover/popover.d.ts +1 -0
  476. package/dist/types/components/popover/popover.d.ts.map +1 -1
  477. package/dist/types/components/progress-indicator/index.d.ts +1 -0
  478. package/dist/types/components/progress-indicator/index.d.ts.map +1 -1
  479. package/dist/types/components/progress-ring/index.d.ts +1 -0
  480. package/dist/types/components/progress-ring/index.d.ts.map +1 -1
  481. package/dist/types/components/radio/index.d.ts +11 -4
  482. package/dist/types/components/radio/index.d.ts.map +1 -1
  483. package/dist/types/components/radio-group/index.d.ts +5 -3
  484. package/dist/types/components/radio-group/index.d.ts.map +1 -1
  485. package/dist/types/components/scoped-notification/index.d.ts +1 -0
  486. package/dist/types/components/scoped-notification/index.d.ts.map +1 -1
  487. package/dist/types/components/setup-assistant/step.d.ts +0 -1
  488. package/dist/types/components/setup-assistant/step.d.ts.map +1 -1
  489. package/dist/types/components/simple-data-table/cell.d.ts.map +1 -1
  490. package/dist/types/components/simple-data-table/index.d.ts.map +1 -1
  491. package/dist/types/components/simple-data-table/interactive-element.d.ts +8 -1
  492. package/dist/types/components/simple-data-table/interactive-element.d.ts.map +1 -1
  493. package/dist/types/components/simple-data-table/types.d.ts +11 -2
  494. package/dist/types/components/simple-data-table/types.d.ts.map +1 -1
  495. package/dist/types/components/slider/index.d.ts +6 -4
  496. package/dist/types/components/slider/index.d.ts.map +1 -1
  497. package/dist/types/components/split-view/listbox.d.ts.map +1 -1
  498. package/dist/types/components/split-view/private/list-item-with-content.d.ts.map +1 -1
  499. package/dist/types/components/tabs/index.d.ts +1 -0
  500. package/dist/types/components/tabs/index.d.ts.map +1 -1
  501. package/dist/types/components/tabs/panel.d.ts +2 -1
  502. package/dist/types/components/tabs/panel.d.ts.map +1 -1
  503. package/dist/types/components/textarea/index.d.ts +12 -40
  504. package/dist/types/components/textarea/index.d.ts.map +1 -1
  505. package/dist/types/components/toast/index.d.ts.map +1 -1
  506. package/dist/types/components/tooltip/index.d.ts +5 -0
  507. package/dist/types/components/tooltip/index.d.ts.map +1 -1
  508. package/dist/types/components/tree/tree.d.ts +5 -0
  509. package/dist/types/components/tree/tree.d.ts.map +1 -1
  510. package/dist/types/components/utilities/dialog/portal.d.ts.map +1 -1
  511. package/dist/types/components/utilities/menu-list/index.d.ts +2 -2
  512. package/dist/types/components/utilities/menu-list/index.d.ts.map +1 -1
  513. package/dist/types/components/utilities/menu-list/item-label.d.ts +12 -0
  514. package/dist/types/components/utilities/menu-list/item-label.d.ts.map +1 -1
  515. package/dist/types/components/utilities/menu-list/item.d.ts +14 -1
  516. package/dist/types/components/utilities/menu-list/item.d.ts.map +1 -1
  517. package/dist/types/components/utilities/truncate/index.d.ts.map +1 -1
  518. package/dist/types/components/utilities/utility-icon/index.d.ts +1 -1
  519. package/dist/types/components/utilities/utility-icon/index.d.ts.map +1 -1
  520. package/dist/types/types/common.d.ts.map +1 -1
  521. package/dist/types/types/components.d.ts.map +1 -1
  522. package/package.json +9 -7
  523. package/dist/cjs/icons/action/index.cjs +0 -2
  524. package/dist/cjs/icons/action/index.cjs.map +0 -1
  525. package/dist/cjs/icons/custom/index.cjs +0 -2
  526. package/dist/cjs/icons/custom/index.cjs.map +0 -1
  527. package/dist/cjs/icons/doctype/index.cjs +0 -2
  528. package/dist/cjs/icons/doctype/index.cjs.map +0 -1
  529. package/dist/cjs/icons/standard/index.cjs +0 -2
  530. package/dist/cjs/icons/standard/index.cjs.map +0 -1
  531. package/dist/cjs/icons/utility/index.cjs +0 -2
  532. package/dist/cjs/icons/utility/index.cjs.map +0 -1
  533. package/dist/es/icons/action/index.js +0 -6
  534. package/dist/es/icons/action/index.js.map +0 -1
  535. package/dist/es/icons/custom/index.js +0 -6
  536. package/dist/es/icons/custom/index.js.map +0 -1
  537. package/dist/es/icons/doctype/index.js +0 -6
  538. package/dist/es/icons/doctype/index.js.map +0 -1
  539. package/dist/es/icons/standard/index.js +0 -6
  540. package/dist/es/icons/standard/index.js.map +0 -1
  541. package/dist/es/icons/utility/index.js +0 -6
  542. package/dist/es/icons/utility/index.js.map +0 -1
  543. package/dist/types/icons/action/index.d.ts +0 -3
  544. package/dist/types/icons/action/index.d.ts.map +0 -1
  545. package/dist/types/icons/custom/index.d.ts +0 -3
  546. package/dist/types/icons/custom/index.d.ts.map +0 -1
  547. package/dist/types/icons/doctype/index.d.ts +0 -3
  548. package/dist/types/icons/doctype/index.d.ts.map +0 -1
  549. package/dist/types/icons/standard/index.d.ts +0 -3
  550. package/dist/types/icons/standard/index.d.ts.map +0 -1
  551. package/dist/types/icons/utility/index.d.ts +0 -3
  552. package/dist/types/icons/utility/index.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"listbox.js","names":[],"sources":["../../../../components/split-view/listbox.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable class-methods-use-this */\n\nimport React, { type ReactNode, type SyntheticEvent } from 'react';\nimport classNames from 'classnames';\nimport eventUtil from '../../utilities/event';\n\nimport { SPLIT_VIEW_LISTBOX } from '../../utilities/constants';\n\nimport Icon from '../icon';\nimport SplitViewListItemContent from './private/list-item-content';\nimport listItemWithContent from './private/list-item-with-content';\nimport checkProps, { checkSelectionProps } from './listbox-check-props';\nimport componentDoc from './component.json';\nimport type { SplitViewListItem } from './types';\n\nexport type { SplitViewListItem };\n\nexport const SORT_OPTIONS = Object.freeze({\n\tUP: 'up',\n\tDOWN: 'down',\n});\n\nexport interface SplitViewListboxSortAssistiveText {\n\tsortedBy?: string;\n\tdescending?: string;\n\tascending?: string;\n}\n\nexport interface SplitViewListboxAssistiveText {\n\tlist?: string;\n\tsort?: SplitViewListboxSortAssistiveText;\n\tunreadItem?: string;\n}\n\nexport interface SplitViewListboxSelectData<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/** The requested selection, as item ids. Pass it back as `selection`. */\n\tselection: SplitViewListboxItemId[];\n\t/** The items of the requested selection */\n\tselectedItems: T[];\n\t/** The item that was clicked, or the range anchor for select-all (`null` when deselecting all) */\n\titem: T | null;\n}\n\nexport interface SplitViewListboxEvents<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/**\n\t * Called when the selection is asked to change (click, meta/shift-click, Ctrl+A).\n\t * `data.selection` is the requested selection; update `selection` to apply it.\n\t */\n\tonSelect: (\n\t\tevent: SyntheticEvent,\n\t\tdata: SplitViewListboxSelectData<T>\n\t) => void;\n\t/**\n\t * Called when the list is sorted.\n\t */\n\tonSort?: (event: SyntheticEvent) => void;\n}\n\nexport interface SplitViewListboxLabels {\n\t/** This is the header of the list. */\n\theader?: string;\n}\n\n/** An item's `id`, as used in `selection` and `unread` */\nexport type SplitViewListboxItemId = string | number;\n\n/**\n * Fields read by the default list item. Items with other fields are typed by\n * the `SplitViewListbox` type parameter, which flows to `renderListItem`, `listItem` and `onSelect`.\n */\nexport type SplitViewListboxItem = SplitViewListItem & {\n\t/** Unique id of the item, matched against `selection` and `unread` */\n\tid: SplitViewListboxItemId;\n};\n\n/**\n * Data passed to `renderListItem`\n */\nexport interface SplitViewListboxRenderListItemData<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/** Whether the item has keyboard focus (is the list's tab stop) */\n\tisFocused: boolean;\n\t/** Whether the item is in `selection` */\n\tisSelected: boolean;\n\t/** Whether the item is in `unread` */\n\tisUnread: boolean;\n\t/** The item from `options` */\n\titem: T;\n}\n\nexport interface SplitViewListboxProps<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `list`: aria label for the list\n\t * * `sort`\n\t * * `sortedBy`: Clickable sort header for the list.\n\t * * `descending`: Descending sorting.\n\t * * `ascending`: Ascending sorting.\n\t */\n\tassistiveText?: SplitViewListboxAssistiveText;\n\t/**\n\t * CSS classes to be added to the parent `div` tag.\n\t */\n\tclassName?: unknown[] | Record<string, unknown> | string;\n\t/**\n\t * Event Callbacks\n\t * * `onSelect` (required): Called with `(event, { selection, selectedItems, item })` when the selection is asked to change. `selection` is the requested selection as item ids.\n\t * * `onSort`: Called when the list is sorted.\n\t */\n\tevents: SplitViewListboxEvents<T>;\n\t/**\n\t * HTML id for component.\n\t */\n\tid?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `header`: This is the header of the list.\n\t */\n\tlabels?: SplitViewListboxLabels;\n\t/**\n\t * The direction of the sort arrow. Option are:\n\t * * SORT_OPTIONS.UP: `up`\n\t * * SORT_OPTIONS.DOWN: `down`\n\t */\n\tsortDirection?: 'up' | 'down';\n\t/**\n\t * Allows multiple item to be selection\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * The list of items.\n\t * It is recommended that you have a unique `id` for each item.\n\t */\n\toptions: T[];\n\t/**\n\t * Ids (`item.id`) of the selected items (`[]` for none). The listbox is controlled: it renders this\n\t * selection and reports changes through `events.onSelect`. For single selection, pass an array of one id.\n\t *\n\t * Passing item objects is deprecated: they are still matched by `id` (or by identity when an item\n\t * has no `id`), and the listbox warns.\n\t */\n\tselection: SplitViewListboxItemId[] | T[];\n\t/**\n\t * Ids (`item.id`) of the unread items.\n\t *\n\t * Passing item objects is deprecated: they are still matched by `id` (or by identity when an item\n\t * has no `id`), and the listbox warns.\n\t */\n\tunread?: SplitViewListboxItemId[] | T[];\n\t/**\n\t * @deprecated Use `renderListItem` instead, which is called as a function with `{ isFocused, isSelected, isUnread, item }`.\n\t */\n\tlistItem?: React.ComponentType<{ item: T }>;\n\t/**\n\t * Renders the content of each list item in place of the default label and text. The listbox still renders the option, its selection and the unread indicator around it. Receives `{ isFocused, isSelected, isUnread, item }`.\n\t */\n\trenderListItem?: (data: SplitViewListboxRenderListItemData<T>) => ReactNode;\n}\n\ninterface SplitViewListboxState<T extends SplitViewListboxItem> {\n\t/** Anchor of shift-click range selection: the last clicked item (ephemeral, not the selection) */\n\tanchorItem: T | null;\n\tcurrentFocusedListItem: {\n\t\tindex: number;\n\t\titem: T | null;\n\t};\n}\n\n// Typed by its keys (not `Partial<SplitViewListboxProps>`) so JSX still requires the other props\nconst defaultProps = {\n\tassistiveText: {\n\t\tlist: 'Select an item to open it in a new workspace tab.',\n\t\tsort: {\n\t\t\tsortedBy: 'Sorted by',\n\t\t\tdescending: 'Descending',\n\t\t\tascending: 'Ascending',\n\t\t},\n\t},\n\tlabels: {},\n} satisfies Partial<SplitViewListboxProps>;\n\nconst EMPTY: never[] = [];\n\n/**\n * Key an item, or an entry of `selection`/`unread`, is matched by: the id, or for an item object\n * without an `id` (deprecated object entries only), the object itself.\n */\nconst toKey = (entry: unknown): unknown =>\n\tentry !== null && typeof entry === 'object'\n\t\t? ((entry as { id?: unknown }).id ?? entry)\n\t\t: entry;\n\n/**\n * The menu with the ARIA role of a listbox.\n */\nclass SplitViewListbox<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> extends React.Component<SplitViewListboxProps<T>, SplitViewListboxState<T>> {\n\tstatic displayName = SPLIT_VIEW_LISTBOX;\n\n\tstatic defaultProps = defaultProps;\n\n\tlistItemComponents: Record<number, HTMLAnchorElement>;\n\n\tListItemWithContent: ReturnType<typeof listItemWithContent>;\n\n\tconstructor(props: SplitViewListboxProps<T>) {\n\t\tsuper(props);\n\n\t\tthis.listItemComponents = {};\n\n\t\tthis.state = {\n\t\t\tanchorItem: null,\n\t\t\tcurrentFocusedListItem: {\n\t\t\t\tindex: 0,\n\t\t\t\titem: null,\n\t\t\t},\n\t\t};\n\n\t\tcheckProps(SPLIT_VIEW_LISTBOX, props, componentDoc);\n\n\t\t// Generates the list item template\n\t\tthis.ListItemWithContent = listItemWithContent(\n\t\t\t(props.listItem as unknown as React.ComponentType<\n\t\t\t\timport('./private/list-item-with-content').ListItemWithContentProps\n\t\t\t>) ||\n\t\t\t\t(SplitViewListItemContent as unknown as React.ComponentType<\n\t\t\t\t\timport('./private/list-item-with-content').ListItemWithContentProps\n\t\t\t\t>)\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tcheckSelectionProps(SPLIT_VIEW_LISTBOX, this.props, componentDoc);\n\t\tthis.focusFirstItem();\n\t}\n\n\tcomponentDidUpdate() {\n\t\tcheckSelectionProps(SPLIT_VIEW_LISTBOX, this.props, componentDoc);\n\t}\n\n\tisListItemFocused(item: T) {\n\t\tconst focusedItem = this.state.currentFocusedListItem.item;\n\t\treturn focusedItem !== null && toKey(focusedItem) === toKey(item);\n\t}\n\n\tisSelected(item: T) {\n\t\tconst key = toKey(item);\n\t\treturn (this.props.selection || EMPTY).some(\n\t\t\t(entry: unknown) => toKey(entry) === key\n\t\t);\n\t}\n\n\tisUnread(item: T) {\n\t\tconst key = toKey(item);\n\t\treturn (this.props.unread || EMPTY).some(\n\t\t\t(entry: unknown) => toKey(entry) === key\n\t\t);\n\t}\n\n\t/** The selected items, in `options` order */\n\tselectedItems(): T[] {\n\t\treturn this.props.options.filter((item) => this.isSelected(item));\n\t}\n\n\tindexOfItem(item: T | null): number {\n\t\tconst key = item === null ? undefined : toKey(item);\n\t\treturn key === undefined\n\t\t\t? -1\n\t\t\t: this.props.options.findIndex((option) => toKey(option) === key);\n\t}\n\n\treportSelection(event: SyntheticEvent, selectedItems: T[], item: T | null) {\n\t\tthis.props.events?.onSelect?.(event, {\n\t\t\tselection: selectedItems.map((selectedItem) => selectedItem.id),\n\t\t\tselectedItems,\n\t\t\titem,\n\t\t});\n\t}\n\n\thandleKeyDown(event: React.KeyboardEvent) {\n\t\tif (this.props.multiple && event.key === 'a' && event.ctrlKey) {\n\t\t\t// select / deselect all\n\t\t\teventUtil.trap(event);\n\t\t\tconst { options } = this.props;\n\t\t\tif (\n\t\t\t\toptions.length > 0 &&\n\t\t\t\toptions.every((option) => this.isSelected(option))\n\t\t\t) {\n\t\t\t\tthis.deselectAllListItems(event);\n\t\t\t} else {\n\t\t\t\tthis.selectAllListItems(event);\n\t\t\t}\n\t\t} else if (event.key === 'ArrowUp') {\n\t\t\teventUtil.trap(event);\n\t\t\tthis.moveToPreviousItem(event);\n\t\t} else if (event.key === 'ArrowDown') {\n\t\t\teventUtil.trap(event);\n\t\t\tthis.moveToNextItem(event);\n\t\t}\n\t}\n\n\tmoveToNextItem(event: SyntheticEvent) {\n\t\tconst nextFocusIndex =\n\t\t\tthis.state.currentFocusedListItem.index === this.props.options.length - 1\n\t\t\t\t? 0\n\t\t\t\t: this.state.currentFocusedListItem.index + 1;\n\n\t\tthis.moveToIndex(event, nextFocusIndex);\n\t}\n\n\tmoveToPreviousItem(event: SyntheticEvent) {\n\t\tconst previousFocusIndex =\n\t\t\tthis.state.currentFocusedListItem.index === 0\n\t\t\t\t? this.props.options.length - 1\n\t\t\t\t: this.state.currentFocusedListItem.index - 1;\n\n\t\tthis.moveToIndex(event, previousFocusIndex);\n\t}\n\n\tmoveToIndex(event: SyntheticEvent, index: number) {\n\t\tconst item = this.props.options[index];\n\n\t\tthis.focusItem(item);\n\t}\n\n\tfocusFirstItem() {\n\t\tconst firstSelectedItem =\n\t\t\tthis.props.options.find((item) => this.isSelected(item)) ||\n\t\t\tthis.props.options[0];\n\n\t\tif (firstSelectedItem) {\n\t\t\tthis.focusItem(firstSelectedItem, true);\n\t\t}\n\t}\n\n\tfocusItem(item: T, setDataOnly?: boolean) {\n\t\tconst index = this.props.options.indexOf(item);\n\n\t\tif (!setDataOnly) {\n\t\t\tthis.listItemComponents[index].focus();\n\t\t}\n\n\t\tthis.setState({\n\t\t\tcurrentFocusedListItem: {\n\t\t\t\tindex,\n\t\t\t\titem,\n\t\t\t},\n\t\t});\n\t}\n\n\tdeselectAllListItems(event: SyntheticEvent) {\n\t\tthis.setState({ anchorItem: null });\n\t\tthis.reportSelection(event, [], null);\n\t}\n\n\tselectAllListItems(event: SyntheticEvent) {\n\t\tthis.reportSelection(event, [...this.props.options], this.state.anchorItem);\n\t}\n\n\t// Reports the requested selection. The rendered selection only changes when `selection` does.\n\tselectListItem(item: T, event: React.MouseEvent) {\n\t\tlet selectedItems = [item];\n\n\t\tif (this.props.multiple) {\n\t\t\tconst currentItems = this.selectedItems();\n\t\t\tif (event.metaKey) {\n\t\t\t\tselectedItems = this.isSelected(item)\n\t\t\t\t\t? currentItems.filter((i) => toKey(i) !== toKey(item))\n\t\t\t\t\t: [item, ...currentItems];\n\t\t\t} else if (event.shiftKey) {\n\t\t\t\tconst itemIndex = this.indexOfItem(item);\n\t\t\t\t// Without an earlier click, the range starts at the first selected item\n\t\t\t\tconst anchorIndex = [\n\t\t\t\t\tthis.indexOfItem(this.state.anchorItem),\n\t\t\t\t\tthis.indexOfItem(currentItems[0] ?? null),\n\t\t\t\t\titemIndex,\n\t\t\t\t].find((index) => index !== -1) as number;\n\t\t\t\tconst begin = Math.min(anchorIndex, itemIndex);\n\t\t\t\tconst end = Math.max(anchorIndex, itemIndex);\n\n\t\t\t\tconst addToSelection = this.props.options.slice(begin, end + 1);\n\t\t\t\tconst addedKeys = addToSelection.map(toKey);\n\n\t\t\t\tselectedItems = [\n\t\t\t\t\t...addToSelection,\n\t\t\t\t\t...currentItems.filter((i) => !addedKeys.includes(toKey(i))),\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\n\t\tthis.setState({ anchorItem: item });\n\n\t\tthis.reportSelection(event, selectedItems, item);\n\t}\n\n\thandleOnSelect(event: React.MouseEvent, { item }: { item: T }) {\n\t\tthis.selectListItem(item, event);\n\t\tthis.focusItem(item);\n\t}\n\n\tsortDirection(): ReactNode {\n\t\treturn this.props.sortDirection ? (\n\t\t\t<Icon\n\t\t\t\tcategory=\"utility\"\n\t\t\t\tname={\n\t\t\t\t\tthis.props.sortDirection === SORT_OPTIONS.DOWN\n\t\t\t\t\t\t? 'arrowdown'\n\t\t\t\t\t\t: 'arrowup'\n\t\t\t\t}\n\t\t\t\tsize=\"xx-small\"\n\t\t\t\tclassName=\"slds-align-top\"\n\t\t\t/>\n\t\t) : null;\n\t}\n\n\theaderWrapper(children: ReactNode): ReactNode {\n\t\treturn this.props.events?.onSort ? (\n\t\t\t<a\n\t\t\t\taria-live=\"polite\"\n\t\t\t\tstyle={{ borderTop: '0' }}\n\t\t\t\thref=\"#\"\n\t\t\t\trole=\"button\"\n\t\t\t\tclassName=\"slds-split-view__list-header slds-grid slds-text-link_reset\"\n\t\t\t\tonClick={eventUtil.trappedHandler(this.props.events.onSort)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</a>\n\t\t) : (\n\t\t\t<div\n\t\t\t\tstyle={{ borderTop: '0' }}\n\t\t\t\tclassName=\"slds-split-view__list-header slds-grid\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n\n\theader(): ReactNode {\n\t\tconst sort = this.props.assistiveText?.sort || {};\n\t\treturn this.props.labels?.header\n\t\t\t? this.headerWrapper(\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-sort={\n\t\t\t\t\t\t\t(this.props.sortDirection === SORT_OPTIONS.DOWN\n\t\t\t\t\t\t\t\t? sort.descending\n\t\t\t\t\t\t\t\t: sort.ascending) as React.AriaAttributes['aria-sort']\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t{sort.sortedBy}\n\t\t\t\t\t\t\t{': '}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{this.props.labels.header}\n\t\t\t\t\t\t\t{this.sortDirection()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t{'- '}\n\t\t\t\t\t\t\t{this.props.sortDirection === SORT_OPTIONS.DOWN\n\t\t\t\t\t\t\t\t? sort.descending\n\t\t\t\t\t\t\t\t: sort.ascending}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t)\n\t\t\t: null;\n\t}\n\n\taddListItemComponent(component: HTMLAnchorElement, index: number) {\n\t\tthis.listItemComponents[index] = component;\n\t}\n\n\tlistItems(): ReactNode {\n\t\tconst { ListItemWithContent } = this;\n\t\tconst { renderListItem } = this.props;\n\n\t\treturn this.props.options.map((item, index) => (\n\t\t\t<ListItemWithContent\n\t\t\t\tkey={item.id || index}\n\t\t\t\tassistiveText={{\n\t\t\t\t\tunreadItem: this.props.assistiveText?.unreadItem,\n\t\t\t\t}}\n\t\t\t\tlistItemRef={(component: HTMLAnchorElement | null) => {\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.addListItemComponent(component, index);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\titem={item}\n\t\t\t\tisFocused={this.isListItemFocused(item)}\n\t\t\t\tisSelected={this.isSelected(item)}\n\t\t\t\tisUnread={this.isUnread(item)}\n\t\t\t\tevents={{\n\t\t\t\t\tonClick: (event, meta) =>\n\t\t\t\t\t\tthis.handleOnSelect(event, {\n\t\t\t\t\t\t\titem: meta.item as T,\n\t\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t\tmultiple={this.props.multiple}\n\t\t\t\trenderContent={\n\t\t\t\t\trenderListItem\n\t\t\t\t\t\t? (data) => renderListItem({ ...data, item })\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t/>\n\t\t));\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tid={this.props.id}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-grid slds-grid_vertical slds-scrollable_none',\n\t\t\t\t\tthis.props.className as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{this.header()}\n\t\t\t\t<ul\n\t\t\t\t\tclassName=\"slds-scrollable_y\"\n\t\t\t\t\taria-label={this.props.assistiveText?.list}\n\t\t\t\t\taria-multiselectable={this.props.multiple}\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tonKeyDown={(event) => this.handleKeyDown(event)}\n\t\t\t\t>\n\t\t\t\t\t{this.listItems()}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default SplitViewListbox;\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,IAAe,OAAO,OAAO;CACzC,IAAI;CACJ,MAAM;AACP,CAAC,GA4JK,IAAe;CACpB,eAAe;EACd,MAAM;EACN,MAAM;GACL,UAAU;GACV,YAAY;GACZ,WAAW;EACZ;CACD;CACA,QAAQ,CAAC;AACV,GAEM,IAAiB,CAAC,GAMlB,KAAS,MACI,OAAO,KAAU,YAAnC,IACK,EAA2B,MAAM,IACnC,GAKE,IAAN,cAEU,EAAM,UAA8D;CAC7E,OAAO,cAAc;CAErB,OAAO,eAAe;CAEtB;CAEA;CAEA,YAAY,GAAiC;EAgB5C,AAfA,MAAM,CAAK,GAEX,KAAK,qBAAqB,CAAC,GAE3B,KAAK,QAAQ;GACZ,YAAY;GACZ,wBAAwB;IACvB,OAAO;IACP,MAAM;GACP;EACD,GAEA,EAAW,GAAoB,GAAO,CAAY,GAGlD,KAAK,sBAAsB,EACzB,EAAM,YAGL,CAGH;CACD;CAEA,oBAAoB;EAEnB,AADA,EAAoB,GAAoB,KAAK,OAAO,CAAY,GAChE,KAAK,eAAe;CACrB;CAEA,qBAAqB;EACpB,EAAoB,GAAoB,KAAK,OAAO,CAAY;CACjE;CAEA,kBAAkB,GAAS;EAC1B,IAAM,IAAc,KA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cAAc,CAAK;IAE7C,UAAA,KAAK,UAAU;GACb,CAAA,CACA;;CAEP;AACD"}
1
+ {"version":3,"file":"listbox.js","names":[],"sources":["../../../../components/split-view/listbox.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable class-methods-use-this */\n\nimport React, { type ReactNode, type SyntheticEvent } from 'react';\nimport classNames from 'classnames';\nimport eventUtil from '../../utilities/event';\n\nimport { SPLIT_VIEW_LISTBOX } from '../../utilities/constants';\n\nimport Icon from '../icon';\nimport SplitViewListItemContent from './private/list-item-content';\nimport listItemWithContent from './private/list-item-with-content';\nimport checkProps, { checkSelectionProps } from './listbox-check-props';\nimport componentDoc from './component.json';\nimport type { SplitViewListItem } from './types';\n\nexport type { SplitViewListItem };\n\nexport const SORT_OPTIONS = Object.freeze({\n\tUP: 'up',\n\tDOWN: 'down',\n});\n\nexport interface SplitViewListboxSortAssistiveText {\n\tsortedBy?: string;\n\tdescending?: string;\n\tascending?: string;\n}\n\nexport interface SplitViewListboxAssistiveText {\n\tlist?: string;\n\tsort?: SplitViewListboxSortAssistiveText;\n\tunreadItem?: string;\n}\n\nexport interface SplitViewListboxSelectData<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/** The requested selection, as item ids. Pass it back as `selection`. */\n\tselection: SplitViewListboxItemId[];\n\t/** The items of the requested selection */\n\tselectedItems: T[];\n\t/** The item that was clicked, or the range anchor for select-all (`null` when deselecting all) */\n\titem: T | null;\n}\n\nexport interface SplitViewListboxEvents<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/**\n\t * Called when the selection is asked to change (click, meta/shift-click, Ctrl+A).\n\t * `data.selection` is the requested selection; update `selection` to apply it.\n\t */\n\tonSelect: (\n\t\tevent: SyntheticEvent,\n\t\tdata: SplitViewListboxSelectData<T>\n\t) => void;\n\t/**\n\t * Called when the list is sorted.\n\t */\n\tonSort?: (event: SyntheticEvent) => void;\n}\n\nexport interface SplitViewListboxLabels {\n\t/** This is the header of the list. */\n\theader?: string;\n}\n\n/** An item's `id`, as used in `selection` and `unread` */\nexport type SplitViewListboxItemId = string | number;\n\n/**\n * Fields read by the default list item. Items with other fields are typed by\n * the `SplitViewListbox` type parameter, which flows to `renderListItem`, `listItem` and `onSelect`.\n */\nexport type SplitViewListboxItem = SplitViewListItem & {\n\t/** Unique id of the item, matched against `selection` and `unread` */\n\tid: SplitViewListboxItemId;\n};\n\n/**\n * Data passed to `renderListItem`\n */\nexport interface SplitViewListboxRenderListItemData<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/** Whether the item has keyboard focus (is the list's tab stop) */\n\tisFocused: boolean;\n\t/** Whether the item is in `selection` */\n\tisSelected: boolean;\n\t/** Whether the item is in `unread` */\n\tisUnread: boolean;\n\t/** The item from `options` */\n\titem: T;\n}\n\nexport interface SplitViewListboxProps<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `list`: aria label for the list\n\t * * `sort`\n\t * * `sortedBy`: Clickable sort header for the list.\n\t * * `descending`: Descending sorting.\n\t * * `ascending`: Ascending sorting.\n\t */\n\tassistiveText?: SplitViewListboxAssistiveText;\n\t/**\n\t * CSS classes to be added to the parent `div` tag.\n\t */\n\tclassName?: unknown[] | Record<string, unknown> | string;\n\t/**\n\t * Event Callbacks\n\t * * `onSelect` (required): Called with `(event, { selection, selectedItems, item })` when the selection is asked to change. `selection` is the requested selection as item ids.\n\t * * `onSort`: Called when the list is sorted.\n\t */\n\tevents: SplitViewListboxEvents<T>;\n\t/**\n\t * HTML id for component.\n\t */\n\tid?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `header`: This is the header of the list.\n\t */\n\tlabels?: SplitViewListboxLabels;\n\t/**\n\t * The direction of the sort arrow. Option are:\n\t * * SORT_OPTIONS.UP: `up`\n\t * * SORT_OPTIONS.DOWN: `down`\n\t */\n\tsortDirection?: 'up' | 'down';\n\t/**\n\t * Allows multiple item to be selection\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * The list of items.\n\t * It is recommended that you have a unique `id` for each item.\n\t */\n\toptions: T[];\n\t/**\n\t * Ids (`item.id`) of the selected items (`[]` for none). The listbox is controlled: it renders this\n\t * selection and reports changes through `events.onSelect`. For single selection, pass an array of one id.\n\t *\n\t * Passing item objects is deprecated: they are still matched by `id` (or by identity when an item\n\t * has no `id`), and the listbox warns.\n\t */\n\tselection: SplitViewListboxItemId[] | T[];\n\t/**\n\t * Ids (`item.id`) of the unread items.\n\t *\n\t * Passing item objects is deprecated: they are still matched by `id` (or by identity when an item\n\t * has no `id`), and the listbox warns.\n\t */\n\tunread?: SplitViewListboxItemId[] | T[];\n\t/**\n\t * @deprecated Use `renderListItem` instead, which is called as a function with `{ isFocused, isSelected, isUnread, item }`.\n\t */\n\tlistItem?: React.ComponentType<{ item: T }>;\n\t/**\n\t * Renders the content of each list item in place of the default label and text. The listbox still renders the option, its selection and the unread indicator around it. Receives `{ isFocused, isSelected, isUnread, item }`.\n\t */\n\trenderListItem?: (data: SplitViewListboxRenderListItemData<T>) => ReactNode;\n}\n\ninterface SplitViewListboxState<T extends SplitViewListboxItem> {\n\t/** Anchor of shift-click range selection: the last clicked item (ephemeral, not the selection) */\n\tanchorItem: T | null;\n\tcurrentFocusedListItem: {\n\t\tindex: number;\n\t\titem: T | null;\n\t};\n}\n\n// Typed by its keys (not `Partial<SplitViewListboxProps>`) so JSX still requires the other props\nconst defaultProps = {\n\tassistiveText: {\n\t\tlist: 'Select an item to open it in a new workspace tab.',\n\t\tsort: {\n\t\t\tsortedBy: 'Sorted by',\n\t\t\tdescending: 'Descending',\n\t\t\tascending: 'Ascending',\n\t\t},\n\t},\n\tlabels: {},\n} satisfies Partial<SplitViewListboxProps>;\n\nconst EMPTY: never[] = [];\n\n/**\n * Key an item, or an entry of `selection`/`unread`, is matched by: the id, or for an item object\n * without an `id` (deprecated object entries only), the object itself.\n */\nconst toKey = (entry: unknown): unknown =>\n\tentry !== null && typeof entry === 'object'\n\t\t? ((entry as { id?: unknown }).id ?? entry)\n\t\t: entry;\n\n/**\n * The menu with the ARIA role of a listbox.\n */\nclass SplitViewListbox<\n\tT extends SplitViewListboxItem = SplitViewListboxItem,\n> extends React.Component<SplitViewListboxProps<T>, SplitViewListboxState<T>> {\n\tstatic displayName = SPLIT_VIEW_LISTBOX;\n\n\tstatic defaultProps = defaultProps;\n\n\tlistItemComponents: Record<number, HTMLAnchorElement>;\n\n\tListItemWithContent: ReturnType<typeof listItemWithContent>;\n\n\tconstructor(props: SplitViewListboxProps<T>) {\n\t\tsuper(props);\n\n\t\tthis.listItemComponents = {};\n\n\t\tthis.state = {\n\t\t\tanchorItem: null,\n\t\t\tcurrentFocusedListItem: {\n\t\t\t\tindex: 0,\n\t\t\t\titem: null,\n\t\t\t},\n\t\t};\n\n\t\tcheckProps(SPLIT_VIEW_LISTBOX, props, componentDoc);\n\n\t\t// Generates the list item template\n\t\tthis.ListItemWithContent = listItemWithContent(\n\t\t\t(props.listItem as unknown as React.ComponentType<\n\t\t\t\timport('./private/list-item-with-content').ListItemWithContentProps\n\t\t\t>) ||\n\t\t\t\t(SplitViewListItemContent as unknown as React.ComponentType<\n\t\t\t\t\timport('./private/list-item-with-content').ListItemWithContentProps\n\t\t\t\t>)\n\t\t);\n\t}\n\n\tcomponentDidMount() {\n\t\tcheckSelectionProps(SPLIT_VIEW_LISTBOX, this.props, componentDoc);\n\t\tthis.focusFirstItem();\n\t}\n\n\tcomponentDidUpdate() {\n\t\tcheckSelectionProps(SPLIT_VIEW_LISTBOX, this.props, componentDoc);\n\t}\n\n\tisListItemFocused(item: T) {\n\t\tconst focusedItem = this.state.currentFocusedListItem.item;\n\t\treturn focusedItem !== null && toKey(focusedItem) === toKey(item);\n\t}\n\n\tisSelected(item: T) {\n\t\tconst key = toKey(item);\n\t\treturn (this.props.selection || EMPTY).some(\n\t\t\t(entry: unknown) => toKey(entry) === key\n\t\t);\n\t}\n\n\tisUnread(item: T) {\n\t\tconst key = toKey(item);\n\t\treturn (this.props.unread || EMPTY).some(\n\t\t\t(entry: unknown) => toKey(entry) === key\n\t\t);\n\t}\n\n\t/** The selected items, in `options` order */\n\tselectedItems(): T[] {\n\t\treturn this.props.options.filter((item) => this.isSelected(item));\n\t}\n\n\tindexOfItem(item: T | null): number {\n\t\tconst key = item === null ? undefined : toKey(item);\n\t\treturn key === undefined\n\t\t\t? -1\n\t\t\t: this.props.options.findIndex((option) => toKey(option) === key);\n\t}\n\n\treportSelection(event: SyntheticEvent, selectedItems: T[], item: T | null) {\n\t\tthis.props.events?.onSelect?.(event, {\n\t\t\tselection: selectedItems.map((selectedItem) => selectedItem.id),\n\t\t\tselectedItems,\n\t\t\titem,\n\t\t});\n\t}\n\n\thandleKeyDown(event: React.KeyboardEvent) {\n\t\tif (this.props.multiple && event.key === 'a' && event.ctrlKey) {\n\t\t\t// select / deselect all\n\t\t\teventUtil.trap(event);\n\t\t\tconst { options } = this.props;\n\t\t\tif (\n\t\t\t\toptions.length > 0 &&\n\t\t\t\toptions.every((option) => this.isSelected(option))\n\t\t\t) {\n\t\t\t\tthis.deselectAllListItems(event);\n\t\t\t} else {\n\t\t\t\tthis.selectAllListItems(event);\n\t\t\t}\n\t\t} else if (event.key === 'ArrowUp') {\n\t\t\teventUtil.trap(event);\n\t\t\tthis.moveToPreviousItem(event);\n\t\t} else if (event.key === 'ArrowDown') {\n\t\t\teventUtil.trap(event);\n\t\t\tthis.moveToNextItem(event);\n\t\t}\n\t}\n\n\tmoveToNextItem(event: SyntheticEvent) {\n\t\tconst nextFocusIndex =\n\t\t\tthis.state.currentFocusedListItem.index === this.props.options.length - 1\n\t\t\t\t? 0\n\t\t\t\t: this.state.currentFocusedListItem.index + 1;\n\n\t\tthis.moveToIndex(event, nextFocusIndex);\n\t}\n\n\tmoveToPreviousItem(event: SyntheticEvent) {\n\t\tconst previousFocusIndex =\n\t\t\tthis.state.currentFocusedListItem.index === 0\n\t\t\t\t? this.props.options.length - 1\n\t\t\t\t: this.state.currentFocusedListItem.index - 1;\n\n\t\tthis.moveToIndex(event, previousFocusIndex);\n\t}\n\n\tmoveToIndex(event: SyntheticEvent, index: number) {\n\t\tconst item = this.props.options[index];\n\n\t\tthis.focusItem(item);\n\t}\n\n\tfocusFirstItem() {\n\t\tconst firstSelectedItem =\n\t\t\tthis.props.options.find((item) => this.isSelected(item)) ||\n\t\t\tthis.props.options[0];\n\n\t\tif (firstSelectedItem) {\n\t\t\tthis.focusItem(firstSelectedItem, true);\n\t\t}\n\t}\n\n\tfocusItem(item: T, setDataOnly?: boolean) {\n\t\tconst index = this.props.options.indexOf(item);\n\n\t\tif (!setDataOnly) {\n\t\t\tthis.listItemComponents[index].focus();\n\t\t}\n\n\t\tthis.setState({\n\t\t\tcurrentFocusedListItem: {\n\t\t\t\tindex,\n\t\t\t\titem,\n\t\t\t},\n\t\t});\n\t}\n\n\tdeselectAllListItems(event: SyntheticEvent) {\n\t\tthis.setState({ anchorItem: null });\n\t\tthis.reportSelection(event, [], null);\n\t}\n\n\tselectAllListItems(event: SyntheticEvent) {\n\t\tthis.reportSelection(event, [...this.props.options], this.state.anchorItem);\n\t}\n\n\t// Reports the requested selection. The rendered selection only changes when `selection` does.\n\tselectListItem(item: T, event: React.MouseEvent) {\n\t\tlet selectedItems = [item];\n\n\t\tif (this.props.multiple) {\n\t\t\tconst currentItems = this.selectedItems();\n\t\t\tif (event.metaKey) {\n\t\t\t\tselectedItems = this.isSelected(item)\n\t\t\t\t\t? currentItems.filter((i) => toKey(i) !== toKey(item))\n\t\t\t\t\t: [item, ...currentItems];\n\t\t\t} else if (event.shiftKey) {\n\t\t\t\tconst itemIndex = this.indexOfItem(item);\n\t\t\t\t// Without an earlier click, the range starts at the first selected item\n\t\t\t\tconst anchorIndex = [\n\t\t\t\t\tthis.indexOfItem(this.state.anchorItem),\n\t\t\t\t\tthis.indexOfItem(currentItems[0] ?? null),\n\t\t\t\t\titemIndex,\n\t\t\t\t].find((index) => index !== -1) as number;\n\t\t\t\tconst begin = Math.min(anchorIndex, itemIndex);\n\t\t\t\tconst end = Math.max(anchorIndex, itemIndex);\n\n\t\t\t\tconst addToSelection = this.props.options.slice(begin, end + 1);\n\t\t\t\tconst addedKeys = addToSelection.map(toKey);\n\n\t\t\t\tselectedItems = [\n\t\t\t\t\t...addToSelection,\n\t\t\t\t\t...currentItems.filter((i) => !addedKeys.includes(toKey(i))),\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\n\t\tthis.setState({ anchorItem: item });\n\n\t\tthis.reportSelection(event, selectedItems, item);\n\t}\n\n\thandleOnSelect(event: React.MouseEvent, { item }: { item: T }) {\n\t\tthis.selectListItem(item, event);\n\t\tthis.focusItem(item);\n\t}\n\n\tsortDirection(): ReactNode {\n\t\treturn this.props.sortDirection ? (\n\t\t\t<Icon\n\t\t\t\tcategory=\"utility\"\n\t\t\t\tname={\n\t\t\t\t\tthis.props.sortDirection === SORT_OPTIONS.DOWN\n\t\t\t\t\t\t? 'arrowdown'\n\t\t\t\t\t\t: 'arrowup'\n\t\t\t\t}\n\t\t\t\tsize=\"xx-small\"\n\t\t\t\tclassName=\"slds-align-top\"\n\t\t\t/>\n\t\t) : null;\n\t}\n\n\theaderWrapper(children: ReactNode): ReactNode {\n\t\treturn this.props.events?.onSort ? (\n\t\t\t// eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS split view header markup uses an anchor for sorting\n\t\t\t<a\n\t\t\t\taria-live=\"polite\"\n\t\t\t\tstyle={{ borderTop: '0' }}\n\t\t\t\thref=\"#\"\n\t\t\t\trole=\"button\"\n\t\t\t\tclassName=\"slds-split-view__list-header slds-grid slds-text-link_reset\"\n\t\t\t\tonClick={eventUtil.trappedHandler(this.props.events.onSort)}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</a>\n\t\t) : (\n\t\t\t<div\n\t\t\t\tstyle={{ borderTop: '0' }}\n\t\t\t\tclassName=\"slds-split-view__list-header slds-grid\"\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n\n\theader(): ReactNode {\n\t\tconst sort = this.props.assistiveText?.sort || {};\n\t\treturn this.props.labels?.header\n\t\t\t? this.headerWrapper(\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-sort={\n\t\t\t\t\t\t\t(this.props.sortDirection === SORT_OPTIONS.DOWN\n\t\t\t\t\t\t\t\t? sort.descending\n\t\t\t\t\t\t\t\t: sort.ascending) as React.AriaAttributes['aria-sort']\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t{sort.sortedBy}\n\t\t\t\t\t\t\t{': '}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{this.props.labels.header}\n\t\t\t\t\t\t\t{this.sortDirection()}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t\t\t\t{'- '}\n\t\t\t\t\t\t\t{this.props.sortDirection === SORT_OPTIONS.DOWN\n\t\t\t\t\t\t\t\t? sort.descending\n\t\t\t\t\t\t\t\t: sort.ascending}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t)\n\t\t\t: null;\n\t}\n\n\taddListItemComponent(component: HTMLAnchorElement, index: number) {\n\t\tthis.listItemComponents[index] = component;\n\t}\n\n\tlistItems(): ReactNode {\n\t\tconst { ListItemWithContent } = this;\n\t\tconst { renderListItem } = this.props;\n\n\t\treturn this.props.options.map((item, index) => (\n\t\t\t<ListItemWithContent\n\t\t\t\tkey={item.id || index}\n\t\t\t\tassistiveText={{\n\t\t\t\t\tunreadItem: this.props.assistiveText?.unreadItem,\n\t\t\t\t}}\n\t\t\t\tlistItemRef={(component: HTMLAnchorElement | null) => {\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\tthis.addListItemComponent(component, index);\n\t\t\t\t\t}\n\t\t\t\t}}\n\t\t\t\titem={item}\n\t\t\t\tisFocused={this.isListItemFocused(item)}\n\t\t\t\tisSelected={this.isSelected(item)}\n\t\t\t\tisUnread={this.isUnread(item)}\n\t\t\t\tevents={{\n\t\t\t\t\tonClick: (event, meta) =>\n\t\t\t\t\t\tthis.handleOnSelect(event, {\n\t\t\t\t\t\t\titem: meta.item as T,\n\t\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t\tmultiple={this.props.multiple}\n\t\t\t\trenderContent={\n\t\t\t\t\trenderListItem\n\t\t\t\t\t\t? (data) => renderListItem({ ...data, item })\n\t\t\t\t\t\t: undefined\n\t\t\t\t}\n\t\t\t/>\n\t\t));\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tid={this.props.id}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-grid slds-grid_vertical slds-scrollable_none',\n\t\t\t\t\tthis.props.className as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{this.header()}\n\t\t\t\t<ul\n\t\t\t\t\tclassName=\"slds-scrollable_y\"\n\t\t\t\t\taria-label={this.props.assistiveText?.list}\n\t\t\t\t\taria-multiselectable={this.props.multiple}\n\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\tonKeyDown={(event) => this.handleKeyDown(event)}\n\t\t\t\t>\n\t\t\t\t\t{this.listItems()}\n\t\t\t\t</ul>\n\t\t\t</div>\n\t\t);\n\t}\n}\n\nexport default SplitViewListbox;\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,IAAe,OAAO,OAAO;CACzC,IAAI;CACJ,MAAM;AACP,CAAC,GA4JK,IAAe;CACpB,eAAe;EACd,MAAM;EACN,MAAM;GACL,UAAU;GACV,YAAY;GACZ,WAAW;EACZ;CACD;CACA,QAAQ,CAAC;AACV,GAEM,IAAiB,CAAC,GAMlB,KAAS,MACI,OAAO,KAAU,YAAnC,IACK,EAA2B,MAAM,IACnC,GAKE,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,KAAK,SAAS,CAAI;GAC5B,QAAQ,EACP,UAAU,GAAO,MAChB,KAAK,eAAe,GAAO,EAC1B,MAAM,EAAK,KACZ,CAAC,EACH;GACA,UAAU,KAAK,MAAM;GACrB,eACC,KACI,MAAS,EAAe;IAAE,GAAG;IAAM;GAAK,CAAC,IAC1C,KAAA;EAEJ,GAzBK,EAAK,MAAM,CAyBhB,CACD;CACF;CAEA,SAAS;EACR,OACC,kBAAC,OAAD;GACC,IAAI,KAAK,MAAM;GACf,WAAW,EACV,qDACA,KAAK,MAAM,SACZ;GALD,UAAA,CAOE,KAAK,OAAO,GACb,kBAAC,MAAD;IACC,WAAU;IACV,cAAY,KAAK,MAAM,eAAe;IACtC,wBAAsB,KAAK,MAAM;IACjC,MAAK;IACL,YAAY,MAAU,KAAK,cAAc,CAAK;IAE7C,UAAA,KAAK,UAAU;GACb,CAAA,CACA;;CAEP;AACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"list-item-with-content.js","names":[],"sources":["../../../../../components/split-view/private/list-item-with-content.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable class-methods-use-this */\n\nimport React, {\n\tComponent,\n\ttype ComponentType,\n\ttype ReactNode,\n\ttype Ref,\n} from 'react';\nimport classNames from 'classnames';\n\nexport const DISPLAY_NAME = 'SLDSSplitViewListItemWithContent';\n\nexport interface SplitViewListItemAssistiveText {\n\t/** The unread indicator. */\n\tunreadItem?: string;\n}\n\nexport interface SplitViewListItemEventData {\n\titem: unknown;\n\tisSelected: boolean;\n\tisUnread?: boolean;\n}\n\nexport interface SplitViewListItemEvents {\n\t/** Called when the item is clicked. */\n\tonClick: (event: React.MouseEvent, data: SplitViewListItemEventData) => void;\n}\n\nexport interface ListItemWithContentProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `unreadItem`: The unread indicator.\n\t */\n\tassistiveText?: SplitViewListItemAssistiveText;\n\t/**\n\t * Item to be displayed\n\t */\n\titem: unknown;\n\t/**\n\t * Allows multiple item to be selection\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * Shows the item as `focused`.\n\t */\n\tisFocused: boolean;\n\t/**\n\t * Shows the item as `selected`.\n\t */\n\tisSelected: boolean;\n\t/**\n\t * Shows the item as `unread`.\n\t */\n\tisUnread?: boolean;\n\t/**\n\t * **Event Callbacks**\n\t * * `onClick`: Called when the item is clicked.\n\t * * * Event\n\t * * * Meta data\n\t * * * * `item`: The original item.\n\t * * * * `isSelected`: Is the item selected.\n\t * * * * `isUnread`: Is the item unread.\n\t */\n\tevents?: SplitViewListItemEvents;\n\t/**\n\t * Reference to the list item component\n\t */\n\tlistItemRef?: Ref<HTMLAnchorElement>;\n\t/**\n\t * Called to render the item content. Takes precedence over the wrapped component.\n\t */\n\trenderContent?: (data: {\n\t\tisFocused: boolean;\n\t\tisSelected: boolean;\n\t\tisUnread: boolean;\n\t\titem: unknown;\n\t}) => ReactNode;\n}\n\nconst defaultProps: Partial<ListItemWithContentProps> = {\n\tassistiveText: {\n\t\tunreadItem: 'Unread Item',\n\t},\n\tevents: {} as SplitViewListItemEvents,\n};\n\n/**\n * HOC that wraps the list item content with selection and unread functionality.\n * @param ListItemContent {node} A React component\n * @returns {ListItemWithContent} A React component\n */\nconst listItemWithContent = (\n\tListItemContent: ComponentType<ListItemWithContentProps>\n) => {\n\tclass ListItemWithContent extends Component<ListItemWithContentProps> {\n\t\tstatic displayName = `${DISPLAY_NAME}(${\n\t\t\tListItemContent.displayName || ListItemContent.name || 'Component'\n\t\t})`;\n\n\t\tstatic defaultProps = defaultProps;\n\n\t\tonClick = (event: React.MouseEvent) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tthis.props.events?.onClick(event, {\n\t\t\t\titem: this.props.item,\n\t\t\t\tisSelected: this.props.isSelected,\n\t\t\t\tisUnread: this.props.isUnread,\n\t\t\t});\n\t\t};\n\n\t\tunread() {\n\t\t\treturn this.props.isUnread ? (\n\t\t\t\t<abbr\n\t\t\t\t\tclassName=\"slds-indicator_unread\"\n\t\t\t\t\ttitle={this.props.assistiveText?.unreadItem}\n\t\t\t\t\taria-label={this.props.assistiveText?.unreadItem}\n\t\t\t\t>\n\t\t\t\t\t{/* eslint-disable-next-line react/jsx-curly-brace-presence */}\n\t\t\t\t\t<span className=\"slds-assistive-text\">{'●'}</span>\n\t\t\t\t</abbr>\n\t\t\t) : null;\n\t\t}\n\n\t\trender() {\n\t\t\treturn (\n\t\t\t\t<li\n\t\t\t\t\tclassName={classNames('slds-split-view__list-item', {\n\t\t\t\t\t\t'slds-is-unread': this.props.isUnread,\n\t\t\t\t\t})}\n\t\t\t\t\trole=\"presentation\"\n\t\t\t\t>\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName=\"slds-split-view__list-item-action slds-grow slds-has-flexi-truncate\"\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\tref={this.props.listItemRef}\n\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\tthis.props.multiple\n\t\t\t\t\t\t\t\t? !!this.props.isSelected\n\t\t\t\t\t\t\t\t: this.props.isSelected\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttabIndex={this.props.isFocused ? 0 : -1}\n\t\t\t\t\t\thref=\"#\"\n\t\t\t\t\t\tonClick={this.onClick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.unread()}\n\t\t\t\t\t\t{this.props.renderContent ? (\n\t\t\t\t\t\t\tthis.props.renderContent({\n\t\t\t\t\t\t\t\tisFocused: this.props.isFocused,\n\t\t\t\t\t\t\t\tisSelected: this.props.isSelected,\n\t\t\t\t\t\t\t\tisUnread: Boolean(this.props.isUnread),\n\t\t\t\t\t\t\t\titem: this.props.item,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ListItemContent {...this.props} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t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jC;;GACA,CAAA;EAEN;CACD;CAEA,OAAO;AACR"}
1
+ {"version":3,"file":"list-item-with-content.js","names":[],"sources":["../../../../../components/split-view/private/list-item-with-content.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable class-methods-use-this */\n\nimport React, {\n\tComponent,\n\ttype ComponentType,\n\ttype ReactNode,\n\ttype Ref,\n} from 'react';\nimport classNames from 'classnames';\n\nexport const DISPLAY_NAME = 'SLDSSplitViewListItemWithContent';\n\nexport interface SplitViewListItemAssistiveText {\n\t/** The unread indicator. */\n\tunreadItem?: string;\n}\n\nexport interface SplitViewListItemEventData {\n\titem: unknown;\n\tisSelected: boolean;\n\tisUnread?: boolean;\n}\n\nexport interface SplitViewListItemEvents {\n\t/** Called when the item is clicked. */\n\tonClick: (event: React.MouseEvent, data: SplitViewListItemEventData) => void;\n}\n\nexport interface ListItemWithContentProps {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `unreadItem`: The unread indicator.\n\t */\n\tassistiveText?: SplitViewListItemAssistiveText;\n\t/**\n\t * Item to be displayed\n\t */\n\titem: unknown;\n\t/**\n\t * Allows multiple item to be selection\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * Shows the item as `focused`.\n\t */\n\tisFocused: boolean;\n\t/**\n\t * Shows the item as `selected`.\n\t */\n\tisSelected: boolean;\n\t/**\n\t * Shows the item as `unread`.\n\t */\n\tisUnread?: boolean;\n\t/**\n\t * **Event Callbacks**\n\t * * `onClick`: Called when the item is clicked.\n\t * * * Event\n\t * * * Meta data\n\t * * * * `item`: The original item.\n\t * * * * `isSelected`: Is the item selected.\n\t * * * * `isUnread`: Is the item unread.\n\t */\n\tevents?: SplitViewListItemEvents;\n\t/**\n\t * Reference to the list item component\n\t */\n\tlistItemRef?: Ref<HTMLAnchorElement>;\n\t/**\n\t * Called to render the item content. Takes precedence over the wrapped component.\n\t */\n\trenderContent?: (data: {\n\t\tisFocused: boolean;\n\t\tisSelected: boolean;\n\t\tisUnread: boolean;\n\t\titem: unknown;\n\t}) => ReactNode;\n}\n\nconst defaultProps: Partial<ListItemWithContentProps> = {\n\tassistiveText: {\n\t\tunreadItem: 'Unread Item',\n\t},\n\tevents: {} as SplitViewListItemEvents,\n};\n\n/**\n * HOC that wraps the list item content with selection and unread functionality.\n * @param ListItemContent {node} A React component\n * @returns {ListItemWithContent} A React component\n */\nconst listItemWithContent = (\n\tListItemContent: ComponentType<ListItemWithContentProps>\n) => {\n\tclass ListItemWithContent extends Component<ListItemWithContentProps> {\n\t\tstatic displayName = `${DISPLAY_NAME}(${\n\t\t\tListItemContent.displayName || ListItemContent.name || 'Component'\n\t\t})`;\n\n\t\tstatic defaultProps = defaultProps;\n\n\t\tonClick = (event: React.MouseEvent) => {\n\t\t\tevent.preventDefault();\n\n\t\t\tthis.props.events?.onClick(event, {\n\t\t\t\titem: this.props.item,\n\t\t\t\tisSelected: this.props.isSelected,\n\t\t\t\tisUnread: this.props.isUnread,\n\t\t\t});\n\t\t};\n\n\t\tunread() {\n\t\t\treturn this.props.isUnread ? (\n\t\t\t\t<abbr\n\t\t\t\t\tclassName=\"slds-indicator_unread\"\n\t\t\t\t\ttitle={this.props.assistiveText?.unreadItem}\n\t\t\t\t\taria-label={this.props.assistiveText?.unreadItem}\n\t\t\t\t>\n\t\t\t\t\t{/* eslint-disable-next-line react/jsx-curly-brace-presence */}\n\t\t\t\t\t<span className=\"slds-assistive-text\">{'●'}</span>\n\t\t\t\t</abbr>\n\t\t\t) : null;\n\t\t}\n\n\t\trender() {\n\t\t\treturn (\n\t\t\t\t<li\n\t\t\t\t\tclassName={classNames('slds-split-view__list-item', {\n\t\t\t\t\t\t'slds-is-unread': this.props.isUnread,\n\t\t\t\t\t})}\n\t\t\t\t\trole=\"presentation\"\n\t\t\t\t>\n\t\t\t\t\t{/* eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS split view list item markup; keyboard handled by the listbox */}\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName=\"slds-split-view__list-item-action slds-grow slds-has-flexi-truncate\"\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\tref={this.props.listItemRef}\n\t\t\t\t\t\taria-selected={\n\t\t\t\t\t\t\tthis.props.multiple\n\t\t\t\t\t\t\t\t? !!this.props.isSelected\n\t\t\t\t\t\t\t\t: this.props.isSelected\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttabIndex={this.props.isFocused ? 0 : -1}\n\t\t\t\t\t\thref=\"#\"\n\t\t\t\t\t\tonClick={this.onClick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.unread()}\n\t\t\t\t\t\t{this.props.renderContent ? (\n\t\t\t\t\t\t\tthis.props.renderContent({\n\t\t\t\t\t\t\t\tisFocused: this.props.isFocused,\n\t\t\t\t\t\t\t\tisSelected: this.props.isSelected,\n\t\t\t\t\t\t\t\tisUnread: Boolean(this.props.isUnread),\n\t\t\t\t\t\t\t\titem: this.props.item,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ListItemContent {...this.props} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</a>\n\t\t\t\t</li>\n\t\t\t);\n\t\t}\n\t}\n\n\treturn ListItemWithContent;\n};\n\nexport default listItemWithContent;\n"],"mappings":";;;;AAaA,IAAa,IAAe,oCAqEtB,IAAkD;CACvD,eAAe,EACd,YAAY,cACb;CACA,QAAQ,CAAC;AACV,GAOM,KACL,MACI;CACJ,MAAM,UAA4B,EAAoC;EACrE,OAAO,cAAc,GAAG,EAAa,GACpC,EAAgB,eAAe,EAAgB,QAAQ,YACvD;EAED,OAAO,eAAe;EAEtB,WAAW,MAA4B;GAGtC,AAFA,EAAM,eAAe,GAErB,KAAK,MAAM,QAAQ,QAAQ,GAAO;IACjC,MAAM,KAAK,MAAM;IACjB,YAAY,KAAK,MAAM;IACvB,UAAU,KAAK,MAAM;GACtB,CAAC;EACF;EAEA,SAAS;GACR,OAAO,KAAK,MAAM,WACjB,kBAAC,QAAD;IACC,WAAU;IACV,OAAO,KAAK,MAAM,eAAe;IACjC,cAAY,KAAK,MAAM,eAAe;IAGtC,UAAA,kBAAC,QAAD;KAAM,WAAU;KAAuB,UAAA;IAAU,CAAA;GAC5C,CAAA,IACH;EACL;EAEA,SAAS;GACR,OACC,kBAAC,MAAD;IACC,WAAW,EAAW,8BAA8B,EACnD,kBAAkB,KAAK,MAAM,SAC9B,CAAC;IACD,MAAK;IAGL,UAAA,kBAAC,KAAD;KACC,WAAU;KACV,MAAK;KACL,KAAK,KAAK,MAAM;KAChB,iBACC,KAAK,MAAM,WACR,CAAC,CAAC,KAAK,MAAM,aACb,KAAK,MAAM;KAEf,UAAU,KAAK,MAAM,YAAY,IAAI;KACrC,MAAK;KACL,SAAS,KAAK;KAXf,UAAA,CAaE,KAAK,OAAO,GACZ,KAAK,MAAM,gBACX,KAAK,MAAM,cAAc;MACxB,WAAW,KAAK,MAAM;MACtB,YAAY,KAAK,MAAM;MACvB,UAAU,EAAQ,KAAK,MAAM;MAC7B,MAAM,KAAK,MAAM;KAClB,CAAC,IAED,kBAAC,GAAD,EAAiB,GAAI,KAAK,MAAQ,CAAA,CAEjC;;GACA,CAAA;EAEN;CACD;CAEA,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/tabs/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n\tuseId,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\n\n// Child components\nimport TabsList from './private/tabs-list';\nimport Tab from './private/tab';\nimport TabPanel from './private/tab-panel';\nimport type { TabsPanelProps } from './panel';\nimport type { ChildrenOf } from '../../types/common';\n\nimport { TABS } from '../../utilities/constants';\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\n\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Tabs variant types\n */\nexport type TabsVariant = 'default' | 'scoped' | 'vertical';\n\n/** @deprecated Use `TabsPanelProps` from `tabs/panel`. */\nexport type TabChildProps = TabsPanelProps;\n\n/**\n * Data passed to the Tabs `onSelect` callback\n */\nexport interface TabsSelectData {\n\t/**\n\t * `value` of the tab being selected: the panel's `value`, or its index as a\n\t * string (`'0'`, `'1'`, ...) when the panel has no `value`.\n\t */\n\tvalue: string;\n\t/**\n\t * `value` of the tab that was selected before this selection, or `undefined`\n\t * when no tab was selected.\n\t */\n\tpreviousValue: string | undefined;\n\t/** Index of the tab being selected */\n\tselectedIndex: number;\n\t/** Index of the tab that was selected before this selection, or `-1` when no tab was selected */\n\tpreviousIndex: number;\n}\n\n/**\n * Props shared by both ways of controlling the selected tab\n */\ninterface TabsBaseProps {\n\t/** `TabsPanel` elements, one per tab. Tabs reads each panel's `label`, `value`, `disabled`, `hasError` and `assistiveText`. */\n\tchildren: ChildrenOf<TabsPanelProps>;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string;\n\t/**\n\t * Called when a tab is requested by click or arrow key. Receives the triggering event and\n\t * `{ value, previousValue, selectedIndex, previousIndex }`. Tabs is controlled: update `value`\n\t * from this callback to change tabs. It is not called for a disabled tab or for the tab that is\n\t * already selected.\n\t */\n\tonSelect: (\n\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\tdata: TabsSelectData\n\t) => void;\n\t/** Tab style variant */\n\tvariant?: TabsVariant;\n}\n\n/**\n * Select the tab by the `value` of its `TabsPanel`.\n */\ninterface TabsValueProps {\n\t/**\n\t * `value` of the selected `TabsPanel` (required, controlled). A panel without a `value` is\n\t * matched by its index as a string (`'0'`, `'1'`, ...). When no panel matches, no tab is selected.\n\t */\n\tvalue: string;\n\tselectedIndex?: never;\n}\n\n/**\n * Select the tab by index (deprecated).\n */\ninterface TabsSelectedIndexProps {\n\tvalue?: undefined;\n\t/**\n\t * @deprecated Use `value` instead (set `value` on each `TabsPanel`, or use the index as a\n\t * string). Index of the selected tab, controlled. Used only when `value` is not passed.\n\t */\n\tselectedIndex: number;\n}\n\n/**\n * Props for the Tabs component\n */\nexport type TabsProps = TabsBaseProps &\n\t(TabsValueProps | TabsSelectedIndexProps);\n\n// The value a panel is matched by: its `value`, or its index as a string.\nconst getPanelValue = (\n\tchild: React.ReactElement<TabsPanelProps>,\n\tindex: number\n): string => child.props.value ?? String(index);\n\n// Determine if a node from event.target is a Tab element\nfunction isTabNode(node: HTMLElement): boolean {\n\treturn (\n\t\t(node.nodeName === 'A' && node.getAttribute('role') === 'tab') ||\n\t\t(node.nodeName === 'LI' &&\n\t\t\t(node.classList.contains('slds-tabs_default__item') ||\n\t\t\t\tnode.classList.contains('slds-tabs_scoped__item') ||\n\t\t\t\tnode.classList.contains('slds-vertical-tabs__nav-item')))\n\t);\n}\n\n// Determine if a tab node is disabled (from DOM)\nfunction isTabNodeDisabled(node: HTMLElement): boolean {\n\tif (node.classList?.contains('slds-disabled')) {\n\t\treturn true;\n\t}\n\tif (node.getAttribute?.('aria-disabled') === 'true') {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// Determine if a tab React element is disabled\nfunction isTabDisabled(tab: React.ReactElement<TabsPanelProps>): boolean {\n\treturn Boolean(tab.props?.disabled);\n}\n\n/**\n * Tabs keeps related content in a single container that is shown and hidden through navigation.\n */\nconst Tabs = (props: TabsProps): React.ReactElement => {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tid: propId,\n\t\tonSelect,\n\t\tselectedIndex: selectedIndexProp,\n\t\tvalue,\n\t\tvariant = 'default',\n\t} = props;\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tTABS,\n\t\t\t{\n\t\t\t\tdefaultSelectedIndex: (props as { defaultSelectedIndex?: number })\n\t\t\t\t\t.defaultSelectedIndex,\n\t\t\t\tselectedIndex: selectedIndexProp,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\tconst [focus, setFocus] = useState(false);\n\tconst tabsRef = useRef<\n\t\tArray<{ tab: React.ReactElement<TabsPanelProps>; node: HTMLElement | null }>\n\t>([]);\n\tconst tabsNodeRef = useRef<HTMLDivElement>(null);\n\n\tconst childArray = React.Children.toArray(\n\t\tchildren\n\t) as React.ReactElement<TabsPanelProps>[];\n\tconst tabsCount = childArray.length;\n\n\t// Selection is controlled: derived from `value`, or from the deprecated\n\t// `selectedIndex` when `value` is not passed. There is no internal copy.\n\tconst selectedIndex =\n\t\tvalue !== undefined\n\t\t\t? childArray.findIndex(\n\t\t\t\t\t(child, index) => getPanelValue(child, index) === value\n\t\t\t\t)\n\t\t\t: Number.isInteger(selectedIndexProp)\n\t\t\t\t? (selectedIndexProp as number)\n\t\t\t\t: -1;\n\n\tconst getNextTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab from index to the last tab\n\t\t\tfor (let i = index + 1; i < tabsCount; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from first tab\n\t\t\tfor (let i = 0; i < index; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst getPrevTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab backwards\n\t\t\tfor (let i = index - 1; i >= 0; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from last tab\n\t\t\tfor (let i = tabsCount - 1; i > index; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst setSelected = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\t\tindex: number,\n\t\t\tshouldFocus?: boolean\n\t\t) => {\n\t\t\tif (index < 0 || index >= tabsCount || index === selectedIndex) return;\n\n\t\t\tconst previous =\n\t\t\t\tselectedIndex >= 0 ? childArray[selectedIndex] : undefined;\n\t\t\tonSelect?.(event, {\n\t\t\t\tvalue: getPanelValue(childArray[index], index),\n\t\t\t\tpreviousValue: previous\n\t\t\t\t\t? getPanelValue(previous, selectedIndex)\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedIndex: index,\n\t\t\t\tpreviousIndex: selectedIndex,\n\t\t\t});\n\t\t\t// Focus follows the selection once the parent updates `value`.\n\t\t\tsetFocus(shouldFocus === true);\n\t\t},\n\t\t[tabsCount, onSelect, selectedIndex, childArray]\n\t);\n\n\tconst isTabFromContainer = useCallback((node: HTMLElement): boolean => {\n\t\tif (!isTabNode(node)) return false;\n\n\t\tlet nodeAncestor: HTMLElement | null = node.parentElement;\n\t\twhile (nodeAncestor) {\n\t\t\tif (nodeAncestor === tabsNodeRef.current) return true;\n\t\t\tif (nodeAncestor.getAttribute('data-tabs')) break;\n\t\t\tnodeAncestor = nodeAncestor.parentElement;\n\t\t}\n\t\treturn false;\n\t}, []);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLDivElement>) => {\n\t\t\tlet node = e.target as HTMLElement;\n\t\t\tdo {\n\t\t\t\tif (isTabFromContainer(node)) {\n\t\t\t\t\tif (isTabNodeDisabled(node)) return;\n\n\t\t\t\t\tlet parentNode = node.parentNode as HTMLElement;\n\t\t\t\t\tif (parentNode?.nodeName === 'LI') {\n\t\t\t\t\t\tnode = parentNode;\n\t\t\t\t\t\tparentNode = node.parentNode as HTMLElement;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst index = Array.from(parentNode.children).indexOf(node);\n\t\t\t\t\tsetSelected(e, index);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode = node.parentNode as HTMLElement;\n\t\t\t} while (node !== null);\n\t\t},\n\t\t[isTabFromContainer, setSelected]\n\t);\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (isTabFromContainer(event.target as HTMLElement)) {\n\t\t\t\tlet index = selectedIndex;\n\t\t\t\tlet preventDefault = false;\n\n\t\t\t\tif (event.key === KEYS.LEFT || event.key === KEYS.UP) {\n\t\t\t\t\tindex = getPrevTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t} else if (event.key === KEYS.RIGHT || event.key === KEYS.DOWN) {\n\t\t\t\t\tindex = getNextTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\n\t\t\t\tif (preventDefault) {\n\t\t\t\t\tEventUtil.trap(event);\n\t\t\t\t}\n\n\t\t\t\tsetSelected(event, index, true);\n\t\t\t}\n\t\t},\n\t\t[isTabFromContainer, selectedIndex, getPrevTab, getNextTab, setSelected]\n\t);\n\n\tconst renderTabsList = () => (\n\t\t<TabsList id={id} variant={variant}>\n\t\t\t{childArray.map((child, index) => {\n\t\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\t\tconst isSelected = selectedIndex === index;\n\t\t\t\tconst shouldFocus = isSelected && focus;\n\n\t\t\t\treturn (\n\t\t\t\t\t<Tab\n\t\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\t\tref={(node: HTMLElement | null) => {\n\t\t\t\t\t\t\ttabsRef.current[index] = { tab: child, node };\n\t\t\t\t\t\t\tif (focus) {\n\t\t\t\t\t\t\t\tsetFocus(false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tfocus={shouldFocus}\n\t\t\t\t\t\tselected={isSelected}\n\t\t\t\t\t\tid={tabId}\n\t\t\t\t\t\tpanelId={panelId}\n\t\t\t\t\t\tdisabled={child.props.disabled}\n\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\thasError={child.props.hasError}\n\t\t\t\t\t\tassistiveText={child.props.assistiveText}\n\t\t\t\t\t>\n\t\t\t\t\t\t{child.props.label}\n\t\t\t\t\t</Tab>\n\t\t\t\t);\n\t\t\t})}\n\t\t</TabsList>\n\t);\n\n\tconst renderTabPanels = () =>\n\t\tchildArray.map((child, index) => {\n\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\tconst isSelected = selectedIndex === index;\n\n\t\t\treturn (\n\t\t\t\t<TabPanel\n\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\tselected={isSelected}\n\t\t\t\t\tid={panelId}\n\t\t\t\t\ttabId={tabId}\n\t\t\t\t\tvariant={variant}\n\t\t\t\t>\n\t\t\t\t\t{child}\n\t\t\t\t</TabPanel>\n\t\t\t);\n\t\t});\n\n\treturn (\n\t\t<div\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-tabs_default': variant === 'default',\n\t\t\t\t\t'slds-tabs_scoped': variant === 'scoped',\n\t\t\t\t\t'slds-vertical-tabs': variant === 'vertical',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tdata-tabs\n\t\t\tref={tabsNodeRef}\n\t\t>\n\t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B,eAAe,EAAM,MAAM;KAE1B,UAAA,EAAM,MAAM;IACT,GAjBC,EAAM,OAAO,CAiBd;GAEP,CAAC;EACQ,CAAA,GAIV,EAAW,KAAK,GAAO,MAAU;GAChC,IAAM,IAAQ,GAAG,EAAG,iBAAiB,KAC/B,IAAU,GAAG,EAAG,mBAAmB;GAGzC,OACC,kBAAC,GAAD;IAEC,UALiB,MAAkB;IAMnC,IAAI;IACG;IACE;IAER,UAAA;GACQ,GAPJ,EAAM,OAAO,CAOT;EAEZ,CAAC,CAoBI;;AAEP;AAEA,EAAK,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/tabs/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseRef,\n\tuseCallback,\n\tuseEffect,\n\tuseId,\n\ttype MouseEvent,\n\ttype KeyboardEvent,\n} from 'react';\nimport classNames from 'classnames';\n\n// Child components\nimport TabsList from './private/tabs-list';\nimport Tab from './private/tab';\nimport TabPanel from './private/tab-panel';\nimport type { TabsPanelProps } from './panel';\nimport type { ChildrenOf } from '../../types/common';\n\nimport { TABS } from '../../utilities/constants';\nimport KEYS from '../../utilities/key-code';\nimport EventUtil from '../../utilities/event';\n\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Tabs variant types\n */\nexport type TabsVariant = 'default' | 'scoped' | 'vertical';\n\n/** @deprecated Use `TabsPanelProps` from `tabs/panel`. */\nexport type TabChildProps = TabsPanelProps;\n\n/**\n * Data passed to the Tabs `onSelect` callback\n */\nexport interface TabsSelectData {\n\t/**\n\t * `value` of the tab being selected: the panel's `value`, or its index as a\n\t * string (`'0'`, `'1'`, ...) when the panel has no `value`.\n\t */\n\tvalue: string;\n\t/**\n\t * `value` of the tab that was selected before this selection, or `undefined`\n\t * when no tab was selected.\n\t */\n\tpreviousValue: string | undefined;\n\t/** Index of the tab being selected */\n\tselectedIndex: number;\n\t/** Index of the tab that was selected before this selection, or `-1` when no tab was selected */\n\tpreviousIndex: number;\n}\n\n/**\n * Props shared by both ways of controlling the selected tab\n */\ninterface TabsBaseProps {\n\t/** `TabsPanel` elements, one per tab. Tabs reads each panel's `label`, `value`, `disabled`, `hasError` and `assistiveText`. */\n\tchildren: ChildrenOf<TabsPanelProps>;\n\t/** CSS classes */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** HTML id */\n\tid?: string;\n\t/**\n\t * Called when a tab is requested by click or arrow key. Receives the triggering event and\n\t * `{ value, previousValue, selectedIndex, previousIndex }`. Tabs is controlled: update `value`\n\t * from this callback to change tabs. It is not called for a disabled tab or for the tab that is\n\t * already selected.\n\t */\n\tonSelect: (\n\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\tdata: TabsSelectData\n\t) => void;\n\t/** Tab style variant */\n\tvariant?: TabsVariant;\n}\n\n/**\n * Select the tab by the `value` of its `TabsPanel`.\n */\ninterface TabsValueProps {\n\t/**\n\t * `value` of the selected `TabsPanel` (required, controlled). A panel without a `value` is\n\t * matched by its index as a string (`'0'`, `'1'`, ...). When no panel matches, no tab is selected.\n\t */\n\tvalue: string;\n\tselectedIndex?: never;\n}\n\n/**\n * Select the tab by index (deprecated).\n */\ninterface TabsSelectedIndexProps {\n\t/** Unset when the deprecated `selectedIndex` is used. */\n\tvalue?: undefined;\n\t/**\n\t * @deprecated Use `value` instead (set `value` on each `TabsPanel`, or use the index as a\n\t * string). Index of the selected tab, controlled. Used only when `value` is not passed.\n\t */\n\tselectedIndex: number;\n}\n\n/**\n * Props for the Tabs component\n */\nexport type TabsProps = TabsBaseProps &\n\t(TabsValueProps | TabsSelectedIndexProps);\n\n// The value a panel is matched by: its `value`, or its index as a string.\nconst getPanelValue = (\n\tchild: React.ReactElement<TabsPanelProps>,\n\tindex: number\n): string => child.props.value ?? String(index);\n\n// Determine if a node from event.target is a Tab element\nfunction isTabNode(node: HTMLElement): boolean {\n\treturn (\n\t\t(node.nodeName === 'A' && node.getAttribute('role') === 'tab') ||\n\t\t(node.nodeName === 'LI' &&\n\t\t\t(node.classList.contains('slds-tabs_default__item') ||\n\t\t\t\tnode.classList.contains('slds-tabs_scoped__item') ||\n\t\t\t\tnode.classList.contains('slds-vertical-tabs__nav-item')))\n\t);\n}\n\n// Determine if a tab node is disabled (from DOM)\nfunction isTabNodeDisabled(node: HTMLElement): boolean {\n\tif (node.classList?.contains('slds-disabled')) {\n\t\treturn true;\n\t}\n\tif (node.getAttribute?.('aria-disabled') === 'true') {\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// Determine if a tab React element is disabled\nfunction isTabDisabled(tab: React.ReactElement<TabsPanelProps>): boolean {\n\treturn Boolean(tab.props?.disabled);\n}\n\n/**\n * Tabs keeps related content in a single container that is shown and hidden through navigation.\n */\nconst Tabs = (props: TabsProps): React.ReactElement => {\n\tconst {\n\t\tchildren,\n\t\tclassName,\n\t\tid: propId,\n\t\tonSelect,\n\t\tselectedIndex: selectedIndexProp,\n\t\tvalue,\n\t\tvariant = 'default',\n\t} = props;\n\tconst generatedId = useId();\n\tconst id = propId || generatedId;\n\n\tuseEffect(() => {\n\t\tcheckProps(\n\t\t\tTABS,\n\t\t\t{\n\t\t\t\tdefaultSelectedIndex: (props as { defaultSelectedIndex?: number })\n\t\t\t\t\t.defaultSelectedIndex,\n\t\t\t\tselectedIndex: selectedIndexProp,\n\t\t\t\tvalue,\n\t\t\t},\n\t\t\tcomponentDoc\n\t\t);\n\t});\n\n\tconst [focus, setFocus] = useState(false);\n\tconst tabsRef = useRef<\n\t\tArray<{ tab: React.ReactElement<TabsPanelProps>; node: HTMLElement | null }>\n\t>([]);\n\tconst tabsNodeRef = useRef<HTMLDivElement>(null);\n\n\tconst childArray = React.Children.toArray(\n\t\tchildren\n\t) as React.ReactElement<TabsPanelProps>[];\n\tconst tabsCount = childArray.length;\n\n\t// Selection is controlled: derived from `value`, or from the deprecated\n\t// `selectedIndex` when `value` is not passed. There is no internal copy.\n\tconst selectedIndex =\n\t\tvalue !== undefined\n\t\t\t? childArray.findIndex(\n\t\t\t\t\t(child, index) => getPanelValue(child, index) === value\n\t\t\t\t)\n\t\t\t: Number.isInteger(selectedIndexProp)\n\t\t\t\t? (selectedIndexProp as number)\n\t\t\t\t: -1;\n\n\tconst getNextTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab from index to the last tab\n\t\t\tfor (let i = index + 1; i < tabsCount; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from first tab\n\t\t\tfor (let i = 0; i < index; i++) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst getPrevTab = useCallback(\n\t\t(index: number): number => {\n\t\t\t// Look for non-disabled tab backwards\n\t\t\tfor (let i = index - 1; i >= 0; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Continue from last tab\n\t\t\tfor (let i = tabsCount - 1; i > index; i--) {\n\t\t\t\tconst tab = tabsRef.current[i];\n\t\t\t\tif (tab && !isTabDisabled(tab.tab)) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn index;\n\t\t},\n\t\t[tabsCount]\n\t);\n\n\tconst setSelected = useCallback(\n\t\t(\n\t\t\tevent: MouseEvent<HTMLDivElement> | KeyboardEvent<HTMLDivElement>,\n\t\t\tindex: number,\n\t\t\tshouldFocus?: boolean\n\t\t) => {\n\t\t\tif (index < 0 || index >= tabsCount || index === selectedIndex) return;\n\n\t\t\tconst previous =\n\t\t\t\tselectedIndex >= 0 ? childArray[selectedIndex] : undefined;\n\t\t\tonSelect?.(event, {\n\t\t\t\tvalue: getPanelValue(childArray[index], index),\n\t\t\t\tpreviousValue: previous\n\t\t\t\t\t? getPanelValue(previous, selectedIndex)\n\t\t\t\t\t: undefined,\n\t\t\t\tselectedIndex: index,\n\t\t\t\tpreviousIndex: selectedIndex,\n\t\t\t});\n\t\t\t// Focus follows the selection once the parent updates `value`.\n\t\t\tsetFocus(shouldFocus === true);\n\t\t},\n\t\t[tabsCount, onSelect, selectedIndex, childArray]\n\t);\n\n\tconst isTabFromContainer = useCallback((node: HTMLElement): boolean => {\n\t\tif (!isTabNode(node)) return false;\n\n\t\tlet nodeAncestor: HTMLElement | null = node.parentElement;\n\t\twhile (nodeAncestor) {\n\t\t\tif (nodeAncestor === tabsNodeRef.current) return true;\n\t\t\tif (nodeAncestor.getAttribute('data-tabs')) break;\n\t\t\tnodeAncestor = nodeAncestor.parentElement;\n\t\t}\n\t\treturn false;\n\t}, []);\n\n\tconst handleClick = useCallback(\n\t\t(e: MouseEvent<HTMLDivElement>) => {\n\t\t\tlet node = e.target as HTMLElement;\n\t\t\tdo {\n\t\t\t\tif (isTabFromContainer(node)) {\n\t\t\t\t\tif (isTabNodeDisabled(node)) return;\n\n\t\t\t\t\tlet parentNode = node.parentNode as HTMLElement;\n\t\t\t\t\tif (parentNode?.nodeName === 'LI') {\n\t\t\t\t\t\tnode = parentNode;\n\t\t\t\t\t\tparentNode = node.parentNode as HTMLElement;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst index = Array.from(parentNode.children).indexOf(node);\n\t\t\t\t\tsetSelected(e, index);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnode = node.parentNode as HTMLElement;\n\t\t\t} while (node !== null);\n\t\t},\n\t\t[isTabFromContainer, setSelected]\n\t);\n\n\tconst handleKeyDown = useCallback(\n\t\t(event: KeyboardEvent<HTMLDivElement>) => {\n\t\t\tif (isTabFromContainer(event.target as HTMLElement)) {\n\t\t\t\tlet index = selectedIndex;\n\t\t\t\tlet preventDefault = false;\n\n\t\t\t\tif (event.key === KEYS.LEFT || event.key === KEYS.UP) {\n\t\t\t\t\tindex = getPrevTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t} else if (event.key === KEYS.RIGHT || event.key === KEYS.DOWN) {\n\t\t\t\t\tindex = getNextTab(index);\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\n\t\t\t\tif (preventDefault) {\n\t\t\t\t\tEventUtil.trap(event);\n\t\t\t\t}\n\n\t\t\t\tsetSelected(event, index, true);\n\t\t\t}\n\t\t},\n\t\t[isTabFromContainer, selectedIndex, getPrevTab, getNextTab, setSelected]\n\t);\n\n\tconst renderTabsList = () => (\n\t\t<TabsList id={id} variant={variant}>\n\t\t\t{childArray.map((child, index) => {\n\t\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\t\tconst isSelected = selectedIndex === index;\n\t\t\t\tconst shouldFocus = isSelected && focus;\n\n\t\t\t\treturn (\n\t\t\t\t\t<Tab\n\t\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\t\tref={(node: HTMLElement | null) => {\n\t\t\t\t\t\t\ttabsRef.current[index] = { tab: child, node };\n\t\t\t\t\t\t\tif (focus) {\n\t\t\t\t\t\t\t\tsetFocus(false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tfocus={shouldFocus}\n\t\t\t\t\t\tselected={isSelected}\n\t\t\t\t\t\tid={tabId}\n\t\t\t\t\t\tpanelId={panelId}\n\t\t\t\t\t\tdisabled={child.props.disabled}\n\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\thasError={child.props.hasError}\n\t\t\t\t\t\tassistiveText={child.props.assistiveText}\n\t\t\t\t\t>\n\t\t\t\t\t\t{child.props.label}\n\t\t\t\t\t</Tab>\n\t\t\t\t);\n\t\t\t})}\n\t\t</TabsList>\n\t);\n\n\tconst renderTabPanels = () =>\n\t\tchildArray.map((child, index) => {\n\t\t\tconst tabId = `${id}-slds-tabs_tab-${index}`;\n\t\t\tconst panelId = `${id}-slds-tabs_panel-${index}`;\n\t\t\tconst isSelected = selectedIndex === index;\n\n\t\t\treturn (\n\t\t\t\t<TabPanel\n\t\t\t\t\tkey={child.key ?? index}\n\t\t\t\t\tselected={isSelected}\n\t\t\t\t\tid={panelId}\n\t\t\t\t\ttabId={tabId}\n\t\t\t\t\tvariant={variant}\n\t\t\t\t>\n\t\t\t\t\t{child}\n\t\t\t\t</TabPanel>\n\t\t\t);\n\t\t});\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions -- wrapper delegates events from the focusable tabs it contains\n\t\t<div\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\t{\n\t\t\t\t\t'slds-tabs_default': variant === 'default',\n\t\t\t\t\t'slds-tabs_scoped': variant === 'scoped',\n\t\t\t\t\t'slds-vertical-tabs': variant === 'vertical',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tonClick={handleClick}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tdata-tabs\n\t\t\tref={tabsNodeRef}\n\t\t>\n\t\t\t{renderTabsList()}\n\t\t\t{renderTabPanels()}\n\t\t</div>\n\t);\n};\n\nTabs.displayName = TABS;\n\nexport default Tabs;\n"],"mappings":";;;;;;;;;;;;AAgHA,IAAM,KACL,GACA,MACY,EAAM,MAAM,SAAS,OAAO,CAAK;AAG9C,SAAS,EAAU,GAA4B;CAC9C,OACE,EAAK,aAAa,OAAO,EAAK,aAAa,MAAM,MAAM,SACvD,EAAK,aAAa,SACjB,EAAK,UAAU,SAAS,yBAAyB,KACjD,EAAK,UAAU,SAAS,wBAAwB,KAChD,EAAK,UAAU,SAAS,8BAA8B;AAE1D;AAG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{"version":3,"file":"panel.js","names":[],"sources":["../../../../components/tabs/panel.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, { type ReactNode } from 'react';\n\nimport { TABS_PANEL } from '../../utilities/constants';\n\nexport interface TabsPanelProps {\n\t/**\n\t * The string or element that is handed off to the `<Tab />` component, ends up being the title and the label for the tab associated with its tab panel.\n\t */\n\tlabel: ReactNode;\n\t/**\n\t * Identifies this panel for the `value` prop of `<Tabs />` and the `value`/`previousValue` reported by its `onSelect`. When omitted, the panel is identified by its index as a string (`'0'`, `'1'`, ...). Rendered `id`s are always index-based.\n\t */\n\tvalue?: string;\n\t/**\n\t * The `children` are the actual tab panels to be rendered. They get created by [tabs/index.jsx](./index.jsx) in the `renderTabPanels` function.\n\t *\n\t * Note that the `<TabsPanel />` component inserts a `div` element around the children, because React requires exactly one \"parent\" element returned. The `<TabPanel />` component simply dips down into `children` to get the children of this wrapping `div` so that it does not get rendered in the DOM.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Disables the `<Tab />` associated with this panel so it cannot be selected.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Show an icon on the `<Tab />` next to the title that can be used to communicate when a tab contains a validation error that needs attention\n\t */\n\thasError?: boolean;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `withErrorIcon`: This text is for the error icon that will be placed next to the `<Tab />` title\n\t */\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n}\n\n/**\n * The `<TabsPanel />` component allows us to simplify the structure of the `<Tabs />` component.\n\n * Rather than require different (deeply nested) children for tabslist, with its tab(s) as well as tabpanel(s), we provide this `TabsPanel` component which takes a `label` property that will become what is shown on the `<Tab />` that will be associated with it.\n\n * The `children` of the Panel will be fed to the `<TabPanel />` component, while its `label` is handled in `<Tab />`, via `<TabsList />`.\n *\n * ```\n * <TabsPanel label=\"Tab 1\" value=\"tab-1\">\n * \t<div>\n * \t\t<h2 className=\"slds-text-heading_medium\">This is my tab 1 contents!</h2>\n * \t\t<p>They show when you click the first tab.</p>\n * \t</div>\n * </TabsPanel>\n * ```\n */\nconst Panel = ({ children }: TabsPanelProps) => (\n\t<div>{React.Children.toArray(children)}</div>\n);\n\nPanel.displayName = TABS_PANEL;\n\nexport default Panel;\n"],"mappings":";;;;AAwDA,IAAM,KAAS,EAAE,kBAChB,kBAAC,OAAD,EAAA,UAAM,EAAM,SAAS,QAAQ,CAAQ,EAAO,CAAA;AAG7C,EAAM,cAAc"}
1
+ {"version":3,"file":"panel.js","names":[],"sources":["../../../../components/tabs/panel.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, { type ReactNode } from 'react';\n\nimport { TABS_PANEL } from '../../utilities/constants';\n\nexport interface TabsPanelProps {\n\t/**\n\t * The string or element that is handed off to the `<Tab />` component, ends up being the title and the label for the tab associated with its tab panel.\n\t */\n\tlabel: ReactNode;\n\t/**\n\t * Identifies this panel for the `value` prop of `<Tabs />` and the `value`/`previousValue` reported by its `onSelect`. When omitted, the panel is identified by its index as a string (`'0'`, `'1'`, ...). Rendered `id`s are always index-based.\n\t */\n\tvalue?: string;\n\t/**\n\t * The `children` are the actual tab panels to be rendered. `<Tabs />` renders them.\n\t *\n\t * Note that the `<TabsPanel />` component inserts a `div` element around the children, because React requires exactly one \"parent\" element returned. The `<TabPanel />` component simply dips down into `children` to get the children of this wrapping `div` so that it does not get rendered in the DOM.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * Disables the `<Tab />` associated with this panel so it cannot be selected.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * Show an icon on the `<Tab />` next to the title that can be used to communicate when a tab contains a validation error that needs attention\n\t */\n\thasError?: boolean;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `withErrorIcon`: This text is for the error icon that will be placed next to the `<Tab />` title\n\t */\n\tassistiveText?: {\n\t\t/** Label of the error icon shown with `hasError`. Defaults to the English text `This item has an error`. */\n\t\twithErrorIcon?: string;\n\t};\n}\n\n/**\n * The `<TabsPanel />` component allows us to simplify the structure of the `<Tabs />` component.\n\n * Rather than require different (deeply nested) children for tabslist, with its tab(s) as well as tabpanel(s), we provide this `TabsPanel` component which takes a `label` property that will become what is shown on the `<Tab />` that will be associated with it.\n\n * The `children` of the Panel will be fed to the `<TabPanel />` component, while its `label` is handled in `<Tab />`, via `<TabsList />`.\n *\n * ```\n * <TabsPanel label=\"Tab 1\" value=\"tab-1\">\n * \t<div>\n * \t\t<h2 className=\"slds-text-heading_medium\">This is my tab 1 contents!</h2>\n * \t\t<p>They show when you click the first tab.</p>\n * \t</div>\n * </TabsPanel>\n * ```\n */\nconst Panel = ({ children }: TabsPanelProps) => (\n\t<div>{React.Children.toArray(children)}</div>\n);\n\nPanel.displayName = TABS_PANEL;\n\nexport default Panel;\n"],"mappings":";;;;AAyDA,IAAM,KAAS,EAAE,kBAChB,kBAAC,OAAD,EAAA,UAAM,EAAM,SAAS,QAAQ,CAAQ,EAAO,CAAA;AAG7C,EAAM,cAAc"}
@@ -47,7 +47,7 @@ var c = n((e, n) => {
47
47
  children: /* @__PURE__ */ o(t, {
48
48
  assistiveText: { label: y.withErrorIcon },
49
49
  category: "utility",
50
- containerClassName: "slds-icon_container slds-icon-utility-error",
50
+ containerClassName: "slds-icon_container",
51
51
  size: "x-small",
52
52
  name: "error",
53
53
  colorVariant: "error",
@@ -1 +1 @@
1
- {"version":3,"file":"tab.js","names":[],"sources":["../../../../../components/tabs/private/tab.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable jsx-a11y/no-interactive-element-to-noninteractive-role */\n\n// # TabItem Component\n\n// ## Dependencies\n\n// ### React\nimport React, {\n\tforwardRef,\n\tuseEffect,\n\tuseRef,\n\ttype ReactNode,\n} from 'react';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ## Constants\nimport { TAB } from '../../../utilities/constants';\n\nimport Icon from '../../icon';\nimport { type TabsVariant } from '../index';\n\n/*\n * Disabled Tab CSS has been removed. If you'd like to use the styling, please import it in your module bundler.\n */\n\nexport interface TabProps {\n\t/**\n\t * The CSS class to be applied when this tab is selected. Defaults to `.slds-is-active`. If another class is desired, it should be passed in _along with_ `.slds-is-active`, not _instead_ of it.\n\t */\n\tactiveTabClassName?: string;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `withErrorIcon`: This text is for the error icon that will be placed next to the `<Tab />` title\n\t */\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n\t/**\n\t * The string or element that is shown as both the title and the label for this tab.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * CSS classes to be added to the tab.\n\t */\n\tclassName?: string;\n\t/**\n\t * When `true`, the HTML attribute `aria-disabled` will be applied.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * The CSS class to be applied when this tab is disabled. Defaults to `.slds-disabled`. If another class is desired, it should be passed in _along with_ `.slds-disabled`, not _instead_ of it.\n\t */\n\tdisabledTabClassName?: string;\n\t/**\n\t * Whether to apply focus to this tab.\n\t */\n\tfocus?: boolean;\n\t/**\n\t * Show an icon that can be used to communicate when a tab contains a validation error that needs attention\n\t */\n\thasError?: boolean;\n\t/**\n\t * The HTML ID of this tab. Also used by the `<TabPanel />` it controls as `tabId`.\n\t */\n\tid?: string;\n\t/**\n\t * The HTML ID of `<TabPanel />` this tab controls.\n\t */\n\tpanelId?: string;\n\t/**\n\t * When `true`, the class `.slds-is-active` is applied.\n\t */\n\tselected?: boolean;\n\t/**\n\t * If the Tabs should be scoped, vertical, or default (default value)\n\t */\n\tvariant?: TabsVariant;\n}\n\nconst Tab = forwardRef<HTMLElement, TabProps>((props, ref) => {\n\tconst {\n\t\tselected = false,\n\t\tdisabled,\n\t\tpanelId,\n\t\tactiveTabClassName = 'slds-is-active',\n\t\tdisabledTabClassName = 'slds-disabled',\n\t\tclassName,\n\t\tchildren,\n\t\tid,\n\t\tvariant = 'default',\n\t\thasError = false,\n\t\tfocus = false,\n\t\tassistiveText = { withErrorIcon: 'This item has an error' },\n\t} = props;\n\n\tconst nodeRef = useRef<HTMLAnchorElement | null>(null);\n\n\tconst setRefs = (node: HTMLAnchorElement | null) => {\n\t\tnodeRef.current = node;\n\t\tif (typeof ref === 'function') {\n\t\t\tref(node);\n\t\t} else if (ref) {\n\t\t\t(ref as React.MutableRefObject<HTMLElement | null>).current = node;\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tif (selected && focus && nodeRef.current) {\n\t\t\tnodeRef.current.focus();\n\t\t}\n\t});\n\n\t/**\n\t * Desired a11y behaviour: The active Tab should get focus when the user presses the\n\t * Tab key. After that, Arrow keys should be used to change the focus from one tab\n\t * to another. Pressing the Tab key one more time should move the focus away from the\n\t * Tab group.\n\t *\n\t * Here, we put the selected Tab in the navigation path (tabIndex = 0) and remove other\n\t * tabs from navigation path (tabIndex = -1).\n\t */\n\tconst tabIndex = selected ? 0 : -1;\n\n\treturn (\n\t\t<li\n\t\t\tclassName={classNames(className, {\n\t\t\t\t[activeTabClassName]: selected,\n\t\t\t\t[disabledTabClassName]: disabled,\n\t\t\t\t'slds-tabs_default__item': variant === 'default',\n\t\t\t\t'slds-tabs_scoped__item': variant === 'scoped',\n\t\t\t\t'slds-vertical-tabs__nav-item': variant === 'vertical',\n\t\t\t})}\n\t\t\trole=\"presentation\"\n\t\t\tid={id}\n\t\t\ttitle={typeof children === 'string' ? children : undefined}\n\t\t>\n\t\t\t<a\n\t\t\t\tclassName={classNames({\n\t\t\t\t\t[activeTabClassName]: selected,\n\t\t\t\t\t[disabledTabClassName]: disabled,\n\t\t\t\t\t'slds-tabs_default__link': variant === 'default',\n\t\t\t\t\t'slds-tabs_scoped__link': variant === 'scoped',\n\t\t\t\t\t'slds-vertical-tabs__link': variant === 'vertical',\n\t\t\t\t})}\n\t\t\t\thref=\"#\"\n\t\t\t\trole=\"tab\"\n\t\t\t\tref={setRefs}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\taria-controls={panelId}\n\t\t\t\taria-disabled={disabled}\n\t\t\t\taria-selected={selected ? 'true' : 'false'}\n\t\t\t\tonClick={(event) => event.preventDefault()}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{hasError && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t'slds-tabs__right-icon': variant !== 'vertical',\n\t\t\t\t\t\t\t'slds-vertical-tabs__right-icon': variant === 'vertical',\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\tlabel: assistiveText.withErrorIcon,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tcontainerClassName=\"slds-icon_container slds-icon-utility-error\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\tname=\"error\"\n\t\t\t\t\t\t\tcolorVariant=\"error\"\n\t\t\t\t\t\t\ttitle={assistiveText.withErrorIcon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</a>\n\t\t</li>\n\t);\n});\n\nTab.displayName = TAB;\n\nexport default Tab;\n"],"mappings":";;;;;;AAqFA,IAAM,IAAM,GAAmC,GAAO,MAAQ;CAC7D,IAAM,EACL,cAAW,IACX,aACA,YACA,wBAAqB,kBACrB,0BAAuB,iBACvB,cACA,aACA,OACA,aAAU,WACV,cAAW,IACX,WAAQ,IACR,mBAAgB,EAAE,eAAe,yBAAyB,MACvD,GAEE,IAAU,EAAiC,IAAI,GAE/C,KAAW,MAAmC;EAEnD,AADA,EAAQ,UAAU,GACd,OAAO,KAAQ,aAClB,EAAI,CAAI,IACE,MACV,EAAoD,UAAU;CAEhE;CAEA,QAAgB;EACf,AAAI,KAAY,KAAS,EAAQ,WAChC,EAAQ,QAAQ,MAAM;CAExB,CAAC;CAWD,IAAM,IAAW,IAAW,IAAI;CAEhC,OACC,kBAAC,MAAD;EACC,WAAW,EAAW,GAAW;IAC/B,IAAqB;IACrB,IAAuB;GACxB,2BAA2B,MAAY;GACvC,0BAA0B,MAAY;GACtC,gCAAgC,MAAY;EAC7C,CAAC;EACD,MAAK;EACD;EACJ,OAAO,OAAO,KAAa,WAAW,IAAW,KAAA;EAEjD,UAAA,kBAAC,KAAD;GACC,WAAW,EAAW;KACpB,IAAqB;KACrB,IAAuB;IACxB,2BAA2B,MAAY;IACvC,0BAA0B,MAAY;IACtC,4BAA4B,MAAY;GACzC,CAAC;GACD,MAAK;GACL,MAAK;GACL,KAAK;GACK;GACV,iBAAe;GACf,iBAAe;GACf,iBAAe,IAAW,SAAS;GACnC,UAAU,MAAU,EAAM,eAAe;GAf1C,UAAA,CAiBE,GACA,KACA,kBAAC,QAAD;IACC,WAAW,EAAW;KACrB,yBAAyB,MAAY;KACrC,kCAAkC,MAAY;IAC/C,CAAC;IAED,UAAA,kBAAC,GAAD;KACC,eAAe,EACd,OAAO,EAAc,cACtB;KACA,UAAS;KACT,oBAAmB;KACnB,MAAK;KACL,MAAK;KACL,cAAa;KACb,OAAO,EAAc;IACrB,CAAA;GACI,CAAA,CAEL;;CACA,CAAA;AAEN,CAAC;AAED,EAAI,cAAc"}
1
+ {"version":3,"file":"tab.js","names":[],"sources":["../../../../../components/tabs/private/tab.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\n/* eslint-disable jsx-a11y/no-interactive-element-to-noninteractive-role */\n\n// # TabItem Component\n\n// ## Dependencies\n\n// ### React\nimport React, { forwardRef, useEffect, useRef, type ReactNode } from 'react';\n\n// ### classNames\nimport classNames from 'classnames';\n\n// ## Constants\nimport { TAB } from '../../../utilities/constants';\n\nimport Icon from '../../icon';\nimport { type TabsVariant } from '../index';\n\nexport interface TabProps {\n\t/**\n\t * The CSS class to be applied when this tab is selected. Defaults to `.slds-is-active`. If another class is desired, it should be passed in _along with_ `.slds-is-active`, not _instead_ of it.\n\t */\n\tactiveTabClassName?: string;\n\t/**\n\t * **Assistive text for accessibility**\n\t * This object is merged with the default props object on every render.\n\t * * `withErrorIcon`: This text is for the error icon that will be placed next to the `<Tab />` title\n\t */\n\tassistiveText?: {\n\t\twithErrorIcon?: string;\n\t};\n\t/**\n\t * The string or element that is shown as both the title and the label for this tab.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * CSS classes to be added to the tab.\n\t */\n\tclassName?: string;\n\t/**\n\t * When `true`, the HTML attribute `aria-disabled` will be applied.\n\t */\n\tdisabled?: boolean;\n\t/**\n\t * The CSS class to be applied when this tab is disabled. Defaults to `.slds-disabled`. If another class is desired, it should be passed in _along with_ `.slds-disabled`, not _instead_ of it.\n\t */\n\tdisabledTabClassName?: string;\n\t/**\n\t * Whether to apply focus to this tab.\n\t */\n\tfocus?: boolean;\n\t/**\n\t * Show an icon that can be used to communicate when a tab contains a validation error that needs attention\n\t */\n\thasError?: boolean;\n\t/**\n\t * The HTML ID of this tab. Also used by the `<TabPanel />` it controls as `tabId`.\n\t */\n\tid?: string;\n\t/**\n\t * The HTML ID of `<TabPanel />` this tab controls.\n\t */\n\tpanelId?: string;\n\t/**\n\t * When `true`, the class `.slds-is-active` is applied.\n\t */\n\tselected?: boolean;\n\t/**\n\t * If the Tabs should be scoped, vertical, or default (default value)\n\t */\n\tvariant?: TabsVariant;\n}\n\nconst Tab = forwardRef<HTMLElement, TabProps>((props, ref) => {\n\tconst {\n\t\tselected = false,\n\t\tdisabled,\n\t\tpanelId,\n\t\tactiveTabClassName = 'slds-is-active',\n\t\tdisabledTabClassName = 'slds-disabled',\n\t\tclassName,\n\t\tchildren,\n\t\tid,\n\t\tvariant = 'default',\n\t\thasError = false,\n\t\tfocus = false,\n\t\tassistiveText = { withErrorIcon: 'This item has an error' },\n\t} = props;\n\n\tconst nodeRef = useRef<HTMLAnchorElement | null>(null);\n\n\tconst setRefs = (node: HTMLAnchorElement | null) => {\n\t\tnodeRef.current = node;\n\t\tif (typeof ref === 'function') {\n\t\t\tref(node);\n\t\t} else if (ref) {\n\t\t\t(ref as React.RefObject<HTMLElement | null>).current = node;\n\t\t}\n\t};\n\n\tuseEffect(() => {\n\t\tif (selected && focus && nodeRef.current) {\n\t\t\tnodeRef.current.focus();\n\t\t}\n\t});\n\n\t/**\n\t * Desired a11y behaviour: The active Tab should get focus when the user presses the\n\t * Tab key. After that, Arrow keys should be used to change the focus from one tab\n\t * to another. Pressing the Tab key one more time should move the focus away from the\n\t * Tab group.\n\t *\n\t * Here, we put the selected Tab in the navigation path (tabIndex = 0) and remove other\n\t * tabs from navigation path (tabIndex = -1).\n\t */\n\tconst tabIndex = selected ? 0 : -1;\n\n\treturn (\n\t\t<li\n\t\t\tclassName={classNames(className, {\n\t\t\t\t[activeTabClassName]: selected,\n\t\t\t\t[disabledTabClassName]: disabled,\n\t\t\t\t'slds-tabs_default__item': variant === 'default',\n\t\t\t\t'slds-tabs_scoped__item': variant === 'scoped',\n\t\t\t\t'slds-vertical-tabs__nav-item': variant === 'vertical',\n\t\t\t})}\n\t\t\trole=\"presentation\"\n\t\t\tid={id}\n\t\t\ttitle={typeof children === 'string' ? children : undefined}\n\t\t>\n\t\t\t{/* eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS tabs markup uses an anchor for each tab */}\n\t\t\t<a\n\t\t\t\tclassName={classNames({\n\t\t\t\t\t[activeTabClassName]: selected,\n\t\t\t\t\t[disabledTabClassName]: disabled,\n\t\t\t\t\t'slds-tabs_default__link': variant === 'default',\n\t\t\t\t\t'slds-tabs_scoped__link': variant === 'scoped',\n\t\t\t\t\t'slds-vertical-tabs__link': variant === 'vertical',\n\t\t\t\t})}\n\t\t\t\thref=\"#\"\n\t\t\t\trole=\"tab\"\n\t\t\t\tref={setRefs}\n\t\t\t\ttabIndex={tabIndex}\n\t\t\t\taria-controls={panelId}\n\t\t\t\taria-disabled={disabled}\n\t\t\t\taria-selected={selected ? 'true' : 'false'}\n\t\t\t\tonClick={(event) => event.preventDefault()}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{hasError && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={classNames({\n\t\t\t\t\t\t\t'slds-tabs__right-icon': variant !== 'vertical',\n\t\t\t\t\t\t\t'slds-vertical-tabs__right-icon': variant === 'vertical',\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\tassistiveText={{\n\t\t\t\t\t\t\t\tlabel: assistiveText.withErrorIcon,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tcategory=\"utility\"\n\t\t\t\t\t\t\tcontainerClassName=\"slds-icon_container\"\n\t\t\t\t\t\t\tsize=\"x-small\"\n\t\t\t\t\t\t\tname=\"error\"\n\t\t\t\t\t\t\tcolorVariant=\"error\"\n\t\t\t\t\t\t\ttitle={assistiveText.withErrorIcon}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\t\t\t</a>\n\t\t</li>\n\t);\n});\n\nTab.displayName = TAB;\n\nexport default Tab;\n"],"mappings":";;;;;;AA4EA,IAAM,IAAM,GAAmC,GAAO,MAAQ;CAC7D,IAAM,EACL,cAAW,IACX,aACA,YACA,wBAAqB,kBACrB,0BAAuB,iBACvB,cACA,aACA,OACA,aAAU,WACV,cAAW,IACX,WAAQ,IACR,mBAAgB,EAAE,eAAe,yBAAyB,MACvD,GAEE,IAAU,EAAiC,IAAI,GAE/C,KAAW,MAAmC;EAEnD,AADA,EAAQ,UAAU,GACd,OAAO,KAAQ,aAClB,EAAI,CAAI,IACE,MACV,EAA6C,UAAU;CAEzD;CAEA,QAAgB;EACf,AAAI,KAAY,KAAS,EAAQ,WAChC,EAAQ,QAAQ,MAAM;CAExB,CAAC;CAWD,IAAM,IAAW,IAAW,IAAI;CAEhC,OACC,kBAAC,MAAD;EACC,WAAW,EAAW,GAAW;IAC/B,IAAqB;IACrB,IAAuB;GACxB,2BAA2B,MAAY;GACvC,0BAA0B,MAAY;GACtC,gCAAgC,MAAY;EAC7C,CAAC;EACD,MAAK;EACD;EACJ,OAAO,OAAO,KAAa,WAAW,IAAW,KAAA;EAGjD,UAAA,kBAAC,KAAD;GACC,WAAW,EAAW;KACpB,IAAqB;KACrB,IAAuB;IACxB,2BAA2B,MAAY;IACvC,0BAA0B,MAAY;IACtC,4BAA4B,MAAY;GACzC,CAAC;GACD,MAAK;GACL,MAAK;GACL,KAAK;GACK;GACV,iBAAe;GACf,iBAAe;GACf,iBAAe,IAAW,SAAS;GACnC,UAAU,MAAU,EAAM,eAAe;GAf1C,UAAA,CAiBE,GACA,KACA,kBAAC,QAAD;IACC,WAAW,EAAW;KACrB,yBAAyB,MAAY;KACrC,kCAAkC,MAAY;IAC/C,CAAC;IAED,UAAA,kBAAC,GAAD;KACC,eAAe,EACd,OAAO,EAAc,cACtB;KACA,UAAS;KACT,oBAAmB;KACnB,MAAK;KACL,MAAK;KACL,cAAa;KACb,OAAO,EAAc;IACrB,CAAA;GACI,CAAA,CAEL;;CACA,CAAA;AAEN,CAAC;AAED,EAAI,cAAc"}
@@ -9,7 +9,7 @@ process.env.NODE_ENV !== "production" && (i = function(i, a, o) {
9
9
  r(i, {
10
10
  "labels.label": a.labels?.label ?? a.label,
11
11
  "assistiveText.label": a.assistiveText?.label
12
- }, s()), e(i, a.defaultValue !== void 0, "defaultValue", "Textarea is controlled: pass `value` and update it in `onChange`."), typeof a.maxLength == "string" && e(i, a.maxLength, "maxLength", `\`maxLength\` as a string has been deprecated. Please pass a number instead. ${s("maxLength")}`), n(i, a.errorText, "errorText", "labels.error` and `hasError", s("labels")), n(i, a.label, "label", "labels.label", s("labels"));
12
+ }, s()), e(i, a.defaultValue !== void 0, "defaultValue", "Textarea is controlled: pass `value` and update it in `onChange`."), typeof a.maxLength == "string" && e(i, a.maxLength, "maxLength", `\`maxLength\` as a string has been deprecated. Please pass a number instead. ${s("maxLength")}`), n(i, a.onKeyPress, "onKeyPress", "onKeyDown", `\`keypress\` is a deprecated DOM event; read \`event.key\` instead. ${s("onKeyDown")}`), n(i, a.errorText, "errorText", "labels.error` and `hasError", s("labels")), n(i, a.label, "label", "labels.label", s("labels"));
13
13
  });
14
14
  var a = i;
15
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"check-props.js","names":[],"sources":["../../../../components/textarea/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tonlyOneOfProperties(\n\t\t\tCOMPONENT,\n\t\t\t{\n\t\t\t\t'labels.label': props.labels?.label ?? props.label,\n\t\t\t\t'assistiveText.label': props.assistiveText?.label,\n\t\t\t},\n\t\t\tcreateDocUrl()\n\t\t);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.defaultValue !== undefined,\n\t\t\t'defaultValue',\n\t\t\t'Textarea is controlled: pass `value` and update it in `onChange`.'\n\t\t);\n\n\t\tif (typeof props.maxLength === 'string') {\n\t\t\tsunsetProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\tprops.maxLength,\n\t\t\t\t'maxLength',\n\t\t\t\t`\\`maxLength\\` as a string has been deprecated. Please pass a number instead. ${createDocUrl(\n\t\t\t\t\t'maxLength'\n\t\t\t\t)}`\n\t\t\t);\n\t\t}\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.errorText,\n\t\t\t'errorText',\n\t\t\t'labels.error` and `hasError',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t'labels.label',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":";;;;;AAUA,IAAI,IAAa,WAA8B,CAAC;AAEhD,QAAA,IAAA,aAA6B,iBAC5B,IAAa,SAA4B,GAAW,GAAO,GAAS;CACnE,IAAM,IAAe,EAAkB,CAAO;CAoC9C,AAlCA,EACC,GACA;EACC,gBAAgB,EAAM,QAAQ,SAAS,EAAM;EAC7C,uBAAuB,EAAM,eAAe;CAC7C,GACA,EAAa,CACd,GAEA,EACC,GACA,EAAM,iBAAiB,KAAA,GACvB,gBACA,mEACD,GAEI,OAAO,EAAM,aAAc,YAC9B,EACC,GACA,EAAM,WACN,aACA,gFAAgF,EAC/E,WACD,GACD,GAGD,EACC,GACA,EAAM,WACN,aACA,+BACA,EAAa,QAAQ,CACtB,GACA,EACC,GACA,EAAM,OACN,SACA,gBACA,EAAa,QAAQ,CACtB;AACD;AAGD,IAAA,IAAe"}
1
+ {"version":3,"file":"check-props.js","names":[],"sources":["../../../../components/textarea/check-props.js"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n/* eslint-disable import/no-mutable-exports */\n/* eslint-disable max-len */\n\nimport deprecatedProperty from '../../utilities/warning/deprecated-property';\nimport onlyOneOfProperties from '../../utilities/warning/only-one-of-properties';\nimport sunsetProperty from '../../utilities/warning/sunset-property';\nimport getComponentDocFn from '../../utilities/get-component-doc';\n\nlet checkProps = function checkPropsFunction() {};\n\nif (process.env.NODE_ENV !== 'production') {\n\tcheckProps = function checkPropsFunction(COMPONENT, props, jsonDoc) {\n\t\tconst createDocUrl = getComponentDocFn(jsonDoc);\n\n\t\tonlyOneOfProperties(\n\t\t\tCOMPONENT,\n\t\t\t{\n\t\t\t\t'labels.label': props.labels?.label ?? props.label,\n\t\t\t\t'assistiveText.label': props.assistiveText?.label,\n\t\t\t},\n\t\t\tcreateDocUrl()\n\t\t);\n\n\t\tsunsetProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.defaultValue !== undefined,\n\t\t\t'defaultValue',\n\t\t\t'Textarea is controlled: pass `value` and update it in `onChange`.'\n\t\t);\n\n\t\tif (typeof props.maxLength === 'string') {\n\t\t\tsunsetProperty(\n\t\t\t\tCOMPONENT,\n\t\t\t\tprops.maxLength,\n\t\t\t\t'maxLength',\n\t\t\t\t`\\`maxLength\\` as a string has been deprecated. Please pass a number instead. ${createDocUrl(\n\t\t\t\t\t'maxLength'\n\t\t\t\t)}`\n\t\t\t);\n\t\t}\n\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.onKeyPress,\n\t\t\t'onKeyPress',\n\t\t\t'onKeyDown',\n\t\t\t`\\`keypress\\` is a deprecated DOM event; read \\`event.key\\` instead. ${createDocUrl('onKeyDown')}`\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.errorText,\n\t\t\t'errorText',\n\t\t\t'labels.error` and `hasError',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t\tdeprecatedProperty(\n\t\t\tCOMPONENT,\n\t\t\tprops.label,\n\t\t\t'label',\n\t\t\t'labels.label',\n\t\t\tcreateDocUrl('labels')\n\t\t);\n\t};\n}\n\nexport default checkProps;\n"],"mappings":";;;;;AAUA,IAAI,IAAa,WAA8B,CAAC;AAEhD,QAAA,IAAA,aAA6B,iBAC5B,IAAa,SAA4B,GAAW,GAAO,GAAS;CACnE,IAAM,IAAe,EAAkB,CAAO;CA2C9C,AAzCA,EACC,GACA;EACC,gBAAgB,EAAM,QAAQ,SAAS,EAAM;EAC7C,uBAAuB,EAAM,eAAe;CAC7C,GACA,EAAa,CACd,GAEA,EACC,GACA,EAAM,iBAAiB,KAAA,GACvB,gBACA,mEACD,GAEI,OAAO,EAAM,aAAc,YAC9B,EACC,GACA,EAAM,WACN,aACA,gFAAgF,EAC/E,WACD,GACD,GAGD,EACC,GACA,EAAM,YACN,cACA,aACA,uEAAuE,EAAa,WAAW,GAChG,GACA,EACC,GACA,EAAM,WACN,aACA,+BACA,EAAa,QAAQ,CACtB,GACA,EACC,GACA,EAAM,OACN,SACA,gBACA,EAAa,QAAQ,CACtB;AACD;AAGD,IAAA,IAAe"}
@@ -7,71 +7,58 @@ import s from "classnames";
7
7
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  //#region components/textarea/index.tsx
9
9
  var u = i((i, u) => {
10
- let { assistiveText: d, autoFocus: f, children: p, className: m, classNameContainer: h, disabled: g, errorText: _, hasError: v, id: y, label: b, labels: x, maxLength: S, name: C, onBlur: w, onChange: T, onClick: E, onFocus: D, onInput: O, onInvalid: k, onKeyDown: A, onKeyPress: j, onKeyUp: M, onSelect: N, onSubmit: P, placeholder: F, required: I, role: L, value: R, defaultValue: z, wrap: B, ...V } = i;
10
+ let { assistiveText: d, children: f, className: p, classNameContainer: m, errorText: h, hasError: g, id: _, label: v, labels: y, maxLength: b, onChange: x, onKeyPress: S, required: C, defaultValue: w, ...T } = i;
11
11
  n(e, { ...i }, r);
12
- let H = o(), U = o(), W = () => y || H, G = () => V["aria-describedby"] || U, K = t(V), q = d?.label, J = x?.label ?? b, Y = J || q, X = v ?? !!_, Z = X ? x?.error ?? _ : void 0;
12
+ let E = o(), D = o(), O = () => _ || E, k = () => T["aria-describedby"] || D, A = t(T), j = d?.label, M = y?.label ?? v, N = M || j, P = g ?? !!h, F = P ? y?.error ?? h : void 0;
13
13
  return a(() => {
14
14
  n(e, {
15
15
  assistiveText: d,
16
- errorText: _,
17
- label: b,
18
- labels: x
16
+ errorText: h,
17
+ label: v,
18
+ labels: y,
19
+ onKeyPress: S
19
20
  }, r);
20
21
  }, [
21
22
  d,
22
- _,
23
- b,
24
- x
23
+ h,
24
+ v,
25
+ y,
26
+ S
25
27
  ]), /* @__PURE__ */ l("div", {
26
- className: s("slds-form-element", { "slds-has-error": X }, h),
28
+ className: s("slds-form-element", { "slds-has-error": P }, m),
27
29
  children: [
28
- Y && /* @__PURE__ */ l("label", {
29
- className: s("slds-form-element__label", { "slds-assistive-text": q && !J }),
30
- htmlFor: W(),
31
- children: [I && /* @__PURE__ */ c("abbr", {
30
+ N && /* @__PURE__ */ l("label", {
31
+ className: s("slds-form-element__label", { "slds-assistive-text": j && !M }),
32
+ htmlFor: O(),
33
+ children: [C && /* @__PURE__ */ c("abbr", {
32
34
  className: "slds-required",
33
35
  title: "required",
34
36
  children: "*"
35
- }), Y]
37
+ }), N]
36
38
  }),
37
39
  /* @__PURE__ */ c("div", {
38
40
  className: "slds-form-element__control",
39
41
  children: /* @__PURE__ */ c("textarea", {
40
- className: s("slds-textarea", m),
41
- autoFocus: f,
42
- disabled: g,
43
- id: W(),
44
- maxLength: typeof S == "string" ? parseInt(S, 10) : S,
45
- name: C,
46
- onBlur: w,
42
+ ...T,
43
+ ...A,
44
+ className: s("slds-textarea", p),
45
+ id: O(),
46
+ maxLength: typeof b == "string" ? parseInt(b, 10) : b,
47
47
  onChange: (e) => {
48
- T?.(e, { value: e.target.value });
48
+ x?.(e, { value: e.target.value });
49
49
  },
50
- onClick: E,
51
- onFocus: D,
52
- onInput: O,
53
- onInvalid: k,
54
- onKeyDown: A,
55
- onKeyPress: j,
56
- onKeyUp: M,
57
- onSelect: N,
58
- onSubmit: P,
59
- placeholder: F,
50
+ onKeyPress: S,
60
51
  ref: u,
61
- role: L,
62
- required: I,
63
- wrap: B,
64
- value: R,
65
- "aria-describedby": Z ? G() : K["aria-describedby"],
66
- ...K
52
+ required: C,
53
+ "aria-describedby": F ? k() : T["aria-describedby"]
67
54
  })
68
55
  }),
69
- Z && /* @__PURE__ */ c("div", {
70
- id: G(),
56
+ F && /* @__PURE__ */ c("div", {
57
+ id: k(),
71
58
  className: "slds-form-element__help",
72
- children: Z
59
+ children: F
73
60
  }),
74
- p
61
+ f
75
62
  ]
76
63
  });
77
64
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/textarea/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport {\n\tuseId,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype FocusEvent,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\ttype FormEvent,\n\ttype CSSProperties,\n\ttype ReactNode,\n\ttype TextareaHTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { TEXTAREA } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Assistive text for Textarea\n */\nexport interface TextareaAssistiveText {\n\t/** Visually hidden label for screen readers */\n\tlabel?: string;\n}\n\n/**\n * Labels for Textarea\n */\nexport interface TextareaLabels {\n\t/** Error message shown below the textarea while `hasError` is true */\n\terror?: ReactNode;\n\t/** Visible label above the textarea */\n\tlabel?: ReactNode;\n}\n\n/**\n * Data passed to `onChange`\n */\nexport interface TextareaChangeData {\n\t/** The new text */\n\tvalue: string;\n}\n\n/**\n * Props removed in v11. They are ignored at runtime and warn in development.\n */\ninterface TextareaRemovedProps {\n\t/** @removed Textarea is controlled: pass `value` and update it in `onChange`. */\n\tdefaultValue?: unknown;\n}\n\n/**\n * Props for the Textarea component\n */\nexport interface TextareaProps extends Pick<\n\tTextareaHTMLAttributes<HTMLTextAreaElement>,\n\t| 'aria-activedescendant'\n\t| 'aria-autocomplete'\n\t| 'aria-controls'\n\t| 'aria-describedby'\n\t| 'aria-expanded'\n\t| 'aria-haspopup'\n\t| 'aria-labelledby'\n\t| 'aria-owns'\n\t| 'aria-required'\n> {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `label`: Visually hidden label. Use instead of `labels.label`.\n\t */\n\tassistiveText?: TextareaAssistiveText;\n\t/** Autofocus on load (poor UX) */\n\tautoFocus?: boolean;\n\t/** Elements rendered after the textarea, inside the form element */\n\tchildren?: ReactNode;\n\t/** CSS class for textarea element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS class for container */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** Disable the textarea */\n\tdisabled?: boolean;\n\t/** @deprecated Use `labels.error` and `hasError` instead. */\n\terrorText?: string;\n\t/** Puts the textarea in an error state and shows `labels.error` */\n\thasError?: boolean;\n\t/** Unique ID */\n\tid?: string;\n\t/** @deprecated Use `labels.label` instead. */\n\tlabel?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `error`: Error message shown below the textarea while `hasError` is true\n\t * * `label`: Visible label. Use `assistiveText.label` for a visually hidden label.\n\t */\n\tlabels?: TextareaLabels;\n\t/** Maximum character count */\n\tmaxLength?: number;\n\t/** Form parameter name */\n\tname?: string;\n\t/** Blur event handler */\n\tonBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n\t/**\n\t * Called when the text changes. Textarea is controlled: update `value` from\n\t * `data.value`, or the text won't change.\n\t */\n\tonChange: (\n\t\tevent: ChangeEvent<HTMLTextAreaElement>,\n\t\tdata: TextareaChangeData\n\t) => void;\n\t/** Click event handler */\n\tonClick?: (event: MouseEvent<HTMLTextAreaElement>) => void;\n\t/** Focus event handler */\n\tonFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n\t/** Input event handler */\n\tonInput?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Invalid event handler */\n\tonInvalid?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Key down event handler */\n\tonKeyDown?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Key press event handler */\n\tonKeyPress?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Key up event handler */\n\tonKeyUp?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** Select event handler */\n\tonSelect?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Submit event handler */\n\tonSubmit?: (event: FormEvent<HTMLTextAreaElement>) => void;\n\t/** Placeholder text */\n\tplaceholder?: string;\n\t/** Mark as required field */\n\trequired?: boolean;\n\t/** ARIA role */\n\trole?: string;\n\t/** The text in the textarea. Required: Textarea is controlled. */\n\tvalue: string;\n\t/** Text wrapping mode */\n\twrap?: 'soft' | 'hard';\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n}\n\n/**\n * A multi-line plain-text editing control.\n */\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\t(props, ref) => {\n\t\tconst {\n\t\t\tassistiveText,\n\t\t\tautoFocus,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\tdisabled,\n\t\t\terrorText,\n\t\t\thasError: hasErrorProp,\n\t\t\tid: propId,\n\t\t\tlabel: labelProp,\n\t\t\tlabels,\n\t\t\tmaxLength,\n\t\t\tname,\n\t\t\tonBlur,\n\t\t\tonChange,\n\t\t\tonClick,\n\t\t\tonFocus,\n\t\t\tonInput,\n\t\t\tonInvalid,\n\t\t\tonKeyDown,\n\t\t\tonKeyPress,\n\t\t\tonKeyUp,\n\t\t\tonSelect,\n\t\t\tonSubmit,\n\t\t\tplaceholder,\n\t\t\trequired,\n\t\t\trole,\n\t\t\tvalue,\n\t\t\t// Removed in v11: destructured so it doesn't reach the DOM. check-props warns.\n\t\t\tdefaultValue: _defaultValue,\n\t\t\twrap,\n\t\t\t...restProps\n\t\t} = props as TextareaProps & TextareaRemovedProps;\n\n\t\tcheckProps(TEXTAREA, { ...props }, componentDoc);\n\n\t\tconst generatedId = useId();\n\t\tconst generatedErrorId = useId();\n\n\t\tconst getId = () => propId || generatedId;\n\t\tconst getErrorId = () => restProps['aria-describedby'] || generatedErrorId;\n\n\t\tconst ariaProps = getAriaProps(restProps);\n\n\t\tconst assistiveTextLabel = assistiveText?.label;\n\n\t\t// `label` is deprecated\n\t\tconst label = labels?.label ?? labelProp;\n\t\tconst labelText = label || assistiveTextLabel;\n\n\t\t// `errorText` is deprecated: it sets both the error state and the message\n\t\tconst hasError = hasErrorProp ?? !!errorText;\n\t\tconst errorMessage = hasError ? (labels?.error ?? errorText) : undefined;\n\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tTEXTAREA,\n\t\t\t\t{ assistiveText, errorText, label: labelProp, labels },\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [assistiveText, errorText, labelProp, labels]);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': hasError,\n\t\t\t\t\t},\n\t\t\t\t\tclassNameContainer as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{labelText && (\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName={classNames('slds-form-element__label', {\n\t\t\t\t\t\t\t'slds-assistive-text': assistiveTextLabel && !label,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t>\n\t\t\t\t\t\t{required && (\n\t\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t</abbr>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{labelText}\n\t\t\t\t\t</label>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\tclassName={classNames('slds-textarea', className as string)}\n\t\t\t\t\t\tautoFocus={autoFocus}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\tid={getId()}\n\t\t\t\t\t\tmaxLength={\n\t\t\t\t\t\t\t// Strings are still accepted at runtime for untyped callers; check-props warns.\n\t\t\t\t\t\t\ttypeof maxLength === 'string'\n\t\t\t\t\t\t\t\t? parseInt(maxLength, 10)\n\t\t\t\t\t\t\t\t: maxLength\n\t\t\t\t\t\t}\n\t\t\t\t\t\tname={name}\n\t\t\t\t\t\tonBlur={onBlur}\n\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\tonChange?.(event, { value: event.target.value });\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonClick={onClick}\n\t\t\t\t\t\tonFocus={onFocus}\n\t\t\t\t\t\tonInput={onInput}\n\t\t\t\t\t\tonInvalid={onInvalid}\n\t\t\t\t\t\tonKeyDown={onKeyDown}\n\t\t\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\t\t\tonKeyUp={onKeyUp}\n\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\tonSubmit={onSubmit}\n\t\t\t\t\t\tplaceholder={placeholder}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\trole={role}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\twrap={wrap}\n\t\t\t\t\t\tvalue={value}\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\terrorMessage\n\t\t\t\t\t\t\t\t? getErrorId()\n\t\t\t\t\t\t\t\t: ((ariaProps as Record<string, unknown>)[\n\t\t\t\t\t\t\t\t\t\t'aria-describedby'\n\t\t\t\t\t\t\t\t\t] as string | undefined)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{errorMessage && (\n\t\t\t\t\t<div id={getErrorId()} className=\"slds-form-element__help\">\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nTextarea.displayName = TEXTAREA;\n\nexport default Textarea;\n"],"mappings":";;;;;;;;AAqJA,IAAM,IAAW,GACf,GAAO,MAAQ;CACf,IAAM,EACL,kBACA,cACA,aACA,cACA,uBACA,aACA,cACA,UAAU,GACV,IAAI,GACJ,OAAO,GACP,WACA,cACA,SACA,WACA,aACA,YACA,YACA,YACA,cACA,cACA,eACA,YACA,aACA,aACA,gBACA,aACA,SACA,UAEA,cAAc,GACd,SACA,GAAG,MACA;CAEJ,EAAW,GAAU,EAAE,GAAG,EAAM,GAAG,CAAY;CAE/C,IAAM,IAAc,EAAM,GACpB,IAAmB,EAAM,GAEzB,UAAc,KAAU,GACxB,UAAmB,EAAU,uBAAuB,GAEpD,IAAY,EAAa,CAAS,GAElC,IAAqB,GAAe,OAGpC,IAAQ,GAAQ,SAAS,GACzB,IAAY,KAAS,GAGrB,IAAW,KAAgB,CAAC,CAAC,GAC7B,IAAe,IAAY,GAAQ,SAAS,IAAa,KAAA;CAU/D,OARA,QAAgB;EACf,EACC,GACA;GAAE;GAAe;GAAW,OAAO;GAAW;EAAO,GACrD,CACD;CACD,GAAG;EAAC;EAAe;EAAW;EAAW;CAAM,CAAC,GAG/C,kBAAC,OAAD;EACC,WAAW,EACV,qBACA,EACC,kBAAkB,EACnB,GACA,CACD;EAPD,UAAA;GASE,KACA,kBAAC,SAAD;IACC,WAAW,EAAW,4BAA4B,EACjD,uBAAuB,KAAsB,CAAC,EAC/C,CAAC;IACD,SAAS,EAAM;IAJhB,UAAA,CAME,KACA,kBAAC,QAAD;KAAM,WAAU;KAAgB,OAAM;KAAW,UAAA;IAE3C,CAAA,GAEN,CACK;;GAER,kBAAC,OAAD;IAAK,WAAU;IACd,UAAA,kBAAC,YAAD;KACC,WAAW,EAAW,iBAAiB,CAAmB;KAC/C;KACD;KACV,IAAI,EAAM;KACV,WAEC,OAAO,KAAc,WAClB,SAAS,GAAW,EAAE,IACtB;KAEE;KACE;KACR,WAAW,MAAU;MACpB,IAAW,GAAO,EAAE,OAAO,EAAM,OAAO,MAAM,CAAC;KAChD;KACS;KACA;KACA;KACE;KACA;KACC;KACH;KACC;KACA;KACG;KACR;KACC;KACI;KACJ;KACC;KACP,oBACC,IACG,EAAW,IACT,EACF;KAGJ,GAAI;IACJ,CAAA;GACG,CAAA;GACJ,KACA,kBAAC,OAAD;IAAK,IAAI,EAAW;IAAG,WAAU;IAC/B,UAAA;GACG,CAAA;GAEL;EACG;;AAEP,CACD;AAEA,EAAS,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/textarea/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport {\n\tuseId,\n\tuseEffect,\n\tforwardRef,\n\ttype ChangeEvent,\n\ttype KeyboardEvent,\n\ttype ReactNode,\n\ttype TextareaHTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\nimport getAriaProps from '../../utilities/get-aria-props';\nimport { TEXTAREA } from '../../utilities/constants';\nimport checkProps from './check-props';\nimport componentDoc from './component.json';\n\n/**\n * Assistive text for Textarea\n */\nexport interface TextareaAssistiveText {\n\t/** Visually hidden label for screen readers */\n\tlabel?: string;\n}\n\n/**\n * Labels for Textarea\n */\nexport interface TextareaLabels {\n\t/** Error message shown below the textarea while `hasError` is true */\n\terror?: ReactNode;\n\t/** Visible label above the textarea */\n\tlabel?: ReactNode;\n}\n\n/**\n * Data passed to `onChange`\n */\nexport interface TextareaChangeData {\n\t/** The new text */\n\tvalue: string;\n}\n\n/**\n * Props removed in v11. They are ignored at runtime and warn in development.\n */\ninterface TextareaRemovedProps {\n\t/** @removed Textarea is controlled: pass `value` and update it in `onChange`. */\n\tdefaultValue?: unknown;\n}\n\n/**\n * Props for the Textarea component.\n *\n * Other `<textarea>` attributes (`rows`, `cols`, `autoComplete`, `readOnly`,\n * …) pass through to the element via `TextareaHTMLAttributes` — the same\n * approach as `Button` / `ButtonHTMLAttributes`, and equivalent to\n * `React.ComponentProps<'textarea'>` without `ref` (ref is via `forwardRef`).\n */\nexport interface TextareaProps extends Omit<\n\tTextareaHTMLAttributes<HTMLTextAreaElement>,\n\t'children' | 'className' | 'defaultValue' | 'onChange' | 'value'\n> {\n\t/**\n\t * **Assistive text for accessibility**\n\t * * `label`: Visually hidden label. Use instead of `labels.label`.\n\t */\n\tassistiveText?: TextareaAssistiveText;\n\t/** Elements rendered after the textarea, inside the form element */\n\tchildren?: ReactNode;\n\t/** CSS class for textarea element */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** CSS class for container */\n\tclassNameContainer?: string | string[] | Record<string, boolean>;\n\t/** @deprecated Use `labels.error` and `hasError` instead. */\n\terrorText?: string;\n\t/** Puts the textarea in an error state and shows `labels.error` */\n\thasError?: boolean;\n\t/** @deprecated Use `labels.label` instead. */\n\tlabel?: string;\n\t/**\n\t * **Text labels for internationalization**\n\t * * `error`: Error message shown below the textarea while `hasError` is true\n\t * * `label`: Visible label. Use `assistiveText.label` for a visually hidden label.\n\t */\n\tlabels?: TextareaLabels;\n\t/**\n\t * Called when the text changes. Textarea is controlled: update `value` from\n\t * `data.value`, or the text won't change.\n\t */\n\tonChange: (\n\t\tevent: ChangeEvent<HTMLTextAreaElement>,\n\t\tdata: TextareaChangeData\n\t) => void;\n\t/**\n\t * @deprecated `keypress` is a deprecated DOM event. Use `onKeyDown` and read\n\t * `event.key` instead. Works only in the 11.0.0 release candidates, and warns.\n\t */\n\tonKeyPress?: (event: KeyboardEvent<HTMLTextAreaElement>) => void;\n\t/** The text in the textarea. Required: Textarea is controlled. */\n\tvalue: string;\n\t/** Text wrapping mode */\n\twrap?: 'soft' | 'hard';\n}\n\n/**\n * A multi-line plain-text editing control.\n */\nconst Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(\n\t(props, ref) => {\n\t\tconst {\n\t\t\tassistiveText,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tclassNameContainer,\n\t\t\terrorText,\n\t\t\thasError: hasErrorProp,\n\t\t\tid: propId,\n\t\t\tlabel: labelProp,\n\t\t\tlabels,\n\t\t\tmaxLength,\n\t\t\tonChange,\n\t\t\tonKeyPress,\n\t\t\trequired,\n\t\t\t// Removed in v11: destructured so it doesn't reach the DOM. check-props warns.\n\t\t\tdefaultValue: _defaultValue,\n\t\t\t...restProps\n\t\t} = props as TextareaProps & TextareaRemovedProps;\n\n\t\tcheckProps(TEXTAREA, { ...props }, componentDoc);\n\n\t\tconst generatedId = useId();\n\t\tconst generatedErrorId = useId();\n\n\t\tconst getId = () => propId || generatedId;\n\t\tconst getErrorId = () => restProps['aria-describedby'] || generatedErrorId;\n\n\t\tconst ariaProps = getAriaProps(restProps);\n\n\t\tconst assistiveTextLabel = assistiveText?.label;\n\n\t\t// `label` is deprecated\n\t\tconst label = labels?.label ?? labelProp;\n\t\tconst labelText = label || assistiveTextLabel;\n\n\t\t// `errorText` is deprecated: it sets both the error state and the message\n\t\tconst hasError = hasErrorProp ?? !!errorText;\n\t\tconst errorMessage = hasError ? (labels?.error ?? errorText) : undefined;\n\n\t\tuseEffect(() => {\n\t\t\tcheckProps(\n\t\t\t\tTEXTAREA,\n\t\t\t\t{ assistiveText, errorText, label: labelProp, labels, onKeyPress },\n\t\t\t\tcomponentDoc\n\t\t\t);\n\t\t}, [assistiveText, errorText, labelProp, labels, onKeyPress]);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclassName={classNames(\n\t\t\t\t\t'slds-form-element',\n\t\t\t\t\t{\n\t\t\t\t\t\t'slds-has-error': hasError,\n\t\t\t\t\t},\n\t\t\t\t\tclassNameContainer as string\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{labelText && (\n\t\t\t\t\t<label\n\t\t\t\t\t\tclassName={classNames('slds-form-element__label', {\n\t\t\t\t\t\t\t'slds-assistive-text': assistiveTextLabel && !label,\n\t\t\t\t\t\t})}\n\t\t\t\t\t\thtmlFor={getId()}\n\t\t\t\t\t>\n\t\t\t\t\t\t{required && (\n\t\t\t\t\t\t\t<abbr className=\"slds-required\" title=\"required\">\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t</abbr>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{labelText}\n\t\t\t\t\t</label>\n\t\t\t\t)}\n\t\t\t\t<div className=\"slds-form-element__control\">\n\t\t\t\t\t<textarea\n\t\t\t\t\t\t{...restProps}\n\t\t\t\t\t\t{...ariaProps}\n\t\t\t\t\t\tclassName={classNames('slds-textarea', className as string)}\n\t\t\t\t\t\tid={getId()}\n\t\t\t\t\t\tmaxLength={\n\t\t\t\t\t\t\t// Strings are still accepted at runtime for untyped callers; check-props warns.\n\t\t\t\t\t\t\ttypeof maxLength === 'string'\n\t\t\t\t\t\t\t\t? parseInt(maxLength, 10)\n\t\t\t\t\t\t\t\t: maxLength\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={(event) => {\n\t\t\t\t\t\t\tonChange?.(event, { value: event.target.value });\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t// eslint-disable-next-line local/no-deprecated -- forwards the deprecated `onKeyPress` prop until 11.0\n\t\t\t\t\t\tonKeyPress={onKeyPress}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t\trequired={required}\n\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\terrorMessage ? getErrorId() : restProps['aria-describedby']\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{errorMessage && (\n\t\t\t\t\t<div id={getErrorId()} className=\"slds-form-element__help\">\n\t\t\t\t\t\t{errorMessage}\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nTextarea.displayName = TEXTAREA;\n\nexport default Textarea;\n"],"mappings":";;;;;;;;AA6GA,I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KACA,kBAAC,OAAD;IAAK,IAAI,EAAW;IAAG,WAAU;IAC/B,UAAA;GACG,CAAA;GAEL;EACG;;AAEP,CACD;AAEA,EAAS,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../components/toast/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\ttype ReactElement,\n\ttype ReactNode,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from '../../utilities/class-names';\nimport EventUtil from '../../utilities/event';\nimport Button from '../button';\nimport Icon, { type IconProps } from '../icon';\nimport { TOAST } from '../../utilities/constants';\nimport DOMElementFocus from '../../utilities/dom-element-focus';\n\n/**\n * Toast variant types\n */\nexport type ToastVariant = 'error' | 'info' | 'success' | 'warning';\n\n/**\n * Assistive text for Toast\n */\nexport interface ToastAssistiveText {\n\t/** Close button assistive text */\n\tcloseButton?: ReactNode;\n\t/** Error variant label */\n\terror?: string;\n\t/** Info variant label */\n\tinfo?: string;\n\t/** Success variant label */\n\tsuccess?: string;\n\t/** Warning variant label */\n\twarning?: string;\n}\n\n/**\n * Labels for Toast\n */\nexport interface ToastLabels {\n\t/** Secondary text below heading */\n\tdetails?: ReactNode;\n\t/** Main heading content */\n\theading?: ReactNode;\n\t/** Link text in heading */\n\theadingLink?: ReactNode;\n}\n\n/**\n * What caused a Toast close request\n */\nexport type ToastRequestCloseTrigger = 'timeout' | 'close-button';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface ToastRequestCloseData {\n\t/** What caused the request: the close button was clicked, or `duration` elapsed */\n\ttrigger: ToastRequestCloseTrigger;\n}\n\n/**\n * Props for the Toast component\n */\nexport interface ToastProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ToastAssistiveText;\n\t/** CSS classes for the toast */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Show the close button. `onRequestClose` is called with `trigger: 'close-button'` when it is clicked. */\n\tdismissible?: boolean;\n\t/** Auto-dismiss duration in milliseconds */\n\tduration?: number;\n\t/**\n\t * `Icon` shown before the message (defaults to variant-specific icon). Its `size` and\n\t * `inverse` default to 'small' and `true`; its `containerClassName` is added to the spacing classes.\n\t */\n\ticon?: ReactElement<IconProps>;\n\t/** Text labels */\n\tlabels?: ToastLabels;\n\t/**\n\t * Callback when the heading link is clicked. It receives the anchor's click event only;\n\t * like a native `onClick`, there is no `data` argument.\n\t */\n\tonClickHeadingLink?: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n\t/**\n\t * Callback when close button is clicked or duration expires. `event` is the close\n\t * button click, or `undefined` when the `duration` timer fires. `data.trigger` is\n\t * `'close-button'` or `'timeout'`.\n\t */\n\tonRequestClose?: (\n\t\tevent: React.MouseEvent<HTMLButtonElement> | undefined,\n\t\tdata: ToastRequestCloseData\n\t) => void;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n\t/** Toast type/severity (default `info`) */\n\tvariant?: ToastVariant;\n}\n\nconst defaultAssistiveText: ToastAssistiveText = {\n\tcloseButton: 'Close',\n\terror: 'error',\n\tinfo: 'info',\n\tsuccess: 'success',\n\twarning: 'warning',\n};\n\nconst defaultLabels: ToastLabels = {};\n\nconst defaultIcons: Record<ToastVariant, ReactNode> = {\n\tinfo: <Icon category=\"utility\" name=\"info\" />,\n\tsuccess: <Icon category=\"utility\" name=\"success\" />,\n\twarning: <Icon category=\"utility\" name=\"warning\" />,\n\terror: <Icon category=\"utility\" name=\"error\" />,\n};\n\n/**\n * Toast serves as a feedback & confirmation mechanism after the user takes an action.\n */\nconst Toast = ({\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdismissible = false,\n\tduration,\n\ticon: propIcon,\n\tlabels: propLabels,\n\tonClickHeadingLink,\n\tonRequestClose,\n\tstyle,\n\tvariant = 'info',\n}: ToastProps): React.ReactElement => {\n\tconst [isInitialRender, setIsInitialRender] = useState(true);\n\tconst toastRef = useRef<HTMLDivElement | null>(null);\n\tconst timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\tconst clearTimeoutRef = useCallback(() => {\n\t\tif (timeoutRef.current) {\n\t\t\tclearTimeout(timeoutRef.current);\n\t\t\ttimeoutRef.current = null;\n\t\t}\n\t}, []);\n\n\t// Keep the latest callback in a ref so a new (e.g. inline) `onRequestClose`\n\t// on each parent render does not restart the auto-dismiss timer.\n\tconst onRequestCloseRef = useRef(onRequestClose);\n\tuseEffect(() => {\n\t\tonRequestCloseRef.current = onRequestClose;\n\t}, [onRequestClose]);\n\n\tconst handleTimeout = useCallback(() => {\n\t\tclearTimeoutRef();\n\t\tonRequestCloseRef.current?.(undefined, { trigger: 'timeout' });\n\t}, [clearTimeoutRef]);\n\n\tconst handleCloseButtonClick = useCallback(\n\t\t(event: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\tonRequestClose?.(event, { trigger: 'close-button' });\n\t\t},\n\t\t[onRequestClose]\n\t);\n\n\t// Set up auto-dismiss timer\n\tuseEffect(() => {\n\t\tif (duration) {\n\t\t\ttimeoutRef.current = setTimeout(handleTimeout, duration);\n\t\t}\n\t\treturn () => {\n\t\t\tclearTimeoutRef();\n\t\t\tDOMElementFocus.returnFocusToStoredElement();\n\t\t};\n\t}, [duration, handleTimeout, clearTimeoutRef]);\n\n\t// Handle initial focus\n\tconst saveToastRef = useCallback(\n\t\t(element: HTMLDivElement | null) => {\n\t\t\ttoastRef.current = element;\n\t\t\tif (isInitialRender && element) {\n\t\t\t\tDOMElementFocus.storeActiveElement();\n\t\t\t\telement.focus();\n\t\t\t\tsetIsInitialRender(false);\n\t\t\t}\n\t\t},\n\t\t[isInitialRender]\n\t);\n\n\t// Get the icon to display\n\tconst icon = propIcon || defaultIcons[variant];\n\n\tconst clonedIcon = React.isValidElement<IconProps>(icon)\n\t\t? React.cloneElement(icon, {\n\t\t\t\tcontainerClassName: classNames(\n\t\t\t\t\t'slds-m-right_small slds-no-flex slds-align-top',\n\t\t\t\t\ticon.props.containerClassName\n\t\t\t\t),\n\t\t\t\tinverse: icon.props.inverse ?? true,\n\t\t\t\tsize: icon.props.size ?? 'small',\n\t\t\t})\n\t\t: icon;\n\n\tconst assistiveTextVariant: Record<ToastVariant, string | undefined> = {\n\t\tinfo: assistiveText.info,\n\t\tsuccess: assistiveText.success,\n\t\twarning: assistiveText.warning,\n\t\terror: assistiveText.error,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-notify slds-notify_toast',\n\t\t\t\t{\n\t\t\t\t\t'slds-theme_info': variant === 'info',\n\t\t\t\t\t'slds-theme_success': variant === 'success',\n\t\t\t\t\t'slds-theme_warning': variant === 'warning',\n\t\t\t\t\t'slds-theme_error': variant === 'error',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tref={saveToastRef}\n\t\t\trole=\"status\"\n\t\t\tstyle={style}\n\t\t\ttabIndex={0}\n\t\t>\n\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t{assistiveTextVariant[variant]}\n\t\t\t</span>\n\t\t\t{clonedIcon}\n\t\t\t<div className=\"slds-notify__content\">\n\t\t\t\t<h2 className=\"slds-text-heading_small\">\n\t\t\t\t\t{labels.heading}{' '}\n\t\t\t\t\t{labels.headingLink && (\n\t\t\t\t\t\t<a onClick={EventUtil.trappedHandler(onClickHeadingLink)} href=\"#\">\n\t\t\t\t\t\t\t{labels.headingLink}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t)}\n\t\t\t\t</h2>\n\t\t\t\t{labels.details && <p>{labels.details}</p>}\n\t\t\t</div>\n\t\t\t{dismissible && (\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: assistiveText.closeButton as string }}\n\t\t\t\t\tclassName=\"slds-notify__close\"\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\ticonSize=\"medium\"\n\t\t\t\t\tinverse\n\t\t\t\t\tonClick={handleCloseButtonClick}\n\t\t\t\t\ttitle={assistiveText.closeButton as string}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nToast.displayName = TOAST;\n\nexport default Toast;\n"],"mappings":";;;;;;;;;AAwGA,IAAM,IAA2C;CAChD,aAAa;CACb,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACV,GAEM,IAA6B,CAAC,GAE9B,IAAgD;CACrD,MAAM,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAQ,CAAA;CAC5C,SAAS,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAW,CAAA;CAClD,SAAS,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAW,CAAA;CAClD,OAAO,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAS,CAAA;AAC/C,GAKM,KAAS,EACd,eAAe,GACf,cACA,iBAAc,IACd,aACA,MAAM,GACN,QAAQ,GACR,uBACA,mBACA,UACA,aAAU,aAC2B;CACrC,IAAM,CAAC,GAAiB,KAAsB,EAAS,EAAI,GACrD,IAAW,EAA8B,IAAI,GAC7C,IAAa,EAA6C,IAAI,GAE9D,IAAgB;EAAE,GAAG;EAAsB,GAAG;CAAkB,GAChE,IAAS;EAAE,GAAG;EAAe,GAAG;CAAW,GAE3C,IAAkB,QAAkB;EACzC,AAEC,EAAW,aADX,aAAa,EAAW,OAAO,GACV;CAEvB,GAAG,CAAC,CAAC,GAIC,IAAoB,EAAO,CAAc;CAC/C,QAAgB;EACf,EAAkB,UAAU;CAC7B,GAAG,CAAC,CAAc,CAAC;CAEnB,IAAM,IAAgB,QAAkB;EAEvC,AADA,EAAgB,GAChB,EAAkB,UAAU,KAAA,GAAW,EAAE,SAAS,UAAU,CAAC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AAD,EAAA,UAAI,EAAO,QAAW,CAAA,CACrC;;GACJ,KACA,kBAAC,GAAD;IACC,eAAe,EAAE,MAAM,EAAc,YAAsB;IAC3D,WAAU;IACV,cAAa;IACb,UAAS;IACT,UAAS;IACT,SAAA;IACA,SAAS;IACT,OAAO,EAAc;IACrB,SAAQ;GACR,CAAA;EAEE;;AAEP;AAEA,EAAM,cAAc"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../components/toast/index.tsx"],"sourcesContent":["/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */\n/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */\n\nimport React, {\n\tuseState,\n\tuseEffect,\n\tuseRef,\n\tuseCallback,\n\ttype ReactElement,\n\ttype ReactNode,\n\ttype CSSProperties,\n} from 'react';\nimport classNames from '../../utilities/class-names';\nimport EventUtil from '../../utilities/event';\nimport Button from '../button';\nimport Icon, { type IconProps } from '../icon';\nimport { TOAST } from '../../utilities/constants';\nimport DOMElementFocus from '../../utilities/dom-element-focus';\n\n/**\n * Toast variant types\n */\nexport type ToastVariant = 'error' | 'info' | 'success' | 'warning';\n\n/**\n * Assistive text for Toast\n */\nexport interface ToastAssistiveText {\n\t/** Close button assistive text */\n\tcloseButton?: ReactNode;\n\t/** Error variant label */\n\terror?: string;\n\t/** Info variant label */\n\tinfo?: string;\n\t/** Success variant label */\n\tsuccess?: string;\n\t/** Warning variant label */\n\twarning?: string;\n}\n\n/**\n * Labels for Toast\n */\nexport interface ToastLabels {\n\t/** Secondary text below heading */\n\tdetails?: ReactNode;\n\t/** Main heading content */\n\theading?: ReactNode;\n\t/** Link text in heading */\n\theadingLink?: ReactNode;\n}\n\n/**\n * What caused a Toast close request\n */\nexport type ToastRequestCloseTrigger = 'timeout' | 'close-button';\n\n/**\n * Data passed to `onRequestClose`\n */\nexport interface ToastRequestCloseData {\n\t/** What caused the request: the close button was clicked, or `duration` elapsed */\n\ttrigger: ToastRequestCloseTrigger;\n}\n\n/**\n * Props for the Toast component\n */\nexport interface ToastProps {\n\t/** Assistive text for accessibility */\n\tassistiveText?: ToastAssistiveText;\n\t/** CSS classes for the toast */\n\tclassName?: string | string[] | Record<string, boolean>;\n\t/** Show the close button. `onRequestClose` is called with `trigger: 'close-button'` when it is clicked. */\n\tdismissible?: boolean;\n\t/** Auto-dismiss duration in milliseconds */\n\tduration?: number;\n\t/**\n\t * `Icon` shown before the message (defaults to variant-specific icon). Its `size` and\n\t * `inverse` default to 'small' and `true`; its `containerClassName` is added to the spacing classes.\n\t */\n\ticon?: ReactElement<IconProps>;\n\t/** Text labels */\n\tlabels?: ToastLabels;\n\t/**\n\t * Callback when the heading link is clicked. It receives the anchor's click event only;\n\t * like a native `onClick`, there is no `data` argument.\n\t */\n\tonClickHeadingLink?: (event: React.MouseEvent<HTMLAnchorElement>) => void;\n\t/**\n\t * Callback when close button is clicked or duration expires. `event` is the close\n\t * button click, or `undefined` when the `duration` timer fires. `data.trigger` is\n\t * `'close-button'` or `'timeout'`.\n\t */\n\tonRequestClose?: (\n\t\tevent: React.MouseEvent<HTMLButtonElement> | undefined,\n\t\tdata: ToastRequestCloseData\n\t) => void;\n\t/** Custom styles */\n\tstyle?: CSSProperties;\n\t/** Toast type/severity (default `info`) */\n\tvariant?: ToastVariant;\n}\n\nconst defaultAssistiveText: ToastAssistiveText = {\n\tcloseButton: 'Close',\n\terror: 'error',\n\tinfo: 'info',\n\tsuccess: 'success',\n\twarning: 'warning',\n};\n\nconst defaultLabels: ToastLabels = {};\n\nconst defaultIcons: Record<ToastVariant, ReactNode> = {\n\tinfo: <Icon category=\"utility\" name=\"info\" />,\n\tsuccess: <Icon category=\"utility\" name=\"success\" />,\n\twarning: <Icon category=\"utility\" name=\"warning\" />,\n\terror: <Icon category=\"utility\" name=\"error\" />,\n};\n\n/**\n * Toast serves as a feedback & confirmation mechanism after the user takes an action.\n */\nconst Toast = ({\n\tassistiveText: propAssistiveText,\n\tclassName,\n\tdismissible = false,\n\tduration,\n\ticon: propIcon,\n\tlabels: propLabels,\n\tonClickHeadingLink,\n\tonRequestClose,\n\tstyle,\n\tvariant = 'info',\n}: ToastProps): React.ReactElement => {\n\tconst [isInitialRender, setIsInitialRender] = useState(true);\n\tconst toastRef = useRef<HTMLDivElement | null>(null);\n\tconst timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tconst assistiveText = { ...defaultAssistiveText, ...propAssistiveText };\n\tconst labels = { ...defaultLabels, ...propLabels };\n\n\tconst clearTimeoutRef = useCallback(() => {\n\t\tif (timeoutRef.current) {\n\t\t\tclearTimeout(timeoutRef.current);\n\t\t\ttimeoutRef.current = null;\n\t\t}\n\t}, []);\n\n\t// Keep the latest callback in a ref so a new (e.g. inline) `onRequestClose`\n\t// on each parent render does not restart the auto-dismiss timer.\n\tconst onRequestCloseRef = useRef(onRequestClose);\n\tuseEffect(() => {\n\t\tonRequestCloseRef.current = onRequestClose;\n\t}, [onRequestClose]);\n\n\tconst handleTimeout = useCallback(() => {\n\t\tclearTimeoutRef();\n\t\tonRequestCloseRef.current?.(undefined, { trigger: 'timeout' });\n\t}, [clearTimeoutRef]);\n\n\tconst handleCloseButtonClick = useCallback(\n\t\t(event: React.MouseEvent<HTMLButtonElement>) => {\n\t\t\tonRequestClose?.(event, { trigger: 'close-button' });\n\t\t},\n\t\t[onRequestClose]\n\t);\n\n\t// Set up auto-dismiss timer\n\tuseEffect(() => {\n\t\tif (duration) {\n\t\t\ttimeoutRef.current = setTimeout(handleTimeout, duration);\n\t\t}\n\t\treturn () => {\n\t\t\tclearTimeoutRef();\n\t\t\tDOMElementFocus.returnFocusToStoredElement();\n\t\t};\n\t}, [duration, handleTimeout, clearTimeoutRef]);\n\n\t// Handle initial focus\n\tconst saveToastRef = useCallback(\n\t\t(element: HTMLDivElement | null) => {\n\t\t\ttoastRef.current = element;\n\t\t\tif (isInitialRender && element) {\n\t\t\t\tDOMElementFocus.storeActiveElement();\n\t\t\t\telement.focus();\n\t\t\t\tsetIsInitialRender(false);\n\t\t\t}\n\t\t},\n\t\t[isInitialRender]\n\t);\n\n\t// Get the icon to display\n\tconst icon = propIcon || defaultIcons[variant];\n\n\tconst clonedIcon = React.isValidElement<IconProps>(icon)\n\t\t? React.cloneElement(icon, {\n\t\t\t\tcontainerClassName: classNames(\n\t\t\t\t\t'slds-m-right_small slds-no-flex slds-align-top',\n\t\t\t\t\ticon.props.containerClassName\n\t\t\t\t),\n\t\t\t\tinverse: icon.props.inverse ?? true,\n\t\t\t\tsize: icon.props.size ?? 'small',\n\t\t\t})\n\t\t: icon;\n\n\tconst assistiveTextVariant: Record<ToastVariant, string | undefined> = {\n\t\tinfo: assistiveText.info,\n\t\tsuccess: assistiveText.success,\n\t\twarning: assistiveText.warning,\n\t\terror: assistiveText.error,\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName={classNames(\n\t\t\t\t'slds-notify slds-notify_toast',\n\t\t\t\t{\n\t\t\t\t\t'slds-theme_info': variant === 'info',\n\t\t\t\t\t'slds-theme_success': variant === 'success',\n\t\t\t\t\t'slds-theme_warning': variant === 'warning',\n\t\t\t\t\t'slds-theme_error': variant === 'error',\n\t\t\t\t},\n\t\t\t\tclassName as string\n\t\t\t)}\n\t\t\tref={saveToastRef}\n\t\t\trole=\"status\"\n\t\t\tstyle={style}\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- the toast is focused on mount so assistive tech announces it\n\t\t\ttabIndex={0}\n\t\t>\n\t\t\t<span className=\"slds-assistive-text\">\n\t\t\t\t{assistiveTextVariant[variant]}\n\t\t\t</span>\n\t\t\t{clonedIcon}\n\t\t\t<div className=\"slds-notify__content\">\n\t\t\t\t<h2 className=\"slds-text-heading_small\">\n\t\t\t\t\t{labels.heading}{' '}\n\t\t\t\t\t{labels.headingLink && (\n\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-is-valid -- SLDS toast markup uses an anchor for the heading link\n\t\t\t\t\t\t<a onClick={EventUtil.trappedHandler(onClickHeadingLink)} href=\"#\">\n\t\t\t\t\t\t\t{labels.headingLink}\n\t\t\t\t\t\t</a>\n\t\t\t\t\t)}\n\t\t\t\t</h2>\n\t\t\t\t{labels.details && <p>{labels.details}</p>}\n\t\t\t</div>\n\t\t\t{dismissible && (\n\t\t\t\t<Button\n\t\t\t\t\tassistiveText={{ icon: assistiveText.closeButton as string }}\n\t\t\t\t\tclassName=\"slds-notify__close\"\n\t\t\t\t\ticonCategory=\"utility\"\n\t\t\t\t\ticonName=\"close\"\n\t\t\t\t\ticonSize=\"medium\"\n\t\t\t\t\tinverse\n\t\t\t\t\tonClick={handleCloseButtonClick}\n\t\t\t\t\ttitle={assistiveText.closeButton as string}\n\t\t\t\t\tvariant=\"icon\"\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n\nToast.displayName = TOAST;\n\nexport default Toast;\n"],"mappings":";;;;;;;;;AAwGA,IAAM,IAA2C;CAChD,aAAa;CACb,OAAO;CACP,MAAM;CACN,SAAS;CACT,SAAS;AACV,GAEM,IAA6B,CAAC,GAE9B,IAAgD;CACrD,MAAM,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAQ,CAAA;CAC5C,SAAS,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAW,CAAA;CAClD,SAAS,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAW,CAAA;CAClD,OAAO,kBAAC,GAAD;EAAM,UAAS;EAAU,MAAK;CAAS,CAAA;AAC/C,GAKM,KAAS,EACd,eAAe,GACf,cACA,iBAAc,IACd,aACA,MAAM,GACN,QAAQ,GACR,uBACA,mBACA,UACA,aAAU,aAC2B;CACrC,IAAM,CAAC,GAAiB,KAAsB,EAAS,EAAI,GACrD,IAAW,EAA8B,IAAI,GAC7C,IAAa,EAA6C,IAAI,GAE9D,IAAgB;EAAE,GAAG;EAAsB,GAAG;CAAkB,GAChE,IAAS;EAAE,GAAG;EAAe,GAAG;CAAW,GAE3C,IAAkB,QAAkB;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